Skip to main content
Glama

repo-memory

Shared, git-tracked working memory for AI agents that share a codebase. What one Claude / Cursor / Cline learns about your repo, the next one picks up automatically. No database. No SaaS. Just files in your repo.

PyPI Python MCP License: MIT


The problem

Every AI session that touches your repo starts from zero. It re-greps the same files. It re-discovers the same conventions. It re-asks the same questions you already answered three sessions ago. Multi-user / multi-tool makes it worse: your teammate's Cursor and your Claude Code learn the same codebase independently.

There is CLAUDE.md / .cursorrules for rules the human writes. But there is nothing for facts an agent verified — "the auth middleware lives at src/auth/middleware.py:42", "PR #387 chose httpx over requests because of HTTP/2", "don't run migrations during peak hours".

repo-memory is that nothing. A .ai-memory/ directory you commit to your repo. Every AI tool reads from it, writes to it. Git is the database.


Related MCP server: cortexmem

Layout

your-repo/
├── .ai-memory/
│   ├── README.md           # explains the convention
│   ├── facts.jsonl         # append-only structured facts with evidence
│   ├── decisions/          # one markdown per non-trivial decision
│   │   └── 2026-05-19-pick-httpx.md
│   └── gotchas.md          # one-line "watch out for X" notes
├── src/
└── README.md

Pure files. Sync over git. No daemon, no DB, no auth. Works offline.


Install

pip install repo-memory-mcp
# or
uvx repo-memory-mcp --help

Python ≥3.10. Depends only on the official mcp SDK (for the MCP server).


Quick start

cd your-repo
repo-memory init                              # creates .ai-memory/ + adds CLAUDE.md hint
repo-memory add-fact "Auth middleware lives in src/auth/middleware.py" \
                     --file src/auth/middleware.py --lines 42-180 --tool grep
repo-memory add-decision "Use httpx not requests" \
                         --body "HTTP/2 + async support; we already use anyio."
repo-memory add-gotcha "Don't run migrations during 9-11am UTC peak"

repo-memory show                              # render everything as Markdown
repo-memory list-facts --tag auth

Then commit .ai-memory/ like any other file:

git add .ai-memory/
git commit -m "memory: record auth middleware location + httpx decision"
git push

Anyone else (human or AI) who pulls the repo now sees those facts/decisions immediately.


LLM & AI Agent Readable Specification

For agents discovering this repo through search or MCP indexing.

Identity

  • name: repo-memory

  • purpose: read/write a structured, git-tracked memory store about the current codebase so multiple AI agents (and humans) don't re-learn it.

  • transport: CLI (repo-memory) and MCP stdio (repo-memory-mcp).

  • storage: plain files under .ai-memory/ in the repo. Sync = git.

When to call which tool

Tool

When

get_repo_memory

At the start of any task on this repo.

add_fact

After you verify a non-obvious fact (location, behavior, convention). Include evidence so the next agent can re-verify cheaply.

add_decision

After a non-trivial choice (architecture, library, trade-off). Body should explain why, not just what.

add_gotcha

After a surprise that wasted your time.

list_facts

When you want only facts in a specific area (tag, source_file).

1. agent.call("get_repo_memory")            -> absorb prior context
2. ...do task, run tools, verify things...
3. agent.call("add_fact", claim, evidence)  -> for each new fact
4. agent.call("add_decision", title, body)  -> if a choice was made
5. session ends, human commits .ai-memory/   -> shared via git

MCP server install

Add to your client config (Claude Desktop / Cursor / Cline):

{
  "mcpServers": {
    "repo-memory": {
      "command": "uvx",
      "args": ["repo-memory-mcp", "--repo", "/abs/path/to/the/repo"]
    }
  }
}

Or set REPO_MEMORY_ROOT env var instead of --repo.

Exposes 5 tools: get_repo_memory, add_fact, list_facts, add_decision, add_gotcha.


Why git, not a database

  • Zero infra. No service to host, no account to create, no API key to rotate.

  • Already authoritative. Git history is the single source of truth. git blame tells you which agent added which fact and when.

  • Works offline. Plane, train, conference WiFi — all fine.

  • PR review. Suspicious or wrong facts get filtered through normal code review.

  • Per-repo scope. A fact about repo A doesn't leak into repo B; the store is local to the repo.


Schema (for tooling authors)

facts.jsonl — one JSON object per line:

{
  "id": "abc123def456",
  "ts": "2026-05-19T18:00:00Z",
  "claim": "Auth middleware lives in src/auth/middleware.py",
  "evidence": {
    "file": "src/auth/middleware.py",
    "lines": "42-180",
    "tool": "grep",
    "command": "rg 'def authenticate' src/",
    "verified_at": "2026-05-19T18:00:00Z"
  },
  "tags": ["auth"],
  "added_by": "claude-opus-4.7"
}

Append-only. Stale entries stay. Readers consult verified_at and re-verify if they want.


Automatic discovery hint

repo-memory init also appends a short discoverability section to your repo's CLAUDE.md (or AGENTS.md if you already have one) telling any AI agent that enters the repo to check .ai-memory/ first and to record new findings back into it. Idempotent — re-running won't duplicate.

Opt out with --no-claude-md.

The appended block is delimited by <!-- BEGIN: repo-memory --> and <!-- END: repo-memory -->, so you can hand-edit other parts of your CLAUDE.md freely.


CLI reference

Command

Effect

repo-memory init [--no-claude-md]

Create .ai-memory/ skeleton + (default) update CLAUDE.md/AGENTS.md.

repo-memory show [--limit N]

Print everything as one Markdown doc.

repo-memory add-fact "<claim>" [--file F --lines L --tool T --command C --tag T --by AGENT]

Append a fact.

repo-memory list-facts [--tag T] [--source-file F] [--since ISO] [--limit N] [--json]

List/filter facts.

repo-memory add-decision "<title>" [--body MD]

Write a decision file.

repo-memory list-decisions

List decision file paths.

repo-memory add-gotcha "<note>"

Append a one-line gotcha.

All commands take --root PATH if your CWD isn't the repo root.


About the author

Built by yubinkim444, who also makes Kay's Records — an app for iOS and Android.

If this project saved you time, giving the app a try is the nicest way to say thanks.

License

MIT © yubinkim444

Available Tools

5 tools
add_decisionB

Record a non-trivial decision made while working in this repo (architecture choice, trade-off, deprecation, etc.) as a markdown file under .ai-memory/decisions/.

Args: title: one-line headline of the decision. body: full markdown explanation — context, options considered, reasoning, who/when.

ParametersJSON Schema
NameRequiredDescriptionDefault
titleYes
bodyNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description only states the basic action of recording a file. It does not disclose behaviors like overwrite policy, directory creation, permissions, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a front-loaded main sentence and a separate Args section. It wastes no words, though the Args could be integrated more tightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and an output schema, the description provides the core purpose and parameter usage but lacks details on return behavior, file naming, or whether it appends/overwrites. Adequate but with clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description compensates by explaining the title as 'one-line headline' and body as 'full markdown explanation' with content guidance. This adds significant meaning beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool records non-trivial decisions as markdown files in a specific directory, with examples of what qualifies. This distinguishes it from sibling tools like add_fact and add_gotcha.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives like add_fact or add_gotcha. The description implies usage for decisions but lacks when-not-to-use criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

add_factA

Record a structured fact you just verified about this codebase, so the next agent (or your next session) doesn't have to re-verify it.

Args: claim: the factual statement (one sentence). file: source file path (relative to repo root) that proves the claim. lines: line range like '42' or '42-50'. tool: name of tool used to verify ('grep', 'read', 'bash', etc.). command: exact command if reproducible. tags: optional tags for later filtering.

ParametersJSON Schema
NameRequiredDescriptionDefault
claimYes
fileNo
linesNo
toolNo
commandNo
tagsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the burden. It explains parameters but does not disclose persistence characteristics, side effects, or return values. The existence of an output schema is not acknowledged.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is informative with a structured Args section, but it is somewhat verbose. Every sentence adds value, but brevity could be improved without losing clarity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a logging tool with 6 parameters and no annotations, the description covers purpose and parameter usage well. However, it does not describe the output schema (which exists), leaving a gap in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description provides detailed explanations for all 6 parameters (e.g., 'claim: the factual statement (one sentence)', 'file: source file path relative to repo root'). This adds significant meaning beyond the schema titles.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Record a structured fact'), the resource ('about this codebase'), and the purpose ('so the next agent doesn't have to re-verify it'). It distinguishes from siblings like add_decision and add_gotcha by emphasizing facts that are verified.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage after verification ('fact you just verified') but lacks explicit guidance on when not to use or how it compares to alternatives. No direct contrast with siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

add_gotchaA

Append a one-line 'watch out for X' note to .ai-memory/gotchas.md. Use for surprises that wasted your time and might trip the next agent.

ParametersJSON Schema
NameRequiredDescriptionDefault
noteYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description bears full responsibility for behavioral disclosure. It conveys the append action and file path but omits important details like side effects (e.g., file creation if missing), error behavior, or permissions needed. This is minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. The first sentence immediately states the action and file location; the second provides usage context. Highly efficient and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple append tool with one parameter, the description covers the essential aspects: action, target, content format, and usage scenario. An output schema exists, so return values need not be detailed. A minor improvement would be noting if the file is created automatically.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The sole parameter `note` lacks description in the schema (0% coverage). The description adds value by specifying it is a 'one-line' note and the expected content ('watch out for X'), compensating for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description specifies the action (append a one-line note), the target resource (`.ai-memory/gotchas.md`), and the type of content ('watch out for X'), clearly distinguishing it from sibling tools like `add_decision` and `add_fact`.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use: 'for surprises that wasted your time and might trip the next agent.' It provides clear context for usage but does not explicitly mention when not to use or list alternatives, which is acceptable given the sibling list.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_repo_memoryA

Return the entire .ai-memory/ of the current repo as a Markdown document ready to drop into your LLM context. Call this before starting any task in this repo so you don't redo work other agents already verified.

Args: fact_limit: cap on number of facts (default 50, most recent first).

ParametersJSON Schema
NameRequiredDescriptionDefault
fact_limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, but description explains it returns a Markdown document, the effect of fact_limit (cap, most recent first), and implies read-only. Could mention prerequisite or error cases.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short paragraphs: first front-loads purpose and usage, second explains parameter. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple read tool with one optional param and output schema. Could mention error handling or if memory missing, but not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but description adds 'most recent first' ordering and explains cap, which goes beyond schema properties.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states it returns the entire .ai-memory/ as Markdown, and distinguishes from sibling add_*/list_facts tools by specifying it should be called before tasks to avoid rework.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says 'Call this **before** starting any task' and explains why. While it doesn't list alternatives, the context of sibling tools makes the usage context clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_factsA

List recorded facts, optionally filtered. Useful when you want only facts relevant to a specific area before reading them.

ParametersJSON Schema
NameRequiredDescriptionDefault
tagNo
source_fileNo
sinceNo
limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must convey behavior. It indicates a read operation ('List') with optional filtering, but does not disclose pagination, ordering, or any side effects. Given the simplicity, a score of 3 is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no extraneous information. The purpose is immediately stated, and the usage hint is brief. Perfect conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description lacks details on filter parameters and return structure. For a tool with four optional parameters, the description is insufficient for an agent to correctly construct calls without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description should compensate by explaining parameters. It only says 'optionally filtered' but does not mention 'tag', 'source_file', 'since', or 'limit', leaving the agent without guidance on how to use filters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states 'List recorded facts', clearly identifying the action and resource. It distinguishes from sibling tools like 'add_fact' and 'add_decision' which are write operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear use case: 'Useful when you want only facts relevant to a specific area before reading them.' It implies filtering but does not specify when not to use or alternatives, though the context is adequate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A4/5.0
Disambiguation5/5

Each tool has a distinct purpose: recording decisions, facts, gotchas, retrieving all memory, or listing facts. No overlapping functionality.

Naming Consistency5/5

All tools follow a consistent verb_noun snake_case pattern (add_decision, add_fact, add_gotcha, get_repo_memory, list_facts).

Tool Count5/5

Five tools is well-scoped for a memory server covering add and retrieve operations without excess or insufficiency.

Completeness4/5

Covers adding and retrieving decisions, facts, and gotchas. However, lacks update or delete functionality, which would be useful for managing memory.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Exposes a repo's historical engineering memory (decisions, landmines, guardrails) via MCP tools for AI coding agents.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides a local-first, source-cited memory layer for AI agents, with MCP tools to search, read, explain sources, and propose/apply memory updates.
    52
    3
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yubinkim444/repo-memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server