Skip to content

Remember Context Between AI Sessions — Persistent Memory for Coding

You’re building a feature with Claude. You explain:

  • “We chose Postgres over MongoDB for ACID compliance”
  • “Redis pool exhaustion was fixed with max_connections=20”
  • “Always use /api/v1/ prefix for REST endpoints”

Next session? Claude has no memory of any of this. You start from scratch.

This wastes:

  • Tokens — re-explaining the same context
  • Time — reconstructing decisions
  • Money — paying for the same API calls twice

toon-memory gives your AI coding agent a persistent memory that:

  1. Survives restarts — memory persists across sessions
  2. Works offline — no cloud, no API calls, no LLM needed
  3. Saves tokens — 22% fewer tokens than JSON
  4. Scales — 80% fewer tool calls per session

At the end of a session, save what matters:

Terminal window
memory_remember({
category: "decision",
key: "use-postgres",
content: "Choose Postgres for ACID compliance and JSON support",
tags: "database;architecture"
})

At the start of the next session, get context instantly:

Terminal window
memory_smart_recall({ intent: "what I was working on" })
// Returns relevant entries combining BM25 + graph + quality

The agent now knows:

  • Your database choice (Postgres)
  • Why you chose it (ACID compliance)
  • Related decisions (Redis for caching, Zod for validation)
Terminal window
memory_remember({
category: "decision",
key: "microservices-approach",
content: "Use microservices for payment and auth, monolith for core business logic"
})
Terminal window
memory_remember({
category: "bug",
key: "redis-connection-timeout",
content: "Redis connection timeout in production — fix was increasing pool size to 20"
})
Terminal window
memory_remember({
category: "pattern",
key: "error-handling",
content: "Always use custom AppError class, never throw raw Error objects"
})
Terminal window
memory_remember({
category: "knowledge",
key: "team-conventions",
content: "PR #142 reverted the caching change — don't re-add it without team approval"
})

Leave tags empty and toon-memory infers them from content:

Terminal window
memory_remember({
category: "bug",
key: "redis-timeout",
content: "Redis connection timeout in production"
})
// Tags auto-inferred: redis

When you save, toon-memory finds related entries:

Terminal window
memory_remember({
category: "decision",
key: "use-zod",
content: "Use Zod for validation"
})
// 🔗 Related: redis-timeout (mentions "validation")

Every entry gets an automatic quality score (0-1):

Factor Weight
Tags 0.3 max
Links 0.2 max
Content length 0.3 max
Recency 0.1 max
Specificity 0.1 max

High-quality entries surface first in recall.

Save with the same key, attributes merge automatically:

Terminal window
// First save
memory_remember({ key: "use-zod", content: "Use Zod for validation" })
// Later save merges automatically
memory_remember({ key: "use-zod", content: "Use Zod — also handles API parsing" })
// Tags and links are combined, not overwritten

Running multiple agent sessions in parallel? toon-memory coordinates:

Terminal window
memory_sessions()
// 🧭 Active sessions (2):
// claude @ feature/auth (you)
// opencode @ feature/db
// 🔥 Soft conflicts: src/types.ts

See which files other sessions are touching to avoid merge conflicts.

Terminal window
npm install -g toon-memory
npx toon-memory # Interactive installer

Your agent will remember everything in the next session.