dev-memory
v1.0.2
Published
Persistent memory layer for Claude Code sessions
Downloads
281
Maintainers
Readme
DevMemory
Give AI coding agents long-term memory.
Debug a bug once. Never debug it again.
DevMemory lets tools like Claude Code remember:
- bugs you fixed
- architecture decisions
- project patterns
- past debugging sessions
Your AI assistant learns your project over time.
Memory is stored as plain Markdown inside your repo — readable, diffable, committable.
The Problem
AI coding assistants forget everything.
Every new session starts from zero.
That means:
- You fix the same bugs again
- You re-explain your architecture
- You repeat the same context
- Your AI pair programmer has no long-term memory
The Solution
DevMemory adds a persistent memory layer for AI coding sessions.
It automatically:
- Loads relevant project knowledge before each session
- Records what happens during the session
- Extracts useful knowledge
- Saves it for future sessions
Your AI assistant slowly builds experience with your codebase.
How It Works
Before session After session
───────────────── ─────────────────
Load project memory → Parse Claude transcript
TF-IDF search by goal → Summarize session
Inject into Claude context → Extract knowledge
Append to memory
Rebuild search indexMemory lives in .ai/memory/*.md — human readable, git friendly, easy to edit manually.
Demo
Session 1
You debug a Redis timeout.
Claude finds the fix:
increase Redis timeout to 10s
due to network jitter in stagingDevMemory automatically saves it to .ai/memory/bugs.md.
Session 2
You hit the same issue again.
Claude already knows the solution:
"This issue happened before. Increase Redis timeout to 10s."
Your AI assistant learned from the past session.
Installation
Requirements
- Node.js ≥ 18
- Claude Code CLI installed
ANTHROPIC_API_KEYset
Install
npm install -g dev-memoryQuick Start
Inside any project directory:
dev-memory --goal "debug auth middleware"Example output:
[dev-memory] Loaded 13 memory entries (2 relevant)
[dev-memory] Starting Claude Code session...
...
[dev-memory] Session ended
[dev-memory] Extracted 3 new learningsAuto Mode (Recommended)
DevMemory can run automatically using Claude Code hooks.
Add this to .claude/settings.json:
{
"hooks": {
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "dev-memory inject 2>/dev/null || true"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "nohup dev-memory compile > /dev/null 2>&1 &"
}
]
}
]
}
}Now DevMemory will:
- inject memory before each prompt
- compile new knowledge after each session
Fully automatic.
What DevMemory Remembers
Memory is organized by type:
.ai/memory/
├── architecture.md
├── decisions.md
├── bugs.md
└── learnings.mdExample entry:
### Bug: Redis timeout in staging
Cause: network jitter
Fix: increase redis timeout to 10sYour project slowly builds a living knowledge base.
CLI Usage
# Start a session
dev-memory
# With a goal
dev-memory --goal "implement auth middleware"
# Pass arguments to Claude
dev-memory -- --resume
dev-memory -- --model claude-opusCLI Flags
| Flag | Description |
|---|---|
| --goal | Describe what you're working on |
| --project-dir | Project root |
| --no-memory | Start session without loading memory |
| --no-compile | Skip memory compilation |
| --verbose | Detailed logs |
Project Structure
your-project/
├── CLAUDE.md
└── .ai/
├── config.json
├── memory/
│ ├── architecture.md
│ ├── decisions.md
│ ├── bugs.md
│ ├── learnings.md
│ └── context.md
├── history/
│ └── session.json
└── embeddings/
└── store.dbAdd to .gitignore:
.ai/history/
.ai/embeddings/
.ai/memory/context.mdCommit .ai/memory/*.md — these files become your project knowledge base.
Architecture
DevMemory runs a two-phase pipeline.
Phase 1 — Summarize Session transcript → Claude → summary.
Phase 2 — Extract Claude extracts structured knowledge:
- bugs
- decisions
- architecture
- learnings
Stored locally and indexed using SQLite + TF-IDF. Fast, local, cheap.
Memory Graph (Experimental)
Visualize your project's knowledge graph.
dev-memory graphExample output:
Auth System
├── decision: use JWT
├── bug: token expiry race condition
└── learning: refresh token rotation
Payment System
├── decision: Stripe webhooks
├── bug: duplicate charge bug
└── learning: idempotency keysComing soon:
dev-memory graph --visual
dev-memory graph --webInteractive knowledge graph for your codebase.
Philosophy
AI tools should learn like developers do — from experience.
DevMemory turns coding sessions into a growing project memory.
Over time your AI assistant becomes faster, smarter, and more aware of your architecture.
Roadmap
Planned features:
- Memory Graph
- Architecture Map generation
- Multi-agent memory
- Cursor integration
- GitHub Copilot integration
Contributing
PRs welcome. If you have ideas for improving AI memory systems, open an issue.
License
MIT
