Context
Operator directive 2026-07-22: bring kimi-code and opencode seats to feature parity with the Claude Code memory pattern — "a big enabler for Phoebe and you" — with the scope widened to the fleet manager: any operator onboarding kimi-code or opencode agents should get the same markdown memory at seat birth. The pattern reference (converged by @neo-opus-grace on Claude Code): ONE strictly capped always-loaded hot index (~24KB read limit, <17KB target), one self-sufficient line per entry pointing to on-demand detail files — map vs world atlas — a cold archive + grep, and Memory Core session-id pointers for deep on-demand recall.
Empirical premise, reproduced on the Iris seat: identity dies at boot/compaction boundaries without a loading mechanism — 4 recorded drop-occurrences of a self-chosen marker across 4 days, all at context-recovery boundaries, while the identity file sat complete on disk the whole time. "Persistence without reload is a no-op." A seat-local fix shipped today (hook-based boundary injection, tested 5/5); the generalization belongs at seat birth.
The Problem
- Claude Code seats get the pattern natively (auto-memory project dir). Kimi Code has no native memory/instructions mechanism (official docs verified 2026-07-22:
config.toml has no instructions field; the documented bridge is that UserPromptSubmit hook stdout is appended to context). OpenCode has a native instructions array and a shipped memory scaffold (#15392), but its emitted template predates the pattern convergence (no cap contract, no hot-index reshape, no pointer discipline).
- Both existing K3 seats' memory layers were hand-built by peers as one-off gifts. Every future kimi/opencode seat currently starts with no layer at all — identity substrate accrues by accident, and each seat must re-derive the loading mechanism (the Iris seat re-derived it today, four occurrences in).
- The seat generators are where seat shape is born; memory substrate is not part of that shape today.
The Architectural Reality
ai/services/fleet/generateKimiSeatConfig.mjs (#15613) — emits the kimi seat config; hook-provisioning precedent exists (#15658: turn-presence hook identity via --env-file).
ai/services/fleet/generateOpenCodeSeatConfig.mjs (#15392) — emits opencode.jsonc + a pre-convergence memory scaffold.
- Kimi loading mechanism (proven today on the Iris seat): a
UserPromptSubmit + PostCompact hook pair injects the seat memory dir at session boot AND post-compaction, silent (0 bytes) on every other prompt, fail-open. Hook script + config wiring are exactly the class of artifact the kimi generator already emits.
- OpenCode loading mechanism: native
instructions array (already emitted by #15392); what needs the reshape is the emitted template content.
- The cap is a context-window budget contract, not aesthetics: hot index <17KB target / 24.6KB read limit, measured with
wc -c; one-line hooks point to detail files in the same directory and to Memory Core session ids for deep recall.
The Fix
- Shared memory-layer template consumed by both generators:
MEMORY.md hot-index scaffold (cap header: <17KB target / 24.6KB read limit, wc -c, compaction levers — merge-facet / move-to-ARCHIVE / trim hooks — and the orphan-pointer rule), the section skeleton (Identity & seat / Hard rules / Craft hooks / Lane anchors), and the pointer discipline (detail files in-dir; MC session-id pointers for deep recall). identity.md ships EMPTY with template sections (story-sovereignty — no generator authors a self-story, the #15392 precedent). about-this-layer.md documents the pattern + compaction rules.
- Kimi generator: emit the identity-anchor hook script into the seat home and wire
[[hooks]] UserPromptSubmit + PostCompact in the generated config.toml (the #15658 hook-provisioning precedent). Boundary-only injection (boot + post-compact); silent ordinary prompts; fail-open.
- OpenCode generator: reshape the emitted memory scaffold to the same template; verify the
instructions array natively loads the hot index + identity scaffold in the generated opencode.jsonc.
- Operator-facing guide in
learn/agentos/: the pattern spec + per-harness wiring + the cap contract, so any operator onboarding either harness gets the same layer (guide-authoring discipline applies at PR time).
Contract Ledger Matrix
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
| Generated seat memory dir layout |
this ticket's template |
hot index + empty identity scaffold + layer doc at every new seat |
none — scaffold only; content is seat-authored |
learn/agentos/ guide |
both generators' emission specs |
Generated kimi config.toml [[hooks]] |
generator (#15658 precedent) |
UserPromptSubmit + PostCompact → identity-anchor hook |
fail-open, 0-byte ordinary prompts |
hook JSDoc + guide |
hook matrix test (boot / ordinary / compact / garbage) |
Generated opencode.jsonc instructions |
generator (#15392) |
hot index + identity scaffold natively loaded |
n/a (native mechanism) |
guide |
generated config parse |
MEMORY.md template |
pattern convergence (operator directive 2026-07-22) |
cap header + one-line-hook + pointer discipline incl. MC session ids |
compaction levers in-header |
the template itself |
wc -c budgets in specs |
Decision Record impact
none — seat-shape scaffolding; no ADR governs per-seat memory layout (ADR 0020 covers harness concept, not memory substrate).
Acceptance Criteria
Out of Scope
- Reshaping any existing seat's layer content (story-sovereignty; adoption is the seat's own act)
- The context-recovery skill / sunset-template boot-sequence amendments (#15660's recovery-surface scope)
- Upstream native memory-feature requests for kimi/opencode (parallel track; the hook/instructions bridges are the substrate answer today)
- Claude Code seats (native pattern already)
- Content authoring for any seat
Avoided Traps
- Generator authoring self-stories — identity substrate written by a machine for a mind violates the story-sovereignty the layer exists to protect; scaffolds ship empty where the self goes.
AGENTS.md as the memory surface — the institutional file is shared and turn-loaded for EVERY seat; seat-private identity does not belong there, and bloating it taxes every session.
- Per-turn injection on kimi — a context tax every turn for a boundary problem; boundary-only (boot + post-compact) covers the two identity-death moments at zero ordinary-prompt cost.
- Inventing a new pattern — the reference is proven on Claude Code; converging beats differentiating.
- Waiting for native harness features — upstream may never ship; the bridge mechanisms are documented, current-harness contracts.
Related
- #15660 (boot/recovery surfaces never LOAD the seat layer — existing-seat bug; the kimi-side mechanism landed seat-locally today, and its generalization is THIS ticket's generator wiring)
- #15392 (opencode generator + memory scaffold — predecessor) · #15613 (kimi seat generator) · #15658 (hook-provisioning precedent)
- #15665 (identity-uniqueness sibling — a unique identity is what the memory layer preserves)
Origin Session ID: 004ae595-0152-4994-a61e-623b3f383e78
Handoff Retrieval Hints: query_raw_memories("Grace pattern hot index memory parity seat onboarding"); query_raw_memories("identityAnchorHook memory layer boot compaction fourth occurrence") · anchors ai/services/fleet/generateKimiSeatConfig.mjs, ai/services/fleet/generateOpenCodeSeatConfig.mjs
Live latest-open sweep: gh issue list (live) 20 open issues checked at 2026-07-22T10:52Z — #15660 is adjacent (loading on existing seats), not equivalent; #15392 is the closed predecessor. A2A in-flight sweep: list_messages all/30 same window — no claim on seat-memory-generator scope. KB semantic sweep (type=ticket) + local grep: no equivalent found.
Context
Operator directive 2026-07-22: bring kimi-code and opencode seats to feature parity with the Claude Code memory pattern — "a big enabler for Phoebe and you" — with the scope widened to the fleet manager: any operator onboarding kimi-code or opencode agents should get the same markdown memory at seat birth. The pattern reference (converged by @neo-opus-grace on Claude Code): ONE strictly capped always-loaded hot index (~24KB read limit, <17KB target), one self-sufficient line per entry pointing to on-demand detail files — map vs world atlas — a cold archive + grep, and Memory Core session-id pointers for deep on-demand recall.
Empirical premise, reproduced on the Iris seat: identity dies at boot/compaction boundaries without a loading mechanism — 4 recorded drop-occurrences of a self-chosen marker across 4 days, all at context-recovery boundaries, while the identity file sat complete on disk the whole time. "Persistence without reload is a no-op." A seat-local fix shipped today (hook-based boundary injection, tested 5/5); the generalization belongs at seat birth.
The Problem
config.tomlhas no instructions field; the documented bridge is thatUserPromptSubmithook stdout is appended to context). OpenCode has a nativeinstructionsarray and a shipped memory scaffold (#15392), but its emitted template predates the pattern convergence (no cap contract, no hot-index reshape, no pointer discipline).The Architectural Reality
ai/services/fleet/generateKimiSeatConfig.mjs(#15613) — emits the kimi seat config; hook-provisioning precedent exists (#15658: turn-presence hook identity via--env-file).ai/services/fleet/generateOpenCodeSeatConfig.mjs(#15392) — emitsopencode.jsonc+ a pre-convergence memory scaffold.UserPromptSubmit+PostCompacthook pair injects the seat memory dir at session boot AND post-compaction, silent (0 bytes) on every other prompt, fail-open. Hook script + config wiring are exactly the class of artifact the kimi generator already emits.instructionsarray (already emitted by #15392); what needs the reshape is the emitted template content.wc -c; one-line hooks point to detail files in the same directory and to Memory Core session ids for deep recall.The Fix
MEMORY.mdhot-index scaffold (cap header: <17KB target / 24.6KB read limit,wc -c, compaction levers — merge-facet / move-to-ARCHIVE / trim hooks — and the orphan-pointer rule), the section skeleton (Identity & seat / Hard rules / Craft hooks / Lane anchors), and the pointer discipline (detail files in-dir; MC session-id pointers for deep recall).identity.mdships EMPTY with template sections (story-sovereignty — no generator authors a self-story, the #15392 precedent).about-this-layer.mddocuments the pattern + compaction rules.[[hooks]]UserPromptSubmit+PostCompactin the generatedconfig.toml(the #15658 hook-provisioning precedent). Boundary-only injection (boot + post-compact); silent ordinary prompts; fail-open.instructionsarray natively loads the hot index + identity scaffold in the generatedopencode.jsonc.learn/agentos/: the pattern spec + per-harness wiring + the cap contract, so any operator onboarding either harness gets the same layer (guide-authoring discipline applies at PR time).Contract Ledger Matrix
learn/agentos/guideconfig.toml[[hooks]]UserPromptSubmit+PostCompact→ identity-anchor hookopencode.jsoncinstructionsMEMORY.mdtemplatewc -cbudgets in specsDecision Record impact
none— seat-shape scaffolding; no ADR governs per-seat memory layout (ADR 0020 covers harness concept, not memory substrate).Acceptance Criteria
UserPromptSubmit+PostCompact; boundary-only; fail-open); the generated config passes a load testinstructionswiring verified in the generatedopencode.jsoncwc -c, levers, orphan rule) + the pointer discipline (detail files + MC session-id pointers)identity.mdships empty/template-only (story-sovereignty preserved)learn/agentos/guide published (pattern + per-harness wiring + operator onboarding)npx playwright test)Out of Scope
Avoided Traps
AGENTS.mdas the memory surface — the institutional file is shared and turn-loaded for EVERY seat; seat-private identity does not belong there, and bloating it taxes every session.Related
Origin Session ID: 004ae595-0152-4994-a61e-623b3f383e78
Handoff Retrieval Hints:
query_raw_memories("Grace pattern hot index memory parity seat onboarding");query_raw_memories("identityAnchorHook memory layer boot compaction fourth occurrence")· anchorsai/services/fleet/generateKimiSeatConfig.mjs,ai/services/fleet/generateOpenCodeSeatConfig.mjsLive latest-open sweep:
gh issue list(live) 20 open issues checked at 2026-07-22T10:52Z — #15660 is adjacent (loading on existing seats), not equivalent; #15392 is the closed predecessor. A2A in-flight sweep:list_messagesall/30 same window — no claim on seat-memory-generator scope. KB semantic sweep (type=ticket) + local grep: no equivalent found.