grpcer/ownmem

Open-source, Git-native memory for AI coding agents — deterministic local recall for Claude Code, Codex, Cursor, Gemini CLI, and compatible tools.

JavaScript

414

34 commits

updated Sep 22, 2026

See the code

README

OwnMem

Git-native memory for AI coding agents

Open-source project memory for Claude Code, Codex, Cursor, Gemini CLI, and other AI coding agents — local, deterministic, reviewable, and never written behind your back.

npm version npm downloads GitHub stars release gates node >= 20.6 license Apache-2.0

English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Español · Français · Deutsch · Português (BR)

✨ Why OwnMem

Most AI agent memory systems optimize for remembering more. OwnMem starts with a different question: who owns project knowledge, who may change it, and how can a bad memory be stopped before it changes a coding agent's actions?

AdvantageWhat it means in practice
The repository owns memoryReadable Markdown in .ownmem/ travels through clone, review, and rollback with the code, and every agent in the repository reads the same source.
Deterministic local recallDefault recall makes no model or network call; the same query, config, and snapshot produce the same ranking.
Evidence before authorityContent cannot declare itself trusted. Independent receipts and live evidence checks decide delivery.
It tells you when it does not knowDelivery is graded: the memory quoted, up to three pointers, or an abstention that names the gate that refused.
Net-zero growthA hard entry count that only ratchets down, so adding to a full corpus means retiring something in the same change.
OwnMem public benchmark: Recall@1 of 100% on 128 queries in 40 languages, against 3.9% for grep -F on the same corpus; recall latency of 0.46 ms at P50 and 1.05 ms at P95 over 4,200 samples, under a 5 ms release gate; MRR 1.000, all 40 unrelated queries abstained, no model or network calls, two runtime dependencies.

Measured on the locked CC0 corpus in this repository. Reproduce it in a clone with npm run benchmark.

🆚 How it compares

OwnMem does not replace CLAUDE.md or AGENTS.md. Those files say how to work here, and they are read in full every turn. OwnMem answers a different question — which of the things this project learned the hard way are worth putting in front of the model for this task — and it is allowed to answer “none of them”.

Instruction filesBuilt-in agent memoryOwnMem
Who writes ityou, by handthe agent, from your conversationsyou, reviewed like code
Where it livesone file in the repositorythe vendor's accountMarkdown in your repository
What reaches the modelall of it, every turnwhatever its own recall pickedone of three tiers, under a token budget
When an entry is wrongyou edit the fileyou may never see the entryevidence drift downgrades it and names what moved
Cost per turnthe whole file in tokensa retrieval callno model call, no network call

🚀 Quick start

Requires Node.js 20.6 or newer. Run this inside the repository that should own the memory:

npm install --save-dev ownmem
npx ownmem init --hook --hosts claude,codex

Reopen the agent afterwards. Name the hosts you use in --hosts (claude, codex, cursor, gemini, grok); the list is recorded, and passing it again later is how a host is added or removed. init creates .ownmem/ and the host adapters, edits instruction files such as CLAUDE.md only inside managed blocks, and prints any one-time step a host still needs. Add --check to the same command to preview it, and --locale auto to write the generated instructions in your system language.

HostHow recall happensSetup
Claude CodeA hook before every Edit and Write, and on requestclaude
CodexA hook before every patch it applies, and on requestcodex; the hooks need three one-time trust steps, which init prints
Grok CLIReads Claude Code's hook configuration through its compatibility layergrok, alongside claude if you use both; trust the folder once with /hooks-trust
CursorAn always-applied rule, or the MCP servercursor; the MCP server takes one manual step, see Plugins
Gemini CLIInstructions, or the MCP servergemini; the MCP server takes one manual step, see Plugins

⚠️ Upgrading from 0.6.0? Update the package with npm install --save-dev ownmem@latest, then run npx ownmem init --update before anything else. 0.6.0 installed hooks whose subcommands no longer exist, so an installation that keeps them runs a failing command on every Bash call. The update removes them and never touches hooks you wrote yourself. Updating covers the rest, including the core.hooksPath cleanup.

💬 Daily use

Keep working in plain language. Your agent drafts a memory when you ask for one, and you review it like code:

“Remember this: staging deployment timeouts come from the pool cap, not too few workers. Check both together next time.”

“Before changing this, check whether the project memory has seen the same failure.”

Recall answers in one of three tiers: the memory quoted, up to three pointers to go and read, or an abstention. A real run:

$ npx ownmem recall -- "staging deploy timed out again, should I add more workers?"
== staging deploy timed out again, should I add more workers? ==
  staging_timeout_pool_cap  [score=0.875 lanes=exact,bm25f,ngram fields=body,codePath,description,hooks,name,triggers]
      matched deploy,more,out,staging,staging deploy timed out,timed
      trust advisory authority · lifecycle advisory (not fully verified)
        Treat it as a lead to re-check against the code, not as an established fact.
      excerpt(body) **Why**: `DB_POOL_MAX` is 10 on staging. Adding workers only queues more requests behind the same ten connections, so the deploy health check times out sooner, not later.
      file .ownmem/staging_timeout_pool_cap.md

Trust is stated, not implied. Nothing backs this entry yet — no review has confirmed it, and it cites no authority document or code anchor — so it arrives as a lead to re-check rather than as an established fact.

The commands you will reach for yourself:

npx ownmem new staging_timeout_pool_cap   # scaffold one memory that already passes every gate
npx ownmem report --since 7d              # used? fast enough? right? what to do next
npx ownmem dashboard --open               # open the local console
npx ownmem mcp                            # serve recall and read to any MCP host over stdio
The OwnMem local console: the known false-delivery residual as the headline figure, the lookup funnel beside it, corpus and evidence health below, and navigation for performance, quality, governance, and semantic retrieval.

ownmem mcp exists for hosts without hooks. It exposes exactly two tools, recall and read, and neither can change a memory; the gate commands (audit, trust, compile) and every memory write stay off that surface. Plugins shows how to register it so it runs the project's own copy.

🧩 How it works

OwnMem architecture: repository-owned Markdown and independent trust receipts compile into immutable snapshots; deterministic local recall passes four delivery gates and arrives in one of three tiers — the memory quoted, up to three pointers, or an abstention that names its reason — while local feedback ledgers, an evaluation harness and a net-zero quota bound what the corpus becomes.
  • Repository source of truth. L1 routing, L2 area indexes, and L3 topics remain reviewable Markdown; trust receipts live outside the text they authorize.
  • Compile, then recall. Schema, graph, lifecycle, and evidence gates produce a content-addressed immutable snapshot. Five deterministic lanes — exact, BM25F, n-gram, fuzzy, and graph — are fused locally; embeddings are an optional sixth lane at weight 0 until local A/B evidence passes.
  • Four gates, three tiers. Relevance, epistemic validity, task applicability, and action risk each refuse on their own grounds. Above a threshold read off an ablation curve the memory is quoted; below it come up to three pointers that are explicitly not answers; with nothing qualified, an abstention that names the gate that refused.
  • No unattended writes. There is no coordinator, no promotion, and no candidate queue. The package measures, proposes, and refuses; every change to memory is a commit somebody makes, and no ranking change lands without the evaluation harness.

Mechanisms, threat model, and research mapping: Technical design.

🔒 Privacy and boundaries

  • Local by default. Ranking reads repository files and local snapshots only: no LLM call, no network request, no retrieval API bill. Delivered excerpts still use the agent's context window, capped by the configured budget.
  • Telemetry stays on the machine. Runtime events live in a Git-ignored directory and expire after thirty days. The daily pass (ownmem daily) reduces each finished day to a counted package with no query text, topic bodies, or file paths. Missing samples show as unavailable, never as 0%.
  • Retrieved text is data. It cannot override host instructions or authorize a tool, and an agent's self-attribution never counts as user confirmation.
  • Failures are visible. An entry with unsigned content or an unverifiable evidence target is withheld; evidence drift downgrades it to advisory and names what moved.
  • Keep secrets out. Secrets and personal or production data that do not belong in Git do not belong in memory.

🧭 When to use it

Good fitChoose another system when
A team wants project knowledge reviewed and migrated with code.You need a cross-repository personal profile or global user memory.
Several coding agents rotate through one repository.You need to capture every conversation automatically with no evidence or risk boundary.
Local, reproducible recall with no retrieval API bill matters.You need large-scale cloud vector search or a real-time global knowledge graph.
Bad memory must be attributable, rejectable, and reversible.Maximum recall volume matters more than governance.

📚 Documentation

DocumentPurpose
ArchitecturePackage boundaries, snapshots, trust, and delivery
Technical designMechanisms, threat model, and research mapping
PluginsPer-host setup, plugins, and trust steps
UpdatingSafe repository updates and version migrations
PrivacyLocal data and optional channel boundaries
ChangelogVersion history
ContributingReporting issues and sending changes
SecurityReporting a vulnerability
LicenseApache-2.0
Research lineage

OwnMem does not claim these foundations as inventions. Its contribution is their composition into an executable protocol for repository memory:

These citations describe the research lineage; they do not imply that the papers implement OwnMem or that OwnMem reproduces their experiments.

OwnMem is open source. Reproducible issues and pull requests are welcome.

agent-memory
ai-agent-memory
ai-memory
bm25
claude-code
claude-code-memory
codex
codex-memory
coding-agent-memory
coding-agents
cursor
cursor-memory
deterministic-retrieval
developer-tools
gemini-cli
gemini-cli-memory
git-native
llm-memory
local-first
project-memory

Contributors

grpcer

33 commits

grpcer/ownmem

Open-source, Git-native memory for AI coding agents — deterministic local recall for Claude Code, Codex, Cursor, Gemini CLI, and compatible tools.

JavaScript

414

34 commits

updated Sep 22, 2026

See the code

README

OwnMem

Git-native memory for AI coding agents

Open-source project memory for Claude Code, Codex, Cursor, Gemini CLI, and other AI coding agents — local, deterministic, reviewable, and never written behind your back.

npm version npm downloads GitHub stars release gates node >= 20.6 license Apache-2.0

English · 简体中文 · 繁體中文 · 日本語 · 한국어 · Español · Français · Deutsch · Português (BR)

✨ Why OwnMem

Most AI agent memory systems optimize for remembering more. OwnMem starts with a different question: who owns project knowledge, who may change it, and how can a bad memory be stopped before it changes a coding agent's actions?

AdvantageWhat it means in practice
The repository owns memoryReadable Markdown in .ownmem/ travels through clone, review, and rollback with the code, and every agent in the repository reads the same source.
Deterministic local recallDefault recall makes no model or network call; the same query, config, and snapshot produce the same ranking.
Evidence before authorityContent cannot declare itself trusted. Independent receipts and live evidence checks decide delivery.
It tells you when it does not knowDelivery is graded: the memory quoted, up to three pointers, or an abstention that names the gate that refused.
Net-zero growthA hard entry count that only ratchets down, so adding to a full corpus means retiring something in the same change.
OwnMem public benchmark: Recall@1 of 100% on 128 queries in 40 languages, against 3.9% for grep -F on the same corpus; recall latency of 0.46 ms at P50 and 1.05 ms at P95 over 4,200 samples, under a 5 ms release gate; MRR 1.000, all 40 unrelated queries abstained, no model or network calls, two runtime dependencies.

Measured on the locked CC0 corpus in this repository. Reproduce it in a clone with npm run benchmark.

🆚 How it compares

OwnMem does not replace CLAUDE.md or AGENTS.md. Those files say how to work here, and they are read in full every turn. OwnMem answers a different question — which of the things this project learned the hard way are worth putting in front of the model for this task — and it is allowed to answer “none of them”.

Instruction filesBuilt-in agent memoryOwnMem
Who writes ityou, by handthe agent, from your conversationsyou, reviewed like code
Where it livesone file in the repositorythe vendor's accountMarkdown in your repository
What reaches the modelall of it, every turnwhatever its own recall pickedone of three tiers, under a token budget
When an entry is wrongyou edit the fileyou may never see the entryevidence drift downgrades it and names what moved
Cost per turnthe whole file in tokensa retrieval callno model call, no network call

🚀 Quick start

Requires Node.js 20.6 or newer. Run this inside the repository that should own the memory:

npm install --save-dev ownmem
npx ownmem init --hook --hosts claude,codex

Reopen the agent afterwards. Name the hosts you use in --hosts (claude, codex, cursor, gemini, grok); the list is recorded, and passing it again later is how a host is added or removed. init creates .ownmem/ and the host adapters, edits instruction files such as CLAUDE.md only inside managed blocks, and prints any one-time step a host still needs. Add --check to the same command to preview it, and --locale auto to write the generated instructions in your system language.

HostHow recall happensSetup
Claude CodeA hook before every Edit and Write, and on requestclaude
CodexA hook before every patch it applies, and on requestcodex; the hooks need three one-time trust steps, which init prints
Grok CLIReads Claude Code's hook configuration through its compatibility layergrok, alongside claude if you use both; trust the folder once with /hooks-trust
CursorAn always-applied rule, or the MCP servercursor; the MCP server takes one manual step, see Plugins
Gemini CLIInstructions, or the MCP servergemini; the MCP server takes one manual step, see Plugins

⚠️ Upgrading from 0.6.0? Update the package with npm install --save-dev ownmem@latest, then run npx ownmem init --update before anything else. 0.6.0 installed hooks whose subcommands no longer exist, so an installation that keeps them runs a failing command on every Bash call. The update removes them and never touches hooks you wrote yourself. Updating covers the rest, including the core.hooksPath cleanup.

💬 Daily use

Keep working in plain language. Your agent drafts a memory when you ask for one, and you review it like code:

“Remember this: staging deployment timeouts come from the pool cap, not too few workers. Check both together next time.”

“Before changing this, check whether the project memory has seen the same failure.”

Recall answers in one of three tiers: the memory quoted, up to three pointers to go and read, or an abstention. A real run:

$ npx ownmem recall -- "staging deploy timed out again, should I add more workers?"
== staging deploy timed out again, should I add more workers? ==
  staging_timeout_pool_cap  [score=0.875 lanes=exact,bm25f,ngram fields=body,codePath,description,hooks,name,triggers]
      matched deploy,more,out,staging,staging deploy timed out,timed
      trust advisory authority · lifecycle advisory (not fully verified)
        Treat it as a lead to re-check against the code, not as an established fact.
      excerpt(body) **Why**: `DB_POOL_MAX` is 10 on staging. Adding workers only queues more requests behind the same ten connections, so the deploy health check times out sooner, not later.
      file .ownmem/staging_timeout_pool_cap.md

Trust is stated, not implied. Nothing backs this entry yet — no review has confirmed it, and it cites no authority document or code anchor — so it arrives as a lead to re-check rather than as an established fact.

The commands you will reach for yourself:

npx ownmem new staging_timeout_pool_cap   # scaffold one memory that already passes every gate
npx ownmem report --since 7d              # used? fast enough? right? what to do next
npx ownmem dashboard --open               # open the local console
npx ownmem mcp                            # serve recall and read to any MCP host over stdio
The OwnMem local console: the known false-delivery residual as the headline figure, the lookup funnel beside it, corpus and evidence health below, and navigation for performance, quality, governance, and semantic retrieval.

ownmem mcp exists for hosts without hooks. It exposes exactly two tools, recall and read, and neither can change a memory; the gate commands (audit, trust, compile) and every memory write stay off that surface. Plugins shows how to register it so it runs the project's own copy.

🧩 How it works

OwnMem architecture: repository-owned Markdown and independent trust receipts compile into immutable snapshots; deterministic local recall passes four delivery gates and arrives in one of three tiers — the memory quoted, up to three pointers, or an abstention that names its reason — while local feedback ledgers, an evaluation harness and a net-zero quota bound what the corpus becomes.
  • Repository source of truth. L1 routing, L2 area indexes, and L3 topics remain reviewable Markdown; trust receipts live outside the text they authorize.
  • Compile, then recall. Schema, graph, lifecycle, and evidence gates produce a content-addressed immutable snapshot. Five deterministic lanes — exact, BM25F, n-gram, fuzzy, and graph — are fused locally; embeddings are an optional sixth lane at weight 0 until local A/B evidence passes.
  • Four gates, three tiers. Relevance, epistemic validity, task applicability, and action risk each refuse on their own grounds. Above a threshold read off an ablation curve the memory is quoted; below it come up to three pointers that are explicitly not answers; with nothing qualified, an abstention that names the gate that refused.
  • No unattended writes. There is no coordinator, no promotion, and no candidate queue. The package measures, proposes, and refuses; every change to memory is a commit somebody makes, and no ranking change lands without the evaluation harness.

Mechanisms, threat model, and research mapping: Technical design.

🔒 Privacy and boundaries

  • Local by default. Ranking reads repository files and local snapshots only: no LLM call, no network request, no retrieval API bill. Delivered excerpts still use the agent's context window, capped by the configured budget.
  • Telemetry stays on the machine. Runtime events live in a Git-ignored directory and expire after thirty days. The daily pass (ownmem daily) reduces each finished day to a counted package with no query text, topic bodies, or file paths. Missing samples show as unavailable, never as 0%.
  • Retrieved text is data. It cannot override host instructions or authorize a tool, and an agent's self-attribution never counts as user confirmation.
  • Failures are visible. An entry with unsigned content or an unverifiable evidence target is withheld; evidence drift downgrades it to advisory and names what moved.
  • Keep secrets out. Secrets and personal or production data that do not belong in Git do not belong in memory.

🧭 When to use it

Good fitChoose another system when
A team wants project knowledge reviewed and migrated with code.You need a cross-repository personal profile or global user memory.
Several coding agents rotate through one repository.You need to capture every conversation automatically with no evidence or risk boundary.
Local, reproducible recall with no retrieval API bill matters.You need large-scale cloud vector search or a real-time global knowledge graph.
Bad memory must be attributable, rejectable, and reversible.Maximum recall volume matters more than governance.

📚 Documentation

DocumentPurpose
ArchitecturePackage boundaries, snapshots, trust, and delivery
Technical designMechanisms, threat model, and research mapping
PluginsPer-host setup, plugins, and trust steps
UpdatingSafe repository updates and version migrations
PrivacyLocal data and optional channel boundaries
ChangelogVersion history
ContributingReporting issues and sending changes
SecurityReporting a vulnerability
LicenseApache-2.0
Research lineage

OwnMem does not claim these foundations as inventions. Its contribution is their composition into an executable protocol for repository memory:

These citations describe the research lineage; they do not imply that the papers implement OwnMem or that OwnMem reproduces their experiments.

OwnMem is open source. Reproducible issues and pull requests are welcome.

agent-memory
ai-agent-memory
ai-memory
bm25
claude-code
claude-code-memory
codex
codex-memory
coding-agent-memory
coding-agents
cursor
cursor-memory
deterministic-retrieval
developer-tools
gemini-cli
gemini-cli-memory
git-native
llm-memory
local-first
project-memory

Contributors

grpcer

33 commits

Languages

JavaScript

100.0%