Skip to content

fix(skills): reconcile inherited secondmate plans with shipped state - #1837

Closed
kunchenguid wants to merge 3 commits into
mainfrom
fm/fm-secondmate-creation-record-intake-r1
Closed

kunchenguid wants to merge 3 commits into
mainfrom
fm/fm-secondmate-creation-record-intake-r1

Conversation

@kunchenguid

@kunchenguid kunchenguid commented Aug 6, 2026 •

Copy link
Copy Markdown
Owner

Intent

Add a small record-intake instruction to the secondmate CREATION/seed path in firstmate's secondmate-provisioning skill, so a new mate that takes over an existing or inherited domain reconciles against authoritative shipped-state instead of inheriting a plan backlog blind.

WHY (captain's chosen safeguard, 2026-08-06): this is the fix for a stale-record recurrence forensically diagnosed in two scout reports (data/fm-stale-record-discord-forensic-s1/report.md and data/fm-stale-record-discord-attribution-s2/report.md). A predecessor secondmate home shipped 21+ merged PRs for a product; when it was retired into a successor, the handover carried backlog.md, captain.md, learnings.md and a brief, but NOT done-archive.md. Because .tasks.toml sets done_keep = 10, a live backlog structurally cannot hold more than ten completions, so the successor inherited 49 open plan rows and zero record of 21 shipped PRs. Already-delivered work therefore resurfaced as 'open'. The verified gap: creation/seeding pulls in charter + inherited config + captain-shared + project clones + (separately) QUEUED backlog only, with ZERO instruction about a domain's shipped/done history, so it assumes a greenfield mate.

CAPTAIN'S EXPLICIT REFRAME AND SCOPE DECISION: do NOT build a bespoke retirement/consolidation export process - retirement is too rare to be the leverage point. Strengthen secondmate CREATION instead, which every transfer relies on. This deliberately fixes BOTH the rare retirement/consolidation case AND the COMMON case of creating a mate for an in-progress project. The captain accepted the tradeoff that reconciliation cost is now paid at every inherited-domain creation rather than once at handover, because creation-side reconciliation works even when the predecessor's export was poor or its home is already gone.

THE FIX, as captain-specified: add a small RECORD-INTAKE instruction to secondmate-provisioning's creation/seed section requiring that, when a new mate takes over an EXISTING or INHERITED domain (a project already in development, or a predecessor's domain), the creating agent MUST (1) reconcile the inherited plans against the domain's authoritative SHIPPED-state - origin/main plus the live deployment - NOT the imported backlog and NOT an absent/fresh local view; (2) pull in only genuinely-open work plus the domain's durable knowledge (learnings/decisions still live); (3) NEVER inherit a plan backlog blind, meaning never carry plan rows for work already shipped. The greenfield-vs-inherited distinction must be explicit so a genuinely new domain is not burdened.

EXPLICIT SCOPE EXCLUSION: this ship is the record-intake creation instruction ONLY. The separate fix to close open-decisions by construction on the decision key and de-overload the 'resolved' verb (the doer's self-blindness defect, also diagnosed in those reports) is captured as its own separately queued ship, fm-decision-key-close-by-construction-r1, and must NOT be implemented here. Also deliberately out of scope: the s1 report's R1 recommendation for a mechanical export gate at retirement - the captain ruled retirement out of scope as too rare.

DELIBERATE DESIGN DECISIONS MADE WHILE IMPLEMENTING (per firstmate's firstmate-coding-guidelines, which was loaded first as the brief required):

  • ONE-OWNER RULE: the reconcile-against-shipped-state procedure lives entirely in the secondmate-provisioning skill, which owns secondmate creation/seeding. A new '## Record intake for an existing or inherited domain' section was placed in the creation/seed path, immediately after 'Charter and seed' and before 'Backlog handoff'. git grep confirms no second copy of the contract exists.
  • AGENTS.md WAS DELIBERATELY LEFT UNTOUCHED, and this is correct, not an omission. AGENTS.md section 6 already carries the load trigger ('Load secondmate-provisioning before creating, seeding, ...'), which fires on exactly this path, so no new trigger line was needed. AGENTS.md size discipline is a first-class rule in this repo (the file grew 585 -> 958 lines from inline conditional detail); its token cost is paid by every session of every fleet member, so conditional detail belongs in the skill whose cost is paid only by sessions that load it. The captain explicitly said 'Do not bloat AGENTS.md.'
  • One single-line reinforcement WAS added in the 'Backlog handoff' section ('For an existing or inherited domain, complete record intake first so no already-shipped plan row is handed off as open work.'). The guidelines permit exactly one deliberate one-line reinforcement at a genuine risk point; this is that point, because it is where plan rows physically move between homes. It is a pointer, not a restatement of the contract.
  • The skill's frontmatter description 'Covers' list gained 'record intake for an existing or inherited domain' so the new content is discoverable at load time.
  • The fetched-clone precondition was folded in as ONE clause of obligation 1 rather than a separate rule, because an unfetched or missing clone is precisely the 'absent/fresh local view' trap the captain named. This is a proportionate inclusion of the s1 report's R4, not scope creep.
  • The inadmissible-evidence list explicitly names the imported backlog, the predecessor's own notes, instruction-surface prose, and an absent/unfetched local view, because the forensic proved the failure mode was judging 'already shipped' from Firstmate's own prose (harness-adapters skill contents, AGENTS.md sections, captain-shared.md) with not one origin/main commit, PR, or deployment cited.
  • The done_keep causal fact is stated once, as the non-obvious reason the rule exists: a live backlog keeps only the configured recent Done entries by design, so an inherited queue structurally over-represents plans and under-represents deliveries.
  • Residual-uncertainty capture was included because the forensic showed the successor inherited silence about what was never reconciled.

NO TEST WAS ADDED, and this is a deliberate, correct decision rather than an oversight. Both this repo's guidelines and no-mistakes' own test-quality rule forbid a test whose only evidence is that it greps, parses, or snapshots implementation/instruction source text for particular strings. A test asserting that this skill's Markdown contains the intake step would be exactly that forbidden anti-pattern. There is no executable consumer of agent-skill prose, so no public or executable interface exists to exercise here. The brief anticipated this explicitly: 'otherwise this is a documentation-contract change and the audience check is the gate.' The gate that does apply, bin/fm-doc-audience-check.sh, was run and passes (ok surfaces=65 local_links=205).

STYLE CONSTRAINTS OBSERVED (repo rules): one full sentence per line in tracked Markdown, never multiple sentences on one physical line; plain dash '-' only, never an em dash; no agent name as commit co-author.

This is firstmate shared, tracked material, delivered under mode=no-mistakes.

What Changed

  • Distinguish greenfield secondmate domains from existing or inherited domains that require record intake before acting on inherited plans.
  • Require inherited plans to be reconciled against fetched origin/main state and the live deployment, rather than backlogs, predecessor notes, or incomplete local views.
  • Seed only genuinely open work and durable knowledge, capture unresolved uncertainty, and complete reconciliation before backlog handoff.

Risk Assessment

✅ Low: The documentation-only change is narrowly scoped, conforms to the required record-intake contract, preserves the greenfield distinction, and introduces no substantiated source risk.

Testing

No baseline command was supplied; targeted validation inspected the complete one-file contract diff, confirmed its agent-runtime audience, and ran the maintained-prose/link checker successfully. No unit test was added because agent-skill prose has no executable semantic consumer and a source-text assertion is expressly forbidden. No screenshot was captured because this is an agent-only Markdown instruction surface with no rendered UI.

Evidence: Record-intake contract diff
diff --git a/.agents/skills/secondmate-provisioning/SKILL.md b/.agents/skills/secondmate-provisioning/SKILL.md
index 12b90be..cb8a812 100644
--- a/.agents/skills/secondmate-provisioning/SKILL.md
+++ b/.agents/skills/secondmate-provisioning/SKILL.md
@@ -3,7 +3,7 @@ name: secondmate-provisioning
 description: >-
   Agent-only reference for persistent secondmate setup and retirement.
   Use when creating, seeding, validating, launching, recovering, handing backlog to, pushing inherited local material into, or retiring a secondmate home, or when editing data/secondmates.md.
-  Covers local leases, whole-home remote routes, transactional seeding, project clone restrictions, secondmate harness pins, inherited local-material push, idle charter, handoff helper, and teardown safety.
+  Covers local leases, whole-home remote routes, transactional seeding, record intake for an existing or inherited domain, project clone restrictions, secondmate harness pins, inherited local-material push, idle charter, handoff helper, and teardown safety.
 user-invocable: false
 metadata:
   internal: true
@@ -152,6 +152,26 @@ Secondmate project lists may include `no-mistakes` and `direct-PR` projects only
 `local-only` projects stay with the main firstmate.
 For `no-mistakes` projects, seeding initializes only projects newly cloned into a secondmate home and refuses to mutate a preexisting clone that is not already initialized.
 
+## Record intake for an existing or inherited domain
+
+Classify the domain before seeding, because this step applies to only one of the two cases.
+A greenfield domain has no delivered domain work yet: nothing already shipped in its projects, no live deployment, and no predecessor records to import.
+Seed a greenfield domain normally; there is nothing to reconcile and this section adds no work to it.
+An existing or inherited domain is any domain whose product is already in development, and any predecessor's domain a new mate takes over, including a consolidation after a retirement.
+Both of those cases require record intake before the new mate acts on any inherited plan.
+
+For an existing or inherited domain, the creating agent must:
+
+1. Reconcile every inherited plan against the domain's authoritative shipped state, which is `origin/main` for each relevant project plus the live deployment.
+   A fetched clone of each relevant project is a precondition of that reconciliation, so wire the home to its projects before reconciling rather than on first task.
+   The imported backlog, the predecessor's own notes, instruction-surface prose, and an absent or unfetched local view are all inadmissible as shipped-state evidence.
+2. Seed the new home with only genuinely open work plus the domain's durable knowledge, meaning the learnings, decisions, and delivery posture that are still live.
+3. Never inherit a plan backlog blind.
+   A plan row whose work is already shipped is dropped, or recorded as done with the merged evidence that settles it, and is never carried forward as open.
+
+A live backlog keeps only the configured recent Done entries by design, so an inherited queue structurally over-represents plans and under-represents deliveries.
+Treat an inherited queue that carries plans with no matching delivery record as unreconciled rather than as open work, and record whatever could not be reconciled as an explicit residual-uncertainty list in the new home rather than leaving that gap silent.
+
 ## Backlog handoff
 
 Apply `AGENTS.md` section 10's work-items-only backlog contract before creation or handoff.
@@ -164,6 +184,7 @@ bin/fm-backlog-handoff.sh <secondmate-id> <item-key>...
 `` `
 
 After seeding, run this handoff for the new secondmate's in-scope queued items.
+For an existing or inherited domain, complete record intake first so no already-shipped plan row is handed off as open work.
 For a local route, the helper resolves and validates the secondmate home from `data/secondmates.md`, then delegates the item move to `tasks-axi mv` (the single owner of the backlog format), which moves each named item - and a whole connected set, blocker plus dependents, atomically - from the main `data/backlog.md` into the secondmate home's `data/backlog.md`.
 For a remote route, the same helper first moves the dependency-closed set atomically from the main backlog into `data/handoff/<id>.outbox.md`, then transfers that backlog-format outbox through `fm-on.sh` and lets the remote home's `fm-backlog-receive.sh` move every not-already-present key under the destination lock.
 The outbox is the whole recovery record: its presence means delivery is unfinished, `--resume-pending` safely re-delivers it, and confirmed receipt removes it.
Evidence: Documentation audience check

fm-doc-audience-check: ok surfaces=65 local_links=205

fm-doc-audience-check: ok surfaces=65 local_links=205

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.

  • Inspected git diff --find-renames 345de4e7aad1484f46bc5115c9e57640a0b060d9..3c4463f52b2bafda4e7b9a56e0bad31d7723344d -- .agents/skills/secondmate-provisioning/SKILL.md and recorded the contract patch
  • Ran bin/fm-doc-audience-check.sh
  • Verified docs/documentation-audiences.json classifies .agents/skills/secondmate-provisioning/SKILL.md as agent-runtime
  • Verified the worktree was clean and HEAD matched 3c4463f52b2bafda4e7b9a56e0bad31d7723344d
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

… domain

A new mate seeded for an existing or inherited domain previously pulled in
charter, inherited config, captain-shared preferences, project clones, and
queued backlog rows with zero instruction about the domain's shipped history,
so it assumed a greenfield domain. A live backlog keeps only the configured
recent Done entries, so an inherited queue structurally over-represents plans
and under-represents deliveries, and already-delivered work resurfaced as open.

Add a record-intake step to the creation/seed path: classify greenfield versus
existing or inherited, and for the latter reconcile every inherited plan
against origin/main plus the live deployment, take only genuinely open work
and still-live durable knowledge, never carry a plan row for shipped work, and
record what could not be reconciled. Greenfield domains are untouched.

The skill owns the procedure; the backlog handoff section carries a one-line
reinforcement at the point where plan rows actually move.
@kunchenguid kunchenguid closed this Aug 6, 2026
@kunchenguid kunchenguid reopened this Aug 6, 2026
@kunchenguid kunchenguid changed the title fix(skills): reconcile inherited plans against shipped state fix(skills): reconcile inherited secondmate plans with shipped state Aug 6, 2026
@kunchenguid

Copy link
Copy Markdown
Owner Author

Superseded by #1853.

This PR hit an unrecoverable no-mistakes custody divergence: a gh pr update-branch performed while the pipeline held custody desynced the gate's preserved head (dedb54e4) from the gate branch (3c4463f), after which axi sync --recover (both plain and --keep-local) and a fresh axi run each refused by pointing at the other. No refs were force-pushed and no gate record was hand-cleared.

The identical change - one Markdown file, +22/-1 to .agents/skills/secondmate-provisioning/SKILL.md - was re-shipped on a fresh branch and is green in #1853. Closing this one as superseded.

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