# open-memex [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/stoneskin/open-memex  
**GitHub Stars:** 6  
**npm Downloads (last month):** 4694  
**Views:** 10  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/open-memex

## Description
Local-first memory for AI coding agents — Markdown + SQLite FTS5, shared across editors via MCP.

## Tools
Capabilities this server exposes over MCP:

- **memory_add** — Save a fact, preference, decision, or note to persistent local memory. Call this PROACTIVELY whenever the user shares something worth remembering across sessions — project conventions, tool choices, personal preferences, decisions made, error fixes and their causes. Worth saving: decisions and their reasons, preferences, conventions, gotchas, approaches tried and abandoned. Not worth saving: one-off task details or anything re-derivable from the code. Do not wait to be asked. For facts you infer yourself rather than the user stating, propose them first and save only on approval. Keep each memory to one self-contained statement; attach aliases when the parameter is available. If a note tells you the user's own wording was already stored verbatim this turn, that statement is already saved: do not retry it in a rewording — save only what that text does not contain, or use memory_supersede on the given id. Default scope is the current project; use the personal scope for facts about the user that apply across all projects. Returns the new memory's id; an identical fact already stored returns that id instead of duplicating. A body that is a structured semantic-edge verdict is refused — edge verdicts go through `open-memex graph verdict`, not memory_add.
- **memory_search** — Search persistent memory by keyword (BM25 full-text). Returns matching memories from the current project and/or personal scope. Call before asking the user about past decisions, conventions, or preferences they may have told you before. Search well: break the question into its concepts and try 2–3 phrasings per concept — synonyms, the user's other language, shorter keyword forms — and check the other scope too, before concluding nothing is stored. Results are ranked by BM25 within review tiers — reviewed (approved/published) project memories come first. `limit` caps how many come back (default 8) and `type` restricts to one memory type.
- **memory_list** — List memories in a scope, newest first, as a numbered inventory. Each line keeps the raw fields — [type] id=… created=… source=… — say them back to the user in plain words (source=user → 'you told me this'; inference → 'I inferred this, check me'; keyword → 'caught from your own wording'), never read the raw id aloud unless they ask. When the user asks 'what do you remember about me?', use scope=both and present the inventory conversationally. The user may point at an entry by its number ('delete #3'): numbers are only valid for the listing you just produced — re-run memory_list, read the candidate back in full, and get a confirmation before calling memory_forget (deletion is permanent). include=all is the audit view (superseded versions, retracted, archived also shown). `type` filters to one memory type; `limit` caps how many entries come back.
- **memory_supersede** — Replace an existing memory with a newer version. The old memory is kept as history (status: superseded) and retrieval returns the new one. Use when a saved fact becomes outdated and should be replaced rather than duplicated. Only active memories can be superseded; the new memory inherits type, tags, and aliases unless you pass replacements. An unknown id is reported back as a failure; nothing is written.
- **memory_forget** — Delete a memory by id. Use when the user asks to forget something. To replace an outdated fact with a corrected one instead of deleting it, use memory_supersede. Deletion is permanent: before deleting, restate the memory's content to the user and get a confirmation. With soft=true the memory is hidden instead (retracted: out of lists and search, file kept, one-way).
- **memory_useful** — Mark an existing memory as useful (D77): record that it demonstrably paid off. Call it ONLY on an explicit signal — the user confirmed it helped ('that was the one', 'saved me again'), or your completed/accepted work clearly relied on that memory and the user saw the result. NEVER call it because a memory appeared in memory_search results, a memory_list inventory, or the session-start block: passive exposure never refreshes usefulness. Exposure is counted automatically under retrieved_count; the useful buckets increment only through this tool, a human approval at review, or a supersede. Useful is split automatically: useful_self for personal memories and unpublished project drafts (the author's own utility), useful_team for approved/published project memories (team knowledge reused) — pass kind only to override. Returns the cumulative counts and reuse_rate (useful / retrieved). The counters live in the local SQLite index, not in the Markdown source of truth, and never leave this machine.
- **memory_status** — Show the project memory sync pipeline: drafts waiting in the outbox (appdata), memories in the repo awaiting review or published, and any repo files not yet committed — plus the D77 reuse report: per-scope retrieved/useful rates, the most-reused memories, and "zombies" (retrieved but never confirmed useful). Call this at session start, when the server reports drafts waiting for review, when the user says 'sync memory' (or '同步记忆'), or when they ask what memory is pulling its weight. Then ask the user which drafts to sync. For the memories themselves use memory_list; for PR review state use memory_pr_status. (MCP server and the `open-memex sync-status` CLI; the opencode native plugin does not expose this tool.)
- **memory_submit** — Move outbox drafts into the repo memory dir for review. Before copying, reports graph lint (never blocking) and auto-applies the deterministic tier: exact-duplicate merges, empty-body archives, first-line title normalization, and high-confidence type/tag inference from keyword captures. Every applied action appears in the output with its undo command; pass noCurate=true to skip curation (lint still reports). D95: semantic merges, splits and uncertain type/tag inferences are one batch-confirm summary — when they exist, submit stops before writing anything and returns the summary. Show that summary to the user, then call again with either curateBatch="accept" (apply the whole batch) or curateBatch="decline" (change nothing). Never per-item approval, never silently apply the batch. Then copies the drafts in as proposed (or keeps a local approval), commits locally on the current branch, and moves the outbox originals out. Never creates a branch on its own — pass branch= only with the user's explicit approval for the full chain. Prints the push and PR commands — those need the user's explicit approval and are never run automatically. (MCP server and the `open-memex submit` CLI; the opencode native plugin does not expose this tool.) Unknown ids or a failed local commit abort the submit with the reason; nothing is published automatically.
- **memory_propose** — Copy personal memories into the project outbox as review drafts. The personal originals stay put. Use this when personal knowledge should enter a project's review flow; memory_submit then moves the drafts into the repo, and memory_promote advances drafts already there. Memories whose body is a structured edge verdict are refused — edge verdicts go through `open-memex graph verdict`, not memory_propose. (MCP server and the `open-memex propose` CLI; the opencode native plugin does not expose this tool.)
- **memory_promote** — Advance a project memory one step up the review ladder (proposed → approved → published), or reject it with a note. Rejected memories are never deleted — they can be revised and resubmitted. One step per call; an unknown id or a memory already published errors. Pass `by` to record the reviewer when it should differ from the default (e.g. approving on the strength of someone else's review). For brand-new outbox drafts, memory_submit is the entry point. (MCP server and the `open-memex promote` CLI; the opencode native plugin does not expose this tool.)
- **memory_resolve** — List git-conflicted memory files, or attempt a field-level 3-way merge of one. Semantic conflicts are reported, never auto-resolved. Run it when a git pull or merge leaves memory files conflicted; the merged file is written in place (undo with git if the merge is wrong). For PR review state rather than file conflicts, use memory_pr_status. (MCP server and the `open-memex resolve` CLI; the opencode native plugin does not expose this tool.)
- **memory_pr_status** — Read the current branch's GitHub PR and map its review state onto each in-repo memory: merged PR → published, PR approval → approved (approved_by = reviewer), changes-requested → suggestion only. Report by default — that mode changes nothing; apply=true writes the mapped transitions to the local files (still no push). (MCP server and the `open-memex pr-status` CLI; the opencode native plugin does not expose this tool.)
- **memory_workingstate** — Read, write, or clear the one ephemeral per-project working-state note (§3.6, D89): where an interrupted task stands, so a fresh session can resume. Scratch state, NOT durable knowledge — it never enters memory retrieval or a review ladder; any conclusion here that should outlive the task goes through the normal memory_add/checkpoint-proposal path instead. WRITE it (action=write, content required) when the user signals the session or task is wrapping up — body rubric: task summary (one paragraph), open files, last commands, where the work stands, next step; short by design, a scratch note, not a transcript. READ it when resuming work or when the user asks what they were doing. CLEAR it on the user's request only. The note lives outside memories/, the user can edit the plain file directly, and it expires after ttl_days (default 7) — expired notes are ignored and `audit` reports them.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "open-memex": {
    "command": "npx",
    "args": ["-y","open-memex","mcp"]
  }
}
```

## Documentation

## What open-memex does

open-memex provides persistent memory for AI coding agents across editor sessions. Memories are stored as individual Markdown files, with SQLite FTS5 acting as a rebuildable keyword-search index rather than the source of truth. The system supports two scopes: project memories for a repository and personal memories for information about the developer. Personal memories stay on the machine and cannot be shared into a repository.

The server is useful when an agent repeatedly needs the same project decisions, constraints, preferences, or lessons. Multiple supported editors on one machine can read and write the same memory collection instead of maintaining separate stores.

## How it works

Agents interact with open-memex through MCP tools. New sessions receive guidance about available memory and pending work, while agents can use the memory tools to manage entries on demand. The MCP path provides workflow tools for editors such as VS Code, Cursor, Claude Code, and Codex-compatible clients.

Project sharing follows a review process rather than automatic publication. Personal memories can be proposed for a project as review candidates, then advanced through review states. Repository changes use a local branch and commit, allowing memory updates to follow a Git-based team workflow. Pull-request state can also be mapped onto the review state of individual memories.

Search is based on the SQLite FTS5 index and a curated synonym map indexed when memories are written. The index can be rebuilt from the Markdown files with the CLI. A derived knowledge graph connects memories through structural relationships such as supersession chains, tags, and explicit mentions.

## Setup and configuration

Install the package globally with Node.js 22.14 or newer:

```sh
npm install -g open-memex
open-memex init
```

The `init` command detects supported local editors and configures their connection. It can set up VS Code, Cursor, opencode, or Visual Studio when the project contains a solution file. Restart the editor after initialization. Run `open-memex doctor` to check the setup.

For a direct MCP configuration, use `open-memex mcp --print-config`. Claude Code can be connected with:

```sh
claude mcp add open-memex -- open-memex mcp
```

## Tools and capabilities

The exposed memory workflow includes:

- `memory_status`: inspect the sync queue, draft outbox, repository review states, uncommitted files, and the D77 reuse report.
- `memory_submit`: curate drafts, apply the deterministic tiering and batch decision, then move selected drafts into the repository memory directory with a local commit.
- `memory_propose`: copy personal memories into project scope as candidates for review.
- `memory_promote`: move candidates through approved and published states, or reject and resubmit them.
- `memory_resolve`: list conflicted memory files and perform a three-way merge.
- `memory_pr_status`: relate the branch pull request's GitHub state to memory review states.

## Limitations and notes

MCP clients do not provide a hard session-start hook, so the standard MCP path relies on handshake guidance and editor instruction files for initial recall. The native opencode plugin is the path with built-in first-turn injection. Editors on different machines do not synchronize automatically. Sharing project memories requires an explicit review and Git workflow; nothing is shared automatically.

_Full upstream README: https://allmcps.com/mcp/open-memex/readme_

