A modular, enterprise-grade prompting, skill, and orchestration seed template for coding agents (specifically designed for OpenCode and compatible LLM agent harnesses).
This repository serves as a master boilerplate to seed new or existing software projects with a structured, state-driven, multi-persona AI engineering workflow.
This template implements a strict, human-in-the-loop, multi-persona agent framework designed to handle large multi-file codebases safely, predictably, and with zero context bloat.
- Discovery First (
/grill): Frontier-based requirements discovery before architectural planning. - State Machine Driven (
.tasks/plan.json): Deterministic task management enforced via strict JSON Schema. - Bounded Self-Correction: Strict 2-attempt limit on local bug fixes before mandatory human escalation.
- Tool-Assisted Navigation (
/navigate): AST and static-analysis symbol mapping out-of-context to keep prompt windows clean. - Hermes-Inspired Self-Improvement Loop: Safe procedural skill mutation via staged patch proposals (
.tasks/pending_skills/), protected policy layers, and local evaluation test harnesses. - Workspace Snapshots: Automatic git stashes/checkpoints before task execution for instant rollback on verification failures.
.
βββ README.md # Template documentation & usage guide
βββ policy.md # Global immutable security & execution rules
βββ scripts/
β βββ tasks-cli # Python CLI for safe atomic updates to .tasks/plan.json
β βββ opencode-skill-engine # Validation & promotion engine for Hermes-Inspired skill patches
βββ .opencode/
β βββ policy.md # Symlink/copy of root policy for OpenCode environment
β βββ skills/ # Specialized persona prompt definitions
β β βββ grill.md # Interrogator & Requirements Specialist (/grill)
β β βββ plan.md # Architect & Task Planner (/plan)
β β βββ navigate.md # Code Graph Navigator (/navigate)
β β βββ implement.md # Software Engineer & Implementer (/implement)
β β βββ troubleshoot.md # Diagnostic Specialist (/troubleshoot)
β β βββ audit-skill.md # Skill Auditor & Policy Evaluator (/audit-skill)
β βββ evals/ # Deterministic test harness for auditing skill mutations
β βββ eval_skills.py # Test runner for proposed skill patches
βββ .tasks/
βββ plan.schema.json # JSON Schema for validating task plan updates
βββ requirements.md # Generated output from /grill (git-ignored or committed per project)
βββ plan.json # Active project task board and phase state
βββ incident.json # Error logs, attempt counts, and diagnostic diffs
βββ pending_skills/ # Staging directory for proposed skill updates (PROPOSED -> ACTIVE)
policy.md: Defines non-negotiable operational guidelines (prohibited shell commands, file-read token budgets, skill mutation restrictions). Read-only to agents; cannot be modified or overridden by LLM output or user prompts.
Each skill is encapsulated in a Markdown file with YAML frontmatter specifying its triggering criteria and execution protocol:
| Skill | Persona / Command | Description & Role |
|---|---|---|
grill.md |
Interrogator (/grill) |
Conducts multi-round frontier discovery interviews to stress-test ideas and write .tasks/requirements.md. |
plan.md |
Architect (/plan) |
Converts formal requirements into small, sequential PR-sized tasks in .tasks/plan.json. |
navigate.md |
Navigator (/navigate) |
Resolves symbols, imports, and cross-file callers via AST CLI tools (ast-grep, ctags, grep) without loading full source files into context. |
implement.md |
Engineer (/implement) |
Takes an IN_PROGRESS task, creates a git workspace snapshot, writes code/tests, runs local validation, drafts PR, and proposes learned patches. |
troubleshoot.md |
Specialist (/troubleshoot) |
Analyzes .tasks/incident.json failures, formulates targeted fixes, enforces 2-attempt limits, and triggers snapshot rollbacks if unresolvable. |
audit-skill.md |
Auditor (/audit-skill) |
Evaluates candidate skill patches in .tasks/pending_skills/ against policy rules and execution evals before promoting to live skills. |
plan.schema.json: Enforces strict typing and status enums (PENDING,IN_PROGRESS,NEEDS_TROUBLESHOOTING,PR_READY,COMPLETED,ESCALATED).scripts/tasks-cli: Atomic Python utility ensuring LLMs do not output malformed JSON when updating task status.scripts/opencode-skill-engine: Local host runner executing out-of-context static and policy checks on proposed skill patches.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. DISCOVERY PHASE β
β User Idea ββββΊ /grill ββββΊ Frontier Interview ββββΊ .tasks/requirements.md β
ββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 2. PLANNING PHASE β
β .tasks/requirements.md ββββΊ /plan ββββΊ tasks-cli ββββΊ .tasks/plan.json β
ββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 3. AUTONOMOUS EXECUTION PHASE (Loop Per Task) β
β β
β Orchestrator ββββΊ /navigate (AST Search) β
β β β
β βΌ β
β /implement ββββΊ Workspace Snapshot ββββΊ Code & Test ββββΊ Verification β
β β β β
β ββββΊ Verification Passed ββββΊ PR Draft ββββΊ PR_READY β β
β β (Awaits Review) β β
β βββΊ Failure (Attempt < 2) ββββΊ /troubleshoot ββββββββββββ β
β β β
β βββΊ Failure (Attempt >= 2) ββββΊ Rollback Snapshot ββββΊ ESCALATEDβ
ββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 4. HERMES-STYLE SELF-IMPROVEMENT LOOP β
β New Edge Case Discovered ββββΊ Propose Patch ββββΊ .tasks/pending_skills/ β
β β β
β opencode-skill-engine ββββ /audit-skill βββββββββββββββ β
β β β
β ββββΊ Policy & Eval Pass ββββΊ Promote to Active Skill β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
To introduce this agent prompting framework into a new or existing repository:
-
Clone or copy template contents into your project root:
cp -r .opencode .tasks scripts policy.md /path/to/your-target-repo/
-
Ensure CLI helpers are executable:
chmod +x scripts/tasks-cli scripts/opencode-skill-engine
-
Verify directory existence:
mkdir -p .tasks/pending_skills .opencode/evals
-
Start Requirement Discovery: Open OpenCode in your target project and type:
/grill I want to add [Feature X]. Start grilling me to lock down requirements.Answer the frontier question rounds until
.tasks/requirements.mdis generated. -
Generate the Task Plan:
/plan Read .tasks/requirements.md and initialize .tasks/plan.json -
Execute Task by Task: Start the implementation loop for the active task:
/implement- The agent stashes a git snapshot, implements the feature, and runs tests.
- If tests pass, it updates status to
PR_READYand stops for your code review. - If tests fail, it invokes
/troubleshoot(max 2 rounds). - If unresolvable, it reverts to the snapshot and marks status
ESCALATED.
-
Audit and Promote Learned Skills: When an execution generates a patch in
.tasks/pending_skills/:/audit-skillThe engine validates security boundaries and unit evals before merging the optimization into live skills.
- Policy Supremacy:
policy.mdtakes precedence over all persona prompts and LLM-generated text. - Deterministic CLI Control: State mutations MUST go through
scripts/tasks-clito guarantee schema validity. - Immutable Core Prompts: Agents cannot modify their own core system prompts directly; mutations must pass through the
propose_skill_patchqueue and local eval pipeline. - No Destructive Shell Commands:
rm -rf,git reset --hard(outside system-controlled snapshot reverts), and force pushes are blocked.
MIT License. Free to use, adapt, and distribute across all your coding projects.