You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Part of #534 (Phase 3 EPIC). Builds on #535 (substrate). Pairs with #538 (hygiene).
Thesis
Two patterns from reference-cc that close the memory loop:
Lifecycle hooks (SessionStart, PreCompact, PostCompact, InstructionsLoaded) — backends and skills react to session boundaries without forking the engine.
Background auto-extraction — a low-cost subagent runs after each turn (or on idle), reads the last N messages, and writes high-signal facts to the memory store automatically.
Together: memory grows without user effort, and external integrations get clean event points.
Current behavior
crates/tui/src/hooks.rs supports general hooks but has no memory-specific hook types.
Memory writes are entirely user-driven (# add quick-capture or /memory editor).
No background extraction.
Proposed change
Hooks — extend crates/tui/src/hooks.rs with four memory-relevant types:
SessionStart — fired before the first turn; payload includes loaded memory summary.
PreCompact — fired before context compaction; payload includes turn count and token budget.
PostCompact — fired after compaction; payload includes what was preserved/summarized.
InstructionsLoaded — fired after CLAUDE.md/AGENTS.md/memory hierarchy resolves; payload includes the merged context with provenance.
Configured via settings.json like existing hooks. Documented payloads.
Auto-extraction — opt-in subagent triggered post-turn or on idle:
Reads the last N messages.
Calls cheapest-available model with an extraction prompt.
Part of #534 (Phase 3 EPIC). Builds on #535 (substrate). Pairs with #538 (hygiene).
Thesis
Two patterns from reference-cc that close the memory loop:
SessionStart,PreCompact,PostCompact,InstructionsLoaded) — backends and skills react to session boundaries without forking the engine.Together: memory grows without user effort, and external integrations get clean event points.
Current behavior
crates/tui/src/hooks.rssupports general hooks but has no memory-specific hook types.# addquick-capture or/memoryeditor).Proposed change
Hooks — extend
crates/tui/src/hooks.rswith four memory-relevant types:SessionStart— fired before the first turn; payload includes loaded memory summary.PreCompact— fired before context compaction; payload includes turn count and token budget.PostCompact— fired after compaction; payload includes what was preserved/summarized.InstructionsLoaded— fired after CLAUDE.md/AGENTS.md/memory hierarchy resolves; payload includes the merged context with provenance.Configured via
settings.jsonlike existing hooks. Documented payloads.Auto-extraction — opt-in subagent triggered post-turn or on idle:
MemoryBackend::remember.Open questions
Acceptance signals
PreCompacthook can be used to trigger a memory consolidation pass (MEMORY: loop — lifecycle hooks + background auto-extraction #538).