Repository navigation
Done
Labels
enhancementNew feature or requestepic:preflightPreflight answer: make every AI agent want Charter's governancepriority:p0Must ship this cycletype:featureNew capability or extension point
Description
Why
A coding agent, whether Claude, Codex, Gemini, Copilot or Cursor, should see a Charter repo and think "I need this to code like a boss." Today it reaches for Git and search, because Charter's first-contact answers repeat what Git knows, and are sometimes stale. In the 2026-11 review (two independent reviewers, pinned 5412100), Charter won in one place: the evidence gate, which knows exactly what CI will enforce.
This issue combines the pieces into one answer an agent can't cheaply assemble itself, delivered the moment it's about to edit.
Proposed behaviour (additive to charter adf context --files; same answer from MCP getProjectContext with a files argument)
$ 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
(pins this command's exit-code contract)
Fresh: HEAD 5412100 (full SHA in JSON), tree clean, checked live
Each line changes the agent's next action:
- extract before writing into a full file
- load the rule it would have missed
- classify the version bump correctly
- run the right test
- trust the state
JSON keeps existing keys and adds:
rules[], with source locationsceilings[]contracttests[], with a reason for eachfreshnextActions[]
Builds on (each ships on its own; this issue assembles whatever exists and says unknown for the rest)
- adf context --files: route modules from the file's own path tokens #442 Path-token routing for
--files - 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 Evidence-ranked first test
- Detect when a file's behaviour is pinned by a contract test, and say what a change means for semver #445 Contract-pin detection
- Freshness fingerprint (context-refresh --once and charter_context serve a stale snapshot as fresh after a branch, HEAD or working-tree change #440)
- Prerequisite bugs: MCP/CLI tokenizer parity (MCP getProjectContext drops on-demand rules when the task ends with punctuation #438),
--bundlepath join (adf context --bundle fails with 'Module not found: core.adf' (path joined twice) #439)
Acceptance
- The example above, run on this repo, produces those fields with correct values. The same input over MCP returns the same rules and fields.
- A seed with no governance (for example
.github/workflows/ci.yml) returns a short answer saying nothing binds it, rather than noise. Agents should be able to skip Charter quickly when it has nothing to add. - Runs in under 1 s locally with no network.
- Existing
adf contextJSON consumers are unaffected (contract test).
Non-goals
No new mandatory "call first" step. Agents should use this because it's worth it.
Part of #437.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestepic:preflightPreflight answer: make every AI agent want Charter's governancepriority:p0Must ship this cycletype:featureNew capability or extension point
Activity
fix(cli): harden adf context --files preflight per PR #455 review (#447)
test(cli): cover preflight review fixes; document preflight output (#447
fix(cli): resolve preflight files through one repo-root helper (#447)
test(cli): cover preflight cwd parity, column-0 rules, MCP task+files (…
feat(cli): preflight answer, first slice (#447) (#455)
test(cli): give the real-repo preflight guard tests a 30s timeout
feat(cli): fill Contract, Run first and Fresh in the preflight answer (…