Skip to content

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

  1. Select the terminal text you want to mark
  2. Right-click on the selected text
  3. Choose Mark for AI from the context menu
  4. The selected content will be marked and available for AI analysis

Method 2: Keyboard Shortcut

  1. Select the terminal text you want to mark
  2. Press Cmd+Shift+M (macOS) or Ctrl+Shift+M (Windows/Linux)
  3. The selected content will be marked for AI usage

Method 3: Command Palette

  1. Select the terminal text you want to mark
  2. Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P)
  3. Type "Mark for AI" and select Terminal: Mark Selection for AI
  4. 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

  1. Open the AI Chat panel
  2. Reference the marked content using #terminal-mark
  3. Ask questions about the marked output
  4. Get explanations, solutions, or suggestions

Inline AI Assistance

  1. Use Cmd+I / Ctrl+I to open inline AI chat
  2. The AI will automatically have access to marked terminal content
  3. Ask for help with errors, explanations, or next steps

Error Analysis

When you encounter errors in the terminal:

  1. Mark the error output
  2. Ask the AI to analyze the error
  3. Get suggestions for fixes and solutions
  4. Receive step-by-step troubleshooting guidance

Common Use Cases

Debugging Command Errors

Scenario: A command fails with an error message

  1. Mark the error output in the terminal
  2. Ask the AI: "What does this error mean and how can I fix it?"
  3. Get detailed explanations and solution steps

Example:

bash
$ 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 denied

Mark this output and ask the AI for help with permission issues.

Understanding Complex Output

Scenario: Analyzing verbose command output

  1. Mark the complex output (logs, build results, etc.)
  2. Ask the AI to summarize or explain key points
  3. Get insights into what the output means

Example:

bash
$ docker build .
[+] Building 45.2s (12/12) FINISHED
 => [internal] load build definition from Dockerfile
 => => transferring dockerfile: 32B
 => [internal] load .dockerignore

Mark this output to understand the Docker build process.

Performance Analysis

Scenario: Analyzing performance metrics

  1. Mark performance-related terminal output
  2. Ask the AI to identify bottlenecks or optimization opportunities
  3. Get recommendations for improvements

Log File Analysis

Scenario: Reviewing application logs

  1. Mark relevant log entries
  2. Ask the AI to identify patterns or issues
  3. Get suggestions for log analysis and debugging

Advanced Features

Multiple Marks

You can mark multiple sections of terminal output:

  1. Mark different sections using the same methods
  2. Each mark is stored separately
  3. Reference specific marks in AI conversations
  4. Compare different outputs or time periods

Mark Management

Viewing Marked Content

  1. Open the Marked Content panel
  2. View all currently marked terminal content
  3. See timestamps and context for each mark
  4. Organize marks by project or session

Clearing Marks

  1. Right-click on marked content in the panel
  2. Select Clear Mark to remove individual marks
  3. Use Clear All Marks to remove all marked content
  4. 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

  1. Mark Relevant Content: Focus on error messages, warnings, and important output
  2. Include Context: Mark enough content to provide context for the AI
  3. Be Specific: Mark specific sections rather than entire terminal sessions
  4. Regular Cleanup: Clear old marks to keep the workspace organized

AI Interaction

  1. Ask Specific Questions: Be clear about what you want to know
  2. Provide Context: Explain what you were trying to achieve
  3. Follow Up: Ask clarifying questions if needed
  4. Apply Suggestions: Try the AI's recommendations and provide feedback

Workflow Integration

  1. Mark as You Go: Mark content immediately when issues arise
  2. Use with Documentation: Combine marked content with relevant documentation
  3. Share with Team: Use marked content to communicate issues with teammates
  4. 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

  1. Avoid Marking Secrets: Don't mark content containing passwords, API keys, or tokens
  2. Review Before Sharing: Check marked content before sending to AI
  3. Use Privacy Mode: Enable privacy mode for sensitive projects
  4. Clear Sensitive Marks: Remove marks containing sensitive information promptly

Troubleshooting

Common Issues

Marking Not Working

  1. Ensure text is properly selected
  2. Check if terminal is in focus
  3. Verify keyboard shortcuts are not conflicting
  4. Restart Trae if the feature becomes unresponsive

AI Not Recognizing Marks

  1. Verify marks are visible in the Marked Content panel
  2. Check AI service connectivity
  3. Ensure marks contain sufficient context
  4. Try re-marking the content

Performance Issues

  1. Clear old marks regularly
  2. Avoid marking extremely large outputs
  3. Use specific selections rather than entire terminal content
  4. Check system resources and AI service status

Keyboard Shortcuts Reference

ShortcutActionDescription
Cmd+Shift+M / Ctrl+Shift+MMark SelectionMark selected terminal text for AI
Cmd+Shift+U / Ctrl+Shift+UClear All MarksRemove all marked content
Cmd+M / Ctrl+MToggle Mark PanelShow/hide marked content panel

Your Ultimate AI-Powered IDE Learning Guide