Terminal Mark for AI Usage
Trae's Terminal Mark for AI Usage feature allows you to mark specific terminal outputs and commands for AI analysis and assistance. This powerful feature helps you get contextual AI help based on your terminal activities and command results.
Overview
The Terminal Mark feature enables you to:
- Mark terminal output for AI analysis
- Get AI assistance with command errors
- Receive suggestions for command optimization
- Analyze log files and debug information
- Get explanations for complex terminal output
How to Mark Terminal Content
Method 1: Right-Click Context Menu
- Select the terminal text you want to mark
- Right-click on the selected text
- Choose Mark for AI from the context menu
- The selected content will be marked and available for AI analysis
Method 2: Keyboard Shortcut
- Select the terminal text you want to mark
- Press
Cmd+Shift+M(macOS) orCtrl+Shift+M(Windows/Linux) - The selected content will be marked for AI usage
Method 3: Command Palette
- Select the terminal text you want to mark
- Open Command Palette (
Cmd+Shift+P/Ctrl+Shift+P) - Type "Mark for AI" and select Terminal: Mark Selection for AI
- The content will be marked and ready for AI analysis
Using Marked Content with AI
Once you've marked terminal content, you can use it in several ways:
AI Chat Integration
- Open the AI Chat panel
- Reference the marked content using
#terminal-mark - Ask questions about the marked output
- Get explanations, solutions, or suggestions
Inline AI Assistance
- Use
Cmd+I/Ctrl+Ito open inline AI chat - The AI will automatically have access to marked terminal content
- Ask for help with errors, explanations, or next steps
Error Analysis
When you encounter errors in the terminal:
- Mark the error output
- Ask the AI to analyze the error
- Get suggestions for fixes and solutions
- Receive step-by-step troubleshooting guidance
Common Use Cases
Debugging Command Errors
Scenario: A command fails with an error message
- Mark the error output in the terminal
- Ask the AI: "What does this error mean and how can I fix it?"
- Get detailed explanations and solution steps
Example:
$ npm install
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /usr/local/lib/node_modules/package.json
npm ERR! errno -13
npm ERR! Error: EACCES: permission deniedMark this output and ask the AI for help with permission issues.
Understanding Complex Output
Scenario: Analyzing verbose command output
- Mark the complex output (logs, build results, etc.)
- Ask the AI to summarize or explain key points
- Get insights into what the output means
Example:
$ docker build .
[+] Building 45.2s (12/12) FINISHED
=> [internal] load build definition from Dockerfile
=> => transferring dockerfile: 32B
=> [internal] load .dockerignoreMark this output to understand the Docker build process.
Performance Analysis
Scenario: Analyzing performance metrics
- Mark performance-related terminal output
- Ask the AI to identify bottlenecks or optimization opportunities
- Get recommendations for improvements
Log File Analysis
Scenario: Reviewing application logs
- Mark relevant log entries
- Ask the AI to identify patterns or issues
- Get suggestions for log analysis and debugging
Advanced Features
Multiple Marks
You can mark multiple sections of terminal output:
- Mark different sections using the same methods
- Each mark is stored separately
- Reference specific marks in AI conversations
- Compare different outputs or time periods
Mark Management
Viewing Marked Content
- Open the Marked Content panel
- View all currently marked terminal content
- See timestamps and context for each mark
- Organize marks by project or session
Clearing Marks
- Right-click on marked content in the panel
- Select Clear Mark to remove individual marks
- Use Clear All Marks to remove all marked content
- Marks are automatically cleared when closing Trae
Context Preservation
Marked content includes:
- Command Context: The command that generated the output
- Timestamp: When the output was generated
- Working Directory: The directory where the command was run
- Environment: Relevant environment variables and settings
Integration with AI Features
Smart Suggestions
The AI can provide smart suggestions based on marked content:
- Command Alternatives: Better ways to achieve the same result
- Flag Recommendations: Useful command flags and options
- Workflow Improvements: Suggestions for optimizing your workflow
Learning from Patterns
The AI learns from your marked content to:
- Recognize common error patterns
- Suggest preventive measures
- Provide personalized recommendations
- Improve future assistance quality
Best Practices
Effective Marking
- Mark Relevant Content: Focus on error messages, warnings, and important output
- Include Context: Mark enough content to provide context for the AI
- Be Specific: Mark specific sections rather than entire terminal sessions
- Regular Cleanup: Clear old marks to keep the workspace organized
AI Interaction
- Ask Specific Questions: Be clear about what you want to know
- Provide Context: Explain what you were trying to achieve
- Follow Up: Ask clarifying questions if needed
- Apply Suggestions: Try the AI's recommendations and provide feedback
Workflow Integration
- Mark as You Go: Mark content immediately when issues arise
- Use with Documentation: Combine marked content with relevant documentation
- Share with Team: Use marked content to communicate issues with teammates
- Learn from Solutions: Review successful solutions for future reference
Privacy and Security
Data Handling
- Marked content is processed locally when possible
- Sensitive information should be redacted before marking
- Marks are not permanently stored unless explicitly saved
- Content is encrypted during transmission to AI services
Security Considerations
- Avoid Marking Secrets: Don't mark content containing passwords, API keys, or tokens
- Review Before Sharing: Check marked content before sending to AI
- Use Privacy Mode: Enable privacy mode for sensitive projects
- Clear Sensitive Marks: Remove marks containing sensitive information promptly
Troubleshooting
Common Issues
Marking Not Working
- Ensure text is properly selected
- Check if terminal is in focus
- Verify keyboard shortcuts are not conflicting
- Restart Trae if the feature becomes unresponsive
AI Not Recognizing Marks
- Verify marks are visible in the Marked Content panel
- Check AI service connectivity
- Ensure marks contain sufficient context
- Try re-marking the content
Performance Issues
- Clear old marks regularly
- Avoid marking extremely large outputs
- Use specific selections rather than entire terminal content
- Check system resources and AI service status
Keyboard Shortcuts Reference
| Shortcut | Action | Description |
|---|---|---|
Cmd+Shift+M / Ctrl+Shift+M | Mark Selection | Mark selected terminal text for AI |
Cmd+Shift+U / Ctrl+Shift+U | Clear All Marks | Remove all marked content |
Cmd+M / Ctrl+M | Toggle Mark Panel | Show/hide marked content panel |