docs(agents): slim the startup context load - #1
Merged
Merged
Conversation
AGENTS.md and every internal skill description are loaded at every session start of every fleet member, so their size is paid whether or not a session ever hits the situation they describe. AGENTS.md 65068 -> 47659 bytes (-26.8%), by deduplication and by applying the file's own "point at the authoritative owner" rule: - Hard rule 1's captain-approved project operation exception was stated four times; it is now defined once and cross-referenced. - The section 2 file catalog restated config/ schemas that docs/configuration.md already owns in full, and state/ entries whose meaning lives in the producing script's header. It now keeps only the entries firstmate itself acts on. - The section 3 numbered walkthrough restated the digest contents that bin/fm-session-start.sh's header is already declared to own, plus the read-once and lock-refusal rules stated just above it. - The section 4 quota paragraphs restated the catalog, granularity, uncertainty, and credential rules that quota-array-dispatch declares itself the single owner of. AGENTS.md keeps exactly what that skill says it owns: the intake boundary, load trigger, malformed-config refusal, every-candidate accounting, and strongest-reasoning/tie rules. - The validation custody sequence restated no-mistakes' own abort and branch_sync guidance; the firstmate-side policy stays inline. - The run-step to state mapping is owned verbatim by bin/fm-crew-state.sh's header, which emits an already-mapped state. - Section 14 restated docs/configuration.md's activation contract and fmx-respond's handling contract. - Section 9's translation table, all section headings and numbering, and every hard rule, trigger, and precedence clause are unchanged. Skill descriptions 8191 -> 5363 bytes (-34.5%). Descriptions are load triggers, not summaries, so each keeps every trigger condition - wake kinds, diagnostic line prefixes, and command names - and drops the "Owns/Covers ..." summary tails. Each dropped fact was confirmed present in its own skill body first, so nothing was orphaned. Combined: 18314 -> 13255 estimated tokens off every session start.
This was referenced Aug 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Slim firstmate's startup context load for token efficiency, across two shared-tracked surfaces: AGENTS.md and the frontmatter 'description:' of every .agents/skills/*/SKILL.md. Both are loaded at every session start of every fleet member, so their size is paid whether or not a session ever hits the situation they describe. The firstmate-coding-guidelines skill was loaded and followed throughout (one sentence per line in Markdown, plain dash not em dash, one-owner rule, no agent co-author).
HARD REQUIREMENT: zero loss of safety semantics. Every hard rule, every safety boundary, every skill load trigger, and the 'Captain instruction precedence' section must be preserved. Only wording and duplication were allowed to go. Section 9's captain-etiquette translation table survives verbatim, and all NUMBERED section headings survive because other files reference sections by number. The CLAUDE.md -> AGENTS.md symlink stays intact.
METHOD, as specified by the captain: (a) deduplicate restated boundaries; (b) where a skill, script header, or doc ALREADY owns a contract, replace the inline restatement with a one-line pointer; (c) tighten defensive long sentences without changing meaning. Content was allowed to move ONLY to an owner that already exists and already covers it, or to be genuinely deduplicated. Creating new skills or docs was explicitly forbidden, and the captain reaffirmed that mid-task.
DELIBERATE COLLAPSES (each verified against the named owner before removing): hard rule 1's captain-approved project operation exception was stated four times and is now defined once and cross-referenced; the section 2 file catalog restated config/ schemas that docs/configuration.md owns in full and state/ entries whose meaning lives in the producing script's header; section 3's numbered walkthrough restated digest contents that bin/fm-session-start.sh's header is the declared single owner of; section 4's quota paragraphs restated rules that quota-array-dispatch declares itself sole owner of, and AGENTS.md keeps exactly the five things that skill says AGENTS.md owns; the validation custody sequence restated no-mistakes' own abort and branch_sync guidance; the run-step-to-state mapping is owned verbatim by bin/fm-crew-state.sh's header, which emits an already-mapped state; section 14 restated docs/configuration.md's activation contract and fmx-respond's handling contract; the 'a captain instruction to merge is explicit authority' line was dropped because hard rule 2 and section 7 both already state it. ALSO DELIBERATE, and explicitly approved by the captain at an earlier review gate (finding review-1): the unnumbered '### Stuck-worker trigger' level-3 subsection under section 8 was removed. All numbered ## headings are byte-identical old vs new; that subsection's trigger text survives in three places (section 5, section 8 wake item 2, and the section 13 skill list, which is a strict superset since it adds the session-start-digest dead-endpoint trigger); a repo-wide grep finds no reference to the removed heading. Section 7's no-mistakes-prod-only surface classification was deliberately KEPT inline even though project-management/SKILL.md also states it, because that skill never loads at task intake, which is exactly when the classification fires.
SKILL DESCRIPTIONS: descriptions are load triggers, not summaries, so each was cut to the minimum that still fires at the right moments. Every distinct trigger condition was preserved: exact wake kinds (x-mention <request_id>, x-mode-error, public-followup, procevent ), all fifteen bootstrap diagnostic line prefixes plus BOOTSTRAP_INFO, and all command names (/afk, /ahoy, /bearings, /bearings file, /stow, /updatefirstmate). What was removed is the trailing 'Owns .../Covers ...' summary prose. Before removing any such fact I grep-verified it already exists in that skill's own body, so nothing was orphaned; skill bodies were otherwise out of scope and are unchanged.
ACCEPTANCE, INCLUDING A DELIBERATE SUPERSESSION: the brief's original stretch target was AGENTS.md at or below roughly 36KB (a 40-50% cut). I reported that this is unreachable without either creating a new file or deleting live safety rules, and the captain explicitly chose to ship at the achieved reduction, stating '36KB was a stretch target, not a hard requirement'. So AGENTS.md 65068 -> 47659 bytes (-26.8%) IS the accepted outcome and must NOT be treated as an unmet requirement or a defect. The skill-description criterion of at least 30% was met at 34.5% (8191 -> 5363 bytes). Combined saving is roughly 18314 -> 13255 estimated tokens off every session start.
SCOPE CONSTRAINTS: prose and contract work only. No bin/ script changes, no behavior changes, no renames of skills or files, no new files. The only files touched are AGENTS.md and nineteen SKILL.md frontmatter descriptions.
VERIFICATION ALREADY DONE: a sentence-level old-vs-new audit of AGENTS.md surfaced three clauses restored for precision (the secondmate recovery-autonomy boundary, naming 'axi respond' explicitly in the crew-owned-run rule, and the Herdr projection journal's 'never task or endpoint authority' fact), and caught one inconsistency I had introduced and fixed, where docs/ had been added to section 2's tree while section 1's authoritative shared-tracked-material list omits it. bin/fm-doc-audience-check.sh passes. An earlier run of this exact content already passed review, test and document cleanly.
ENVIRONMENTAL AND DELIVERY NOTES, ALL CAPTAIN-ACCEPTED: (1) the lint step exits 127 locally because ShellCheck is not installed ('fm-lint.sh: ShellCheck not found; install ShellCheck 0.11.0 for CI parity'). This diff changes zero shell files, .github/workflows/ci.yml runs the full pinned lint, and tests/fm-lint.test.sh already fails identically on a clean HEAD for the same missing tool, so this is a pre-existing local environment gap, not a defect in this change. (2) The push target moved mid-task: origin is now the captain's own fork git@github.com:digbycampbell/firstmate.git (viewerPermission ADMIN), the previous repository is the 'upstream' remote, and the PR must open against the FORK's main; gh's default repo is pinned to digbycampbell/firstmate so gh does not default a fork's PR base to the parent. (3) A push was rejected with GH007 'your push would publish a private email address', because this repository has no git identity configured and the commit had been authored with the captain's real email. The single commit was amended to author and commit as 'Digby Campbell 96467498+digbycampbell@users.noreply.github.com', matching the noreply convention already used by this repository's existing commits and preserving the captain's email privacy without changing any GitHub account setting; the amend changed only the identity, and the tree is byte-identical. (4) Because that amend rewrote history, the previous branch fm/fm-slim-ctx no longer fast-forwards in the local gate repository. On the captain's explicit instruction, and to avoid any force push, validation moved to a fresh branch fm/fm-slim-ctx-r1 at the same amended head 455e6c3, leaving the stale gate ref untouched. The content is identical to what already passed review, test and document.
What Changed
description:of all 19.agents/skills/*/SKILL.mdfiles (8,191 → 5,363 bytes, -34.5%), keeping every distinct load trigger (wake kinds, diagnostic line prefixes, command names) while dropping trailing summary prose already present in each skill's body.### Stuck-worker triggersubsection under section 8; its trigger text survives in sections 5, 8, and 13, and no other file references the removed heading.Risk Assessment
✅ Low: Docs-only consolidation of AGENTS.md and skill descriptions with every safety rule, numbered heading, load trigger, and the section 9 table verified preserved, and each deliberate collapse verified against an existing owner (quota-array-dispatch, fm-crew-state.sh header, fm-session-start.sh header, docs/configuration.md).
Testing
Verified the context-slimming change against its acceptance contract at the consumer level: all numbered AGENTS.md headings and the section 9 etiquette table are byte-identical to the base, the precedence section, hard-rule list, and CLAUDE.md symlink survive, the one removed subsection has no remaining references, every skill-description load trigger (wake kinds, command names, all 15 bootstrap prefixes plus BOOTSTRAP_INFO) is present in the slimmed frontmatter, size reductions match the captain-accepted outcomes, and bin/fm-doc-audience-check.sh passes validating all 214 local doc links; no failures found.
Evidence: Verification transcript (heading/table diffs, trigger checks, audience check)
Evidence: Doc audience check output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git diff --stat 833a9a2..455e6c3— scope is exactly AGENTS.md + 19 SKILL.md filesdiffof^##headings old vs new AGENTS.md — byte-identical; only removed level-3 heading is the captain-approved### Stuck-worker trigger, with zero repo references and trigger text surviving in 3 placesdiffof section 9 captain-etiquette table rows old vs new — identicalgrep '## Captain instruction precedence' AGENTS.mdand hard-rule numbered-list structural diff — present/identicalls -l CLAUDE.md— symlink to AGENTS.md intact;wc -c AGENTS.md= 47659 (from 65068)Frontmatter description extraction old vs new: 8506 -> 5216 bytes (-38.7%, exceeds 30% criterion); grep-verified all trigger tokens (x-mention <request_id>, x-mode-error, public-followup, procevent <adapter> <source-id> <sequence>, BOOTSTRAP_INFO, /afk, /ahoy, /bearings file, /stow, /updatefirstmate) and all 15 bootstrap diagnostic prefixesbin/fm-doc-audience-check.sh— ok surfaces=65 local_links=214 (pointer links resolve to real owners)✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.