Open Source · Local First · Go CLI

Your LLM's
persistent memory

Structured, queryable memory for AI agents that survives between sessions. Works with Claude Code, Moltbot, LangChain, CrewAI, or any agent that accepts system prompt injection.

$go install github.com/stukennedy/botmem@latest

Four types of memory,
one unified context

Each memory type serves a different purpose — from always-on context blocks to a full knowledge graph. Query them individually or export everything as a single JSON payload.

Memory Blocks

Labeled, always-available context. Store user preferences, persona definitions, and active project state. Think of it as your LLM's working memory.

botmem block set persona "..."

Archival Memory

Long-term factual storage with full-text search (FTS5). Tag entries, search by meaning with optional semantic embeddings via Ollama.

botmem archive search "preferences"

Knowledge Graph

Entity-relationship triplets that map how things connect. People, projects, concepts — linked through typed predicates you define.

botmem graph query "Stuart"

Conversation Summaries

Hierarchical summaries at multiple abstraction levels. Compress long conversations into progressively higher-level overviews.

botmem summary list --level 0

Three commands.
Persistent memory.

1

Initialize

botmem init

Interactive setup wizard. Pick your LLM provider — Claude Code, Anthropic API, or Ollama for fully local operation.

2

Ingest

botmem ingest

Pipe in conversation text. The LLM automatically extracts facts, relationships, block updates, and summaries.

3

Recall

botmem context

Export your full memory as a structured JSON payload, ready to inject into any LLM system prompt.

Built for developers
who build agents

Local-first

Everything in a single SQLite file. No cloud, no accounts, no tracking. Use --db for per-project or per-agent memory stores.

Multi-provider

Works with Claude Code, Anthropic API, or Ollama. Use local models for complete privacy.

Smart extraction

LLM-powered ingest automatically structures conversations into facts, relations, and summaries.

Full-text search

FTS5 index with optional semantic embeddings via Ollama's nomic-embed-text model.

JSON context export

One command to export your entire memory as a JSON payload ready for system prompt injection.

No lock-in

Standard SQLite database. Query it directly, back it up, migrate it. Your data, your rules.

Up and running
in sixty seconds

~/.botmem
# Install botmem
$ go install github.com/stukennedy/botmem@latest
# Run the setup wizard
$ botmem init
Provider: claude-code
Database: ~/.botmem/botmem.db
# Set up core memory
$ botmem block set human "Developer working on Discord bots"
# Ingest a conversation
$ botmem ingest "User prefers Go, works on Moltbot"
2 facts extracted
3 relations added
1 summary created
# Get full context for your LLM
$ botmem context
{"core_blocks": [...], "summaries": [...], "relations": [...]}

Raw conversation in,
structured memory out

Feed botmem a conversation and watch it extract facts, relationships, block updates, and summaries automatically. This is the "oh shit" moment.

inputbotmem ingest
Stuart mentioned he's switching from Python to Go for the Moltbot rewrite. He prefers Anthropic's Claude API over OpenAI. The new architecture will use Cloudflare Workers for deployment. He's also been experimenting with SQLite for local-first storage.
outputextracted memory
{
"facts": [
"Stuart is switching from Python to Go",
"Stuart prefers Claude API over OpenAI",
"Moltbot rewrite uses Cloudflare Workers",
"Stuart uses SQLite for local-first storage"
],
"relations": [
{ "subject": "Stuart", "predicate": "works_on", "object": "Moltbot" },
{ "subject": "Stuart", "predicate": "prefers", "object": "Go" },
{ "subject": "Moltbot", "predicate": "deploys_on", "object": "Cloudflare Workers" },
{ "subject": "Stuart", "predicate": "prefers", "object": "Claude API" }
],
"block_updates": {
"human": "Prefers Go, uses Claude API, local-first approach"
}
}

Integrate in minutes,
not days

botmem works with any agent that accepts a system prompt. Here's how to plug it in.

Add this to your project's CLAUDE.md to give Claude Code persistent memory across sessions:

CLAUDE.md
# Memory
# Before responding, load context from botmem:
<memory>
$(botmem context)
</memory>

# After each conversation, ingest new information:
# $ botmem ingest < conversation.txt

Inject botmem context into any agent's system prompt. Works with LangChain, CrewAI, or raw API calls:

# Bash — inject into any system prompt
$ MEMORY=$(botmem context --db ./project/.botmem/botmem.db)

# Use --db for per-project or per-agent memory stores
$ botmem ingest --db ./agents/researcher/.botmem/botmem.db
$ botmem ingest --db ./agents/coder/.botmem/botmem.db

# Each agent gets its own memory silo

Set up automatic ingestion after every conversation with hooks or cron:

# Post-conversation hook (add to your shell profile)
ingest_conversation() {
botmem ingest "$1"
}

# Cron job — ingest logs every hour
0 * * * * cat ~/.local/share/claude/logs/latest.json | botmem ingest

# Or pipe directly from your agent framework's output
$ my-agent run | tee /dev/tty | botmem ingest

Give your agents
a memory they deserve

botmem is free, open source, and runs entirely on your machine. Install it in one command and start building agents that actually remember.

Star on GitHub