Commands are high-level workflows that orchestrate agents to accomplish complex development tasks. They are invoked directly in OpenCode sessions using the slash (/) prefix.
The Agentic system distributes command files to your project:
- Source: Command files live in the
command/directory of the Agentic repository - Distribution: Running
agentic pullcopies them to.opencode/command/in your project - Recognition: OpenCode automatically recognizes these files and makes them available as slash commands
- Invocation: The filename (without .md) becomes the command name
Example:
command/research.md→.opencode/command/research.md→ Available as/researchcommand/plan.md→.opencode/command/plan.md→ Available as/plan
Purpose: Comprehensive analysis of codebase and documentation.
Syntax: /research [ticket-file] [additional-instructions]
Example:
/research thoughts/tickets/eng-123.md - find all authentication code and analyze the current OAuth implementation
Process:
- Reads ticket and mentioned files
- Spawns codebase-locator agents for discovery
- Spawns analyzer agents for deep dives
- Searches thoughts/ for historical context
- Synthesizes findings into research document
Output: thoughts/research/YYYY-MM-DD_topic.md
Purpose: Create detailed implementation specifications.
Syntax: /plan [ticket-file] [research-file]
Example:
/plan thoughts/tickets/eng-123.md thoughts/research/2025-01-15_oauth-research.md
Process:
- Reads ticket and research
- Spawns agents to verify current state
- Interactively develops approach with user
- Creates phased implementation plan
- Defines success criteria
Output: thoughts/plans/descriptive-name.md
Purpose: Implement an approved plan.
Syntax: /execute [plan-file]
Example:
/execute thoughts/plans/oauth-implementation.md
Process:
- Reads complete plan
- Implements each phase sequentially
- Runs verification after phases
- Updates progress checkmarks
- Handles mismatches adaptively
Output: Modified source code files
Purpose: Create meaningful git commits.
Syntax: /commit
Example:
/commit
Process:
- Reviews all staged and unstaged changes
- Analyzes purpose and impact
- Drafts commit message
- Creates git commit
- Handles pre-commit hooks
Output: Git commit with descriptive message
Purpose: Validate implementation against plan.
Syntax: /review [plan-file]
Example:
/review thoughts/plans/oauth-implementation.md
Process:
- Compares implementation to plan
- Verifies success criteria
- Identifies deviations
- Documents findings
- Provides recommendations
Output: thoughts/reviews/YYYY-MM-DD_review.md
Each command consists of:
---
description: Brief description of command purpose
---Detailed prompt that:
- Defines the task
- Outlines process steps
- Specifies output format
- Provides guidelines
$ARGUMENTS- User-provided arguments- File paths and parameters
- Read mentioned files completely
- Understand requirements
- Plan approach
- Spawn appropriate agents
- Coordinate parallel execution
- Wait for all results
- Synthesize findings
- Present findings or proposals
- Ask clarifying questions
- Iterate based on feedback
- Confirm before proceeding
- Create specified documents
- Update existing files
- Report completion status
- Provide context: Include relevant files and clear instructions
- Review outputs: Don't blindly accept results
- Iterate: Use follow-up questions to refine
- Fresh contexts: Start new sessions for each phase
- Clear phases: Break complex tasks into steps
- Parallel agents: Maximize efficiency
- User checkpoints: Get confirmation at key points
- Structured output: Use consistent formats
---
description: What this command does
---
# Command Name
Brief overview of the command's purpose.
## Steps to follow:
1. **Step Name**
- Specific action
- Expected outcome
2. **Step Name**
- Specific action
- Expected outcome
## Output Format
Description of what will be produced.
## Important Notes
- Key guidelines
- Common pitfalls
- Best practices
<placeholder>$ARGUMENTS</placeholder>- Use descriptive verbs:
research.md,analyze.md - Keep names short and memorable
- Avoid special characters
3. **Spawn research tasks**:
- Use **codebase-locator** to find relevant files
- Use **codebase-analyzer** to understand implementation
- Use **thoughts-locator** to find documentationCommands are invoked with a slash prefix:
/command-name arguments
- File paths:
thoughts/tickets/eng-123.md - Instructions: Text after dash (
-) - Multiple files: Space-separated
- Each command typically starts fresh
- Commands pass compressed context
- Maintains conversation flow
Read inputs → Spawn discovery → Spawn analysis → Synthesize → Document
Read context → Understand current → Propose approach → Iterate → Finalize
Read plan → Implement phase → Verify → Update progress → Repeat
Read plan → Check implementation → Compare → Document → Recommend
- Ensure command file exists in
.opencode/command/ - Check file naming matches invocation
- Run
agentic pullto update
- Review command instructions
- Check agent responses
- Verify file paths exist
- Break into smaller commands
- Use more specific instructions
- Start with fresh context
- Commands complete in one execution
- Cannot maintain state between invocations
- Use documents for persistence
- Limited to available tools
- Cannot modify own configuration
- Must work within OpenCode constraints
- Large files may exceed limits
- Complex commands may need splitting
- Use compression via agents
Potential additions:
/test- Run and analyze tests/deploy- Handle deployment tasks/refactor- Systematic refactoring/document- Generate documentation