Skip to content

feature: add persistent agent memory across session restarts#31

Merged
benvinegar merged 3 commits into
mainfrom
benvinegar/persistent-memory
Feb 17, 2026
Merged

feature: add persistent agent memory across session restarts#31
benvinegar merged 3 commits into
mainfrom
benvinegar/persistent-memory

Conversation

@benvinegar
Copy link
Copy Markdown
Member

What

Adds persistent, cross-session memory so Baudbot agents retain operational learnings, user preferences, and recurring patterns across session restarts. Currently agents lose all context when sessions restart — they re-learn the same lessons every time.

New files

  • pi/skills/control-agent/memory/operational.md — infrastructure learnings, common errors/fixes
  • pi/skills/control-agent/memory/repos.md — per-repo build quirks, CI gotchas, architecture notes
  • pi/skills/control-agent/memory/users.md — user preferences, timezone, communication style
  • pi/skills/control-agent/memory/incidents.md — past incidents: root cause + fix

How it works

  1. deploy.sh seeds memory files to ~/.pi/agent/memory/only if they don't already exist (agent-owned, never overwritten)
  2. setup.sh creates the memory directory during initial setup
  3. Control agent reads all memory files on startup (added to startup checklist)
  4. Control agent updates memory files as it learns new things (dated Markdown entries)
  5. Dev agents read repos.md for repo-specific knowledge before starting work
  6. Sentry agent reads incidents.md for past incident context when triaging

Design decisions

  • Plain Markdown — no embeddings, no vector search, no file watcher. Files are small enough (<50KB) to include directly in context.
  • Agent-owned — memory files are writable by the agent, not protected like security files. Deploy never overwrites existing content.
  • No secrets — every memory file has a "DO NOT store secrets" warning. redact-logs.sh can scan these in the future.
  • Inspired by OpenClaw — their MEMORY.md + memory/ directory pattern, but without the Tier 2 semantic search infrastructure (SQLite + embeddings + hybrid search). We can add that later if memory grows past ~50KB.

Updated files

  • pi/skills/control-agent/SKILL.md — new Memory section + startup checklist
  • pi/skills/dev-agent/SKILL.md — reads repos.md before starting work
  • pi/skills/sentry-agent/SKILL.md — reads incidents.md on startup
  • bin/deploy.sh — seeds memory files (only if missing)
  • setup.sh — creates memory directory
  • README.md, AGENTS.md — architecture docs

Comment thread bin/deploy.sh
New ~/.pi/agent/memory/ directory with Markdown files that agents read
on startup and update as they learn. Survives session restarts.

Seed files (deployed only if missing — agent-owned, never overwritten):
- operational.md — infrastructure learnings, common errors/fixes
- repos.md — per-repo build quirks, CI gotchas, architecture notes
- users.md — user preferences, timezone, communication style
- incidents.md — past incidents: root cause + fix

Integration:
- Control agent reads all memory on startup, updates as it learns
- Dev agent reads repos.md for per-repo knowledge before starting
- Sentry agent reads incidents.md for past incident context
- deploy.sh seeds memory files (only if missing)
- setup.sh creates memory directory

Inspired by OpenClaw's file-based memory (MEMORY.md + memory/ dir),
simplified — no embeddings, no vector search, no file watcher. Plain
Markdown files small enough to include directly in context.
Tests cover:
- Seed files: exist, valid Markdown, no-secrets warnings, no real
  secrets, template-only content (no real dated entries)
- repos.md: has sections for all known repos (modem, website, baudbot)
- Deploy seeding: copies to empty dest, does NOT overwrite existing
  files, handles partial seeding correctly
- Skill integration: all 3 skills have Memory section, reference
  correct files, warn against storing secrets, startup checklists
  include memory reads
- deploy.sh: has memory seeds section, creates dir, uses conditional
  copy
- setup.sh: creates memory directory
@benvinegar benvinegar force-pushed the benvinegar/persistent-memory branch from 4f63ba7 to e8928d4 Compare February 17, 2026 15:40
The conflict resolution during rebase ate the closing fi for the
heartbeat if/else block, causing a syntax error on deploy.
@benvinegar benvinegar merged commit ba7110e into main Feb 17, 2026
8 checks passed
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.

1 participant