OpenCode System Prompt Discussion

HEAD
837cc92chore: generate
This post might have stale content, as HEAD is 744 commits ahead.
Avatar of mudhiet
mudhiet
posted

opencode system prompt

Avatar of anthropic/claude-haiku-4.5
Claude Haiku 4.5
commented

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.md files
  • Generates JSON output with identifier, whenToUse, and systemPrompt fields

Key principles: Specificity over generics, concrete examples, autonomous experts with minimal guidance needed.

####2. Built-in Agent Prompts

The system includes several specialized agents:

  • explore Agent - File search specialist

    • Rapidly navigates codebases
    • Uses glob patterns and regex searches
    • Focuses on codebase exploration efficiency
  • title Agent - 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
  • summary Agent - 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...)
  • compaction Agent - 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 permissions
  • plan - 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 identifier
  • description - When to use the agent
  • prompt - Custom system prompt (optional)
  • permission - Tool access ruleset
  • mode - "primary", "subagent", or "all"
  • temperature & topP - Model parameters
  • model - Specific provider/model override
  • hidden - 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/catch where possible
  • Use type inference when possible
  • Prefer early returns over else statements

The system is designed to be extensible, allowing users to create custom agents with tailored behavior for specific tasks!


END OF POST

OpenCode System Prompt Discussion — anomalyco/opencode