Logo
Features

Memory

How BabyClaw remembers things between sessions -- working memory and long-term extraction.

Memory

The agent starts each session fresh -- it doesn't inherently remember previous conversations. Memory in BabyClaw is file-based: the agent reads and writes files in its workspace to maintain continuity across sessions.

There are two kinds of memory: working memory (temporary, per-session) and long-term memory (extracted from conversations, persisted to files).

Working memory

Working memory is a per-session scratchpad. The agent uses the update_working_memory tool to jot down things it needs to track during a conversation -- file paths, intermediate results, IDs, or anything else that helps it stay on track.

Working memory is included in the agent's context on each turn within the session. It goes away when the session ends.

Long-term memory

After conversations in the main session, BabyClaw automatically extracts notable information and saves it to daily memory files.

How extraction works

  1. After the agent finishes a turn in the main session, memory extraction is queued
  2. After a 5-minute debounce (to batch multiple messages), the extractor runs
  3. It reviews the conversation and pulls out things worth remembering: decisions, preferences, context, lessons learned
  4. It writes these to memory/YYYY-MM-DD.md in the workspace
  5. Extraction avoids duplicating things already captured in existing memory files

The extraction is AI-powered -- the agent uses the same chat model to decide what's worth keeping. It skips transient chat, obvious implementation details, and anything already recorded.

What gets extracted

The extractor focuses on durable information:

  • Decisions you made ("we're using PostgreSQL for this project")
  • Preferences ("I prefer dark mode", "don't use semicolons")
  • Context about your life or work ("starting a new job in March")
  • Lessons learned ("the deploy script needs --force on staging")
  • Things you explicitly asked the agent to remember

It skips:

  • Casual back-and-forth
  • Step-by-step implementation details
  • Things already in existing memory files

Where memories live

workspace/
└── memory/
    ├── 2026-02-18.md
    ├── 2026-02-19.md
    └── 2026-02-20.md

Each daily file contains timestamped entries from that day's conversations.

MEMORY.md

The workspace also has a top-level MEMORY.md file for curated long-term memory. This is different from the daily files -- it's meant to be a distilled summary that the agent maintains over time, pulling the most important things from daily notes and organizing them.

The agent reads MEMORY.md at the start of main sessions (it's part of the instructions in AGENTS.md). Daily files are also read for recent context (typically today and yesterday).

Memory is only for the main session

Memory extraction only runs after main session conversations. Other sessions (linked group chats, scheduled task runs) don't trigger extraction. This is a deliberate choice -- the main session is where personal context lives, and keeping it isolated prevents leaking information to other contexts.

Session startup

At the start of each session, the agent reads:

  1. SOUL.md -- who it is
  2. USER.md -- who you are
  3. Recent daily memory files (today + yesterday)
  4. MEMORY.md (main session only)

This gives it enough context to pick up where things left off, even though the actual conversation history is limited to the session.historyLimit most recent messages.