Skip to content

Memory: periodic sleep-time consolidation agent (dual-gated, memory-tools only) #722

Closed

Description

@currentbits

Parent: #719

The ambiguous remainder (jaccard 0.4–0.7 pairs, shared-entity contradiction candidates, fat conventions, distill candidates) needs judgment. Follow the Claude Code Auto Dream / Letta sleep-time pattern: a periodic background agent run per project, dual-gated on ≥24h since last run AND ≥N new open queue items, that:

  1. Reads memory_maintenance + memory_distill (both already exist as MCP tools).
  2. For each open pair: merge via memory_supersede, invalidate the stale side, or noop — with the rule that losers are tombstoned, never deleted.
  3. Trims fat conventions (>1500 chars) via supersede with a tighter body.
  4. Writes strategy entries from the distill evidence pack, then supersedes the consumed runs.
  5. Absolutizes relative dates in bodies it touches ("yesterday" → ISO date).

Design notes:

  • Solenta is an agent host, so this is a thread running a cheap worker model on a schedule — no new infra, reuses automations/scheduler. The prompt is self-contained; the tools already exist.
  • Sandbox: the pass may only call memory tools, no file/shell access.
  • Record each pass as a run memory entry so the Memory tab can show "last consolidation: X resolved, Y merged".
  • Cap work per pass (e.g. 20 queue items) so a flooded queue drains over several passes.

Tests: prompt-level integration test with a fake agent (pattern exists in electron tests); memory-server side needs nothing new.

Activity

  1. currentbits commented on Aug 26, 2026

    @currentbits
    OwnerAuthor

    Design refinement from the GBrain review (#719 addendum): implement this as a phase manifest, not a single agent prompt. Ordered phases, each individually testable and each declaring deterministic vs LLM:

    1. deterministic janitor rules (dead pairs, stale rows, cosine ≥0.95 — overlaps Memory janitor: deterministic auto-resolution of dead/stale/certain queue rows #720; run first, no model cost)
    2. date/type pre-filter over remaining open pairs (cheap gate, GBrain's layered pre-filter pattern)
    3. LLM adjudication of the survivors (merge/supersede/invalidate/noop)
    4. distill strategies from the evidence pack, supersede consumed runs
    5. record the pass as a run entry + janitor snapshot fields (lastConsolidation: {resolved, merged, distilled, at})

    Also: keep adjudication verdicts durable (our open-pair unique index does this) so a pair is never re-judged across passes.

  2. added
    plan:doing
    and removed
    plan:todo
    on Aug 27, 2026
  3. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Implementing on coder/fork-memory-periodic-sleep-time-consolid-2eee8e.

    Host-side dual-gate (≥24h since last fire AND ≥5 open queue items) then createThread + startRun with a self-contained consolidation prompt. Reuses the automations scheduler pattern (same as post-merge): not a user-visible Automation.

    Sandbox: Claude --allowedTools=mcp__coder-memory__* plus a memory-only MCP config (no coder-threads); permission prompts for anything else (including memory_delete) are auto-denied. Cap 20 queue items per pass. Each pass is a run memory entry written by the agent.

    Tests: gate unit tests + prompt-level fake-agent integration (teach-runner pattern).

  4. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Implementation is on coder/fork-memory-periodic-sleep-time-consolid-2eee8e.

    • Dual-gate host scheduler (24h AND ≥5 open queue items) in electron/memory-consolidate.js, same pattern as automations/postmerge.
    • Self-contained prompt: maintenance + distill, supersede/invalidate/noop, fat-convention trim, strategy distill, date absolutizing, type:run summary, cap 20.
    • Sandbox: memory-only MCP config (*-memory.json) + --allowedTools=mcp__coder-memory__*; memory_delete and non-memory tools auto-denied on Claude's permission channel. No worktree, no daily budget.
    • Tests: gate/prompt/scheduler unit file + fake-agent prompt dump (teach-runner pattern).

    Not in this change: Memory tab activity line (#723).

  5. added
    plan:done
    and removed
    plan:doing
    on Aug 27, 2026
  6. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Landed from Solenta thread "Fork: Memory: periodic sleep-time consolidation agent (dual-". Closed on merge.

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

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions