nexusmem 0.1.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,182 @@
1
+ # Changelog
2
+
3
+ Notable changes per published version. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/);
4
+ this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ Tags were added retroactively on 2026-08-11 and point at the exact commits the npm tarballs were
7
+ built from, matched by publish timestamp: `v0.1.0` → `67a4776`, `v0.1.1` → `809e62c`,
8
+ `v0.1.2` → `b22a3b0`.
9
+
10
+ ## [Unreleased]
11
+
12
+ ## [0.3.0] — 2026-08-13
13
+
14
+ **Upgrade note.** The first `sync` after upgrading drops every stored embedding and rebuilds it.
15
+ This is not optional and it is not a bug: embeddings now come from Ollama's `/api/embed`, which
16
+ returns L2-normalised vectors, while the previous `/api/embeddings` did not — measured norms of 1.0
17
+ and 20.7 for the same input. `nodes_vec` ranks by Euclidean distance and records no per-row
18
+ provenance, so a corpus holding both would separate by scale rather than by meaning. `sync` says
19
+ what it dropped, nodes are untouched, and BM25 keeps working while the rebuild runs. On this repo
20
+ the rebuild was 833 nodes in one pass, inside a 9-second sync.
21
+
22
+ ### Added
23
+
24
+ - **Session summaries via a local model** (`sources.session`, opt-in, off by default). Each
25
+ finished session becomes one distilled `session_summary` node — decisions and their reasons —
26
+ alongside the raw exchanges. Runs a local Ollama chat model (`qwen2.5:3b` by default); nothing is
27
+ downloaded automatically and no transcript leaves the machine. New `scan-session` command, with
28
+ `--dry-run` to print the exact prompt a session would produce without calling the model.
29
+ Bounded three ways: a session must be quiet for `settleMinutes` (default 30) before it is
30
+ eligible, the prompt is hashed so an unchanged session never reaches the model again, and
31
+ `maxSessions` caps how many are summarized per sync. Every exchange is redacted before the model
32
+ sees it, and the model's own output is redacted again before it is stored.
33
+ - **`sync --embed-limit <n>`** to cap the embedding pass, for when draining the whole backlog is not
34
+ wanted.
35
+
36
+ ### Changed
37
+
38
+ - **The embedding pass drains the backlog in one `sync`** instead of stopping after 200 nodes, and
39
+ sends texts to Ollama in batches of 32 — measured at 4.21x the throughput of one call per node
40
+ (20.3ms → 4.8ms per node, over 96 real nodes from this repo). Leaving it uncapped is safe because
41
+ paging walks rowids monotonically, so a node the provider failed on is passed over rather than
42
+ retried forever, and because three consecutive dead requests end the pass: an Ollama that is not
43
+ running now costs three requests rather than one timeout per node.
44
+ - **Embeddings carry a provider identity.** Changing the embedding model, or upgrading from a
45
+ release that recorded no identity, drops the vectors and re-embeds rather than ranking across a
46
+ mixture.
47
+ - **Ranking priors now share one budget instead of getting one each.** `signal` and `recency` are
48
+ query-independent, and each was separately capped at overturning a 2× relevance gap. The score
49
+ multiplies them, so together they could overturn 4× — which is not a corner case but a description
50
+ of every commit made during an active working day, fresh and high-signal at once. A query about the
51
+ PowerShell hook returned two unrelated same-day `fix:` commits at ranks 3 and 4 while the section
52
+ that answered it sat at rank 6. The 2× budget is now the bound on the priors *jointly*, split
53
+ between them (`signal^0.215 × recency^0.288`, down from `^0.431` and `^0.576`), and a third prior
54
+ would re-divide the same budget rather than enlarge it. Measured on four real queries against this
55
+ repository's memory: the answering section rose in three of them — the rationale for "why BM25
56
+ before vector search" went from rank 4 to rank 1 — and no query's correct top hit was displaced.
57
+
58
+ ### Known limitation
59
+
60
+ - Session-summary *titles* depend on the model following a fixed output format, and a 3B model often
61
+ does not. Measured over 14 real sessions, roughly a third came back usable; the rest were
62
+ conversational preambles, stray bullets, or a bare "Summary of the Session". Those are rejected
63
+ and the title falls back to the first line of the question that opened the session — always
64
+ specific, not always elegant. Compliance was worst on long sessions and on transcripts not in
65
+ English. `sources.session.model` takes a larger model if it matters.
66
+
67
+ ## [0.2.0] — 2026-08-12
68
+
69
+ **Upgrade note.** Both new sources are on by default, so the first `sync` after upgrading an
70
+ existing project ingests the patches of its 200 most recent commits and starts recording the
71
+ repository in `~/.nexusmem/projects.json`. Set `sources.diff.enabled` to `false` in
72
+ `.nexusmem/config.json` if you would rather not, and `NEXUSMEM_HOME` relocates the user-scoped
73
+ directory. Nothing existing is rewritten or lost.
74
+
75
+ ### Added
76
+
77
+ - **Diff-level nodes.** Commit patches are now indexed, one node per changed file, so a question
78
+ about *what the change looked like* reaches the lines themselves rather than the commit message
79
+ and a `+41/-6` summary. New `code_diff` kind, `diff` source, `scan-diff` preview command, and a
80
+ `sources.diff` config block. Read by a second `git log --patch` walk with its own cursor: folding
81
+ it into the existing `--numstat` walk would put patch text and numstat rows in one field, where a
82
+ diff line reading `-1\t2\tfoo` is indistinguishable from a real file entry.
83
+ Bounded on purpose — 200 commits on a first sync, 20 files per commit, no merges (their patch
84
+ exists only in a combined format this parser does not read), and binaries, lockfiles and build
85
+ output skipped. Patches are redacted with the shape-matching rules only; the key/value rule that
86
+ serves prose would rewrite `const apiKey = process.env.SERVICE_API_KEY` into a redaction marker.
87
+ - **Cross-project recall.** `query --all-projects` (and `search_memory`'s `allProjects`) searches
88
+ every repository NexusMem has been run in on this machine, tagging each result with the repository
89
+ it came from. Databases stay per-repository — a shared global store was rejected for giving up the
90
+ property that deleting one repo's `.nexusmem/` removes that repo's memory and nothing else — so a
91
+ plain index at `~/.nexusmem/projects.json`, written by `init` and refreshed by `sync`, is what
92
+ makes the others findable. New `projects` command lists it; `--prune` forgets entries whose
93
+ database is gone. A stale or corrupt registry degrades the query, never fails it.
94
+ Ranking fuses each project's list by rank (RRF) instead of comparing raw BM25 costs, which are
95
+ computed against their own corpus and are not comparable across databases. The bias this leaves —
96
+ every project's rank-1 hit is worth the same, so recall favours breadth — is documented rather
97
+ than hidden.
98
+ - **Query-aware diff excerpts.** A packed summary is ~320 characters and a patch is thousands, so
99
+ the packer now picks the hunk whose tokens match the query and starts the excerpt at the changed
100
+ line. Found by dogfooding: "what flags are passed to every git invocation" retrieved the right
101
+ file and then spent the whole summary on a class definition seventy lines above the answer.
102
+ Matching splits identifiers on case and underscore boundaries, because `\bretry\b` does not match
103
+ `RETRY_DELAYS_MS` and a natural-language question otherwise never meets the code it is about.
104
+ - `CHANGELOG.md` now ships inside the npm tarball. npm's always-included list covers `package.json`,
105
+ `README` and `LICENSE` but not the changelog, so it previously reached GitHub readers only.
106
+
107
+ ### Internal
108
+
109
+ - The test suite no longer writes to the developer's real `~/.nexusmem`. `sync` records the
110
+ repository it ingested in the project registry, and the suite syncs temporary repositories in
111
+ several places, so a green run left seven dead entries behind — found by running `nexusmem
112
+ projects` after the fact, not by any test. `tests/setup.ts` now points `NEXUSMEM_HOME` at a
113
+ throwaway directory for the whole suite, and one test fails if that guard is ever removed.
114
+ - `npm run smoke` drives the *packaged* artifact: build, pack, install into a throwaway directory,
115
+ then run the installed CLI, an end-to-end ingest/query against a fixture repository, and an
116
+ `initialize` handshake over real stdio. It also audits the manifest `npm publish` would send,
117
+ which is a different artifact from the tarball. Both defects that ever reached npm users passed a
118
+ green unit suite first; each is now pinned by a check verified to fail when the defect is
119
+ reintroduced. Runs in CI on Linux and Windows as its own job.
120
+
121
+ ## [0.1.2] — 2026-08-10
122
+
123
+ ### Fixed
124
+
125
+ - `nexusmem --version` printed `0.1.0` on 0.1.1. The version string in `src/cli/index.ts` was a
126
+ literal separate from `package.json`, and the 0.1.1 bump only touched the latter. `src/mcp/server.ts`
127
+ had the same problem in its `McpServer` constructor, so an MCP client's `initialize` handshake
128
+ would have reported the same stale version. Both now read the real version through
129
+ `readOwnVersion()` in `src/core/version.ts`, which resolves `package.json` via `import.meta.url`.
130
+ Found by running the published package end to end rather than trusting `npm publish --dry-run`
131
+ and the registry API, neither of which executes a `--version` flag.
132
+
133
+ The ingestion and retrieval pipeline was never affected — only the two places that report a version
134
+ independently of running a command.
135
+
136
+ ## [0.1.1] — 2026-08-10
137
+
138
+ ### Changed
139
+
140
+ - README rewritten for someone deciding whether to read the source: what it does, how retrieval
141
+ scores, what it costs, and where it breaks. `README.md` ships inside the package, so this is a
142
+ real change to what npm delivers — but no code changed between 0.1.0 and 0.1.1.
143
+ - Documented the ranking flaw the tool found in itself, and the fact that the conversation source
144
+ in the sample `status` output is opt-in rather than default.
145
+ - Dropped `&&` from the quickstart, which Windows PowerShell 5.1 cannot parse.
146
+
147
+ ## [0.1.0] — 2026-08-10
148
+
149
+ First public release.
150
+
151
+ ### Added
152
+
153
+ - **Collectors.** Git history (commit metadata and diff stats, not diff bodies), shell commands with
154
+ exit codes via an opt-in PowerShell hook, tracked markdown docs via `git ls-files -- '*.md'`, and
155
+ opt-in assistant transcripts.
156
+ - **Hybrid retrieval.** SQLite FTS5 BM25 and `sqlite-vec` KNN over 768-dim embeddings, fused with
157
+ reciprocal rank fusion, then ranked by relevance against signal and recency priors and packed into
158
+ an explicit token budget.
159
+ - **MCP server** over stdio (`nexusmem mcp`) exposing `search_memory`, `sync_project` and
160
+ `get_status`, for Claude Desktop, Cursor, Windsurf and other MCP clients.
161
+ - **CLI**: `init`, `sync`, `query`, `status`, `mcp`, and `hook install|remove|status`, plus four
162
+ dry-run previews — `scan-git`, `scan-shell`, `scan-docs`, `scan-conversation` — that write nothing
163
+ and print the nodes ingestion would create with their signal scores.
164
+ - Content-addressed node ids (`sha256(projectId + kind + naturalKey)`), so `sync` is idempotent and
165
+ two clones of one repository share a memory namespace.
166
+ - Everything stays on the machine: one SQLite database in WAL mode under `<repo>/.nexusmem/`.
167
+
168
+ ### Notes
169
+
170
+ - Requires Node **>= 22**. `better-sqlite3` 12.11.1 publishes no prebuilt binary for Node 20 — its
171
+ prebuilds start at ABI 127 — so a lower floor would have been a promise the package could not keep.
172
+ Do not lower it without checking upstream prebuilds first.
173
+ - Not done at this release: diff bodies are not indexed, queries are scoped to a single project,
174
+ there is no local-model summarization pass, and the conversation collector has never been audited
175
+ for the stale-node bug that was found and fixed in the docs collector.
176
+
177
+ [Unreleased]: https://github.com/yaminbakoh4-dot/NexusMem/compare/v0.3.0...HEAD
178
+ [0.3.0]: https://github.com/yaminbakoh4-dot/NexusMem/compare/v0.2.0...v0.3.0
179
+ [0.2.0]: https://github.com/yaminbakoh4-dot/NexusMem/compare/v0.1.2...v0.2.0
180
+ [0.1.2]: https://github.com/yaminbakoh4-dot/NexusMem/compare/v0.1.1...v0.1.2
181
+ [0.1.1]: https://github.com/yaminbakoh4-dot/NexusMem/compare/v0.1.0...v0.1.1
182
+ [0.1.0]: https://github.com/yaminbakoh4-dot/NexusMem/releases/tag/v0.1.0