Skip to content

Continuous decaying working memory (global + per-project) that seeds new sessions #12

Description

@RyanSeanPhillips

Summary

A background loop that continuously distills conversations into a decaying, tiered working memory — global + per-project — that new sessions pull from to seed context. The capstone of the memory roadmap (depends on the cross-vendor index #11).

Why cldctrl is positioned for this

The moving parts already exist: the daemon (background, ~5min cadence), the conversation index with incremental (mtime/byte-offset) parsing — cross-vendor via #11, the summarizer (core/summaries.ts, claude --print), the control-plane per-project store + recaps/, and the MCP surface to seed/serve memory to any agent (Claude or Codex).

Design

  1. Background extractor (daemon job). Each tick, for sessions with NEW turns only (incremental), distill salient facts/decisions/open-threads into memory entries tagged scope: global | project:<path>. Use a cheap model (Haiku) + batching; throttle to daemon cadence.
  2. Tiered time-decay ("memory pyramid"). Recent entries verbose; as they age, progressively re-summarize (detail decays): last-day detailed → last-week summarized → older collapses to a one-line gist and falls back to the long-term search index. Keeps working memory bounded + recency-rich without context pollution. Decay policy configurable.
  3. Two scopes. Global working memory (current focus, recent cross-project decisions/prefs) + per-project working memory (where we left off, open threads, decisions).
  4. Seeding new conversations. On launch_session in project X, OFFER to inject that project's working memory (+ relevant global bits) into the kickoff — prefill + confirm (same model as cross-project coordination Cross-project coordination: a driver conversation that reads, dispatches, and verifies across projects #10) — and/or a get_working_memory({project}) MCP tool the agent pulls on demand.

Prior art to borrow from

  • Stanford "Generative Agents" memory stream: score memories by recency + importance + relevance; periodic reflection synthesizes higher-level memories. ("Time decay on level of detail" ≈ reflection + recency weighting.)
  • MemGPT/Letta: tiered memory paging (what's in context vs recall vs archival).
  • mem0 / Zep: managed decay/summarization; Zep adds a temporal knowledge graph.

Risks / mitigations

  • Cost: changed-sessions-only, batch, cheap model, daemon throttle.
  • Trust: auto-extracted memory can be wrong; bad seed context is worse than none → make it visible + editable (dashboard "working memory" panel with pin/forget) and confirm-before-seed. Advisory, never silently authoritative.
  • Scope bleed: explicit global-vs-project rules; user can correct/move.
  • Privacy: all local (fits the data-stays-local edge).

Dependencies / order

Substrate = #11 (cross-vendor conversation index). Then the three-tier memory model: long-term search (built) → semantic/vector layer → this continuous working-memory loop. Relates to #10 (coordination uses the same prefill+confirm seeding) and the three-tier memory note.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions