Repository navigation
Description
Problem
Following the README's own sequence, then committing, corrupts .ai/core.adf:
npx @stackbilt/cli bootstrap --yes
npx charter adf compile --target all --write --force # README step 3
npx charter hook install --pre-commit
git commit # hook runs `charter adf tidy`compile --write writes full rule content into CLAUDE.md / AGENTS.md / .cursorrules / GEMINI.md. The pre-commit hook then runs charter adf tidy, which treats that generated content as "content added beyond the thin pointer" and ingests it back into .ai/core.adf. The two commands are mutually incompatible: one expands .ai/ into the vendor files, the other folds the vendor files back into .ai/.
What the round trip produced
core.adf after one commit (hand-authored file was 26 lines; it became 66):
📋 CONTEXT:
- <!-- agents-modules -->
- Read the matching file before working in these areas:
- <!-- /agents-modules -->
- # agents-modules
- Read the matching file before working in these areas:
- # /agents-modules
- <!-- agents-modules --> <- same marker block, 4 copies
...
⚠ CONSTRAINTS [load-bearing]:
...
- `entry_loc`: 0 / 500 [lines] <- METRICS captured as a constraint bullet
- **CURRENT**: Charter initialized — node, react, vite project <- state.adf content, 3 copies
- `.ai/frontend.adf` — Triggers: React, CSS, UI, ... <- the manifest module index
Three distinct failures:
- HTML marker comments become list bullets (
<!-- agents-modules -->), and accumulate a copy per run. - Sections cross-contaminate: the module index, METRICS and
state.adf's STATE all land insidecore.adf's CONSTRAINTS. - A deliberate deletion was silently reverted. I had removed the bootstrap-generated rule
Use .js extensions for all ESM importsbecause it is wrong for this Vite/TS repo (see bug(bootstrap): injects a stack-incorrect ESM extension rule as a load-bearing constraint #294).tidyread it back out of the compiledCLAUDE.mdand restored it to[load-bearing].state.adfwas likewise reverted to its bootstrap placeholder, discarding the authored STATE.
The corruption was committed, because it happens during the pre-commit hook. Nothing in the output said a source file had been rewritten.
Why it matters
This is the failure mode a governance tool exists to prevent: unattended, silent edits to the source of truth, including undoing a human's considered decision. An agent that bootstraps, compiles and commits — exactly the documented path — ends up with an .ai/ that is worse on every commit and does not notice.
Related symptom: check and sync can't agree
Once vendor files are pointers (tidy's model), charter adf compile --target all --check reports all four stale forever, and its remediation line is wrong:
[stale] GEMINI.md — out of date with .ai/ source.
Run: charter adf compile --target gemini --write
Running that produces byte-identical files (verified: same md5 over three runs) and --check still reports stale. charter adf sync --write, which sounds like the fix, writes an empty lock and changes nothing:
[ok] Wrote empty lock file at .ai/.adf.lock (no SYNC entries declared).
$ cat .ai/.adf.lock
{}
So compile --check is unusable as a CI gate in pointer mode.
Suggested fixes
- Make the two modes explicit and mutually exclusive. A repo is either compiled (vendor files hold content,
tidymust skip them) or pointer (vendor files are stubs,compile --writemust refuse). Record the mode in.charter/config.jsonand have each command respect it. The compile banner already identifies generated files —tidyshould skip anything carrying it. - Never let
tidywrite to.adfsources from a hook without saying so. At minimum print the diff summary; ideally require--writeand run--dry-runin hooks. - Never re-add a bullet that a previous tidy removed. A small ledger of ingested-then-deleted lines would prevent silently reverting human edits.
- Filter marker comments and section-specific content (
<!-- ... -->, module index tables, METRICS lines) from ingestion. - Fix
compile --check's remediation message so it names a command that actually resolves the state, or exclude pointer-mode files from the check.
Environment
@stackbilt/[email protected], Node 22.14, WSL2 (case-insensitive /mnt/c mount), fresh repo, no pre-existing agent config files.
Activity
stackbilt-admin commentedon Sep 20, 2026
Docs sweep update — 2026-09-19
Still present on
mainat 1856a64. Confirmed the exact mechanism while documentingadf tidy:adf-tidy.ts:243gates onPOINTER_MARKERS:POINTER_MARKERS[0]isCOMPILE_BANNER_MARKER(adf.ts:291-292). So a compiled vendor file does not fail that test — it passes it, and tidy proceeds to treat compiler output as a thin pointer and fold it back into.ai/. There is no banner-specific skip anywhere inadf-tidy.ts.The protection that exists today lives one level up, in the generated pre-commit hook (
hook.ts:53), which greps for the banner and drops those files fromSTAGED_VENDORSbefore tidy is invoked. That is what CHANGELOG 1.9.2's "pre-commit auto-tidy now ignores files produced bycharter adf compile" describes — the hook, not the command.Consequence: the bug is latent rather than fixed. Anyone running
charter adf tidydirectly, or through any path that is not the generated hook, still gets the round-trip corruption this issue reports.Note the interaction with #295 / PR #300, now merged:
adf compile --writerefuses to overwrite a pointer carrying retained content, so the compile direction is protected. The tidy direction is not.Documented as current behavior in
docs/cli-reference.mdundercharter adf tidyrather than described as fixed.Auto-updated by /docs skill.
docs: add missing adf command reference and record #295 fix (#308)
docs: correct the adf tidy note and document score, telemetry, stamp-…