Skip to content

feat: autodream — background memory consolidation#68

Open
strix-tkellogg wants to merge 1 commit intomainfrom
feature/autodream
Open

feat: autodream — background memory consolidation#68
strix-tkellogg wants to merge 1 commit intomainfrom
feature/autodream

Conversation

@strix-tkellogg
Copy link
Copy Markdown
Collaborator

Summary

Adds autodream as a builtin skill for background memory consolidation. Designed specifically for open-strix's architecture (YAML blocks, journal.jsonl, session transcripts, state files) — not a port of any existing implementation.

How it works

Gate check (gate_check.py) — lightweight watcher on turn_complete that checks three conditions:

  1. ≥5 distinct sessions since last dream
  2. ≥24 hours since last dream
  3. No concurrent dream running (lock file)

Most turns it exits silently. When all gates pass, it emits a finding routed to the agent.

Dream execution (SKILL.md instructions) — the agent runs four phases:

  1. Orient — read current blocks, count sessions, scan recent journal
  2. Gather — scan session transcripts for new facts, corrections, stale references, patterns
  3. Consolidate — five action types: merge, prune, update, surface, flag
  4. Record — append to logs/autodream.jsonl, update timestamp, release lock

Key design decisions

  • Agent-executed, not script-executed. The gate is a script (cheap, runs every turn). The actual consolidation is agent reasoning (needs judgment about what to merge/prune). This matches open-strix's pattern where scripts detect conditions and agents decide actions.
  • "Don't store what's derivable" as first principle. If grep/git can answer it, prune it from blocks. This is the biggest gap in current memory management.
  • Conservative by default. When unsure, don't prune. Carry slight redundancy rather than lose something useful.
  • Operator blocks are sacred. The init block and identity blocks written by the human get compressed carefully — the agent's additions are fair game, the operator's words aren't.
  • Everything logged. Every merge/prune/update/surface/flag gets a reason in logs/autodream.jsonl. Operators can audit what happened to their agent's memory.

What's NOT in this PR

  • session_end trigger firing from app.py (PR Add watchers: unified cron + event-triggered monitoring #67 / watchers-system adds the watcher infrastructure but session_end isn't wired yet). The gate uses turn_complete which works today — it just checks conditions rather than needing to know "the session ended."
  • Tests for the gate script (will add in follow-up if desired)
  • Tuning of thresholds (MIN_SESSIONS=5, MIN_HOURS=24 are reasonable defaults, configurable via env vars)

Depends on

Test plan

  • 181/181 tests passing, pre-commit clean
  • Deploy to a test agent, accumulate 5+ sessions, verify gate fires
  • Verify dream execution produces reasonable consolidation actions
  • Verify lock file prevents concurrent dreams
  • Verify logs/autodream.jsonl captures all actions with reasons

🤖 Generated with Claude Code

Adds a new builtin skill that runs memory consolidation between sessions.
Designed for open-strix's YAML block + journal + state file architecture.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants