Repository navigation
Description
North star
Charter should be the governance standard for AI-assisted development. Every coding agent (Claude, Codex, Gemini, Copilot, Cursor and others) should see a Charter repo and think "I need this to code like a boss": it should want Charter's guideposts, not tolerate them because a pointer file says "call this first".
Where we are (2026-11 review, pinned 5412100)
Two independent reviews (Claude/Fable and Codex), plus a full day of real agent maintenance in this repo, reached the same finding. Agents reach for Git and search by default, and are right to, because Charter's first-contact answers repeat what Git knows and are sometimes wrong:
- The snapshot reports "fresh" after a branch switch.
- MCP drops a binding rule when the task ends with a period.
getProjectStatereports green while the live gate is red.
Charter won in one place, the evidence gate. It knows exactly what CI will enforce, names the source file and the measured value against its ceiling, and verifies the repair in one call.
The opportunity is to give agents that same exact, decision-changing answer before they edit, combined with the rule that binds the file, whether it's a published contract, and the right test to run.
The answer we're building (#447)
$ charter adf context --files packages/cli/src/commands/adf-evidence.ts
Binds: adf-dev.adf → "ADF package has zero runtime dependencies" (.ai/adf-dev.adf:18)
Headroom: adf_evidence_loc 274/313 → 39 lines left
Contract: exit codes + --format json pinned by evidence-contracts.test.ts → breaking = major + migration note
Run first: pnpm exec vitest run packages/cli/src/__tests__/integration/evidence-contracts.test.ts
Fresh: HEAD 5412100, tree clean, checked live
Each line prevents a real mistake:
- writing into a full file
- missing a rule
- shipping a breaking change as a patch
- running the wrong test
- trusting stale state
How the pieces combine
Every issue ships value on its own. Combined, they form the preflight answer.
Trust floor: answers must be right before they can be loved
- MCP getProjectContext drops on-demand rules when the task ends with punctuation #438 MCP/CLI tokenizer parity (p0)
- adf context --bundle fails with 'Module not found: core.adf' (path joined twice) #439
adf context --bundlepath bug (p0) - context-refresh --once and charter_context serve a stale snapshot as fresh after a branch, HEAD or working-tree change #440 Snapshot freshness fingerprint plus
staleandstaleReasons(p0) - getProjectState reports 'All constraints pass' while live evidence fails #441
getProjectStatefalse green (p1)
Parts of the preflight answer
- adf context --files: route modules from the file's own path tokens #442 Route from file-path tokens: the binding rule
- adf context --files: report live ceiling headroom for each file #443 Live ceiling headroom
- Rank first-test candidates by direct symbol evidence, not import distance #444 First test ranked by direct evidence
- Detect when a file's behaviour is pinned by a contract test, and say what a change means for semver #445 Contract-pin detection and semver guidance
The assembled answer
- Preflight: one answer (binding rule, headroom, contract, first test, freshness) before an agent edits a file #447 Preflight: one answer before an agent edits a file (p0; assembles whatever parts exist and says
unknownfor the rest)
First contact: where agents meet it, across every vendor
- First contact: every vendor pointer and every gate failure shows the preflight answer #448 Every vendor pointer and every gate failure shows the preflight answer
- charter_brief reports scaffold-generated routes as implemented endpoints, and its evaluator still passes #449 Brief reports scaffold routes as implemented, and its evaluator still passes
- Hook can answer with the wrong Charter CLI, and a fresh clone has no local gate #450 Hook can answer with the wrong CLI; fresh clone has no gate
Follow-on
- classify labels contract-breaking changes SURFACE or LOCAL #446
classifylabels contract breaks as SURFACE or LOCAL - smart-commit.sh can't set a message or trailers, so core.adf's commit rule is unfollowable #459
smart-commit.shcan't set a message or trailers, socore.adf's commit rule is unfollowable - Preflight follow-ups: task-only Binds, nested .ai/, MSYS paths, new files from subdirectories #460 Preflight follow-ups from the feat(cli): route adf context --files modules from path tokens #452/feat(cli): preflight answer, first slice (#447) #455 reviews
- Preflight: a missing ON_DEMAND module shows as '(no load-bearing rules)' instead of unreadable #461 Missing ON_DEMAND module shows as "no load-bearing rules" instead of unreadable
- Preflight parts follow-ups: Windows drive-letter test ranking, semicolon-free import parse, and 9 minors #467 Preflight parts follow-ups (two Windows/parse false negatives first)
Proof
- Voluntary-use pilot: do AI agents choose Charter, and code better when they do? #451 Voluntary-use pilot (native vs. flat instructions vs. optional Charter, across two or more agents)
Suggested order (two weeks)
- Days 1–4: build Preflight: one answer (binding rule, headroom, contract, first test, freshness) before an agent edits a file #447 on one file, fixing the parts on its path: MCP getProjectContext drops on-demand rules when the task ends with punctuation #438, adf context --bundle fails with 'Module not found: core.adf' (path joined twice) #439, context-refresh --once and charter_context serve a stale snapshot as fresh after a branch, HEAD or working-tree change #440, adf context --files: route modules from the file's own path tokens #442, adf context --files: report live ceiling headroom for each file #443, Rank first-test candidates by direct symbol evidence, not import distance #444, Detect when a file's behaviour is pinned by a contract test, and say what a change means for semver #445.
- Day 5: First contact: every vendor pointer and every gate failure shows the preflight answer #448, so agents meet the answer first.
- Week 2: Voluntary-use pilot: do AI agents choose Charter, and code better when they do? #451 pilot; getProjectState reports 'All constraints pass' while live evidence fails #441, charter_brief reports scaffold-generated routes as implemented endpoints, and its evaluator still passes #449, Hook can answer with the wrong Charter CLI, and a fresh clone has no local gate #450 in parallel.
Parallel tracks that don't block each other:
- Correctness: MCP getProjectContext drops on-demand rules when the task ends with punctuation #438–441
- Parts: adf context --files: route modules from the file's own path tokens #442–445
- Surfaces: First contact: every vendor pointer and every gate failure shows the preflight answer #448–450
Principles
- Cross-agent first. Same answer from the CLI, MCP, and every vendor pointer.
- Additive only. Existing JSON keys and exit codes stay; new fields are added.
- Local-first. No network, under 1 s.
- Honest. Say
unknownrather than guess. Say "nothing binds this file" so agents can skip Charter quickly when it has nothing to add. - Owner-controlled policy. Raising a ceiling is the maintainer's decision, never the default repair.
Relationship to existing issues
- Release needed: published 2.1.0 still overwrites a hardened governance workflow (docs on main say it won't) #397 (release needed): blocks real-world reach. This work lands in the 3.x source, but most agents run npm
latest(2.1.0). Releasing is what puts preflight in front of agents. First contact: every vendor pointer and every gate failure shows the preflight answer #448 may only advertise shipped behaviour, and Voluntary-use pilot: do AI agents choose Charter, and code better when they do? #451 runs on a release or a stated, locally built commit. - Make governance trailers meaningful: resolve references and allow per-repo risk patterns #292 (per-repo risk patterns): classify labels contract-breaking changes SURFACE or LOCAL #446's diff classification reuses Make governance trailers meaningful: resolve references and allow per-repo risk patterns #292's configurable risk patterns. One risk model, not three.
- hook: commit-msg gate does not apply CI's HIGH-risk unlinked-commit check #342 (hook vs CI HIGH-risk check): classify labels contract-breaking changes SURFACE or LOCAL #446's staged-diff mode is the capability hook: commit-msg gate does not apply CI's HIGH-risk unlinked-commit check #342 needs. First contact: every vendor pointer and every gate failure shows the preflight answer #448 renders gate failures through one path for the hook and CI, so they can't disagree.
- score: add harness-enforcement dimensions (Claude Code hooks, evals, memory, cost, GitHub hygiene, deploy targets) #311 (score dimensions): deferred. Hook can answer with the wrong Charter CLI, and a fresh clone has no local gate #450 and score: add harness-enforcement dimensions (Claude Code hooks, evals, memory, cost, GitHub hygiene, deploy targets) #311 share one hook-detection routine, which covers every vendor's hooks, not only Claude Code's.
- research-dispatch: Implement the new framework for test-time scaling in your own LLMs to improve pe #271 (research dispatch): unrelated to this epic.
Deferred
adf suggestreplay against labeled tasks: promising, but its over-routing hasn't been reproduced yet.- Recalibration guard and flagging unchecked load-bearing rules.
- New score dimensions (score: add harness-enforcement dimensions (Claude Code hooks, evals, memory, cost, GitHub hygiene, deploy targets) #311).
- Any new mandatory "call first" step.
What would change the plan
If #451 shows optional Charter within noise of flat compiled instructions on first-attempt success, or voluntary reuse under ~30% of eligible runs, move the answer to the gate-failure output only and narrow Charter to the evidence gate.
Activity
fix(cli): share task tokenizer with MCP and fix adf context --bundle …
feat(cli): report live ceiling headroom in adf context --files (#454)
feat(cli): preflight answer, first slice (#447) (#455)