Skip to content

refactor(skills): move trigger-time procedure out of AGENTS.md into on-demand skills - #76

Merged
alandomio merged 3 commits into
mainfrom
fm/agents-md-snello
Nov 7, 2026
Merged

alandomio merged 3 commits into
mainfrom
fm/agents-md-snello

Conversation

@alandomio

@alandomio alandomio commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Intent

riesci a spostare AGENTS.md in alcune skill per renderlo più leggero. quando inizi ad applicare i 12 principi degli agenti AI?

Context: earlier on 2026-11-07 firstmate analysed its own workflow against humanlayer/12-factor-agents. The top-ranked weakness was factor 3 (own your context window): every session loads about 70 KB before any work, AGENTS.md alone is 54 KB (353 lines), and the resulting frequent compactions caused lost details and repeated mistakes. Proposal #1, recommended, was "AGENTS.md split into a short core plus skills loaded only when needed". This ask starts that proposal.

What Changed

AGENTS.md is loaded into every Firstmate session, so procedure that only matters at a specific moment now lives in agent-only skills loaded at that moment, leaving a one-line trigger in AGENTS.md.

Size of AGENTS.md: 54193 bytes / 451 lines before, 27713 bytes / 260 lines after (-48.9%).
Section numbers and headings are unchanged, so existing AGENTS.md section N references and anchors still resolve.

Moved blocks and their new owner

Moved from AGENTS.md New owner
Section 7 intake: project resolution, secondmate routing, ship/scout/council classification, delivery mode, yolo, branch prefix, base branch, self-repo consent, prod-only surface classification, concurrency new task-intake
Section 4 dispatch-profile routing precedence and fm-dispatch-resolve.sh handling new task-intake
Section 11 brief-filling rules (intent, spec, recall placeholders, Herdr lab detail) new task-intake
Section 7 steering: fm-send, --resolve-key, remote resend, fm-control, secondmate replies, captain mid-task changes new worker-steering
Section 8 drain sections (OPEN DECISIONS, UNREAD STATUS, PENDING INBOX NOTES, RECORD DIVERGENCE, ack details) and per-wake-type handling new wake-handling
Section 9 internal-term rewrite table, final-message regression example, surface choice new captain-reporting
Section 6 knowledge destinations, CANDIDATE routing, correction mechanics new knowledge-routing
Section 10 filing, holding, re-evaluation and note hygiene new backlog-management
Section 7 extra direct-PR review rules ship-landing
Section 4 every-candidate quota accounting, eligibility and tie rules (already fully stated there) quota-array-dispatch (duplicate deleted, ownership line updated)

The six new skills are listed in agent-skill-trigger-index and registered as agent-runtime in docs/documentation-audiences.json.
Comments and docs that pointed at moved text now point at the owning skill; no script logic changed.

No rule weakened

These stay inline in AGENTS.md, word for word or with identical force:

  • hard rules 1-5, verbatim;
  • the self-repo publication boundary;
  • merge authority (yolo semantics, never merging red or with a required check that has not reported, mandatory fm-pr-merge.sh / fm-merge-local.sh);
  • captain-instruction precedence, verbatim;
  • worktree isolation for spawns and ship briefs;
  • lock-refused read-only mode;
  • never pkill watchers;
  • drain before acting and acknowledge only after handling;
  • read before asserting state or absence;
  • the standalone final message and full PR URL;
  • the ban on internal vocabulary in captain chat;
  • Telegram is never captain authority.

Every sentence removed from AGENTS.md was checked against the new file and the skills: it now lives verbatim in its new owner, was merged into a rule that is still inline, or was a pointer to a script header that already owns it.

Lint note

The pipeline lint step crashed inside bin/fm-lint.sh itself on this machine (LC_NUMERIC=it_IT makes EPOCHREALTIME use a comma, giving value too great for base), not on this diff.
The same lint on this head with LC_NUMERIC=C exits 0; the locale bug is filed as a separate follow-up.

Risk Assessment

✅ Low: The fix round only changes comments and docs, pointing stale AGENTS.md section references at the skills that now own that content (knowledge-routing, task-intake, wake-handling, quota-array-dispatch). The remaining AGENTS.md section references point to rules AGENTS.md still owns.

Testing

I ran the targeted tests for documentation and owner pointers, instruction rendering, harness references, AGENTS.md handling, startup-network and captain-hold-lifecycle; all passed, including the full 13-minute captain-hold-lifecycle suite. A verification report shows AGENTS.md is 48.9% smaller (54 KB to 27.7 KB). It also shows that every receiving skill has valid frontmatter, every skill AGENTS.md says to load resolves, the trigger index lists the new triggers, and no AGENTS.md section N reference points to a missing section. I read each line from the review round-1 findings and all now point at the skill that owns the content. This is a documentation and instruction change with no UI, so there are no screenshots; the evidence is the text report. I created no temporary files in the worktree.

Evidence: AGENTS.md split verification report (size, skill frontmatter, trigger index, section references)

Source: AGENTS.md split verification report (size, skill frontmatter, trigger index, section references)

AGENTS.md before: 54193 bytes, 451 lines; after: 27713 bytes, 260 lines (-48.9%). task-intake/worker-steering/wake-handling/captain-reporting/knowledge-routing/backlog-management: frontmatter OK, listed in trigger index and named in AGENTS.md. Unresolved load targets: none. References to missing AGENTS.md sections: none.

AGENTS.md always-loaded size
  before (130c652): 54193 bytes, 451 lines
  after  (9542821): 27713 bytes, 260 lines
  reduction: 48.9%

Skills receiving moved procedure (frontmatter check):
  task-intake            name=OK description=OK bytes=10205
  worker-steering        name=OK description=OK bytes=2666
  wake-handling          name=OK description=OK bytes=4945
  captain-reporting      name=OK description=OK bytes=3867
  knowledge-routing      name=OK description=OK bytes=3109
  backlog-management     name=OK description=OK bytes=2911
  ship-landing           name=OK description=OK bytes=4736
  quota-array-dispatch   name=OK description=OK bytes=12474
  stow                   name=OK description=OK bytes=38912

Skills named by AGENTS.md that resolve to .agents/skills: 22; 'load `X`' targets unresolved: none
  trigger index lists task-intake: yes; named in AGENTS.md: yes
  trigger index lists worker-steering: yes; named in AGENTS.md: yes
  trigger index lists wake-handling: yes; named in AGENTS.md: yes
  trigger index lists captain-reporting: yes; named in AGENTS.md: yes
  trigger index lists knowledge-routing: yes; named in AGENTS.md: yes
  trigger index lists backlog-management: yes; named in AGENTS.md: yes

AGENTS.md sections present: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
Cross-repo 'AGENTS.md section N' references pointing to a missing section: none

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 3 issues found → auto-fixed ✅
  • ⚠️ docs/configuration.md:752 - This line still says "AGENTS.md section 6 owns what a declaration changes about knowledge routing". That content (memory-tier routing, capture-on-behalf, correction rules) moved to .agents/skills/knowledge-routing/SKILL.md, and the commit updated other references in this same file but missed this one. A reader who follows the pointer lands on a section 6 that now only says to load knowledge-routing. Point it at the knowledge-routing skill. The same leftover appears at .agents/skills/stow/SKILL.md:223, whose heading still reads "Route each finding using AGENTS.md's knowledge-routing table" even though the next line now names the skill.
  • ℹ️ bin/fm-project-capacity-lib.sh:13 - Several comments still credit AGENTS.md sections with procedures that moved into skills: bin/fm-project-capacity-lib.sh:13 says uncapped dispatch is in "(AGENTS.md section 7)" (concurrency is now in task-intake); bin/fm-promote.sh:26 says delivery resolution at promotion is in "(AGENTS.md section 7)" (now task-intake); docs/architecture.md:319 says "The intake and authority contract in AGENTS.md owns when separate scout research is warranted" (now task-intake); and bin/fm-bootstrap.sh:70 says the dispatch-profile array "procedure in AGENTS.md section 4" (section 4 now holds only the trigger). Retarget each to the owning skill so the single-owner pointers stay accurate.
  • ℹ️ bin/fm-startup-network.sh:36 - The change updated the comment in tests/fm-startup-network.test.sh:314 to say a clean success is not captain-facing progress per "AGENTS.md section 9". The production header comment for the same rule in bin/fm-startup-network.sh:36 still cites "(AGENTS.md section 8)". The wording it referred to ("no-change updates are not captain-facing progress") now lives in the wake-handling skill. Make the two references agree.

🔧 Fix: Retarget stale AGENTS.md section references to owning skills
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-documentation-audiences.test.sh (pointers to the owning file can't silently disappear, local links resolve)
  • bash tests/fm-harness-adapter-references.test.sh
  • bash tests/fm-supervision-instructions.test.sh
  • bash tests/fm-ask-user-authority.test.sh
  • bash tests/fm-ensure-agents-md.test.sh
  • bash tests/fm-startup-network.test.sh
  • bash tests/fm-captain-hold-lifecycle.test.sh (full run: exit 0, 61 checks passed, none failed)
  • Wrote a verification script (output in the evidence dir) that compares AGENTS.md size at 130c652 and 9542821, checks each receiving skill's frontmatter (name/description), checks that every skill AGENTS.md says to load resolves, checks that the trigger index lists the new triggers, and checks that every AGENTS.md section N reference in the repo points to a section that exists
  • Read the lines from the round-1 review findings by hand (docs/configuration.md:752, stow/SKILL.md:224, fm-project-capacity-lib.sh:13, fm-promote.sh:26, architecture.md:319, fm-bootstrap.sh:70, fm-startup-network.sh:36, tests/fm-startup-network.test.sh:314); each now points at the skill that owns the content
⚠️ **Document** - 1 info
  • ℹ️ bin/fm-subagent-pretool-check.sh:193 - The guard's runtime ROUTE message (asserted in tests/fm-subagent-pretool-check.test.sh:20-21 and described in docs/subagent-guard.md:173) still tells the agent to classify work 'under the AGENTS.md intake contract'. Classification now lives in the task-intake skill; AGENTS.md section 7 still points there, so the message is indirect rather than wrong. Retargeting it changes executable output and tests, which is outside the document phase; consider a follow-up to name the task-intake skill directly.
⚠️ **Lint** - 1 warning
  • ⚠️ linter found issues (exit code 2)
✅ **Push** - passed

✅ No issues found.

Alan Domio added 3 commits November 7, 2026 15:46
…kills

AGENTS.md drops from 54193 bytes / 451 lines to 27713 bytes / 260 lines.
Hard rules, merge authority, captain-instruction precedence, isolation,
read-before-asserting and the captain-chat translation duty stay inline;
intake, steering, wake handling, the term rewrite table, knowledge routing
and backlog upkeep move into six new agent-only skills with load triggers.
@alandomio
alandomio merged commit ad0f7f0 into main Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant