mnem is Git for AI Agent Knowledge. A persistent, versioned knowledge layer for AI agents, with best-or-tied recall on every public benchmark we tested.
Drop in source code, PDFs, Markdown docs, conversation exports, or whole directories and mnem parses, chunks, and indexes them in one command. File types are auto-detected: heading-aware chunking for Markdown, function- and class-level parsing for source code across many languages, sliding-window extraction for PDFs. No LLM call at ingest, so the same input always produces the same graph; re-ingesting an unchanged file is a no-op.
Skills, decisions, and conventions live as nodes and typed edges in a queryable knowledge graph inside your project's .mnem/ directory. Commit it alongside your code and every teammate's agents start from the same baseline; branch, diff, merge, or roll back any write the same way you would source. Forgetting is first-class: revoke a fact and every retrieval path filters it out automatically, with the audit trail preserved.
Retrieval fuses vector, keyword, and graph traversal in a single pass and reports exactly how many tokens were spent and what was dropped at the budget; nothing gets silently truncated. Optional multi-hop graph expansion stitches answers together across linked documents.
One binary, no server, no external database, fully offline; the same engine runs as a CLI, an HTTP server, an MCP server, or a Python library, and in the browser via WebAssembly. Wire it into Claude Code, Cursor, Gemini CLI, or any MCP host with one command. Zero-config out of the box; swap the embedder provider in one line of config when you outgrow the default.
https://github.com/user-attachments/assets/bd744a7e-8e89-4531-bd96-fdee0030c390
- The Problem
- Benchmarks
- vs others
- Install
- Quickstart
- Integrate / Unintegrate
- Commands
- MCP Tools
- Python API
- GraphRAG
- What you get
- When NOT to use
- Docs
- Contributing
The Problem
Who this affects: If you use AI coding assistants (Claude Code, Cursor, Gemini CLI, etc.) or build software where an AI agent needs to remember things between sessions, this is the problem mnem solves.
Every session starts from zero.
- Sessions are isolated. Plan a migration in Claude Code (an AI coding assistant). Open Cursor (another AI coding assistant) tomorrow. That agent has never heard of it.
- Memory you can't inspect isn't memory. Something changed in your agent's context. You don't know what, when, or why. There's no log.
- Conventions rot in flat files. Six engineers, six
AGENTS.mdfiles (agent configuration files many AI tools read automatically) diverging in silence. No merge, no history, no way to tell which is current.
Your codebase has git. Your agent's knowledge doesn't.
Benchmarks
Measured head-to-head against mem0 and MemPalace on six public datasets. mnem leads on five‡†; ties MemPalace on LongMemEval.
Methodology: mem0 numbers are our own reproduction under the same harness - mem0 does not publish R@K (Recall at top K - the fraction of correct answers returned in the top K results) headline scores on these datasets. MemPalace headline numbers are cross-verified under our harness. This is disclosed, not hidden: reproducible artifacts ship alongside the binary.
Default harness embedder: MiniLM-L6-v2 (a small pre-trained text model in ONNX format - ONNX is an open file format for AI models; you don't need to install anything separately), same bytes across all systems in each test. FinanceBench uses bge-large on all systems for fair comparison (see † footnote). No LLM rerank. Sample counts per run: LongMemEval 500 Q, LoCoMo full dataset (~1986 Q), ConvoMem 50/category, MemBench 100/config. All benchmarks use dense-only retrieval (no sparse/BM25 lane). Reproduce: bash benchmarks/harness/run_bench.sh.
mem0 columns: our reproduction under the same harness (mem0 doesn't publish R@K headlines on these datasets). MemPalace columns: public headline numbers cross-verified under our harness. Raw artefacts: benchmarks/results/v0.1.0/. † FinanceBench uses Ollama bge-large (1024-dim) on all systems; MemPalace shown at best configuration (bge-large direct ChromaDB); mem0 applies LLM memory extraction before storage. Pipeline note: mnem FinanceBench run used hybrid retrieval (--hybrid-boost --query-expand); MemPalace bge-large used pure vector retrieval - pipelines differ. Full methodology: benchmarks/results/analysis/financebench.md. ‡ LoCoMo: mnem uses MAX-over-turn-hits session scoring (lenient); MemPalace uses per-turn aggregation (stricter) - scores reflect different evaluation methodology. See benchmarks/results/analysis/locomo.md.
Query speed
mnem bench fetch longmemeval # download datasets (one-time, 264 MB)
mnem bench # TUI; select benchmarks interactively
mnem bench run --benches longmemeval --limit 50 --non-interactive
mnem bench results ./bench-out # re-render results from a prior run
# Legacy bash harness (canonical path for headline numbers)
bash benchmarks/harness/run_bench.sh
Methodology, raw artifacts, per-bench breakdowns: benchmarks/ and docs/src/benchmarks/.
Compared to others
✅ full support · ~ partial or limited · ✗ not supported · n/a not applicable · + see footnote
| mnem | mem0 | MemPalace | Hermes | Supermemory | Graphiti | Letta | Cognee | |
|---|---|---|---|---|---|---|---|---|
| Local-first | ✅ | ~ | ✅ | ~ | ✗ | ✗ | ~ | ~ |
| Versioned history | ✅ | ✗ | ✗ | ✗ | ✗ | ✗ | ~ | ✗ |
| Branch & merge | ✅ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| Content-addressed storage + | ✅ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| WASM / edge | ✅ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ | ✗ |
| API-free ingest | ✅ | ~ | ✅ | ~ | ✗ | ✗ | ✗ | ~ |
| Token-budget transparency | ✅ | ✗ | ✗ | ~ | ✗ | ✗ | ~ | ✗ |
| Single binary | ✅ | ✗ | ✗ | ✗ | n/a | ✗ | ✗ | ✗ |
| No external DB | ✅ | ~ | ✗ | ✅ | n/a | ✗ | ✗ | ~ |
| Knowledge graph | ✅ | ✗ | ~ | ✗ | ✗ | ✅ | ✗ | ✅ |
| Hybrid retrieval | ✅ | ~ | ~ | ✗ | ~ | ✅ | ~ | ~ |
| MCP native | ✅ | ~ | ✅ | ✗ | ✅ | ~ | ✅ | ✅ |
| License | Apache-2.0 | Apache-2.0 | MIT | MIT | MIT | Apache-2.0 | Apache-2.0 | Apache-2.0 |
+ Content-addressed storage: same bytes always get the same ID; identical facts auto-deduplicate · Hybrid retrieval here means vector + sparse + graph in one pass · Hermes is an agent runtime, not a memory store; mnem attaches as a MemoryProvider plugin and rows show Hermes' native memory only (bounded MEMORY.md + FTS5 session log) · mem0 v2 (Apr 2026) dropped graph backends from the OSS SDK · Graphiti needs an LLM key + a graph backend (Neo4j / FalkorDB / Kuzu / Neptune); ships an MCP server · Letta "MCP" = MCP client (Letta agents call MCP servers) · MemPalace defaults to ChromaDB (backend pluggable) · Supermemory self-host needs Cloudflare + Postgres + OpenAI · Cognee needs an LLM key for graph extraction; first-party MCP server since v0.3.5 · verified 2026-05-19
Deeper write-ups:
- mnem vs mem0 - agent memory layer, OSS leader
- mnem vs MemPalace - benchmark peer
- mnem vs Hermes - agent runtime; mnem plugs in as the memory layer
- mnem vs Supermemory - cloud-hosted memory service
- mnem vs Graphiti - AI coding assistant knowledge graph tool
- mnem vs Letta - agent-memory framework (formerly MemGPT)
- mnem vs Cognee - KG-for-agents alternative
Full matrix: docs/src/comparisons/README.md.
Install
Pick one:
Cargo (Rust) · compiles from source, ~5-15 min first run
Install via rustup (free; also installs rustc). Verify with cargo --version.
# Linux only: sudo apt-get install g++ (Debian/Ubuntu/WSL) or sudo dnf install gcc-c++ (Fedora/RHEL)
cargo install --locked mnem-cli --features bundled-embedder
cargo install compiles from source (the ~5-15 min above). To grab a prebuilt binary directly, install cargo-binstall once and then:
cargo binstall mnem-cli
Resolves to the GitHub-release archive in seconds. Same bytes, same features (bundled-embedder baked in). Reach for cargo install when you need a custom feature set (e.g. --features bundled-embedder-cuda).
pip (Python) · pre-built binary, bundled embedder, works immediately
[!CAUTION] macOS binaries not yet published.
pip install mnem-cliinstalls v0.1.7, which uses a runtime downloader that fails on macOS. Per-platform wheels (Linux · Windows · macOS) ship in v0.1.8 — usecargo installabove in the meantime.
Install Python (free; pip is bundled with Python 3.4+). Verify with python --version.
pip install mnem-cli
Using Python to call mnem from your own app?
pip install mnem-cligives you themnemcommand-line tool. To import mnem from Python code (import pymnem), usepip install mnem-pyinstead - see Python API.
npm (Node.js) · pre-built binary, bundled embedder, works immediately
[!CAUTION] macOS support pending.
npm install -g mnem-cliinstalls v0.1.7, which uses a runtime downloader that may fail on macOS. Per-platform sub-packages ship in v0.1.8 — usecargo installabove in the meantime.
Install Node.js (free; npm is bundled, Node 18+ required). Verify with node --version.
npm install -g mnem-cli
From source · the unreleased main branch, for local changes or pre-release commits
Use this if you need a commit that hasn't been published to crates.io yet, or you're making local changes. Otherwise prefer the published-crate path above. Requires Rust 1.95+ (rustup install 1.95 && rustup default 1.95 if needed).
# Linux only: sudo apt-get install g++ (Debian/Ubuntu/WSL) or sudo dnf install gcc-c++ (Fedora/RHEL)
git clone https://github.com/Uranid/mnem
cd mnem
cargo install --path crates/mnem-cli --features bundled-embedder
Docker · runs the HTTP server; no local install needed
docker run --rm -p 9876:9876 -e MNEM_HTTP_ALLOW_NON_LOOPBACK=1 \
ghcr.io/uranid/mnem:latest http --bind 0.0.0.0:9876
mnem --version # confirm install
mnem doctor # checks embedder + store + config, prints a green/yellow/red checklist
If
mnem: command not found: Try opening a new terminal first (PATH changes only take effect in new sessions). On Linux, pip installs to~/.local/bin- if that's not in your PATH, runexport PATH="$HOME/.local/bin:$PATH"then add that same line to~/.bashrc(this is a one-time fix; the file change makes it permanent). On Windows: 1. Runpip show mnem-cli. 2. Copy theLocationvalue (e.g.C:\Users\you\AppData\Roaming\Python\Python312\site-packages). 3. Replacesite-packageswithScriptsto get the Scripts folder path. 4. Open System Properties → Environment Variables → Path → Edit → New → paste the Scripts path → OK. 5. Open a new Command Prompt - PATH changes require a new window to take effect.
[!NOTE]
--lockedpins exact tested dependency versions.--features bundled-embedderpacks the embedder (~40 MB) into the binary somnem retrieveworks immediately - no extra setup. This flag is Cargo-only; pip and npm ship with the embedder pre-baked. Without it (and without configuring another provider inconfig.toml),mnem retrievefails with "embedder not configured".
Full install matrix: docs/src/install.md.
Embedding mnem inside a Python app? The
pip install mnem-cliabove ships the CLI binary as a wheel. The native Python API (import pymnem) lives in a separate package. Jump to Python API (mnem-py) ↓ forpip install mnem-pyand snippets.
Quickstart
Step 1: Try it now (standalone, no AI assistant needed)
mkdir my-graph
cd my-graph
mnem init # required once per project - creates the .mnem/ folder that stores your graph
mnem ingest --text "mnem is a versioned knowledge graph for AI agents"
mnem retrieve "what does mnem do"
mnem initis required once per project beforemnem ingestormnem retrieve- it creates the.mnem/folder. If something looks wrong, runmnem doctor.
Expected output:
[1] score=0.94 mnem is a versioned knowledge graph for AI agents
tokens_used=12 candidates_seen=1 dropped=0
Step 2 (optional): Wire your AI assistant
Prerequisite: This example uses Claude Code. Don't have it? Download free at claude.ai/code. No agent? Skip to "Session 2" -
mnem retrieveworks standalone.
Working directory: Open Claude Code from
my-graph/(or a subdirectory) after wiring - launching from a different folder means it won't find this graph.
# Session 1: add a fact and wire the agent
mnem init # skip if you already ran this in Step 1
mnem ingest --text "The API retry policy uses exponential backoff with a 3-attempt limit"
mnem integrate claude-code # Cursor: use `mnem integrate cursor`
# Session 2 (next day, new terminal): memory persists
cd my-graph
mnem retrieve "what is our API retry policy"
After mnem integrate, close and reopen the application (not just the terminal). To verify: open any session and send a message - you should see mnem: N item(s) before Claude replies. 0 item(s) means the graph is empty but the integration is working.
Local vs global graph:
.mnem/in your project directory holds project-specific memory.~/.mnemglobal/.mnem/(the global graph, where~means your home directory - e.g.C:\Users\youon Windows,/home/youon Linux/macOS) holds facts that span all your projects - personal preferences, shared team conventions, cross-repo entities. Usemnem global retrieveandmnem global addto target it.
Next steps:
- Ingest a file:
mnem ingest README.md(ormnem ingest your-docs/ --recursivefor a whole directory) - Wire your AI assistant:
mnem integrate(Claude Code, Cursor, and more) - Ask anything:
mnem retrieve "your question"
Five minutes from zero. See docs/src/quickstart.md for the full walkthrough.
mnem integrate - wire into any agent host
Not using Claude Code, Cursor, or another AI coding assistant? Skip this section -
mnem integrateis only needed if you want one of those tools to pick up mnem automatically.
Claude Code, Cursor, and similar tools must already be installed.
mnem integratedetects which are present - runmnem integrate --checkfirst to see what's detected.
One command wires mnem into your agent host. For MCP-aware hosts it adds the MCP server (tools like mnem_retrieve and mnem_commit), an auto-retrieval trigger where the host supports hooks, and the mnem system prompt where the host has a rules file. Hermes Agent is hook-only by design: mnem integrate hermes writes Hermes pre_llm_call / post_llm_call hooks that add retrieved memory as a +1 context layer and persist the turn, without modifying Hermes' system prompt. Restart the host (close and reopen Claude Code, Cursor, Hermes, etc. as an application, not just the terminal) and the agent starts using mnem automatically. To verify: start a new session and send any message - you should see retrieved mnem context injected before the model answers. 0 item(s) is fine - it means the graph is empty; the integration is working.
Troubleshooting: Not seeing
mnem: N item(s)?
- Make sure you closed and reopened the application (not just the terminal) - this means close the Claude Code or Cursor window entirely and relaunch it
- Open the application from inside the directory that contains your
.mnem/folder (or any subdirectory of it) - if you open Claude Code from a different folder, it won't find that project's graph- Run
mnem doctorto check the embedder and store are healthy- Run
mnem integrate --checkto see if the host was wired correctly
mnem integrate # interactive: detect installed hosts and prompt
mnem integrate claude-code # wire a specific host, skip interactive detection
mnem integrate hermes # wire Hermes pre/post LLM hooks only
mnem integrate --all # wire every detected host without prompting
mnem integrate --check # report wired state for all hosts; nothing changes
mnem integrate --dry-run # preview what would be written without changing anything
mnem integrate --show claude-code # print the MCP JSON block for manual copy-paste
mnem integrate --no-hooks # skip UserPromptSubmit hook wiring
mnem integrate --no-system-prompt # skip system prompt wiring
mnem integrate --target-repo ~/notes # point the MCP server at a specific graph, not the global one
What gets wired:
- MCP server (
mcpServers.mnem) - MCP-aware hosts get full mnem tool access viamnem mcp --repo <graph>; defaults to the global graph (~/.mnemglobal/.mnem) - Auto-retrieval trigger - Claude Code gets a
UserPromptSubmithook; Hermes Agent getspre_llm_call/post_llm_callshell hooks in$HERMES_HOME/config.yaml(defaulting to~/.hermes/config.yamlwhen$HERMES_HOMEis unset). Both retrieve from the local graph first and fall back to the global graph. - System prompt - mnem usage instructions injected into hosts with project-rules files. Hermes is deliberately excluded because its hook contract is designed for +1 user-context enrichment rather than system-prompt edits.
The hook always queries your project's .mnem/ first (walking up from the current directory), then falls back to mnem global retrieve automatically. The hook and system prompt behave the same regardless of which default knowledge graph you choose during setup. Use --target-repo only if you want the MCP server to point somewhere other than the global graph.
Auto-detects and configures:
- Claude Code
- Claude Desktop
- Cursor
- Continue
- Zed
- Gemini CLI
- Hermes Agent
Any other MCP-aware host works via a hand-edited mcpServers entry pointing at mnem mcp --repo <path> - see docs/src/mcp.md.
The agent gets the full mnem toolset as native tools: retrieve, commit, ingest, tombstone, traverse, global graph access, and more. No extra daemon, no port to manage. Full tool reference: docs/src/mcp.md.
mnem unintegrate # interactive: pick which hosts to remove mnem from
mnem unintegrate claude-code # remove one host
mnem unintegrate --all # remove all wired hosts
Run mnem unintegrate --help for all options.
Commands
Quick glossary: node = a single entry in the graph (a fact, document chunk, or entity - anything you store). edge = a typed link between two nodes (
depends_on,relates_to,part_of, etc.). CID = content-addressed ID - a unique fingerprint based on exact bytes; every node, edge, and commit gets one. HEAD = the tip of the current op-log (most recent commit - same concept as in git). op-log = the append-only log of all write operations. ref = a named pointer to a commit CID (e.g.refs/heads/main- same as a git branch or tag).
Every command accepts --help for the full flag reference. Full CLI reference: docs/src/cli.md.
1. mnem init - Initialize a knowledge graph
Create a .mnem/ store in the current directory. Commit it alongside your codebase so every developer and agent starts from the same baseline.
mnem init
Example: Your team ships an AI agent alongside an API service. Run
mnem initonce in the repo root - every engineer who clones the repo gets the same knowledge base their agents were trained on.
mnem doctor # probes embedder, store, config - green/yellow/red checklist
mnem stats # nodes, edges, refs, store size at a glance
2. mnem ingest - Add documents to the graph
Parse a file or directory into Doc, Chunk, and Entity nodes in a single pass. No LLM required at ingest - deterministic and audit-friendly: same bytes always produce the same CIDs (content-addressed IDs - a unique fingerprint computed automatically from the content bytes; every node, edge, and commit gets one).
mnem ingest architecture.md
mnem ingest --recursive docs/ # ingest an entire directory
File type is auto-detected by extension: Markdown uses heading-aware chunking, source code (.rs, .py, .ts, .go, and more) uses Tree-sitter function/class-level parsing, PDFs use sliding-window text extraction - all handled automatically with no flags.
Example: An agent onboarding to your platform ingests
ARCHITECTURE.md, therunbooks/directory, and all ADR files at startup. Every subsequent agent retrieves the same structured knowledge without re-reading each file from scratch.
mnem ingest --text "Deploy window is Tuesdays 10-11 AM UTC" # ingest inline text without a file
mnem ingest src/ --recursive # ingest all source files under src/
mnem ingest --chunker recursive report.pdf # PDF with explicit recursive chunking
mnem ingest --extractor keybert notes.md # keyphrase enrichment for stronger sparse retrieval
mnem ingest --max-tokens 256 notes.md # smaller chunks for fine-grained retrieval
3. mnem add - Write individual facts and relationships
Commit a single fact node, or connect two entities with a typed edge. The lowest-level write primitive - use it when you want precise control over what goes into the graph. The optional --label tag (e.g. Fact, Convention, Decision) categorizes nodes so you can filter retrieval by type later.
mnem add node -s "Deploy window is Tuesdays 10-11 AM UTC"
Example: Mid-conversation, an agent discovers an undocumented constraint. It commits the finding immediately so every downstream agent operates from the same shared truth - no more re-discovering the same edge case across sessions.
mnem add node --label Fact -s "The payments API uses idempotency keys for all POST requests"
mnem add node --label Convention -s "All REST APIs are versioned under /v1/"
mnem add edge --from <uuid> --to <uuid> --label depends_on # connect two existing nodes
mnem get <uuid> # fetch a node by UUID
mnem get <uuid> --content # include full content body
mnem tombstone <uuid> # soft-delete: hidden from retrieval, kept in audit log
mnem tombstone <uuid> --reason "superseded by v2 decision" # record why
mnem delete <uuid> # hard-delete: no audit trail
mnem global get <uuid> # look up a node in the global graph
mnem global tombstone <uuid> # soft-delete in the global graph
4. mnem retrieve - Search the graph
Hybrid semantic + keyword + graph retrieval in a single pass. Returns exactly what it found, what it skipped, and how many tokens were used - no silent truncation at the token budget.
mnem retrieve "what did we decide about the API rate-limit design"
Example: Three sprints later, a new engineer asks the agent "why is our retry logic exponential?" The agent retrieves the original decision node with the full rationale - without anyone having to remember to document it separately.
mnem -R ~/notes retrieve "query" # target a specific graph explicitly
mnem retrieve "..." --limit 20 # return more results
mnem retrieve "..." --graph-expand 20 # add multi-hop graph traversal
mnem retrieve "..." --graph-expand 20 --community-filter --graph-mode ppr
mnem retrieve "..." --rerank cohere:rerank-english-v3.0
mnem retrieve "..." --vector-cap 512 # widen the dense candidate pool
mnem retrieve "..." --explain # print per-item lane scores (vector, sparse, graph_expand, rerank)
See GraphRAG for the full flag reference.
5. mnem global - Cross-project, cross-session memory
A second graph at ~/.mnemglobal/.mnem/ (where ~ is your home directory: C:\Users\you on Windows, /home/you on Linux/macOS) that follows agents everywhere - across repos, teams, and sessions. Use it for shared conventions, vendor decisions, and entities that appear in every project.
mnem global retrieve "what payment provider do we use"
mnem global add node --label Convention -s "All REST APIs are versioned under /v1/"
Example: Your platform has a dozen microservices, each with its own
.mnem/. The global graph holds team-wide conventions, shared entity definitions, and cross-service decisions. Any agent on any service can query it without knowing which repo the fact originated from.
mnem global ingest contacts.md
mnem global add node --label Entity:Person \
--prop name=Alice -s "Alice leads the infra team"
mnem global get <uuid>
mnem global tombstone <uuid>
When to use local vs global:
Use local .mnem/ for |
Use mnem global for |
|---|---|
| Project-specific facts, decisions, code context | People, preferences, facts that span all projects |
| Per-repo memory that travels with the repo | Knowledge you want every session and every agent to see |
| Anything you'd commit alongside the code | Cross-session continuity |
The mnem integrate command sets up the agent to read local first and fall back to global automatically - no manual switching required during normal use.
6. mnem status / mnem log - Inspect history
See the current state of the graph and walk the op-log backwards.
mnem status # op-head CID, head commit, all named refs, label counts
mnem log # walk op-log backwards, last 20 entries
mnem stats # compact one-liner: CIDs, ref count, label names
mnem log -n 50 # show last 50 entries
mnem log --oneline # compact one-line-per-op format
mnem log --format json # machine-readable JSON stream
7. mnem diff / mnem show - Compare snapshots and inspect blocks
See exactly what changed between any two op CIDs: ref deltas plus structural node/edge diff. Decode any block by CID for detailed forensics.
mnem log # lists commits with their CIDs - copy a CID from here to use below
mnem diff HEAD <cid>
Example: An agent ran overnight and committed hundreds of new facts. Before merging into
main, a reviewer diffsHEADagainst the pre-run snapshot to confirm nothing unexpected was added or removed.
mnem diff <op-a-cid> <op-b-cid> # diff any two ops
mnem show # decode and pretty-print the current op-head block
mnem show <cid> # decode any block by CID (Node, Edge, Commit, Operation, ...)
mnem cat-file <cid> # emit raw DAG-CBOR bytes for any block to stdout
mnem cat-file <cid> --json # decode to DAG-JSON and pretty-print (pipe into jq)
8. mnem branch - Create and manage branches
Branch the knowledge graph the same way you branch code. Each branch is an independent line of commits - experiment freely, merge back when ready.
mnem branch create agentic-workflow
Example: Two agents are testing competing approaches to a summarisation pipeline. Each works on its own branch -
approach-aandapproach-b- committing findings as it goes. A reviewer merges the winning branch back intomain, preserving the full history of both experiments.
mnem branch list # list all branches; * marks current
mnem branch create <name> <start> # branch from a ref, branch name, or CID
mnem branch create <name> --from HEAD # explicit --from form; same resolution as above
mnem branch delete <name> # delete a local branch pointer
9. mnem merge - Merge branches
3-way graph merge - the same model as git merge, but for knowledge. Conflicts land in .mnem/MERGE_CONFLICTS.json for explicit resolution.
mnem merge agentic-workflow
Example: Agent A spent a week processing customer interviews; Agent B processed support tickets in parallel. Merging combines both knowledge bases cleanly - no fact is silently overwritten, and the full provenance of every node is preserved.
mnem merge <branch> --strategy=ours # auto-resolve: keep current side
mnem merge <branch> --strategy=theirs # auto-resolve: take incoming side
mnem merge <branch> --dry-run # preview outcome without persisting anything
mnem merge --continue # finish after editing MERGE_CONFLICTS.json
mnem merge --abort # cancel; restore HEAD from ORIG_HEAD
10. mnem push / mnem pull / mnem clone - Sync with a remote
Push and pull a knowledge graph the same way you push and pull code. The wire format is standard CAR v1 (Content Addressed aRchive, an IPFS-compatible binary format).
Before your first push, register a remote:
mnem remote add origin <url>where<url>is your server address - for example,http://my-server:9876orhttps://mnem.example.com(see More options below for the full remote command list).Running your own server? On the target machine, set
MNEM_HTTP_ALLOW_NON_LOOPBACK=1and runmnem http --bind 0.0.0.0:9876. The same binary that powers the CLI also serves over HTTP - no separate install or daemon needed. Thenmnem remote add origin http://<server-ip>:9876on the client side.Authentication (bearer token): By default,
mnem httphas no authentication. To secure push/pull, both the server and client must use the same token:# Server side: set the token and start the server export MNEM_HTTP_AUTH_TOKEN=my-secret-token MNEM_HTTP_ALLOW_NON_LOOPBACK=1 mnem http --bind 0.0.0.0:9876 # Client side: register the remote pointing to an env var holding the same token export MNEM_REMOTE_ORIGIN_TOKEN=my-secret-token mnem remote add origin http://my-server:9876 --token-env MNEM_REMOTE_ORIGIN_TOKEN mnem push # exits 1 with "authentication failed (HTTP 401)" if token is wrong or missingThe server rejects requests with a wrong or missing token with HTTP 401. Never hard-code the token value in commands - use environment variables. If
MNEM_REMOTE_ORIGIN_TOKENis unset or empty at push time,mnem pushexits 1 with "missing authentication token" before making any network request.
mnem push # push HEAD to origin/main
mnem pull # fast-forward origin/main into HEAD
Single-writer note:
mnem pushandmnem pullacquire the write lock on the local store. Ifmnem httpis running against the same store, the push will block until the server releases any in-progress write (it does not corrupt data, but it will wait). If you need a clean push without waiting, stopmnem httpfirst. For concurrent CI pipelines writing to the same remote, use an external queue or separate repos merged withmnem merge.
Example: An agent running in CI commits new findings after each build and pushes. Agents on developer machines pull at session start - the whole team works from the same knowledge baseline without any manual sync.
mnem push <remote> <branch> # push a specific branch
mnem pull <remote> <branch> # pull from a specific remote/branch
mnem fetch # fetch without merging (default remote)
mnem fetch <remote> # fetch from a named remote
mnem clone <url> [<dir>] # clone a CAR archive into <dir>
mnem clone file:///tmp/repo.car ./copy # clone from a local file path
mnem clone ./repo.car ./copy # bare path shorthand (must end in .car)
mnem remote add <name> <url> # register a remote
mnem remote add <name> <url> \
--token-env MNEM_REMOTE_ORIGIN_TOKEN # supply the bearer token via env var
mnem remote list # list all configured remotes
mnem remote show <name> # show URL + capabilities
mnem remote remove <name> # remove a remote entry
11. mnem query - Structured graph queries
Exact-match property filter with optional edge traversal. No embedding computation needed - fast and deterministic.
mnem query --where name=Alice
Example: An agent builds an org-chart from onboarding documents. Later, another agent runs
mnem query --where kind=Person --with-outgoing reports_toto reconstruct the full reporting structure without a text search.
mnem query --where kind=Person -n 25 # increase result limit
mnem query --where kind=Person \
--with-outgoing knows # follow outgoing "knows" edges
mnem query --where status=active \
--with-outgoing depends_on \
--with-outgoing depends_on # chain multiple hops
mnem blame <node-uuid> # list all incoming edges to a node
mnem blame <node-uuid> --etype authored # filter to one edge type
mnem blame <node-uuid> --first-writer # show oldest ancestor commit per edge (BFS)
# mnem ref: manage named refs (branches/tags by CID)
mnem ref list # list all refs (refs/heads/*, refs/remotes/*, ...)
mnem ref set <name> <target-cid> # point a ref at a specific commit CID
mnem ref delete <name> # delete a named ref
12. mnem reindex - Manage embeddings
Backfill or update vector embeddings for nodes. Run after adding a new embedding provider or switching models.
Running
mnem reindexwhilemnem httpis active?mnem reindexis a write operation - it acquires the single-writer lock, so it waits until any in-progress write completes before starting. Ongoing HTTP reads (mnem retrieve) continue to work during reindex but may see stale embeddings until the reindex commit lands. Stop the HTTP server first if you need a consistent point-in-time snapshot.
mnem reindex
mnem reindex --label Doc # restrict to nodes of o
No comments yet
Be the first to share your take.