Repository navigation
feat(bin): track the fleet-shared learnings record across home syncs - #6
Merged
Merged
Conversation
…pivots, credential cross-reference rule)
…ds, gitignore, and docs
…leet-shared contract
…ording to tracked contract
…eet paths must not be tracked' step in .github/workflows/ci.yml still asserted the pre-decision contract that nothing under data/state/config/projects/.no-mistakes may be tracked, but the recorded captain decision (review rounds 1-3) made data/learnings.md the one tracked fleet-shared file (already reconciled in .gitignore, docs/configuration.md, AGENTS.md, sync/stow skills, and the docs inventory). Added a one-line pathspec carve-out ':(exclude)data/learnings.md' to the same git ls-files invocation at that single enforcement boundary, with a comment referencing the owning doc. Verified by running the exact step body in the worktree (passes), a negative scratch-repo case proving data/captain.md and state/x still fail the guard on every path axis, tests/fm-ci-workflow.test.sh (all assertions pass, invariants job stays fast-tier), bin/fm-doc-audience-check.sh (ok, 118 surfaces), and actionlint (clean)
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
Fork sync for firstmate: merge the two local-main learnings-only commits into origin/main so the merged away-cap fix (PR 5) and the fleet learnings reach running sessions on the next update pass. The merge was content-disjoint with no conflicts; suites (fm-spend-cap, fm-pipeline-spend) and lint already pass locally with FM_LINT_JOBS=1. Learnings data files are captain-private durable records being synced, not new content to review. PR 6 exists but was refused at merge for being raised outside no-mistakes; this run supersedes it procedurally.
What Changed
data/learnings.mdthe one tracked file under the otherwise-gitignoreddata/dir (.gitignorenow usesdata/*with a!data/learnings.mdexception) and seeded it with the fleet's durable learnings record (emergency SSH access, k3s dead-replica cleanup, fleet service access).preserve_pretracking_learnings()tobin/fm-ff-lib.shand wired it into both the fast-forward and redundant-divergencereset --keepadvance paths: when a target introduces the tracked file over a home's pre-tracking local copy, the copy is moved to a dateddata/learnings.local.*.mdsibling instead of blocking or clobbering the advance, and a converged home still reads clean.data/learnings.mdas a read-only primary-shipped input likecaptain-shared.md), and added T15/T16 tests intests/fm-secondmate-sync.test.shcovering convergence over a local copy and that preservation never fires without an advance.Risk Assessment
Testing
Drove the real update-pass product end-to-end in disposable fixture worlds: the fleet learnings record reached the primary and a running secondmate home in one pass with the pre-tracking local copy preserved at a dated sibling and the home reading clean, restart-secondmates scheduling the live session; adversarially, a diverged home was skipped with its learnings byte-for-byte untouched and a converged home's curated tracked learnings refused the unsafe advance at the dirty guard. Both modified suites and git's own ignore resolution confirm the tracked-learnings contract; every scenario passed.
Evidence: Live fm-update.sh pass: fleet learnings reach primary and secondmate home, local copy preserved, home clean, restart scheduled
Source: Live fm-update.sh pass: fleet learnings reach primary and secondmate home, local copy preserved, home clean, restart scheduled
Evidence: Adversarial fm-update.sh drives: diverged home untouched, curated tracked learnings refuse dirty advance
Source: Adversarial fm-update.sh drives: diverged home untouched, curated tracked learnings refuse dirty advance
Evidence: fm-secondmate-sync suite: T15/T16 pass
Source: fm-secondmate-sync suite: T15/T16 pass
ok - T15 tracked learnings: the fleet record converges while the home's local copy is preserved ok - T16 preserve-only-on-advance: a skipped home keeps its learnings untouched # all fm-secondmate-sync tests passedPipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
data/learnings.md- branch carries 2 commit(s) that exist on your local main branch but were never pushed to origin/main; these may be unintended bundled work (proposed PR changes 1 file(s)):Confirm these commits belong in this PR before approving, or manually separate the intended work onto origin/main before gating.
🔧 No changes applied.
1 warning still open:
data/learnings.md- branch carries 2 commit(s) that exist on your local main branch but were never pushed to origin/main; these may be unintended bundled work (proposed PR changes 1 file(s)):Confirm these commits belong in this PR before approving, or manually separate the intended work onto origin/main before gating.
no changes applied: bundled local-default commits require manual separation or explicit approval; the rebase conflict resolver cannot safely select commits to discard.
data/learnings.md:1- This merge makes data/learnings.md a tracked file headed for origin/main, but the repo's own policy declares data/ captain-private and gitignored (AGENTS.md:48 ".env,data/, ... are captain-private and gitignored"; .gitignore:3data/; docs/configuration.md:666 "it is gitignored"; docs/configuration.md:669 "There is no shared learnings file by captain decision"), and the secondmate sync contract relies on that invariant: .agents/skills/secondmate-provisioning/SKILL.md:103 guarantees updates "never touch the gitignored operational dirs, so a secondmate's backlog, projects, and in-flight work are never disturbed". Concrete failing sequence after this lands on origin/main: (1) a standalone secondmate/clone home holds its own untracked domain-local data/learnings.md (tests/fm-shared-captain-inheritance.test.sh:5,52 asserts learnings stays domain-local in every home); (2) its next /updatefirstmate origin refresh or guarded fast-forward (SKILL.md:101,107) targets a commit that adds tracked data/learnings.md; (3) git refuses ("untracked working tree files would be overwritten by merge") or flags the home dirty, so firstmate updates stop flowing to exactly the homes that have their own learnings — undermining this change's own stated goal of learnings reaching running sessions. In the primary, any session's uncommitted learnings curation (AGENTS.md:66,149 instructs sessions to write there) now dirties a tracked file, tripping the "dirty homes launch unchanged with a warning" guard. The missing policy decision: whether the captain-private learnings contract becomes tracked-and-fork-synced (requiring doc/.gitignore updates to match plus a per-home reconcile procedure), or stays local-only (untrack the file and distribute the content another way). The intent authorizes the content sync but never addresses overriding the gitignored/captain-private contract or the update-pass wedge, so this needs the captain's explicit call; remedy extends beyond correcting the merge, hence ask-user rather than auto-fix.data/learnings.md:1- The new file is 11,725 bytes ≈ 3,909 estimated tokens (bin/fm-startup-memory-budget.sh estimator: ceil(bytes/3)), which is ~52% of the 7,500-token default startup budget that data/captain.md + data/captain-shared.md + data/learnings.md share (docs/configuration.md:673). Depending on the primary's live captain files and configured budget, the startup growth check may report an over-budget finding after this sync; that surface is advisory by design and the stow aging-tier contract is expected to curate it, so no action required — noting the share so the budget signal is not a surprise.🔧 Fix applied.
1 warning still open:
AGENTS.md:48- Fix round 1 (commit 6aa76a1) reconciled the new tracked-fleet learnings contract in .gitignore:3-4, docs/configuration.md:668-673, .agents/skills/secondmate-provisioning/SKILL.md:103,132, and .agents/skills/updatefirstmate/SKILL.md:35, but left AGENTS.md asserting the old contract it was replacing: line 48 still declares ".env,data/,state/,config/,projects/, and.no-mistakes/are captain-private and gitignored" (data/learnings.md is now tracked fleet-shared), line 66 still callsdata/learnings.md"curated home-local knowledge", and line 149 still says "Fleet-local operational facts belong in curated, home-localdata/learnings.md". Concrete sequence: a session in any home loads AGENTS.md at start, follows line 149 and appends a learning to its now-tracked data/learnings.md (in a secondmate home the stow/AGENTS instruction to record learnings there predates the read-only-between-propagation carve-out only captain-shared got), and the home's next advance skips at the dirty guard with "dirty working tree" until a human reconciles — exactly the wedge docs/configuration.md:674 now documents but the instruction surface agents actually read still invites. AGENTS.md is an agent memory file not part of the change under validation, so amending its policy wording is a deliberate captain decision rather than pipeline output; the remedy, not the defect, is what needs authorization. Sibling sites: AGENTS.md:66, AGENTS.md:149.🔧 Fix applied.
2 issues (1 warning, 1 info) still open:
.agents/skills/operational-home-layout/SKILL.md:54- Fix round 1 (6aa76a1) and the round-2-approved AGENTS.md fix (45a1459) reconciled the new tracked fleet-shared learnings contract in .gitignore, docs/configuration.md, both sync skills, and AGENTS.md, but left the other instruction surfaces agents load still asserting the replaced contract. .agents/skills/operational-home-layout/SKILL.md:54 still declares learnings.md "LOCAL, gitignored ... created lazily, absent until this home has a learning to store", and .agents/skills/stow/SKILL.md:89 still carves out only data/captain-shared.md as read-only in secondmate homes while directing the memory pass to "curate only the editable local files" (with data/learnings.md counted among the three memory files at line 86), plus stow:220 "Create data/learnings.md only for a genuinely new local learning" and stow:224 "Keep the candidate in data/learnings.md". Concrete failing sequence: a converged secondmate home runs its /stow memory pass (AGENTS.md routes it); step 2 treats the now-tracked data/learnings.md as an editable local file (only captain-shared is excluded in secondmate homes); the pass stamps, prunes, or archives entries in the tracked file per the aging-tier contract; the home turns dirty and every subsequent spawn/bootstrap/update sync skips at the dirty guard until a human reconciles - the exact wedge docs/configuration.md:674-675 documents but these surfaces still invite, and secondmate-provisioning SKILL.md:132 contradicts by saying "the primary curates it". Sibling site: docs/architecture.md:508 still lumps data/learnings.md under "local markdown under data/". This is the same class round 2 fixed for AGENTS.md, left behind in shared tracked skill docs; the remedy corrects these files to the already-decided contract (tracked, primary-curated, read-only curation input in secondmate homes, no lazy local creation) and does not extend the change's intent, so auto-fix rather than ask-user.bin/fm-ff-lib.sh:485- The fix-round-1 preserve_pretracking_learnings call (function at bin/fm-ff-lib.sh:290, introduced by 6aa76a1) runs at line 485, before the already-current short-circuit and before the divergence decision at line 492, so a home that will NOT advance still gets its untracked data/learnings.md renamed to the dated sibling. Concrete sequence: a secondmate home holds a clean local divergence (e.g. an unpushed squash-merged contribution) plus its pre-tracking local learnings copy (invisible to the dirty guard); the bootstrap sweep reaches ff_target, preservation moves data/learnings.md to data/learnings.local.<stamp>.md, then divergence_is_redundant fails, a reconcile marker is recorded, and the home is skipped - the home never advanced, yet its learnings file is now absent at the original name, so the running session's next context digest prints ABSENT and the header's own wording ("whose pre-tracking local copy such an advance preserves") is violated for a non-advance. Content is preserved and the wedge-prevention goal is unaffected, so this is minor; the mechanical remedy is to invoke preserve only immediately before the two sites that actually advance (the redundant-divergence reset --keep at line 497 and the merge --ff-only at line 527), leaving a skipped home byte-for-byte untouched. Same exposure applies if the merge itself fails after preservation (e.g. concurrent dirt); the reorder reduces but does not fully eliminate that window, which is acceptable.🔧 Fix applied.
1 info still open:
bin/fm-remote-secondmate-control.sh:377- Every local advance boundary routes through ff_target and gets preserve_pretracking_learnings, but a remote secondmate host (e.g. the registeredmachome this change's own learnings record) runs its own Firstmate copy during cmd_update: until that host refreshes its copy past this merge, its older ff_target lacks the preservation step, so the first remote sync of a home holding a pre-tracking untracked data/learnings.md will fail once with "untracked working tree files would be overwritten" and the parent dies with the actionable remedy ("run /updatefirstmate") already printed. After the host copy refreshes, the same sync preserves the copy correctly. Loud, self-remediating version skew inherent to shipping the fix through the artifact it fixes - noting so the one-time skip is not read as a regression.✅ **Test** - passed
✅ No issues found.
bin/fm-test-run.sh tests/fm-secondmate-sync.test.sh (includes new T15 tracked-learnings convergence and T16 preserve-only-on-advance)bin/fm-test-run.sh tests/fm-shared-captain-inheritance.test.sh (inherit contract after the learnings tracking change)Live drive of bin/fm-update.sh with FM_ROOT_OVERRIDE/FM_HOME into a disposable fixture world: origin tip adds tracked data/learnings.md, secondmate home holds a pre-tracking local copy (transcript: evidence/fm-update-learnings-live.txt)Adversarial live drives of bin/fm-update.sh: uniquely diverged home with pre-tracking learnings copy (skipped, untouched, no sibling), and converged home with curated tracked learnings (dirty-guard refusal, no clobber) (transcript: evidence/fm-learnings-adversarial.txt)git check-ignore / git ls-files / git status --porcelain against the real worktree: data/learnings.md tracked and not ignored, data/captain.md still ignored, tree clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.