{
  "markdown": "# NexusMem\n\n[![CI](https://github.com/yaminbkk/NexusMem/actions/workflows/ci.yml/badge.svg)](https://github.com/yaminbkk/NexusMem/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/nexusmem)](https://www.npmjs.com/package/nexusmem)\n[![npm downloads](https://img.shields.io/npm/dm/nexusmem)](https://www.npmjs.com/package/nexusmem)\n[![License: MIT](https://img.shields.io/badge/license-MIT-informational)](LICENSE)\n![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen)\n[![yaminbkk/NexusMem MCP server](https://glama.ai/mcp/servers/yaminbkk/NexusMem/badges/score.svg)](https://glama.ai/mcp/servers/yaminbkk/NexusMem)\n[![Listed on AiList](https://hifriendbot.com/ai-list/badge/nexusmem.svg)](https://hifriendbot.com/ai-list/nexusmem/)\n\n![NexusMem: init, sync --github, and a query against this repo's own history — surfacing a real issue, the PR that closed it, and the commits it shipped](docs/demo.gif)\n\nYour coding agent can read `git log`. It cannot read the four things you tried last Tuesday that\ndidn't work.\n\nNexusMem records what actually happened on your machine (shell commands and their exit codes, git\nhistory down to the patch of each changed file, project docs, optionally your assistant transcripts)\ninto a local SQLite database, and\nserves back a ranked, token-budgeted slice of it on demand. Everything stays on disk. No account, no\ncloud, no telemetry.\n\nThe shell history is the part worth caring about. Git tells an agent what shipped. Shell history\ntells it what was attempted, in what order, and which commands exited non-zero. That information\nexists nowhere else, and it disappears when your terminal scrollback rolls over.\n\n![How NexusMem works: git commits, shell commands with their real exit codes, docs, and GitHub threads flow into a local SQLite index, which returns a ranked, token-budgeted slice of that history so your coding agent answers with a real citation instead of a guess](docs/how-it-works.svg)\n\n**Contents:** [Try it](#try-it) · [Exact shell capture](#optional-exact-shell-capture) ·\n[Failure → fix chains](#failure--fix-chains-opt-in) · [How retrieval works](#how-retrieval-works) ·\n[Session summaries](#session-summaries-optional-local-model) ·\n[GitHub issues & PRs](#github-issues--prs-optional) · [Use it from an agent](#use-it-from-an-agent)\n· [What it costs you](#what-it-costs-you) · [Staleness & provenance](#staleness--provenance) ·\n[Where it breaks](#where-it-breaks) · [Commands](#commands) · [Cross-project recall](#recall-across-projects)\n· [On disk](#on-disk) · [Development](#development)\n\n## Try it\n\nFrom inside any git repository:\n\n```\nnpx nexusmem init\nnpx nexusmem sync\n```\n\nThen ask it something. Real output from this repository, top 2 of 5 hits:\n\n```\n$ nexusmem query \"windows spawn failure\"\n\nRelevant history for: windows spawn failure\n\n- 2026-08-09 [observed] fix: distinguish a failed git spawn from \"not a git repository\"\n  readRepoInfo collapsed three unrelated failures into one error: git running and reporting\n  the path is not a work tree, git not being installed, and the process failing to spawn at\n  all. Dogfooding hit the third case in two separate sessions...\n- 2026-08-09 [authored] README.md — Before a tagged release\n  - [ ] Retry on transient process-spawn failures on Windows\n```\n\n`[observed]`/`[authored]` is the provenance tag (see [Staleness & provenance](#staleness--provenance))\n— a commit is a directly observed event, a doc section is a written claim that could go stale.\n\nA commit and a docs section, ranked against each other, inside whatever token budget you gave it.\nNothing was summarized by a model on the way out; the ranker just decided what not to send. (One\noptional source, session summaries, does run a local model — but at ingest time, never on the way\nout. What you query is always stored text.)\n\nFor a sense of what actually accumulates, here is `nexusmem status` on this repo after two days:\n\n```\n527 node(s)  2026-08-08 .. 2026-08-09\n       321  shell_command\n       130  conversation_turn\n        60  doc_section\n        16  git_commit\n```\n\nSixteen commits. Three hundred and twenty-one shell commands. The commits were already retrievable\nby any agent with a terminal. The rest was not.\n\nThat `conversation_turn` row only appears because this corpus was synced with `--conversation`.\nAssistant transcripts are the one source that is off by default and stays off until you opt in, since\nthey are the likeliest place for a pasted credential to be sitting. A default install indexes git\ncommits, their diffs, shell and docs.\n\nRequirements: Node 22 or newer, and git. Node 20 will not work, because `better-sqlite3` ships no\nprebuilt binary for it and Node 20 went end-of-life in April 2026. Ollama is optional and only\naffects semantic search (see below).\n\n## Optional: exact shell capture\n\nScraped history files (PSReadLine, `.bash_history`, `.zsh_history`) give you command text and not\nmuch else. The hook gives you working directory, exit code and a real timestamp:\n\n```bash\nnexusmem hook install\n```\n\nIt wraps your existing PowerShell prompt rather than replacing it, is idempotent, and\n`nexusmem hook remove` undoes it cleanly.\n\nExit codes are what make this worth installing. A failed command is a stronger signal than a\nsuccessful one, and without the hook there is no way to tell them apart.\n\n## Failure → fix chains (opt-in)\n\n```bash\nnexusmem sync --link-failures\n```\n\nAfter a normal sync, this walks every failed `shell_command` (non-zero exit code) and looks for\nwhatever later resolved it, using two independent heuristics: a later command in the same project\nand working directory, exact same normalized text, that exited `0` within 24h (**same-command\nretry**); and, separately, the best full-text match among nearby conversation turns or session\nsummaries, requiring every significant word of the failing command to appear, not just one\n(**conversation bridge**). A failure can be linked by either, both, or neither.\n\nBoth links are surfaced in query results. The conversation-bridge heuristic originally matched on\nany shared word, and dogfooding against this repo's own real history found it wrong on roughly half\nits links — a shared word as generic as \"npm\" was enough to link an unrelated discussion. Requiring\nevery significant word fixed that: re-dogfooded against the same corpus, every resulting link (the\nfull set produced, not a sample) checked out correct on manual review of the full text, not just the\nsummary.\n\nWhen a linked failure appears in a result set, its fix rides along immediately after it, inheriting\nthe failure's own relevance score rather than needing to match the query on its own merits. That is\nthe point: a query about why something failed shouldn't need to separately guess the words used in\nwhatever fixed it. This works across projects too — `query --all-projects` chains a failure to its\nfix using whichever project's own database recorded the link, since links are always local to the\nproject they were found in.\n\n```\n$ nexusmem query \"why did npm whoami fail\"\n\n- 2026-08-12 [observed] shell: npm whoami  (exit 1)\n- 2026-08-12 [observed] shell: npm login   (exit 0)  -- linked as the fix\n```\n\n## How retrieval works\n\nEvery source normalizes to the same `MemoryNode` shape, so a commit, a shell command and a docs\nsection compete on equal terms. Retrieval runs BM25 over FTS5 and, if an embedding model is\nreachable, a vector search over `sqlite-vec`, fused with Reciprocal Rank Fusion on rank *position*\nonly, never raw scores — a BM25 cost and a vector distance live on unrelated, unbounded scales, and\nposition is the only thing they agree on.\n\nRanking then multiplies three factors:\n\n```\nscore = relevance × signal^0.215 × recency^0.288\n```\n\n`relevance` comes from the query. `signal` (a `fix:` commit outranks a `chore:`; a failed command\noutranks a successful one) and `recency` are priors that hold before any query exists. Each factor is\nfloored into `[floor, 1]` rather than `[0, 1]`, so one weak dimension can't zero out a strong match.\n\nThe exponents bound how far signal and recency, *together*, may overturn relevance: at most a 2× gap\nacross their whole range, applied jointly rather than per-prior. That's deliberate — the score\n*multiplies* the two priors, so capping each at 2× separately still let the pair overturn 4×, and\nthat hit hardest on fresh, high-signal commits made during an active working day. The bug that\nexposed this: two unrelated same-day `fix:` commits outranked the docs section that actually answered\nthe query. See [`retrieval/rank.ts`](src/retrieval/rank.ts) for the full derivation.\n\nWithout Ollama, vector search is skipped and you get BM25 only — fully supported, not a degraded\nstate; `sync` and `query` both succeed and simply do less.\n\n## Session summaries (optional, local model)\n\nWith `sources.session.enabled`, each finished session becomes one distilled node next to the raw\nexchanges — what was decided and why, rather than forty individual turns. It runs a local Ollama\nchat model (`qwen2.5:3b` by default); nothing is downloaded automatically and nothing leaves the\nmachine.\n\n```bash\nnexusmem scan-session --dry-run\n```\n\nThat prints the exact prompt a session would produce, after redaction and budget trimming, without\ncalling the model.\n\nThree things bound the cost. A session is only summarized once it has been quiet for\n`settleMinutes` (default 30), so a session in progress is not re-summarized on every sync. The\nprompt is hashed, and an unchanged hash skips the model entirely — on this repo a steady-state sync\nof 14 summarized sessions takes 0.25s and makes no model calls. And `maxSessions` (default 10) caps\nhow many reach the model per run; the rest are reported as queued and picked up next sync.\n\n**What it is actually like, measured on 14 real sessions with `qwen2.5:3b`.** The summaries\nthemselves are good: decisions with their reasons, in the shape the prompt asks for. Titles are less\nreliable — the model returned a usable one about a third of the time, and otherwise produced a\nconversational preamble, a stray bullet, or a bare \"Summary of the Session\". Those are rejected and\nthe title falls back to the first line of the question that opened the session, which is always\nspecific even when it is not elegant. Compliance was worst on long sessions and on transcripts not\nin English. A larger model (`qwen2.5:7b`) is the lever if the titles matter to you; set\n`sources.session.model`.\n\n## GitHub issues & PRs (optional)\n\nWith `sources.github.enabled`, each issue and PR on this repo's github.com remote becomes one node\n(title, opening post and every comment, folded together) alongside the raw discourse a discussion\nalready leaves in shell/conversation history. Off by default — not for a sensitivity reason, but\nbecause it's the first source with a real external dependency: it reads via the `gh` CLI, so it\nneeds `gh` installed and authenticated (`gh auth login`), and it makes live network calls instead of\nonly reading what's already on disk. A repo with no github.com remote, or an unauthenticated `gh`,\nis a silent no-op either way.\n\n```bash\nnexusmem scan-github\n```\n\npreviews the nodes a sync would produce, same as the other `scan-*` commands. `maxThreads` (default\n100) and `maxCommentsPerThread` (default 100) bound one sync's cost; `since` is tracked as its own\ncursor, so a repeat sync only re-reads threads that changed. Dogfooded against this repo's own 14\nreal issues/PRs: ingest took under a second, and a query for \"labelled retrieval regression corpus\"\ncorrectly ranked issue #8 — the one that asked for it — first.\n\n## Use it from an agent\n\n```json\n{\n  \"mcpServers\": {\n    \"nexusmem\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"nexusmem\", \"mcp\"]\n    }\n  }\n}\n```\n\nThree tools over stdio: `search_memory` returns the packed context block, `sync_project` ingests, and\n`get_status` reports what is currently remembered. Each takes an explicit `projectRoot`, because an\nMCP tool call carries no shell working directory. `sync_project` runs `init` for you if the\nrepository has not been set up.\n\n## What it costs you\n\nTwo numbers get conflated in tools like this, so they are kept apart here.\n\n**Packer efficiency** is how much the ranker trims from its own candidate set. On this repository's\ncorpus it runs 81–84%. It is useful for tuning the ranker and useless as a claim about your bill,\nbecause the baseline is hypothetical: without NexusMem those candidates were never going into your\ncontext window in the first place.\n\n**End-to-end saving** compares the packed context NexusMem actually sends against reading, in full,\nthe same files its own ranking identified as relevant to the query. Measured with\n[`scripts/benchmark.ts`](scripts/benchmark.ts) (`npm run bench`), which anyone who clones this repo\nand points it at a synced corpus can re-run from scratch:\n\n| Corpus | Commits | Query set | vs. full file content | vs. `git log -p` on those files |\n| --- | --- | --- | --- | --- |\n| This repo | 62 | 16 real prompts, verbatim from this project's own history | 95% (median 94%) | 98% (median 97%) |\n| [`vitejs/vite`](https://github.com/vitejs/vite) | 9,567 | 16, mechanically sampled — see below | 99% (median 98%) | ~100% (median ~100%) — see caveat |\n\nBoth clear the original >70% target (\"cut API token spend versus sending full context\"), and the vite\nrun is the first measurement at the scale that target was always described as applying to.\n\n**Read the methodology before quoting either number — it's a narrower claim than it looks:**\n\n- **Graded against NexusMem's own ranking**, not an outside answer key: the file set is whichever\n  files the packed nodes for that query touch. This measures what the pack step saves once retrieval\n  already picked a candidate set; it doesn't independently verify that set was the right one.\n- **Query sets are mechanical, not cherry-picked** (see `scripts/benchmark.ts`): vite's is an even\n  sample of well-explained `fix`/`feat`/`perf`/`refactor` commits plus rationale-bearing doc headings;\n  this repo's reuses real historical prompts verbatim, several of which are broad task instructions\n  rather than narrow questions — part of why its number sits below vite's.\n- **`git log -p` baselines can be enormous** — one vite query's baseline hit 7.5M tokens because a\n  file in its resolved set has that much history. At that scale, \"just read the file's history\n  instead\" stops being a viable alternative at all.\n- **Supersedes the old ~40% figure**, which was hand-tallied from two hand-picked queries against\n  this repo alone with an unstated baseline. Not wrong, just underspecified — this replaces it with a\n  stated method and a script that reproduces it.\n\nOne thing that is not a percentage: shell commands and conversation turns have no cheap `grep`\nequivalent. Without something recording them, they are gone, not merely more expensive to find.\n\nFor how these numbers compare to a similar tool's own claims, see\n[`docs/competitor-comparison.md`](docs/competitor-comparison.md) (vs. projectmem) and\n[`docs/competitor-comparison-yesmem.md`](docs/competitor-comparison-yesmem.md) (vs. YesMem, including\nnative Windows support vs. its documented WSL2 requirement).\n\nLatency on a ~530-node corpus, warm, p50 over 10 runs:\n\n| Operation | |\n| --- | --- |\n| BM25 retrieval (FTS5) | ~1.1 ms |\n| Vector KNN (`sqlite-vec`) | ~3.2 ms |\n| Fuse, rank, pack | ~0.6 ms |\n| Query embedding (local Ollama) | ~55–77 ms |\n| **End-to-end hybrid** | **~56 ms** |\n\nAll the SQLite work totals about 5 ms. The embedding call is the only thing on this path worth\noptimizing, and it is somebody else's process.\n\n## Staleness & provenance\n\nTwo things a memory layer needs and this one only partly has: a way to tell an observed fact from a\nguess, and a way to retire a conclusion once something contradicts it. This section is what exists\nand what doesn't.\n\nEvery node carries a `provenance`, a four-tier trust hierarchy set once per collector at ingest\ntime: `observed` (a commit that landed, a shell command's real exit code) > `authored` (a doc\nsection — a human's own written claim) > `recorded` (a conversation turn — verbatim, but talk about\nevents rather than the events) > `derived` (a session summary — a model's distillation). The tier is\nshown as a tag on every query result and decays retrieval weight — the lower the trust, the faster a\nnode fades from ranking as it ages. The ordering is the design claim; the exact decay ratios are\njudgment calls, not measured optima.\n\n```bash\nnexusmem stale\n```\n\nLists non-`observed` nodes old enough (45+ days by default) that nothing has confirmed they still\nhold — a heuristic on age and provenance, not on content. It writes nothing; you decide which\ncandidates are actually wrong. Any candidate the SLM has already flagged (see below) is decorated\nwith its standing `likely superseded by` suggestion — reading those costs nothing, so the plain\ncommand stays instant and offline.\n\n```bash\nnexusmem mark-stale <oldNodeId> --supersedes <newNodeId>\n```\n\nLinks `newNodeId` as the replacement for `oldNodeId`. The ranker down-weights the old node from then\non (it stays queryable, just usually loses to its replacement) — nothing is deleted, unlike `forget`.\n\n```bash\nnexusmem stale --check-contradictions\n```\n\nFor each candidate, finds the most similar newer node (local embedding search) and asks a local SLM\n(Ollama, `qwen2.5:3b` by default) whether it actually contradicts the older one — real content\ncomparison, not just age. A match is printed as `likely superseded by <id> <title> -- <reason>`\nunder the candidate. Every judgment (either verdict) is memoized, so a judged pair is never sent to\nthe model again; nothing else is written — `supersedes` stays yours to set via `mark-stale`.\n\n**This also runs automatically during `sync`** — at most 3 new judgments per run (configurable via\nthe `contradictions` block in `.nexusmem/config.json`; set `autoCheck: false` to turn it off), only\nwhen the embedding provider was reachable anyway, and free on repeat syncs thanks to the\nmemoization. New and open suggestions show up in the sync summary, `nexusmem status` (a `flagged`\nline), and plain `nexusmem stale`.\n\n**What this doesn't do:** it is one small model's yes/no judgment on one older/newer pair, not a\nverified fact — treat a match as a lead to check, not a conclusion. It also only ever compares a\ncandidate against nodes *found by embedding similarity*; a contradiction from an unrelated-sounding\nnode would never surface. Comprehensive contradiction detection (not just for the pair the vector\nsearch happens to surface) is still an open problem, and nothing here supersedes a node on its own.\n\n`provenance` is a separate question from `trust_state`: provenance says where a claim came from,\nnever whether anyone checked it.\n\n```bash\nnexusmem review <nodeId> --verify\nnexusmem review <nodeId> --reject\n```\n\nRecords your own verdict on one node, independent of the SLM contradiction checker above (which only\never writes a suggestion, never a verdict). `--reject` down-weights the node in ranking — same\ndemote-not-delete rule as `mark-stale`, it stays queryable, just usually loses to better matches —\nand both verdicts are shown as a `[verified]`/`[rejected]` tag on every query result that returns the\nnode afterward. `--verify` is a label only; it does not boost ranking. Every node starts `candidate`\n(untagged) until reviewed, and a re-sync never overwrites a verdict once one is set.\n\n## Where it breaks\n\n- **Shell history without the hook is unscoped.** Scraped history has no directory context, so it is\n  attributed to whichever repository you ran `sync` from. Bounded to a tail window, and an\n  approximation rather than a guarantee.\n- **Japanese and Chinese depend on the vector pass.** FTS5's `unicode61` tokenizer splits on\n  whitespace, so languages without space boundaries get no useful BM25 recall.\n- **Rebasing strands nodes.** Rewritten history leaves nodes for unreachable commits. They describe\n  real events so they are not wrong, but a targeted prune does not exist yet. `sync --rebuild`\n  forces a clean re-scan.\n- **Multi-line PowerShell input is read as separate commands.** A function typed across several lines\n  at the prompt is not reconstructed.\n- **Scrape-fallback ids drift** if the history file is trimmed from the front between syncs.\n  Installing the hook fixes this.\n- **Session-summary titles depend on the model following instructions**, and a 3B model often does\n  not. The fallback keeps them specific rather than generic, but see the section above for what to\n  expect.\n- **Changing the embedding model re-embeds everything.** Vectors from two models are not comparable\n  and `nodes_vec` records no per-row provenance, so `sync` drops the lot and rebuilds rather than\n  ranking across a mixture. It says so when it happens. Nodes are untouched and BM25 keeps working\n  throughout.\n- **Diff indexing is bounded, and deliberately lossy.** A first sync indexes the patches of the most\n  recent 200 commits (later syncs only walk `cursor..HEAD`); merge commits contribute none, since\n  their patch exists only in a combined format this parser does not read; and binaries, lockfiles and\n  build output are skipped so a dependency bump cannot bury the corpus. All of it is still recorded\n  as a `git_commit` node. A patch longer than `limits.maxBodyChars` is truncated, so the tail of a\n  very large change is not indexed. The caps live under `sources.diff` in `config.json`.\n- **Cross-project recall favours breadth.** Each repository's hits are fused by rank, so a project\n  whose best match is mediocre still contributes a rank-1 item, and rank 1 is worth the same in\n  every list. Adding a repository that has little to say about your question still pushes a few of\n  its results into the budget. Signal, recency and the budget are what hold that in check; there is\n  no per-project quality weight.\n- **The project registry is an index, not a source of truth.** It can point at a database that has\n  moved or been deleted; those are reported and skipped, never silently pruned, because an\n  unmounted drive is not a deleted project.\n- **Conversation chunking is unevaluated.** Splitting long replies at heading boundaries measurably\n  helped, but it has never been tested systematically.\n- **A chunked node's sibling count in one result is capped, not tuned.** `conversation_turn` and\n  `doc_section` both split one reply or file into several nodes; at most 2 of them may appear\n  together in a packed result. Found live: a query for \"token\" returned 9 of its top 12 hits as\n  different pieces of one heavily-sectioned reply, crowding out the node that actually answered it.\n  The cap of 2 is a judgement call, not a measured optimum, same as the ranking priors' budget above.\n- **The size of the prior budget is a judgement call, not a measured optimum.** Priors are now\n  bounded jointly rather than one at a time, which closed a real 4× hole (see the ranking section),\n  but the 2× budget itself has never been tuned against a labelled relevance set — there isn't one.\n  It is a defensible constant, not a result. What is measured is the direction: on four real queries\n  against this repo's own memory, switching to the joint cap moved the section that answered the\n  question up in three of them (the rationale section for \"why BM25 before vector search\" went from\n  rank 4 to rank 1) and displaced no query's correct top hit.\n- **`forget` is per-repository, not global.** Its deny-list lives in the one `.nexusmem/memory.db` it\n  ran against (plus that repo's stale prior identities, same scope `--prune-source` already uses). A\n  value that leaked into shell history from several repositories needs `forget` run once per repo —\n  there is no shared, machine-wide deny-list across every project you have synced.\n- **A deny-list doesn't survive a clone or restore on its own.** `.nexusmem/` is gitignored by design,\n  so `deny_list` never travels with `git clone`/`git push` — while git history itself, the thing a\n  fresh `sync` re-derives from, is fully portable and copied by every clone. A teammate's fresh\n  checkout, a new machine, or a restored backup starts with zero protection: the forgotten value comes\n  right back on the first sync. Confirmed live 2026-08-17, not just a theoretical read of the code.\n  `forget --export <path>` / `forget --import <path>` close this: export writes the active entries to\n  a plaintext JSON file you move through a channel you control (never git — the file is exactly as\n  sensitive as the value it holds), and import re-applies them in the new checkout, deleting any\n  copies that already synced back in. It is deliberately manual, not automatic on every `sync`.\n\n## Commands\n\n`init`, `sync`, `query <text>` (add `--as-of <date>` for a bi-temporal read, see below), `status` (add\n`--share` for a plain-text summary worth pasting somewhere), `projects`, `mcp`, `forget <value>`,\n`stale` (add `--check-contradictions` for a local-SLM content check, see above), `mark-stale\n<nodeId> --supersedes <newNodeId>`, `review <nodeId> --verify|--reject` (record a human verdict on\none node, see above), `precheck` (advisory — warns about staged files with an unresolved past\nfailure or high recent churn; exits 0 unless `--strict`), `hook install|remove|status` (the\nPowerShell exit-code hook), `hook git install|remove|status` (a git pre-commit hook that runs\n`precheck` before each commit), and `hook git-post install|remove|status` (a git post-commit hook\nthat runs a full `sync`, including embedding, in the background after each commit — detached, so it\nnever makes `git commit` itself wait; a burst of commits coalesces into one sync via `sync --auto`'s\nlock instead of piling up).\n\nThere are also eight dry-run previews (`scan-git`, `scan-diff`, `scan-shell`, `scan-docs`,\n`scan-conversation`, `scan-session`, `scan-github`, `scan-structure`) that write nothing and print\nwhat ingestion *would* produce — nodes and their signal scores for the first seven, import-graph\nedges for `scan-structure`. That is the intended way to tune scoring against a real repository\nbefore committing to a change. Add `--json` to pipe them somewhere.\n\nEvery command takes `-C <path>` to target another repository. On `sync`, `--conversation` and\n`--github` opt their (opt-in) sources in for one run without persisting it, `--no-embed` skips the\nvector pass, `--link-failures` builds the failure → fix chains described above, and `--rebuild`\ndrops the project's nodes and re-ingests from scratch.\n\n`sync --prune-source <name>` deletes an entire collector source (e.g. `shell:pwsh`); `forget <value>`\nis the finer-grained complement — it deletes every node matching one exact string (or `--regex`\npattern) *and* writes a standing deny-list entry so the value can never be re-ingested, even by a\nlater `sync --rebuild` re-reading the append-only shell-hook log or a full transcript scan. Every\nremoval leaves a hash-only tombstone, never the forgotten content itself. Both are dry-run by\ndefault; `--yes` confirms. `forget --list` shows active entries; `forget --export <path>` /\n`forget --import <path>` carry them to another checkout of the same repo (see the limitation above).\nSee [`docs/forget-mechanism.md`](docs/forget-mechanism.md) for why this exists.\n\n## Recall across projects\n\n`query --all-projects` searches every repository you have run NexusMem in, not just the current one,\nand tags each result with the repository it came from:\n\n```\n$ nexusmem query --all-projects \"why was the retry budget raised\"\nscope   2 project(s): NexusMem, uploader\n\n- 2026-08-12 [observed] [uploader] fix: raise the retry budget after the S3 upload timeouts\n- 2026-08-12 [observed] [uploader] retry.ts @ 8d0f98b — fix: raise the retry budget after the S3 upload timeouts\n  @@ -1 +1 @@\n  -export const RETRY_BUDGET = 3;\n  +export const RETRY_BUDGET = 5;\n- 2026-08-09 [observed] [NexusMem] fix(git): retry a transient failure to spawn git\n```\n\n## Bi-temporal reads\n\nEvery node carries two clocks: `ts`, the event's own time (\"what happened then\"), and `created_at`,\nthe moment the store actually recorded it (\"what did the store hold then\") — normally the same\nquestion, but not when a sync runs late, a backfill lands weeks after the events it describes, or a\nteammate's clone catches up all at once. `query`/`search_memory` answer the first by default;\n`--as-of <date>` switches to the second:\n\n```bash\nnexusmem query \"why does the ranker cap joint priors\" --as-of 2026-08-10\n```\n\nOnly nodes recorded at or before that instant are considered, even if the events they describe are\nolder still. There is no equivalent write — this is a read-time filter over `created_at`, not a\nsnapshot or a way to query a value that has since changed, since nodes are write-once (see\n[Staleness & provenance](#staleness--provenance) for what changes a node's *weight*, not its\nrecord).\n\nDatabases stay per-repository — there is no shared global store, and deleting one repo's\n`.nexusmem/` still removes exactly that repo's memory. What makes the others findable is a plain\nindex at `~/.nexusmem/projects.json`, written by `init` and refreshed by every `sync`. `nexusmem\nprojects` shows what is in it, and `--prune` forgets entries whose database is gone.\n\nRanking across repositories uses reciprocal rank fusion per project rather than raw BM25, because a\nBM25 cost is computed against its own corpus and means different things in a 50-node and a\n50,000-node database. The trade is stated in *Where it breaks*.\n\nThe MCP `search_memory` tool takes the same switch as `allProjects: true`.\n\n## On disk\n\n```\n<repo>/.nexusmem/\n  .gitignore     '*' — the workspace ignores itself, so init never edits a file it doesn't own\n  config.json    validated on read; a corrupt config fails loudly rather than silently\n  memory.db      SQLite in WAL mode\n\n~/.nexusmem/\n  projects.json      which repositories exist, for cross-project recall; a corrupt one reads as empty\n  shell-history.jsonl  the hook's log, if you installed it\n```\n\n`NEXUSMEM_HOME` overrides the user-scoped directory.\n\nNode ids are content-addressed from `sha256(projectId + kind + naturalKey)`, so running `sync` twice\ncannot produce duplicates and ingestion stays correct even if a cursor is lost. Project identity\ncomes from the normalized origin URL when there is one, falling back to the absolute path, so two\nclones of the same repo share one memory namespace.\n\nDeleting `.nexusmem/` loses nothing that `sync` cannot rebuild.\n\n## Status\n\nIngestion, hybrid retrieval, budgeted packing and the MCP server all work and are covered by 701\ntests running on Linux and Windows across Node 22 and 24.\n\n## Development\n\n```bash\nnpm install\nnpm run typecheck\nnpm test\nnpm run build\n```\n\nTests are behavioral rather than snapshot-based, and several are regressions tied to specific\nobserved failures. `tests/git-errors.test.ts` injects a fake `spawn` to exercise the Windows\nprocess-spawn faults, which cannot be provoked on demand.\n\nBug fixes, test coverage, and small focused features are welcome — see\n[CONTRIBUTING.md](CONTRIBUTING.md) for the workflow, or browse issues labeled\n[`good first issue`](https://github.com/yaminbkk/nexusmem/labels/good%20first%20issue)\nfor something scoped and self-contained to start with.\n\n## On how this was built\n\nThis started as an experiment in whether a local context-memory engine for coding agents was viable,\nprototyped with Claude Code. The code was written through AI-assisted workflows; the architecture,\nthe design decisions and the specifications were human-directed.\n\nThat is worth stating plainly because it should change how you read the code, not whether you trust\nit. Audits, corrections and PRs are genuinely welcome, and the commit history is deliberately\ndetailed about *why* things are the way they are, including the times an earlier assumption turned\nout to be wrong.\n\n## License\n\nMIT\n",
  "bytes": 31909,
  "sha": "dfcc14b842dc6c0861a607f0480699c5bc7d83fe52fd59fffc62cc4059ccb468",
  "repo_slug": "yaminbkk/nexusmem",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_yaminbkk_nexusmem_3fbdc35d/readme"
}