Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.30.0 chore(release): fix wave 6 version stamps, CHANGELOG, upgrade note and regenerated bundles

garrytana267370289f0
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index 23c73bd5fc..da1215e4fe 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index ef91e40c71..6cccef2633 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.",
"author": {
"name": "Garry Tan",
diff --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.md
index 3f7cf45bc4..5ca737791e 100644
--- a/BOOTSTRAP_FOR_AGENTS.md
+++ b/BOOTSTRAP_FOR_AGENTS.md
@@ -1,4 +1,4 @@
-<!-- gbrain-runbook-stamp: 0.60.28.0 -->
+<!-- gbrain-runbook-stamp: 0.60.30.0 -->
<!-- This stamp must equal the VERSION file at every release; CI enforces it
(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it to
the installed binary and warns on skew. -->
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 244039a5cd..01a8e265a4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,125 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.30.0] - 2026-10-01
+
+**Fix wave 6: two privacy leaks closed, "who invested" and "who attended" answer the right way round, facts saved without a person get one, contradiction checks get much more accurate, and hybrid search on big Postgres brains stops falling back to keyword-only.**
+
+Two privacy fixes first. An agent connected over MCP could read a personal-profile value that had been saved as private, such as a risk tolerance or a decision style, through the ontology tools. Remote callers now see only shared values, like recall. And a fact you told gbrain to forget could still show up in the agent's hot-memory block for up to 30 seconds after the forget, or longer when the forget ran from another process. Every write and forget now clears that cache, on every transport.
+
+The graph stored some relationships backwards. A company page listing `investors: [Bob]` saved "the company invested in Bob", so "Who invested in Gamma?" found nobody. Meetings had the same problem, and on top of that, every person mentioned anywhere in a meeting note was marked as an attendee. Now the investor, partner and attendee links point from the person to the page, and only an explicit attendee list makes someone an attendee. Existing brains re-derive their links once; the commands are below.
+
+Facts saved with no entity used to be invisible to entity recall and skipped by the conflict checker. One production brain had 23% of its facts in that state. `remember` and imports now link a fact when it names exactly one known person or company, and the new `gbrain facts relink` repairs the backlog.
+
+The contradiction judge now needs two different times before it calls something a change over time, and treats look-alike names as different people. On a fresh test world it caught 131 of 150 planted conflicts (was 101) and raised 11 false alarms in 820 unrelated pairs (was 59).
+
+| After upgrading | Before | After |
+| --- | --- | --- |
+| A remote agent reads a private profile value | shown | hidden |
+| Hot memory right after `forget` | kept the fact up to 30 s | fact gone |
+| "Who invested in X?" from frontmatter investors | no answer | the investors |
+| A person only mentioned in meeting notes | typed attended | a mention |
+| A fact with no entity | unlinked, never conflict-checked | linked when one known entity is named |
+| Contradiction judge, same-time conflicts caught | 101/150 | 131/150 |
+| Contradiction judge, false alarms on unrelated pairs | 59/820 | 11/820 |
+| Vector search on a 160k-chunk Postgres brain (p50) | ~500 ms, often cut to keyword-only | ~15 ms, same top 10 |
+| Pasted emails and logs in a Claude Code turn | extracted as facts about you | not extracted |
+
+These bugs came from the gbrain-evals category waves N1 (ontology), N2 (contradiction surfacing), N5 (forget and hot memory), N9 (multi-hop relations) and N12 (meeting attendance). The unlinked-facts work (#5836) came from the GBRA-37 thread.
+
+## To take advantage of v0.60.30.0
+
+`gbrain upgrade` installs the binary and applies two schema migrations: v187 adds the fact-relink attempt table and an index over unlinked facts, and v188 replaces the ontology dedup index with one keyed per stint. Restart every `gbrain serve`, autopilot and worker afterwards so they run the new code.
+
+1. **If `gbrain doctor` warns about a partial migration, run the orchestrator:**
+ ```bash
+ gbrain apply-migrations --yes
+ ```
+2. **Re-derive relationship and attendance links (once per source).** The link extractor version moved, so the next `gbrain extract --stale` (or the autopilot cycle) re-derives body links on its own. Frontmatter links re-derive only with frontmatter included:
+ ```bash
+ gbrain extract links --source db --include-frontmatter --source-id <id>
+ ```
+ Each page's own derived links are replaced in one transaction; manual links and links from other pages are untouched. For a reviewed, preview-bound repair of historical attendance instead, use `gbrain extract links --source db --repair-attendance --source-id <id>` ([attendance evidence](docs/guides/attendance-evidence.md#preview-bound-historical-repair)).
+3. **Link facts that have no entity.** Preview, then apply after you agree (the model tier is capped by `--max-usd`, default $1.00):
+ ```bash
+ gbrain facts relink --dry-run
+ gbrain facts relink
+ ```
+ `gbrain doctor` reports the backlog as `unlinked_facts`. Guide: [docs/guides/facts-relink.md](docs/guides/facts-relink.md).
+4. **Expect one paid re-judge of contradictions.** The judge prompt version moved to 3, so the next `gbrain eval suspected-contradictions` re-judges every pair. It prints its cost estimate first, as on any prompt change.
+5. **Your agent reads `skills/migrations/v0.60.30.0.md`** the next time you talk to it. The symptom table is in [Recover after upgrading](docs/guides/repair.md#fix-wave-6).
+6. **Verify:**
+ ```bash
+ gbrain doctor # unlinked_facts, vector_plan and self_capture report
+ gbrain stats
+ ```
+7. **If any step fails,** file an issue at https://github.com/garrytan/gbrain/issues with the output of `gbrain doctor` and `~/.gbrain/upgrade-errors.jsonl` if it exists.
+
+**Say to your agent:** *"We upgraded gbrain. Preview the unlinked facts relink and the attendance repair for each source, and tell me what would change before applying anything."*
+
+### Behavior changes
+
+- **Attendance and relation direction contract.** Schema-pack frontmatter relations take their direction from the verb's built-in counterpart for that page type: company `investors`, `key_people` and `partner`, deal `investors` and `lead`, and meeting `attendees` are stored subject -> page (`people/bob-example -> companies/gamma-example`, `invested_in`). Verbs with no counterpart, such as company-brain's `owned_by`, stay page -> target. Under the shipped `gbrain-base` and `company-brain` packs (and brains with no `schema_pack`), meeting attendance follows the canonical rule: only an explicit attendee list makes a person an attendee, stored person -> meeting; a person only mentioned in the notes stays `mentions`. A pack whose `attended` rule has a phrase `regex` still decides attendance itself. Code that walked meeting -> person `attended` edges must walk incoming edges. Repair existing brains with step 2 above.
+- **Concurrent PGLite CLI writers wait for the lock.** A CLI write on a PGLite brain whose lock is held by another CLI call (not a `gbrain serve`) now waits up to 30 seconds for the lock instead of failing at once with `owner_unavailable`. Behind a long-running non-serve holder, such as a jobs daemon, the write waits and then fails lock-busy. A serve holder, or an owner socket that answers, still routes through the owner as before.
+- **Contradiction judge prompt v3.** The three temporal verdicts now need two different times (different dates in the metadata or the text); a same-date or undated value conflict is a contradiction. Look-alike names are different entities. Matched A/B on a fresh N2 seed, one judge sample per arm, 1,371 identical pairs: same-time conflicts caught 101/150 -> 131/150, false contradictions on unplanted pairs 59/820 -> 11/820, judged-pair precision 62.0% -> 91.0%, temporal recognition unchanged at 40/40. The prompt version bump invalidates the judge cache, so the next run re-judges every pair (step 4).
+- **`remember` infers a missing entity.** When `entity` is omitted, `remember` (CLI and MCP) looks for the subject in the fact text without a model call and files the fact on that entity only when exactly one existing entity is named and no other name competes. The response carries `entity_inferred`, or `warnings: ["NO_ENTITY"]` (or `ENTITY_LINK_FAILED`) with a `hint` when it stays unattributed. Pass `infer_entity: false` for one call, or turn it off with `gbrain config set facts.entity_inference off` (earlier links stay). Page imports apply the same inference in the facts backstop.
+- Undated pages reach the contradiction judge as `(date unknown)` instead of their import date, so the date pre-filter and `temporal_supersede` proposals use real content dates.
+- A bare `gbrain find-contradictions` on the local CLI reads the latest stored run instead of returning the "unavailable" note. An explicit `--source`, `GBRAIN_SOURCE`, `.gbrain-source` and every remote caller still get the note.
+- The claude-cli provider now needs Claude Code 2.0.60 or newer and starts its child with hooks disabled; older CLIs get an upgrade message.
+- `gbrain dream --drain --window` is a hard deadline. `--drain` exits 0 only when the backlog drained; every other stop exits 3 and prints `stopped`, `remaining` and the rerun command.
+- `gbrain embed --stale` exits non-zero when a page changed under it, naming the pages and the retry.
+- Link commands on thin clients follow an ambient `GBRAIN_SOURCE` or `.gbrain-source` (use `--all-sources` to span), and fail with an upgrade instruction against an older brain host that ignores the scope.
+
+### Itemized changes
+
+#### Privacy
+
+- **Private ontology values stay private (N1-3).** `ontology_get`, `ontology_conflicts` and `volunteer_chronicle`'s ontologies read only `visibility: world` observations for remote callers, applied before per-dimension resolution and the conflict filter, so a remote caller resolves the newest value they may see. Trusted local callers read every tier. Both engines.
+- **Forgotten facts leave hot memory immediately (N5-1).** Every mutating MCP op clears the per-process hot-memory cache, on success and failure, on both transports. A per-engine generation stops a build that raced an invalidation from storing stale data, and each cache hit rechecks the source's withdrawal watermark, so a forget committed by another process (a CLI next to a running server) is not served either.
+
+#### Graph and attendance (N9, N12)
+
+- **Frontmatter relations keep their declared direction (N9-2).** "Who invested in X?" reaches frontmatter-derived investors.
+- **Canonical attendance under the shipped packs (N9-3, N12-7)** on the database, `put_page`, sweep and filesystem paths. Historical attendance repair now covers shipped-pack meetings and reports only phrase-owning packs as `pack_semantics_preserved`.
+- **"Who attended <meeting>?" resolves its seed (N9-4).** For an incoming `attended` relation the relational arm falls back to a live `meeting` or `event` page whose title exactly matches the question's phrase (case-insensitive, unique in the source). Other relations never seed from titles.
+- A brain with no `schema_pack` keeps `gbrain-base` as its default pack; the attendance and direction differences from `gbrain-base-v2` are fixed in the extractor, so both store the same edges.
+- `LINK_EXTRACTOR_VERSION_TS` moves to `2026-10-01T00:00:00Z`, so pages stamped earlier re-derive on the next stale sweep.
+
+#### Facts and memory (#5836, N5)
+
+- **New `gbrain facts relink`** moves unlinked facts onto their entity page's facts fence through the write coordinator: free tiers first (exact mention, page subject), then the fact extraction model under `--max-usd`. It retires exact duplicates, never supersedes, and queues linked facts for the System One conflict sweep. Migration v187 adds `fact_relink_attempts` and `idx_facts_unlinked_active`.
+- **New doctor check `unlinked_facts`** reports the unlinked share, new unlinked facts over 7 days and the preview command. `gbrain decide status` shows the share of conflict skips caused by a missing entity.
+- **A forget's search text is rebuilt before it answers (N5-2).** A CLI forget used to leave the withdrawn page with no searchable chunks until a resident worker ran. It now rebuilds them after the commit; a failed rebuild stays queued.
+- **The first `remember` after a `forget` no longer refuses as stale bytes (N5-3).** A file write waits while a withdrawal mirror for the same page is queued or running, and a forget that commits while a write is preparing makes the write reprepare instead of failing.
+
+#### Ontology (N1)
+
+- **`ontology_propose` works on managed brains (N1-1).** It commits through the coordinator with the entity's page key instead of being refused by the writer guard. Unmanaged brains keep the direct write.
+- **Returning to an earlier value records it (N1-2).** Lisbon -> Porto -> Lisbon from one source now makes Lisbon current again. Migration v188 replaces the ontology dedup index with `idx_facts_ontology_stint_dedup`, which adds `valid_from`; same-stint repeats stay no-ops.
+
+#### Contradictions (N2)
+
+- Undated pages keep a null date (N2-1), the bare local `find-contradictions` reads the latest run (N2-2), and the judge prompt moves to v3 (N2-3). See behavior changes above.
+
+#### Retrieval and memory hygiene
+
+- **Hybrid search on large Postgres brains keeps its vector half (#5824).** The content-freshness check moved out of the HNSW candidate scan, so the planner keeps `idx_chunks_embedding`; chunks edited after embedding are still never returned, and a since+until date range keeps the index. On a 160k-chunk brain, vector search p50 went from about 500 ms to about 15 ms with identical top-10 results. New doctor check `vector_plan` confirms the index is used. Rollback for this release: `gbrain config set search.vector_legacy_guard true` (or `GBRAIN_VECTOR_LEGACY_GUARD=1`) on the brain host, then restart serve and autopilot. Thanks to @clatyceo for the EXPLAIN analysis and @morven-ai for #5803.
+- **Pasted text is not extracted as facts about you (#5812).** The Stop hook saves only your own words from a turn, and a paste-only turn saves nothing; the sweep, serve harvest and dream `extract_atoms` never show pasted blocks to the extractor. Transcripts, recall and `synthesize` keep the text. Facts extracted from pastes before this release stay until you `gbrain forget` them. Patch from @benswinney.
+- **gbrain's own claude-cli calls stop filling your memory (#5820).** The provider starts `claude --print` with `--settings '{"disableAllHooks":true}'`, and the Stop hook, serve harvest, sweep and dream `extract_atoms` skip these sessions. Doctor `self_capture` shows the newest one captured and prints one-time quarantine commands. Reported by @clatyceo.
+- **Nightly dream stops skipping after a long atom drain (#5809, #5832).** A timed-out, cancelled or taken-over `extract-atoms-drain` job stops at its next page and releases the cycle lock; the interrupted page takes no failure strike. A `cycle_already_running` skip names the lock holder. Ported from @andreineacsu (#5833) and @furuchanchan (#5805).
+- **`bun run verify` works on a stock Mac again (#5810).** `scripts/check-retired-phrases.sh` parses under macOS `/bin/bash` 3.2, and CI parses every tracked shell script with bash 3.2 (`bun run check:bash32`). Ported from @mml-studio (#5811).
+- **`gbrain embed --stale` stops reporting success for pages it skipped (#5804).**
+- **Link and graph tools work on multi-source brains (#5827).** `get_links`, `get_backlinks` and `traverse_graph` read the same federated sources as `search` for agents without a source grant; a granted token stays inside its grant, and private pages stay hidden. Locally, `gbrain links` (new name; `get_links` still works), `gbrain backlinks` and `gbrain graph` read every federated source when none is pinned, accept `--source-id` and `--all-sources`, and graph output carries `source_id`, `from_source_id` and `to_source_id`. Reported by @greenwayveterinary-tech.
+
+### For contributors
+
+- `coordinatedDatabaseWrite` (`src/core/persistence/database-write.ts`) is the managed path for database-only rows; `coordinatedManualLinkWrite` delegates to it.
+- `relink_facts` is a write-coordinator mutation, so a relink request replays or refuses as a unit on managed and unmanaged brains.
+- `rebuildPendingPageProjections` takes a `pages` filter; `CLAIMABLE_WRITE_SQL` skips file writes whose page has a pending withdrawal mirror.
+- `buildJudgePrompt` `PROMPT_VERSION` is 3; `ctx.localSourceImplicit` marks a CLI source that came from a non-explicit tier.
+- The vector statement builder lives in `src/core/search/vector-statement.ts`; `scripts/bench/vector-plan-5824.ts` reproduces the planner measurement.
+- `bun run check:bash32` parses every tracked shell script with a bash 3.2 parser when one is installed.
+
## [0.60.28.0] - 2026-10-01
**Fix wave 5: session start stops showing another session's text, private pages stay out of ambient recall, big brain repos onboard again, old queued jobs stop wedging synthesize, and the cleanups promised last wave ship.**
diff --git a/TODOS.md b/TODOS.md
index b740a66d9f..56624eec0c 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -17,6 +17,25 @@
- [ ] **P3 — Time the System One quickstart on a fresh machine (`/devex-review`).**
**What:** measure the documented key-in-hand to first-decision clock against the under-5-minute target. **Effort:** S. **Priority:** P3.
+## Fix wave 6 follow-ups (filed 2026-10-01, follow-up from v0.60.30.0)
+
+- [ ] **P2 — Remove the vector legacy guard (#5824 follow-up).**
+ **What:** delete `GBRAIN_VECTOR_LEGACY_GUARD` / `search.vector_legacy_guard` next wave, with a one-time notice when it is still set. **Effort:** S. **Priority:** P2.
+- [ ] **P3 — Write-time freshness for stale vectors (#5824 follow-up).**
+ **What:** null the vector or store an `embedding_current` flag when a chunk's text changes, so stale rows stop taking HNSW candidate slots. **Effort:** M. **Priority:** P3.
+- [ ] **P3 — Per-column date spelling for the keyword and CJK arms (#5824 follow-up).**
+ **What:** the vector arm's since/until guard now keeps the index; the keyword and CJK arms still use the shared expression. **Effort:** S. **Priority:** P3.
+- [ ] **P3 — Title-FTS expression index (#5803 remainder).** **Effort:** S. **Priority:** P3.
+- [ ] **P3 — `gbrain auth permissions <name> set-source …` for legacy tokens (#5827 follow-up).** **Effort:** S. **Priority:** P3.
+- [ ] **P3 — #5831: atom facts without `entity_slug`.** **Effort:** M. **Priority:** P3.
+- [ ] **P3 — Provenance-based withdrawal of facts already extracted from pastes or self-captures (#5812, #5820 follow-up).**
+ **What:** facts extracted before v0.60.30.0 from pasted blocks or gbrain's own claude-cli sessions stay until forgotten one by one. **Effort:** M. **Priority:** P3.
+- [ ] **P3 — `gbrain graph-query` on a thin client should forward `--source`.** **Effort:** S. **Priority:** P3.
+- [ ] **P3 — Managed atom retry ignores the cycle lock's lease signal.**
+ **What:** `src/core/persistence/atom-retry.ts` does not stop when the cycle lock is lost, unlike the drain (#5809). **Effort:** S. **Priority:** P3.
+- [ ] **P3 — Heap flag for `bun run typecheck` on 8 GB Macs.**
+ **What:** the macOS runner needed `--max-old-space-size=4096`. **Effort:** S. **Priority:** P3.
+
## Unlinked facts follow-ups (#5836, filed 2026-10-01)
- [ ] **P3 — Automatic free-tier relink in the dream/autopilot cycle.**
diff --git a/VERSION b/VERSION
index a3343a8bc4..150cc79a03 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.60.28.0
+0.60.30.0
diff --git a/docs/fix-wave-notes/capy-evalwave-fixes-b.md b/docs/fix-wave-notes/capy-evalwave-fixes-b.md
deleted file mode 100644
index ca08be9f01..0000000000
--- a/docs/fix-wave-notes/capy-evalwave-fixes-b.md
+++ /dev/null
@@ -1,126 +0,0 @@
-# Eval-category wave, fix lane B (`capy/evalwave-fixes-b`)
-
-Notes for folding into the fix wave 5 CHANGELOG (v0.60.28.0). No version bump
-on this branch. Source reports: gbrain-evals `capy/wave-n9`
-(`docs/benchmarks/2026-10-01-n9-multi-hop.md`, `2026-10-01-wave-bugs.md`) and
-`capy/wave-n12-n13` (N12-7).
-
-## What changed
-
-- **N9-2, schema-pack frontmatter relations stored backwards.**
- `extractFrontmatterLinks` built every pack `frontmatter_links` mapping as
- outgoing. A pack mapping now takes its direction from the verb's
- `FRONTMATTER_LINK_MAP` counterpart for the same page type, so under
- `gbrain-base` (including brains with no `schema_pack`) company `investors`,
- `key_people` and `partner`, deal `investors` and `lead`, and meeting
- `attendees` are stored subject -> page (`people/bob-example ->
- companies/gamma-example`, `invested_in`). Verbs with no counterpart, such as
- company-brain's `owned_by`, stay outgoing. "Who invested in X?" now reaches
- frontmatter-derived investors.
-- **N9-3 and N12-7, meeting attendance under shipped packs.** The page-type
- bound `attended` rule in `gbrain-base` and `company-brain` was returned before
- the canonical-attendance branch, so body attendance was stored meeting ->
- person and every person linked anywhere on a meeting page was typed attended
- (24 of 24 notes-only mentions in N12). That rule mirrors the in-code meeting
- prior, so meeting links now follow canonical, evidence-gated attendance
- (explicit attendee list only, person -> meeting) on the database, put_page,
- sweep and filesystem paths. A pack whose `attended` rule carries a phrase
- `regex` still decides attendance itself (`ownsAttendanceInference`), and
- historical attendance repair reports only those packs as
- `pack_semantics_preserved`; shipped base and company-brain meetings are now
- repairable to person -> meeting.
-- **N9-4, "Who attended <meeting>?" never resolved its seed.** The relational
- arm's seed resolver only returns entity pages. For an incoming `attended`
- relation it now falls back to a live `meeting` or `event` page whose title is
- exactly the seed phrase (case-insensitive, unique in the source). Other
- relations never seed from titles. `resolveEntitySlugWithSource` itself is
- unchanged, so the gbrain-evals repro's direct resolver line still prints
- `fallback_slugify` while the arm fires.
-- **N12-7 default-pack decision: tier 7 stays `gbrain-base`.** A brain with no
- `schema_pack` predates `gbrain init` writing one and carries the legacy
- 24-type taxonomy; switching the fallback to `gbrain-base-v2` would change
- type inference, alias closure and enrichment without v2's reviewed
- `migration_from` retype step. The attendance and direction differences
- between the two packs are fixed in the extractor instead, so both store the
- same edges. Documented in `docs/architecture/schema-packs.md`.
-
-## Re-deriving existing brains
-
-A documented repair, not a migration. `LINK_EXTRACTOR_VERSION_TS` moves to
-`2026-10-01T00:00:00Z`, so every page stamped before it is stale and the next
-`gbrain extract --stale` (and the cycle's stale drain) re-derives its markdown
-links: reversed body attendance and notes-only "attended" edges are replaced.
-Frontmatter edges re-derive only with frontmatter included, so run once per
-source:
-
-```bash
-gbrain extract links --source db --include-frontmatter --source-id <id>
-```
-
-Each page's own derived links (markdown, wikilink and frontmatter producers)
-are replaced in one transaction per page; manual links and links other pages
-created are untouched. The gated `--repair-attendance` preview/apply path also
-now covers shipped-pack meetings. A schema migration was not used because the
-repair needs the extractor (attendance evidence, the active pack, endpoint
-types), a full-brain re-extraction inside `apply-migrations` would be slow on
-large brains, and migrations are version-numbered while this lane carries no
-version. Stamps written by pre-fix code after the new watermark read as fresh
-(the accepted watermark limitation); the explicit command covers them.
-
-Tested on PGLite and Postgres in `test/pack-relation-direction-engine.test.ts`
-(pre-fix rows rewritten by `extract links --source db --include-frontmatter`,
-and by `extract --stale` for pages stamped between the old and new watermark).
-
-## Tests
-
-- New: `test/pack-relation-direction.test.ts` (pure extraction across no pack,
- gbrain-base, company-brain, gbrain-base-v2) and
- `test/pack-relation-direction-engine.test.ts` (both engines: db extraction,
- put_page N12-7 shape, relational arm N9-4, title-seed scoping, both
- re-derivation paths). All failed before the fix.
-- Updated to the new contract (each previously pinned pack-owned outgoing
- attendance under gbrain-base or company-brain): `attendance-retrieval`
- (per-source pack selection now discriminates with a phrase-owned fixture
- pack), `attendance-repair`, `link-inference-constraints`, `extract-db`,
- `extract-timeline-attendance`, `derived-link-reconciliation`,
- `links-attendance-blocked`, `extract-endpoint-revision`.
-- Module-size ratchet raised: `src/commands/extract.ts` +2,
- `src/core/link-extraction.ts` +10.
-
-## Eval before/after
-
-Copied overlays (gbrain-evals `.gbrain-overlays/`, verified tree, not
-symlinked) of fix-wave-5 head `31021a06` (before) and `49acbc3b` (this
-lane's fix commit, after). Measured, not tuned: no number below informed a
-code change.
-
-- **gbrain-evals repros.** `repro-relational-edges.ts`: before, all five typed
- edges point page -> target and both "Who attended" questions report
- `fired: false, seeds_resolved: 0`; after, all five point subject -> page,
- "Who invested in Gamma Example?" fans out to Bob, and both attendance
- questions fire (`seeds_resolved: 1, candidates: 2`). `n12-7` repro: legacy
- pack attended `[alice, bob]` before, `[alice]` after (matches v2).
-- **N9 hermetic (keyword path, 3 seeds).** Composed strict all-hit unchanged
- (10/375 canonical, 5/375 paraphrase; arm fired 0/750). One-hop: the only
- changed number is the template funnel's `seed_resolved`, 240 -> 390 (all
- 150 attendance runs now resolve the meeting); runs fired stay 174, recall
- and hit@1 are identical (template recall@5 0.719 -> 0.755 on, both
- commits; attendance recall@5 0.456 both arms, both commits).
-- **N9 paid (OpenAI hybrid).** Identical before and after on every reported
- number.
-- **relational-ab paid (145 questions x 3 seeds).** Identical before and
- after: template recall@5 0.7368 -> 0.7632 off -> on, hit@1 27.6% -> 42.8%,
- 174 fired; paraphrase recall@5 0.4109 -> 0.5368, hit@1 4.8% -> 16.6%, 99
- fired; attendance rows unchanged (template recall@5 0.38, paraphrase 0.355,
- 0 fired).
-
-Why attendance retrieval did not move on world-v1: its meeting pages state
-attendance only in prose ("[Chris Jackson](people/chris-jackson-91) dialed in
-from Singapore"), with no attendee list or `attendees:` frontmatter. Before the
-fix the legacy pack typed all 131 person links on meeting pages as attended,
-stored meeting -> person, which the incoming "Who attended" traversal could
-not use; after, the evidence gate types the same 131 links `mentions`. The
-seed now resolves, but there are no canonical attendance edges to walk. A
-corpus with explicit attendee lists (the documented format) fires, as the
-repro shows. Paid spend: $0.258 of the $2 cap (budget run
-`evalwave-fixes-b-2026-10-01T20-31-25-960Z-57117001`, closed).
diff --git a/docs/fix-wave-notes/capy-evalwave-fixes-c.md b/docs/fix-wave-notes/capy-evalwave-fixes-c.md
deleted file mode 100644
index 802e17296d..0000000000
--- a/docs/fix-wave-notes/capy-evalwave-fixes-c.md
+++ /dev/null
@@ -1,165 +0,0 @@
-# Eval-category wave, fix lane C (`capy/evalwave-fixes-c`)
-
-Bugs from gbrain-evals branch `capy/wave-n1-n5` (repros in
-`docs/benchmarks/2026-10-01-n1-n5/repro/`, ledger
-`docs/benchmarks/2026-10-01-wave-bugs.md`). Every item has a failing test
-first, then a root-cause fix, on both engines. No version bump or CHANGELOG
-entry: the integrator owns those. Base: `capy/fix-wave-5` (a551d84b).
-
-## Integration notes
-
-- **Migration v188** (`facts_ontology_stint_dedup`). GBRA-37 holds v187 and
- lane B v188. Standalone, this branch has a gap at 187–188, so three
- count-based assertions fail until those land and pass once they do:
- `test/migrations-golden.test.ts` (gap list `[17,18,19,100]`),
- `test/fix-wave-4-integration.test.ts` X1 (`applied: LATEST_VERSION - 178`)
- and `test/persistence-diagnostics.test.ts` (`applied` count). Every other
- suite is green here.
-- **Goldens.** The catalog, doctor `schema_version`, export-surface, migration
- record and SQL-text goldens were regenerated for v188 and the new
- `visibility` read option. After merging v187/v188, regenerate them once
- more with `GBRAIN_TEST_UPDATE_GOLDENS=1` (unit and the Postgres E2E
- catalog/doctor/replay files) rather than hand-merging the JSON.
-- **Ratchets.** `scripts/module-size-limits.tsv` (both engines, `types.ts`)
- and `scripts/function-size-baseline.tsv` (`dispatchToolCall` +3) record
- the growth with rationale.
-- `isFactWithdrawn` / `recordFactWithdrawal` signatures are unchanged.
-- No edits to `src/core/ops/context.ts`, `src/core/ops/links.ts`,
- `src/commands/hook.ts` or the vector search SQL.
-
-## N1-3 — ontology reads returned private observations to remote callers (privacy)
-
-`ontology_get` (and `ontology_conflicts`, `volunteer_chronicle`'s
-ontologies) only redacted diary-sourced rows and rows whose provenance page
-is private; `facts.visibility` was never checked, so a remote caller saw an
-observation proposed with `visibility: private`.
-
-- `getOntology` and `findOntologyConflicts` take a `visibility` tier list
- (both engines), applied before the per-dimension `DISTINCT ON` and the
- conflict `HAVING`, so an untrusted caller resolves the newest world value
- instead of a private value or a hole.
-- The three ops pass `['world']` for `ctx.remote !== false` (the recall and
- hot-memory rule); trusted local callers read every tier.
-- Existing chronicle fixtures that expected remote callers to see
- default-private observations now write those rows as `visibility: world`,
- so they keep isolating the diary and provenance-page rules.
-- Tests: `test/ontology-fact-visibility.test.ts` (handler and MCP dispatch,
- remote `true`/`undefined` vs local, conflicts, `volunteer_chronicle`);
- Postgres parity in `test/e2e/ontology-merge-parity.test.ts`.
-
-## N1-1 — `ontology_propose` refused on every `gbrain init` brain
-
-`mergeOntologyFact` inserts into `facts` directly, and the managed writer
-guard trigger rejects that whenever managed persistence is on.
-
-- New `coordinatedDatabaseWrite` (`src/core/persistence/database-write.ts`):
- the managed path for database-only rows. It checks the caller's durable
- write authority, then runs the write inside `withCoordinatedWrite` with
- the source incarnation revalidated and the given page keys held.
- `coordinatedManualLinkWrite` now delegates to it (behavior unchanged).
-- `ontology_propose` uses it with the entity's page key; unmanaged brains
- keep the direct engine call. A direct engine write on a managed brain is
- still refused.
-- Tests: `test/managed-ontology-propose.test.ts` (PGLite and Postgres via
- `test/e2e/managed-ontology-propose-postgres.test.ts`).
-
-## N1-2 — same-provenance revert was a silent noop
-
-The dedup index `(source_id, entity_slug, dimension, value_hash,
-source_markdown_slug)` had no time component, so Lisbon → Porto → Lisbon from
-one provenance collided with the first Lisbon row and Porto stayed current.
-
-- Migration v188 replaces it with `idx_facts_ontology_stint_dedup`, which adds
- `valid_from`. The new key is strictly finer, so existing rows satisfy it.
-- `mergeOntologyFact` (both engines) keeps same-stint repeats idempotent: when
- the incoming value equals the current open value and the same provenance
- already observed it at or after the current stint's start, it returns
- `noop` instead of inserting a corroboration echo. Exact replays of any
- step conflict on the new key and stay noops.
-- Tests: `test/ontology-revert.test.ts` (dated, undated, replay),
- `test/managed-ontology-propose.test.ts` (through the coordinator), parity
- in `test/e2e/ontology-merge-parity.test.ts`; `test/e2e/schema-drift.test.ts`
- pins the new index shape.
-
-## N5-1 — hot memory served a forgotten fact for up to 30 s
-
-`getBrainHotMemoryMeta` (`src/core/facts/meta-hook.ts`) caches per process for
-30 s, and nothing invalidated it (`bumpHotMemoryCache` had no caller), so
-`context_pack` and `_meta.brain_hot_memory` kept a withdrawn claim.
-
-- `dispatchToolCall` calls `invalidateHotMemoryForEngine(engine)` after every
- mutating op, on success and on failure (a failed write may have committed
- part of its work). Both MCP transports dispatch here.
-- A per-engine generation stops a build that raced an invalidation from
- storing its stale payload.
-- Each cache hit revalidates the source's `fact_withdrawals` watermark (count
- and latest `withdrawn_at`, read before the rows), so a forget committed by
- another process (a CLI next to a running server) is not served either.
-- Tests: `test/hot-memory-invalidation.test.ts` (forget via dispatch on both
- tiers in `_meta` and `context_pack`, an out-of-dispatcher withdrawal, a
- fresh write, the race), PGLite and Postgres via
- `test/e2e/hot-memory-invalidation-postgres.test.ts`.
-
-## N5-3 — first remember after a forget refused as stale bytes (PGLite CLI)
-
-The forget commits, queues its `withdrawal-mirror` effect and exits; a CLI
-process has no resident consumer. The next process (the remember) starts a
-consumer whose effect worker and request worker run in the same tick
-(`consumer.ts` `doTick`). The mirror rewrites the page file after the remember
-captured `expectedBeforeHash` and before it publishes, at an unchanged page
-revision, so publication refused with `source_changed` → `raw_file_changed`.
-Postgres and the servers hid it by timing.
-
-- `CLAIMABLE_WRITE_SQL` (`journal.ts`): a file write is not claimed while a
- queued or running withdrawal mirror targets its page (an untargeted legacy
- mirror blocks its whole worktree). Writes to other pages are unaffected.
-- `publishMutation` (`coordinator.ts`): changed bytes **and** a moved page
- revision (a forget committed while the write was preparing) throw
- `revision_conflict`, so semantic writes reprepare; changed bytes at an
- unchanged revision still refuse as `raw_file_changed`.
-- Tests: `test/withdrawal-followup-writes.test.ts` (PGLite and Postgres via
- `test/e2e/withdrawal-followup-writes-postgres.test.ts`).
-
-## N5-2 — forget under concurrent CLI writes on PGLite
-
-Two independent causes. The ledger said the `owner_unavailable` forgets had
-committed; they had not (refused before sending, fact still active).
-
-- **Missing chunks.** `recordFactWithdrawal` deletes the withdrawn pages'
- chunks in the commit and leaves the rebuild to the resident projection
- worker, which a CLI forget never runs. It reproduced without concurrency
- (forget, then search). `submitForgetMutation` now rebuilds those pages'
- text projections after the commit and before answering
- (`rebuildPendingPageProjections` gained a `pages` filter). A failed rebuild
- stays queued as durable projection work and does not turn a committed
- forget into an error.
-- **`owner_unavailable`.** `maybeDelegateLocalOperation` treated any PGLite
- lock holder as a resident owner; when the holder was another CLI call
- there was no owner socket, so concurrent CLI writes (forgets and remembers)
- got `owner_unavailable` with `submission_status: not_sent`. A holder that
- is not a serve and answers no owner socket now falls through to the engine
- path, which already waits up to 30 s for the lock. A serve holder, or a
- socket that answered, still makes every failure final.
- `maybeDelegateLocalAdministration` is unchanged.
-- Behavior change to call out: concurrent CLI calls on one PGLite brain now
- take turns on the lock instead of failing fast; behind a long-running
- non-serve holder (e.g. a jobs daemon) a CLI write waits and then fails
- lock-busy rather than answering `owner_unavailable` immediately.
-- `test/persistence-memory-mutations.test.ts` "forget commits offline" used
- to assert the chunks were empty after a forget (the N5-2 behavior); it now
- asserts the chunks keep the retained text and drop the withdrawn claim.
-- Tests: `test/withdrawal-followup-writes.test.ts` (retained fact in chunks
- and keyword search after an acknowledged forget),
- `test/persistence-local-client.test.ts` (non-serve holder falls through;
- serve holder without a socket still throws).
-
-## Repros (gbrain-evals `capy/wave-n1-n5`, run against this checkout)
-
-| Repro | Before (a551d84b) | After |
-|---|---|---|
-| N1-1 | `ontology-add` exit 1 `writer_coordinator_required`; `ontology_get` `[]` | exit 0; `ontology_get` returns location = Lisbon |
-| N1-2 | third write `noop`; current Porto | third write `superseded_prior`; current Lisbon |
-| N1-3 | remote sees `decision_style=deliberate, risk_tolerance=high (private marker)` | remote sees `decision_style=deliberate` |
-| N5-1 | `context_pack` and `get_page` `_meta` right after forget carry the fact | both `false` |
-| N5-2 | rounds lose chunks after `forget ok` (search false) or answer `owner_unavailable` (2/5 each) | 10/10 rounds over two runs: forget ok, retained neighbor in recall and search |
-| N5-3 | first remember `scope_denied: The source file bytes changed after this request was accepted.`; retry ok | first remember ok |
diff --git a/docs/fix-wave-notes/capy-evalwave-fixes-d.md b/docs/fix-wave-notes/capy-evalwave-fixes-d.md
deleted file mode 100644
index 94cf9c85a4..0000000000
--- a/docs/fix-wave-notes/capy-evalwave-fixes-d.md
+++ /dev/null
@@ -1,123 +0,0 @@
-# Fix wave 6, lane D: N2 contradiction surfacing
-
-Branch `capy/evalwave-fixes-d`, based on `origin/capy/fix-wave-5` at `a551d84b`
-(#5839 was still open). Bugs and keyless repros come from gbrain-evals
-`capy/wave-n2-a4`, `docs/benchmarks/2026-10-01-n2-contradiction-surfacing/`.
-No version bump or CHANGELOG entry; the collector owns both.
-
-## N2-1: undated pages reached the judge with a date
-
-Root cause: `searchResultToMember` (`src/core/eval-contradictions/runner.ts`)
-copied `SearchResult.effective_date` verbatim. For a page with no frontmatter
-or filename date, `computeEffectiveDate` stores the creation time with source
-`fallback`, so every undated page reached the judge as `(from: <import day>)`
-instead of `(date unknown)`. Two consequences: the date pre-filter's
-"both sides have an effective date" rule always fired, so rule 1 never skipped
-text-dated pairs, and `temporal_supersede` proposals ordered pairs by import
-time, naming the wrong side as older.
-
-Fix: a pair member keeps an effective date only when its source is a content
-source (not `fallback`, not unlabeled), the same rule `deriveTimelineAnchor`
-already applies. Take members inherit the null.
-
-Tests: `test/eval-contradictions-runner.test.ts` "N2-1: …" (two cases, one
-through `put_page` and the default `hybridSearch`). Both failed before the fix.
-The keyless repro now prints `[]` for judge dates (the pair is skipped) and
-`pairs skipped by the date filter: 1`.
-
-Behavior note: on the N2 world the 20 `dated_change/text_dates` pairs are now
-skipped by the pre-filter (dates more than 30 days apart in both texts), as
-the filter documents. Their old `temporal_supersede` proposals were the ones
-naming the wrong side (0 of 20 acceptable for the oracle judge).
-
-Cached verdicts are keyed on text, not dates, so a pre-fix cached verdict can
-still be returned for a pair. Its proposal is re-rendered with the corrected
-dates, so the worst case is "date order unclear". The N2-3 prompt bump below
-invalidates the cache anyway.
-
-## N2-2: bare `gbrain find-contradictions` returned the unavailable note
-
-Root cause: `makeContext` (`src/cli.ts`) always fills `ctx.sourceId`, falling
-back to `'default'`. `find_contradictions` (`src/core/ops/insights.ts`) refuses
-any caller with a scalar source because stored reports are brain-wide, so the
-documented bare command (skills/correction-pipeline/SKILL.md) never worked.
-
-Fix: `makeContext` marks `ctx.localSourceImplicit = true` when the source came
-from a non-explicit tier (`local_path`, `brain_default`, `sole_non_default`,
-`seed_default`, or the pre-init fallback), the same explicit/implicit split
-#2561 uses. The op treats a scalar source as a filter unless that marker is set
-and the caller is the trusted local CLI. Not widened: every remote caller,
-unset trust, any federated grant, `--source <id>`, `GBRAIN_SOURCE`, and
-`.gbrain-source` still get the unavailable note without loading the report.
-`ops/context.ts` (another lane's file) is untouched.
-
-Tests: `test/find-contradictions-cli-source.test.ts` drives the real
-`makeContext` (bare reads the run; `--source alpha` and `GBRAIN_SOURCE=alpha`
-refused; `--source __all__` reads). `test/salience-source-scope.test.ts` adds
-the local-implicit read and three refusals (remote, unset trust, federated
-grant) carrying the marker. Bare-command test failed before the fix. Also
-checked end to end with `bun src/cli.ts find-contradictions --json` on a
-keyless PGLite brain: the base returns the note, the fix returns the run.
-
-The gbrain-evals N2-2 repro builds `{ remote: false, sourceId: 'default' }` by
-hand, without the CLI marker, so it still prints the note. That context no
-longer matches what the CLI builds.
-
-## N2-3: judge prompt (shipped, PROMPT_VERSION 2 → 3)
-
-Two rules added to `buildJudgePrompt`:
-
-1. The three temporal verdicts need two different times (different `(from:)`
- dates or different dates in the text). Same-date or undated value
- conflicts are contradictions.
-2. Only claims about the same entity can conflict. Look-alike names are
- different entities (`no_contradiction`). The example uses generic names,
- not N2 names.
-
-Measurement: a matched before/after on a fresh N2 seed (20261002; the counted
-seed is 20261001). Generator `n2-contradiction-gen/1.0.0`, judge
-`anthropic:claude-haiku-4-5-20251001`, PGLite keyword-only retrieval, top 5,
-cache off. "Before" is this branch with N2-1 and N2-2 (`e833e93d`). "After"
-adds only the prompt change, byte-identical to this commit. Both arms judged
-the same 1,371 offered pairs: all planted pairs plus a fixed sha256-sampled 40%
-of unplanted pairs (820 distinct). The offered-key hash is identical across
-arms. Scored with gbrain-evals `scoreClassification`.
-
-| Metric | Before (v2) | After (v3) |
-|---|---|---|
-| Same-time conflicts called contradiction | 101/150 (67.3%) | 131/150 (87.3%) |
-| … dated same day | 36/50 | 45/50 |
-| … undated | 24/50 | 37/50 |
-| … mixed dated | 41/50 | 49/50 |
-| False contradiction, dated changes | 0/40 | 0/40 |
-| False contradiction, compatible negatives | 3/50 | 2/50 |
-| False contradiction, unplanted pairs | 59/820 (7.2%) | 11/820 (1.3%) |
-| Judged-pair precision | 101/163 (62.0%) | 131/144 (91.0%) |
-| Temporal recognition, dated changes | 40/40 | 40/40 |
-| Judge errors | 0/1371 | 0/1371 |
-| Acceptable resolution proposals | 141/190 | 171/190 |
-
-Paired flips: planted conflicts gained 30, lost 0. Unplanted pairs lost 51
-false contradictions and gained 3. Compatible negatives lost 2 and gained 1.
-This is one judge sample per arm. The conflict flips are one-directional
-(30 to 0), so noise does not explain them. Recall improved and every
-false-contradiction rate fell or held, which meets the bar to ship.
-
-Cost: $5.90 total ($2.78 before, $3.12 after, 2,742 requests), ledger-reconciled
-under one $10 budget run (`n2-3-prompt-ab-2026-10-01T21-40-40-215Z-f873e9f2`,
-gbrain-evals `.budget/ledger.json`). The driver was a scratch script reusing
-the gbrain-evals generator, gold and scorer. It is not committed.
-
-Operator impact: the bump invalidates the persistent judge cache, so the next
-`gbrain eval suspected-contradictions` re-judges every pair and prints its cost
-estimate first, as it does on any prompt change.
-
-Test: `test/eval-contradictions-judge.test.ts` "N2-3: …" pins both rules and
-the version. It failed before the change.
-
-## Validation
-
-- `bun run typecheck` and `bun run verify`: pass.
-- Contradiction, source-scope, isolation-matrix, CLI flag and source suites:
- 746 tests across 26 files pass on the N2-1/N2-2 commits. All 16 test files
- that use `makeContext` pass. The 265 contradiction tests pass with prompt v3.
diff --git a/docs/fix-wave-notes/capy-gbra35-fix-wave.md b/docs/fix-wave-notes/capy-gbra35-fix-wave.md
deleted file mode 100644
index 40086aeee3..0000000000
--- a/docs/fix-wave-notes/capy-gbra35-fix-wave.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Fix-wave notes: capy/gbra35-fix-wave (GBRA-35)
-
-Retrieval, memory hygiene, dream lock, Mac verify and federated link reads.
-Contributor branch for fix wave 6. The collector writes the version and the
-single CHANGELOG entry; this file carries the text, evidence, closes and credits.
-Base: `capy/fix-wave-5` (a551d84b, master v0.60.27.0 plus fix wave 5). No
-schema migration.
-
-## CHANGELOG text (symptom-first)
-
-- **Hybrid search on large Postgres brains no longer quietly falls back to keyword-only results (#5824).** The vector arm checked content freshness inside the HNSW candidate scan. Postgres can't estimate that check, so the planner dropped `idx_chunks_embedding`, scanned every chunk and hit its 8 s budget. A since+until date filter on vector search did the same. The freshness check now runs after the index scan, so chunks edited after embedding are still never returned, and a date range keeps the index. On a 160k-chunk brain, vector search goes from about 500 ms to about 15 ms (p50) with identical top-10 results. A new `gbrain doctor` check, `vector_plan`, confirms the index is used. If vector search regresses after upgrading, run `gbrain config set search.vector_legacy_guard true` (or set `GBRAIN_VECTOR_LEGACY_GUARD=1`) on the brain host and restart serve and autopilot to restore the old statement for this release.
-- **Pasted text no longer becomes "facts about you" (#5812).** When you paste an email, article or log into Claude Code, the Stop hook saves only your own words from that turn, and a turn that was only a paste saves nothing. The sweep, the serve harvest and dream `extract_atoms` never show pasted blocks to the extractor. Transcripts, the session corpus, recall and `synthesize` still keep the pasted text. To keep a paste as memory, save it with `gbrain remember "…" --provenance "…"`. Facts extracted from pastes before this release stay until you remove them with `gbrain forget`.
-- **gbrain's own claude-cli calls stop filling your memory (#5820).** Each `claude --print` call from the claude-cli provider used to fire your Claude Code hooks, so it was banked as a conversation and extracted with another paid call. The provider now starts its child with hooks disabled (`--settings '{"disableAllHooks":true}'`), and your login is unaffected. The Stop hook, the serve harvest, the sweep and dream `extract_atoms` all skip these sessions. `gbrain doctor` (`self_capture`) shows when the newest one was captured and prints one-time quarantine commands for old files. The claude-cli provider now needs Claude Code 2.0.60 or newer; older CLIs get a clear upgrade message.
-- **Nightly dream no longer skips for hours after a long atom drain (#5809, #5832).** A timed-out or cancelled `extract-atoms-drain` job, or one whose cycle lock was taken over, now stops at its next page and releases `gbrain-cycle:<source>`. The interrupted page takes no failure strike and nothing more is written. `gbrain dream --drain --window` is now a hard deadline: no new page starts after it. `--drain` exits 0 only when the backlog drained; every other stop exits 3, reports `stopped` and `remaining`, and prints the rerun command. The routine cycle's `extract_atoms` phase also stops on an autopilot-cycle timeout, and a `cycle_already_running` skip names the lock holder.
-- **`bun run verify` works on a stock Mac again (#5810).** `scripts/check-retired-phrases.sh` didn't parse under macOS `/bin/bash` 3.2. CI now parses every tracked shell script with the real bash 3.2 parser (`bun run check:bash32`), and the macOS 26 job runs `bun run verify` under `/bin/bash`.
-- **`gbrain embed --stale` no longer reports success for pages it skipped (#5804).** A page edited or retagged after the run started now counts as a failure (non-zero exit), with one summary naming the pages and how to retry.
-- **Link and graph tools work on multi-source brains (#5827).** `get_links`, `get_backlinks` and `traverse_graph` no longer return nothing for agents connected without a source grant: they read the same federated sources as `search`, a granted token stays inside its grant, and private pages stay hidden. Locally, `gbrain links` (new name; `get_links` still works), `gbrain backlinks` and `gbrain graph` read every federated source when no source is pinned, accept `--source-id` and `--all-sources`, refuse `--source` combined with either, and print a rerun hint when a page's links live in a source outside the read. Graph output carries source ids (`source_id` on nodes, `from_source_id`/`to_source_id` on edges). Behavior change: on thin clients the link commands follow an ambient `GBRAIN_SOURCE` or `.gbrain-source` (use `--all-sources` to span), and against an older brain host that ignores the scope they fail with an upgrade instruction instead of printing unscoped results.
-
-## Closes
-
-- Issues: #5824, #5812, #5820, #5809, #5832, #5810, #5804, #5827.
-- Superseded PRs, to close with a pointer after the wave merges: #5803 (option A, code-only, replaces its statistics + migration; title-FTS index deferred), #5833 (ported with credit), #5811 (ported), #5805 (ported), #5046 and #5479 (drain window as a hard deadline is covered).
-- #5558 / #5815: already fixed by fix wave 5 (#5839), which deleted the line.
-
-## Credits
-
-Ported code carries `Co-Authored-By` trailers: @andreineacsu (#5833), @mml-studio (#5811), @furuchanchan (#5805), @benswinney (the #5812 patch). Diagnosis credit: the #5824 reporter (@clatyceo) for the EXPLAIN analysis and option A, @morven-ai for #5803, @clatyceo for #5820, @greenwayveterinary-tech for #5827.
-
-## Evidence
-
-- #5824 reproduced on 3a284ae: 40k pages, 160k vector(1536) chunks, PostgreSQL 16.15 + pgvector. The emitted statement ran a seq scan in 469 ms; with the freshness check out of the CTE it ran an HNSW scan in 14 ms. Bench (`scripts/bench/vector-plan-5824.ts`), before → after p50/p95 ms: current 506/630 → 15/24, 10% stale 449/493 → 16/27, 30% stale 377/399 → 15/27, re-embedded with stale statistics 501/550 → 20/38. Top-10 overlap was 1.00 in every phase, with no underfill.
-- Every fix has a test that fails with its source change reverted and passes with it. Lane logs record the commands and counts (vector, pasted content, self-capture, drain, bash 3.2, embed, links).
-- The macOS 26 runner passed `bun run verify` under `/bin/bash` 3.2.57.
-- The claude CLI hook probe on 1.0.90 through 2.1.287: `--settings '{"disableAllHooks":true}'` suppresses user hooks and keeps OAuth. 2.0.60 is the oldest CLI that accepts the provider's full argv. Managed-policy hooks still run on 2.1.x (policy wins); the Stop, harvest and sweep skips cover that case.
-
-## Deferred (TODOS)
-
-- Remove `GBRAIN_VECTOR_LEGACY_GUARD` / `search.vector_legacy_guard` next wave, with a one-time notice if it is still set.
-- Write-time freshness for stale vectors (null the vector or store an `embedding_current` flag) so stale rows stop taking candidate slots.
-- Per-column date spelling for the keyword and CJK arms.
-- #5803's title-FTS expression index.
-- `gbrain auth permissions <name> set-source …` CLI for legacy tokens (#5827 suggestion 3).
-- #5831: atom facts without `entity_slug`.
-- Provenance-based withdrawal of facts already extracted from pastes or self-captures.
-- `gbrain graph-query` on a thin client should forward `--source`.
-- Managed atom retry (`persistence/atom-retry.ts`) ignores the cycle lock's lease signal.
-- A heap flag for `bun run typecheck` on 8 GB Macs (the macOS runner needed `--max-old-space-size=4096`).
diff --git a/docs/fix-wave-notes/facts-relink-5836.md b/docs/fix-wave-notes/facts-relink-5836.md
deleted file mode 100644
index 1867561099..0000000000
--- a/docs/fix-wave-notes/facts-relink-5836.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# facts-relink-5836 (#5836): unlinked facts
-
-Contributor notes for the fix-wave collector (GBRA-37). No version bump on this branch.
-
-## CHANGELOG paragraph
-
-**Facts saved without an entity now get one, and the backlog can be repaired (#5836).**
-Facts that no entity owned were invisible to entity recall, never reached the
-entity page's `## Facts` fence, and the System One conflict sweep skipped them
-as `no_entity` (one production brain had 23% of facts unlinked and 101 of its
-last 103 new facts). `remember` and page imports now look for the subject in
-the fact text without a model call and link only when exactly one existing
-entity is named and no other name competes; the response says what happened
-(`entity_inferred`, or `warnings: ["NO_ENTITY"]` with a hint). The new
-`gbrain facts relink` repairs old facts: free tiers first, then the fact
-extraction model under a `--max-usd` cap (default $1.00), moving each fact by
-id onto its entity page's fence through the write coordinator, retiring exact
-duplicates, never superseding anything, and queuing linked facts for the
-conflict sweep. `gbrain doctor` reports `unlinked_facts`, and `gbrain decide
-status` shows the share of conflict skips caused by missing entities.
-
-## Upgrade note
-
-- Migration v187 adds `fact_relink_attempts` and the `idx_facts_unlinked_active`
- index. It is separate from the optional backlog repair.
-- New facts may now be filed onto entity pages automatically. Turn it off with
- `gbrain config set facts.entity_inference off`; that does not undo earlier links.
-- Repair the backlog on the brain host: `gbrain facts relink --dry-run`, then
- `gbrain facts relink`. Guide: `docs/guides/facts-relink.md`.
-
-## Design notes for reviewers
-
-- Relink publishes through a coordinator mutation (`relink_facts`) on managed
- and unmanaged brains alike, the same coordinator remember uses. That replaced
- the planned unmanaged journal and extract_facts recovery hook: the
- coordinator's journal already makes the request replay or refuse as a unit.
-- Alternatives considered and not taken: retrieval-first recall over
- unattributed facts (already partly served by fact-text filtering),
- entity-free conflict candidates (TODOS), LLM entity resolution at write time
- (remember stays zero-LLM).
diff --git a/docs/guides/repair.md b/docs/guides/repair.md
index f0ae7f4f7d..4944406117 100644
--- a/docs/guides/repair.md
+++ b/docs/guides/repair.md
@@ -577,6 +577,27 @@ as one line each, for example
A line that says `Unknown:` means the check could not run; it is not a clean
result. Ask the brain host's operator to run the steps above.
+<a id="fix-wave-6"></a>
+### Upgrading to v0.60.30.0 (fix wave 6)
+
+**Say to your agent:** *"We upgraded gbrain to v0.60.30.0. Preview the
+unlinked facts relink and the link re-derivation for each source, and tell me
+what would change before applying anything."*
+
+`gbrain upgrade` applies migrations v187 (fact relink attempts) and v188 (the
+per-stint ontology dedup index). Restart every `gbrain serve`, autopilot and
+worker so they run the new code, then work through what applies:
+
+| Symptom | Check or code | Issue | Preview | Apply | Verify |
+| --- | --- | --- | --- | --- | --- |
+| "Who invested in X?" or "Who attended <meeting>?" finds nobody; meeting attendance edges point meeting -> person, or notes-only mentions are typed attended | none | N9-2, N9-3, N9-4, N12-7 | `gbrain extract links --source db --repair-attendance --source-id <id>` (attendance only, preview-bound) | `gbrain extract links --source db --include-frontmatter --source-id <id>` per source; body links also re-derive on the next `gbrain extract --stale` | `gbrain graph <person-slug>` shows person -> page `invested_in` / `attended` edges |
+| Facts saved without an entity are missing from entity recall and skipped as `no_entity` by the conflict sweep | doctor `unlinked_facts` | #5836 | `gbrain facts relink --dry-run` | `gbrain facts relink` (model tier capped by `--max-usd`, default $1.00) | `gbrain doctor` (`unlinked_facts`); `gbrain decide status` |
+| `remember` answers `warnings: ["NO_ENTITY"]` | none | #5836 | none | pass `entity`, or name exactly one existing person or company in the text; `gbrain config set facts.entity_inference off` turns inference off | the response carries `entity_inferred` or the chosen entity |
+| A CLI write on PGLite pauses for up to 30 s, then fails lock-busy | lock busy | N5-2 | none | wait for the other CLI call, or stop the long-running non-serve holder (for example a jobs daemon) | re-run the write |
+| The next `gbrain eval suspected-contradictions` estimates a full re-judge | none | N2-3 | the printed cost estimate | run it after you agree (judge prompt v3 invalidated the cache once) | the run reports judged pairs |
+| Hybrid search on Postgres returns keyword-only results or hits the vector timeout | doctor `vector_plan` | #5824 | `gbrain doctor` | upgrade and restart; rollback for this release: `gbrain config set search.vector_legacy_guard true`, then restart serve and autopilot | `gbrain doctor` shows `vector_plan` ok |
+| Facts about you that came from pasted text or from gbrain's own claude-cli calls | doctor `self_capture` | #5812, #5820 | `gbrain recall` for the fact | `gbrain forget <fact id>`; doctor `self_capture` prints one-time quarantine commands for old self-capture files | `gbrain doctor` |
+
<a id="fix-wave-5"></a>
### Upgrading to v0.60.28.0 (fix wave 5)
diff --git a/llms-full.txt b/llms-full.txt
index 15d51f800b..586cde6e05 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -9209,6 +9209,27 @@ as one line each, for example
A line that says `Unknown:` means the check could not run; it is not a clean
result. Ask the brain host's operator to run the steps above.
+<a id="fix-wave-6"></a>
+### Upgrading to v0.60.30.0 (fix wave 6)
+
+**Say to your agent:** *"We upgraded gbrain to v0.60.30.0. Preview the
+unlinked facts relink and the link re-derivation for each source, and tell me
+what would change before applying anything."*
+
+`gbrain upgrade` applies migrations v187 (fact relink attempts) and v188 (the
+per-stint ontology dedup index). Restart every `gbrain serve`, autopilot and
+worker so they run the new code, then work through what applies:
+
+| Symptom | Check or code | Issue | Preview | Apply | Verify |
+| --- | --- | --- | --- | --- | --- |
+| "Who invested in X?" or "Who attended <meeting>?" finds nobody; meeting attendance edges point meeting -> person, or notes-only mentions are typed attended | none | N9-2, N9-3, N9-4, N12-7 | `gbrain extract links --source db --repair-attendance --source-id <id>` (attendance only, preview-bound) | `gbrain extract links --source db --include-frontmatter --source-id <id>` per source; body links also re-derive on the next `gbrain extract --stale` | `gbrain graph <person-slug>` shows person -> page `invested_in` / `attended` edges |
+| Facts saved without an entity are missing from entity recall and skipped as `no_entity` by the conflict sweep | doctor `unlinked_facts` | #5836 | `gbrain facts relink --dry-run` | `gbrain facts relink` (model tier capped by `--max-usd`, default $1.00) | `gbrain doctor` (`unlinked_facts`); `gbrain decide status` |
+| `remember` answers `warnings: ["NO_ENTITY"]` | none | #5836 | none | pass `entity`, or name exactly one existing person or company in the text; `gbrain config set facts.entity_inference off` turns inference off | the response carries `entity_inferred` or the chosen entity |
+| A CLI write on PGLite pauses for up to 30 s, then fails lock-busy | lock busy | N5-2 | none | wait for the other CLI call, or stop the long-running non-serve holder (for example a jobs daemon) | re-run the write |
+| The next `gbrain eval suspected-contradictions` estimates a full re-judge | none | N2-3 | the printed cost estimate | run it after you agree (judge prompt v3 invalidated the cache once) | the run reports judged pairs |
+| Hybrid search on Postgres returns keyword-only results or hits the vector timeout | doctor `vector_plan` | #5824 | `gbrain doctor` | upgrade and restart; rollback for this release: `gbrain config set search.vector_legacy_guard true`, then restart serve and autopilot | `gbrain doctor` shows `vector_plan` ok |
+| Facts about you that came from pasted text or from gbrain's own claude-cli calls | doctor `self_capture` | #5812, #5820 | `gbrain recall` for the fact | `gbrain forget <fact id>`; doctor `self_capture` prints one-time quarantine commands for old self-capture files | `gbrain doctor` |
+
<a id="fix-wave-5"></a>
### Upgrading to v0.60.28.0 (fix wave 5)
diff --git a/openclaw.plugin.json b/openclaw.plugin.json
index b290781cf0..3690e45e48 100644
--- a/openclaw.plugin.json
+++ b/openclaw.plugin.json
@@ -1,7 +1,7 @@
{
"id": "gbrain-context-engine",
"name": "gbrain",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Personal knowledge brain with Postgres + pgvector hybrid search",
"family": "bundle-plugin",
"kind": "context-engine",
diff --git a/package.json b/package.json
index 86db6e856b..cab381910c 100644
--- a/package.json
+++ b/package.json
@@ -205,7 +205,7 @@
"bun": ">=1.4.0"
},
"license": "MIT",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"overrides": {
"@ai-sdk/provider-utils": "4.0.33",
"@hono/node-server": "^2.0.5",
diff --git a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
index 79bf4ec563..57be063171 100644
--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
index 05ee40de00..b3577a8e2d 100644
--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-coding",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-coding/README.md b/plugin-variants/gbrain-coding/README.md
index 5844df0f79..f701280c2c 100644
--- a/plugin-variants/gbrain-coding/README.md
+++ b/plugin-variants/gbrain-coding/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.28.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.30.0 -->
# gbrain-coding (generated persona variant — do not hand-edit)
Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.
diff --git a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
index 00f123b45a..e4f0c978dd 100644
--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
index ec52d80904..6f3ee63f21 100644
--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json
@@ -1,6 +1,6 @@
{
"name": "gbrain-daily",
- "version": "0.60.28.0",
+ "version": "0.60.30.0",
"description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)",
"author": {
"name": "Garry Tan",
diff --git a/plugin-variants/gbrain-daily/README.md b/plugin-variants/gbrain-daily/README.md
index 696a707bc8..10bda5e967 100644
--- a/plugin-variants/gbrain-daily/README.md
+++ b/plugin-variants/gbrain-daily/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.28.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.30.0 -->
# gbrain-daily (generated persona variant — do not hand-edit)
Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.
diff --git a/plugin/README.md b/plugin/README.md
index 5f38a69fc5..6b239a133e 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -1,4 +1,4 @@
-<!-- gbrain-plugin-tree-stamp: 0.60.28.0 -->
+<!-- gbrain-plugin-tree-stamp: 0.60.30.0 -->
# gbrain plugin skill tree (generated — do not hand-edit)
This tree is the curated skill set for the gbrain Codex and Claude Code
diff --git a/skills/migrations/v0.60.30.0.md b/skills/migrations/v0.60.30.0.md
new file mode 100644
index 0000000000..a7eca24719
--- /dev/null
+++ b/skills/migrations/v0.60.30.0.md
@@ -0,0 +1,89 @@
+# Upgrade to v0.60.30.0: fix wave 6
+
+Fix wave 6 closes two privacy leaks (private ontology values shown to remote
+callers, forgotten facts kept in hot memory), stores investor, partner and
+attendance links from the person to the page, links facts saved without an
+entity, makes the contradiction judge stricter about time and names, and keeps
+the vector half of hybrid search on large Postgres brains. Migrations v187 and
+v188 run during `gbrain upgrade`. Never apply a relink or a repair on the
+user's behalf without asking.
+
+## What the user will notice
+
+- Remote agents no longer see ontology values saved as private.
+- A forgotten fact disappears from the hot-memory block right away.
+- "Who invested in X?" and "Who attended <meeting>?" answer from the person
+ side. A person only mentioned in meeting notes is a mention, not an
+ attendee.
+- `remember` without an entity may file the fact on the one person or company
+ it names; the response says `entity_inferred`, or warns `NO_ENTITY` with a
+ hint.
+- A CLI write on a PGLite brain held by another CLI call waits up to 30
+ seconds for the lock instead of failing with `owner_unavailable`.
+- The next `gbrain eval suspected-contradictions` re-judges every pair once
+ (judge prompt v3) and prints its cost estimate first.
+- `gbrain doctor` may report `unlinked_facts`, `vector_plan` or
+ `self_capture`.
+
+## Step 1: restart everything that runs gbrain
+
+Tell the user, then, with their agreement: stop autopilot and workers, stop
+each resident `gbrain serve`, run `gbrain upgrade` on each host, confirm
+`gbrain --version` prints `0.60.30.0` through each launcher's binary path,
+and restart them.
+
+## Step 2: re-derive relationship and attendance links
+
+The link extractor version moved, so the next `gbrain extract --stale` (or the
+autopilot cycle) re-derives body links on its own. Frontmatter links need one
+explicit run per source. Ask the user first, then for each source id from
+`gbrain sources list`:
+
+```bash
+gbrain extract links --source db --include-frontmatter --source-id <id>
+```
+
+Each page's own derived links are replaced in one transaction. Manual links
+and links created by other pages are untouched. If the user wants a reviewed,
+preview-bound repair of historical attendance instead, follow
+`docs/guides/attendance-evidence.md` ("Preview-bound historical repair").
+
+Code or routines that walked meeting -> person `attended` edges must now walk
+incoming edges (person -> meeting).
+
+## Step 3: link facts that have no entity
+
+Run `gbrain doctor` and read `unlinked_facts`. If it reports a backlog, show
+the user the preview:
+
+```bash
+gbrain facts relink --dry-run
+```
+
+Only after they agree, apply it (the model tier is capped by `--max-usd`,
+default $1.00):
+
+```bash
+gbrain facts relink
+```
+
+If the user does not want automatic entity inference on new facts:
+`gbrain config set facts.entity_inference off`. That does not undo earlier
+links.
+
+## Step 4: contradiction re-judge
+
+Before the next `gbrain eval suspected-contradictions`, tell the user the
+judge cache was invalidated and the run will re-judge every pair. Show the
+printed cost estimate and wait for agreement.
+
+## Step 5: verify
+
+```bash
+gbrain doctor
+gbrain stats
+```
+
+If vector search regresses on a Postgres brain, the rollback for this release
+is `gbrain config set search.vector_legacy_guard true` on the brain host,
+then a restart of serve and autopilot. Report it as an issue.
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 023b7769bd..f696f495d3 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -156,6 +156,7 @@
"migrations/v0.60.26.0.md": "30d761ef5a2361bad66053f97b7b659304a591274be33e281f4f6df0d7d5566e",
"migrations/v0.60.27.0.md": "1c3ac6a23ccfce8ad299457799b02958f7d21fcd967c471634f73bdb66f2b603",
"migrations/v0.60.28.0.md": "f7fa936066fb188f6f3f54bb6c720f57743792e4371d0b98dd3cb5a57d1bd9c9",
+ "migrations/v0.60.30.0.md": "2dd24bb319cad80ae15c52fb163c704fc3adfc1182d44ab563f636f07434a9e0",
"migrations/v0.60.5.0.md": "0d3ee19359a2740de08ac9ec388ddc15e7c72d663afe33832e1e54170528acab",
"migrations/v0.60.6.0.md": "1cbfca2c899e1348acbd61f0baa4c8e723b5283ff868c710c74e116c0cb6726e",
"migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",
diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.md
index c9461bc94c..ff7444e13b 100644
--- a/templates/bootstrap/template-repo/README.md
+++ b/templates/bootstrap/template-repo/README.md
@@ -1,6 +1,6 @@
# gbrain agent workspace — template
-<!-- gbrain-template-stamp: 0.60.28.0 -->
+<!-- gbrain-template-stamp: 0.60.30.0 -->
This repository is the **"Use this template"** distribution artifact for a
[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same