Repository navigation
v1.39.0 - Context integrity gates
Open Second Brain v1.39.0 - Context integrity gates
Ten defects in the read and delivery path used to degrade quietly, and in every one of them an agent could not tell a genuine miss from a broken mechanism: owner-scoped isolation was enforced on one surface out of thirteen, a context pack carried no record of the vault state it was built from, session continuation resolved ambiguity by picking the most recent candidate, the lineage ledger lost history on compaction and had no writer lock, an embedding store written against a different model or sqlite-vec ABI returned zero or garbage neighbours with nothing checking on the read path, a frontmatter line the parser did not understand vanished without a trace, nothing counted broken links vault-wide, nothing measured the SessionStart injection, nothing joined retrieval receipts across a session, and a mis-resolved vault root was materialized by the first write while the doctor reported it clean. This release converts each of those into an explicit, named one. Two shared seams carry the wave - a closed-vocabulary degradation channel and a stamp-and-compare module whose gates the operator sets to off, warn, or fail. The kernel still calls no LLM, and every new surface is byte-identical when its flag, argument, or config key is absent.
What ships
- A closed isolation boundary.
isOwnerVisiblehad two callers in the whole codebase; eleven more content-returning MCP tools now honour a scope, alongside--agent-scopeono2b search query,o2b search expand, ando2b brain sgrep. Ownership fails closed: a page whose frontmatter cannot be read, and a page whoseowner:is present but not a plain string - the shape Obsidian Properties writes for any list-valued field - is withheld from a scoped caller rather than shared with everyone.brain_search_expandon another owner's chunk now raises the same error as a genuinely missing chunk, closing an enumeration surface over sequential integer ids. A table-driven test partitions all 108 tools into scoped, deliberately-unscoped-with-a-recorded-reason, and non-content, and fails until a new tool is classified. - No stale context served as current. A pack records the index corpus generation plus a digest over the directories it walked, and an expiry from
integrity.pack_validity_seconds. The anticipatory cache stores both and refuses a drifted or expired entry as a miss naming the reason, instead of quietly rebuilding; its schema version bumped so pre-existing cache files read as misses rather than un-stamped hits. - No wrong-but-plausible session resume. The crutch resolver returns a named outcome - linked, or an abstention naming
no-candidate,self-known,no-workspace,ambiguous,stale, orevidence-missing- instead of a barenullwhose four causes were indistinguishable. Two concurrent sessions in one directory now both abstain where one was previously stitched to the other. Repo, branch, and commit joincwdas required-match predicates, and a remote carrying credentials canonicalizes to the same identity as the same repository cloned without them, with the credential never reaching a recorded field. - A ledger that keeps what it recorded. Sequence numbers, a hash chain, a writer lock, and compaction that retains recent lines verbatim instead of folding one summary line per session - so
firstSeenMs, per-session event history, and any field a later writer adds all survive. A dropped write is recorded as a named gap and excluded from continuation matching, so a lost observation can never become a false stitch. A tampered, truncated, or unreadable ledger is reported by verification and still resolves. - Memory that cannot land in the wrong vault.
o2b brain initstamps an idempotent identity marker; Brain writers compare it ahead of their first byte, and a present-but-different marker refuses with a named error. Of 106 write-capable modules, 97 carry the guard and nine are excluded with a stated reason - measured by a census test that names any module that slips. - Diagnostics with a name and a consumer. A frontmatter line the scanner drops is reported by
o2b search indexand byo2b brain doctor, naming the file, the line number, and the text. The doctor's newuncertainstream also carries ledger findings, stale lock files, and a missing vault marker, and it reachesbrain_doctorover MCP - not only a human at a terminal. - A regression barrier on link rot. A deterministic count of link rows the read-time resolution ladder cannot resolve, compared against a committed ceiling that may only fall, gated in CI by the same code path that writes it.
Process wins
- Two independent adversarial reviews of the full diff against
mainfound fourteen confirmed defects, all fixed before merge. Four of them had survived an earlier review pass because the tests asserted only that a call threw - while the bytes had already landed in the wrong vault. The regression harness now digests the vault tree before the refused call and compares after it, and asserts the bytes before asserting the throw. - Three premises recorded during triage turned out to be false and were corrected rather than implemented: a malformed frontmatter block does not drop the note (the scanner cannot fail, so it silently discards lines instead), the "invalid YAML" branch in the Claude-memory parser was unreachable dead code, and no vault-wide broken-link count existed at all.
- One design decision was reversed by measurement. The ratchet first counted raw SQL nulls, which made every link row in the starter vault "broken" and would have fired on healthy edits - a gate that gets routinely bumped is noise. The definition token in the ceiling file exists precisely so that change is explicit rather than mistakable for link rot.
- Four source files carried literal NUL bytes that made git treat them as binary and made
grepskip them silently. The defect was found while counting guard coverage, because two modules were invisible to the census.
Notes
- 7260 tests pass, against 6808 on the previous release; lint holds the exact 134-warning baseline; the version bump rode inside the feature pull request per repository policy.
- Limits, stated deliberately, because a release about not concealing degradation cannot overstate its own reach:
owner_scope_deliverydefaults tooffand no writer surface setsowner:today, so an untouched vault gains capability rather than changed behaviour; the link-ratchet ceiling measures thetemplates/brain-starterrepository template, not any operator's vault; the lineage writer lock has no retry, so concurrent sessions can drop lifecycle observations, each named in a gap sidecar; compaction retention changed from 256 sessions to 256 lines; fivebrain_briefviews reject an explicitagent_scoperather than honouring it; ando2b brain doctor --strictnow exits 2 on an un-initialized vault where it previously exited 0. - Under the default
warn, an embedding-ABI drift is reported byo2b search status, byo2b search check(ungated, since it is a diagnostic the operator ran deliberately), and on the MCP status surface. Nothing is rebuilt automatically: the existing self-heal path rebuilds keyword data only and would leave stale vectors in place, so this release reports rather than pretending to heal.
