Skip to content

feat: let a home declare authoritative external memory tiers - #6608

Merged
kunchenguid merged 5 commits into
kunchenguid:mainfrom
shaptonstahl:fm/fm-add-palimpsest-openbrain-routing-to-firs-b4
Oct 14, 2026
Merged

kunchenguid merged 5 commits into
kunchenguid:mainfrom
shaptonstahl:fm/fm-add-palimpsest-openbrain-routing-to-firs-b4

Conversation

@shaptonstahl

@shaptonstahl shaptonstahl commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Intent

AGENTS.md routing: add the Palimpsest and OpenBrain routing to firstmate's instructions.

Context the ask refers to, from the filed work item: firstmate's shared AGENTS.md section 6 ("Route durable knowledge to its most specific owner") lists only firstmate-local destinations (data/captain.md, data/captain-shared.md, data/learnings.md, a project's AGENTS.md, firstmate's own tracked surface) and section 2 says those files hold knowledge "regardless of harness memory". The stow skill likewise knows nothing about external memory stores. The captain's actual memory layering, decided 2026-08-31 and recorded in this home's data/captain.md under "Memory layering", is three tiers partitioned by scope of truth, never writing one fact to more than one tier:

  1. Palimpsest (MCP mcp__claude_ai_Palimpsest__*) holds reasoning continuity: decisions, hypotheses, speculation, corrections, self-knowledge. Permanent, append-only, cross-machine. Authoritative for why. Capture without asking, then report what was captured; corrections use supersedes, never edit or delete.
  2. OpenBrain (MCP mcp__claude_ai_OpenBrain__*) holds retrievable facts: people, projects, references, resolved answers, tasks. Permanent, cross-machine. Authoritative for what.
  3. This home's data/ is a disposable per-machine operational cache, never a peer of tiers 1 or 2. A learning landing in data/learnings.md never excuses skipping Palimpsest.

Consequence of the gap: the only thing keeping tiers 1 and 2 from being swallowed into the per-machine cache is one unversioned pointer file under the captain's harness memory directory, lost silently on a fresh clone, a secondmate home, or a local memory reset. A related standing risk: firstmate's non-Claude worker harnesses cannot reach these connectors at all, so firstmate itself is the sole capture path for their work.

Maintainer review follow-up: drop the missing-declaration receipt line so the undeclared path is silent; clarify the exempt floor wording; say how stow reconciles entries tagged with a renamed or retired tier.

What Changed

  • Declaration schema. docs/configuration.md gets a new "External memory tiers (Memory layering section)" section, and the index table now links to it. A home can declare outside stores, such as Palimpsest or OpenBrain MCP connectors, in a Memory layering heading in data/captain.md or in the primary home's data/captain-shared.md. Each tier lists its destination, the knowledge classes it owns, its correction rule, and its capture etiquette. A local data/captain.md declaration takes precedence over the shared one. With no declaration, the local data/ files stay the only memory owners, and nothing is reported.
  • Routing in AGENTS.md. Section 2 now carves out an exception to "regardless of harness memory" for knowledge classes a declared tier owns. Section 6 makes a declared tier authoritative for its classes, and data/ becomes only a per-machine cache for them. A local copy never excuses skipping capture to the tier, and corrections follow the tier's own rule. When a worker's harness can't reach a tier, firstmate captures the worker's findings from its report. data/learnings.md is now limited to fleet-local facts that no declared tier owns.
  • stow skill. The skill reads the declaration and checks which tiers the session can reach. It routes tier-owned findings to their tier first, and the sweep now includes reports from workers whose harnesses can't reach a tier.
    • Pending-capture marker. A new <!--t:NAME--> marker covers findings whose tier is unreachable. The finding stays in a startup-loaded local file. No prune, decay, eviction, offload, consolidation, or archive step may remove it until a later pass captures it to the tier. If the tier is renamed or retired, the marker is pointed at the tier that now owns that class, or dropped if no declared tier does.
    • Declared-tier guard. Before any removal, the tier must confirm it holds the fact, or the fact is captured there first. Entries pending capture are excluded from budget eviction and offload, and they count toward the exempt floor.
    • Receipt. It names entries still waiting on an unreachable tier. A session isn't reported as reset-safe while any such entry remains.

Reviewed, edited, or generated with deterministic and AI tools.

Risk Assessment

✅ Low: The change only edits instruction prose in docs and a skill, and it meets the intent's maintainer follow-ups. The undeclared path is now silent, the floor wording names the pinned and pending-capture floor, and renamed or retired tiers are reconciled. The one remaining gap is a rare duplicate-capture edge in a secondmate's read-only shared file.

Testing

I confirmed that the diff touches only instruction prose and docs, and that no bin/ code reads the new pending-capture marker. I ran the targeted stow-cascade and documentation-audience checks; both pass, including local doc-link resolution. The routing, silent undeclared path, pending-capture marker, and renamed/retired-tier reconciliation are interpreted by the LLM and have no deterministic product surface to drive live. Under the repo's test-quality rule, testing them belongs in a development-only model evaluation, not this gate. No UI is involved, so there are no visual artifacts.

  • Live validation: ⚠️ no-surface - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A home with a Memory layering declaration makes stow route tier-owned facts to the declared external tiers instead of local files ⏸️ untested no No live-validatable surface: the routing is natural-language skill instruction that an LLM interprets. No script or binary changed, so a gate run could only measure non-deterministic model interpretat…
With no Memory layering declaration, stow stays silent and routes to local files without a missing-declaration receipt line ⏸️ untested no No live-validatable surface: receipt content is skill prose with no deterministic code that emits it.
Adversarial: an unreachable declared tier leaves a tier-owned entry in place with its <!--t:NAME--> marker, and stow never prunes, evicts, offloads, or archives it; a renamed or retired tier has its m… ⏸️ untested no No live-validatable surface: eviction, offload eligibility, and marker reconciliation are defined only in skill prose, and no bin/ budget or offload code reads the marker.
The docs index row links to the External memory tiers section, and all local doc links resolve ⏸️ untested no Docs-only check: link resolution passes in the existing test, but there is no running product surface to drive.
  • Outcome: ⚠️ 1 warning across 1 run (29.8s)

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

🔧 **Rebase** - 1 issue found → auto-fixed ✅
  • ⚠️ .agents/skills/stow/SKILL.md - merge conflict rebasing onto origin/main

🔧 Fix applied.
✅ Re-checked - no issues remain.

⚠️ **Review** - 1 info
  • ℹ️ .agents/skills/stow/SKILL.md:29 - The &lt;!--t:NAME--&gt; lifecycle tells "a later pass that can reach NAME" to capture the entry and then remove the marker. It does not cover a marked entry in a secondmate's read-only data/captain-shared.md. Step 2 (line 95-97) forbids that pass from removing the marker, so the marker stays. Concrete sequence: (1) The primary's harness cannot reach the tier, for example a non-Claude primary, so it writes a tier-owned shared preference into data/captain-shared.md with &lt;!--t:Palimpsest--&gt;. (2) The primary's /stow cascades to secondmates (line 290). (3) Every secondmate whose harness can reach the tier captures the entry again on every cascade, because the marker never clears and the marker rule says "captures" rather than "confirm the tier holds it, else capture" (the declared-tier guard at line 118 does say confirm). The result is repeated duplicate appends into an append-only store until the primary can reach the tier itself. The scenario is rare. Smallest fix, within the existing ownership rules: in the marker rule, say the pass first confirms whether the tier already holds the fact. For a read-only shared entry, the pass may capture only after that confirmation and then routes the marker removal to the primary owner as an ownership exception.
⚠️ **Test** - 1 warning
  • ⚠️ this change has no live-validatable surface; proceed without live validation? (0 of 4 scenarios were driven live against the product); A home with a Memory layering declaration makes stow route tier-owned facts to the declared external tiers instead of local files: No live-validatable surface: the routing is natural-language skill instruction that an LLM interprets. No script or binary changed, so a gate run could only measure non-deterministic model interpretation, which the repo's test-quality rule assigns to development-only evaluation.; With no Memory layering declaration, stow stays silent and routes to local files without a missing-declaration receipt line: No live-validatable surface: receipt content is skill prose with no deterministic code that emits it.; Adversarial: an unreachable declared tier leaves a tier-owned entry in place with its <!--t:NAME--> marker, and stow never prunes, evicts, offloads, or archives it; a renamed or retired tier has its marker retargeted or removed: No live-validatable surface: eviction, offload eligibility, and marker reconciliation are defined only in skill prose, and no bin/ budget or offload code reads the marker.; The docs index row links to the External memory tiers section, and all local doc links resolve: Docs-only check: link resolution passes in the existing test, but there is no running product surface to drive.
  • Live validation: ⚠️ no-surface - 0 of 4 scenarios driven live against the product
Scenario Result Live Evidence
A home with a Memory layering declaration makes stow route tier-owned facts to the declared external tiers instead of local files ⏸️ untested no No live-validatable surface: the routing is natural-language skill instruction that an LLM interprets. No script or binary changed, so a gate run could only measure non-deterministic model interpretat…
With no Memory layering declaration, stow stays silent and routes to local files without a missing-declaration receipt line ⏸️ untested no No live-validatable surface: receipt content is skill prose with no deterministic code that emits it.
Adversarial: an unreachable declared tier leaves a tier-owned entry in place with its <!--t:NAME--> marker, and stow never prunes, evicts, offloads, or archives it; a renamed or retired tier has its m… ⏸️ untested no No live-validatable surface: eviction, offload eligibility, and marker reconciliation are defined only in skill prose, and no bin/ budget or offload code reads the marker.
The docs index row links to the External memory tiers section, and all local doc links resolve ⏸️ untested no Docs-only check: link resolution passes in the existing test, but there is no running product surface to drive.
  • git diff --stat 8c9c67de..HEAD (only .agents/skills/stow/SKILL.md, AGENTS.md, docs/configuration.md changed)
  • grep -rln &#39;&lt;!--pinned\|&lt;!--t:&#39; bin/ tests/ (no executable consumer of the memory markers)
  • bash tests/fm-stow-cascade.test.sh (pass)
  • bash tests/fm-documentation-audiences.test.sh (pass, including local link resolution)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Adds external memory tier declarations to home configuration.

The PR appears safe to merge, with a non-blocking cleanup gap if a declared tier is later removed or renamed.

Reviews (2) · Last reviewed commit: "no-mistakes(ci): Environment: 2026-10-05..."

Comment thread .agents/skills/stow/SKILL.md Resolved
Comment on lines +27 to +29
- `<!--t:NAME-->` - pending capture: a tier-owned entry that the declared memory tier `NAME` does not yet hold because no session that wrote or curated it could reach that tier; it follows any tier marker the entry already carries.
Stow never prunes, ages out, evicts, offloads, consolidates away, or moves to the cold archive an entry carrying it, whatever its tier clock says.
A later pass that can reach `NAME` captures the entry there under the tier's declared rule, then removes the marker, after which the entry is curated like any other.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Retired tiers strand pending entries If a home removes or renames a declared tier while entries still carry its <!--t:NAME--> marker, the only documented way to clear the marker requires capturing to that old tier. Those entries remain in startup memory and cannot be pruned, offloaded, or evicted to meet the memory budget. Please define how stow reconciles pending markers when a tier declaration changes.

@shaptonstahl
shaptonstahl force-pushed the fm/fm-add-palimpsest-openbrain-routing-to-firs-b4 branch from d44d452 to f44e659 Compare October 13, 2026 02:05
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @shaptonstahl for rebasing this rather than starting over. This is my first triage look at it.

What I checked: the full diff at f44e6591 (AGENTS.md §2/§6, .agents/skills/stow/SKILL.md, docs/configuration.md). It's prose and docs only, with no scripts and no workflows. The attestation MATCHES this head. Live validation is "no-surface", which I accept for an instruction-only change. AGENTS.md grows from about 6,930 to 7,060 words, still under the 9,000-word ceiling.

CI: "Behavior portable parallel 1" is red in tests/fm-pi-primary-types.test.sh (Pi BeforeAgentStartEvent.prompt TS2339). Main 6407052f fails the same way, so it's not caused by your change. The rest is still running.

Contract-class (my own verdict): new-default. With a declaration, the behavior is fully opt-in, which is nice. One line reaches every home, though: with no Memory layering declaration, "stow reports the missing declaration in its receipt" (§6, the stow receipt bullet, and the docs). That gives every captain who has never heard of external tiers a new line in every stow receipt.

VISION (each rule):

  • One captain, one interface: mixed. The declared-tier routing aligns, but the missing-declaration receipt line is noise for the default home.
  • Authority is explicit: aligns (tier capture only happens when the captain declares it).
  • Scripts own the mechanics: aligns (judgment-only prose).
  • A restart is a non-event: aligns (the pending-capture marker keeps uncaptured facts in startup-loaded memory, which addresses Greptile's P1).
  • Delegation with a spine: aligns.
  • The fleet outlives any vendor: aligns (the tiers are generic, and Palimpsest/OpenBrain are only an example).
  • Scope: aligns, though personal memory layering correctly stays under data/.

Some gentle suggestions, your call:

  1. If you drop the "report the missing declaration" line, so the undeclared path stays silent exactly as today, this becomes opt-in and can merge on its own once CI is green. If you'd rather keep it, it goes to Kun as a merge-or-leave instead. Either is fine.
  2. The no-mistakes review note at stow lines 122/129 says "the exempt pinned floor". Since pending-capture entries are now exempt too, "the exempt pinned and pending-capture floor" would point the captain at the right lever.
  3. Greptile's P2 is still open: if a home renames or retires a tier, entries carrying <!--t:OLD--> can never clear. One sentence on how stow reconciles that would close it.

If you push changes, please re-raise through git push no-mistakes so the attestation binds the new head. Thanks again!

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.
…-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass
…rkers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.
@shaptonstahl
shaptonstahl force-pushed the fm/fm-add-palimpsest-openbrain-routing-to-firs-b4 branch from 66f1227 to 901cb3c Compare October 14, 2026 04:42
@kunchenguid
kunchenguid merged commit 2911a3b into kunchenguid:main Oct 14, 2026
19 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @shaptonstahl — really appreciate you taking the time on this.

All three follow-ups from my last look are in. With no Memory layering declaration, the undeclared path now stays silent exactly as it does today. The floor wording now names pinned and pending-capture entries. A renamed or retired tier now gets its marker retargeted or removed. With that, the change is opt-in: nothing changes for a home until it declares tiers. CI was green on 901cb3c2 against current main, and the no-mistakes attestation matched that head.

pc-agents-lstutzman Bot referenced this pull request in lstutzman/firstmate Oct 14, 2026
…, relaunch races) (#10)

* fix: prevent concurrent secondmate relaunch races (#7154)

* fix: serialize secondmate liveness relaunches across task set

* no-mistakes(review): Remove relaunch wait override and test bounded contention

* no-mistakes(document): Clarify secondmate relaunch locking and timeout documentation

* chore: keep local Stele binding out of shared template

* no-mistakes(document): Correct stale secondmate recovery timing comment

* chore: exclude local Stele binding from relaunch fix

* ci: retrigger CI after a timed-out test shard

* no-mistakes(document): Correct secondmate recovery ordering documentation

(cherry picked from commit 6407052)

* fix: require explicit authority for Firstmate upstream contributions (#7172)

* feat(bin): gate firstmate-upstream publication behind a declared home role

Users who clone firstmate and run it as-is got a surprise: when their
agent hit a firstmate bug, it could drive a pull request at upstream
because nothing distinguished the maintainer's home from an ordinary
user's. Every home now resolves to user/operator unless the gitignored
config/firstmate-role grants a maintainer scope, or a single task
carries the captain's recorded --upstream-consent on the brief, spawn,
and promotion. fm-brief, fm-spawn, and fm-promote apply one fail-closed
gate in bin/fm-role-lib.sh; the role is never inferred from gh identity,
remotes, permissions, or CI, and secondmates honor only receipt-proven
inherited grants so a child cannot grant itself. Session start reports
the resolved role with no network call. Ordinary project delivery and
the clone-and-run setup flow are unchanged.

* no-mistakes(review): Harden firstmate role parsing, normalization, and inheritance

* no-mistakes(review): Detect firstmate by lineage; drop consent fallback; fix claims

* no-mistakes(document): Correct and consolidate Firstmate role documentation

(cherry picked from commit 7df545b)

* fix(pi): narrow before_agent_start events before reading prompt (#7248)

* fix: narrow Pi before-agent prompt events

* no-mistakes(review): Restore processing-run abort detection and type Pi test events

(cherry picked from commit 8c9c67d)

* feat: let a home declare authoritative external memory tiers (#6608)

* docs: let a home declare authoritative external memory tiers

AGENTS.md section 6 routed durable knowledge only to firstmate-local files,
so a home whose captain keeps reasoning and facts in external stores had no
tracked rule keeping those stores authoritative over the per-machine data/
cache. Add a generic home-declared Memory layering contract (schema in
docs/configuration.md), make firstmate the capture path for workers whose
harness cannot reach a declared tier, and teach the stow skill to route to
declared tiers first and never prune a tier-owned entry without capturing it.

* no-mistakes(review): Report missing memory-layering declaration and index tier docs

* no-mistakes(document): Narrow memory-tier re-seed step to captain re-declaration

* no-mistakes(ci): Environment: 2026-10-05, host wildrobot, Linux 7.0.0-34. Finding ci-1 (Greptile): a tier-owned fact could be lost when its declared tier was unreachable from the session. - The invariant that was broken: until the declared tier holds a tier-owned fact, that fact must stay in a memory file loaded at startup. - Where it could be broken: the declared-tier guard, which said to archive the entry to the never-loaded cold tier; the routing step for new findings, which only mentioned the receipt; and the budget-eviction and offload eligibility rules. Fix, made only in .agents/skills/stow/SKILL.md: - **New marker.** Added `<!--t:NAME-->` to the existing compact marker list, so its meaning lives in one place. It marks a tier-owned entry that tier NAME does not hold yet. Stow never prunes, ages out, evicts, offloads, consolidates away, or archives an entry carrying it, whatever its tier clock says. A later pass that can reach NAME captures the entry there and removes the marker. - **Declared-tier guard.** "still archive rather than delete" now says to leave the entry in place with its pending-capture marker, and the receipt still names it. - **Routing step 2.** When the tier is unreachable, a new finding is written to the startup-loaded local file its class would otherwise use, or kept where it already lives, with the marker. It is still reported as an exception in the receipt. - **Budget eviction and offload eligibility.** Both now exclude entries pending capture, so the convergence pool is counted correctly. - **Receipt bullet.** Changed "finding or pruned entry" to entries left carrying the pending-capture marker, because those entries are no longer pruned. docs/configuration.md ("protects tier-owned entries from pruning") and AGENTS.md section 6 are still accurate, so I left them unchanged. No new file, queue, script, or digest section. One sentence per line, plain dashes. Verification: tests/fm-stow-cascade.test.sh, tests/fm-documentation-audiences.test.sh, and tests/fm-lint.test.sh all pass

* docs: keep undeclared memory-tier path silent and close stuck tier markers

Drop the stow receipt line reporting a missing Memory layering declaration
(AGENTS.md section 6, the stow skill, docs/configuration.md) so a home with
no declaration behaves exactly as before. Name pending-capture entries in the
exempt floor wording, and say how stow retargets or clears a pending-capture
marker whose tier was renamed or retired.

(cherry picked from commit 2911a3b)

---------

Co-authored-by: Pedro Guimarães <[email protected]>
Co-authored-by: Kun Chen <[email protected]>
Co-authored-by: Ian Brown <[email protected]>
Co-authored-by: Stephen Haptonstahl <[email protected]>
mfylkesnes added a commit to mfylkesnes/firstmate that referenced this pull request Oct 15, 2026