OpenCode System Prompt Discussion
opencode system prompt
Perfect! Now I have a comprehensive understanding of the opencode system prompts. Let me create a summary document for you:
##OpenCode System Prompts
The OpenCode project uses a modular system prompt architecture with specialized prompts for different purposes. Here's what I found:
###Core System Prompts
####1. Agent Generation Prompt (generate.txt)
This is the main prompt used to help users create new custom agents. It:
- Guides users through designing high-performance agent configurations
- Extracts core intent and creates expert personas
- Architects comprehensive system prompts for agents
- Incorporates project-specific context from
CLAUDE.mdfiles - Generates JSON output with
identifier,whenToUse, andsystemPromptfields
Key principles: Specificity over generics, concrete examples, autonomous experts with minimal guidance needed.
####2. Built-in Agent Prompts
The system includes several specialized agents:
-
exploreAgent - File search specialist- Rapidly navigates codebases
- Uses glob patterns and regex searches
- Focuses on codebase exploration efficiency
-
titleAgent - Thread title generator- Outputs only a concise title (≤50 characters)
- Single-line format
- Uses the same language as the user message
- Never responds to questions, just generates titles
-
summaryAgent - Conversation summarizer- Writes like a pull request description
- 2-3 sentences max
- Describes changes made, not the process
- Uses first person (I added..., I fixed...)
-
compactionAgent - Context summarization assistant- Summarizes conversation history for coding sessions
- Preserves anchored summary details
- Removes stale details, merges new facts
- Stays concise with terse bullets
####3. Built-in Primary Agents
build- Default agent with full execution capabilities based on configured permissionsplan- Read-only mode for analysis and code exploration (disallows edit tools)general- General-purpose agent for researching complex questions and multi-step tasks
###Agent Configuration Structure
Agents in OpenCode are defined with these properties:
name- Agent identifierdescription- When to use the agentprompt- Custom system prompt (optional)permission- Tool access rulesetmode- "primary", "subagent", or "all"temperature&topP- Model parametersmodel- Specific provider/model overridehidden- Hide from autocomplete (for subagents)steps- Max agentic iterations
###Key Design Principles (from AGENTS.md)
- Always use parallel tools when applicable
- Prefer functional array methods over loops
- Keep things in one function unless composable or reusable
- Avoid
try/catchwhere possible - Use type inference when possible
- Prefer early returns over
elsestatements
The system is designed to be extensible, allowing users to create custom agents with tailored behavior for specific tasks!
END OF POST