docs: cut the every-session context set by 74%, and fix what the cut broke #105
Reference in New Issue
Block a user
Delete Branch "docs/slim-agents-md"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Trims the two files every session pays for, then fixes the fifteen defects a full review of that trim found.
Why
AGENTS.mdis preloaded viaCLAUDE.md's@AGENTS.mdimport, andAGENTS.mdin turn instructs readingCONTEXT.mdanddocs/VISION.md. Every word in that set is a tax paid whether or not it is relevant to the session.AGENTS.md(preloaded)CONTEXT.md(instructed read)docs/VISION.md(instructed read)Nothing was deleted that wasn't either relocated or independently verified as already carried elsewhere.
What moved where
Content was split by audience rather than by heading:
README.md, which did not previously exist.docs/spec/gates.md. Every constant, hook ID, error string and tried-and-rejected note was preserved; these exist to stop settled decisions being re-litigated.CONTEXT.mdglossary entry) → nine subsections ofgates.md.docs/spec/architecture.md. The reference principle is flagged aspirational: no instruction file carries awhen:field, only 2 of 39 skills do, and the scanner script it names does not exist.CONTEXT.mdwas restructured to conform togrill-with-docs's ownCONTEXT-FORMAT.mdtemplate, which it had never followed — 23 glossary entries averaging 190 words against a documented "one sentence max".Review findings, and the fixes
A four-way review (content-loss audit on each trimmed file, a dangling-reference sweep, and a fact-check of the new prose against the repo) found 15 defects. All are fixed in commits 4–9.
Content loss: two real drops, both restored. The
apm pack-won't-refresh-the-mirror warning and the plugin self-containment constraint. Both were guard-rails that fired from preloaded context, so restoring the sentence to an on-demand doc would have restored the text without the function. They are placed by when they need to fire: the first now lives in the DRIFT failure message of the hook that already catches that exact mistake; the second inarchitecture.mdbeside the mechanism, since no gate catches it.Dangling references: 11 across 8 files. Six were rationale comments in
scripts/andtests/citingCONTEXT.mdtext that moved. These were re-anchored to ADR-0013 where it owns the fact, and had their citation dropped entirely where no ADR does — the quote was already inline, so the citation added a rot surface and no information. Two ADRs (0007, 0015) that the trim missed now carry dated amendments, matching the three that got them.Stale claims.
CONTEXT.mdpointed atgates.mdfor a measurement method that lives in ADR-0020, and carried a token figure that was wrong three days after being written — dropped rather than re-measured, since it was the file's only live number. It also named asession-handoffskill that does not exist.Published metadata was wrong.
gitea's marketplace description advertised wikis (no wiki skill exists) while omittinggitea-branchesandgitea-files;git's advertised pull requests, which are gitea's, while omittingpc-author/pc-run. This is the same defectbb9158dfixed oncorein August, so the fix follows that precedent — packageapm.ymland root marketplace entry together, versions bumped, manifests regenerated.To stop it recurring a third time, the two sources now have distinct jobs: published descriptions enumerate (a consumer needs to know what they get),
architecture.md's table states routing boundaries only (it answers "where does a new skill go"). They are supposed to differ, so nobody should be diffing them.Versions
git1.3.3 → 1.3.4,gitea1.3.4 → 1.3.5, marketplace 0.4.2 → 0.4.3 — all PATCH for metadata under theper_packagestrategy.A release tag is likely needed at merge.
check-release-neededonly fires againstrefs/heads/main, so it stayed silent on the feature-branch pushes, but the version bumps above are exactly what it exists to catch.Verification
pre-commit run --hook-stage pre-push --all-files— 16/16 Passed, exit 0bash tests/run-tests.sh— full suite greenagentsmd-audit— secrets clean, drift clean, informational findings only for sections deliberately relocated to the READMEmain; no commits onmainsince the branch pointKnown trade, not a defect
AGENTS.mdnow says "14 repo-defined hooks" while the command it hands you prints 16; the reconciliation (pre-commit's twometahooks declare nostages:) moved togates.md. Same shape for thepretty-format-jsonguard. Both previously fired from preloaded context and now require openinggates.mdfirst. That is the deliberate cost of the trim, recorded here rather than left to be rediscovered.Refs: #99
Why: CONTEXT.md is an instructed every-session read at 33,799 bytes (~8,450 tokens), and CONTEXT.md:17 layered docs/VISION.md on top. After the AGENTS.md trim, that left ~9,650 tokens of instructed reads sitting behind a file whose own format contract — grill-with-docs/CONTEXT-FORMAT.md:43, "Keep definitions tight. One sentence max." — it was not following. 22 glossary entries averaged 190 words; the top four were 55% of the file, and one ("Vale audit prefilter") was 1,444 words of pre-commit forensics filed as a definition. Implementation notes: - CONTEXT.md rewritten to CONTEXT-FORMAT.md's prescribed template: ## Language (five clusters, 22 terms with _Avoid_ aliases), ## Relationships, ## Example dialogue, ## Flagged ambiguities. 33,799 -> 9,762 bytes. - Vale prefilter forensics moved to docs/spec/gates.md under nine subsections: the two-copy style layout, vale-wrap.sh and the Vale 3.15.2 text.frontmatter.description limitation, the --config argv defect (E100), glob scoping, the rule inventory, and 0-files-means-NOT-RUN. - Instruction-file format and the bidirectional-reference principle moved to docs/spec/architecture.md, the latter flagged as aspirational: no instruction file carries a `when:` field, only 2 of 39 skills do, and the reference scanner script it names does not exist. - Added a per-plugin scope table to architecture.md so "which plugin owns this skill" survives the trim, and corrected its claim that the content index lives in providers/claude-code/CLAUDE.md — that file is now two import lines and the index sits in core/AGENTS.md. - "Repo and Gitea are the only source of truth" moved from CONTEXT.md's Principles into AGENTS.md session rules; it was operative guidance in a glossary. docs/VISION.md and LESSONS.md added to the on-demand list. - The apm-consumed install entry (432 words) was deleted outright: all four consequences are already carried by README.md, ADR-0018, gates.md and AGENTS.md. - ADR-0013, ADR-0015 and ADR-0017 each pointed at CONTEXT.md sections that moved; amended with dated supersession notes rather than left dangling. Impact: the every-session set drops from ~15,700 to ~4,140 tokens across both passes (-74%). The deleted "lint plugin" entry was also stale on a safety claim — it said lint-runner inherits Edit, but ADR-0016 restored `disallowedTools: Edit, Write, NotebookEdit` and CONTEXT.md was never updated. Refs: #99Review round two: 11 defects found, all fixed, plus one reversed decision
A five-way review of this branch at
de84d1bfound 11 defects. Six commits (b1ea14d..d42f636) fix them. Two blind verifiers then re-ran the first five commits and found four more — fixed ind42f636.Parts of the PR body above are now wrong. Corrections are in the "Body corrections" section at the bottom; read them before reviewing against it.
The one real bug
bd2bf66restored theapm packguard-rail by appending it to theFix:command after--. That made the printed line stop being runnable, and it was worse than it looked. Reproduced by execution:Pasting that (a) command-substituted a real
apm packrun via the unquoted backticks, then (b) hit--as the POSIX end-of-options marker, so${1:-}became--,CHECKstayed 0, no shift occurred, and[[ $# -eq 0 ]] || usageexited 1. The user got a usage error from the tool meant to fix their problem, and the mirror stayed stale. Fixed inb1ea14d; the command now stands alone on its own line, verified by pasting the printed output verbatim (exit 0, mirror synced, re-check clean).Note
tests/test-sync-marketplace-mirror.shasserts nothing about the DRIFT message, so this can regress silently. Tracked separately.The false-green risk
AGENTS.mdinstructedbash tests/run-tests.shwithout--strict. That is precisely the invocation where a suite whose dependency is missing exits 77, reports SKIPPED rather than failed, and the run goes green having verified less than it claims — the failure.pre-commit-config.yaml:71andgates.mdboth already record. Fixed in4d336bbwith the flag and a one-clause reason, so a future trim cannot drop it as noise.Relatedly,
tests/run-tests.sh:262— the message a developer is handed at the moment a push gate fails — still cited AGENTS.md for the dependency list this branch moved to README.md.56cc173re-anchored four files of this class and missed the only one a human reads. Fixed in3659659, verified by forcing the skip path withvaleoff PATH.Reversed decision: ADR-0021, enumeration retired
The "published descriptions enumerate" rule this PR's body proposes has now failed three times, and the third failure is inside the correction for the second:
bincaveman,zoom-outgitgit-workflowgiteagitea-workflow23 of 27 at the third attempt — and
git-workflowis missing despite65bac15's own message claiming it was added.Critically,
bb9158d(the August precedent this PR cites) was a wrong-content failure, not an incomplete list:core's description was a syntactically perfect four-item enumeration ofbin's skills. Enumerating harder could not have caught it, and a gate asking "does every enumerated item exist?" would have passed it — all four existed.bb9158d's own fix replaced the enumeration with a domain boundary.c7ba3d2retires enumeration and records the decision in ADR-0021, including why no gate is added. Versions:bin1.1.5,git1.3.5,gitea1.3.6, marketplace 0.4.5.Also closed: root
apm.yml's top-levelversion:was left at 0.4.2 whilemarketplace.versionwent to 0.4.4 — these have moved in lockstep in every commit that ever touched the file, andapm.yml's own comment records the top-level field as live and consumed byapm audit. No gate catches it:apm-pack-check-cleancompares compiled output againstapm.yml, not the two fields against each other.Corrected factual claims
c68e864andd42f636fix claims that did not survive re-measurement:gates.mdciteddocs/research/examples/; the tree is atplugins/kyberforge/docs/research/examples/gates.md's description-budget arithmetic rested on 23,427, an ADR-0020 figure pinned tof9b919d, and compared a name-inclusive total against a description-only ceiling — dropped rather than re-measured, following this branch's own precedent for CONTEXT.md's token figuregates.mdlisted "every routing target must resolve" as a hard FAIL. Verified with fixtures: SUGGESTION by default, ERROR only when terminal and route-notated or corroborated, INFO when no universe resolvesgates.md/README.mdcalledpre-commit run --hook-stage pre-push --all-filesthe whole push gate.check-release-needed.shis a no-op there — its own header calls this a "Known gap"architecture.mdclaimedwhen:appears in two of 39 skill sources; exactly oneSKILL.mdcarries it (the second hit is aMETA.md)architecture.mdsaidcore/AGENTS.mddeploys "beside" CLAUDE.md; they go to~/.agents/and~/.claude/Machine state removed from preloaded context
AGENTS.mdtold agents the<plugin>:form resolves "because user-scope native installs were left enabled on purpose". That premise is false here:installed_plugins.jsonis{"plugins": {}}, noenabledPluginskey exists in~/.claude.json,~/.apm/marketplaces.jsonis empty.ADR-0018 had already reversed itself once on this exact claim (Correction 2026-08-14) citing that same enablement as evidence. Rather than flip it a third time,
4d336bbmakes both files state nothing about install state, and ADR-0018 gets a dated note recording that this fact is machine state, not a property of the decision.What the blind verifiers caught in the fixes themselves
Four defects of the same class this branch exists to close, found after the first five commits and fixed in
d42f636:AGENTS.md:41still carried both phrasingsc68e864reports fixing —grep -rn 'repo-defined'returned exactly one hit repo-wide, in the preloaded fileapm.yml". All three do (skill-size-check.sh:342, bothvalidate.sh). The conclusion survives — none readsdescription:— but the mechanism was falsified by one greparchitecture.mdsaid 20 ADRs;c7ba3d2made it 21, in the filec68e864audited for stale counts. Number dropped —ls docs/adr/is already the indexgates.md's new verdict table said-> namepromotes to ERROR.NAME_HYPHrequires a hyphen, so-> gitea-prsis checked and-> triageis not extracted at all, and the SUGGESTION text advises that spelling — taking its advice can silence the finding. Documented as a defect; nothing covers it, since the one arrow case intest-adr0020-targets.shhappens to use a hyphenated targetAGENTS.md:48's coverage claim was shrunk rather than chased: restoring six glossary entries did not make it true (12 more sampled terms are undefined, three used inside CONTEXT.md itself).Body corrections
check-release-neededderives its pathspec solely from.pre-commit-hooks.yamlentries plus siblingassets/— four paths, none touched here. Andv2.0.0already points at9385c77, this PR's base. Cutting a tag "to satisfy the gate" would be cargo-cultingbin1.1.3 → 1.1.5 is not mentioned in the body at allCONTEXT.mdis not 9,762 B+1330/−243vs+1365/−278atde84d1b) — review against git, not the web UIapm.lock.yaml— a reviewer can skip the 350 linesEvery
resolved_commitmovesf9b919d → 9385c77: the lock catching up to content already merged in #103. No new or removed dependencies, no ref retargeting.lintlosingexec_status: gated_pending_approvaltraces to36ba7a1(already onmain), which removed its only approval-gated artifact ���plugins/lintships no executable at either commit. Not a trust downgrade. No consumer impact: this is the repo's own working-copy lock, and.claude/skills/and.claude/agents/are gitignored.Verification at
d42f636pre-commit run --hook-stage pre-push --all-files→ 16/16 Passed, exit 0bash tests/run-tests.sh --strict→ 24 passed, 0 skipped, 0 failedpre-commit run --all-filesfails on the documented ADR-0020 hot-gate baseline (26/9/10) — verified identical onmain; these commits touch noSKILL.md, noskill-size-check.sh, no Vale stylemarketplace.jsonmirrors byte-identical; description and version agree across all six locations per pluginCaveat:
d42f636fixes what the blind verifiers found, but has not itself been through a blind verification pass.Deferred to issues
gates.md's 12 undocumented pre-commit-stage hooks (incl. repo-localskill-frontmatter) · the-> namehyphenation gap and its missing test ·test-sync-marketplace-mirror.shpinning nothing about the DRIFT message ·ADR-0013:98's wrongdocs/research/examples/path ·skill-implementation-workflow.md:233's false "META.mdalongside every skill" claim · gates.md's ownSentenceOpenerThereIsviolation · README's missingscripts/install.shstep · CONTEXT.md's 12 undefined terms.Refs #99