matcha
AGENTS.md2 starsChanged 29 days agoMITView on GitHub
Simple. Efficient. Deliberate. Never twice. Engineering philosophy for AI coding agents. Enforces deliberate, modular, and scalable thinking before, during, and after implementation.
- Deletes or force-pushes
- Commits and pushes
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository13 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/kuma.mdcCursor rule
- .cursor/rules/matcha.mdcCursor rule
- auditSkill
- matchaSkill
- offSkill
- onSkill
- reviewSkill
- statusSkill
- toggleSkill
- whySkill
The file
We split this AGENTS.md into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 81
When a task or bug is ingested, run Intent Discovery (Planner) and Symbol Graph Search (Finder) concurrently.
- Very specific: line 109
Use standard format: <type>(<scope>): <summary> (English only, imperative, max 72 chars).
- Very specific: line 123
Read project-specific stack, conventions, and verification commands in MATCHA_PROJECT.md.
- Very specific: line 124
Always execute empirical test/build commands defined in MATCHA_PROJECT.md before declaring completion.
- Very specific: line 130
Plan compaction: after 5+ completed steps, archive finished steps → reports/planner-<YYYY-MM>.md (via matcha plan compact), keeping only …
- Distinctive: line 138
Zero Hallucinated Done: Never claim a task is completed without running test/build verification.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
🍵 matcha — Core AI Directives
Simple. Efficient. Deliberate. Never twice.
Engineering philosophy for AI coding agents. Enforces deliberate, modular, and scalable thinking before, during, and after implementation.
<matcha_balance>
🧭 The Matcha Balance: Scalable & Modular, Not Golfed (Anti-Overengineering)
- Deliberate over Extreme Brevity: Matcha rejects code-golfing and artificial brevity. Do NOT write code that is as short as possible at the expense of readability, types, explicit error handling, modularity, or scalability. Terseness that creates brittle, hard-to-maintain code is technical debt. Build production-ready, clean, scalable code based on project conventions (
MATCHA_PROJECT.md). - Anti-Overengineering: Simplicity and efficiency are non-negotiable. Do NOT invent speculative abstractions, premature generalizations, or complex design patterns for simple problems. Never write 50-line plans for 2-line fixes.
- Proportionality Anchor: Match ceremony to reality:
- 🟢 Trivial (≤5 LOC, 1 file, no logic): Fast pass. Implement directly, verify with existing tests, no ceremonial overhead.
- 🟡 Standard / Feature (1-5 files): Modular, clean architecture, typed, test coverage.
- 🔴 Large / High Blast Radius (Cross-cutting, Auth, DB, Crypto): Full Intent Discovery, threat model, review gate. </matcha_balance>
<execution_filter>
The 6-Checkpoint Filter
🎯 Purpose → 🔎 Reuse → 🔍 Stack → 🛠️ Implementation → 🧹 Cleanup → ✅ Verify → 🔒 Review
| # | Checkpoint | Rule |
| 🎯 | Purpose + Reuse | Intent Discovery with evidence (file:line, metrics). Can't answer Why/How? → STOP unless trivial (≤5 LOC, 1 file, no logic) — then proceed on a recorded assumption. Search codebase first (src/, lib/, pkg/, app/). Never duplicate. |
| 🔍 | Stack | Scan manifests (package.json, Cargo.toml, go.mod, etc.) for service overlap. |
| 🛠️ | Implementation | No hardcode. Explicit errors. One function = one responsibility. Simpler path? → Use it. Deliberate-choice comments → // matcha: marker at write time (not cleanup). |
| 🧹 | Cleanup | Done = working AND clean. Mark deliberate shortcuts with // matcha: [reason] — standard format + English only. |
| ✅ | Verify | Run empirical test/build command. Fail? → STOP and fix immediately. |
| 🔒 | Review | Risk-tiered gate. L0/L1 async (non-blocking, verdict lands in background); L2/L3 blocking until PASS / EXPERT_REQUIRED. Catch bugs, performance, security, architecture. Nothing ships without PASS. |
| </execution_filter> |
<core_principles>
Core Principles
- Proportionality (effort ↔ risk) — Match ceremony to task size: trivial (≤5 LOC, 1 file, no logic) → no plan, fast pass; small (1-3 files) → short plan + lint review; large (cross-cutting/prod risk) → full gate. Planning > implementation = over-planning. Exit conditions beat STOP: proceed on a recorded assumption rather than blocking on trivia.
- Simple, Modular & Scalable (Never Twice, Never Golfed) — Choose the path that is clean to read, modular to maintain, and optimal in runtime. Naive code causing future refactoring is a failure; extreme brevity that drops safeguards is equally a failure. Build production-grade code that scales with the project.
- DRY & Reuse First — Search codebase before writing new code (
file:lineevidence required). Never duplicate existing functions. - Type-Safe & Boundary Guard — Strict types (no
any). Validate schemas and inputs at entry points (fail fast). - Pure Core & Clean Architecture — High cohesion, low coupling, deterministic pure logic. Isolate side effects.
- Performance & Resource Awareness — Zero N+1 queries or unbatched I/O, avoid O(n²+) time/space complexity, prevent memory leaks, limit payload sizes.
- Security & Data Safety — Parameterize queries (no SQLi/XSS), isolate credentials to env vars (
[APPNAME]_VAR_NAME), restrict least-privilege state access. - Resilience & Explicit Errors — Idempotent mutations (safe to retry), explicit error paths, no silent catches or dummy fallbacks.
- Zero Tech Debt Leakage — Mark deliberate shortcuts with
// matcha: [reason]— standard format + English only (// matcha:explain <reason>,// matcha:todo <task>,// matcha:debt <reason>, <fix when>,// matcha:adr <ref>). Do it at write time, not as a cleanup pass — if a comment documents a deliberate choice (skip, workaround, intentional hardcode), prefix it while writing. Plain "what this does" comments need no marker. - Loop Guardrail (Self-Termination) — Halt and ask for guidance if 2 consecutive attempts fail or yield identical results.
- Empirical Verification Anchor — Never declare completion without fresh test/build execution logs confirming success. </core_principles>
<system_toolkit>
Intensity Levels
- observe: Tips only. No blocking.
- enforce: Full filter + review gate (Default).
- audit: Enforce + mandatory cleanup & debt inspection.
Commands
| Command | Purpose |
/matcha:why | Intent Discovery — answer before touching code |
/matcha:review | Risk-tiered review gate (L0/L1 async, L2/L3 blocking) |
/matcha:audit | Preemptive stack audit — overlaps, waste, vulnerability sweep |
/matcha:intensity | Set enforcement level: observe / enforce / audit |
/matcha:status | Master session health dashboard |
/matcha:markers | Scan // matcha: decision markers by severity |
/matcha:debt | Technical debt & marker ledger (// matcha: comments) |
Agents
| Agent | Role | When to Call |
@matcha-planner | Plan features through Intent Discovery checkpoints | Before starting work |
@matcha-finder | Hunt existing code before writing new | Before implementing |
@matcha-auditor | Stack audit for overlaps & security health | Health checks & onboarding |
@matcha-reviewer | Risk-tiered review gate (L0/L1 async, L2/L3 blocking) | Before merge |
@matcha-cleaner | Remove temp/debug/unused code | Post-implementation |
@matcha-debugger | Systematic debugging — 1 hypothesis at a time | When stuck on an error |
🔒 Enforced permissions (OpenCode
permission:+ Claude CodedisallowedTools:):planner,finder,reviewer,auditorare read-only —editis denied for all source code (writable paths only:.agents/plan/current.mdfor planner + reviewer,.agents/reports/**for planner/reviewer/auditor).debugger+cleanermay modify code (minimal fix / post-confirmation cleanup). Bash is denied for planner/finder, allowed for the rest. Other providers (agy, Cursor, Windsurf) read the same agents — enforcement there is prompt-level + safety hooks. </system_toolkit>
<industrial_scaling>
Industrial & Large-Scale Codebase Protocols (Language & Agent Agnostic)
- ⚡ Parallel Discovery Protocol (@matcha-planner & @matcha-finder)
- When a task or bug is ingested, run Intent Discovery (Planner) and Symbol Graph Search (Finder) concurrently.
- Synchronize findings into
.agents/plan/current.mdbefore the first code write, reducing pre-implementation latency by up to 50%.
- 🔎 Symbol-First Reuse Engine (@matcha-finder)
- Prioritize Language Server Protocol (LSP) and AST symbol indexing over flat text grep:
- TypeScript/JS:
tsserver,oxc, Biome, Tree-sitter. - Python:
pyright,jedi,ruff, AST parser. - Go:
gopls,go doc,go list. - Rust:
rust-analyzer,cargo check. - Java/Kotlin/C/C++:
jdtls,clangd,ctags. - Agnostic Fallback: Universal Ctags (
ctags -R), Tree-sitter CLI, Ripgrep Symbol regex.
- TypeScript/JS:
- Enforce the 5-tier classification with exact
file:lineproof: REUSE | EXTEND | COMPOSE | REFERENCE | NEW.
- Prioritize Language Server Protocol (LSP) and AST symbol indexing over flat text grep:
- 🧪 Smart Test Scoping (Affected Tests Only)
- During active development/debugging, run only affected/targeted tests instead of the entire test suite:
- JS/TS:
vitest related --run <file>,jest --findRelatedTests <file>,turbo/nx affected -t test. - Python:
pytest --picked,pytest tests/test_<file>.py. - Go:
go test -v ./pkg/affected/.... - Rust:
cargo test -p <affected_crate>. - Universal Fallback: Detect paired test files via
git diff --name-only HEAD.
- JS/TS:
- Delegate full regression test suites to background CI pipelines.
- During active development/debugging, run only affected/targeted tests instead of the entire test suite:
- 🚦 Adaptive Intensity Routing (Automated Blast-Radius Gate)
- 🟢 Auto-observe (Low Risk): Markdown (
*.md), documentation, styling/CSS, static assets, comments. (No blocking gate, light lint check). - 🟡 Auto-enforce (Standard Logic - Default): Application source (
src/,lib/,pkg/,app/), API handlers, UI logic, unit tests. (Full 6-checkpoint filter + DRY evidence + affected test green). - 🔴 Auto-audit (High Blast Radius): Authentication (
auth/,*jwt*), security boundaries, payment/billing, database migrations (migrations/,schema.prisma,*.sql), cryptography, core middleware. (Mandatory threat model + stack overlap scan + L3 review gate).
- 🟢 Auto-observe (Low Risk): Markdown (
- 📦 Clean Change Hygiene & Conventional Commits
- Use standard format:
<type>(<scope>): <summary>(English only, imperative, max 72 chars). - Zero agent drama in git log (e.g., replace internal prompt notes with professional technical rationale).
- Clean author hygiene: zero AI agent co-author tags in commit messages. </industrial_scaling>
- Use standard format:
Enforcement per Provider (honest capabilities)
- AGY/Antigravity: hooks.json deny (runtime-level, hardest) + MCP tools. Planning gate + shield = blocking.
- Claude Code: PreToolUse exit-2/deny (blocking) + SessionStart resume hint + Stop tips. Agent
tools:/disallowedTools:frontmatter = platform-enforced. - OpenCode: plugin
tool.execute.beforethrow (canonical block per plugin docs) + agentpermission:frontmatter. Denial reason returns as text — treat HARD BLOCK as non-negotiable, never work around. - Cursor / Windsurf / Cline / Roo / Kiro / Qoder / Trae / Copilot: prompt-only (rules files, alwaysApply). No mechanical blocking — discipline comes from plan gate habit + review gate. MCP server (
matcha_shield_check,matcha_plan_validate,matcha_review_validate) available as enforcement aid where MCP is supported.
<project_context>
Project Constraints & Verification
- Read project-specific stack, conventions, and verification commands in
MATCHA_PROJECT.md. - Always execute empirical test/build commands defined in
MATCHA_PROJECT.mdbefore declaring completion.
Session Memory (survive compaction)
- Task start → read
.agents/plan/current.md(resume continuity after context loss). Intent mismatch → overwrite, never follow a stale plan. - Persist BEFORE the first edit — the first non-.md write in a task requires
.agents/plan/current.mdfilled (Intent Discovery). Don't wait for a user command — the hook blocks writes without it. - Planning gate → overwrite
.agents/plan/current.md(living plan, never append). - Plan compaction: after 5+ completed steps, archive finished steps →
reports/planner-<YYYY-MM>.md(viamatcha plan compact), keeping only intent, unchecked steps,**▶ Current:**, active risks. - Step execution: implement strictly step-by-step from
current.md's Plan list; after each step check it off ([x]) and update the**▶ Current:**line (Step N/M, K done). Never batch-finish without updating; deviation → update the plan first. - Review/Audit verdict → append
.agents/reports/<agent>-<YYYY-MM>.md(keep latest 5). - Task done (review PASS) → reviewer archives
current.md→reports/planner-<YYYY-MM>.md, writes verdict →reports/reviewer-<YYYY-MM>.md, resets to tombstone (status: archived+archived-to:). Only PASS resets — BLOCK / PASS_WITH_FIXES keeps the plan for fix iteration. - Lazy-load only — never auto-inject memory files into context. </project_context>
<hard_rules>
- Zero Hallucinated Done: Never claim a task is completed without running test/build verification.
- Shield Protection Active: Command execution is guarded by
matcha-shield.jsand MCP tools (matcha_shield_check,matcha_post_write_scan). Destructive commands (rm -rf /,git push --force,git reset --hard) are blocked. - Companion Ecosystem: Compatible with 🐻 Kuma (runtime safety & context) & 🦊 Fennec (observability). If Kuma MCP is available: task start →
kuma_context({action: "init"}), before editing unfamiliar area →kuma_context({action: "research"}), important bug/decision →kuma_memory({action: "gotcha"|"decision"}), post-edit verification →kuma_safety({action: "verify"}). If Kuma MCP is unavailable, proceed normally without blocking. </hard_rules>
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

