Skip to content

fix(session-start): print the secondmate charter in the context digest - #1157

Open
brchue-ux wants to merge 1 commit into
kunchenguid:mainfrom
brchue-ux:fm/sm-identity
Open

fix(session-start): print the secondmate charter in the context digest#1157
brchue-ux wants to merge 1 commit into
kunchenguid:mainfrom
brchue-ux:fm/sm-identity

Conversation

@brchue-ux

Copy link
Copy Markdown

Problem

A seeded secondmate home carries its charter at data/charter.md, but bin/fm-session-start.sh never printed it.
The CONTEXT digest listed only data/projects.md, data/secondmates.md, data/captain.md, data/captain-shared.md, and data/learnings.md.

AGENTS.md line 3 ("You are the first mate.") is loaded every session in every home, while the charter that would correct it in a secondmate home was loaded in none.
The result is a reproduced identity bug: a second mate opens the session announcing itself as the first mate and describing a fleet-wide role it does not have.

Changes

bin/fm-session-start.sh - print data/charter.md in the CONTEXT digest, first, before data/projects.md.
It answers "who am I", which governs how everything after it is read.
It uses the existing print_file_or_absent helper rather than a second emission path, so absence prints the same explicit ABSENT marker and stays distinguishable from an empty-but-present file.
Absence is meaningful: no charter means this is a primary home rather than a secondmate one.
data/charter.md is also added to the digest's closing "do NOT re-read" trailer and to the two header comments that enumerate the context files.

AGENTS.md - one line in the top address block stating the identity rule, plus charter.md in the section 2 data/ layout listing, one line in the section 3 ABSENT-meaning sentence, and data/charter.md in the section 3 context-digest enumeration.
The last two are cross-reference updates to existing lists, not restatements of the rule.
The additions are deliberately tight because that file's token cost is paid by every session of every fleet member.

Deliberate non-changes

The identity rule is not added to the charter template in bin/fm-brief.sh.
This is a one-owner-rule decision: AGENTS.md owns the rule and the charter supplies only the domain.
Duplicating it into the generated charter would create two copies to drift, and would leave already-seeded homes - whose charters were copied at seed time and are gitignored local state - still broken.
The two changes here fix every existing home with no per-home edits, which is a required property of the fix.

No home's data/charter.md was edited.

AGENTS.md section 1's "only point of contact for all software work across all of their projects" sentence was reviewed and deliberately left alone; that remit wording is tracked as its own separate item.

Verification

Extended tests/fm-session-start.test.sh rather than adding a new runner, per the repo's colocated-test rule:

  • test_context_digest_charter_present - content printed, ordered before projects.md, listed in the trailer.
  • test_context_digest_charter_absent - ABSENT marker, not (present, empty).
  • The pre-existing digest test's expected ABSENT count moves from 4 to 5, since charter.md is now a sixth context file.

bin/fm-lint.sh and bin/fm-doc-audience-check.sh both run clean (ok surfaces=55 local_links=151).

One pre-existing unrelated failure in that suite, not ok - MISSING diagnostic did not appear at all, reproduces identically on the base commit b29621b and is not caused by this change.

Digest output

Charter present:

data/charter.md (secondmate charter; ABSENT = this is a primary home)
--------------------------------------------------------------------------------
You are a persistent second mate managed by the main firstmate.
Your domain is the budget app (home_budget_app).

data/projects.md
--------------------------------------------------------------------------------
- home_budget_app [no-mistakes] - the budget app (added 2026-07-01)

Charter absent:

data/charter.md (secondmate charter; ABSENT = this is a primary home)
--------------------------------------------------------------------------------
ABSENT

data/projects.md
--------------------------------------------------------------------------------
- demo [no-mistakes] - a demo project (added 2026-07-01)

Compatibility

Checked rather than assumed.
The CONTEXT section of fm-session-start.sh is a sequence of unconditional print_file_or_absent calls with no reference to PRIMARY_HARNESS or any backend variable.
Harness branching in that script is confined to the supervision-instructions step, and backend reads to the fleet-state endpoint liveness loop; neither gates CONTEXT.
This change is therefore independent of both the harness axis and the runtime-backend axis.

A seeded secondmate home carries its charter at data/charter.md, but
fm-session-start.sh never printed it: the CONTEXT digest listed only
projects.md, secondmates.md, captain.md, captain-shared.md, and
learnings.md. AGENTS.md line 3 ("You are the first mate.") is loaded
every session in every home, while the charter that would correct it in
a secondmate home was loaded in none, so a second mate opened every
session announcing itself as the first mate and describing a fleet-wide
role it does not have.

Print data/charter.md first in CONTEXT, in the same delimited form and
with the same explicit ABSENT marker as the files already there. It
answers "who am I", which governs how everything after it is read, and
its absence is meaningful: no charter means a primary home rather than a
secondmate one. Add it to the digest's "do NOT re-read" trailer too.

Add the identity rule to AGENTS.md's address block, and charter.md to
the data/ layout listing in section 2.

The rule is deliberately NOT added to the charter template in
fm-brief.sh: AGENTS.md owns the rule and the charter supplies only the
domain, so there is one copy to maintain and every already-seeded home
is fixed with no per-home edits to gitignored local state.

The CONTEXT digest is composed unconditionally, with no harness or
runtime-backend branching, so this change is independent of both axes.
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