Skip to main content

Sync AI coding context from Git AI to Redis Agent Memory Server for semantic search and recall.

Project description

DevMemory ๐Ÿง ๐Ÿš€

CI PyPI License: MIT

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 why for 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:

  1. Use MCP tools like search_long_term_memory to pull in recent and relevant memories instead of asking the LLM to rediscover context from raw code.
  2. Call create_long_term_memories at the end of a task to store what changed and why, so future sessions start with that knowledge.
  3. Read .devmemory/CONTEXT.md on 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

๐Ÿง‘โ€๐Ÿ’ป 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

devmemory-0.1.12.tar.gz (9.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

devmemory-0.1.12-py3-none-any.whl (70.7 kB view details)

Uploaded Python 3

File details

Details for the file devmemory-0.1.12.tar.gz.

File metadata

  • Download URL: devmemory-0.1.12.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

Hashes for devmemory-0.1.12.tar.gz
Algorithm Hash digest
SHA256 e2c1e5916e4385a370b91c5b8d560a492fa69615340221147df590f8035c7ffa
MD5 4424a9693c12d3e97f3669860c8806f9
BLAKE2b-256 f93534ea4c7ef4efcefca52b18bc2c2213408c974c0178b8a4d3c76ead477de9

See more details on using hashes here.

File details

Details for the file devmemory-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: devmemory-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 70.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for devmemory-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8003f3d33a311c9fa6cf3fd365f45ea62711cef23d407d3510bc9c1056826a2f
MD5 7ac3d0735d2dcadbbcd137c0010ddefa
BLAKE2b-256 46db77a23ec259a5708bad12b688aae94fc5c47448cfa93844d955e011254f0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page