Repository navigation
Description
Part of #114.
Problem Statement
Persona edits never reach a running Orchestrator Session: the persona snapshot is first-write-wins for the Session's whole life. For a long-lived Orchestrator, a Human's PERSONA.md revision sits on disk indefinitely while the bot keeps speaking the old voice.
Solution
Treat compaction as the single principled refresh point. At the compaction boundary, compare on-disk PERSONA.md against the recorded snapshot; on difference only, rewrite the persona section and re-record the snapshot row. Identical content is a no-op. Verified premise: DSH compaction replaces only the history surface span and replays the system prompt verbatim to reuse prefix cache, so the refresh is a deliberate short-prefix rewrite at a moment when the absolute bill is at its local minimum - not a free ride, a discounted one.
User Stories
- As a Human who revised PERSONA.md, I want the new voice to take effect after the next compaction, so that long-lived bots eventually catch up without a restart.
- As a Human who did not touch PERSONA.md, I want compaction to change nothing about the bot's voice, so that refreshes never surprise me.
- As an Orchestrator agent, I want exactly one voice per Session generation, so that I never mix two personas mid-life.
Implementation Decisions
- Refresh is a conditional rewrite plus snapshot-row re-record; the per-assembly persona lookup path is unchanged.
- The first-write-wins invariant gains one explicit, conditional exception (compaction boundary only).
- Trigger observation rides the existing session compaction events; no new seams.
Testing Decisions
- Changed PERSONA.md + one compaction -> new turns use the new version and the snapshot row advances.
- Unchanged PERSONA.md -> the snapshot row is byte-identical after compaction.
- Rest-of-prefix invariance across the refresh.
Out of Scope
- Turn-annotation (Spec: turn-annotation for out-of-band Memory worktree changes #324, separate track); live persona re-reads per turn (rejected: steering belongs in the prefix); Nudge/background loops.
Further Notes
Amends the never-patches-a-running-session rule in ADR-0060 with one explicit exception. Mechanism detail (which compaction event to observe) is tracer-slice work, not this spec.
Activity
test(memory): compaction refresh wiring test