ai-harness-framework
AGENTS.md2 starsChanged 6 days agoMITView on GitHub
A general-purpose AI agent harness framework for building reliable, predictable multi-session engineering workflows. This repository serves as both the harness implementation and a reference template for bootstrapping harness-enabled projects. Before writing code: If baseline verification is failing, repair that first before adding new scope. - MUST run make check (or equivalent verification) before every commit <!-- source: harness-engineering-template L03 — repo must have a verifiable consistent-state predicate --> - MUST NOT mark a feature as passing manually — use make…
- Reads credentials
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,843 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 repository11 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- adoptSkill
- commitSkill
- feature-cycleSkill
- parallel-lanesSkill
- releaseSkill
- reviewSkill
- session-handoffSkill
- update-docsSkill
- verificationSkill
- write-skillSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
24 rules. About 0 are common, 8 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
If baseline verification is failing, repair that first before adding new scope.
- Distinctive: line 23
Verification required: Don't claim done without running verification commands
- Very specific: line 24
Update artifacts: Before ending a session, add progress/NNN-YYYY-MM-DD.md, regenerate PROGRESS.md, and update the active feature's …
- Distinctive: line 25
Stay in scope: Don't modify files unrelated to the current feature
- Distinctive: line 29
Update docs with code: No stale documentation — update docs in the same commit as the code change
- Very specific: line 36
MUST: run make check (or equivalent verification) before every commit <!-- source: harness-engineering-template L03 — repo must have a …
- Very specific: line 39
MUST: commit the feature's code and docs before verify-feature — it refuses uncommitted changes outside harness bookkeeping, so its …
- Very specific: line 42
MUST: add session notes under progress/ and regenerate PROGRESS.md at session end <!-- source: harness-engineering-template L05 — durable …
- Distinctive: line 46
MUST: keep features completable in a single session — if a feature spans multiple sessions, split it <!-- source: …
- Distinctive: line 48
MUST: follow dual-mode cleanup: immediate cleanup at every session end + periodic (weekly/monthly) full-system sweep for structural drift …
- Very specific: line 98
Document architectural constraints in .harness/arch-rules.json
- Very specific: line 100
Run make check-arch to enforce layer dependencies and invariants
- Very specific: line 101
Every new error category caught in review becomes a rule in .harness/arch-rules.json
- Very specific: line 115
Never add allow rules for sensitive actions (writes outside the project, network, installs, pushes) to the shared settings file — it …
- Distinctive: line 137
Before ending a session:
- Very specific: line 139
Run make clean-check — confirms build passes, no debug artifacts, progress updated
- Very specific: line 140
Start the session note with node scripts/framework-check.mjs progress-new "<title>" (it picks the number, date and heading lint requires, …
- Very specific: line 141
Keep feature_list.json declaration-only.
- Very specific: line 142
Update docs/quality-document.md: name each feature that passed this session (its id, what changed, which modules) and rate those modules …
- Distinctive: line 144
Commit with descriptive message explaining WHY, not just what
- Very specific: line 145
Leave repo clean enough for next session to run ./init.sh immediately
- Very specific: line 147
If running low on context: Do NOT rush to finish — stop, add a concise note under progress/, regenerate PROGRESS.md, and commit a clean …
- Very specific: line 153
Unclear requirements: Check docs/PRODUCT.md if present, otherwise ask user.
- Very specific: line 154
Repeated test failures: Update PROGRESS.md, flag for human review
≈ “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
AI Harness Framework
A general-purpose AI agent harness framework for building reliable, predictable multi-session engineering workflows. This repository serves as both the harness implementation and a reference template for bootstrapping harness-enabled projects.
Startup Workflow
Before writing code:
- Confirm working directory with
pwd - Read this file completely
- Read project docs (
docs/ARCHITECTURE.md,docs/PRODUCT.md, README) - Run
./init.shto verify environment is healthy (it also runs the harness self-tests, once per session) - Read the session brief
./init.shprints at the end (or runnode scripts/framework-check.mjs brief): the active feature, what can start next, stale evidence, and the last session's risks and next step. Openfeature_list.jsononly for the features it names - Check for parallel work — if more than one feature is
planned, runnpm run lane-suggestbefore picking just one. It is read-only; if it reports an independent set, propose that set (and theparallel-lanesskill's flow) to a human before defaulting to a single feature. - Review recent commits with
git log --oneline -5
If baseline verification is failing, repair that first before adding new scope.
Working Rules
- One feature at a time: Pick exactly one unfinished feature from
feature_list.json— unlessnpm run lane-suggestfound an independent, human-approved set to run in parallel lanes instead (seeparallel-lanesskill, DECISIONS.md D-028) - WIP=1: Only one feature may be active at any time (
state: "active"or compatibility aliasstatus: "in_progress"in that feature's.harness/state/<id>.json). Complete and move topassingbefore activating the next. On alane/<feature-id>worktree lane, this is scoped per lane — a lane may only activate the feature it is named for (seelane-new/lane-list/lane-land/lane-drop, docs/ARCHITECTURE.md, and DECISIONS.md D-017). - Verification required: Don't claim done without running verification commands
- Update artifacts: Before ending a session, add
progress/NNN-YYYY-MM-DD.md, regeneratePROGRESS.md, and update the active feature's.harness/state/<id>.json - Stay in scope: Don't modify files unrelated to the current feature
- The declared behavior is the spec: a feature's
behaviorinfeature_list.jsondefines done. A test that contradicts it is a bug in the test — fix the test in the same commit and say so in the commit message and session note. Stop and ask only when the declared behavior itself looks wrong - Leave clean state: Next session must be able to run
./init.shimmediately - One logical operation per commit: The repo must be in a consistent state after every commit
- Update docs with code: No stale documentation — update docs in the same commit as the code change
Constraints
<!-- source: harness-engineering-template L03 — consistent-state predicate must be verifiable --><!-- why: without explicit MUST/MUST NOT rules, agents drift from the prescribed workflow -->- MUST run
make check(or equivalent verification) before every commit<!-- source: harness-engineering-template L03 — repo must have a verifiable consistent-state predicate --> - MUST NOT mark a feature as
passingmanually — usemake verify-feature F=<id>or the documented verification path - MUST commit the feature's code and docs before
verify-feature— it refuses uncommitted changes outside harness bookkeeping, so its evidence names the commit that passed; the state shard it writes goes in the next commit<!-- source: feat-030, D-041 — evidence recorded on a dirty tree named a commit that did not hold the verified code --><!-- source: harness-engineering-template L08 — state transitions must go through the harness gate --> - MUST add session notes under
progress/and regeneratePROGRESS.mdat session end<!-- source: harness-engineering-template L05 — durable cross-session continuity requires written handoff --> - MUST NOT skip verification layers (Layer 1 → Layer 2 → Layer 3 in order)
<!-- source: harness-engineering-template L09 — each layer gates the next; skipping produces false confidence --> - MUST keep features completable in a single session — if a feature spans multiple sessions, split it
<!-- source: harness-engineering-template L08 — multi-session features lose context and degrade VCR --> - MUST follow dual-mode cleanup: immediate cleanup at every session end + periodic (weekly/monthly) full-system sweep for structural drift
<!-- source: harness-engineering-template L12 — structural drift accumulates silently without periodic sweeps -->
State Files
Agents must read and update these files — they are the source of truth, not chat history:
| File | Purpose | When to Read | When to Update |
feature_list.json | Feature declarations (id, behavior, dependencies, layers) | Session start | When features are added, split, or redefined |
.harness/state/<id>.json | That feature's mutable state (state, evidence) | Session start | After every feature state change |
PROGRESS.md | Generated current-state dashboard and session index | Session start | Regenerate at session end |
progress/NNN-YYYY-MM-DD.md | One session's durable notes | Session start | Session end |
claude-progress.md | Compatibility alias for progress tracking | Session start (if used) | Session end (if used) |
DECISIONS.md | Architectural decisions log | Before major decisions | After any architectural decision |
session-handoff.md | Multi-session handoff notes | Session start (if present) | Session end (for large sessions) |
Definition of Done
A feature is done only when ALL of the following are true:
- Target behavior is implemented
- Required verification actually ran (tests / lint / type-check / build)
- Layer 1 (syntax/static checks) passes
- Layer 2 (runtime behavior/tests) passes
- Layer 3 (system confirmation/e2e) passes when crossing component boundaries
- Evidence recorded in
.harness/state/<id>.jsonand session notes inprogress/ - Repository remains restartable from
./init.sh
Verification Commands
# Full verification (recommended) — make and npm forms are 1:1 mirrors
make check # or: npm run checkRequired checks (each with its npm mirror):
make lint/npm run lint— Static analysis and code stylemake typecheck/npm run typecheck— Type checking (if applicable)make test/npm run test— Unit and integration testsmake build/npm run build— Production build verificationmake e2e/npm run e2e— End-to-end tests (required for cross-component changes)make quality/npm run quality— Opt-in metric gates from.harness/quality.json(coverage, mutation score, …); SKIP while disabled
Other mirrors: check-arch, verify-feature (npm run verify-feature -- <id>), activate (npm run activate -- <id>), verify-all, lane-new (-- <id>), lane-list, lane-land (-- <id>), lane-drop (-- <id>), lane-suggest, migrate-feature-state, add-feature (-- <id> <name>), vcr, harness-docs, create-harness, harness-upgrade, harness-audit, backup-list, backup-pin (-- <id>), backup-unpin (-- <id>), backup-restore (-- <id>), report, sweep, session-start, session-end, clean-check, setup, dev, help.
make check runs all layers in order (lint → typecheck → test → build → e2e → optional verify-all → optional quality). The multi-repo layer reports SKIP when its markers are absent, and the quality layer while .harness/quality.json is disabled; other unconfigured layers also report SKIP and do not count as verified. A failing layer stops the chain. Both surfaces delegate to the same Node runner (scripts/framework-check.mjs); npm run check is the make-free entrypoint.
Architecture Boundaries
- Document architectural constraints in
.harness/arch-rules.json - The reusability seam contract lives in
.harness/manifest.jsonanddocs/ARCHITECTURE.md— keep both accurate in the same commit as any repository layout change - Run
make check-archto enforce layer dependencies and invariants - Every new error category caught in review becomes a rule in
.harness/arch-rules.json - See Architecture Docs for the full layer model
Observability
- Complete a sprint contract (
templates/sprint-contract.md) before starting each feature - Session traces are recorded to
.harness/traces/viamake session-start/make session-end - Score completed sprints against
templates/evaluator-rubric.md— every dimension must reach B or above - See Observability Docs for the full protocol
Tools and MCP
.claude/settings.jsondenies Claude Code reads of secret files (.envvariants,~/.ssh,~/.aws, …); every other permission stays at the tool's own default. It is not a security boundary: scripts can still open those files- Codex and Gemini CLI get no shipped permission file;
docs/TOOLS.mdsays how to get the same protection there, and how to opt into Claude Code's OS sandbox - Never add
allowrules for sensitive actions (writes outside the project, network, installs, pushes) to the shared settings file — it applies to every teammate - MCP integrations and permitted capabilities are documented in
docs/TOOLS.md
Skills
Skills are reusable capability packs in skills/ — one folder per skill, each with a SKILL.md (frontmatter: name and description; sections: When to Use, Workflow, Quick Reference). Load the relevant skill when starting that kind of work:
feature-cycle— the one-feature-at-a-time loopverification— running the gates honestly and reading their outputsession-handoff— ending a session durablyadopt— bootstrapping the harness in a new projectparallel-lanes— an agent proposes a parallel-lane plan from independent features; a human approves every state-changing steprelease— the final pass before reporting work donecommit— focused commits, one logical operation, message explains WHYreview— an independent verification pass before the feature gateupdate-docs— the docs-drift pass (same-commit rule)write-skill— authoring new skills (project skills may be added underskills/)
Skill structure is validated by the lint layer; see the write-skill skill for the format.
End of Session
Before ending a session:
- Run
make clean-check— confirms build passes, no debug artifacts, progress updated - Start the session note with
node scripts/framework-check.mjs progress-new "<title>"(it picks the number, date and heading lint requires, writes the sections and refreshesPROGRESS.md), then fill in every section; after any later state change runnode scripts/framework-check.mjs progress-update - Keep
feature_list.jsondeclaration-only; feature state belongs in.harness/state/<id>.json - Update
docs/quality-document.md: name each feature that passed this session (its id, what changed, which modules) and rate those modules A/B/C/D —clean-checkfails until every gate-verified feature is mentioned - Record any unresolved risks or blockers
- Commit with descriptive message explaining WHY, not just what
- Leave repo clean enough for next session to run
./init.shimmediately
If running low on context: Do NOT rush to finish — stop, add a concise note under progress/, regenerate PROGRESS.md, and commit a clean checkpoint.
Escalation
If you encounter:
- Architecture decisions: Consult
docs/ARCHITECTURE.mdandDECISIONS.mdfirst, thendocs/decisions/ - Unclear requirements: Check
docs/PRODUCT.mdif present, otherwise ask user. A test that contradicts the declared behavior is not unclear requirements: the behavior wins (see Working Rules) - Repeated test failures: Update
PROGRESS.md, flag for human review - Scope ambiguity: Re-read
feature_list.jsonfor definition of done
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.

