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.
๐ช 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": ""
}
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 |
๐งโ๐ป 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.9.tar.gz.
File metadata
- Download URL: devmemory-0.1.9.tar.gz
- Upload date:
- Size: 9.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c3b5018b6e9a7b08f7bdab1eff44639d7e2d9058f1d406cb3c90e16b80c2dce
|
|
| MD5 |
07f8cbb91f33225063e9c62ae75cf04b
|
|
| BLAKE2b-256 |
c2d611233220d5ff74bcb583355d6c252fc2ee369456ac646856f33ff3238472
|
File details
Details for the file devmemory-0.1.9-py3-none-any.whl.
File metadata
- Download URL: devmemory-0.1.9-py3-none-any.whl
- Upload date:
- Size: 50.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 |
d2de95bb92e46bd2f517b5fdd3823413d58bce9e8c02a8bc842c93d14d14f687
|
|
| MD5 |
d55508e3cde8cf318865c50b75135b1a
|
|
| BLAKE2b-256 |
d37e0c953250476e4dba8421a0b16ff0cb4f9b90693b69326adceda8c41a13ae
|