Sync AI coding context from Git AI to Redis Agent Memory Server for semantic search and recall.
Project description
DevMemory ๐๐ง
TL;DR: DevMemory is a longโterm memory for your AI coding agents.
It remembers why code was written, how it changed, and what your team learned โ then feeds that back into your agents. No more โreinvent the bugโ speedruns. ๐๐ฅ
Built on Git AI for silent capture and Redis Agent Memory Server for semantic search and recall.
๐ก What DevMemory Does (in human terms)
- ๐ช Hooks into your git workflow via Git AI notes
- ๐งฌ Extracts rich memories:
- Commit summaries (who, what, why, which agent/model, how much AI)
- Perโfile code snippets
- Promptโlevel context with acceptance metrics
- ๐ง Stores everything in Redis AMS as semantic vectors
- ๐ Lets you ask:
โHow do we handle auth?โ โ it searches, then LLMโsynthesizes an actual answer with sources - ๐งพ Ships a knowledge protocol:
.devmemory/knowledge/*.md+ CLI + Cursor rules so humans and agents keep the docs alive together
If Entire saves how agents worked and Git AI tracks who wrote which line, DevMemory is the part that answers โOkay, but what did we actually learn?โ.
๐งฎ How It Works
Developer commits code
โ
โผ
Git AI captures AI attribution, prompts, agent/model info
โ
โผ
DevMemory syncs enriched memories to Redis AMS (automatic via post-commit hook)
โ
โโโบ Semantic search via CLI (with LLM-synthesized answers)
โโโบ MCP recall in Cursor IDE (agents search memory before coding)
โโโบ Context briefing auto-generated on branch switch
The knowledge loop:
- Capture โ Git AI silently records AI code attribution, prompts, and agent/model info on every commit
- Enrich โ DevMemory extracts three layers per commit: enriched summary, perโfile code snapshots, and promptโlevel context with acceptance metrics
- Search โ Semantic vector search with LLMโpowered answer synthesis (RAG over your git history)
- Recall โ Cursor agents read memory via MCP before writing code, and persist new decisions after
- Learn โ Humanโcurated knowledge files (
.devmemory/knowledge/*.md) feed the same store, capturing architecture decisions and gotchas
๐งต Think of it as
git log+ โwhat we should have written in the ADRโ + your AI agents actually reading it.
๐ฅ Demo (what it feels like)
Imagine:
devmemory status # โ
Stack + hooks look good
git commit -am "feat: add user auth" # You used an AI agent heavily
# Normally the post-commit hook runs this for you in the background:
# (sleep 2 && devmemory sync --latest 2>/dev/null) &
# but you can also trigger it manually:
devmemory sync --latest
devmemory search "how do we handle auth in this service?"
You get:
- A concise answer synthesized by the LLM (RAG), describing:
- Which files implement auth
- Which agent/model was used
- Key decisions (e.g., why JWT vs sessions)
- A Sources table listing:
- Commit summaries
- Relevant perโfile code snippets
- The original prompts that drove the changes
Sample search result:
$ devmemory search "why we use redis memory server instead of other databases?"
Searching for: why we use redis memory server instead of other databases?
Synthesizing answer...
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Answer โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ Short answer: because Redis Agent Memory Server (AMS) already provides the exact semantic-memory features we need (embeddings, โ
โ topic extraction, NER, deduplication) while being battleโtested infra, so it reduces operational complexity and keeps the CLI โ
โ lightweight. โ
โ โ
โ Details / evidence from the repo: โ
โ โ
โ โข AMS handles embeddings, topic extraction and NER internally and provides builtโin memory deduplication (see โ
โ .devmemory/knowledge/architecture.md, commit b0abbb04ad13). โ
โ โข The same AMS image serves both REST (port 8000) and MCP (port 9050) endpoints used by the CLI (see docker-compose.yml and โ
โ ams_client.py; feature enable commit f025d01e107c). โ
โ โข README and ams_client.py show we store semantic vectors in Redis AMS and call its /v1/long-term-memory APIs, avoiding the need โ
โ to run a separate vector DB (README.md commit 2b7602a5318a and devmemory/core/ams_client.py). โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Sources (10 relevant, 20 filtered out)
# Score Type Source
1 0.302 semantic Why Redis Agent Memory Server
2 0.614 semantic Memory Types and Their Purpose
3 0.613 semantic feat: enable devmemory CLI with redis AMS and git-ai (f025d01e107c)
4 0.641 semantic feat: add more metadata from the session to the memory (4ccf7529bd4e)
5 0.671 semantic fix: use the --quite to show the one line update (139d559bdaa0)
6 0.677 semantic Fix: terminal hang issue and the correct saved memories coun (daf56666f1f1)
7 0.512 episodic .devmemory/knowledge/architecture.md (b0abbb04ad13)
8 0.550 episodic devmemory/core/ams_client.py (f025d01e107c)
9 0.588 episodic README.md (2b7602a5318a)
10 0.561 episodic docker-compose.yml (f025d01e107c)
Auto-sync example:
๐ Quick Start
Prerequisites
- Git
- Docker + 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 Docker / Python / Git AI and verifies the Docker daemon is running
- Installs uv if not present, then installs the
devmemoryCLI viauv tool install - Sets up
.envfrom.env.example - Starts Redis + AMS + MCP via Docker
- Configures git hooks + Cursor MCP + agent rules in the current repo
Manual Setup
git clone https://github.com/devmemory/devmemory
cd devmemory
# Set up environment
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
# Start the stack
make up
# Install the CLI (requires uv: https://docs.astral.sh/uv/)
uv tool install --editable .
# Set up hooks, MCP config, and Cursor rules in your project
cd /path/to/your/project
devmemory install
# Check everything works
devmemory status
โจ๏ธ CLI Commands
Core workflow ๐ง
devmemory sync # Sync unsynced Git AI commits to Redis
devmemory sync --latest # Sync only the latest commit
devmemory sync --all # Re-sync all commits
devmemory sync --dry-run # Preview what would be synced
devmemory search "how do we auth" # Semantic search with LLM-synthesized answer
devmemory search "auth" -n 5 # Limit results
devmemory search "auth" --raw # Raw results without LLM synthesis
devmemory status # Show system health, sync state, hooks
Code archaeology ๐
devmemory why src/auth.py # Explain why a file exists and how it evolved
devmemory why src/auth.py login # Focus on a specific function or class
devmemory why src/auth.py --raw # Show raw memories and git history without synthesis
Knowledge management ๐
devmemory add "We chose Redis over Postgres for vector search because..." --topic architecture
devmemory add --interactive # Interactive mode with prompts
devmemory learn # Sync .devmemory/knowledge/*.md into memory store
devmemory learn --dry-run # Preview what would be synced
devmemory context # Generate .devmemory/CONTEXT.md from git state + memory
Setup and config โ๏ธ
devmemory install # Set up git hooks + Cursor MCP + agent rules
devmemory install --skip-hook # Skip hook installation
devmemory install --skip-rule # Skip Cursor agent rules
devmemory config show # Show current config
devmemory config set endpoint URL # Change AMS endpoint
devmemory config reset # Reset to defaults
๐ 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 sets up three things for Cursor:
- MCP server config (
~/.cursor/mcp.json) โ Agents can search and write to the memory store via MCP tools (search_long_term_memory,create_long_term_memories, etc.) - Agent behavior rules (
.cursor/rules/devmemory.mdc) โ Instructs agents to search memory before coding, persist decisions after significant work, and maintain knowledge files - Context rule (
.cursor/rules/devmemory-context.mdc) โ Agents read.devmemory/CONTEXT.mdat task start for a preโbuilt briefing
The result is a compounding loop: each agent session makes the next one smarter.
Your AI stops acting like a goldfish and starts acting like a teammate. ๐ โก๏ธ๐งโ๐ป
๐ช 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.6.tar.gz.
File metadata
- Download URL: devmemory-0.1.6.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 |
ce91ddde003b382c4cf36b05de9a8e6d61c8dda9c29853b48da09b3a816c1a19
|
|
| MD5 |
d51460e3d1c295220682612b4c2d5376
|
|
| BLAKE2b-256 |
4c95d69a5ed52d14474646d42cdc450137e17fc1ca2eb4150d3e841016245d74
|
File details
Details for the file devmemory-0.1.6-py3-none-any.whl.
File metadata
- Download URL: devmemory-0.1.6-py3-none-any.whl
- Upload date:
- Size: 51.3 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 |
8b3d1595d9f36ca806d39164101e91a74bd6267da3eaf97bdc98ed839aab7b56
|
|
| MD5 |
c36937418f4c8e166c40dae1c55d1a9a
|
|
| BLAKE2b-256 |
b3ccffdab7e7aa0406bccf1f21d4c7c90bb3ce9adfa36db91360abf100e35a48
|