4.7 KiB
4.7 KiB
OpenCode Agent Definition Fix - Design Spec
Overview
Fix OpenCode agent definitions so subagents spawned via @mention (when using superpowers) properly enforce the conductor workflow. Currently subagents fail to follow 1-space indentation, TDD protocols, and delegation rules even when explicitly instructed.
Current State Audit
Files Involved
.opencode/agents/tier3-worker.md- Tier 3 Worker agent definition.opencode/agents/tier4-qa.md- Tier 4 QA agent definition.opencode/agents/tier2-tech-lead.md- Tier 2 Tech Lead agent definition.opencode/agents/tier1-orchestrator.md- Tier 1 Orchestrator agent definition
Problems Identified
-
Wrong MCP Tool Naming
- Current:
discovered_tool_py_get_code_outline,discovered_tool_run_powershell - Correct:
manual-slop_py_get_code_outline,manual-slop_run_powershell - Result: Subagents cannot find/locate MCP tools
- Current:
-
Insufficient Code Style Enforcement
- "1-space indentation" mentioned but not CRITICAL
- No explicit warning about native edit tool destroying indentation
- Subagents default to 4-space on unknown files
-
Missing Conductor Workflow Structure
- No pre-delegation checkpoint protocol (
git add .) - No atomic commit per-task rules
- No TDD Red→Green→Refactor phase enforcement
- No mandatory task state tracking in plan.md
- No pre-delegation checkpoint protocol (
-
Context Amnesia Not Addressed
- Subagents lose all workflow context between tasks
- No reminder about stateless operation
- No checkpoint/commit reminder system
-
Tier 3 Worker Mode Incorrect
mode: subagentmay cause OpenCode to strip context- May need
mode: primaryfor full workflow access
Goals
- Subagents spawned via
@mentionfollow conductor workflow without deviation - 1-space indentation enforced as CRITICAL for all Python code
- TDD phases (Red→Green→Refactor) enforced mandatorily
- MCP tool names correct and functional
- Pre-delegation checkpoints prevent work loss
- Atomic commits per task maintained
Functional Requirements
1. Agent Definition Rewrite
All tier agent files (.opencode/agents/*.md) must include:
-
CRITICAL Indentation Block at top:
## CRITICAL: 1-Space Indentation for Python ALL Python code MUST use exactly 1 (ONE) space for indentation. VIOLATION: Using 4 spaces or tabs will corrupt the codebase. -
MCP Tool Mapping Table (correct names):
| Native Tool | MCP Tool | |-------------|----------| | read | manual-slop_read_file | | edit | manual-slop_edit_file | | bash | manual-slop_run_powershell | | glob | manual-slop_search_files | -
Pre-Delegation Checkpoint Protocol:
## Pre-Delegation Checkpoint (MANDATORY) Before delegating ANY change: 1. Run: git add . 2. Reason: Prevents work loss if subagent fails -
TDD Phase Enforcement:
## TDD Protocol 1. RED: Write failing test, confirm failure 2. GREEN: Implement to pass, confirm pass 3. REFACTOR: Optional, with passing tests NEVER skip phases. -
Atomic Commit Rules:
## Commit Protocol After each task: git add . && git commit Do NOT batch commits.
2. Tier 3 Worker Specific Fixes
- Verify
mode: subagentis correct for OpenCode's @mention system - Add WHERE/WHAT/HOW/SAFETY task structure reminder
- Add BLOCKED protocol for unresolvable tasks
- Include Context Amnesia reminder (fresh context each task)
3. Tier 4 QA Specific Fixes
- Add DO NOT FIX warning - analysis only
- Include root cause tracing instructions
- Add data flow tracing from docs/guide_architecture.md
4. Tier 2 Tech Lead Specific Fixes
- Add persistent memory reminder
- Add surgical prompt structure (WHERE/WHAT/HOW/SAFETY)
- Add delegation via Task tool instructions
- Add phase completion verification protocol
5. Tier 1 Orchestrator Specific Fixes
- Verify mode: primary for main agent sessions
- Add track initialization workflow
- Add product alignment check
Architecture Reference
Based on:
conductor/workflow.md- TDD protocol, commit rulesconductor/product-guidelines.md- Code style (1-space indentation)opencode.json- MCP tool definitions (manual-slop_*)- superpowers docs - @mention subagent spawning
Out of Scope
- Changes to superpowers plugin itself
- Changes to OpenCode core behavior
- Changes to mma_exec.py (not used in OpenCode flow)
- Changes to Gemini CLI workflow (separate system)
Success Criteria
- All Python files in project use 1-space indentation
- Subagents follow TDD protocol without skipping phases
- Pre-delegation checkpoints executed before risky operations
- MCP tools findable by subagents
- Atomic commits maintained per task
- Conductor workflow followed without deviation even after corrections