Agent Playbook Template is a portable governance framework for AI coding agents. It gives a repository a version-controlled source of truth for how agents load context, route work by role, handle approval gates, validate changes, record decisions, and hand off structured context across tools.
Use this template when you want repeatable agent behavior across Codex, Claude, Copilot, Cursor, OpenCode, Windsurf, or a generic CLI workflow. It is not an app runtime or product framework; it is the operating layer around agent-assisted software work.
- Root agent instructions through
AGENTS.md - Source-of-truth operating and routing docs in
docs/ - Layered reusable rules in
rules/global/,rules/domain/, andproject/ - Reusable skills in
skills/*/SKILL.md - Tool-specific agent surfaces for Claude and GitHub Copilot
- Adapter harnesses for Claude Code, Copilot, Cursor, OpenCode, Windsurf, and generic CLI use
- Governance scripts for linting, budget reporting, trace review, context-pack generation, and eval scoring
- GitHub Actions workflows for markdown lint, rule governance, and trace review
- Evals and deterministic tooling fixtures for checking governance behavior
- Release metadata in
VERSIONandCHANGELOG.md
Choose the path that fits your situation — all three lead to the same governance model.
- Open
prompt-budget.yml. Setbudget.profileandexecution_mode. - If
budget.profileisnano: readdocs/rules-nano.mdand stop — that is your complete rule surface. - Otherwise: read
AGENTS.md(loading order) →docs/rules-quickstart.md(minimal Layer 1). - Run
bash scripts/adoption-audit.sh --template-modeto confirm this template repo is intact. Use--strictafter adopting the template into a real project.
- Run the on-project-start skill (
skills/on-project-start/SKILL.md) ifbudget.profileisstandardorfull. - Triage the task scale (
skills/demand-triage/SKILL.md): Small / Medium / Large. - Small → implement directly, run targeted tests, done.
- Medium/Large → read
DECISIONS.mdfor contradictions → plan → critic → approve → implement → validate. - Record any architecture/behavior decisions according to
prompt-budget.yml->decision_log.policy(DECISIONS.mdin adopted projects, task summary or trace in this template repo).
| Concern | Where to look |
|---|---|
| Changing agent trust level | prompt-budget.yml → execution_mode |
| Adding or removing roles | docs/agent-playbook.md + .github/copilot-instructions.md |
| Budget / token cost (targets) | bash scripts/budget-report.sh |
| Budget / token cost (actuals) | python3 scripts/trace-query.py --budget-usage |
| Reviewing past traces (analytics) | python3 scripts/trace-query.py --summary |
| Reviewing past traces (quality) | bash scripts/agent-review.sh |
| Upgrading the template | MIGRATION.md |
| Contradiction check before planning | python3 scripts/decisions-conflict-check.py --text "..." |
| Governance regression tests | bash scripts/run-evals.sh (see evals/README.md) |
| Deterministic context pack for cross-tool handoff | python3 scripts/build-context-pack.py ... |
| Tooling output regression tests | bash scripts/test-tooling.sh (see evals/tooling/README.md) |
role= who owns the workintent mode= what phase the work is in (analyze,implement,review,document)execution_mode= how much autonomy the agent has (supervised,semi-auto,autonomous)budget.profile= how much instruction surface loads (nano,minimal,standard,full)model_routing= optional abstract model-tier policy (fast,balanced,deep) — keep provider IDs in adapter/local config, not source docs
The table below shows how each governance gate behaves across the three trust levels.
| Gate | supervised |
semi-auto |
autonomous |
|---|---|---|---|
| Plan approval (Medium/Large) | STOP — wait for user | STOP — wait for user | Advisory by default; STOP when auto_proceed_on_plan: false |
| Destructive actions | STOP — always | STOP — always | STOP unless halt_on_destructive_actions: false |
| Scope expansion | STOP — present new scope | STOP when gate is active | Log ADVISORY and continue if expansion stays within original intent and auto_proceed_on_scope_expansion: true; STOP if it adds an unrelated module |
| Stuck escalation (3 failed attempts) | STOP — escalate to user | STOP — escalate to user | STOP unless halt_on_stuck_escalation: false |
| Critic review (Medium/Large) | Runs; user sees output | Runs; user sees output | Runs by default; skip when skip_critic_role: true |
Legend: STOP = agent pauses and waits for human input. Advisory = agent logs the event and continues. Gate behavior is defined in docs/operating-rules.md → Trust level.
- Copy this template into your repository (or create a repo from this template).
- Edit the two source-of-truth docs first:
docs/operating-rules.mdanddocs/agent-playbook.md. UpdateAGENTS.mdafter them as the root entrypoint. - Run your first task with the required workflow: discover -> triage -> plan (if needed) -> implement -> validate -> record decisions according to
prompt-budget.yml->decision_log.policy.
For first entry into a new repository, use the profile-aware initialization path: at minimal, follow the manual scan path in docs/rules-quickstart.md; at standard/full, run skills/on-project-start/SKILL.md before implementation.
If you only do one thing on day one after adopting this template: switch decision_log.policy to normal and keep DECISIONS.md updated so future agent runs can perform contradiction checks.
This template is for governing agent behavior, not for shipping a particular runtime or product feature set.
Read it in this order:
docs/operating-rules.mddefines safety, scope, checkpoints, and intent-mode rules.docs/agent-playbook.mddefines role ownership, capability ceilings, routing, and workflow paths.docs/agent-templates.mddefines the required output contracts such as handoffs, checkpoints, and rule-entry format.docs/schemas/context-pack.schema.jsondefines a portable machine-readable task envelope when the same work may move across tools or runtimes.
Practical interpretation:
- choose a
rolefor ownership - choose an
intent modefor the current phase - use
execution_modeto decide whether human approval gates stop or auto-proceed - use
budget.profileto decide how much of the framework loads - if your runtime exposes model selection, use
model_routingfor vendor-neutral tier policy and keep concrete provider/model IDs in adapter or local config
Use case: add a new repository rule that all API handlers must enforce request ID logging.
- Update rule source: add the non-negotiable rule in
project/project-manifest.mdunderNon-negotiable constraints. - Align routing and role guidance: update
docs/agent-playbook.mdif any role ownership changes. - Sync tool instructions: update
.github/copilot-instructions.mdto keep tool-specific guidance consistent. - Record the decision according to
prompt-budget.yml->decision_log.policy: append a datedDECISIONS.mdentry in adopted projects, or record it in the task summary/trace when this template repo is inexample_onlymode. - Validate consistency: ensure
AGENTS.mdmatchesdocs/operating-rules.mdanddocs/agent-playbook.md.
Outcome: every future implementation task follows the same logging requirement with traceable reasoning.
Goal: [what to change]
Scope: [files/modules allowed]
Constraints: follow AGENTS.md and docs/operating-rules.md
Deliverable: proposal + implementation + validation results
Read set: [list of files read]
Scale: [SMALL|MEDIUM|LARGE] + reason
Workflow path: [small simplification | medium/large full path]
Checkpoint map: [plan approval, destructive actions, scope expansion]
## YYYY-MM-DD: [Decision title]
- **Context**: Why this decision was needed
- **Decision**: What was decided
- **Alternatives considered**: What was rejected and why
- **Constraints introduced**: What future work must respectflowchart LR
A[User Task Request] --> B[AGENTS.md]
B --> C[docs/operating-rules.md]
B --> D[docs/agent-playbook.md]
C --> L[Layered Config<br/>rules/ + project/]
D --> E[Role Selection]
E --> F[skills/*/SKILL.md]
F --> G[Implementation + Validation Loop]
G --> H[Decision Record<br/>per decision_log.policy]
H --> I[Future Contradiction Checks]
This template supports layered constraint files so teams can adapt behavior without rewriting one large rules file.
rules/global/— cross-project security, prompt-injection defense, and code-quality rules (loaded atstandardandfullprofiles)rules/domain/— domain-specific constraints (backend, cloud, frontend, code-quality, etc.)project/project-manifest.md— project-local context and boundaries
When constraints conflict, follow precedence defined in docs/operating-rules.md: Project Context -> Domain Rules -> Global Rules.
For rule placement, same-layer conflict handling, and governance checks, see docs/layered-configuration.md.
For staged simplification and automation steps, see docs/rule-optimization-plan.md.
- Discover context: read relevant code/docs and existing decisions.
- Initialize (first entry only): run
on-project-startto confirm boundaries. - Triage task scale: classify as Small, Medium, or Large using evidence.
- Plan path: Small uses the simplified path; bounded Medium work may go directly to implementation; ambiguous, high-risk, or cross-module Medium/Large work uses the full planning path.
- Implement safely: keep scope tight and follow repository patterns.
- Validate: run targeted checks/tests, fix, and repeat until stable.
- Record durable state according to
prompt-budget.yml->decision_log.policy: adopted projects usually updateDECISIONS.md; this template repo records task decisions in summaries, handoffs, or traces.
This flow is what makes the template useful in real teams: predictable output quality, lower drift, and faster onboarding.
This template is designed for teams searching for:
- AI coding agent playbook template
- GitHub Copilot repository instructions template
- multi-agent software workflow for planning and implementation
- documentation-driven engineering workflow
- decision log and contradiction-check workflow
If you maintain a fork, keep these phrases in your repository description and README summary so more users can discover and adopt your workflow.
- a root
AGENTS.mdentrypoint - reusable operating rules and routing rules
- project-level subagents for Claude-compatible tooling
- reusable prompt templates for any chat-based coding tool
- a machine-readable context-pack contract for multi-tool orchestration
- a canonical trace schema (
docs/schemas/trace.schema.yaml) usable by any adapter - an adapter-neutral evals framework (
evals/) that verifies governance rules across tools - harness adapters and shell-first governance scripts for local and CI validation
- reusable skills you can adapt into your own agent ecosystem
- repo-wide Copilot instructions
- Version: 0.20.0 (
VERSION) - Claude subagents: 8 (
.claude/agents/*.md) - Reusable skills: 18 (
skills/*/SKILL.md) - Governance scripts: 14 (
scripts/*) - GitHub workflows: 3 (
.github/workflows/*.yml) - Adapter harnesses: 6 (
harness/adapters/*) - Example profiles and notes: 4 (
examples/*.md) - Source-of-truth docs:
docs/operating-rules.md,docs/agent-playbook.md(AGENTS.mdis the root entrypoint that should stay aligned with them)
Use examples/ for ready-to-adapt constraint profiles:
examples/high-security-mode.mdexamples/mvp-rapid-mode.mdexamples/legacy-maintenance.mdexamples/anti-patterns.md
AGENTS.mdprompt-budget.ymldocs/rules-nano.mddocs/rules-quickstart.mddocs/operating-rules.mddocs/agent-playbook.md
DECISIONS.md— effectively required if you want contradiction checks and durable decision memoryARCHITECTURE.md.github/copilot-instructions.md.claude/agents/skills/docs/agent-templates.md
docs/example-task-walkthrough.md— reference for expected output formatsdocs/external-practices-notes.mddocs/adoption-guide.mdharness/— adapter hooks and wrapper scripts for tools that support or emulate governance hooksevals/— adapter-neutral behavior fixtures and scoring helpers
- Create a new repository from this template or copy the files into an existing repository.
- Edit
docs/operating-rules.mdwith your real safety, testing, and review expectations. - Edit
docs/agent-playbook.mdso the role routing matches your stack. - Update
AGENTS.mdso the root entrypoint reflects those source-of-truth docs. - Review and replace
ARCHITECTURE.mdwith your repository's module map and data flow (the template repo now includes its own reference architecture). - Keep, rename, or remove subagents in
.claude/agents/based on the tools your team actually uses. - Keep, rename, or remove skills in
skills/based on the workflows you repeat often. - Update
.github/copilot-instructions.mdso it reflects the same role model. - Keep
DECISIONS.mdactive from day one so agents can run contradiction checks before planning/implementation. - Apply memory lifecycle rules from
skills/memory-and-state/SKILL.md(archive stale decisions when thresholds are hit and use selective reads for active vs. archived decisions). - Update
prompt-budget.ymlso the budget profile, execution mode, and enabled roles/skills match your project. - Run
bash scripts/adoption-audit.sh --strictafter your first customization pass.
- Replace generic module labels with your actual modules.
- Add repository-specific safety rails, test commands, and release rules.
- Add or remove role definitions to match your delivery workflow.
- If your team does not use Claude-style subagents, keep the role names but remove
.claude/agents/. - If your team does not use Copilot instructions, remove
.github/copilot-instructions.md. - See
docs/adoption-guide.md→ Tool adapter reference for Cursor, Windsurf, and OpenAI API setup.
The role names in this template are conceptual first:
feature-plannerbackend-architectapplication-implementerui-image-implementerintegration-engineerdocumentation-architectrisk-reviewercritic
Some tools can map these directly to project subagents. Others cannot. In tools without native subagents, use the same role names through prompt templates, reusable skills, or repository instructions instead.