Trae Prompts
Relevant source files
The following files were used as context for generating this wiki page:
Trae Prompts define the operational logic and identity of Trae AI, an agentic AI coding assistant integrated within a specialized IDE. These prompts establish a collaborative "AI Flow" paradigm where the agent works independently or alongside the user to solve complex coding tasks, including codebase creation, debugging, and general software development queries.
The system is designed to act as a professional pair programmer that prioritizes accuracy, security, and idiomatic code changes while maintaining a conversational yet technical tone.
Sources: Trae/Chat Prompt.txt:1-10, Trae/Builder Prompt.txt:1-15
Core Agent Identity and Paradigm
Trae AI operates as a powerful agentic assistant within a specific IDE environment. It follows a step-by-step reasoning process to determine whether to call tools or respond directly to user inputs.
Operational Principles
- AI Flow Paradigm: Enables both independent task execution and collaborative problem-solving.
- Context Awareness: Automatically incorporates IDE metadata such as open files, cursor position, and edit history into its reasoning process.
- Professionalism: Maintains a conversational but professional demeanor, referring to itself in the first person and the user in the second person.
Sources: Trae/Chat Prompt.txt:1-6, Trae/Builder Prompt.txt:1-15, Trae/Builder Prompt.txt:20-25
Interaction Flow and Logic
The following diagram illustrates the high-level logic used by Trae AI when processing a user request.
This flow ensures that the agent gathers sufficient context from the codebase before attempting to provide a solution or implement changes.
Sources: Trae/Builder Prompt.txt:11-18, Trae/Chat Prompt.txt:11-18
Task Management and State Tracking
For complex, multi-step tasks, Trae AI employs a systematic "Todo List" approach. This ensures visibility for the user and prevents the agent from losing track of requirements during long horizons of work.
Task States
| State | Description |
|---|---|
pending | Task has been identified but work has not started. |
in_progress | Currently active task. Only one task can be in this state at a time. |
completed | Task finished successfully and verified. |
Sources: Trae/Builder Prompt.txt:194-205
Task Management Rules
- Atomicity: Break complex tasks into smaller, actionable items.
- Real-time Updates: Mark tasks as completed immediately upon finishing, rather than batching completions.
- Verification: Never mark a task as completed if tests are failing or the implementation is partial.
- Error Handling: If blocked, create a new task specifically describing the resolution needed.
Sources: Trae/Builder Prompt.txt:207-220, Qoder/prompt.txt:40-55
Tooling and External API Integration
Trae AI utilizes a specific suite of tools to interact with the filesystem, terminal, and external services.
Core Toolset
| Tool Name | Purpose |
|---|---|
search_codebase | Locates symbols or semantic concepts across the repo. |
edit_file_fast_apply | Implements precise code changes. |
run_command | Executes shell commands (compilation, tests, etc.). |
web_search | Gathers real-time information and documentation. |
todo_write | Manages the internal task list. |
Sources: Trae/Builder Prompt.txt:118-135, Trae/Builder Tools.json
Integration Guidelines
- Search and Reading: Prefer reading larger file sections in a single call to minimize tool invocations.
- External APIs: Use the most suited APIs for a task without seeking explicit permission, unless an API key is required.
- Parallelism: Invoke multiple independent tools simultaneously (e.g., reading 3 files at once) to maximize efficiency.
Sources: Trae/Builder Prompt.txt:31-38, Trae/Builder Prompt.txt:75-85, Qoder/prompt.txt:80-90
Code Change and Debugging Standards
When modifying a codebase, Trae AI follows strict idiomatic and security guidelines to ensure the code is maintainable and safe.
Implementation Workflow
Key Coding Rules
- Minimalism: Use the fewest steps possible to complete a change.
- Idiomatic Code: Mimic existing file conventions, naming styles, and library choices found in
package.jsonorrequirements.txt. - Security: Never hardcode secrets or keys. Follow security best practices for external integrations.
- UI/UX: When building web apps, prioritize modern design and UX best practices. SVG is the mandatory format for image creation.
Sources: Trae/Builder Prompt.txt:41-70, Trae/Chat Prompt.txt:28-40, Qoder/prompt.txt:130-150
Conclusion
Trae Prompts establish a robust framework for an AI coding assistant that balances autonomy with user visibility. By utilizing structured task management, parallel tool execution, and strict adherence to codebase conventions, the agent provides a high-quality development experience tailored to the specific context of the project.