Local-first 🧠memory for Hermes Agent that lives in your Obsidian vault and remembers project context. Nightly 😴 dream passes turn repeat corrections into confirmed preferences with measurable confidence. Adapters ship for Claude Code, Codex, and OpenClaw, with an MCP server for anything else.
TypeScript
fix(search): release the staging DB's zombie handle before the Windows rename swap (#288)
Chris Ne44aceb8bbcf
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9c164ab5..be7462d6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- **Brain store hardening.** Readers that show log events, or numbers derived from them, to a caller below local reach now withhold events of the `private` partition, and a census test fails on any new log reader that has not been classified. `brain_doctor` names each shard that reads only in part by kind, offset and repair command, and `o2b store shard quarantine|list|release` skips one bad line on this machine without touching the shard (a line of a newer format is never skipped, a pending blob only after seven days and never in `settings`). `o2b store partition leave <partition>` takes a partition off this machine on purpose, and the error that names a lost partition names the verb. A `lane-entry` record keeps the file's text in an optional `raw` field when its fields and text do not reproduce it, so a lane file written as text reads back byte for byte, also after a rollback; the format version does not change.+### Fixed++- **Windows: `o2b search reindex` no longer fails with `EBUSY` on its own staging file.** A `bun:sqlite` connection with unfinalized statements survives `close()` until garbage collection and keeps `brain.sqlite.new` open, so the rename swap failed on every attempt on Windows (POSIX `rename(2)` ignores open handles). The rebuild now forces a collection cycle right before the swap renames.+## [1.98.0] - 2026-11-02Open Second Brain 1.98.0 is the agent-presence and self-improvement release: the vault states its usage where the agents that read it actually look, and its skills improve only under evidence. The install path closes its own gap - `o2b install --target <host> --apply` now writes the brain-usage block into the agent-instruction file the installed host reads at the vault root, through a shared managed-block writer that preserves every byte outside the block, refuses a hand-edited block by name, and records its ownership so uninstall removes exactly the pair the tool wrote. The dream pass gains an operator-approved exit into those same files: a lesson promotes into a managed lessons block only when the full qualification holds and a fresh approval pins the approved text, every non-member carries one named blocked reason, and the doctor grades every block state it can name. The skill lane gains a benchmark-gated rewrite loop where a skill is rewritten only after a candidate beats the incumbent on scored dev tasks with full coverage and survives the one held-out check - Open Second Brain never calls a model, the calling agent executes the task envelopes, the scorer reads structural predicates and nothing the agent claims about its own work, the accept stays an operator step on the command line, and the incumbent's bytes ride a content-restoring rollback journal until the sequence settles. And ChatGPT desktop is named where its operators look for it: it reads the shared Codex config, and the detect output and install docs say so.diff --git a/src/core/search/indexer.ts b/src/core/search/indexer.tsindex a58c8ae3..18fbc25e 100644--- a/src/core/search/indexer.ts+++ b/src/core/search/indexer.ts@@ -1603,6 +1603,13 @@ async function reindexInto(// for the swap and removed once the swap succeeds; a crash between the// renames leaves it at `.old`, which the next Store.open restores in// preference to the older `.bak` (restoreFromBakIfMissing).+ // Windows: a bun:sqlite connection with unfinalized statements survives+ // close() as a zombie holding the staging DB handle until GC, so the+ // rename swap below fails EBUSY against the process's OWN handle (POSIX+ // is unaffected - rename(2) ignores open handles). Force collection to+ // release finalizer-pending handles before the renames.+ if (typeof Bun !== "undefined") Bun.gc(true);+ else (globalThis as { gc?: () => void }).gc?.();progress.start(INDEX_STAGE.swap, 1);const keepBak = countStoredEmbeddings(bakPath) > countStoredEmbeddings(config.dbPath);const parkPath = keepBak ? config.dbPath + ".old" : bakPath;