A battle-tested template for configuring autonomous AI coding agents with quality gates, TDD enforcement, and the Sentinel review system.
The template/ directory contains everything you copy into your project:
| File | Purpose |
|---|---|
template/AGENTS.md |
The agent operating system — MUST rules, TDD, workflow, boundaries |
template/SETUP.md |
Placeholder inventory & customization checklist |
template/ROADMAP.md |
Project phases template |
template/LEARNINGS.md |
Discovered knowledge log |
template/DECISIONS.md |
Architecture decision records |
template/CHANGELOG.md |
User-facing changes log |
template/docs/SENTINEL.md |
Quality gate — 6 parallel review sub-agents, invocation, infrastructure enforcement |
template/docs/ARCHITECTURE.md |
Project structure template |
template/docs/TESTING-STRATEGY.md |
Test strategy details |
template/docs/DEVELOPMENT-WORKFLOW.md |
Git worktrees, branching, PR process |
Give your AI agent one of these prompts — it handles everything:
Fetch the agents-template from https://github.com/pedrofuentes/agents-template — download all files from the
template/directory into this project's root. Then read AGENTS.md and follow the First Run setup instructions. Scan my project files to auto-fill what you can, then ask me for anything you can't infer.
Fetch the agents-template from https://github.com/pedrofuentes/agents-template — first back up any existing agent config files (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md, etc.) to
.agent-backup/, then download all files from thetemplate/directory into this project's root. Read AGENTS.md and follow the Migration setup path. Extract all project-specific information from the backed-up files and use it to configure the template. Ask me to confirm before finalizing.
Fetch the latest agents-template from https://github.com/pedrofuentes/agents-template — compare the
template/files with my current versions. Show me what changed, apply updates while preserving my project-specific configuration (filled-in placeholders, custom rules, code examples). Do NOT overwrite my customizations. Ask me to confirm before applying changes.
If your agent can't fetch from GitHub:
git clone https://github.com/pedrofuentes/agents-template.git /tmp/agents-template
cp -r /tmp/agents-template/template/* /path/to/your/project/
rm -rf /tmp/agents-templateThen give the agent the appropriate prompt above (without the "Fetch..." part).
STOP. Before merging, invoke the Sentinel. Create a sub-agent with
docs/SENTINEL.mdas its system prompt. Provide it the PR diff (git diff main...HEAD), the branch name, and changed files. Do NOT review your own code. Tell me the decision.
Run a post-merge Sentinel audit. Create a sub-agent with
docs/SENTINEL.mdas its system prompt. Provide it the last merge diff (git diff HEAD~1). If any 🔴 CRITICAL findings exist, create follow-up fix commits.
Read
docs/SENTINEL.mdand act as the Sentinel — run every check against the current PR diff. Note: self-review is lower trust than a separate sub-agent.
CI enforcement (recommended for teams): See docs/SENTINEL.md for GitHub Actions integration.
| Your Setup | Method | Notes |
|---|---|---|
| Copilot CLI or Claude Code | Method A (sub-agent) | Convenient for dev; lower trust |
| CI/CD (GitHub Actions) | Method B (recommended) | Production-grade enforcement |
| Cursor, Windsurf, other | Method C (manual) | Always works |
| Solo project, no CI | Method C | Start here, upgrade later |
| Stack | Package Manager | Test Runner | Formatter | Linter |
|---|---|---|---|---|
| TypeScript/Node | pnpm / npm | Vitest / Jest | Prettier | ESLint |
| Python | uv / pip | pytest | ruff | ruff |
| Go | (native) | go test | gofmt | golangci-lint |
The system enforces a continuous improvement loop. The coding agent and the Sentinel are always separate — the agent that wrote the code never reviews its own work.
Coding Agent writes code (TDD, worktrees, small increments)
↓
Sentinel (separate sub-agent) reviews
↓
❌ REJECTED → Coding Agent fixes → Sentinel reviews again (max 3 cycles)
↓ ↑
└────────── loop until ──────────────┘
↓
✅ APPROVED → record baseline SHA → merge to main
↓
Create GitHub issues for 🟡/🟢 findings → follow-up PRs → same loop
↓
3× REJECTED on same issue? → 🚨 escalate to human
Each cycle ratchets quality up. The Sentinel never lowers its standards. The loop only exits when the quality threshold is met or a human takes over.
| Level | Meaning | Merge? | Examples |
|---|---|---|---|
| 🔴 CRITICAL | Must fix — blocks merge | No | Security vuln, data loss, incorrect behavior, failing tests, TDD violation |
| 🟡 IMPORTANT | Improvements to working code | Conditional — tracked as GitHub issues | Missing error propagation, N+1 queries, resilience gaps, edge cases |
| 🟢 MINOR | Polish | Yes | Naming, docs, code style suggestions |
The agent autonomously fixes 🔴 findings and re-invokes Sentinel (up to 3 cycles). 🟡 findings are tracked as GitHub issues (sentinel:important). If a 🟡 finding could cause data loss or security exposure, Sentinel reclassifies it as 🔴. For production deploys, all 🟡 issues must be resolved or explicitly risk-accepted.
- TDD defense in depth — Layer 1 (STOP checkpoint verbs) + Layer 2 (Sentinel verification)
- Sentinel quality gate — 6 parallel review sub-agents with anti-prompt-injection and dispatch-proof enforcement
- Quality ratchet — continuous improvement loop until Sentinel approves
- Separation of concerns — the coder ≠ the reviewer, always
- Autonomous workflow — Plan → Approve → Execute → Sentinel → Merge
- 4-tier boundaries — ALWAYS / ASK FIRST / HUMAN REQUIRED / NEVER
- Commit choreography —
test(red)→feat(green)→refactorwith exemptions - Git worktrees — mandatory branch isolation for every task
- Pre-merge checklist — SHA-bound, Mode-verified gate before every merge
- Identity framing — Prompt engineering techniques for higher agent compliance
This template was refined through 24+ expert AI reviews across 9 models (Claude Opus 4.7, Opus 4.6, Opus 4.5, Sonnet 4.6, Sonnet 4, Haiku 4.5, GPT-5.4, GPT-5.2, GPT-5.1). See MIGRATION-GUIDE.md for the full evolution history.
Current version: v0.4.1. See CHANGELOG.md for version history.
Live-tested on gitnotate, Arbol, and Council. Results:
- Sentinel caught a real XSS vulnerability (innerHTML injection) the agent would have shipped
- Pre-merge checklist gate prevents agents from merging without Sentinel — even for 1-line fixes
- Coverage jumped from 45% to 98% on undertested packages
- TDD choreography violations detected and documented as process debt
- Quality ratchet loop worked autonomously — agent invoked Sentinel, got REJECTED, fixed findings, re-invoked without being told
- 3 memory leaks (MutationObserver, event listeners) caught and fixed
- Unicode crash (btoa on emoji/CJK) caught and fixed
- 5 CVEs in transitive dependencies flagged and resolved
Every gap found during testing was fed back into the template to make it stronger.
MIT