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.


๐Ÿช 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


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.9.tar.gz (9.6 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.9-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

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

Hashes for devmemory-0.1.9.tar.gz
Algorithm Hash digest
SHA256 3c3b5018b6e9a7b08f7bdab1eff44639d7e2d9058f1d406cb3c90e16b80c2dce
MD5 07f8cbb91f33225063e9c62ae75cf04b
BLAKE2b-256 c2d611233220d5ff74bcb583355d6c252fc2ee369456ac646856f33ff3238472

See more details on using hashes here.

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

Hashes for devmemory-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d2de95bb92e46bd2f517b5fdd3823413d58bce9e8c02a8bc842c93d14d14f687
MD5 d55508e3cde8cf318865c50b75135b1a
BLAKE2b-256 d37e0c953250476e4dba8421a0b16ff0cb4f9b90693b69326adceda8c41a13ae

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