Sync AI coding context from Git AI to Redis Agent Memory Server for semantic search and recall.
Project description
DevMemory ๐ง ๐
DevMemory is a longโterm memory for AI coding agents that can explain why any file or function looks the way it does and let agents reuse that understanding across sessions without re-reading the whole repo.
Built on Git AI for capture and Redis Agent Memory Server for semantic search and recall.
Why DevMemory
devmemory whyfor code archaeology: Ask why a file or function exists and get a narrative backed by commits, prompts, and code snippets.- Semantic search over your repoโs history: Search โhow do we handle auth?โ or โwhy did we switch to Redis?โ and get synthesized answers with sources.
- Agent-ready, sessionโtoโsession memory: Coding agents can fetch recent and relevant memories at the start of a task and write new ones when they finish, instead of reโparsing the codebase and burning tokens every session.
If Git AI tracks who wrote which line and Entire checkpoints how agents worked, DevMemory answers what the team actually learned, why the code ended up this way, and gives agents a fast way to reuse that knowledge next time.
devmemory why (hero feature)
devmemory why src/auth.py
devmemory why src/auth.py login
devmemory why src/auth.py --raw
devmemory why src/auth.py --verbose
devmemory why pulls together:
- Commit summaries
- Per-file code snapshots
- Prompt-level context
- Human knowledge from
.devmemory/knowledge/*.md
and turns them into an explanation of how and why a file or symbol evolved, plus the sources it used.
Typical questions it answers:
- Why do we use this pattern here instead of an alternative?
- When did this behavior change and what bug or feature drove it?
- Which agent and prompts were involved in this refactor?
Quick start
Prerequisites
- Git
- Docker and Docker Compose
- Python 3.10+
- OpenAI API key (for embeddings and answer synthesis)
- Git AI (for AI code attribution capture)
One-line setup
bash scripts/install.sh
This script checks your environment, installs the CLI with uv, starts Redis plus AMS and MCP, configures git hooks, and wires DevMemory into Cursor.
Manual setup
git clone https://github.com/devmemory/devmemory
cd devmemory
cp .env.example .env
make up
uv tool install --editable .
cd /path/to/your/project
devmemory install
devmemory status
๐ Knowledge Files
DevMemory supports humanโcurated knowledge in .devmemory/knowledge/*.md.
Each markdown section (## heading) becomes a separate searchable memory.
.devmemory/
โโโ CONTEXT.md # Auto-generated context briefing (gitignored)
โโโ knowledge/
โโโ architecture.md # Architecture decisions and rationale
โโโ gotchas.md # Known issues and workarounds
โโโ conventions.md # Coding patterns and project rules
Knowledge files use frontmatter for metadata:
---
topics: [architecture, decisions]
entities: [Redis, AMS]
---
## Why We Chose Redis
We chose Redis with vector search over dedicated vector DBs
because it's already part of our stack and reduces complexity.
Run devmemory learn to sync knowledge files into the memory store.
Both automated capture (Git AI) and human knowledge feed the same searchable store.
๐ง Pro tip: Treat
.devmemory/knowledge/like living ADRs. Small, focused, and updated often.
๐ค Cursor Agent Integration
devmemory install wires DevMemory into Cursor so agents can:
- Use MCP tools like
search_long_term_memoryto pull in recent and relevant memories instead of asking the LLM to rediscover context from raw code. - Call
create_long_term_memoriesat the end of a task to store what changed and why, so future sessions start with that knowledge. - Read
.devmemory/CONTEXT.mdon branch switch for a compact briefing instead of reโevaluating the entire project on every run.
Over time this creates a compounding loop: each agent session leaves the repo a little better documented for the next one, while saving tokens and latency by reusing existing memory.
Auto-summarization
DevMemory can automatically generate LLM-powered summaries for each commit during sync. These summaries capture:
- Intent: Why the change was made and what problem it solves
- Outcome: What was actually implemented
- Learnings: Insights discovered during implementation
- Friction points: Blockers, tradeoffs, or challenges encountered
- Open items: Follow-ups, known limitations, or TODOs
Benefits for agents:
- Token efficiency: Agents read concise summaries (100-300 tokens) instead of parsing full commit diffs
- Better search relevance: Semantic search finds summaries that explain "why we added retry logic" faster than scanning code
- Faster onboarding: Agents quickly catch up on recent changes by reading summaries instead of analyzing code
- Intent preservation: The "why" behind changes is preserved even when commit messages are brief
Enable auto-summarization:
devmemory config set auto_summarize true
Summaries are generated non-blocking during devmemory syncโfailures are logged but don't stop the sync process. Each summary is stored as a semantic memory with the commit-summary topic, making them easily searchable.
๐ช Git Hooks
DevMemory installs two git hooks:
| Hook | What it does |
|---|---|
post-commit |
Runs devmemory sync --latest in background (autoโsyncs after every commit) |
post-checkout |
Runs devmemory context --quiet (refreshes context briefing on branch switch) |
๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Developer Machine โ โ Docker Stack โ โ Cursor IDE โ
โ โ โ โ โ โ
โ Git AI (git hooks) โ โ Redis Stack โ โ MCP Client โ
โ โ โ โ โฒ โ โ โ โ
โ โผ โ โ โ โ โ โผ โ
โ Git Notes (refs/ai) โ โ AMS API (:8000) โ โ MCP Server โ
โ โ โ โ โฒ โ โ (:9050) โ
โ โผ โ โ โ โ โ โ
โ devmemory sync โโโโโโโโโโโโโผโโโโโโผโโโโโ โ โ โ
โ โ โ โ โ โ
โ devmemory search โโโโโโโโโโโผโโโโโโผโโโโโบ AMS Search โโโผโโโโโโผโโโบ LLM synth โ
โ โ โ โ โ โ
โ .devmemory/knowledge/*.md โ โ โ โ Agent rules โ
โ โ โ โ โ โ (.cursor/rules)โ
โ devmemory learn โโโโโโโโโโโโผโโโโโโผโโโโโ โ โ โ
โ โ โ โ โ โ
โ devmemory context โโโโโโโโโโผโโโโโโผโโโโโบ .devmemory/CONTEXT.md โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
๐งพ What Gets Captured
DevMemory extracts three memory layers from each Git AI commit:
| Layer | Type | What it contains | Answers |
|---|---|---|---|
| Commit summary | semantic | Agent/model, prompts used, AI contribution stats, acceptance metrics, technologies, files | โWhich agent was used?โ, โHow much AI code?โ |
| Per-file code | episodic | Code snippets from diffs with key lines (imports, class/function defs) | โHow do we call the API?โ, โWhat client for Redis?โ |
| Prompt context | semantic | Actual prompt text, acceptance rate, affected files | โWhat prompts were used?โ, โWhat was the developer asking?โ |
Unique data points captured via Git AI and surfaced by DevMemory:
- AI vs human lines per commit
- Acceptance rate (lines accepted unchanged vs overridden)
- Time waiting for AI per commit
- Agent and model used (Cursor, Copilot, Claude Code, etc.)
๐ณ Docker Stack
The docker-compose.yml runs:
| Service | Port | Description |
|---|---|---|
| redis | 6379 | Redis Stack (vector search, JSON, streams) |
| api | 8000 | Agent Memory Server REST API |
| mcp | 9050 | MCP server for Cursor IDE (SSE mode) |
| redis-insight | 16381 | RedisInsight UI (debug profile only) |
make up # Start stack
make down # Stop stack
make logs # View logs
make debug # Start with RedisInsight
make clean # Stop and remove volumes
make verify # Run verification checks
๐ How DevMemory Fits the Ecosystem
| Tool | What it does | Data store |
|---|---|---|
| Git AI | Captures AI code attribution and prompts | Git Notes + SQLite |
| Entire | Captures agent sessions/checkpoints | Git branch |
| DevMemory | Turns captured data into searchable, evolving team knowledge | Redis AMS |
Git AI and Entire are capture tools.
DevMemory is a memory and knowledge tool โ it makes captured data searchable via semantic vector search, synthesizes answers with LLM, and feeds context back to AI agents automatically.
โ๏ธ Configuration
Config is stored in ~/.devmemory/config.json:
{
"ams_endpoint": "http://localhost:8000",
"mcp_endpoint": "http://localhost:9050",
"namespace": "default",
"user_id": "",
"auto_summarize": false
}
Configuration options:
auto_summarize: Enable automatic LLM-powered commit summaries (default:false). When enabled, each commit synced generates a narrative summary capturing intent, outcome, learnings, and friction points.
Environment variables (in .env):
| Variable | Default | Description |
|---|---|---|
OPENAI_API_KEY |
(required) | Used for embeddings and answer synthesis |
GENERATION_MODEL |
gpt-5-mini |
Model for LLM answer synthesis |
EMBEDDING_MODEL |
text-embedding-3-small |
Model for vector embeddings |
Remote AMS Configuration
To use a remote AMS server (e.g., deployed on a cloud server), set these environment variables:
# Point to your remote AMS endpoints
AMS_ENDPOINT=https://amsapi.yourdomain.com
MCP_ENDPOINT=https://amsmcp.yourdomain.com
# Auth token (required for protected AMS servers)
AMS_AUTH_TOKEN=your_auth_token_here
The auth token is always read from environment variables for security and is never stored in config files. Running devmemory config set ams_auth_token <value> will be rejected - you must use the AMS_AUTH_TOKEN environment variable.
๐งโ๐ป Contributing
Contributions, bug reports, and wild feature ideas are very welcome. ๐
See CONTRIBUTING.md for details on running the stack, tests, and linting.
If you build something cool with DevMemory, please open an issue or PR and show it off. โจ
โญ๏ธ Supporting the Project
If DevMemory helps you or your team:
- Star the repo on GitHub โญ
- Tell your AIโobsessed friends
- Open issues with realโworld workflows youโd like memory support for
Happy shipping โ and may your agents never forget another architecture decision again. ๐ง ๐ฆ๐
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devmemory-0.1.15.tar.gz.
File metadata
- Download URL: devmemory-0.1.15.tar.gz
- Upload date:
- Size: 9.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a96f3c00a9626a8c1acf77752ac09f4bf63cd65831e679a289e98c3937b23429
|
|
| MD5 |
7d89ef6bc656232b81a7a06d36f35448
|
|
| BLAKE2b-256 |
915777bcafe6acfca5c8ad0449fe8ef0e40f6afae7577196adea6c06d5acdc76
|
File details
Details for the file devmemory-0.1.15-py3-none-any.whl.
File metadata
- Download URL: devmemory-0.1.15-py3-none-any.whl
- Upload date:
- Size: 74.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73741f756b0d0a2abcbdd22bd1b5665dc3afcb32e4bbd0ee707389a4ca926b27
|
|
| MD5 |
6785b422f3045e74aa307eb6fde0caf3
|
|
| BLAKE2b-256 |
0ec27cbdb063b55f8cc011ea1551429eed09c89cebd10f583a098677d6d4d0dd
|