Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
docs: README, protocol and guides describe what gbrain does now, not how it got here (#6009)
Garry Tan6622a119e40e
diff --git a/AGENTS.md b/AGENTS.mdindex 977ecff35a..cfaeb5de37 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -33,8 +33,8 @@ start here.and confirm their choice before continuing. Cost spread between cornersis 25x — silent acceptance is the wrong default. See[`./INSTALL_FOR_AGENTS.md`](./INSTALL_FOR_AGENTS.md) Step 3.5 for the- exact ask-the-user protocol. Same banner fires on `gbrain post-upgrade`- for existing users (search modes were added in v0.32.3).+ exact ask-the-user protocol. The same banner fires on `gbrain post-upgrade`+ for a brain created before v0.32.3, when search modes arrived.4. Read [`./INSTALL_FOR_AGENTS.md`](./INSTALL_FOR_AGENTS.md) for the full step-by-stepflow (keyless memory, optional API capabilities, maintenance, verification).diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1f683cc2b6..32213b24fd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -219,7 +219,7 @@ Scripts that parse exit codes or `--json` output should read the [behavior chang| --- | --- | --- | --- || `gbrain embed --stale` time-budget stop | exit 3 | exit 11 (since v0.60.37.0) | treat 11 as "run `resume_command`"; 3 now only means `confirmation_required` || `gbrain dream --drain` with backlog left | exit 3 | exit 11, `--json` carries `resume_command` | treat 11 as a resumable stop |-| Other exit-3 sites (`agent run --follow` timeout, `providers test`, `sources harden`, `sources pull`, `sources remove/archive default`, `extract-conversation-facts`) | exit 3 | 124, 1 or 2 ([exit codes](docs/guides/exit-codes.md#changed-in-this-release)) | branch on the new codes |+| Other exit-3 sites (`agent run --follow` timeout, `providers test`, `sources harden`, `sources pull`, `sources remove/archive default`, `extract-conversation-facts`) | exit 3 | 124, 1 or 2 ([exit code changes by command](#exit-code-changes-by-command)) | branch on the new codes || `migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | exit 2 ("pass `--yes`") | exit 3 with the consent payload | stop, relay `user_message`, run `fix.command` only after the user agrees || `pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | exit 1 | exit 3 with the consent payload | same || `book-mirror` paid fan-out without authorization | exit 0 ("cancelled", nothing ran) | exit 3 with the consent payload | same |@@ -263,6 +263,29 @@ Scripts that parse exit codes or `--json` output should read the [behavior chang`gbrain mcp expose` and `gbrain google` still exit 2 when they need confirmation (documented contract v1 legacy); `mcp expose`'s document now also carries the consent fields (`code`, `effects`, `user_message`, `fix`).++#### Exit code changes by command++Scripts written against v0.60.45.0 or earlier see these exits differ. "Before" is the old exit.++| Command | Before | Now | Why |+|---|---|---|---|+| `gbrain embed --stale` time-budget stop | 3 | 11 | 3 means "ask the user first"; a budget stop means "run the resume command" |+| `gbrain dream --drain` backlog left (window/deadline/lock stop, busy cycle lock) | 3 | 11 | a resumable stop; `--json` carries `resume_command` |+| `gbrain agent run … --follow` timeout | 3 | 124 | a timeout, not a consent stop; the job keeps running |+| `gbrain providers test` transient provider error | 3 | 1 (retryable) | retryable failure |+| `gbrain sources harden` with sources needing attention | 3 | 1 | failure for cron; the report names what to fix |+| `gbrain sources pull` rebase conflict aborted | 3 | 1 | failure |+| `gbrain sources remove default` / `gbrain sources archive default` | 3 | 2 | invalid input |+| `gbrain extract-conversation-facts` pages skipped on a busy lock | 3 | 1 (retryable) | re-run to finish the skipped pages |+| `gbrain call` invalid parameters | 1 | 2 | invalid input; stdout carries the error envelope |+| `gbrain migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | 2 | 3 | a consent stop: the payload names the effects and the words to ask the user |+| `gbrain pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | 1 | 3 | a consent stop, not a failure |+| `gbrain book-mirror` paid fan-out without authorization | 0 | 3 | nothing ran |+| `gbrain doctor --remediate` without a terminal and without `--yes` | 0 (it ran) | 3 | paid and destructive work waits for the user |+| `gbrain autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` with a bad value | 1 | 2 | invalid input |+| `gbrain jobs submit` on PGLite without `--follow` or `--queue-only` | 0 (queued, no worker) | 1 (`no_worker`) | the job would wait for a worker that is not running |+### Itemized changes#### The agent error contractdiff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.mdindex ac197c7627..e8556de984 100644--- a/INSTALL_FOR_AGENTS.md+++ b/INSTALL_FOR_AGENTS.md@@ -390,9 +390,9 @@ gbrain skillpack scaffold --all # copy the 50+ bundled skills + RESOLVER.mScaffolded skills are first-class files in your repo. Edit freely; re-running scaffoldrefuses to overwrite anything that exists. Use `gbrain skillpack reference <name>` to-diff against gbrain's bundle when you want upstream improvements. (The legacy-`gbrain skillpack install` managed-block model was removed in v0.33 — run-`gbrain skillpack migrate-fence` once if upgrading from an older release.)+diff against gbrain's bundle when you want upstream improvements. (A workspace+that still carries the managed-block fence from `gbrain skillpack install`, a+model gbrain removed in v0.33, needs `gbrain skillpack migrate-fence` once.)> **PGLite brains are single-process (applies to every MCP registration> below).** PGLite is a single-writer embedded Postgres: the first running@@ -492,7 +492,7 @@ platform glue entirely with `gbrain autopilot --install` (built-in self-maintainworks during DB outages.- **Auto-update** (daily): `gbrain check-update --json` (tell user, never auto-install).- **Dream cycle** (nightly): `gbrain dream` runs the 8-phase overnight maintenance cycle.- Entity sweep, citation fixes, memory consolidation, plus (v0.23+) overnight conversation+ Entity sweep, citation fixes, memory consolidation, plus overnight conversationsynthesis and cross-session pattern detection. One cron-friendly command. This is whatis an opt-in maintenance capability. See `docs/guides/cron-schedule.md` for thefull protocol.@@ -536,16 +536,16 @@ consent gates around unattended remediation.## Upgrade-For v0.60.5.0 and later, confirm a database backup exists before upgrading,-upgrade every process that writes to the brain, then follow the+When an upgrade crosses v0.60.5.0, confirm a database backup exists before+upgrading, upgrade every process that writes to the brain, then follow the[v0.60.5.0 steps](skills/migrations/v0.60.5.0.md): one full `gbrain doctor`,then preview `gbrain repair` and apply only after the user agrees-([repair guide](docs/guides/repair.md)). For v0.60.6.0, also follow the-[one-time timeline prune and slug-collision steps](skills/migrations/v0.60.6.0.md). For v0.60.11.0, preview+([repair guide](docs/guides/repair.md)). Across v0.60.6.0, also follow the+[one-time timeline prune and slug-collision steps](skills/migrations/v0.60.6.0.md). Across v0.60.11.0, preview`gbrain repair contextual-mode` and rebuild PGLite vector indexes after a crashrepair ([steps](skills/migrations/v0.60.11.0.md)).-For v0.53.0.0, follow the+When an upgrade crosses v0.53.0.0, follow the[mechanical shared-skills migration](skills/migrations/v0.53.0.0.md) on the host,starting with `gbrain apply-migrations --dry-run --json`. Stop/exclude old writers,review writer status, and use the checklist's action-specific `--admin-intent`@@ -594,20 +594,20 @@ v0.31.x retrieval shape), then run `gbrain config set search.mode <mode>`. SeeStep 3.5 above for the full ask-the-user protocol — the upgrade path uses thesame matrix and same default.-For v0.12.0+ specifically: if your brain was created before v0.12.0, run+If the brain was created before v0.12.0, run`gbrain extract links --source db && gbrain extract timeline --source db` to-backfill the new graph layer (see Step 4.5 above).+backfill the graph layer (see Step 4.5 above).-For v0.12.2+ specifically: if your brain is Postgres- or Supabase-backed and-predates v0.12.2, the `v0_12_2` migration runs `gbrain repair-jsonb`-automatically during `gbrain post-upgrade` to fix the double-encoded JSONB-columns. PGLite brains no-op. If wiki-style imports were truncated by the old+If the brain is Postgres- or Supabase-backed and was created before v0.12.2,+the `v0_12_2` migration runs `gbrain repair-jsonb` automatically during+`gbrain post-upgrade` to fix double-encoded JSONB columns (PGLite brains+no-op). If wiki-style imports from before v0.12.2 were truncated by a`splitBody` bug, run `gbrain sync --full` after upgrading to rebuild`compiled_truth` from source markdown.## The onboard surface-`gbrain onboard` is the activation surface gbrain did not have before.+`gbrain onboard` is gbrain's activation surface.Once your brain has any content, run `gbrain onboard --check --json` tosee structured recommendations across 5 brain-health axes (orphans,stale embeddings, entity link coverage, timeline coverage, takes count).@@ -651,8 +651,8 @@ grants.writing/originals page content to your configured chat model (defaultAnthropic Haiku). Refuses to run unless `takes.bootstrap_enabled=true`is set in config AND `--yes` is passed. Two-gate opt-in by design.-- Autopilot's auto-apply tier for takes-bootstrap stays `manual_only`- until v0.42.1's eval gate (do not bypass).+- Autopilot's auto-apply tier for takes-bootstrap is `manual_only`+ (do not bypass).**Suppress nudges in CI / scripted environments:**```bashdiff --git a/README.md b/README.mdindex 90da15251e..e3e098bdcd 100644--- a/README.md+++ b/README.md@@ -212,17 +212,17 @@ to keep daemon installation and paid reindexing opt-in.For a hosted brain, start with the [native OAuth and private machine connection guide](docs/guides/hosted-harness-access.md). To open the dashboard, register clients, edit access, or invalidate tokens, use [MCP administration](docs/mcp/ADMIN.md). A **profile** controls MCP authority; a **surface** controls which granted tools are visible. Neither grants owner dashboard access. New memory profiles use the starter surface. `--surface verbs` retains exactly the seven memory verbs, with orientation available through `gbrain://capabilities`. Thin CLI connections use the full surface and remain restricted by their grants.-The existing connection commands below remain supported. Choose the instructions for your actual product:+Choose the connection instructions for your actual product:-**Upgrading an existing brain:** existing search chunks need rebuilding before-remote chunk retrieval resumes. Semantic result caching is temporarily disabled;+**Upgrading a brain indexed before v0.48.3.0:** its search chunks need rebuilding+before remote chunk retrieval returns them. Semantic result caching is temporarily disabled;stored contradiction reports and code-inspection tools have local-only limits.Follow the [upgrade recovery guide](skills/migrations/v0.48.3.0.md) for rebuildcommands, embedding costs, and the restrictions that remain after rebuilding.**Say to your agent:** *"Upgrade gbrain and check whether my search index needs rebuilding."*- **[Claude Code](docs/mcp/CLAUDE_CODE.md)** — plugin: `/plugin marketplace add garrytan/gbrain` + `/plugin install gbrain@gbrain` (MCP + skills; persona variants `gbrain-coding` / `gbrain-daily` install curated subsets; pick one). Marketplace-free skills: `gbrain skillpack scaffold --harness claude-code` copies a persona-curated skill set into your user-scope skills dir. Or local one-liner: `claude mcp add gbrain -- "$(command -v gbrain)" serve`. Remote with just a bearer token: `gbrain connect https://your-host/mcp --token gbrain_xxx` prints a paste-ready block (or `--install` wires it up and smoke-tests the token).-- **[Codex](docs/mcp/CODEX.md)** — plugin (recommended): `codex plugin marketplace add garrytan/gbrain@codex-plugin` + `codex plugin add gbrain@gbrain` installs the MCP server AND the curated skill set. Or connect-only: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex` (or `--install`); That legacy path reads `$GBRAIN_REMOTE_TOKEN` at runtime. The new private-handoff installer writes a private managed HTTP header so the connection survives a new shell.+- **[Codex](docs/mcp/CODEX.md)** — plugin (recommended): `codex plugin marketplace add garrytan/gbrain@codex-plugin` + `codex plugin add gbrain@gbrain` installs the MCP server AND the curated skill set. Or connect-only: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex` (or `--install`); the token path reads `$GBRAIN_REMOTE_TOKEN` at runtime, while the private-handoff installer writes a private managed HTTP header so the connection survives a new shell.- **[Cursor / Windsurf / any stdio MCP client](docs/mcp/CLAUDE_CODE.md)** — same shape, add `{"command": "gbrain", "args": ["serve"]}` to your MCP config.- **[Hermes](docs/mcp/HERMES.md)** — `printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve`. Keep `--args` last, and verify with `hermes mcp test gbrain` (the add exits 0 even on failure).- **[Grok Bot](docs/guides/grok-bot.md)** — recommended: keep the brain on your computer, publish it with `gbrain mcp expose --funnel`, grant the Bot a `memory-writer` client and install the thin CLI at `/workspace/gbrain`; or install memory inside the Bot computer when no machine of yours stays online. Bots share local files and credentials; sources organize memory without isolating Bots. **Say to your agent:** *"connect grok bot to my brain"*.diff --git a/docs/ENGINES.md b/docs/ENGINES.mdindex f639adb721..4289d015b1 100644--- a/docs/ENGINES.md+++ b/docs/ENGINES.md@@ -390,7 +390,7 @@ src/schema.sql (canonical for every other table) ─┴─> src/schema.sql BEGINchunk-index and FTS-language policies at runtime. An unknown statement kind, an unclassified`DO` block, or a rule that no longer matches fails the build.- **Guards**: `check:schema-fresh` regenerates the whole chain into a temp dir and names the source- to edit on drift; the E4 catalog goldens (`test/schema-catalog-golden.test.ts`,+ to edit on drift; the catalog goldens (`test/schema-catalog-golden.test.ts`,`test/e2e/schema-catalog-golden.test.ts`) and `test/pglite-upgrade-replay.test.ts` pin the endstate.@@ -695,7 +695,7 @@ and assert `jsonb_typeof` — the assertion PGLite cannot make.`dialect-pglite.ts` and `dialect-postgres.ts`, expose it through a private`engineSql` getter over the current connection, and delegate every methodof a migrated domain to `src/core/engine-sql/<domain>.ts` the way both- engines do. Declare its capabilities honestly. The E5 binding matrix+ engines do. Declare its capabilities honestly. The binding matrix(`test/helpers/executor-binding-matrix.ts`) and the engine-sql contracttests tell you whether the adapter binds, counts, fails and cancels like theothers. A non-SQL engine implements every method itself.diff --git a/docs/GBRAIN_VERIFY.md b/docs/GBRAIN_VERIFY.mdindex 68cb6ee906..82b8970f81 100644--- a/docs/GBRAIN_VERIFY.md+++ b/docs/GBRAIN_VERIFY.md@@ -170,8 +170,10 @@ gbrain statsgbrain embed --stale```-If `OPENAI_API_KEY` is not set, embeddings can't be generated. Keyword search-still works without embeddings, but hybrid/semantic search won't.+Without a key for the configured embedding provider (`VOYAGE_API_KEY` for the+default `voyage:voyage-4`, `OPENAI_API_KEY` for OpenAI models), embeddings can't+be generated. Keyword search still works without embeddings, but+hybrid/semantic search won't.### 4c. End-to-End Test@@ -216,10 +218,12 @@ gbrain stats**Expected:** Embedded chunk count matches (or is close to) total chunk count.-**If zero or very low:** `OPENAI_API_KEY` may be missing or invalid. Check:+**If zero or very low:** the embedding provider key (`VOYAGE_API_KEY` for the+default model, `OPENAI_API_KEY` for OpenAI models) may be missing or invalid.+Check:```bash-echo $OPENAI_API_KEY | head -c 10+echo $VOYAGE_API_KEY | head -c 10 # or $OPENAI_API_KEY```If blank, set the key. Then:diff --git a/docs/TESTING.md b/docs/TESTING.mdindex 638d34f94b..845c3ce8a0 100644--- a/docs/TESTING.md+++ b/docs/TESTING.md@@ -239,7 +239,7 @@ Recorded ownership changes:reconciliation crash boundaries" step runs both files by name and uploads thecrash manifests, unchanged. Both files are in `E2E_EXCLUSIONS`(`PERSISTENCE_VALIDATION_OWNED` in `scripts/e2e-matrix.ts`), so PR- `selected-e2e` no longer runs them a second time; `scripts/select-e2e.ts`+ `selected-e2e` does not run them a second time; `scripts/select-e2e.ts`prints `excluded: <file> (owned by persistence-validation.yml)` on stderr whena mapped source changes. The nightly full-corpus E2E run and the local gates(`ci:local`, `ci:ubicloud`, their `:diff` forms) still run them. Run them@@ -1100,7 +1100,7 @@ and the `Migration` type in `schema-migrations/types.ts`. Fixtures:(flags omitted, a flag string without `w`/`a`/`+`, or `O_RDONLY` without`O_WRONLY`/`O_RDWR`), file or directory, and on one whose flags it cannotread. Windows refuses fsync on a read-only handle and has no directory flush-(EPERM), which wedged the managed write queue (#5595) and every skill-bundle+(EPERM), which wedges the managed write queue (#5595) and every skill-bundlepublication (#5475). Flushes of descriptors opened for writing pass. Eachfailure prints `FAIL [durable_flush_read_handle]: <file>:<line>`, the open ittraced, a `Fix:` line and this anchor. Fix: fsync the descriptor you wrotediff --git a/docs/ai-providers/claude-cli.md b/docs/ai-providers/claude-cli.mdindex a1be194643..7817a0dd8a 100644--- a/docs/ai-providers/claude-cli.md+++ b/docs/ai-providers/claude-cli.md@@ -73,8 +73,8 @@ stdin:single-writer lock.- `--settings '{"disableAllHooks":true}'` stops the child from running yourClaude Code hooks (user and project settings). Without it, gbrain's own- Stop hook banked every claude-cli call's prompt as one of your- conversations, and extracting facts from it spawned another call (#5820).+ Stop hook would bank every claude-cli call's prompt as one of your+ conversations, and extracting facts from it would spawn another call.Your login is unaffected: credentials are not settings. Hooks from amanaged policy file (`/etc/claude-code/managed-settings.json` on Linux)are a different case. Claude Code 2.1.287 still runs them, because policy@@ -133,7 +133,7 @@ above.| Streaming | Not implemented. `doStream()` throws. `gateway.toolLoop()` (the main caller) is non-streaming already, so this is not a practical limitation for subagent dispatch, but any caller that expects a streaming chat surface cannot use `claude-cli`. || Tool use | JSON emission via a system-prompt-injected protocol, not the CLI's native tool-call mechanism. Parallel tool calls in one turn round-trip correctly. || Multimodal | Not supported over the subprocess path. File/image message parts are rendered as a `[file <mediaType>]` text stub, not sent as actual content. |-| Prompt caching | The recipe declares `supports_prompt_cache: true`: Claude Code caches prompt prefixes itself on every `--print` run (Anthropic's Claude Code docs put `-p` runs in the main-conversation TTL bucket — one hour on a subscription, five minutes on an API key). gbrain cannot place `cache_control` breakpoints on this path — the adapter renders messages to stdin text and ignores `providerOptions` — so caching is automatic rather than gateway-driven, and `doctor`'s `subagent_capability` no longer grades a claude-cli subagent tier `degraded:no_caching`. `cache_read_input_tokens` is surfaced as `usage.cachedInputTokens` (next row). |+| Prompt caching | The recipe declares `supports_prompt_cache: true`: Claude Code caches prompt prefixes itself on every `--print` run (Anthropic's Claude Code docs put `-p` runs in the main-conversation TTL bucket — one hour on a subscription, five minutes on an API key). gbrain cannot place `cache_control` breakpoints on this path — the adapter renders messages to stdin text and ignores `providerOptions` — so caching is automatic rather than gateway-driven, and `doctor`'s `subagent_capability` does not grade a claude-cli subagent tier `degraded:no_caching`. `cache_read_input_tokens` is surfaced as `usage.cachedInputTokens` (next row). || Usage / token counts | Reported `usage.input_tokens` / `usage.output_tokens` are read straight from the CLI's `--output-format json` envelope (`result.usage?.input_tokens` / `output_tokens`); gbrain does not independently count tokens for this path. The envelope's `cache_read_input_tokens` is surfaced as `usage.cachedInputTokens`, so cache reads are counted in gbrain's usage accounting; `cache_creation_input_tokens` is not surfaced (the AI SDK's usage shape has no corresponding field). || Cost figures | The recipe declares `cost_per_1m_input_usd: 3.0` / `cost_per_1m_output_usd: 15.0` — the same Sonnet-class figures the `anthropic` recipe declares (`price_last_verified: 2026-06-17`) — purely so gbrain's budget ledger has a number to attribute per call. Neither the recipe nor the adapter code checks what you're actually billed; treat these as the ledger's nominal per-call number, not a verified charge. The `--max-usd` / `--max-cost` budget gate does not read them either: it prices `claude-cli:<model>` at the nominal Anthropic rate for that model, and a short alias (`claude-cli:haiku`) prices identically to the dated id it resolves to; `pricing.overrides` forces $0 or a real rate for any `claude-cli:*` string. || User-level CLAUDE.md | `~/.claude/CLAUDE.md` still loads on every call (see above) — only the working directory changes (see "What actually happens on a call" for exactly what that directory is and isn't). |diff --git a/docs/architecture/RETRIEVAL.md b/docs/architecture/RETRIEVAL.mdindex b4529f36a6..abb045de1e 100644--- a/docs/architecture/RETRIEVAL.md+++ b/docs/architecture/RETRIEVAL.md@@ -146,7 +146,7 @@ specific miss with `gbrain search diagnose "<q>" --target <slug>`.- **Entity** queries ("who works at X?") apply a higher graph-traversal weight.- **Temporal** queries ("what happened last week?") bypass source-boost so chat/daily pages surface.- **Event** queries ("Acme AI Series A") engage the timeline index.-- **Concept** queries ("what is the ownership economy?", "find all the companies doing offshore wind" — definitional paraphrases and landscape/quantifier phrasings with no proper noun) rank vector-lean, so keyword-decoy pages stop outranking the page that actually explains the idea. Proper nouns, quoted phrases, and sub-3-word queries never classify as concept — they keep their existing routing.+- **Concept** queries ("what is the ownership economy?", "find all the companies doing offshore wind" — definitional paraphrases and landscape/quantifier phrasings with no proper noun) rank vector-lean, so keyword-decoy pages don't outrank the page that actually explains the idea. Proper nouns, quoted phrases, and sub-3-word queries never classify as concept.- **General** queries hit the standard hybrid stack.The classifier is deterministic (no LLM call). Wrong classification degrades gracefully — the hybrid stack still works without it.@@ -163,7 +163,7 @@ strict `recall_all@5` while hybrid plus equal-weight expansion scores 54.89%(paired +3 / -183 questions). Variant lists with the original's weight canoutvote it on small-k retrieval.-The fix is budget-normalized weighted RRF, composed in `src/core/search/fusion-lists.ts`. Every vector list is a role-tagged arm (`original` | `variant` | `clause` | `image`) — tagged objects, never a positional convention, so a failed arm or a fell-open image branch can't mis-tag a list. The `original` arm always fuses at weight 1; the non-empty `variant`/`clause` arms share ONE total weight budget, `search.expansion_variant_budget` (`weight_i = b / n_voting_arms`, each row scored `weight / (k + rank)`), so total expansion influence is exactly `b` however many variants the LLM produced. `null` — the default in all three mode bundles — is the legacy equal-weight fusion (every list weight 1, byte-identical). A budget in (0, 4] is set with `gbrain config set search.expansion_variant_budget <b>`, per call via `HybridSearchOpts.expansionVariantBudget`, or pinned per eval arm with `gbrain eval longmemeval --expansion-variant-budget <b>` (sweep it against frozen `--expansion-replay` variants so cells differ only in `b`). Arithmetic: two variants agreeing on a distractor at rank 0 tie the original's rank-0 vote exactly at `b = 1.0`; legacy with two variants is ≈ `b = 2.0`; `b = 0.5` subordinates them. The knob is a no-op when expansion is off and folds into the query-cache key (`evb=`). Outcome (ranker wave, 2026-09-06, recorded Haiku variants replayed at every budget): the mechanism is real — strict `recall_all@5` rises from 255/470 at the legacy weighting to 394/470 at budget 0.25 — but its pre-registered rule (≥ plain hybrid − 2 on the 430-question decision set, no type losing > 1) failed at every budget (0.25: −43; plain hybrid 439/470), so every bundle keeps `expansion_variant_budget: null` and the knob is an operator lever. The receipts point at a trigger rather than a weight (expand only when the original query's evidence is weak), filed as the next pre-registered mechanism.+Budget-normalized weighted RRF, composed in `src/core/search/fusion-lists.ts`. Every vector list is a role-tagged arm (`original` | `variant` | `clause` | `image`) — tagged objects, never a positional convention, so a failed arm or a fell-open image branch can't mis-tag a list. The `original` arm always fuses at weight 1; the non-empty `variant`/`clause` arms share ONE total weight budget, `search.expansion_variant_budget` (`weight_i = b / n_voting_arms`, each row scored `weight / (k + rank)`), so total expansion influence is exactly `b` however many variants the LLM produced. `null`, the default in all three mode bundles, is equal-weight fusion (every list weight 1). A budget in (0, 4] is set with `gbrain config set search.expansion_variant_budget <b>`, per call via `HybridSearchOpts.expansionVariantBudget`, or pinned per eval arm with `gbrain eval longmemeval --expansion-variant-budget <b>` (sweep it against frozen `--expansion-replay` variants so cells differ only in `b`). Arithmetic: two variants agreeing on a distractor at rank 0 tie the original's rank-0 vote exactly at `b = 1.0`; equal weighting with two variants is ≈ `b = 2.0`; `b = 0.5` subordinates them. The knob is a no-op when expansion is off and folds into the query-cache key (`evb=`). Measured 2026-09-06 with recorded Haiku variants replayed at every budget: the mechanism is real — strict `recall_all@5` rises from 255/470 at equal weighting to 394/470 at budget 0.25 — but its pre-registered rule (≥ plain hybrid − 2 on the 430-question decision set, no type losing > 1) failed at every budget (0.25: −43; plain hybrid 439/470), so every bundle sets `expansion_variant_budget: null` and the knob is an operator lever. The receipts point at a trigger rather than a weight (expand only when the original query's evidence is weak) as the next mechanism to pre-register.The mode bundles retain a core-library `expansion` default (`tokenmax` true;`balanced` and `conservative` false). It applies only when a library caller@@ -242,7 +242,7 @@ failure (`isDbAccessFailure` in `src/core/pg-access-classify.ts` — the DBitself is unreachable, not a schema gap), `hybridSearch` rethrows the armerror instead of returning an empty result set. A dead database must surfaceas the classified `database_error` envelope, never as a silent "no results".-Schema-class arm failures (pre-migration brains) keep the fail-open contract.+Schema-class arm failures (pre-migration brains) fail open.The stage order is pinned by `hybridSearch` in `src/core/search/hybrid.ts`:dedup runs BEFORE the reranker (so the reranker sees a diverse candidate pool,@@ -294,26 +294,25 @@ shipped `balanced` default, `voyage:rerank-2.5`,`scripts/r1-namedthing-rerank-ab.ts --relational`, paired per query): withthe reranker on and no pin, hit@1 fell from 21/39 to 3/39 (19 paired losses)and hit@3 from 27/39 to 5/39 (22 paired losses), while the 11 non-relational-core questions showed 0 losses. With the pin at its default 3 — measured with-`--autocut on`, the shape that shipped before rule R2 turned autocut off — the-same paired comparison shows 0 hit@1 and-0 hit@3 losses (21/39 and 27/39, the reranker-off numbers) and the 11 core-questions unchanged, which is why the balanced reranker stays on.+core questions showed 0 losses. With the pin at its default 3 (measured with+`--autocut on`; autocut is off by default) the same paired comparison shows+0 hit@1 and 0 hit@3 losses (21/39 and 27/39, the reranker-off numbers) and the+11 core questions unchanged, which is why the balanced reranker is on.`pinRelationalRows`(`src/core/search/relational-rerank-pin.ts`) runs immediately after thereranker and re-pins the arm's rows above the reranked text rows in their fusedorder, bounded by `search.relational_rerank_pin` (3 in every bundle; `0`/`off`-restores the pre-pin ranking). It is a permutation of the pool (nothing added+disables the pin). It is a permutation of the pool (nothing addedor removed; one row per page; a relational row the reranker itself rankedhigher keeps that position; ties go to the fused order), fires only when thereranker actually reordered (fail-open and reranker-off runs are untouched —the fused order already carries the arm), and is a pure no-op fornon-relational queries. Pinned rows are stamped `relational_pinned` so autocut-keeps them and leaves them out of its cliff math (text-row autocut is-unchanged). The #3995 evidence slot still runs afterwards as the page-1-guarantee for pin 0 / fail-open runs. The pin trusts the arm: a false-positive-arm now puts up to `max` edge pages at the top instead of one at `limit` —-turn it off per brain with `gbrain config set search.relational_rerank_pin off`.+keeps them and leaves them out of its cliff math (text rows are cut as+usual). The evidence slot runs afterwards as the page-1 guarantee for pin 0 /+fail-open runs. The pin trusts the arm: a false-positive arm puts as many edge+pages at the top as the pin allows, where an unpinned run would place one at+`limit`. Turn it off per brain with `gbrain config set search.relational_rerank_pin off`.The knob folds into the query-cache key (`rrp=`).### Metadata boost gate: vector-only voters keep the vector order@@ -322,8 +321,8 @@ The post-fusion metadata boosts (backlink, salience, recency + chronicle,graph signals, alias resolution) reward well-connected pages. That is rightwhen a lexical arm agreed the page is about the query; it is wrong onparaphrase-style concept questions where nothing but the vector arm voted —-there the boosts promoted hub pages (1.03–1.12x) over the gold concept page,-which carried none. `decideMetadataBoosts`+there the boosts promote hub pages (1.03–1.12x) over the gold concept page,+which carries none. `decideMetadataBoosts`(`src/core/search/metadata-boost-gate.ts`) runs before `runPostFusionStages`and, under `search.metadata_boost_gate=lexical` (every bundle), skips thoseboosts when no strict keyword, title-phrase or relational row fused (relaxed@@ -332,19 +331,19 @@ title-phrase boost, compiled-truth boost, cosine re-score, dedup, rerankerand autocut are untouched either way. Receipt (Cat 13 conceptual recall,gbrain-evals): held-out nDCG@5 53.0 → 57.8 (bare vector 60.5 remains thestretch), NamedThingBench, BrainBench, the retrieval canary and the-LongMemEval dev slice byte-identical. `always` restores the pre-wave-pipeline; the decision is on `HybridSearchMeta.metadata_boost_gate`; the+LongMemEval dev slice byte-identical. `always` applies the boosts whatever+voted; the decision is on `HybridSearchMeta.metadata_boost_gate`; theknob folds into the query-cache key (`mbg=`). The companion`search.keyword_arm_confidence_floor` (`src/core/search/arm-confidence.ts`,off in every bundle) down-weights a weak keyword arm in the fusion; its-pre-registered receipt did not move the held-out score, so it ships as an+pre-registered receipt did not move the held-out score, so it is anoperator knob only.### Autocut: score-discontinuity result-sizing-Off by default in every bundle. It shipped on for `balanced` and `tokenmax`-until the ranker wave's pre-registered rule R2 measured it on LongMemEval from-the shipped default's captured post-rerank pool: with the reranker on, the+Off by default in every bundle. Pre-registered rule R2 measured it on+LongMemEval from the default path's captured post-rerank pool: with the+reranker on, thescore cliff after the top session is the normal shape on multi-part questions,and the cut removed the second gold session — strict `recall_all@5` 449/470 →379/470 (−68 paired on the 430-question decision set), with no floor in the@@ -354,7 +353,7 @@ autocut keeps the best session and drops the rest, which is a token saving(mean returned window 3256 → 1633 estimated tokens at 0.35) paid for with thequestions that need more than one session. `gbrain config set search.autocuttrue` re-enables it with the knobs below; a session-aware cut (never below k-distinct sessions) is the filed follow-up. `applyAutocut`+distinct sessions) is a filed follow-up. `applyAutocut`(`src/core/search/autocut.ts`) cuts the ranked set at the largestcross-encoder rerank-score cliff, before the limit slice, first page only.Never-empty failsafe (`minKeep`), no-op when fewer than 2 results carry a@@ -398,8 +397,8 @@ chunks, while neighbor windows reached only 285–292, so `auto` givesconversations exactly the `page` unit. `auto` itself answered 445 of 500LongMemEval-S questions against 312 for chunks (development data), and thepreregistered sealed check was inconclusive at a ceiling (149 against 147 of-150); see `docs/evidence-delivery.md` for the numbers and the token cost. The-earlier failed lexical excerpt selector is in+150); see `docs/evidence-delivery.md` for the numbers and the token cost. A lexical+excerpt selector that failed its evaluation is recorded in`docs/eval/ANSWER_PACKET_RESULTS.md`. Contract, algorithms and latency:[`docs/evidence-delivery.md`](../evidence-delivery.md).@@ -424,7 +423,7 @@ gbrain eval replay --against before.ndjsongbrain eval --qrels qrels.json --config-a baseline.json --config-b balanced.json```-The current measured LongMemEval result (95.53% session-level `recall_all@5` on the release default path, 449/470, and 93.40% with the reranker off, 439/470; cleaned S split, 470 scored questions, k=5, measured 2026-09-06 by the in-repo harness), its per-type table, every arm of the ranker wave and the judged answer-accuracy row live in [`docs/eval-bench.md`](../eval-bench.md#public-benchmarks-longmemeval).+The current measured LongMemEval result (95.53% session-level `recall_all@5` on the release default path, 449/470, and 93.40% with the reranker off, 439/470; cleaned S split, 470 scored questions, k=5, measured 2026-09-06 by the in-repo harness), its per-type table, every measured ranker arm and the judged answer-accuracy row live in [`docs/eval-bench.md`](../eval-bench.md#public-benchmarks-longmemeval).Methodology + metric glossary in [`docs/eval/SEARCH_MODE_METHODOLOGY.md`](../eval/SEARCH_MODE_METHODOLOGY.md).@@ -433,9 +432,9 @@ Methodology + metric glossary in [`docs/eval/SEARCH_MODE_METHODOLOGY.md`](../evaRemote reads default to the `world` take holder when no grant is supplied; anexplicit empty grant permits no takes. Counts and average weights use onlypermitted active takes. Stored emotional weight contributes zero because it-combines all holders. Recent-salience inclusion uses `updated_at`, while the-existing recency formula is retained; unrestricted local reads keep their-existing formulas. Deleted, quarantined and archived contributors are excluded+combines all holders. Recent-salience inclusion uses `updated_at` with the+same recency formula as unrestricted local reads, which use their full+formulas. Deleted, quarantined and archived contributors are excludedbefore ranking, limits and anomaly-baseline aggregation. Default remote pageprivacy also excludes private pages; its documented opt-outs do not widentake-holder permissions.@@ -444,14 +443,14 @@ take-holder permissions.## Chunk rebuilds after upgrading**Say to your agent:** *"Check whether my search index is ready, and repair-code metadata without spending on embeddings."* Search and query now report+code metadata without spending on embeddings."* Search and query report`projection_readiness` for empty and nonempty results. `projection_pending`means visible pages lack a current revision seal; `projection_status_unknown`means the diagnostic could not establish readiness. Neither is a clean miss.The CLI names these states; `--json` retains its result-array format and sendsincompleteness notices to stderr. MCP carries them in `_meta.retrieval`.-The upgraded resident `gbrain serve` drains queued Markdown and code rebuilds+A resident `gbrain serve` drains queued Markdown and code rebuildswithout provider calls. Code repair can also run through the current owner:`gbrain reindex-code --force --no-embed`. Rebuilds preserve only exact,provenance-compatible vectors: each vector records the embedding input it wasdiff --git a/docs/architecture/canonical-writers.md b/docs/architecture/canonical-writers.mdindex 0565bc5bfc..b37045235b 100644--- a/docs/architecture/canonical-writers.md+++ b/docs/architecture/canonical-writers.md@@ -38,7 +38,7 @@ Managed Markdown sync runs on the registered filesystem owner withcommit, source incarnation, owner epoch, topology generation and pageidentities/revisions. Attached repositories import committed Git content;`--working-tree` opts into uncommitted files and detached repositories include-them automatically. Source-relative exclusions retain their existing meaning.+them automatically. Source-relative exclusions apply as they do in classic sync.Each file's bytes and fingerprint are frozen before its journal request isadmitted. Import leaves the original bytes intact unless canonical sanitizationor retained tags require an explicit recoverable file publication.diff --git a/docs/architecture/schema-packs.md b/docs/architecture/schema-packs.mdindex 8fb9724a0f..111895c159 100644--- a/docs/architecture/schema-packs.md+++ b/docs/architecture/schema-packs.md@@ -138,15 +138,13 @@ this chain top-down. First match wins.| 6 | `~/.gbrain/config.json` `schema_pack` field | What `gbrain schema use` (and `gbrain init`, which sets `gbrain-base-v2`) writes. || 7 | Default: `gbrain-base` | Always present. |-Tier 7 stays `gbrain-base`, not `gbrain-base-v2`. A brain with no pack-configured anywhere was created before `gbrain init` started writing-`schema_pack`, and its pages carry the legacy 24-type taxonomy. Pointing the-fallback at v2 would change type inference, alias closure and enrichment for-those brains without running v2's `migration_from` retype rules, which-`gbrain schema upgrade` applies as a reviewed step. The relationship-behaviors that used to differ between the two (backwards frontmatter-relations and attendance typed from any meeting link) are fixed in the-extractor instead, so both packs store the same edges; see+Tier 7 is `gbrain-base`, not `gbrain-base-v2`. Only a brain whose+`gbrain init` never wrote `schema_pack` reaches tier 7, and its pages carry the+legacy 24-type taxonomy. Pointing the fallback at v2 would change type+inference, alias closure and enrichment for those brains without running v2's+`migration_from` retype rules, which `gbrain schema upgrade` applies as a+reviewed step. Relation direction and meeting attendance are decided in the+extractor, so both packs store the same edges; see[Relation direction](#relation-direction).## Relation direction@@ -166,17 +164,18 @@ the in-code meeting prior. Meeting links then follow canonical attendance:only an explicit attendee list makes a person an attendee, stored person ->meeting (see [attendance evidence](../guides/attendance-evidence.md)). A packthat gives `attended` a phrase `regex` decides attendance itself and keeps its-outgoing semantics. Brains extracted before this rule re-derive with-`gbrain extract links --source db --include-frontmatter`.+outgoing semantics. A brain whose links were extracted before v0.60.30.0+re-derives them with `gbrain extract links --source db --include-frontmatter`.A link type's `inference.regex` runs before the in-code link matchers, so apack regex decides the verb for a markdown link when it matches. A rule marked`ner_only: true` runs only for NER body mentions (`gbrain extract ner`). Thebundled `gbrain-base` and `gbrain-base-v2` packs mark their `founded`,`works_at`, `invested_in` and `advises` sketch regexes this way, so a bare-"started" or "joined" near a markdown link no longer labels it `founded` or-`works_at`; the tuned in-code matchers decide those links. Brains extracted-before this change re-derive with `gbrain extract links --source db`.+"started" or "joined" near a markdown link does not label it `founded` or+`works_at`; the tuned in-code matchers decide those links. A brain whose links+were extracted before v0.60.36.0 re-derives them with+`gbrain extract links --source db`.## How the agent uses the active packdiff --git a/docs/architecture/thin-client.md b/docs/architecture/thin-client.mdindex 4e5e6e287c..ec01048ff2 100644--- a/docs/architecture/thin-client.md+++ b/docs/architecture/thin-client.md@@ -31,7 +31,8 @@ receives only what its client row allows (`grantScopes` caps every request tothe row's `scope`), so a read-only row still yields a read-only token. The hintlists `write` because some authorization_code clients (claude.ai customconnectors) request exactly the hinted scope and never step up after an-`insufficient_scope` tool error, which left writer rows permanently read-only.+`insufficient_scope` tool error, so a narrower hint would keep their writer rows+read-only.Discovery excludes `agent`, which DCR cannot grant, while explicit DCR requestsfor delegation remain rejected.@@ -65,7 +66,7 @@ carries the routing-seam picture):non-TTY default). Exhaustive TS `never` switch on `RemoteMcpError.reason`for canned, actionable error messages. Renderer parity: the local-enginepath runs `JSON.parse(JSON.stringify(result))` so renderers see the same- shape on both paths (kills the Date/bigint/Buffer drift class).+ shape on both paths (no Date/bigint/Buffer drift between them).`applyThinClientSourceScope` maps `--source` / `GBRAIN_SOURCE` /`.gbrain-source` onto a declared `source_id` and returns the ambient bindingit used; an empty array result from an op that declares `all_sources`@@ -88,7 +89,7 @@ carries the routing-seam picture):rejected as on the shared thin route. `--source`/`--source-id`, environment and dotfile scope use theengine-free resolver; an explicit `default` is forwarded, not dropped.The host's declared `recall.source_id` narrows both arms through the existing- authorization resolver. Local omitted-policy CLI behavior is unchanged.+ authorization resolver. On a local install, a call without a policy runs locally.- `src/core/cli-options.ts` — `parseGlobalFlags` supports `--timeout=Ns`(accepts `30s`, `2m`, `500ms`, plain ms). Default `null` = per-commanddefault (30s for most ops, 180s for `think`). `parseTimeout(s)` exporteddiff --git a/docs/architecture/topologies.md b/docs/architecture/topologies.mdindex 3a8bbe0c4b..1fff3b461b 100644--- a/docs/architecture/topologies.md+++ b/docs/architecture/topologies.md@@ -126,7 +126,7 @@ gbrain serve --http --port 3001 --bind 0.0.0.0 # bind explicitly for remote acce# (default bind is 127.0.0.1)gbrain auth register-client neuromancer \--grant-types client_credentials \- --scopes read,write,admin # admin needed for ping/doctor+ --scopes read,write,admin # admin needed for remote doctor# source-scoped client (write to one source, federate reads across# multiple sources). Omit both flags for an unscoped super-client.@@ -141,8 +141,8 @@ The `register-client` command prints a `client_id` and `client_secret`.Note both. **Scope must include `admin`** for `run_doctor` (used by`gbrain remote doctor`) and generic background jobs. `submit_job` acceptsonly `sync`, `import`, `lint`, and `lint-fix` with the authenticated source's-registered root. `gbrain remote ping` no longer submits an autopilot cycle;-run maintenance on the brain host. See the+registered root, so the host refuses the `autopilot-cycle` job that+`gbrain remote ping` submits; run maintenance on the brain host. See the[authorization upgrade guide](../guides/authorization-upgrade.md#generic-remote-background-jobs).**Step 2 — On the thin client (neuromancer):**@@ -182,7 +182,6 @@ Example for Claude Desktop's `~/.config/claude/claude_desktop_config.json`:```bashgbrain doctor # runs thin-client checks (no local DB needed)-gbrain remote ping # triggers an autopilot cycle on the host (Tier B)gbrain remote doctor # asks the host to run its own doctor (Tier B)```@@ -502,7 +501,8 @@ Quiesce every writer on every host that uses this database before activating:3. Stop `gbrain jobs work` workers and supervisors that are not autopilot's.4. Disable cron entries, Git hooks and harness hooks that run `gbrain sync`,`embed`, `extract`, `dream` or `import`.-5. Upgrade every remaining host to this release, even ones you only read from.+5. Upgrade every remaining host to the gbrain version you activate with (v0.60.11.0+ or newer), even ones you only read from.Then run the sequence, re-reading status between every step, because`admin_state` rotates after every change and a stale value refuses with@@ -575,14 +575,14 @@ dry run first."*It takes no `<source>`: deactivation is brain-wide.5. Verify on every host: `gbrain sources writer status` reports `mode: classic`and this host's `local_markers`: `cleared`, or `pending` with each path that- still needs attention. Older binaries honor local markers without this- cleanup, so run a command from this release (for example+ still needs attention. Binaries older than v0.60.20.0 honor local markers+ without this cleanup, so run a v0.60.20.0 or newer command (for example`gbrain sources writer status`) once on every other host before an olderbinary writes there. That first command removes the markers and registryrecords of the retired epoch; a marker from an unknown or newer epoch (forexample after restoring an older backup) is kept and reported.-`min_writer_version` stays deferred: while the brain is managed, the database+`min_writer_version` is not implemented: while the brain is managed, the databasewriter guard is the enforcement, and after deactivation that guard is inert.### Writer admin lock@@ -597,7 +597,7 @@ neither lock nor unlock, and generic `gbrain config set`/`unset` (including`--pattern`) refuse the reserved key `persistence.writer_admin_lock`. Dry runsof the four operations refuse too. The lock guards against routine or accidentalagent administration; it is not a security boundary against a caller with the-same shell. Binaries older than this release do not consult it.+same shell. Binaries older than v0.60.11.0 do not consult it.`gbrain sources writer status` shows `admin_lock` (whether it is set, when, andby which host) and the selected brain.@@ -693,8 +693,8 @@ the canonical page, which moves the phantom's rows by id, thenthe `managed_facts_entity` intent. Each checks its local writer authority (and,for file publication, the canonical owner) before model calls. Receipt pagesfor these runs stay unmanaged-only. `unsupported_maintenance` in writer status-and activation preview is now empty. Do not infer that every dream or job-writer is restored from the named lanes above.+and activation preview is empty, but that does not mean dream or job writers+outside the lanes named above publish on a managed brain.Google and GitHub API sources route through managed connector checkpoints,not a Git cursor. A deliberately unbound API source uses reviewed@@ -717,7 +717,7 @@ another explicit retry after inspecting and repairing its cause; cancelledreceipts are not retry-approved. No connector API data is fetched before thesource/owner and active-work preflight, although deriving exact matching inputcan require a normal API fetch before retry approval.-For PGLite, `dream` and `jobs --follow` still need exclusive engine access:+For PGLite, `dream` and `jobs --follow` need exclusive engine access:stop the resident owner and any supervisor using their normal shutdown path,wait for writes to drain, run the inline command, then restart the owner. Thedisk-brain CLI regression verifies refusal with a live owner, malformed-outputdiff --git a/docs/guides/authorization-upgrade.md b/docs/guides/authorization-upgrade.mdindex c81e18f219..007c462c43 100644--- a/docs/guides/authorization-upgrade.md+++ b/docs/guides/authorization-upgrade.md@@ -71,9 +71,8 @@ Generic background submission requires a durable authenticated principal.Stdio agents should use the local CLI or a dedicated authorized operation.Local application maintenance retains its existing job and budget restrictions.-`gbrain remote ping` previously submitted an `autopilot-cycle` job and now-receives the generic-job denial. Run the existing maintenance workflow on the-brain host, or use dedicated authorized operations such as `sync_brain` and+`gbrain remote ping` submits an `autopilot-cycle` job, which the host refuses+with the generic-job denial. Run maintenance on the brain host, or use dedicated authorized operations such as `sync_brain` and`connector_sync`. `gbrain remote doctor` remains available with its requiredscope.diff --git a/docs/guides/bootstrap.md b/docs/guides/bootstrap.mdindex d80120df10..4ed7f2c518 100644--- a/docs/guides/bootstrap.md+++ b/docs/guides/bootstrap.md@@ -41,17 +41,15 @@ follows is `BOOTSTRAP_FOR_AGENTS.md` at the repo root, fetched at the**What session start shows:** the SessionStart hook prints yourallowlisted MEMORY.md sections, push status and hook health, plus a warm-context pack. It never shows another session's activity. Releases before-v0.60.28.0 printed a `Last session activity` line from the newest session-buffer on the machine, whichever agent or session wrote it (#5558). That line-and the stop-hook buffer behind it are gone, and there is deliberately no-opt-in to bring them back. Buffers an older release left in+context pack. It never shows another session's activity, and no setting+turns that on. Session buffers that releases before v0.60.28.0 left in`~/.gbrain/transcripts/live/` are deleted by the stop hook once they are 7-days old; you can delete them now. If you set `GBRAIN_HOOKS=0` as a-workaround, remove it from the environment the harness starts from (shell-profile or service) after upgrading the `gbrain` the harness runs, then-restart the harness: `GBRAIN_HOOKS=0` also turns off capture, session-persistence and crash recovery.+days old; you can also delete them by hand. If you set `GBRAIN_HOOKS=0` to+hide the `Last session activity` line those releases printed, remove it from+the environment the harness starts from (shell profile or service) after+upgrading the `gbrain` the harness runs, then restart the harness:+`GBRAIN_HOOKS=0` also turns off capture, session persistence and crash+recovery.**What does NOT run:** anything while the harness is closed. Session-triggeredschedules fire at turn/session boundaries only. True 24/7 operation is what adiff --git a/docs/guides/chat-connectors.md b/docs/guides/chat-connectors.mdindex 4ec99423aa..6dcc34e2fb 100644--- a/docs/guides/chat-connectors.md+++ b/docs/guides/chat-connectors.md@@ -7,7 +7,7 @@ skill already documents: fetch replaces the manual download, and everythingdownstream (redaction, slugging, part-splitting, idempotency) is the exact`gbrain transcripts ingest` pipeline.-Providers in v1: **ChatGPT** and **Claude** (both live). Perplexity has no live+Live providers: **ChatGPT** and **Claude**. Perplexity has no liveconnector yet (no transcript adapter) — use the conversation-archive manualconversion for it.@@ -47,9 +47,8 @@ nobody at the terminal (no TTY, `CI`, an agent process, or- It prints an `[AGENT]` block (`actor: user`, `next: tell_user_to_run`) withthe provider's cookie checklist fenced in `[SHOW USER]` and the stdin commandto run, saves nothing, and exits 1.-- `--try-oauth` never starts the loopback sign-in headless (it used to wait up- to 10 minutes for a browser redirect); it says OAuth needs a person at a- browser and hands over the same cookie checklist. With a person at the+- `--try-oauth` never starts the loopback sign-in headless; it says OAuth+ needs a person at a browser and hands over the same cookie checklist. With a person at theterminal, `--no-browser` prints the sign-in URL instead of opening a browser.What the agent does: relay the `[SHOW USER]` text verbatim and ask the user todiff --git a/docs/guides/concurrent-writes.md b/docs/guides/concurrent-writes.mdindex 16e761a2df..22a71d490f 100644--- a/docs/guides/concurrent-writes.md+++ b/docs/guides/concurrent-writes.md@@ -213,19 +213,19 @@ re-run the rules against the pinned file and database copies; any change meansa fresh preview. Apply, backups and the retry of the blocked write work exactlyas above.-Atom scan/failure bookkeeping now lives outside canonical note metadata so+Atom scan/failure bookkeeping lives outside canonical note metadata soprocessing progress does not create new disagreements. Managed atom extractionchecks trusted local source-wide authority and, for filesystem writes, ownerreadiness before model work, then journals publication and completion. Retainedaccepted output replays without-another model call. This does not restore every legacy maintenance writer; see+another model call. Not every legacy maintenance writer runs on the managed path; see[supported managed work and explicit repair](../architecture/topologies.md#supported-managed-work-and-explicit-repair).### Roll back safelyStop submitting new reconciliation requests first. Keep a compatible upgradedowner running until all accepted requests are terminal and recovery has drained;-inspect the durable receipts before disabling the new command or reverting the+inspect the durable receipts before disabling the reconcile command or reverting thebinary. Never downgrade an active reconciliation queue to a version that doesnot understand its intents. Leave the additive processing-state table and privatebackups in place. Do not automatically restore an old preimage over later edits,@@ -244,10 +244,10 @@ and do not disable guards or change ownership as part of rollback.| `cancelled` | Cancelled before publication began. |On Windows, publication flushes each staged file through the handle it was-written with and skips the directory flush Windows does not provide. Older-releases flushed through a read-only handle, which Windows refuses (`EPERM`), so-a restoration could stay `recovering` and hold every later write on that source-behind it. After upgrading, the owner retries it on its own; confirm with+written with and skips the directory flush Windows does not provide. A+restoration that an older gbrain left `recovering` (it flushed through a+read-only handle, which Windows refuses with `EPERM`) holds every later write+on that source behind it; the current owner retries it on its own. Confirm with`gbrain doctor --json` (`canonical_content_writes` reports `ok` once recoveryhas drained).@@ -307,13 +307,13 @@ UUID, without fabricating a queued receipt or opening another PGLite engine.Legacy callers that omit a request ID and lose the entire acknowledgment cannotrecover exact replay identity from the content alone.-Local Unix listeners keep their existing socket addresses when they fit the+Local Unix listeners use their standard socket address when it fits theportable 103-byte limit. Longer addresses use a deterministic private directoryunder `/private/tmp` on macOS or `/tmp` on Linux, independent of `HOME` and`TMPDIR`. Both CLI discovery and resident servers derive it without opening thedatabase. The directory must belong to the current OS user with mode `0700`;-clients require a socket with mode `0600`. Unsafe entries are refused. Existing-credentials and hook-secret locations are unchanged. A native binding lock+clients require a socket with mode `0600`. Unsafe entries are refused.+Credentials and hook secrets stay in their own locations. A native binding lockserializes startup and remains held until the listener has actually closed.@@ -332,8 +332,8 @@ retrying the whole transaction after a confirmed abort.## Frozen memory verbs-`remember` and `forget` accept optional `request_id`. Their frozen success enums-and `protocol_version: 1` are unchanged. Accepted pending memory writes use the+`remember` and `forget` accept optional `request_id` and keep their frozen+success enums and `protocol_version: 1`. Accepted pending memory writes use theexisting `unavailable` error with a populated suggestion and additive`write_request`/`write_error` metadata. A pending response never claims`status: "inserted"` or `expired: true`.@@ -367,9 +367,9 @@ bytes, revisions, chunks and embedding signatures remain unchanged. Managedwithdrawals retain a versioned target manifest for the mirror, Git and embeddingworkers; each worker checkpoints one affected page at a time.-A withdrawal mirror or Git scan no longer parks on a page whose file is a+A withdrawal mirror or Git scan does not park on a page whose file is async-skip metafile (`RESOLVER.md`, which carries the managed durability block-by design) or whose file holds an uncoordinated local edit (#5396): the+by design) or whose file holds an uncoordinated local edit: thewithdrawal is recorded in the database, the page is listed in the effect's`data.skipped` with reason `metafile` or `file_database_drift`, and therequest's Git and embedding effects proceed. Reconcile a `file_database_drift`@@ -690,7 +690,7 @@ content digest and `file_count`, not a per-file map, so `sources add`, `claim`,`rebind`, `archive`, `remove`, clone, reclone and writer transfer work the sameat 50,000 files as at 50. Rows written by older releases, which also carry aper-file map, stay valid and are compacted on their next rewrite. Every command-still hashes each file once while holding the root's native lock and before it+hashes each file once while holding the root's native lock and before itopens a database transaction; in human output it reports `files hashed of total`on stderr for worktrees above 5,000 files. Measured on a 4-vCPU cloud machinewith a 50,000-file, 3.4 MB worktree: `sources add`, `claim` and transferdiff --git a/docs/guides/embedding-migration.md b/docs/guides/embedding-migration.mdindex 37e2d025b2..f426692974 100644--- a/docs/guides/embedding-migration.md+++ b/docs/guides/embedding-migration.md@@ -165,8 +165,8 @@ re-embedding is started automatically on upgrade. Existing page vectors with amatching model and a legacy NULL text hash remain searchable, including after afailed migration attempt; this does not relabel vectors from another model.-Stop older GBrain mutation workers before repair; this release does not prove-mixed-version mutation compatibility. Preserve their durable queued work.+Stop older GBrain mutation workers before repair; mixed-version mutation is+not supported. Preserve their durable queued work.Select the intended brain using the ordinary global `--brain` option. Thismigration is brain-wide: both `gbrain migrate embeddings` and `gbrain retrieval-upgrade`reject `--source` and `--slugs`, including `--flag=value`@@ -187,13 +187,13 @@ cost cap finite and nonnegative. Values are never truncated or clamped. Pacingaccepts bare `--pace` (balanced), `--pace=off|gentle|balanced|aggressive`, and`--pace-max-concurrency N` or `--pace-max-concurrency=N` with a positive safeinteger. Empty or unknown pace modes refuse rather than falling back to off.-Pacing's existing configuration/environment precedence is unchanged.+Pacing keeps its usual configuration/environment precedence.-Unsuccessful CLI JSON and local `migrate_embeddings` operation envelopes retain-their existing status and reason fields and add a `recovery` object with the status+Unsuccessful CLI JSON and local `migrate_embeddings` operation envelopes carry+their status and reason fields plus a `recovery` object with the statuscommand, this guide, and partial-state and authorization cautions. Human stderr-prints the same guidance after the case-specific advice. The operation remains-local-only and admin-scoped; its `failed` discriminator is unchanged. Reuse the same+prints the same guidance after the case-specific advice. The operation is+local-only and admin-scoped, and reports failure with its `failed` discriminator. Reuse the samebrain selection when inspecting status; do not blindly retry or reset the migration marker.| Failure | Action before retrying | Partial state to inspect |@@ -286,8 +286,8 @@ do that without a separately reviewed reconciliation of all later intent.After status reports completion, keep the same brain and source selection andcheck content you already know exists. Authorize any provider calls separately;-a search on an embedded brain can contact its configured provider. In the-network-isolated keyless fixture used for this release, these exact commands ran+a search on an embedded brain can contact its configured provider. In a+network-isolated keyless fixture, these exact commands ranagainst an existing synthetic page:```bash@@ -427,5 +427,5 @@ Local providers such as Ollama, llama-server and LM Studio can be explicitmigration targets. Select the model actually served and its output width;changing a provider ID changes the embedding signature and is not proof thatold vectors are compatible. Do not rewrite stored signatures to bypass the-re-embed. Removed provider IDs and their former base-URL compatibility paths-are no longer supported; use a supported recipe and an approved migration.+re-embed. Retired provider IDs and their base-URL compatibility paths are not+supported; use a supported recipe and an approved migration.diff --git a/docs/guides/error-codes.md b/docs/guides/error-codes.mdindex 13f925c9a0..2aa476eb62 100644--- a/docs/guides/error-codes.md+++ b/docs/guides/error-codes.md@@ -4,14 +4,14 @@Every gbrain error carries a stable `code`. Read `code` first and fall back to `error`(older servers send only `error`); then follow `fix.next` as described in[AGENT_OPERATOR_v1](../protocol/AGENT_OPERATOR_v1.md). Exit codes are in [exit codes](exit-codes.md).-Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the renamed codes.+Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the legacy pairs.**Say to your agent:** *"gbrain returned an error code I don't recognize. Look it up and tell me what to do."*-## Renamed in this release+## Legacy `error` values-Under contract v1 an existing `error` value never changes. Where a surface historically sent a-different value, it keeps sending it in `error` and adds the canonical value in `code`.+Under contract v1 an `error` value never changes. Where a surface sends a legacy value in+`error`, it also sends the canonical value in `code`:| `error` (frozen) | `code` (canonical) | Meaning ||---|---|---|diff --git a/docs/guides/exit-codes.md b/docs/guides/exit-codes.mdindex ec8d12d5ba..0968657224 100644--- a/docs/guides/exit-codes.md+++ b/docs/guides/exit-codes.md@@ -23,25 +23,8 @@ the exit code first, then reads the JSON document (`--json`) for the details:`class` and `retryable` live only in the JSON document; the exit code stayscoarse so shell scripts can branch on it.-Under contract v1, `gbrain mcp expose` and `gbrain google` still exit 2 when-they need the user's confirmation (documented legacy; changing it is a v2 item).+Under contract v1, `gbrain mcp expose` and `gbrain google` exit 2 when they+need the user's confirmation (documented legacy; changing it is a v2 item).-## Changed in this release--| Command | Before | Now | Why |-|---|---|---|---|-| `gbrain embed --stale` time-budget stop | 3 | 11 | 3 means "ask the user first"; a budget stop means "run the resume command" |-| `gbrain dream --drain` backlog left (window/deadline/lock stop, busy cycle lock) | 3 | 11 | a resumable stop; `--json` carries `resume_command` |-| `gbrain agent run … --follow` timeout | 3 | 124 | a timeout, not a consent stop; the job keeps running |-| `gbrain providers test` transient provider error | 3 | 1 (retryable) | retryable failure |-| `gbrain sources harden` with sources needing attention | 3 | 1 | failure for cron; the report names what to fix |-| `gbrain sources pull` rebase conflict aborted | 3 | 1 | failure |-| `gbrain sources remove default` / `gbrain sources archive default` | 3 | 2 | invalid input |-| `gbrain extract-conversation-facts` pages skipped on a busy lock | 3 | 1 (retryable) | re-run to finish the skipped pages |-| `gbrain call` invalid parameters | 1 | 2 | invalid input; stdout now carries the error envelope |-| `gbrain migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | 2 | 3 | a consent stop: the payload names the effects and the words to ask the user |-| `gbrain pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | 1 | 3 | a consent stop, not a failure |-| `gbrain book-mirror` paid fan-out without authorization | 0 | 3 | nothing ran; it used to report "cancelled" and exit 0 |-| `gbrain doctor --remediate` without a terminal and without `--yes` | 0 (it ran) | 3 | paid and destructive work waits for the user |-| `gbrain autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` with a bad value | 1 | 2 | invalid input |-| `gbrain jobs submit` on PGLite without `--follow` or `--queue-only` | 0 (queued, no worker) | 1 (`no_worker`) | the job would wait for a worker that is not running |+The per-command exit changes that came with contract v1 (v0.60.46.0) are in+the [CHANGELOG](../../CHANGELOG.md#exit-code-changes-by-command).diff --git a/docs/guides/github-source.md b/docs/guides/github-source.mdindex 69d5011ec2..09ed21efb7 100644--- a/docs/guides/github-source.md+++ b/docs/guides/github-source.md@@ -156,12 +156,12 @@ pull requests, issue comments, PR reviews, PR review comments, labels,milestones, assignees, check runs, check suites, workflow runs. Each eventsubmits a targeted `sync` job that refreshes exactly the item that changed(check events resolve the linked PR from the payload; events without an-item reference are acknowledged and skipped). Push events keep their-existing git-source behavior.+item reference are acknowledged and skipped). Push events follow the+git-source behavior.Without a public URL, use a tunnel (Tailscale Funnel, ngrok, or any HTTPShost). The webhook is HMAC-signed per source with the same-`X-Hub-Signature-256` verification as the existing push webhook. Out-of-scope+`X-Hub-Signature-256` verification as the push webhook. Out-of-scoperepos are acknowledged but never materialized.## Pages@@ -187,15 +187,12 @@ comments, reviews and checks). Two behaviors worth knowing:stay recallable by those facets. Without a body, the chunk would holdonly the title, and compound titles tokenize poorly.- **Near-identical pages** (the same PR merged across several mirrored- repos) are de-duplicated at search time by upstream gbrain (Jaccard- similarity, `src/core/search/dedup.ts`). Content recall is unaffected:+ repos) are de-duplicated at search time (Jaccard similarity,+ `src/core/search/dedup.ts`). Content recall is unaffected:the surviving copy carries the same text, and the hidden copy is stillreachable via a repo-scoped query or direct slug lookup. If you needthe per-repo copy to win, include the repo name in the query.-A feature-scoped retrieval bench (brain-bench style, hit@K against a live-mirror) ships with the QA notes; see `QA-REPORT.md` for the summary.-## Rate limitsThe client honors `x-ratelimit` headers, backs off on 403/429 and pausesdiff --git a/docs/guides/google-connect.md b/docs/guides/google-connect.mdindex e6b508524e..5ae3e6720e 100644--- a/docs/guides/google-connect.md+++ b/docs/guides/google-connect.md@@ -204,8 +204,8 @@ patiently — 6 attempts by default, exponential backoff with jitter capped at60s, honoring `Retry-After` when Google sends one — before finally giving upand reporting `rate_limited`. That budget is deliberately much larger thanthe 2-attempt budget used for other retryable failures (like a 401 needing a-token refresh): giving up too early used to mean a thread that would have-succeeded a few seconds later was instead skipped for the rest of the sync.+token refresh), so a thread that would succeed a few seconds later is not+skipped for the rest of the sync.Even when a thread's retry budget IS exhausted, a rate-limit failure is nevercounted toward a hold — unlike a genuine per-thread@@ -380,13 +380,13 @@ This is deliberate: the pages are your private mail, calendar and contacts,and a page that quietly stays group-readable after a sync is the failurethis rule prevents. There is no per-source setting for a looser mode yet.-### Files written before v0.60.31.0+### Files readable by other local users-Older releases wrote these files with your umask, typically 0644 (readable by-every local user), and an upgrade does not rewrite them. In the default-directory that is harmless, because gbrain keeps `~/.gbrain` at 0700. In a-custom `--dir` outside `~/.gbrain`, older pages stay readable by other local-users until they are rewritten.+gbrain releases before v0.60.31.0 wrote these files with your umask, typically+0644 (readable by every local user), and an upgrade does not rewrite them. In+the default directory that is harmless, because gbrain keeps `~/.gbrain` at+0700. In a custom `--dir` outside `~/.gbrain`, those pages stay readable by+other local users until they are rewritten.The upgrade prints a one-time notice for each Google source outside`~/.gbrain`, naming the directory, how many readable entries it found and@@ -498,10 +498,11 @@ explicit MIME metadata fields; `body.data`, raw messages and snippets are neverselected. The selection includes child-identity sentinels beyond depth 32 so adeeper MIME tree remains incomplete rather than appearing empty. Decoded metadataresponses are capped at 2 MiB before JSON parsing; oversized responses fail without-advancing repair. Ordinary sync's message-body requests are unchanged.+advancing repair. Ordinary sync fetches message bodies; only historical repair+uses this metadata-only request.-Upgrading changes future ingestion, **not** every historical page. Ordinary-incremental sync only revisits changed threads and its success does not establish+Sync records receipts for threads it ingests; it does **not** revisit every+historical page. Ordinary incremental sync only revisits changed threads and its success does not establishhistorical inspection. To repair already-imported pages without replaying bodies:```shdiff --git a/docs/guides/hosted-harness-access.md b/docs/guides/hosted-harness-access.mdindex ef2c3dea56..054ee9118d 100644--- a/docs/guides/hosted-harness-access.md+++ b/docs/guides/hosted-harness-access.md@@ -289,7 +289,7 @@ identity. This connection has no local database backup or `bin/gbrain-setup`helper; complete backups belong on the brain host. If the handoff was lost,recover it through the host's delivery procedure first.-Before this security migration, stop old servers and workers and take a protected backup. Start only runtimes that enforce the migrated grants. If rollout fails, disable the affected entry points and restore a compatible runtime while preserving memory and the tightened grants; do not run an older authorization implementation against the migrated database. Local installations can be released independently of hosted delegation.+Before applying the grant migration, stop old servers and workers and take a protected backup. Start only runtimes that enforce the migrated grants. If rollout fails, disable the affected entry points and restore a compatible runtime while preserving memory and the tightened grants; do not run an older authorization implementation against the migrated database. Local installations can be released independently of hosted delegation.Remove a managed configuration with the same private handoff and `gbrain connect... --remove`, or remove the native OAuth connection through its harnessdiff --git a/docs/guides/life-chronicle.md b/docs/guides/life-chronicle.mdindex ad00d959df..8e9fb26012 100644--- a/docs/guides/life-chronicle.md+++ b/docs/guides/life-chronicle.md@@ -29,8 +29,8 @@ A page is extracted automatically when all of these hold:with `meetings/`, `conversations/`, `cal/` or `calendar/`.- Its body has at least 80 characters. Dream-generated pages, diary pages(`life/diary/`) and event pages themselves are never extracted.-- It was written or changed after this release activated on the brain. History- is never swept automatically.+- It was written or changed while automatic extraction was active on the brain+ (v0.60.45.0 or later). History is never swept automatically.- Its own date (frontmatter `date`, `start` or an authored effective date) iswithin `chronicle.auto_recent_days` (default 30). Undated pages count asrecent.@@ -94,9 +94,9 @@ apart), pending pages and the command that runs them.## After upgrading-Automatic extraction turned on by default in this release. Until you answer,-doctor shows `auto_chronicle_default_on` (info) and the advisor shows the same-finding with `ask_user: true`. The agent relays the cost to you, then records+Automatic extraction is on by default from v0.60.45.0. On a brain upgraded+from an earlier release, doctor shows `auto_chronicle_default_on` (info) until+you answer, and the advisor shows the same finding with `ask_user: true`. The agent relays the cost to you, then recordsyour answer:```bash@@ -105,7 +105,7 @@ gbrain config set auto_chronicle false # opt out```A brain that already had `auto_chronicle true` sees the notice too, because-that setting had no effect before this release.+that setting had no effect before v0.60.45.0.## History: backfill on requestdiff --git a/docs/guides/live-sync.md b/docs/guides/live-sync.mdindex cb16040cd4..837047db8c 100644--- a/docs/guides/live-sync.md+++ b/docs/guides/live-sync.md@@ -87,9 +87,8 @@ Two more tips:request and why it waits. `gbrain doctor` reports a managed cursor'sremaining entries and ETA from any process.-Before this drain shipped, the workaround was a shell loop around-`gbrain sync --source <id> --no-pull` until it printed `synced`. That loop-still works, and each run now drains as far as its deadline allows.+A shell loop around `gbrain sync --source <id> --no-pull` until it prints+`synced` also works; each run drains as far as its deadline allows.## Implementationdiff --git a/docs/guides/multi-source-brains.md b/docs/guides/multi-source-brains.mdindex 4da522221c..fdeab36b38 100644--- a/docs/guides/multi-source-brains.md+++ b/docs/guides/multi-source-brains.md@@ -166,8 +166,7 @@ source is archived. Private pages stay hidden from remote agents exactly as inGraph output carries source ids: each `gbrain graph` node has `source_id`, andeach edge returned to agents has `from_source_id` / `to_source_id`. The same slug-in two sources is two nodes or two edges, so a walk may return more edges than-before.+in two sources is two nodes or two edges.When a local unqualified read finds nothing but the page has links in a sourceoutside the read (a non-federated source), the CLI prints the per-source counts@@ -331,7 +330,7 @@ stored file paths, called its **slug-root mode**:The mode is decided once, by the first real sync or the first coordinated pagewrite (such as `put_page`) that records a new file path, and pinned in the-source's configuration. A few older write paths, such as saved brainstorm+source's configuration. A few write paths, such as saved brainstormideas, follow an existing pin but do not set one. Every later sync,write and reader obeys the pin, so an existing brain never has its slugsrenamed. `gbrain sync --dry-run` works out the mode without pinning it. A@@ -350,11 +349,10 @@ can refuse that file with a slug/origin mismatch; there, add new pages asfiles in the checkout and sync them. Pages that already have a stored pathkeep writing to that file.-**Older stored paths.** Before v0.60.5.0, write-through recorded-Git-root-style paths (`notes/people/alice-example.md`) for pages in-`source-root` sources, which made the next sync fail. Sync now accepts that-older form when the rest of the path names the same page, and rewrites it on-the next import. No command is needed.+**Older stored paths.** Releases before v0.60.5.0 recorded Git-root-style+paths (`notes/people/alice-example.md`) for pages in `source-root` sources.+Sync accepts that form when the rest of the path names the same page, and+rewrites it on the next import. No command is needed.**`ambiguous_source_path`.** If both readings of an old stored path exist asfiles, for example `~/vault/notes/people/alice-example.md` anddiff --git a/docs/guides/repair.md b/docs/guides/repair.mdindex af5743953a..82309026c5 100644--- a/docs/guides/repair.md+++ b/docs/guides/repair.md@@ -74,9 +74,9 @@ any other option the table below does not list, including `--max-usd`: arefused run changes nothing. To cap paid embedding work, run the repairsthrough `gbrain doctor --remediate --yes --include-repairs --expect <plan_hash> --max-usd <n>`(`<plan_hash>` comes from `gbrain doctor --remediation-plan --json`). `--all`-runs `timeline`, then `visibility`, then `safe-chunks`, then `contextual-mode`, then `connector-checkpoints`, then `request-indexes`, then `connector-fences`, then `orphan-bindings`, then `embedding-effects`, and stops at the+runs `timeline`, then `visibility`, then `safe-chunks`, then `contextual-mode`, then `connector-checkpoints`, then `request-indexes`, then `connector-fences`, then `orphan-bindings`, then `embedding-effects`, then `attribution-backfill`, then `planner-stats`, and stops at thefirst kind that stops.-The explicit-only kinds (`google-file-modes`, `stale-atoms`, `extractor-facts`) never run under+The explicit-only kinds never run under`--all`; it lists each with its preview command and still exits 0 when theyare the only findings left. `gbrain repair` with no kind does the same for apreview. With `--json` the list is `explicit_kinds[]` (`kind`, `code:@@ -120,14 +120,13 @@ should also check `results[].complete`.| `request-indexes` | `persistence_request_indexes` | Creates a missing managed sync request index, or drops an INVALID one (left by an interrupted concurrent build) and rebuilds it, on a brain whose schema version is already current. Postgres builds each index `CONCURRENTLY`, one at a time, so writes continue; PGLite builds inline. It changes no user data, takes no journal admission and runs brain-wide (`--source` does not narrow it). See [managed sync request indexes](#request-indexes). | `building`: an index another session is still building; it is never dropped. || `connector-fences` | none (a `connector_fence_below_timeline` refusal names it) | Moves a facts or takes fence that sits below the timeline sentinel of a Google or GitHub page into the page body through a revision-bound `put_page`, so the connector's next re-render carries the fence instead of refusing. Then re-attempt the held item with `gbrain sources retry-held <source>`. | `kept_ambiguous_pages`: pages whose fences are duplicated, unbalanced or unparseable. Move the fence by hand: read the page, place the fence above the `<!-- timeline -->` line, and save it with the current `expected_revision`. || `connector-checkpoints` | `connector_checkpoints` | Deletes managed connector checkpoint rows and retry pointers that no registered connector source can load and that are older than 7 days. They accumulate after a content setting such as `g_history_days` changes, or when a connector host older than v0.60.11.0 runs during an upgrade. Cleanup only: it never copies or re-keys a checkpoint, takes no journal admission and runs brain-wide (`--source` does not narrow it). | Rows a queued or running connector write, or a connector's recorded pending set, still references. |-| `orphan-bindings` | `orphan_persistence_bindings` | Deletes persistence source bindings whose source was removed, or that belong to an earlier incarnation of a source re-added under the same id. Releases before this one left the binding behind on `gbrain sources remove` and `gbrain sources purge`, so the re-added source read as claimed and every `gbrain sync --source <id>` failed with `writer_coordinator_required`. Bookkeeping only: no journal admission, no page or file changes, and it runs brain-wide (`--source` does not narrow it). See [orphan bindings](#orphan-bindings). | A binding that a queued, running or recovering write request of the same source incarnation still references. |+| `orphan-bindings` | `orphan_persistence_bindings` | Deletes persistence source bindings whose source was removed, or that belong to an earlier incarnation of a source re-added under the same id. `gbrain sources remove` and `gbrain sources purge` delete the binding; one an older gbrain left behind makes the re-added source read as claimed, so every `gbrain sync --source <id>` fails with `writer_coordinator_required`. Bookkeeping only: no journal admission, no page or file changes, and it runs brain-wide (`--source` does not narrow it). See [orphan bindings](#orphan-bindings). | A binding that a queued, running or recovering write request of the same source incarnation still references. || `embedding-effects` | `stale_embedding_effects` | Settles stale queued and failed embedding effects of committed writes, which block receipt compaction and activation: `reconciled` when current vectors pass the effect verifier, `superseded` when the page was deleted or a newer revision owns its own effect, `retry_queued` for the owner (paid; a used-up retry allowance gets one new bounded cycle per explicit apply). See [stale queued embedding effects](#stale-queued-embedding-effects). | `blocked` effects, counted by reason (`owner_unavailable`, `embedding_disabled`, `embedding_unconfigured`, `projection_pending`, `no_replacement_obligation`). || `attribution-backfill` | none | Fills write attribution (who wrote it) on pages, page versions and facts written before attribution was recorded, only where exactly one committed request in the write journal proves the writer: the page write whose recorded result is the row's revision, or the `remember` that inserted the fact. Fills NULLs only, in committed batches of 1,000 that resume after an interruption; no content, revision, page file or request ID changes. See [write attribution](../mcp/ADMIN.md#write-attribution). | `unrecorded_pages`, `unrecorded_page_versions`, `unrecorded_facts`: rows the journal cannot prove. They stay `unrecorded`; nothing is inferred. || `safe-chunks` | `safe_index_pending` (also `contextual_retrieval_coverage`, `details.unsealed_pages`) | Rebuilds the chunks of markdown and code pages indexed before the safe-chunk fence, which remote and MCP search withhold. It rebuilds projections only: no page write, no new page version and no request ID. Vectors whose embedding input did not change are kept; the rest are embedded unless you pass `--no-embed` or no embedding model is configured. | `code_without_source_path`: code pages with no recorded file to re-chunk. `unsupported_page_kind`: other page kinds, such as images. Their importer re-seals them. || `orphan-children` | `child_table_orphans` (also a `storage_corrupt` error) | Explicit-only. Deletes rows of page child tables (chunks, versions, tags, takes, raw data, timeline, links) whose page row no longer exists, and clears dangling `links.origin_page_id` and `files.page_id` references, each in one statement that rechecks the orphan condition. See [orphan children](#orphan-children). | `torn_pages`: page rows whose stored body cannot be read (torn TOAST). The preview names them; the repair never changes them. |-| `contextual-mode` | `contextual_retrieval_coverage` (pages with no recorded mode) | Stamps the contextual retrieval mode on markdown pages imported without one (for example by a large `--no-embed` sync or a connector source before this release), exactly as a fresh import of the page would: the page, source and brain settings decide, and the per-chunk synopsis tier lands at the free title tier. It rebuilds projections only: no page write, no new page version and no request ID. A page whose stored vectors already match the stamped convention keeps them and queues no re-embedding; a page whose embedding input changes has only those vectors cleared and is re-embedded once, unless you pass `--no-embed`. | `unsealed_projection`: pages whose chunks lag their text; `gbrain embed --stale` or `safe-chunks` seals them first, and the next run stamps them. `embed_skip`: pages marked to skip embedding keep their stored vectors and are not stamped. |-gbrain repair google-file-modes --apply # explicit-only: runs only when named-gbrain repair --all --apply # every automatic kind in order+| `planner-stats` | `planner_stats_stale` | Runs `ANALYZE` on the hot tables (pages, links, facts, takes, content_chunks, timeline_entries) whose planner statistics are stale, so search and graph reads stop planning as slow nested loops. PGLite also resets each table's pending row count; Postgres runs each `ANALYZE` with a 60 s statement timeout and a 2 s lock timeout. No journal admission, no user data changes, brain-wide. | none |+| `contextual-mode` | `contextual_retrieval_coverage` (pages with no recorded mode) | Stamps the contextual retrieval mode on markdown pages imported without one (for example by a large `--no-embed` sync, or by a connector source on an older gbrain), exactly as a fresh import of the page would: the page, source and brain settings decide, and the per-chunk synopsis tier lands at the free title tier. It rebuilds projections only: no page write, no new page version and no request ID. A page whose stored vectors already match the stamped convention keeps them and queues no re-embedding; a page whose embedding input changes has only those vectors cleared and is re-embedded once, unless you pass `--no-embed`. | `unsealed_projection`: pages whose chunks lag their text; `gbrain embed --stale` or `safe-chunks` seals them first, and the next run stamps them. `embed_skip`: pages marked to skip embedding keep their stored vectors and are not stamped. |Timeline rows that an earlier version of a page produced and its current textno longer has are removals, not history, so `timeline` neither counts nor@@ -144,9 +143,9 @@ bullet in a save that passes the current `expected_revision` deletes its entry.Managed Google and GitHub connector checkpoints are keyed on the parsedconnector settings minus credential-delivery fields, so the per-cycle-`last_source_cycle_at` stamp no longer makes every run start over. The-v0.60.11.0 migration copies each connector source's newest committed-checkpoint to the new key. A source whose newest checkpoint receipt was+`last_source_cycle_at` stamp does not make a run start over. On an upgrade+across v0.60.11.0, the migration copies each connector source's newest+committed checkpoint to the current key. A source whose newest checkpoint receipt wascompacted re-walks its window once; unchanged pages are not admitted again.**Say to your agent:** *"Did my Gmail connector stop re-importing everything@@ -195,16 +194,15 @@ Git-backed source and while the account differs### Managed sync request indexesA managed sync checkpoint checks that every page receipt of its run-committed. On a large `persistence_requests` table that check used to scan the-whole table and hit the coordinator's 5-second statement timeout, so the-checkpoint never committed and was retried ahead of every other write to the-source (#5762). Two indexes now serve it, `persistence_requests_sync_run_open`-and `persistence_requests_sync_run_committed`. On Postgres, migration 179+committed. Two indexes serve that check, `persistence_requests_sync_run_open`+and `persistence_requests_sync_run_committed`, so it stays inside the+coordinator's 5-second statement timeout on a large `persistence_requests`+table. On Postgres, migration 179builds them `CONCURRENTLY` after the upgrade; while it runs it prints`building <index> on ~N rows; this can take minutes; it is safe to leave-running`. A timeout that still happens fails the checkpoint with+running`. If the check still times out, the checkpoint fails with[`checkpoint_validation_timeout`](write-refusals.md#checkpoint-validation-timeout)-instead of retrying forever.+and is not retried ahead of other writes.**Say to your agent:** *"My sync says checkpoint_validation_timeout. What do I run?"*@@ -233,10 +231,10 @@ nothing is evicted.After an upgrade that re-queues text projections (for example the 0.51protocol activation), search and code results stay incomplete until every-queued Markdown and code page is rebuilt (#5401). Doctor+queued Markdown and code page is rebuilt. Doctor`text_projection_readiness` warns while any visible page is pending.-The upgraded resident owner (`gbrain serve` or autopilot) drains the queue on+The resident owner (`gbrain serve` or autopilot) drains the queue onits own: each pass rebuilds up to 100 pages and starts no new page after250 ms, and takes 2 pages while writes are waiting. A page whose rebuild failsis retried after 30 seconds.@@ -267,7 +265,7 @@ Verify: `gbrain doctor` shows `text_projection_readiness` ok.### Provider key sourceAn exported provider key (for example `OPENAI_API_KEY`) wins over the matching-config key (`openai_api_key` in `~/.gbrain/config.json`) (#5137). When both are+config key (`openai_api_key` in `~/.gbrain/config.json`). When both areset and differ, every gbrain command except `gbrain hook` prints one warningper process naming the variable, the config key and which one is in effect.No key or part of one is ever printed.@@ -309,9 +307,9 @@ the item's error code names, then re-attempt. See**Say to your agent:** *"I removed a source and added it back, and now syncsays it needs a coordinator. Fix it."*-Removing a source now also removes that source's persistence binding, and the-claim check only counts a binding of the source's current incarnation. A-binding left behind by an older release is reported by doctor's+Removing a source also removes that source's persistence binding, and the+claim check counts only a binding of the source's current incarnation. A+binding left behind by an older gbrain is reported by doctor's`orphan_persistence_bindings` check. Preview, then apply after you agree:```bash@@ -360,8 +358,9 @@ is written. A run that has neither says `scan incomplete` and is a lower bound;### Stale atoms-`gbrain repair stale-atoms` (explicit-only, #5770) retires atoms that drifted-before managed re-extraction learned to retire them. It lists live atoms bound+`gbrain repair stale-atoms` (explicit-only) retires atoms that drifted from+their source page and that managed re-extraction never retired (atoms left+by an older gbrain). It lists live atoms boundto a source page (`source_slug`) in two classes:- `origin_gone`: the source page is missing or deleted;@@ -395,10 +394,10 @@ threshold.### Extractor facts-Before v0.60.11.0, every managed write to a conversation page without a-Facts fence expired all of that page's conversation-extractor facts-(`expired_at` set, `row_num` cleared), and recall stopped returning them.-`gbrain repair extractor-facts` (#5731) restores them. It is explicit-only and+A managed write by a gbrain older than v0.60.11.0 to a conversation page+without a Facts fence expires all of that page's conversation-extractor facts+(`expired_at` set, `row_num` cleared), so recall stops returning them.+`gbrain repair extractor-facts` restores them. It is explicit-only andpreview-bound.```bash@@ -438,18 +437,17 @@ re-extraction (the old rows are gone), and facts on unmanaged brains without`--include-ambiguous`. On PGLite the same-transaction rule holds only to themillisecond (PGLite's clock resolution).-The preview warns, naming the host, when a consumer older than this release+The preview warns, naming the host, when a consumer older than v0.60.11.0published writes after `writer_version_cutoff`: an old consumer expiresrestored facts again. Upgrade and restart it first.<a id="captured-facts"></a>### Captured facts-Before v0.60.30.0, automatic capture (the writeback hook, the compaction-harvest and the corpus sweep) extracted facts from gbrain's own claude-cli-model sessions and from text you pasted into a conversation. New capture skips-both, but the facts already stored stay active, so recall and hot memory keep-returning them. `gbrain repair captured-facts` expires them. It is+Automatic capture (the writeback hook, the compaction harvest and the corpus+sweep) skips gbrain's own claude-cli model sessions and text you paste into a+conversation. Facts a gbrain older than v0.60.30.0 captured from them stay+active, so recall and hot memory keep returning them. `gbrain repair captured-facts` expires them. It isexplicit-only and preview-bound, and it runs on the brain host (it reads theClaude Code session directory and the session corpus there).@@ -489,10 +487,11 @@ maintenance request per page on a managed brain). Nothing is withdrawn, so### Loop factsClosing a commitment loop (`gbrain loops done`, `gbrain loops drop`, or the-`loops_close` tool) retires its commitment fact. A loop closed while that-retirement could not commit (for example on a managed brain, where the write-was refused but the close still reported `fact_expired: true`) left the fact-active, so entity cards and recall keep the finished promise. `gbrain repair+`loops_close` tool) retires its commitment fact.+A loop closed by a gbrain older than v0.60.32.0 while that retirement could+not commit (for example on a managed brain, where the write was refused but+the close still reported `fact_expired: true`) leaves the fact active, so+entity cards and recall keep the finished promise. `gbrain repairloop-facts` retires those facts. It is explicit-only and preview-bound.**Say to your agent:** *"Doctor says some closed loops still have an active@@ -517,9 +516,9 @@ withdrawal is recorded, so the same promise made again is stored normally.<a id="failed-writes"></a>### Failed writes-Before v0.60.38.0, on a managed brain whose `tags`, `timeline_entries` or-`takes` table had a `source_id` column gbrain does not create, the managed-writer guard refused writes it should have allowed (#5983). Each refused write+On a managed brain whose `tags`, `timeline_entries` or `takes` table has a+`source_id` column gbrain does not create, the managed writer guard of a+gbrain older than v0.60.38.0 refuses writes it should allow. Each refused writekeeps a failed receipt with its full intent until receipt compaction(`persistence.receipt_retention_days`, 30 days by default). `gbrain repairfailed-writes` submits those writes again. It is explicit-only and@@ -573,8 +572,7 @@ history.<a id="held-files"></a>### Held files-A file gbrain cannot import without guessing (#5988) no longer stops a sync.-Sync holds it, imports the rest of the source, advances the checkpoint and+A file gbrain cannot import without guessing does not stop a sync. Sync holds it, imports the rest of the source, advances the checkpoint andkeeps reporting the file until it changes, is deleted, or a newer gbrain canread it. A held new file has no page yet; a page whose newer file is held keepsits last good revision, search marks it `stale`, `get_page` carries@@ -592,8 +590,8 @@ The session below is real output (volatile ids, hashes and times shown asthese commands and checks every line shown). Before the upgrade, a generatorcommitted three notes to the `notes` source: `notes/standup.md` with a titlethat continues on an unquoted line, a new `notes/digest.md` with `title:`-twice, and a new `notes/roundup.md` with an unquoted `: ` in `author:`. The-older gbrain blocked the source on the first file it refused.+twice, and a new `notes/roundup.md` with an unquoted `: ` in `author:`. A+gbrain older than v0.60.47.0 blocks the source on the first file it refuses.1. After upgrading, `gbrain post-upgrade` names the blocked source and thecommand that unblocks it now. Doing nothing also works: the next scheduled@@ -719,14 +717,14 @@ default 50) and `frontmatter_repairable` (files the repair can fix, includingones that import only after quoting). Both are explicit-only findings:`gbrain doctor --remediation-plan --json` lists them as `explicit_kind_required`with `gbrain repair frontmatter --source <id>`, and `--remediate` never runs the-repair. `frontmatter_hook` warns when an installed pre-commit hook predates-this release; refresh it with `gbrain frontmatter install-hook --force`.+repair. `frontmatter_hook` warns when an installed pre-commit hook is older+than the running gbrain's hook; refresh it with `gbrain frontmatter install-hook --force`.Settings, all read by every sync:| Key | Default | Effect || --- | --- | --- |-| `sync.holds` | `hold` | `fail` restores fail-closed blocking: a content refusal blocks the sync as it did before holds. |+| `sync.holds` | `hold` | `fail` makes sync fail closed: a content refusal blocks the sync. || `sync.hold_cap` | `500` | How many holds a sync result lists in detail; storage is never capped and valid files always import. || `sync.hold_escalate_count` / `sync.hold_escalate_pct` | `50` / `5` | A source holding more files, or a run holding more than that share of at least 40 screened imports, reports `holds_escalated` and doctor `git_held_files` fails. || `sync.parser_regression` | `stop` | `hold` holds a file whose exact bytes imported under an earlier gbrain (`parser_regression`) instead of stopping the run with `sync_parser_regression`. |@@ -742,7 +740,7 @@ repository). See the `frontmatter-guard` skill.### FrontmatterA file whose YAML frontmatter gbrain cannot read without guessing is held by-sync instead of blocking it (#5988), and some files import only after gbrain+sync instead of blocking it, and some files import only after gbrainquotes an unquoted value. `gbrain repair frontmatter` fixes those files ondisk and imports them. It also finds pages an older import stored wrong: abody that begins with its own frontmatter block, or a title derived from the@@ -936,10 +934,12 @@ Exit status: `0` when no automatically repairable finding remains and no stepfailed, even if operator-required, explicit-only or unsupported findingsremain (they are listed); `1` when a repairable finding remains, a step failed, or the budgetran out; `2` when the score target is unreachable and there was no repair step-to run, or a resume was refused. `healthy` is true only when every wave check-is clean; `repairs_completed` counts the repair steps that finished.+to run, or a resume was refused. `healthy` is true only when every recovery+check is clean after the run; `repairs_completed` counts the repair steps that finished.++## Recover after an upgrade-## Recover after upgrading to this release+<a id="recover-after-upgrading-to-this-release"></a>**Say to your agent:** *"We just upgraded gbrain. Check what needs repair andwalk me through it before changing anything."*@@ -962,19 +962,19 @@ walk me through it before changing anything."*<a id="repair-upgrade-symptoms"></a>-| Symptom or error text | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- |-| Sync `BLOCKED` on one file (`Invalid YAML frontmatter`, a frontmatter slug conflict, `Content too large`); after upgrading, sync prints `Held <path>: …`; doctor `git_held_files` or `frontmatter_repairable` warns; the upgrade banner prints `frontmatter_holds:` | #5988 | `gbrain sources status <source>`, then `gbrain repair frontmatter --source <source>` (add `--include-ambiguous` for interpretations) | nothing to unblock: the next sync converts the blocked request in place (`gbrain sync --source <source> --no-pull` does it now); for the backlog, the printed `gbrain repair frontmatter … --apply --expect <hash> --yes` ([held files](#held-files)) | `gbrain doctor --only git_held_files,frontmatter_repairable --json` (both ok) | brain host; the repair apply after the user agrees | `destructive` (repair apply rewrites the previewed lines) |-| Tag, timeline or take writes fail with `writer_coordinator_required` or `storage_error: Publication failed (P0001)` on a managed brain; sync ends `PARTIAL` at a tagged page | #5983 | `gbrain doctor --json` (`schema_version` is 197 or later) | the original `gbrain sync --source <source> … --no-pull --retry-failed --json`, then `gbrain extract --stale --source-id <source>` and `gbrain extract timeline --source db --source-id <source>`, then `gbrain facts relink --source <source> --dry-run` (paid tier only after the user agrees), then `gbrain repair failed-writes --source <source>` and, after the user agrees, its printed `--apply --expect <hash>` | `gbrain sources status` shows the new `last_commit`; a second `gbrain extract timeline --source db` run adds no rows; a second `gbrain repair failed-writes` preview lists nothing to replay | brain host; the replay apply after the user agrees | paid (relink tier), destructive (replay apply) |-| Sync `BLOCKED` with `checkpoint_validation_timeout` | #5762 | `gbrain doctor` (`persistence_request_indexes`) | `gbrain repair request-indexes --apply` when an index is missing or INVALID, then the printed `gbrain sync --source <source> --no-pull --retry-failed …` | `gbrain doctor --only persistence_request_indexes --json` reports `ok`; `gbrain sources status` shows the new `last_commit` | brain host | none |-| Doctor `persistence_request_indexes` warns | #5762 | `gbrain repair request-indexes` | `gbrain repair request-indexes --apply` | `gbrain doctor --only persistence_request_indexes --json` | brain host | none |-| Doctor `persistence_request_growth` warns | #5751, #5762 | `gbrain doctor --json` | the printed `gbrain config set persistence.limits.<limit> <value>` | `gbrain doctor --only persistence_request_growth --json` | brain host | none |-| Working-tree sync prints `legacy file(s) skipped … no contextual retrieval mode` | #5751 | `gbrain repair contextual-mode` | `gbrain repair contextual-mode --apply` | the next `gbrain sync --working-tree` no longer prints the line | brain host, after the user agrees | none |-| Working-tree sync prints `legacy file(s) skipped … not valid UTF-8` | #5751 | `find <checkout> -name '*.md' ! -exec iconv -f UTF-8 -t UTF-8 -o /dev/null {} \; -print` | re-save each listed file as UTF-8 | the next `gbrain sync --working-tree` no longer prints the line | user (re-saves the files) | none |-| Doctor `google_file_modes` warns, or the upgrade printed `[google] Google source <id> keeps its files in <dir>, outside ~/.gbrain` | #5080 | `gbrain repair google-file-modes --source <id>` | `gbrain repair google-file-modes --source <id> --apply` | `gbrain doctor --only google_file_modes --json` (`google_file_modes` ok) | brain host, after the user agrees | none |-| Recall or hot memory returns facts from gbrain's own claude-cli sessions or from pasted text; doctor `captured_facts_active` warns; the upgrade banner prints `captured_facts_active: N (explicit_kind_required; …)` | #5812, #5820 | `gbrain repair captured-facts` (add `--include-ambiguous` to include paste candidates) | `gbrain repair captured-facts --apply --expect <hash>` with the hash that preview printed | `gbrain doctor --only captured_facts_active --json` (`captured_facts_active` ok) | brain host, after the user agrees | `destructive` (quarantines facts) |-| A finished promise still shows on entity cards and in recall after its loop was closed; doctor `loop_facts_drift` warns; the upgrade banner prints `loop_facts_drift: N (explicit_kind_required; …)` | #5869 | `gbrain repair loop-facts` | `gbrain repair loop-facts --apply --expect <hash>` | `gbrain doctor --only loop_facts_drift --json` (`loop_facts_drift` ok) | brain host, after the user agrees | `destructive` (retires facts) |-| `gbrain upgrade` refuses with `requires Bun >=<floor>` (exit 78), or doctor `self_upgrade_health` says `Auto-upgrade to <target> held` | #5855 | `bun --version` | `bun upgrade`, then `gbrain upgrade` ([Bun floor](upgrades-auto-update.md#bun-floor)) | `gbrain --version` shows the target; `gbrain doctor --only self_upgrade_health --json` (`self_upgrade_health` ok) | user | `persistent_install` |+| Symptom or error text | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- |+| Sync `BLOCKED` on one file (`Invalid YAML frontmatter`, a frontmatter slug conflict, `Content too large`); after upgrading, sync prints `Held <path>: …`; doctor `git_held_files` or `frontmatter_repairable` warns; the upgrade banner prints `frontmatter_holds:` | `gbrain sources status <source>`, then `gbrain repair frontmatter --source <source>` (add `--include-ambiguous` for interpretations) | nothing to unblock: the next sync converts the blocked request in place (`gbrain sync --source <source> --no-pull` does it now); for the backlog, the printed `gbrain repair frontmatter … --apply --expect <hash> --yes` ([held files](#held-files)) | `gbrain doctor --only git_held_files,frontmatter_repairable --json` (both ok) | brain host; the repair apply after the user agrees | `destructive` (repair apply rewrites the previewed lines) |+| Tag, timeline or take writes fail with `writer_coordinator_required` or `storage_error: Publication failed (P0001)` on a managed brain; sync ends `PARTIAL` at a tagged page | `gbrain doctor --json` (`schema_version` is 197 or later) | the original `gbrain sync --source <source> … --no-pull --retry-failed --json`, then `gbrain extract --stale --source-id <source>` and `gbrain extract timeline --source db --source-id <source>`, then `gbrain facts relink --source <source> --dry-run` (paid tier only after the user agrees), then `gbrain repair failed-writes --source <source>` and, after the user agrees, its printed `--apply --expect <hash>` | `gbrain sources status` shows the new `last_commit`; a second `gbrain extract timeline --source db` run adds no rows; a second `gbrain repair failed-writes` preview lists nothing to replay | brain host; the replay apply after the user agrees | paid (relink tier), destructive (replay apply) |+| Sync `BLOCKED` with `checkpoint_validation_timeout` | `gbrain doctor` (`persistence_request_indexes`) | `gbrain repair request-indexes --apply` when an index is missing or INVALID, then the printed `gbrain sync --source <source> --no-pull --retry-failed …` | `gbrain doctor --only persistence_request_indexes --json` reports `ok`; `gbrain sources status` shows the new `last_commit` | brain host | none |+| Doctor `persistence_request_indexes` warns | `gbrain repair request-indexes` | `gbrain repair request-indexes --apply` | `gbrain doctor --only persistence_request_indexes --json` | brain host | none |+| Doctor `persistence_request_growth` warns | `gbrain doctor --json` | the printed `gbrain config set persistence.limits.<limit> <value>` | `gbrain doctor --only persistence_request_growth --json` | brain host | none |+| Working-tree sync prints `legacy file(s) skipped … no contextual retrieval mode` | `gbrain repair contextual-mode` | `gbrain repair contextual-mode --apply` | the next `gbrain sync --working-tree` no longer prints the line | brain host, after the user agrees | none |+| Working-tree sync prints `legacy file(s) skipped … not valid UTF-8` | `find <checkout> -name '*.md' ! -exec iconv -f UTF-8 -t UTF-8 -o /dev/null {} \; -print` | re-save each listed file as UTF-8 | the next `gbrain sync --working-tree` no longer prints the line | user (re-saves the files) | none |+| Doctor `google_file_modes` warns, or the upgrade printed `[google] Google source <id> keeps its files in <dir>, outside ~/.gbrain` | `gbrain repair google-file-modes --source <id>` | `gbrain repair google-file-modes --source <id> --apply` | `gbrain doctor --only google_file_modes --json` (`google_file_modes` ok) | brain host, after the user agrees | none |+| Recall or hot memory returns facts from gbrain's own claude-cli sessions or from pasted text; doctor `captured_facts_active` warns; the upgrade banner prints `captured_facts_active: N (explicit_kind_required; …)` | `gbrain repair captured-facts` (add `--include-ambiguous` to include paste candidates) | `gbrain repair captured-facts --apply --expect <hash>` with the hash that preview printed | `gbrain doctor --only captured_facts_active --json` (`captured_facts_active` ok) | brain host, after the user agrees | `destructive` (quarantines facts) |+| A finished promise still shows on entity cards and in recall after its loop was closed; doctor `loop_facts_drift` warns; the upgrade banner prints `loop_facts_drift: N (explicit_kind_required; …)` | `gbrain repair loop-facts` | `gbrain repair loop-facts --apply --expect <hash>` | `gbrain doctor --only loop_facts_drift --json` (`loop_facts_drift` ok) | brain host, after the user agrees | `destructive` (retires facts) |+| `gbrain upgrade` refuses with `requires Bun >=<floor>` (exit 78), or doctor `self_upgrade_health` says `Auto-upgrade to <target> held` | `bun --version` | `bun upgrade`, then `gbrain upgrade` ([Bun floor](upgrades-auto-update.md#bun-floor)) | `gbrain --version` shows the target; `gbrain doctor --only self_upgrade_health --json` (`self_upgrade_health` ok) | user | `persistent_install` |**Say to your agent:** *"After the upgrade, preview the captured-facts andloop-facts repairs and tell me what each would expire before applying@@ -990,7 +990,7 @@ A line that says `Unknown:` means the check could not run; it is not a cleanresult. 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)+### Upgrading to v0.60.30.0**Say to your agent:** *"We upgraded gbrain to v0.60.30.0. Preview theunlinked facts relink and the link re-derivation for each source, and tell me@@ -1002,25 +1002,25 @@ worker so they run the new code, then work through what applies:<a id="repair-recall-symptoms"></a>-| Symptom | Check or code | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- | --- |-| "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 | brain host, after the user agrees | none |-| 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` | agent, after the user agrees | `paid` (capped by `--max-usd`) |-| `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 | agent | none |-| 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 | agent | none |-| 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 | agent, after the user agrees | `paid` |-| 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 | brain host | none |-| 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` | agent, after the user agrees | `destructive` (forgets the fact) |+| Symptom | Check or code | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- | --- |+| "Who invested in X?" or "Who attended <meeting>?" finds nobody; meeting attendance edges point meeting -> person, or notes-only mentions are typed attended | none | `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 | brain host, after the user agrees | none |+| Facts saved without an entity are missing from entity recall and skipped as `no_entity` by the conflict sweep | doctor `unlinked_facts` | `gbrain facts relink --dry-run` | `gbrain facts relink` (model tier capped by `--max-usd`, default $1.00) | `gbrain doctor` (`unlinked_facts`); `gbrain decide status` | agent, after the user agrees | `paid` (capped by `--max-usd`) |+| `remember` answers `warnings: ["NO_ENTITY"]` | none | 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 | agent | none |+| A CLI write on PGLite pauses for up to 30 s, then fails lock-busy | lock busy | none | wait for the other CLI call, or stop the long-running non-serve holder (for example a jobs daemon) | re-run the write | agent | none |+| The next `gbrain eval suspected-contradictions` estimates a full re-judge | none | the printed cost estimate | run it after you agree (judge prompt v3 invalidated the cache once) | the run reports judged pairs | agent, after the user agrees | `paid` |+| Hybrid search on Postgres returns keyword-only results or hits the vector timeout | doctor `vector_plan` | `gbrain doctor` | upgrade and restart; to roll back: `gbrain config set search.vector_legacy_guard true`, then restart serve and autopilot | `gbrain doctor` shows `vector_plan` ok | brain host | none |+| Facts about you that came from pasted text or from gbrain's own claude-cli calls | doctor `self_capture` | `gbrain recall` for the fact | `gbrain forget <fact id>`; doctor `self_capture` prints one-time quarantine commands for old self-capture files | `gbrain doctor` | agent, after the user agrees | `destructive` (forgets the fact) |<a id="fix-wave-5"></a>-### Upgrading to v0.60.28.0 (fix wave 5)+### Upgrading to v0.60.28.0**Say to your agent:** *"We upgraded gbrain to v0.60.28.0. Restart everythingthat runs it, then walk me through what doctor finds, in order, beforechanging anything."*-Most wave 5 fixes take effect only in a process that runs the new binary, so-restart first. `gbrain sources writer status --json` lists, in+Most of these fixes take effect only in a process that runs v0.60.28.0 or+later, so restart first. `gbrain sources writer status --json` lists, in`writer_versions[]`, the latest version each host and principal was seenwriting with in the retained requests. That is history, not proof: an idleolder `gbrain serve` never shows up there. Restart in this order:@@ -1057,38 +1057,38 @@ Then recover what doctor names, in this order (skip a step whose check is ok):<a id="repair-runtime-symptoms"></a>-| Symptom | Check or code | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- | --- |-| synthesize fails every run; `POST /ingest` 409 (was 500); workers refuse to start with "legacy jobs have missing or unsupported authority" | `legacy_job_authority` / `permission_denied` ([legacy job authority](#legacy-job-authority)) | #5157, #5114 | stop `gbrain serve`, autopilot and workers; `gbrain jobs cancel <active id>`; `gbrain jobs authorize-legacy --select "status=waiting\|delayed\|waiting-children\|paused"` | `gbrain jobs authorize-legacy --select "<same filter>" --expect <hash> --yes`, then restart | `gbrain doctor` shows `legacy_job_authority` ok; `/ingest` returns 202 | brain host, after the user agrees | `paid` (authorizes legacy jobs) |-| Search returns atoms quoting text a page no longer has, or atoms of deleted pages | doctor `atom_provenance_drift` | #5770 | `gbrain repair stale-atoms --source <id>` | `gbrain repair stale-atoms --source <id> --apply --expect <hash>` | `gbrain doctor` (`atom_provenance_drift` drops by the retired count) | brain host, after the user agrees | `destructive` (removes stale atoms) |-| `sources add`, `claim`, `rebind`, `archive`, `remove`, clone, reclone or `sources writer transfer` on a repo with more than ~10k files fails with "The verified source manifest exceeds the 1 MiB administration metadata bound" | `request_too_large` | #5790 | none: upgrade and restart every writer host and resident `gbrain serve` | Re-run the failed command (with the same `--request-id` if you kept it) | `gbrain sources writer status --json` shows the source bound, and its `manifest_digest` is set | agent | none |-| A stdio agent bound with `GBRAIN_SOURCE` (or `.gbrain-source`) gets `permission_denied` naming the binding when it passes `source_id` | `permission_denied` (hint starts "This connection is bound to source …") | #5081 | `gbrain sources list` (the source must show `federated`, not `isolated` or `unset`) | `gbrain sources federate <id>` on the brain host | Repeat the read with `source_id: "<id>"`; it returns only that source's rows. See [explicit reads from a bound agent connection](multi-source-brains.md#explicit-reads-from-a-bound-agent-connection) | brain host, after the user agrees | none |-| A new session's start-up context showed another session's text (`Last session activity: …`) | none | #5558 | none | Upgrade the `gbrain` each harness runs its hooks with and restart the harness. If you set `GBRAIN_HOOKS=0` as a workaround, remove it from the environment the harness starts from (shell profile or service) and restart the harness again | A new session shows no `Last session activity` line, and `gbrain doctor` reports `bootstrap_hooks_heartbeat` again after a few turns (capture and session persistence are back) | user (upgrades and restarts the harness) | `persistent_install` |-| `connect --harness codex\|claude-code\|opencode --install` stored the bearer token inline in the harness config without telling you | receipt `token_storage: "inline"` | #5775 | On the brain host: `gbrain mcp admin invalidate-tokens <client_id> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json` (only if the config file was exposed) | `gbrain mcp admin invalidate-tokens <client_id> --yes --if-version <revision> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json`, then `gbrain connect <mcp_url> --harness <harness> --credentials-file <handoff> --install --fresh-token`, then reload the harness | The new receipt prints `token_storage`, `config_path`, `renew_command` and `if_exposed`, and the harness answers a memory round trip | brain host, after the user agrees | `credentials` (invalidates tokens) |-| A second brain's autopilot replaced the first one's job, logs interleave in `~/.gbrain/autopilot.log`, or `gbrain autopilot --status --json` shows `job.needs_reinstall: "legacy_shared_job"` (or `"wrapper_missing"` after moving a brain); install refuses with `autopilot_job_owned_by_other_brain` | `gbrain autopilot --status --json` (`job.*`) / `autopilot_job_owned_by_other_brain` | #5195 | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` | `GBRAIN_HOME=<brain parent> gbrain autopilot --install` (every non-default brain first, then the default brain) | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` shows `job.needs_reinstall: null` and the brain's own `launchd_label` / `systemd_unit`. See [several brains on one host](live-sync.md#several-brains-on-one-host) | brain host, after the user agrees | `persistent_install` |-| `gbrain serve` started in a `.gbrain-mount` project: CLI writes fail `owner_unavailable` and MCP writes stay `queued` | `owner_unavailable` | #5237 | none | Upgrade and restart the resident `gbrain serve` (the harness that spawns it) | `gbrain sources writer status --probe --json` from the project answers | user (upgrades and restarts the harness) | `persistent_install` |-| Backup coverage reports `remote evidence: unavailable` for a private remote that is pushed | doctor `backup_coverage` | #5794 | none | Upgrade, then `gbrain backup check` | `gbrain backup status --json` shows `verification.state: "verified"`; see [remote unavailable](../operations/backup-check.md#remote-unavailable) | agent, after the user agrees | `persistent_install` (upgrade) |-| On Windows, a write or `gbrain sync` refuses a colon slug such as `calendar:abc` | [`colon_slug_windows_write_through`](write-refusals.md#colon_slug_windows_write_through) | #5032 | none | Use a slug without `:`, or write the page from a macOS or Linux host that owns the source | The write succeeds, or `gbrain sync` no longer lists the file | agent | none |-| Search empty or incomplete after upgrading; doctor `text_projection_readiness` warns | `text_projection_readiness` | #5401 | `gbrain doctor` (pending count, also while a PGLite resident runs) | `gbrain projections drain` (Postgres, or PGLite with no resident); on PGLite with a resident, wait or stop, drain and restart per [projection owner resident](#projection-owner-resident) | `gbrain doctor` shows `text_projection_readiness` ok | brain host | none |-| `Error [projection_owner_resident]` from `gbrain projections drain` (exit 2) | [`projection_owner_resident`](#projection-owner-resident) | #5401 | `gbrain doctor` | the printed stop, drain and restart commands | `gbrain doctor` | brain host | none |-| `[gbrain] warning: OPENAI_API_KEY in this process's environment differs from openai_api_key …`; doctor `embedding_key_source` warns | `embedding_key_source` ([provider key source](#embedding-key-source)) | #5137 | `gbrain doctor` (`embedding_key_source`) | remove the variable and restart that process, or `gbrain config unset openai_api_key` | the warning no longer prints; `gbrain doctor` shows `embedding_key_source` ok | user (owns the key) | `credentials` |-| `The OpenAI embedding provider rejected its key (HTTP 401)` | [`embedding_auth_failed`](write-refusals.md#embedding_auth_failed) | #5137 | `gbrain doctor` (`embedding_key_source`, `embedding_provider`) | the printed fix for the key source in effect, then `gbrain embed --stale` | `gbrain doctor` shows `embedding_provider` ok | user (owns the key) | `credentials`; `paid` for `embed --stale` |-| Conversation facts missing from recall after managed writes | `extractor_facts_expired` | #5731 | `gbrain repair extractor-facts` | `gbrain repair extractor-facts --apply --expect <hash>` (ambiguous: add `--include-ambiguous` to both) | `gbrain doctor` | brain host, after the user agrees | `destructive` (rewrites expired facts) |---### Symptoms from the lifecycle fixes in v0.60.20.0+| Symptom | Check or code | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- | --- |+| synthesize fails every run; `POST /ingest` returns 409 (500 on an older gbrain); workers refuse to start with "legacy jobs have missing or unsupported authority" | `legacy_job_authority` / `permission_denied` ([legacy job authority](#legacy-job-authority)) | stop `gbrain serve`, autopilot and workers; `gbrain jobs cancel <active id>`; `gbrain jobs authorize-legacy --select "status=waiting\|delayed\|waiting-children\|paused"` | `gbrain jobs authorize-legacy --select "<same filter>" --expect <hash> --yes`, then restart | `gbrain doctor` shows `legacy_job_authority` ok; `/ingest` returns 202 | brain host, after the user agrees | `paid` (authorizes legacy jobs) |+| Search returns atoms quoting text a page no longer has, or atoms of deleted pages | doctor `atom_provenance_drift` | `gbrain repair stale-atoms --source <id>` | `gbrain repair stale-atoms --source <id> --apply --expect <hash>` | `gbrain doctor` (`atom_provenance_drift` drops by the retired count) | brain host, after the user agrees | `destructive` (removes stale atoms) |+| `sources add`, `claim`, `rebind`, `archive`, `remove`, clone, reclone or `sources writer transfer` on a repo with more than ~10k files fails with "The verified source manifest exceeds the 1 MiB administration metadata bound" | `request_too_large` | none: upgrade and restart every writer host and resident `gbrain serve` | Re-run the failed command (with the same `--request-id` if you kept it) | `gbrain sources writer status --json` shows the source bound, and its `manifest_digest` is set | agent | none |+| A stdio agent bound with `GBRAIN_SOURCE` (or `.gbrain-source`) gets `permission_denied` naming the binding when it passes `source_id` | `permission_denied` (hint starts "This connection is bound to source …") | `gbrain sources list` (the source must show `federated`, not `isolated` or `unset`) | `gbrain sources federate <id>` on the brain host | Repeat the read with `source_id: "<id>"`; it returns only that source's rows. See [explicit reads from a bound agent connection](multi-source-brains.md#explicit-reads-from-a-bound-agent-connection) | brain host, after the user agrees | none |+| A new session's start-up context showed another session's text (`Last session activity: …`) | none | none | Upgrade the `gbrain` each harness runs its hooks with and restart the harness. If you set `GBRAIN_HOOKS=0` as a workaround, remove it from the environment the harness starts from (shell profile or service) and restart the harness again | A new session shows no `Last session activity` line, and `gbrain doctor` reports `bootstrap_hooks_heartbeat` again after a few turns (capture and session persistence are back) | user (upgrades and restarts the harness) | `persistent_install` |+| `connect --harness codex\|claude-code\|opencode --install` stored the bearer token inline in the harness config without telling you | receipt `token_storage: "inline"` | On the brain host: `gbrain mcp admin invalidate-tokens <client_id> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json` (only if the config file was exposed) | `gbrain mcp admin invalidate-tokens <client_id> --yes --if-version <revision> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json`, then `gbrain connect <mcp_url> --harness <harness> --credentials-file <handoff> --install --fresh-token`, then reload the harness | The new receipt prints `token_storage`, `config_path`, `renew_command` and `if_exposed`, and the harness answers a memory round trip | brain host, after the user agrees | `credentials` (invalidates tokens) |+| A second brain's autopilot replaced the first one's job, logs interleave in `~/.gbrain/autopilot.log`, or `gbrain autopilot --status --json` shows `job.needs_reinstall: "legacy_shared_job"` (or `"wrapper_missing"` after moving a brain); install refuses with `autopilot_job_owned_by_other_brain` | `gbrain autopilot --status --json` (`job.*`) / `autopilot_job_owned_by_other_brain` | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` | `GBRAIN_HOME=<brain parent> gbrain autopilot --install` (every non-default brain first, then the default brain) | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` shows `job.needs_reinstall: null` and the brain's own `launchd_label` / `systemd_unit`. See [several brains on one host](live-sync.md#several-brains-on-one-host) | brain host, after the user agrees | `persistent_install` |+| `gbrain serve` started in a `.gbrain-mount` project: CLI writes fail `owner_unavailable` and MCP writes stay `queued` | `owner_unavailable` | none | Upgrade and restart the resident `gbrain serve` (the harness that spawns it) | `gbrain sources writer status --probe --json` from the project answers | user (upgrades and restarts the harness) | `persistent_install` |+| Backup coverage reports `remote evidence: unavailable` for a private remote that is pushed | doctor `backup_coverage` | none | Upgrade, then `gbrain backup check` | `gbrain backup status --json` shows `verification.state: "verified"`; see [remote unavailable](../operations/backup-check.md#remote-unavailable) | agent, after the user agrees | `persistent_install` (upgrade) |+| On Windows, a write or `gbrain sync` refuses a colon slug such as `calendar:abc` | [`colon_slug_windows_write_through`](write-refusals.md#colon_slug_windows_write_through) | none | Use a slug without `:`, or write the page from a macOS or Linux host that owns the source | The write succeeds, or `gbrain sync` no longer lists the file | agent | none |+| Search empty or incomplete after upgrading; doctor `text_projection_readiness` warns | `text_projection_readiness` | `gbrain doctor` (pending count, also while a PGLite resident runs) | `gbrain projections drain` (Postgres, or PGLite with no resident); on PGLite with a resident, wait or stop, drain and restart per [projection owner resident](#projection-owner-resident) | `gbrain doctor` shows `text_projection_readiness` ok | brain host | none |+| `Error [projection_owner_resident]` from `gbrain projections drain` (exit 2) | [`projection_owner_resident`](#projection-owner-resident) | `gbrain doctor` | the printed stop, drain and restart commands | `gbrain doctor` | brain host | none |+| `[gbrain] warning: OPENAI_API_KEY in this process's environment differs from openai_api_key …`; doctor `embedding_key_source` warns | `embedding_key_source` ([provider key source](#embedding-key-source)) | `gbrain doctor` (`embedding_key_source`) | remove the variable and restart that process, or `gbrain config unset openai_api_key` | the warning no longer prints; `gbrain doctor` shows `embedding_key_source` ok | user (owns the key) | `credentials` |+| `The OpenAI embedding provider rejected its key (HTTP 401)` | [`embedding_auth_failed`](write-refusals.md#embedding_auth_failed) | `gbrain doctor` (`embedding_key_source`, `embedding_provider`) | the printed fix for the key source in effect, then `gbrain embed --stale` | `gbrain doctor` shows `embedding_provider` ok | user (owns the key) | `credentials`; `paid` for `embed --stale` |+| Conversation facts missing from recall after managed writes | `extractor_facts_expired` | `gbrain repair extractor-facts` | `gbrain repair extractor-facts --apply --expect <hash>` (ambiguous: add `--include-ambiguous` to both) | `gbrain doctor` | brain host, after the user agrees | `destructive` (rewrites expired facts) |+++### Upgrading to v0.60.20.0<a id="repair-migration-symptoms"></a>-| Symptom or error text | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- |-| `gbrain upgrade` said the upgrade failed, or migrations ran twice | #5693 | `gbrain apply-migrations --list` | `gbrain apply-migrations --yes` | `gbrain doctor --only minions_migration --json` (`minions_migration` ok) | agent, after the user agrees | none |-| `another apply-migrations is running (host …, pid …)` | #5693 | `gbrain doctor` | wait, then `gbrain apply-migrations --yes` | `gbrain apply-migrations --list` | agent | none |-| doctor `orphan_persistence_bindings`; a re-added source fails with `writer_coordinator_required` | #5732 | `gbrain repair orphan-bindings` | `gbrain repair orphan-bindings --apply` | `gbrain doctor` | brain host, after the user agrees | none |-| doctor `stale_embedding_effects`; `writer_not_quiesced` names an embedding effect | #5629, #5734 | `gbrain repair embedding-effects --source <id>` | `gbrain repair embedding-effects --source <id> --apply` | `gbrain doctor` (pending until the owner run commits a `retry_queued` effect) | brain host, after the user agrees | none |-| autopilot never syncs a connector, or prints `has never synced` | #5673 | `gbrain sources status <id>` | `gbrain sync --source <id>` once | `gbrain sources status <id>` | agent | `egress` (fetches from the provider) |-| a connector source keeps a stale `local_path` | #5673 | `gbrain sources list` | `gbrain sources set-path <id> --clear` | `gbrain sources list` | agent, after the user agrees | none |-| classic writes refused after leaving managed mode, or `local_markers: pending` | #5628 | `gbrain sources writer deactivate --dry-run` | see the [deactivate runbook](../architecture/topologies.md#deactivate-runbook) | `gbrain sources writer status` on every host | brain host, after the user agrees | none |+| Symptom or error text | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- |+| `gbrain upgrade` said the upgrade failed, or migrations ran twice | `gbrain apply-migrations --list` | `gbrain apply-migrations --yes` | `gbrain doctor --only minions_migration --json` (`minions_migration` ok) | agent, after the user agrees | none |+| `another apply-migrations is running (host …, pid …)` | `gbrain doctor` | wait, then `gbrain apply-migrations --yes` | `gbrain apply-migrations --list` | agent | none |+| doctor `orphan_persistence_bindings`; a re-added source fails with `writer_coordinator_required` | `gbrain repair orphan-bindings` | `gbrain repair orphan-bindings --apply` | `gbrain doctor` | brain host, after the user agrees | none |+| doctor `stale_embedding_effects`; `writer_not_quiesced` names an embedding effect | `gbrain repair embedding-effects --source <id>` | `gbrain repair embedding-effects --source <id> --apply` | `gbrain doctor` (pending until the owner run commits a `retry_queued` effect) | brain host, after the user agrees | none |+| autopilot never syncs a connector, or prints `has never synced` | `gbrain sources status <id>` | `gbrain sync --source <id>` once | `gbrain sources status <id>` | agent | `egress` (fetches from the provider) |+| a connector source keeps a stale `local_path` | `gbrain sources list` | `gbrain sources set-path <id> --clear` | `gbrain sources list` | agent, after the user agrees | none |+| classic writes refused after leaving managed mode, or `local_markers: pending` | `gbrain sources writer deactivate --dry-run` | see the [deactivate runbook](../architecture/topologies.md#deactivate-runbook) | `gbrain sources writer status` on every host | brain host, after the user agrees | none |`orphan-bindings` and `embedding-effects` also run under `gbrain repair --all`and `gbrain doctor --remediate --include-repairs`; `embedding-effects` is paid@@ -1101,7 +1101,7 @@ work when it queues a retry. Retry commands: `gbrain sources writer retry-effect`gbrain doctor` reports `self_capture` when the dream session corpus(`dream.synthesize.session_corpus_dir`) still holds files captured from-gbrain's own `claude-cli` sessions (#5413). Dream and the sweep already skip+gbrain's own `claude-cli` sessions. Dream and the sweep skipthe ones they can identify, but nothing removes them. The check never movesor deletes files. It lists what it classified (a harness transcript under agbrain scratch project matches the file) and counts what it cannot decide (no@@ -1131,7 +1131,7 @@ activation. Settle it."*`gbrain doctor` reports `stale_embedding_effects` when a committed write stillhas an embedding effect that is queued an hour later with no consumer claiming-it (#5629), or that failed (#5734, for example after a provider outage). Either+it, or that failed (for example after a provider outage). Eitherone keeps the write receipt from compacting and blocks activation with`writer_not_quiesced`. Preview, then apply after you agree, on the brain host:@@ -1157,7 +1157,7 @@ covers the whole retry budget each grant authorizes. A resumed run replays thegrant it already made instead of granting another cycle. A signature-mismatchedvector is never reconciled; it is re-embedded.-## Wave 5 refusal codes+## Repair refusal codesEach heading below is the `docs` anchor a refusal carries.@@ -1199,7 +1199,7 @@ applies to `gbrain jobs authorize-legacy --select`, `gbrain jobs cancel### Legacy job authority`permission_denied` with this anchor means a queued job row has SQL NULL-`submission_authority`, left by an upgrade across v0.50 (#5157, #5114).+`submission_authority`, left by an upgrade across v0.50.- A resubmission over a **dead or cancelled** legacy key releases the key andqueues a fresh job. No step needed.@@ -1253,11 +1253,11 @@ message lists the valid statuses, and the hint is a complete example.`projection_owner_resident` (exit 2): `gbrain projections drain` did not runbecause a gbrain process (named with its pid) holds this PGLite brain. Nothing-changed. The upgraded resident drains the queue itself; re-run `gbrain doctor`+changed. The resident drains the queue itself; re-run `gbrain doctor`to watch the pending count in `text_projection_readiness` (doctor asks theresident over its local socket, so the count shows while the resident runs; a-resident that does not answer may predate this release and should be restarted-on the upgraded gbrain).+resident that does not answer runs an older gbrain, so restart it on the+current version).To drain faster, stop the owner, drain, then restart it. The restart runswhether or not the drain failed:@@ -1280,5 +1280,5 @@ follows `GBRAIN_AUTOPILOT_LABEL` when set.- [Write refusal reasons](write-refusals.md) — what a refused write means and the recovery command- [Concurrent writes and durable receipts](concurrent-writes.md) — receipts, retries and capacity limits-- [v0.60.5.0 upgrade steps](../../skills/migrations/v0.60.5.0.md) — the backup-first upgrade that introduced these repairs+- [v0.60.5.0 upgrade steps](../../skills/migrations/v0.60.5.0.md) — backup-first upgrade steps for a brain older than v0.60.5.0- [Topologies: claim and activate runbook](../architecture/topologies.md#claim-and-activate-runbook) — quiescence checklist, the writer admin lockdiff --git a/docs/guides/skill-reference.md b/docs/guides/skill-reference.mdindex e84a43df56..17472b15d0 100644--- a/docs/guides/skill-reference.md+++ b/docs/guides/skill-reference.md@@ -2,25 +2,24 @@Read the skill files in `skills/` before doing brain operations. GBrain ships 50+ skills(the current list lives in `skills/manifest.json`) organized by `skills/RESOLVER.md`-(`AGENTS.md` is also accepted as of v0.19):+(`AGENTS.md` is also accepted):-**Original 8 (conformance-migrated):** ingest (thin router), query, maintain, enrich,+**Core 8:** ingest (thin router), query, maintain, enrich,briefing, migrate, setup, publish.-**Brain skills (ported from an upstream agent fork):** signal-detector, brain-ops, idea-ingest, media-ingest,+**Brain skills:** signal-detector, brain-ops, idea-ingest, media-ingest,meeting-ingestion, citation-fixer, repo-architecture, skill-creator, daily-task-manager.**Operational + identity:** daily-task-prep, cross-modal-review, cron-scheduler, reports,-testing, soul-audit, webhook-transforms, data-research, minion-orchestrator. As of-v0.20.4, `minion-orchestrator` is the single unified skill for both lanes of background-work (shell jobs via `gbrain jobs submit shell`, LLM subagents via `gbrain agent run`) ...-the prior `gbrain-jobs` skill was merged in, Preconditions are shared, and trigger-routing is narrowed to what the skill actually covers.+testing, soul-audit, webhook-transforms, data-research, minion-orchestrator.+`minion-orchestrator` is the single skill for both lanes of background work (shell jobs+via `gbrain jobs submit shell`, LLM subagents via `gbrain agent run`), with shared+Preconditions and trigger routing limited to what the skill covers.-**Skillify loop (v0.19):** skillify (the markdown orchestration), skillpack-check+**Skillify loop:** skillify (the markdown orchestration), skillpack-check(agent-readable health report).-**Brain-resident skillpacks + advisor (v0.42.47.0, #2180):** A brain repo can carry its+**Brain-resident skillpacks + advisor:** A brain repo can carry itsown publishable skillpack (`brain_resident: true` in `skillpack.json` + `schema_pack`);`gbrain skillpack init-brain-pack` scaffolds one with a 5-section machine-parseable README.Connecting harnesses discover it on `gbrain sources add` (Topology A advisory, bounded nag@@ -29,9 +28,9 @@ via `nag-state.ts`) and over MCP via the source-scoped `list_brain_skillpack` op+ `gbrain advisor` op compute a ranked, read-only list of high-leverage actions from brainstate (8 collectors in `src/core/advisor/`); `--json`+exit codes for CI/cron, local-only`--apply <id>` behind confirm, exposed over MCP behind `mcp.publish_advisor` (read-only; on-by default for the local stdio server, opt-in for remote HTTP; an explicit `false` hides it). Thin-client binary install stays deferred to PR2 `build_skillpack`.+by default for the local stdio server, opt-in for remote HTTP; an explicit `false` hides it). Thin clients cannot install a brain pack as a binary.-**Routing-table compression (v0.32.3.0):** `skills/functional-area-resolver/` —+**Routing-table compression:** `skills/functional-area-resolver/` —two-layer dispatch pattern for shrinking large AGENTS.md / RESOLVER.md files(>=12KB) without losing routing accuracy. Replaces one row per skill with oneentry per functional area, where each area declares its sub-skills in a@@ -51,12 +50,12 @@ Receipt header binds (model, prompt_template_hash, fixtures_hash, harness_sha,ts) so future contributors can verify reproduction. Companion `rescore.mjs`re-scores existing JSONL with lenient tolerance for zero API cost. Reproducewith `cd evals/functional-area-resolver && node harness.mjs --model-{opus|sonnet|haiku}` (~$0.30–1.70 per model). Nine v0.33.x follow-up TODOs-filed for held-out corpus growth, cross-vendor verification, hierarchical-area-of-areas, embedding-based pre-router, and the run-1 vs run-2-prompt-design ablation methodology.+{opus|sonnet|haiku}` (~$0.30–1.70 per model). Open follow-ups (held-out corpus+growth, cross-vendor verification, hierarchical area-of-areas, an embedding-based+pre-router, and the run-1 vs run-2 prompt-design ablation methodology) are tracked+in [TODOS.md](../../TODOS.md#functional-area-resolver-follow-ups-v03230).-**Operational health (v0.19.1):** smoke-test (8 post-restart health checks; bounded+**Operational health:** smoke-test (8 post-restart health checks; boundedauto-fix for Bun, CLI, and Zod CJS; read-only worker topology via native supervisorstatus with duplicate detection; DB, gateway, API key, brain repo; user-extensiblevia `~/.gbrain/smoke-tests.d/*.sh`).diff --git a/docs/guides/skillopt.md b/docs/guides/skillopt.mdindex 19859aac09..3276f2a826 100644--- a/docs/guides/skillopt.md+++ b/docs/guides/skillopt.md@@ -496,8 +496,8 @@ purpose:** the config dir also holds the CLI's session credentials, so theempty-dir form logs the child out wherever the CLI reads its session from theconfig dir — macOS included (observed with Claude Code 2.1.x). If rolloutsstart failing auth (`Not logged in · Please run /login`) after flipping this-on, that is why: the run now ends `errored` with that message as the failure-detail instead of finishing as a `no_improvement` with a 0.000 score. For a+on, that is why: the run ends `errored` with that message as the failure+detail, not as a `no_improvement` with a 0.000 score. For ahermetic run that stays authenticated, use the explicit-path form andpre-seed that directory with a logged-in config.diff --git a/docs/guides/troubleshooting.md b/docs/guides/troubleshooting.mdindex 481549773a..28cd7c44bb 100644--- a/docs/guides/troubleshooting.md+++ b/docs/guides/troubleshooting.md@@ -62,7 +62,7 @@| `embed_staleness` | the stale-chunk count (the embed worker's own predicate) | the reason names the database error; re-run `gbrain doctor` once it is fixed || `schema_pack_consistency`, `schema_pack_source_drift` | the pages or config query, or a source's active schema pack | `gbrain schema lint --with-db` runs the same classification locally; `gbrain schema active` debugs pack resolution |-`bootstrap_push_health` and `gbrain bootstrap status` report only the push record of the workspace named by this machine's bootstrap receipt; another workspace's stale or failed push is listed as such (a warn naming that workspace), never as this workspace's state. `reranker_health` auth warnings are audit-log history (`details.live_probe_performed: false`), not a live check of the key. **Behavior change:** a doctor that used to read all green can now show these warns; each one is a check that did not run.+`bootstrap_push_health` and `gbrain bootstrap status` report only the push record of the workspace named by this machine's bootstrap receipt; another workspace's stale or failed push is listed as such (a warn naming that workspace), never as this workspace's state. `reranker_health` auth warnings are audit-log history (`details.live_probe_performed: false`), not a live check of the key. These warns can appear while every other check reads green; each one names a check that did not run.**`brain_score` shows a low "timeline density (entity and event pages)"?** The 15-point timeline component grades only linkable pages whose type's active-pack primitive is `entity` or `temporal` (people, companies, meetings, emails, events…); reference documents such as notes, writing and guides have no events and are not graded, so do not stamp "page created" rows onto them. Types the pack does not declare are still graded. Raise the score by giving those entity and event pages real timeline entries (`gbrain extract timeline`).@@ -214,10 +214,11 @@ agent runs `gbrain doctor` and reads the `vector_plan` check.embedding get fresh vectors.- warn, legacy guard: see below.-**Legacy guard (one-release rollback).** If vector search got slower or-returned different results right after the upgrade that moved the content-freshness check out of the HNSW candidate scan (#5824), you can restore the-previous statement while you report it:+**Legacy guard (temporary rollback).** Vector search checks content freshness+outside the HNSW candidate scan. `search.vector_legacy_guard` restores the older+statement, which checked freshness inside the scan. Use it only when vector+search is slower or returns different results than before your upgrade, and+report the regression:1. The setting belongs to the process that runs searches on the brain host(`gbrain serve`, autopilot, job workers), never to a thin client.@@ -231,7 +232,7 @@ previous statement while you report it:5. Remove it once the regression is fixed: `gbrain config setsearch.vector_legacy_guard false` (or unset the variable) and restart again.-The guard is retired in the next release; that release prints a one-time notice+The guard is temporary. The release that retires it prints a one-time noticewhen the inert setting is still present.## Global maintenance timeouts@@ -239,7 +240,7 @@ when the inert setting is still present.**Doctor warns `global_maintenance_timeouts`, or late maintenance phases(orphans, purge, the brain-wide embed) never seem to run?** On a large brainone `autopilot-global-maintenance` job may not fit every phase before its-deadline (30 minutes by default). Each job now stops starting phases that its+deadline (30 minutes by default). Each job stops starting phases that itsdeadline would cut off and the next job resumes at that phase, so one pass canspan several jobs; the resume point is the config row`autopilot.global_maintenance.progress`. A phase that was running when a job@@ -260,7 +261,7 @@ at the deadline).**Say to your agent:** *"Why aren't my meetings showing up as timeline events?"*-Automatic event extraction works again and is on by default. See the+Automatic event extraction is on by default. See the[Life Chronicle guide](life-chronicle.md) for what qualifies, the cost, thethree-step check, and the skip codes. `gbrain doctor` reports it as the`auto_chronicle` check. To turn it off, rundiff --git a/docs/guides/write-refusals.md b/docs/guides/write-refusals.mdindex a7bcc998ab..71220c8310 100644--- a/docs/guides/write-refusals.md+++ b/docs/guides/write-refusals.md@@ -36,23 +36,23 @@ of making a duplicate.| Reason | Error code | What it means | Recovery || --- | --- | --- | --- |-| `file_database_drift` | `source_changed` | The page's canonical file and its database copy disagree, usually because the file was edited outside a coordinated write. Neither copy was overwritten. A file with no `type:` line keeps the stored type, and titles compare trimmed, so those alone no longer cause this. | `gbrain sources reconcile <source> <slug> --brain <brain> --preview`, review the preview, resolve it, then `--apply <resolved-preview-file> --request-id <new uuid>`. Retry the original write with a **new** request ID. See [repair a file/database disagreement](concurrent-writes.md#repair-a-filedatabase-disagreement). |+| `file_database_drift` | `source_changed` | The page's canonical file and its database copy disagree, usually because the file was edited outside a coordinated write. Neither copy was overwritten. A file with no `type:` line keeps the stored type, and titles compare trimmed, so those alone do not cause this. | `gbrain sources reconcile <source> <slug> --brain <brain> --preview`, review the preview, resolve it, then `--apply <resolved-preview-file> --request-id <new uuid>`. Retry the original write with a **new** request ID. See [repair a file/database disagreement](concurrent-writes.md#repair-a-filedatabase-disagreement). || <a id="writer-coordinator-required"></a>`database_guard` or `database_trigger` | `writer_coordinator_required` (or `storage_error` for another trigger) | A database trigger refused a row while a write was being prepared or published, so nothing was committed and any canonical file already replaced was restored. With `database_guard`, a gbrain process wrote a row its publication does not own (another source, an unresolvable source, or a source checkpoint/topology change outside owner administration). This is a gbrain defect or a version mismatch between gbrain processes sharing the database, not a content conflict. The receipt's `write_error_detail` names the table, operation, guard branch, source relationship and stage; it never contains page text or source names. | On the brain host run `gbrain sources writer status --probe --json`. Its `recent_failures[].error_detail` adds the source ids and the gbrain build and host that ran the attempt (`attempt.consumer_version`). If that build differs from `gbrain --version`, upgrade or restart every gbrain process that shares the database (serve, autopilot, sync jobs), then retry with a **new** request ID. If the builds match, report `error_detail` on the gbrain issue tracker. Never force-write, edit SQL or disable the guard. || `ambiguous_source_path` | `page_identity_changed` | A source registered at a Git subfolder `<sub>` has a page whose stored path `<sub>/<file>` could mean either `<file>` in the source directory (the older Git-root spelling) or `<sub>/<file>` inside a folder of the source that repeats its name, and both files exist. Sync refuses instead of guessing. See [sources in a Git subfolder](multi-source-brains.md#sources-in-a-git-subfolder). | Rename or move one of the two files, commit, then `gbrain sync --source <source> --no-pull --retry-failed`. || `physical_root_device_changed` | `recovery_required` | The checkout's filesystem device number changed while everything else matches, which macOS can do after a reboot. When the owner token, brain, worktree, root, inode and a non-zero birth time all match and the caller can verify database ownership, the write path re-stamps ownership by itself and the write proceeds. This refusal means the automatic re-stamp could not be verified; the suggestion says why. | Do a deliberate self-transfer: `gbrain sources writer status <source>` (note `admin_state`), then `gbrain sources writer transfer prepare <source> --self-transfer --admin-intent writer_transfer_prepare --expected-state <admin_state>`, then `gbrain sources writer transfer accept <source> --path <root> --expected-epoch <epoch> --manifest <digest from prepare> --self-transfer --admin-intent writer_transfer_accept --expected-state <fresh admin_state>`. Retry the original write with the **same** request ID. Never delete ownership marker files. || <a id="embedding_budget_below_worst_case"></a>`embedding_budget_below_worst_case` | `embedding_budget_below_worst_case` | `gbrain migrate embeddings` (or the local `migrate_embeddings` operation) was given a `--max-cost-usd` cap below the migration's worst-case authorization: every planned provider request at its maximum input size, plus any debits a resumed run already holds. The run stopped before any provider request, re-chunk or vector invalidation, so nothing changed. The message and JSON carry `cap_usd`, `worst_case_usd`, `debited_usd` and `required_cap_usd`. | Re-run with the value the `suggestion` names, for example `gbrain migrate embeddings --to <provider:model> --dim <N> --max-cost-usd <required_cap_usd> --yes` (operation: `max_cost_usd`). Preview first with `--dry-run`, which prints the worst-case authorization beside the estimate. Requests settle to reported usage, so actual spend is usually far below the cap. See [embedding migration](embedding-migration.md). |-| frontmatter slug conflict | `frontmatter_slug_conflict` (`invalid_params` before #5988) | A file's frontmatter `slug:` names a different page than its path. On a write nothing is written; during sync the file is held and the rest of the source imports. | Remove the `slug:` line or make it match the path, commit, then sync. See [`frontmatter_slug_conflict`](#frontmatter_slug_conflict). |+| frontmatter slug conflict | `frontmatter_slug_conflict` (`invalid_params` on a gbrain older than v0.60.47.0) | A file's frontmatter `slug:` names a different page than its path. On a write nothing is written; during sync the file is held and the rest of the source imports. | Remove the `slug:` line or make it match the path, commit, then sync. See [`frontmatter_slug_conflict`](#frontmatter_slug_conflict). || `cursor_processing_options_conflict` | `invalid_params` | An unfinished sync's processing options (`--no-embed`, `--no-extract`, `--no-schema-pack`) conflict with this run, or the cursor predates saved options and has none. When options are saved, a run that omits those flags, including autopilot and `sync` jobs, adopts them. | When the message prints a resume command (`gbrain sync --source <source> --no-pull` plus the saved flags), run it or drop the conflicting flag. When it reports no saved options, resolve pending requests first, then rediscover with `gbrain sync --source <source> --no-pull --retry-failed` and the processing flags you want. || `take_row_collision` | `take_row_collision` | A save adds a takes-table row whose row number already belongs to a different take that exists only in the database. The save stops instead of overwriting that take. | Renumber the new takes row, or add the existing take to the page's takes table, then save with the current `expected_revision` and a **new** request ID (the content changed). || `invalid_source_uri` | `invalid_source_uri` | The brain has shared skillpacks, and the page's stored `source_uri` is a `file:` URI that cannot be turned into a local path, so gbrain cannot prove the write stays outside a skillpack. Shared-skill protection stays on. | The source owner inspects the page's stored `source_uri` on the brain host and replaces it with an absolute file URI or clears it; there is no dedicated command yet. Retry with a **new** request ID. || `queue_capacity` | `queue_capacity` | Admission would exceed a write-journal limit. Existing requests keep their place; nothing is evicted. For the cumulative limits (lifetime request IDs and receipt bytes), `detail` names the limit, for example `principal_lifetime_ids`. | For a cumulative limit, run the printed `gbrain config set persistence.limits.<limit> <value>` (sized for about one more year at the current rate), then retry with the **same** request ID. For outstanding-request, queued-byte or recovery-byte limits, let outstanding requests finish and check `gbrain sources writer status`. See [bounded admission and retention](concurrent-writes.md#bounded-admission-and-retention). |-| <a id="checkpoint-validation-timeout"></a>`index_building`, `index_missing` or `indexes_valid` | `checkpoint_validation_timeout` | A managed sync's checkpoint validation (the check that every page receipt of the run committed) hit the coordinator's 5-second statement timeout on a large `persistence_requests` table. The checkpoint request failed terminally instead of being retried ahead of every other write to the source, so other writes proceed; `last_commit` is unchanged and every page the run already committed stays committed. `detail` says which of three states the request indexes were in when the hint was built. | `index_building`: this release's index migration is still building the indexes; wait (doctor `persistence_request_indexes` shows progress), then run the printed retry. `index_missing`: run `gbrain repair request-indexes --apply` (it drops an INVALID index and rebuilds it concurrently on Postgres), then the printed retry. `indexes_valid`: run the printed retry once; if it times out again, report the request id with the `persistence_request_indexes` and `persistence_request_growth` entries of `gbrain doctor --json`. The retry is `gbrain sync --source <source> --no-pull --retry-failed` plus the run's `--repo` base and cursor options (`--full`, `--working-tree`, `--src-subpath`, `--exclude`, `--include-hidden`, `--strategy`) and saved processing flags, so it resumes the same cursor. Do not cancel the request: a cancelled checkpoint still blocks the next one. |+| <a id="checkpoint-validation-timeout"></a>`index_building`, `index_missing` or `indexes_valid` | `checkpoint_validation_timeout` | A managed sync's checkpoint validation (the check that every page receipt of the run committed) hit the coordinator's 5-second statement timeout on a large `persistence_requests` table. The checkpoint request failed terminally instead of being retried ahead of every other write to the source, so other writes proceed; `last_commit` is unchanged and every page the run already committed stays committed. `detail` says which of three states the request indexes were in when the hint was built. | `index_building`: migration 179 is still building the indexes; wait (doctor `persistence_request_indexes` shows progress), then run the printed retry. `index_missing`: run `gbrain repair request-indexes --apply` (it drops an INVALID index and rebuilds it concurrently on Postgres), then the printed retry. `indexes_valid`: run the printed retry once; if it times out again, report the request id with the `persistence_request_indexes` and `persistence_request_growth` entries of `gbrain doctor --json`. The retry is `gbrain sync --source <source> --no-pull --retry-failed` plus the run's `--repo` base and cursor options (`--full`, `--working-tree`, `--src-subpath`, `--exclude`, `--include-hidden`, `--strategy`) and saved processing flags, so it resumes the same cursor. Do not cancel the request: a cancelled checkpoint still blocks the next one. || <a id="connector-account-changed"></a>`account_changed`, `account_unresolved` | `connector_account_changed` | A managed Google or GitHub connector's credential resolves to a different account than the one pinned for the source (Google email, GitHub App installation or login), or to no account at all. Google checks every enabled service before any service runs. Nothing was imported. No reset flag authorizes an account change. | The suggestion gives two branches with real values. (A) Restore the credential for the pinned account (the configured `g_token_env`, `g_token_command`, vault credential, `gh_token_env` or GitHub App key), then `gbrain sync --source <source>`. (B) For a deliberate change, add a new source for the new account (`gbrain google setup --account <email>`, or `gbrain sources add <new-id> --kind github … --app-install <id>`), then `gbrain sources archive <source>`; existing pages stay under the old source. || <a id="connector-intent-outdated"></a>`pre_upgrade` | `connector_intent_outdated` | A connector write was admitted in the intent format retired in v0.60.11.0. With detail `pre_upgrade` it was admitted before this brain's upgrade; otherwise a connector host older than v0.60.11.0 admitted it. The consumer recovers any file publication in progress first, then fails the request. | `pre_upgrade`: nothing to do; the item is fetched again on the next `gbrain sync --source <source>` under a new request ID. Otherwise: `gbrain upgrade` on the host that runs connector jobs, then `gbrain sync --source <source>`. || <a id="invalid-connector-text"></a>`invalid_connector_text` | `invalid_connector_text` | A Google or GitHub item's identity field (a path, item id or account) contains a NUL or an unpaired UTF-16 surrogate, which cannot be stored. Prose (bodies, subjects, titles) is cleaned at render time and never refused. The item is counted toward a hold; the rest of the sync continues. | Nothing to run for one refusal. Once the item is held, `gbrain sources status <source>` names it; after the provider data is fixed, `gbrain sources retry-held <source>`, then `gbrain sync --source <source>`. || <a id="connector-holds-exhausted"></a>`connector_holds_exhausted` | `connector_holds_exhausted` | A Google or GitHub source already holds 100 items and this sync would hold another. The sync stopped without advancing its cursor. So many held items usually means a source-wide problem (a broken renderer, a revoked scope), not bad items. | `gbrain sources status <source>` to see the held items and their error codes, fix the cause, then `gbrain sources retry-held <source>` and `gbrain sync --source <source>`. `gbrain sync --source <source> --full` also clears every hold. || <a id="connector-fence-below-timeline"></a>`fence_not_carried` | `connector_fence_below_timeline` | A managed connector re-render would have dropped a facts or takes fence the stored page keeps below its timeline sentinel, or one that is duplicated, unbalanced or unparseable. The write was refused so those rows are not expired; the item is counted toward a hold. | Preview `gbrain repair connector-fences --source <source>`, apply it after review with `--apply`, then `gbrain sources retry-held <source>`. A page the repair counts as ambiguous needs a manual edit (see [repair](repair.md)). |-| <a id="unsupported-mutation-protocol"></a>`consumer_upgrade_required` | `unsupported_mutation_protocol` | A v0.60.11.0 connector sent a `connector_v2_*` write to a persistence consumer older than v0.60.11.0, which does not know the format. Other `permission_denied` refusals on connector receipts are never relabeled as upgrades. | `gbrain upgrade` on every consumer and worktree-owner host, then `gbrain sync --source <source>`. Upgrade those hosts before connector hosts. |+| <a id="unsupported-mutation-protocol"></a>`consumer_upgrade_required` | `unsupported_mutation_protocol` | A connector on v0.60.11.0 or later sent a `connector_v2_*` write to a persistence consumer older than v0.60.11.0, which does not know the format. Other `permission_denied` refusals on connector receipts are never relabeled as upgrades. | `gbrain upgrade` on every consumer and worktree-owner host, then `gbrain sync --source <source>`. Upgrade those hosts before connector hosts. || `unbound_source` | `owner_unavailable` | On Postgres, a page write went to a source that has a checkout path but no canonical owner. It is refused by default because another host may own the files. The same reason appears when the source was bound, or the page gained a canonical file, after a database-only write was accepted, and (as a `source_changed` sync failure) when a canonical file appears at the path of a page written while the source was unbound. | Bind the source (`gbrain sources writer status <source> --json`, then `gbrain sources writer claim <source> --path <checkout> --admin-intent writer_claim --expected-state <admin_state>`), or opt in with `gbrain config set persistence.unbound_write database_only`. See [unbound sources on Postgres](#unbound-sources-on-postgres). || <a id="embedding_zero_norm"></a>`zero_norm`, `non_finite` or `empty_input` | `embedding_zero_norm` | The embedding provider returned a vector with no direction (all zeros, NaN or infinity) for a chunk, or the chunk text was empty. A vector index silently skips such a row, so gbrain refuses to store it. Only that chunk is refused: the page text and every other chunk's vector are saved, and the page is left for `gbrain embed --stale`. It is never retried as a rate limit or network error. | Inspect the named page's chunk text (empty, whitespace- or symbol-only chunks are the usual cause) or the embedding provider, fix it, then run `gbrain embed <slug>` (add `--source <source>` for a non-default source). If normal text also returns zero vectors, the provider or model is broken; check it with `gbrain doctor`. || `targets_parked` (doctor: `parked_effects`) | effect `error_code` | A Git backup or withdrawal target failed five times in a row and was set aside so the other pages keep committing. An effect `error_code` of `git_index_stale` means an index lock older than 10 minutes blocks the checkout: `.git/index.lock` in it (`git -C <checkout> rev-parse --git-path index.lock` for a linked worktree). Remove it only if no git command is running there, then run the `retry-effects` command. A fresher lock (`git_index_locked`) is retried as contention and never parks. The page write itself committed; its Git backup or withdrawal is incomplete. Contention, dependency waits, shutdown and transient database errors never count toward the five. | `gbrain sources writer status <source>`, fix the cause it names, preview with `gbrain sources writer retry-effects <source> --request-id <id> --dry-run`, then run it without `--dry-run`. Each run grants one more attempt per parked target; a target that fails again parks again. |@@ -64,7 +64,7 @@ of making a duplicate.| <a id="writer_deactivate"></a>`writer_deactivate` blockers | `writer_not_quiesced`, `writer_admin_locked`, `writer_admin_state_changed`, `writer_lock_unavailable` | `gbrain sources writer deactivate` found pending work (a queued, running or recovering write, a topology change or effect that is not settled, a held connector item, or a live connector or maintenance lease), the writer admin lock, a changed admin state, or a local process holding a worktree lock. Nothing changed. The suggestion names each blocker and its exit. | Run `gbrain sources writer deactivate --dry-run` for the full list, run each named exit (`gbrain cancel-write-request <request_id>`, `gbrain sync --source <id> --no-pull --retry-failed`, `gbrain repair embedding-effects --source <id>`, `gbrain sources writer retry-effects <source> --request-id <id> --dry-run`, `gbrain sources writer unlock`, `gbrain sources retry-held <id>`), then deactivate again with a fresh `--expected-state` from `gbrain sources writer status --json`. See the [deactivate runbook](../architecture/topologies.md#deactivate-runbook). || <a id="extract-timeline-refused"></a>timeline extract refused | the printed code, usually `writer_coordinator_required` | `gbrain extract timeline --source db` (or a timeline-only `gbrain extract timeline` on a managed brain) could not write a page's timeline rows. It prints `refused: <code>; nothing written; existing timeline rows are untouched` per page, a summary of written versus refused, and exits 1. The rows import already stored for each page stay as they were. | `gbrain extract --stale` (add `--source-id <id>` when you scoped the run) publishes links and missing timeline rows on the managed path. If it refuses too, follow the row for the printed code. || unknown option (repair) | `invalid_params` | `gbrain repair` refuses any option it does not list, so a mistyped flag or `--max-usd` never runs a repair silently without it. | Fix the option (`gbrain repair --help`). To cap paid repair work, preview with `gbrain doctor --remediation-plan --json` and, after the user agrees, run `gbrain doctor --remediate --yes --include-repairs --expect <plan_hash> --max-usd <n>`. |-| <a id="colon_slug_windows_write_through"></a>`colon_slug_windows_write_through` | `colon_slug_windows_write_through` | A page slug such as `calendar:abc` is valid, but its canonical file name would contain `:`, which Windows cannot store (it names an alternate data stream). On Windows, a write that would publish that file is refused before admission, and `gbrain sync` skips each such file with this reason instead of failing the run. Database-only writes of the same slug (no repo configured, `sync.write_through` off, an unbound source, or a [read-only mirror](multi-source-brains.md#read-only-mirror-sources) source and pages created while it was one) still succeed, and macOS and Linux are unchanged. | Use a slug without `:` (the suggestion names one), or write the page from a macOS or Linux host that owns the source. For a skipped sync file, rename it without `:` on a macOS or Linux checkout, commit, then run `gbrain sync --source <source> --no-pull` on the Windows host. |+| <a id="colon_slug_windows_write_through"></a>`colon_slug_windows_write_through` | `colon_slug_windows_write_through` | A page slug such as `calendar:abc` is valid, but its canonical file name would contain `:`, which Windows cannot store (it names an alternate data stream). On Windows, a write that would publish that file is refused before admission, and `gbrain sync` skips each such file with this reason instead of failing the run. Database-only writes of the same slug (no repo configured, `sync.write_through` off, an unbound source, or a [read-only mirror](multi-source-brains.md#read-only-mirror-sources) source and pages created while it was one) still succeed, and macOS and Linux are not affected. | Use a slug without `:` (the suggestion names one), or write the page from a macOS or Linux host that owns the source. For a skipped sync file, rename it without `:` on a macOS or Linux checkout, commit, then run `gbrain sync --source <source> --no-pull` on the Windows host. || <a id="embedding_auth_failed"></a>`embedding_auth_failed` | `embedding_auth_failed` | The embedding provider rejected the configured key (HTTP 401 or 403). Printed once per process on stderr, naming the key source in effect: an environment variable (for example `OPENAI_API_KEY`, which wins over the config key) or the config key in `~/.gbrain/config.json`. No key or part of one is printed. | Environment key in effect but the config key is right: remove the variable from the environment of the process that reported it (shell profile, `~/.gbrain/.env`, or a daemon's service definition) and restart that process. Environment key intended: replace it with a valid key, restart, and run `gbrain config unset openai_api_key` (or the matching key). Config key in effect: `gbrain config set openai_api_key <valid key>`. Then `gbrain embed --stale` embeds what was saved meanwhile. `gbrain doctor` (`embedding_key_source`) shows the key source in doctor's own environment. || <a id="managed_pull_skipped"></a>`managed_pull_skipped` (cycle warn); doctor `sync_freshness` "upstream unknown" or "upstream N commit(s) ahead" | `managed_pull_skipped` | A managed brain never runs `git pull` inside a cycle: Git pull needs an explicit drained maintenance window, so an explicit `gbrain sync` without `--no-pull` is refused with `writer_coordinator_required`. An unattended cycle asked to pull (autopilot passes `pull: true`, `gbrain dream --pull`) instead syncs the checkout as it is and reports it: the sync phase result carries `details.upstream_refresh` (`pulled`, `failed`, `skipped_managed` or `not_requested`), and when the checkout tracks an upstream the phase is `warn` with `details.warning` (`code`, `cause`, `fix`, `docs`). Every sync also records the checkout's last upstream observation (the upstream commit, when it was last fetched or pushed, and how many upstream commits the synced commit lacks) in the source row. Doctor `sync_freshness` reports that separately from the local projection: a source with a `remote_url` whose observation is missing or older than 24 hours is "upstream unknown", and any source whose observation saw upstream commits it has not synced is "behind"; neither is reported fresh. `details.upstream_unknown_count` and `details.upstream_behind_count` count them. | `gbrain sources refresh <source>` (the printed `fix` fills in the source). It drains writes to the source's checkout, fast-forwards it to its upstream and runs the managed sync for every source bound to that checkout; see [worktree refresh refusals](#worktree-refresh-refusals) for what it can refuse. On a brain that is not managed, `gbrain sync --source <source>` pulls and records the observation. || <a id="facts_absorb_write_refused"></a>`facts_absorb_write_refused (<code>)`; `ingest_log` `write_refused: <code> …` | `facts_absorb_write_refused` | A durable `facts-absorb` job extracted facts but the write path refused to store them, for example `writer_coordinator_required` because the entity's Markdown file sits in a claimed canonical worktree before `sources writer activate`, or `permission_denied`, `invalid_params` or `writer_registration_required`. These refusals do not change on retry, so the job goes straight to `dead` on its first attempt instead of re-running inference; on a brain that is not yet activated, a job whose source root is a claimed worktree is refused before extraction starts, so it makes no model call; the `facts:absorb` row in `ingest_log` (and doctor `facts_extraction_health`) records `write_refused` with the real code, not a provider failure. The source page itself was already saved. | Fix the named cause first: `gbrain sources writer status <source>`, then finish the [claim and activate runbook](../architecture/topologies.md#claim-and-activate-runbook) for a claimed worktree, or fix the grant. Then `gbrain jobs retry <job id>` (the error names the id). |@@ -98,7 +98,7 @@ a receipt can report has a row here.| `writer_registration_required` | `writer_registration_required` | The source needs an active canonical owner before this operation, for example activation. | Claim the source on its owner host (`gbrain sources writer status <source>` names the next step). || `writer_identity_invalid` | `writer_identity_invalid` | This host's local writer identity file is unreadable or has an unknown format. | Run `gbrain doctor` on the host; it names the identity file to repair. || `writer_not_initialized` | `writer_not_initialized` | The brain has no persistence identity yet, usually because migrations have not run. | Run `gbrain apply-migrations --yes` on the brain host. |-| <a id="managed-guard-page-children"></a>`writer_coordinator_required: canonical writer must use the persistence coordinator` on a tag, timeline or take write; on the client `storage_error: Publication failed (P0001)` | `writer_coordinator_required` (`storage_error` on the stored receipt) | Before v0.60.38.0, on a managed brain whose `tags`, `timeline_entries` or `takes` table had a `source_id` column gbrain does not create, the managed writer guard refused every insert and update of those rows, including coordinated ones (#5983). From v0.60.38.0 those rows always take their source from their page and the column is ignored. An uncoordinated delete of such a row on a live page is now refused there too, as on every other brain. | Upgrade to v0.60.38.0 or later on the brain host, then follow its recovery steps in the [CHANGELOG](../../CHANGELOG.md) (or [repair](repair.md#recover-after-upgrading-to-this-release)): `gbrain sync … --no-pull --retry-failed`, `gbrain extract --stale`, `gbrain extract timeline --source db`, a previewed `gbrain facts relink`, then `gbrain repair failed-writes` (preview, then `--apply --expect <hash>`) for the refused `put_page`, `add_timeline_entry` and `remember` calls; see [failed writes](repair.md#failed-writes). |+| <a id="managed-guard-page-children"></a>`writer_coordinator_required: canonical writer must use the persistence coordinator` on a tag, timeline or take write; on the client `storage_error: Publication failed (P0001)` | `writer_coordinator_required` (`storage_error` on the stored receipt) | On a managed brain whose `tags`, `timeline_entries` or `takes` table has a `source_id` column gbrain does not create, the managed writer guard of a gbrain older than v0.60.38.0 refuses every insert and update of those rows, including coordinated ones. gbrain v0.60.38.0 and later take those rows' source from their page and ignore the column; an uncoordinated delete of such a row on a live page is refused, as on every other brain. | Upgrade to v0.60.38.0 or later on the brain host, then follow its recovery steps in the [CHANGELOG](../../CHANGELOG.md#060380---2026-10-03) (or [repair](repair.md#recover-after-an-upgrade)): `gbrain sync … --no-pull --retry-failed`, `gbrain extract --stale`, `gbrain extract timeline --source db`, a previewed `gbrain facts relink`, then `gbrain repair failed-writes` (preview, then `--apply --expect <hash>`) for the refused `put_page`, `add_timeline_entry` and `remember` calls; see [failed writes](repair.md#failed-writes). || `writer_coordinator_required` | `writer_coordinator_required` | The operation needs managed persistence (the write coordinator) and this brain or call path does not use it. A file write refused because the path sits in a managed canonical worktree names that worktree in the message, and its `detail` reads `root=<directory> source=<id or unknown> evidence=<marker file, managed-root registry or source binding>`. | Run the operation through the command the message names, on a managed brain. When the brain is not managed and the evidence is an ownership file (`.gbrain-owner.json`, `.gbrain-owner-<hash>.json`, `.gbrain-managed`), check it with `gbrain sources writer status` before removing anything: a half-finished claim is finished or rolled back through writer administration. || `fact_already_expired` | `fact_already_expired` | The fact the write targets is already expired or withdrawn. | Nothing to do; list active facts to find the current one. || `source_writeback_required` | `source_writeback_required` | The write needs a correction to the source's repository files, and this caller or profile never writes them. | Make the correction in the source repository, then sync. |@@ -117,7 +117,7 @@ recovery-byte limits can refuse writes without that warning.Some content refuses deterministically: the same bytes refuse on every retry.On a write (`put_page`, `capture`, `gbrain import`) the call fails with the codebelow and nothing is written. During `gbrain sync` the file is **held**-instead (#5988): the rest of the source imports, the checkpoint advances, and+instead: the rest of the source imports, the checkpoint advances, andthe hold is reported by the sync result (`held`, `held_count`,`holds_outstanding`), `gbrain sources status <source>`, doctor`git_held_files`, `get_page` (`file_held`) and search (`stale` hits and the@@ -148,11 +148,11 @@ with each file and fix the ones that need no guessing."*| <a id="sync_parser_regression"></a>`sync_parser_regression` | Sync stopped without advancing because it would hold a file whose exact bytes imported before (default `sync.parser_regression=stop`). This is a gbrain bug, not a content problem. | Report it with the gbrain version, the file and the code; upgrade or pin the last good version, then `gbrain sync --source <source> --no-pull --retry-failed`. To keep syncing meanwhile, `gbrain config set sync.parser_regression hold` (ask the user). || <a id="changed_since_preview"></a>`changed_since_preview` | A `gbrain repair frontmatter --apply` found a file, its proposed change or its page different from what the preview showed, so that file was not written. | Preview again, show the user the new diff and approve its new hash. |-A source blocked by one of these refusals before this release recovers on its-next sync (scheduled or manual) with no ledger surgery: the blocked request is+A source that a gbrain older than v0.60.47.0 blocked on one of these refusals+recovers on its next sync (scheduled or manual) with no ledger surgery: the blocked request isconverted in place and reported as `converted_from_failed`. To do it now run`gbrain sync --source <source> --no-pull`. `gbrain config set sync.holds fail`-restores fail-closed blocking for teams that want it. Escalation:+makes sync fail closed for teams that want it. Escalation:more than `sync.hold_escalate_count` (default 50) holds in a source, or morethan `sync.hold_escalate_pct` (default 5%) of a run's screened imports (atleast 40), sets `holds_escalated` and makes doctor `git_held_files` fail: a@@ -249,8 +249,8 @@ The opt-in never applies to a page that came from a canonical file (it has astored source path). An edit there could be lost on the owner's next sync, soit keeps refusing with only the bind option. `revert_version` is also judged onthe version it writes: reverting to a version recorded while the page had a-canonical file refuses the same way (versions taken before this release did not-record it and count as file-less).+canonical file refuses the same way (a version an older gbrain recorded+without that information counts as file-less).If the source is bound after a database-only write was accepted but before itwas published, the write fails with the same reason and nothing is written;@@ -306,8 +306,8 @@ and evidence delivery cuts `window`, `section` and `page` text from the samecopy. A chunk from the middle of a long key, with neither its `BEGIN` norits `END` line, therefore carries the token instead of key lines, and keymaterial never reaches the embedding provider. The stored page is unchanged.-Pages indexed before v0.60.31.0 that contain a `BEGIN` or `END … PRIVATE-KEY` line are withheld from search until the upgrade re-chunks them, without+Pages indexed by a gbrain older than v0.60.31.0 that contain a `BEGIN` or+`END … PRIVATE KEY` line are withheld from search until the upgrade re-chunks them, withoutprovider calls; `gbrain doctor` reports them as `credential_projection_pending`until then, and `gbrain embed --stale` embeds the new chunks when you chooseto. Key material with no `BEGIN` or `END` line anywhere on the page, and keys@@ -342,10 +342,9 @@ Each finding carries:- **fingerprint**: `sha256:` plus the first 16 hex characters of thevalue's hash. It identifies the value without revealing it.-- **rule ... since**: the gbrain version that added or changed the rule,- shown for rules this release added or changed (`url_credentials`,- `basic_auth`, `digitalocean` and private keys whose `BEGIN` or `END` line- is missing). A push that worked before an upgrade and fails after it names+- **rule ... since**: the gbrain version that added or changed the rule+ (v0.60.31.0 for `url_credentials`, `basic_auth`, `digitalocean` and+ private keys whose `BEGIN` or `END` line is missing). A push that worked before an upgrade and fails after it namesthe version here.- **allow this finding**: the exact command that appends the fingerprint tothe `.gbrain-scan-allow` file at the repository root. The path is absolute@@ -379,11 +378,11 @@ matches, including credentials added later.### A stale allowlist entry for a private key-Before v0.60.31.0, a private key whose `END` line was missing (a cut-off-excerpt) was matched by its `BEGIN` line alone, and its fingerprint covered-only that line. The fingerprint now covers the key body too, so an old entry-for such a key no longer matches and the push is refused again. The refusal-says so and gives the replacement:+The fingerprint of a private key whose `END` line is missing (a cut-off+excerpt) covers the key body as well as its `BEGIN` line. gbrain older than+v0.60.31.0 fingerprinted the `BEGIN` line alone, so an allowlist entry+written then does not match and the push is refused. The refusal says so and+gives the replacement:```textstale allowlist entry: sha256:<old> matched only this key's BEGIN header before gbrain v0.60.31.0; the fingerprint now covers the key body.diff --git a/docs/mcp/ADMIN.md b/docs/mcp/ADMIN.mdindex 51c2a968c0..6a3d8fb68f 100644--- a/docs/mcp/ADMIN.md+++ b/docs/mcp/ADMIN.md@@ -363,7 +363,7 @@ Who can read it:version only for the local CLI and `admin` holders. A `read` or `write` grantgets the same version rows without any attribution field.-Rows written before this release start `unrecorded`. Fill the ones the write+Rows written before v0.60.37.0 read `unrecorded`. Fill the ones the writejournal proves exactly, after you agree; it is free and changes no content:```bash@@ -428,8 +428,8 @@ promise erasure of historical logs/backups. Revoking a client cannot undo anexternal operation already running. Removing a client configuration alone doesnot revoke server access.-Previously accepted jobs continue under their existing grant checks after-token invalidation. Revocation or deletion denies those jobs at their next+Jobs accepted before token invalidation continue under their existing grant+checks. Revocation or deletion denies those jobs at their nextauthority check; external work already admitted may complete. All three actionsretain request history, audit records, spending reservations, and settlement.diff --git a/docs/mcp/CLAUDE_CODE.md b/docs/mcp/CLAUDE_CODE.mdindex 97db95cad4..4ced7b0048 100644--- a/docs/mcp/CLAUDE_CODE.md+++ b/docs/mcp/CLAUDE_CODE.md@@ -182,8 +182,7 @@ sub-second, world-visibility by default, and available on `--surface verbs`.window's standing entities so that rehydration pack is warm) into`.claude/settings.local.json`. Nothing to call; `GBRAIN_HOOKS=0` disablesevery hook event, including capture. Session start never shows another- session's activity: the `Last session activity` line older releases printed- was removed in v0.60.28.0 (#5558), with deliberately no opt-in to restore it.+ session's activity, and no setting turns that on.- **Manual (any brain, incl. remote/Postgres):** call the verbs yourself atboundaries — `context_pack(entities, budget_tokens)` at session start /after compaction, `delta(session_id, budget_tokens)` on wakes. Seediff --git a/docs/mcp/DEPLOY.md b/docs/mcp/DEPLOY.mdindex 60c56c9000..a9f1ffa211 100644--- a/docs/mcp/DEPLOY.md+++ b/docs/mcp/DEPLOY.md@@ -734,8 +734,8 @@ are in [CHATGPT.md](CHATGPT.md#troubleshooting).**A claude.ai connector can search but not save**The `/mcp` challenge hints `read write`, and each token is capped to the-client's registered scope. A connector approved before v0.60.5.0 was-approved with the old `read` hint and keeps a read-only grant. Remove and+client's registered scope. A connector approved before v0.60.5.0 received a+`read`-only hint and keeps a read-only grant. Remove andre-add the connector, and approve `write` on the consent screen. If theclient is registered with `read` only, widen it first([ADMIN.md](ADMIN.md#inspect-clients-and-edit-access)).diff --git a/docs/mcp/README.md b/docs/mcp/README.mdindex 39232e59b2..57f2e1f2fa 100644--- a/docs/mcp/README.md+++ b/docs/mcp/README.md@@ -64,8 +64,8 @@ not proof the user has no notes). Full contract, including the scope-failure`search` and `query` return their rows as compact JSON in the first contentblock. Remote callers get **lean rows** by default: the fields an agent acts-on, without the ranking diagnostics that made each row several times longer-than its evidence text.+on, without the ranking diagnostics that would make each row several times+longer than its evidence text.A lean row keeps `id` (the `fetch` key), `slug`, `title`, `type`,`chunk_text`, `score`, `effective_date`, `source_id`, `chunk_id` (with@@ -98,8 +98,8 @@ graph signals, the full `delivered` object):| Client | Rows by default | How to get full rows || --- | --- | --- || Any MCP client (stdio or HTTP) | lean | `fields: "full"` per call, or the host sets `gbrain config set mcp.result_rows full` |-| gbrain thin CLI, this release or later | full (it sends `X-Gbrain-Client`) | nothing to do |-| gbrain thin CLI, older release | lean | upgrade the CLI, or the host sets `mcp.result_rows full` |+| gbrain thin CLI, v0.60.44.0 or later | full (it sends `X-Gbrain-Client`) | nothing to do |+| gbrain thin CLI, older than v0.60.44.0 | lean | upgrade the CLI, or the host sets `mcp.result_rows full` || Trusted local CLI (`gbrain search`, `gbrain call`) | full | nothing to do |The host setting is read per request over OAuth HTTP and at start-up fordiff --git a/docs/mcp/TOOL_REFERENCE.md b/docs/mcp/TOOL_REFERENCE.mdindex 10ed2e610c..c1d27c396c 100644--- a/docs/mcp/TOOL_REFERENCE.md+++ b/docs/mcp/TOOL_REFERENCE.md@@ -156,16 +156,16 @@ Get recent ingestion log entries## `get_page`-Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns). `file_held` means sync holds this page's newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its `fix`).+Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (restorable until the purge cutoff, 72h by default, when the autopilot purge phase or `gbrain pages purge-deleted` hard-deletes them). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns). `file_held` means sync holds this page's newer file: you are reading the last good revision, and put_page refuses until the file is repaired (follow its `fix`).| Parameter | Type | Guidance || --- | --- | --- || `slug` (required) | string | Page slug || `fuzzy` | boolean | Enable fuzzy slug resolution (default: false) |-| `include_content` | boolean | #2225: include the canonical serialized `content` field (frontmatter + body + timeline sentinel) for lossless get→edit→put_page round-trips. Default false — it roughly duplicates compiled_truth + timeline, so read-only callers should not pay for it. |-| `include_deleted` | boolean | v0.26.5: surface soft-deleted pages with deleted_at populated (default: false). Used by restore workflows. |-| `include_timeline_entries` | boolean | #5709: also return `timeline_entries`, the page's timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small. |-| `source_id` | string | #4329: scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers. |+| `include_content` | boolean | Include the canonical serialized `content` field (frontmatter + body + timeline sentinel) for lossless get→edit→put_page round-trips. Default false — it roughly duplicates compiled_truth + timeline, so read-only callers should not pay for it. |+| `include_deleted` | boolean | Surface soft-deleted pages with deleted_at populated (default: false). Used by restore workflows. |+| `include_timeline_entries` | boolean | Also return `timeline_entries`, the page's timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small. |+| `source_id` | string | Scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers. |## `get_recent_salience`@@ -176,7 +176,7 @@ Returns readable pages recently touched and ranked by activity salience and rece| `days` | number | Window in days. Default 14. || `limit` | number | Max results (default 20, capped at 100). || `slugPrefix` | string | Optional slug-prefix filter, e.g. 'personal' or 'wiki/people'. |-| `recency_bias` | string (`flat`, `on`) | v0.29.1: how to weight recency in the salience score.<br> 'flat' (DEFAULT) — v0.29.0 behavior. Every page gets 1/(1+days_old).<br> Stable, predictable; what most callers want.<br> 'on' — Per-prefix decay map. concepts/originals/writing/<br> become evergreen (recency component = 0); daily/,<br> media/x/, chat/ decay aggressively. Use when the<br> user explicitly biases for recency-aware salience<br> ('what's been salient lately' vs 'what matters<br> in this brain regardless of when'). |+| `recency_bias` | string (`flat`, `on`) | How to weight recency in the salience score.<br> 'flat' (DEFAULT) — every page gets 1/(1+days_old).<br> Stable, predictable; what most callers want.<br> 'on' — Per-prefix decay map. concepts/originals/writing/<br> become evergreen (recency component = 0); daily/,<br> media/x/, chat/ decay aggressively. Use when the<br> user explicitly biases for recency-aware salience<br> ('what's been salient lately' vs 'what matters<br> in this brain regardless of when'). |## `get_skill`@@ -233,12 +233,12 @@ List pages with optional filters. For 'what's recent / what did I touch this wee| `type` | string | Filter by page type || `tag` | string | Filter by tag || `limit` | number | Max results (default 50; remote callers are capped at 100) |-| `offset` | number | Skip first N rows (pagination). Engine-supported since PageFilters gained offset; previously accepted at the CLI and silently dropped. |+| `offset` | number | Skip first N rows (pagination). || `updated_after` | string | ISO date (YYYY-MM-DD) or full timestamp. Returns pages with updated_at > value. Bare (without updated_after_slug) this is LOSSY across rows sharing one timestamp — a bulk sync stamps one now() across a transaction; pair with updated_after_slug to page exactly. || `updated_after_slug` | string | Keyset cursor slug: pass the last row's slug together with updated_after set to that row's updated_at_iso (column precision — a millisecond-rounded value re-selects same-millisecond rows). Resumes strictly after (updated_at, slug) and forces sort=updated_asc. |-| `sort` | string (`updated_desc`, `updated_asc`, `created_desc`, `slug`) | Sort order. Default updated_desc (matches pre-v0.29). Options: updated_desc, updated_asc, created_desc, slug. |-| `include_deleted` | boolean | v0.26.5: include soft-deleted pages (default: false). Used by restore workflows and operator diagnostics. |-| `source_id` | string | v0.46.25: scope listing to a single source. Defaults to OperationContext.sourceId / federated scope. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. |+| `sort` | string (`updated_desc`, `updated_asc`, `created_desc`, `slug`) | Sort order. Default updated_desc. Options: updated_desc, updated_asc, created_desc, slug. |+| `include_deleted` | boolean | Include soft-deleted pages (default: false). Used by restore workflows and operator diagnostics. |+| `source_id` | string | Scope listing to a single source. Defaults to OperationContext.sourceId / federated scope. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. |## `list_skills`@@ -291,7 +291,7 @@ Hybrid search with vector + keyword + multi-query expansion. Prefer `query` for| `limit` | number | Max results. Omitted or 0 resolves from the active search mode (10 conservative / 25 balanced / 50 tokenmax by default, or the configured `search.searchLimit` override) — for both text queries and image-similarity queries (`image` param). || `offset` | number | Skip first N results (for pagination) || `types` | array | Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters. |-| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800) |+| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. || `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').<br> 'chunk' — the ranked chunk only (~300-450 tokens per result).<br> 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).<br> 'section' — the enclosing markdown section, or the conversation rounds around the hit.<br> 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.<br> 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.<br>Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta. || `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). || `token_budget` | number | Token budget. Chunk mode, and whenever return_unit is omitted: caps the cumulative chunk payload (results that would overflow are skipped). Explicit non-chunk return_unit: the budget for delivered evidence (default search.return_budget_default = 6000, auto 24000; remote max search.return_budget_max_remote = 32000). |@@ -302,16 +302,16 @@ Hybrid search with vector + keyword + multi-query expansion. Prefer `query` for| `symbol_kind` | string | Filter to chunks where content_chunks.symbol_type matches (e.g., function, class, method, type, interface) || `near_symbol` | string | Anchor retrieval at this qualified symbol name (e.g., BrainEngine.searchKeyword). Enables A2 two-pass. || `walk_depth` | number | Structural walk depth 1-2. Default 0 (off). Expands anchors through code_edges with 1/(1+hop) decay. |-| `salience` | string (`off`, `on`, `strong`) | v0.29.1 salience boost — emotional_weight + take_count, NO time component.<br> 'off' — default for entity / canonical / definitional queries<br> 'on' — surface emotionally-weighted + take-rich pages<br> 'strong' — aggressive mattering tilt<br>Omit and gbrain auto-detects from query text. Independent of `recency`. |-| `recency` | string (`off`, `on`, `strong`) | v0.29.1 recency boost — per-prefix age decay, NO mattering signal.<br> 'off' — default for canonical truth<br> 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen<br> 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')<br>Omit and gbrain auto-detects. Independent of `salience` (orthogonal axes). |-| `since` | string | v0.29.1 — filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). Replaces deprecated `afterDate`. |-| `until` | string | v0.29.1 — filter to effective_date <= this. Same format as `since`. Replaces deprecated `beforeDate`. YYYY-MM-DD lands at end-of-day. |-| `source_id` | string | v0.34: scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio. |-| `cross_modal` | string (`text`, `image`, `both`, `auto`) | v0.36 cross-modal search routing.<br> 'text' (default for non-image-intent queries) — text-only path, no behavior change vs v0.35.<br> 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.<br> 'both' — run text AND image searches in parallel; merge via weighted RRF.<br> 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing. |-| `embedding_column` | string | v0.36: route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns. |-| `adaptive_return` | boolean | v0.41.33 — return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:<br> TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.<br> Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.<br>Safe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap. |-| `autocut` | boolean | v0.42.3.0 — autocut is the SMART DEFAULT (already ON when the reranker runs, which it does in the default search mode). It returns only the confident cluster by cutting where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful — not a fixed wall of 20+.<br> You almost never set this. Pass FALSE only to FORCE the full top-K when you deliberately want breadth — broad exploration, 'show me everything about X', enumeration where you'd rather over-collect and judge for yourself, or when you suspect the top hit is wrong and want to see the alternatives.<br> TRUE is redundant in default mode (it's already on); it only matters to override a brain whose config turned autocut off.<br>Safe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the smart default. |-| `relational` | boolean | v0.43 — relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this. |+| `salience` | string (`off`, `on`, `strong`) | Salience boost — emotional_weight + take_count, NO time component.<br> 'off' — default for entity / canonical / definitional queries<br> 'on' — surface emotionally-weighted + take-rich pages<br> 'strong' — aggressive mattering tilt<br>Omit and gbrain auto-detects from query text. Independent of `recency`. |+| `recency` | string (`off`, `on`, `strong`) | Recency boost — per-prefix age decay, NO mattering signal.<br> 'off' — default for canonical truth<br> 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen<br> 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')<br>Omit and gbrain auto-detects. Independent of `salience` (orthogonal axes). |+| `since` | string | Filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). |+| `until` | string | Filter to effective_date <= this. Same format as `since`. YYYY-MM-DD lands at end-of-day. |+| `source_id` | string | Scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio. |+| `cross_modal` | string (`text`, `image`, `both`, `auto`) | Cross-modal search routing.<br> 'text' (default for non-image-intent queries) — text-only path.<br> 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.<br> 'both' — run text AND image searches in parallel; merge via weighted RRF.<br> 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing. |+| `embedding_column` | string | Route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns. |+| `adaptive_return` | boolean | Return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:<br> TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.<br> Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.<br>Safe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap. |+| `autocut` | boolean | Cut the ranked results where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful, not a fixed wall of 20+. Off by default in every search mode; a brain can turn it on with `gbrain config set search.autocut true`.<br> Pass TRUE for a tight, confident set on one call. Pass FALSE to force the full top-K on a brain whose config turned autocut on, when you deliberately want breadth: broad exploration, 'show me everything about X', enumeration, or when you suspect the top hit is wrong.<br>Safe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the brain's configured default. |+| `relational` | boolean | Relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this. |## `recall`@@ -322,7 +322,7 @@ MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filt| `entity` | string | Entity slug (canonical). Returns facts about this entity newest first, each labelled with its source_id. Across several granted sources, same-slug entities that no entity-identity group links are different entities: facts comes back empty and ambiguous_entity names each (source_id, entity_slug); pass source_id to read one. || `query` | string | MEMORY_VERBS v1: free-text retrieval over pages (hybrid search arm). Response adds results[] (slug, title, chunk, evidence, create_safety, provenance). Combinable with entity (both arms run). Degrades to keyword-only search when no embedding provider is configured (search_degraded notes it; never an error). || `budget_tokens` | number | MEMORY_VERBS v1: server-side token budget (char/4 estimate). Facts pack first, then results. Response adds budget_tokens, budget_used, dropped_count. |-| `budget_policy` | string (`facts_first`, `query_first`) | Optional packing order. facts_first preserves legacy behavior (default). query_first packs the ranked page prefix before facts only with a nonblank query and positive finite budget; a positive budget below one token keeps neither arm. No query or inactive budget preserves legacy behavior. Neither policy skips oversized items or truncates. Supplying this option adds budget_packing accounting. Keep fact-focused/entity-filtered questions on facts_first. |+| `budget_policy` | string (`facts_first`, `query_first`) | Optional packing order. facts_first (default) packs facts first, then page results. query_first packs the ranked page prefix before facts only with a nonblank query and positive finite budget; a positive budget below one token keeps neither arm. Without a nonblank query and an active budget, packing stays facts_first. Neither policy skips oversized items or truncates. Supplying this option adds budget_packing accounting. Keep fact-focused/entity-filtered questions on facts_first. || `source_id` | string | Optional concrete source id for both facts and page results. Narrows the caller’s authorized scope, including an explicit default; a denied, missing, or archived source fails rather than widening. Omit to preserve the existing context/grant scope. || `since` | string | ISO 8601 datetime or duration shorthand (e.g. "8 hours ago"). Filters the FACTS arm only, on event time (valid_from, falling back to created_at); composes with `entity` and `session_id`. An unparseable value is rejected (invalid_params). || `session_id` | string | Source session id (e.g. topic-A). Returns facts captured in that session. |@@ -330,7 +330,7 @@ MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filt| `supersessions` | boolean | When true, return only the supersession audit log (facts with superseded_by set), newest first by COALESCE(expired_at, valid_until). || `limit` | number | Per-arm cap: max fact rows AND max search results. Default 50, cap 100. || `grep` | string | Substring filter on fact text (case-insensitive). Applied in SQL before the limit, so matches on high-cardinality entities are found even outside the newest-N window. |-| `include_pending` | boolean | v0.32: when true, response includes pending_consolidation_count (facts not yet promoted to takes by the dream-cycle consolidate phase). One round trip; backward-compatible (field omitted when false). |+| `include_pending` | boolean | When true, response includes pending_consolidation_count (facts not yet promoted to takes by the dream-cycle consolidate phase). One round trip; backward-compatible (field omitted when false). || `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit for the results[] arm (needs `query`; default config search.return_unit = 'auto'). 'window' adds neighbor chunks, 'section' the enclosing section or conversation rounds, 'page' the whole page/session (best for multi-session questions), 'auto' the whole page for conversation pages and the ranked chunk unchanged for everything else (budget_tokens or budget_policy without return_unit keeps chunk packing). Non-chunk units return one result per page with `delivered` metadata and a top-level `delivery` block; the evidence is budgeted by budget_tokens (default 6000, auto 24000) and then packed by recall's usual rules. || `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). |@@ -358,7 +358,7 @@ Discover this brain's tool catalog and optionally unlock a wider tool surface fo| Parameter | Type | Guidance || --- | --- | --- |-| `tools` | array | Fetch full read-only tool schemas for these names. Names outside your visible surface are silently omitted (D5). |+| `tools` | array | Fetch full read-only tool schemas for these names. Names outside your visible surface are silently omitted. || `surface` | string (`verbs`, `starter`, `full`) | Persist this tool surface for your client. Must not exceed the server ceiling; ignored surfaces stay available via no-arg discovery. Takes effect on your next tools/list. |## `resolve_slugs`@@ -382,7 +382,7 @@ Cheap hybrid search (vector + keyword + RRF) with no LLM expansion. Best for exa| `mode` | string | Search mode (conservative\|balanced\|tokenmax). Local callers only. || `source_id` | string | Scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile); when unset, an unqualified read spans every federated source. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. || `types` | array | Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters. |-| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800) |+| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. || `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').<br> 'chunk' — the ranked chunk only (~300-450 tokens per result).<br> 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).<br> 'section' — the enclosing markdown section, or the conversation rounds around the hit.<br> 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.<br> 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.<br>Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta. || `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). || `token_budget` | number | Token budget for delivered evidence when return_unit is not 'chunk' (default search.return_budget_default = 6000; auto: search.return_budget_conversation = 24000). Ignored in chunk mode. |@@ -414,18 +414,18 @@ Submit an LLM agent job that the worker dispatches via the gateway-native tool l## `traverse_graph`-Traverse link graph from a page. Remote callers default to bidirectional edges (GraphPath[]) at depth 2 (pass depth explicitly for deeper walks); trusted local no-filter callers keep the legacy node shape at depth 5.+Traverse link graph from a page. Remote callers default to bidirectional edges (GraphPath[]) at depth 2 (pass depth explicitly for deeper walks); trusted local no-filter callers get the legacy node shape at depth 5.| Parameter | Type | Guidance || --- | --- | --- || `slug` (required) | string | Slug of the page to start the traversal from, e.g. 'people/alice-example'. This is the start-node param — there is no `start` or `root` param. || `depth` | number | Max traversal depth (capped at 10). Default 5, except a remote call that lets direction default to 'both' uses 2 (bidirectional path enumeration is combinatorial on hubs); an explicit depth is always honored up to the cap. || `link_type` | string | Filter to one link type (per-edge filter, traversal only follows matching edges) |-| `direction` | string (`in`, `out`, `both`) | Traversal direction ('in', 'out', or 'both'). Remote callers default to 'both'; trusted local no-filter callers keep the legacy outgoing-node output. |+| `direction` | string (`in`, `out`, `both`) | Traversal direction ('in', 'out', or 'both'). Remote callers default to 'both'; trusted local no-filter callers get the legacy outgoing-node output. || `source_id` | string | Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers. || `all_sources` | boolean | Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely. |## `whoami`-Introspect the calling identity. Returns one of three transport shapes: {transport: "oauth", client_id, client_name, scopes, expires_at, source_id, federated_read}, {transport: "legacy", token_name, scopes, expires_at: null}, or {transport: "local", scopes: []}, or {transport: "stdio", scopes: []} for the auth-less stdio MCP pipe. Throws unknown_transport when the context is ambiguous (remote=true without auth and no transport marker) — fail-closed posture mirroring the v0.26.9 trust-boundary contract.+Introspect the calling identity. Returns one of three transport shapes: {transport: "oauth", client_id, client_name, scopes, expires_at, source_id, federated_read}, {transport: "legacy", token_name, scopes, expires_at: null}, or {transport: "local", scopes: []}, or {transport: "stdio", scopes: []} for the auth-less stdio MCP pipe. Throws unknown_transport when the context is ambiguous (remote=true without auth and no transport marker) — fail-closed, per the trust-boundary contract.diff --git a/docs/operations/backfill-pacing.md b/docs/operations/backfill-pacing.mdindex d5e0a4c702..c592f61440 100644--- a/docs/operations/backfill-pacing.md+++ b/docs/operations/backfill-pacing.md@@ -1,4 +1,4 @@-# Sync resumability + lock tuning (v0.42.x, #1794)+# Sync resumability + lock tuning`gbrain sync` is resumable and converges under pool exhaustion + repeated kills.Progress banks into the append-only `op_checkpoint_paths` table (one row per drained@@ -15,7 +15,7 @@ hatches — no config-dashboard surface by design):| `GBRAIN_SYNC_MAX_CHECKPOINT_FAILURES` | 3 | Consecutive failed flushes (each already retried ~12s) before the run aborts with `reason: 'checkpoint_unavailable'` instead of importing work it can never bank. || `GBRAIN_SYNC_YIELD_EVERY` | 64 | Yield the event loop (`setTimeout(0)`, NOT `setImmediate` — Bun starves the timers phase under a tight setImmediate loop) every N files so the lock-refresh `setInterval` heartbeat fires mid-import. || `GBRAIN_LOCK_STEAL_GRACE_SECONDS` | derived (~600 at 30min TTL) | A holder that refreshed within this window is NOT stolen even if its TTL lapsed (starved-but-alive). Dead holders stop refreshing, age past the grace, and become stealable; TTL stays the backstop. |-| `GBRAIN_SYNC_STALL_ABORT_SECONDS` | 900 | Progress-aware stall watchdog (#1950): if the import drain makes no forward progress (keyed on file-import progress, NOT the lock heartbeat) for N seconds, abort the run and release the per-source lock so the next `gbrain sync` resumes from the checkpoint. Reports `reason: 'stall_timeout'`. Observed BETWEEN files; a hang inside one file's import isn't interrupted until it returns (the hard deadline is that backstop). 0 disables. Also the progress window of the default hard deadline (see [Large brains](#large-brain-deadlines)); when this is 0 the window stays 900. |+| `GBRAIN_SYNC_STALL_ABORT_SECONDS` | 900 | Progress-aware stall watchdog: if the import drain makes no forward progress (keyed on file-import progress, NOT the lock heartbeat) for N seconds, abort the run and release the per-source lock so the next `gbrain sync` resumes from the checkpoint. Reports `reason: 'stall_timeout'`. Observed BETWEEN files; a hang inside one file's import isn't interrupted until it returns (the hard deadline is that backstop). 0 disables. Also the progress window of the default hard deadline (see [Large brains](#large-brain-deadlines)); when this is 0 the window stays 900. |<a id="large-brain-deadlines"></a>## Large brains: deadlines and budgets@@ -38,17 +38,16 @@ making progress, or stops loudly with the exact command to finish.A naive `gbrain embed --stale` / large `sync` can saturate a PgBouncertransaction-mode pooler and starve the minion supervisor's lock renewals-(`lock-renewal-failed` → dead jobs). Pacing is the native, composable fix — it-replaces external SIGSTOP/SIGCONT wrapper scripts. **Opt-in: default mode `off`.**+(`lock-renewal-failed` → dead jobs). Pacing is built in and composable, so no+external SIGSTOP/SIGCONT wrapper script is needed. **Opt-in: default mode `off`.**The composable primitive is `src/core/db-pacer.ts` (`createDbPacer`):- **Concurrency cap is the real lever** (caps simultaneous in-flight DB writes =pooler slots held). Embed paths set their worker count to `maxConcurrency`(single pool, no permit); `sync` uses the shared `acquire()` **permit** becauseeach parallel worker owns a separate engine (one budget must span pools).-- **In-band signal** (`observe(ms)` EWMA from the work's own queries — never- blind the way an out-of-band probe pool was). **No probe loop, no- `probeLatency` engine method.**+- **In-band signal** (`observe(ms)` EWMA from the work's own queries). There is+ no out-of-band probe pool, probe loop, or `probeLatency` engine method.- **Cooperative `pace()` sleep** on `setTimeout` (keeps the lock heartbeatfiring), jittered to avoid a thundering-herd resume. `acquire()`/`pace()` throw`AbortError` on cancel; everything else is fail-open (a pacer bug never kills a@@ -68,18 +67,18 @@ of the search-mode pattern but with **env ABOVE config** (incident escape hatch)**Surfaces.** `gbrain embed --stale --pace[=mode]` (bare `--pace` = balanced),`--pace-max-concurrency=N`. `--background` carries explicit pace OVERRIDES (notthe resolved bundle) into the `embed` job payload; the handler re-resolves-env>config>bundle at execution so `GBRAIN_PACE_*` still wins (CX5). Config-level+env>config>bundle at execution so `GBRAIN_PACE_*` still wins. Config-level`pace.mode` paces EVERY `runEmbedCore` caller (cycle embed, embed-catch-up,sync-auto-embed) and the prod `embed-backfill` job automatically. `sync` readsenv/config. PGLite / mode `off` → no-op pacer.-**Correctness fixes pacing bundles** (longer paced runs widen these): CLI+**Correctness guards for paced runs** (longer paced runs widen these races): CLI`embed --stale` single-flights via the SAME per-source lock key as the`embed-backfill` handler (`src/core/embed-backfill-lock.ts`; all-source runs lockevery source in sorted order) so a hand-run backfill and a queued job can't race-the NULL→non-NULL upsert (`TODOS:2299`); a **bounded** end-of-run keyset re-entry+the NULL→non-NULL upsert; a **bounded** end-of-run keyset re-entry(max 3 + forward-progress, paced runs only) catches rows inserted behind the-cursor (`TODOS:2301`); and the embed wall-clock budget timer is re-armed around+cursor; and the embed wall-clock budget timer is re-armed around`pace()` sleeps so paced time doesn't burn the work budget.`EmbedResult.pacing` carries the end-of-run telemetry (cap, samples, EWMA, sleptdiff --git a/docs/operations/spend-controls.md b/docs/operations/spend-controls.mdindex 5f04e30211..0e71440266 100644--- a/docs/operations/spend-controls.md+++ b/docs/operations/spend-controls.md@@ -36,7 +36,7 @@ number you typed on the command line.## Consent and caps for paid commands (agent operator contract v1)-Since v0.60.46.0 every command that spends money asks for authorization the+Every command that spends money asks for authorization thesame way ([protocol](../protocol/AGENT_OPERATOR_v1.md#consent-and-preapproval)).Without a terminal and without authorization, nothing runs: the command exits3 with a `confirmation_required` payload whose `user_message` the agent relays@@ -54,10 +54,9 @@ What authorizes paid work, and the cap it runs under:| `--yes` alone, no estimate and no configured cap | the default cap ($5), printed | `default` || `spend.posture=tokenmax` | the derived/default cap above, except `enrich` and `reindex-code` (below) | `derived` / `default` |-- **`tokenmax` on `enrich` and `reindex-code` stays uncapped.** Those two- commands already ran without a ceiling under `spend.posture=tokenmax`- before the consent wave, so the posture keeps that meaning there: an- unattended run proceeds with no ceiling (spend still ledgered). Everywhere+- **`tokenmax` on `enrich` and `reindex-code` is uncapped.** On those two+ commands `spend.posture=tokenmax` means no ceiling: an unattended run+ proceeds uncapped (spend still ledgered). Everywhereelse `tokenmax` authorizes the run under the derived cap. An explicit`--max-usd` always wins.- **A derived cap that runs out** stops the command with exit 1, a checkpoint@@ -65,7 +64,7 @@ What authorizes paid work, and the cap it runs under:check then suggests the preapproval command. Raise the cap only with theuser's agreement.- **Unpriced models** (a model gbrain has no per-token rate for, for example- one released after this version): under a derived or default cap the run+ a newly released one): under a derived or default cap the run**warns and proceeds** (`BUDGET_TRACKER_NO_PRICING` on stderr; the capcannot meter it). Under a cap the user set (`--max-usd`, a configured capor a preapproval) it **blocks** with `no_pricing` and nothing is spent: the@@ -249,9 +248,9 @@ writer's share and 7-day spend. Details: [Life Chronicle](../guides/life-chronic## Dream paid-loop breaker (`dream.breaker.max_dead_submissions`)Dream synthesize and patterns pay a model for each transcript or reflection set-they submit. When the same input keeps failing, every cycle used to pay for it-again. The breaker stops that: once one dream key has died 3 times within 24-hours, dream refuses to submit it again until you reset it. The refusal shows up+they submit. Without a limit, an input that keeps failing would be paid for+again on every cycle. The breaker stops that: once one dream key has died 3+times within 24 hours, dream refuses to submit it again until you reset it. The refusal shows upin the cycle summary and the autopilot log with the exact reset command, and`gbrain doctor` reports it as `dream_paid_loop`.diff --git a/docs/protocol/AGENT_OPERATOR_v1.md b/docs/protocol/AGENT_OPERATOR_v1.mdindex 9ceda95a81..94bf663b2f 100644--- a/docs/protocol/AGENT_OPERATOR_v1.md+++ b/docs/protocol/AGENT_OPERATOR_v1.md@@ -554,7 +554,7 @@ of an MCP `isError` result, and HTTP error bodies.| Field | Type | Meaning ||---|---|---|-| `error` | string | Legacy wire value, frozen forever under v1. Equals `code` for codes new in v1. |+| `error` | string | Legacy wire value, frozen forever under v1. Equals `code` except for the four legacy values listed under **Precedence** below. || `code` | string | Canonical registry code ([error codes](../guides/error-codes.md)). || `reason` | string? | Sub-cause where one code covers several (`embeddings_disabled`, `wired_running`, …). || `message` | string | What happened, one sentence. |@@ -572,8 +572,8 @@ Pre-existing keys keep their names and meaning: `detail`, `protocol_version`(memory verbs), `write_request` and `write_error` (write receipts).**Precedence.** Read `code`; fall back to `error` when `code` is absent (a-server older than v1). Four surfaces historically sent a different `error`-value and keep sending it; the canonical value rides `code`:+server older than v1). Four surfaces send a legacy `error` value that differs+from `code`; the canonical value rides `code`:| `error` (frozen) | `code` (canonical) ||---|---|@@ -868,8 +868,8 @@ that work in this conversation.| 130 | interrupted | ask the user whether to re-run |`gbrain mcp expose` and `gbrain google` still exit 2 when they need-confirmation (documented v1 legacy). Details and the "changed in this release"-table: [exit codes](../guides/exit-codes.md).+confirmation (documented v1 legacy). Details and the per-command exit table:+[exit codes](../guides/exit-codes.md).**`--json` documents.** A command whose `--help` documents `--json` writesexactly one JSON document to stdout (or NDJSON lines for `eval export`,@@ -969,50 +969,9 @@ Nested legacy errors keep their nesting and gain sibling `code` and `fix`.know.- Removing a legacy shape needs a written support policy and evidence aboutits consumers first. A breaking change means a new `AGENT_OPERATOR_v2`.--## Behavior changes for scripts and agents--What changed when contract v1 shipped, for scripts and agents that parsed the-old behaviour. The release's CHANGELOG entry carries the same table.--| Area | Before | Now | What to change |-| --- | --- | --- | --- |-| `gbrain embed --stale` time-budget stop | exit 3 | exit 11 (since v0.60.37.0) | treat 11 as "run `resume_command`"; 3 now only means `confirmation_required` |-| `gbrain dream --drain` with backlog left | exit 3 | exit 11, `--json` carries `resume_command` | treat 11 as a resumable stop |-| Other exit-3 sites (`agent run --follow` timeout, `providers test`, `sources harden`, `sources pull`, `sources remove/archive default`, `extract-conversation-facts`) | exit 3 | 124, 1 or 2 ([exit codes](../guides/exit-codes.md#changed-in-this-release)) | branch on the new codes |-| `migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | exit 2 ("pass `--yes`") | exit 3 with the consent payload | stop, relay `user_message`, run `fix.command` only after the user agrees |-| `pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | exit 1 | exit 3 with the consent payload | same |-| `book-mirror` paid fan-out without authorization | exit 0 ("cancelled", nothing ran) | exit 3 with the consent payload | same |-| `gbrain doctor --remediate` without a terminal | ran paid and mutating work with no `--yes` and no cap | refuses with exit 3; nothing runs. Repairs (`--include-repairs`) need `--yes --expect <plan_hash>` from `--remediation-plan --json` | relay `user_message`; pass `--yes` (derived cap) or `--max-usd <n>` only after the user agrees |-| Paid, destructive, credential, egress and install commands without a terminal | "re-run with `--yes`" text | exit 3 with `effects`, `user_message` and an `ask_user` fix | stop and ask; never add `--yes` on your own |-| `--yes` on paid work without `--max-usd` | no cap unless the command had its own default | runs under a derived cap (estimate x1.5, floor $0.25; the $5 default with no estimate), printed first; exhaustion exits 1 with a resume command | pass `--max-usd <n>` for a bigger job the user approved |-| Unpriced model (no per-token rate known) | refused whenever a cap was set | warns and runs under a derived or default cap; under a user cap refuses with a fix to look up the rate and run `gbrain pricing set` | register the rate, then retry |-| `gbrain reindex-frontmatter --json` | `--json` skipped the confirmation | `--json` never implies consent | pass the authorization the payload names |-| `gbrain jobs submit` on PGLite | queued with no worker to run it | refuses with `no_worker` unless `--follow` or `--queue-only` | add `--follow` (run it now) or `--queue-only` |-| Invalid input: `autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` | exit 1 | exit 2 (`invalid_params`) | treat 2 as "fix the command" |-| `gbrain doctor --json` with no brain configured | human text or nothing | one `no_brain` envelope with the `gbrain init` fix | parse the document |-| `gbrain serve` on a brain another serve holds, or with no brain | exited before the MCP handshake | completes the handshake in status-only mode with one `gbrain_status` tool; `--fail-fast` (or `GBRAIN_SERVE_FAIL_FAST=1`) restores the early exit for supervisors | read `gbrain_status`; supervisors pass `--fail-fast` |-| `gbrain doctor` (plain, `--only`, `--remediation-plan`, MCP `run_doctor`) with an embedding key | sent one paid embedding request on every run | no provider call; `embedding_provider` reports `configured, not probed` with a `paid`+`egress` fix (`--only embedding_provider --probe --yes`) | run the probe only after the user agrees |-| `gbrain embed`, `jobs submit embed*`, `features --auto-fix` with a billed embedding provider and no terminal | embedded without asking | exit 3 with the consent payload unless `--yes`, `--max-usd`, tokenmax or a preapproval covers it; writes that embed new content are unchanged | cron jobs that backfill on purpose pass `--yes` (or `--max-usd <n>`), or set a preapproval |-| `doctor --remediation-plan --json` steps | `command` only | each step also carries `fix` with `consent` (`paid` / `destructive`) and `next` | follow `fix.next` |-| A PGLite brain whose automatic repair failed | later commands kept opening it and wrote to `pg_wal/` | every command exits 3 with the consented `pglite-repair` until the user decides; nothing touches the data directory | relay `user_message`; never move or rebuild the brain files yourself |-| `gbrain serve` whose configured brain directory is missing (unmounted drive) or whose writer-lock file cannot be opened | exited before the MCP handshake (`internal_error`) | status-only mode: `gbrain_status` names the path (`missing_brain`, `brain_unopenable`); nothing is created at the path | relay it; the server reopens the brain once it is back |-| `gbrain transcripts recent` while `gbrain serve` holds the brain | `pglite_busy` | reads through the running serve | none |-| Error envelopes | `error`, `message`, `suggestion` | adds `code`, `fix`, `class`, `retryable`, `docs_cmd`, `contract_version`; `error` unchanged (legacy values frozen) | read `code`, fall back to `error` |-| Docs pointers in errors | repo-relative paths | absolute URLs pinned to the installed version | open the URL, or run `gbrain errors <code>` offline |-| MCP results with advice | advice in `_meta` or stderr only | extra `[gbrain notice …]` text blocks plus `_meta.gbrain_notices`; `content[0]` unchanged | parse `content[0]` alone; read the notice blocks |-| MCP error results | could carry several blocks | exactly one block; notices inside the envelope | parse the one block |-| MCP tool list on stdio | listed 10 owner-only tools that always refused there | those tools are not listed on stdio; their refusals name the CLI command | use the CLI command the refusal names |-| MCP advisor on stdio | off | on by default (read-only); remote HTTP stays opt-in | none |-| MCP `initialize` instructions | one fixed text | generated per surface (`verbs`, `starter`, `full`) from the tools that caller can call | none |-| Keyless brains (no embedding key) | doctor warned and the health score dropped | doctor reports `severity: info` with the enable command; the score is not penalized | none |-| stdin reads | could wait forever on an open, silent pipe | 30 s to the first byte, 60 s idle; `GBRAIN_STDIN_TIMEOUT_MS` overrides | close stdin or pipe the payload |-| Prompts under an agent process or `CI` | prompted whenever stdin was a terminal | decline unless `GBRAIN_INTERACTIVE=1` | answer through the consent payload instead |-| `--json` stdout for commands that declare it | could mix human text into stdout or print nothing on failure | exactly one JSON document; other output goes to stderr; a fallback document on a silent non-zero exit | parse stdout as one document |-| Fix commands (`fix.argv`, `command`, `preview_argv`, `verify.argv`, `then`) | a few named the brain and source; most ran against whatever `GBRAIN_BRAIN_ID`, `GBRAIN_SOURCE` or dotfile the shell had | every gbrain fix names `--brain <id>` (and `--source <id>` where the command routes a source), so it acts on the intended brain from any directory | run fixes exactly as given |-| `gbrain doctor --remediation-plan` on a brain with pending migrations | applied the migrations before computing the plan | never migrates; the plan carries a `migrations_pending` notice whose fix applies them | run the notice's fix, or `doctor --remediate` after consent |-| `sources harden` with no id, `migrate` without `--to`, `mcp grant` without a NAME, malformed `backup create/restore` | exit 1 (`sources harden`: `internal_error`) | exit 2, `invalid_params`, with the usage and an example | treat 2 as "fix the command" |-| `gbrain db-repair` under an ambient `GBRAIN_BRAIN_ID` pointing at a mount | refused, ignoring `--brain host` | `--brain host` repairs the host brain | none |+- Legacy values are frozen. The change table for scripts and agents written+ against gbrain v0.60.45.0 or earlier, before contract v1, is in the+ [v0.60.46.0 CHANGELOG entry](../../CHANGELOG.md#behavior-changes-for-scripts-and-agents).## Tool catalog changes (`tools/list_changed`)@@ -1023,7 +982,7 @@ swaps in the full catalog. Harness support varies by version:| Harness | Behaviour ||---|---|| Claude Code | recent versions refresh the tool list on the notification; some versions and modes have been reported to keep the old list |-| Codex | refreshes the tool list (since openai/codex#12449); its deferred tool search can stay stale |+| Codex | versions that include openai/codex#12449 refresh the tool list; its deferred tool search can stay stale || other MCP clients | not measured |If a tool the fix names is not in your tool list after a recovery, restart thediff --git a/docs/takes-vs-facts.md b/docs/takes-vs-facts.mdindex c6d3dc48b1..c44a1b90c9 100644--- a/docs/takes-vs-facts.md+++ b/docs/takes-vs-facts.md@@ -127,5 +127,5 @@ Known limitation: the owner can alsoappear under `brain` (a take the owner asserts, via `propose_takes`) and`people/<owner>` (extraction that names the owner). The resolver selects the*default* canonical owner string for reads; it does not merge those other-strings. Per-take attribution for other people (e.g. `people/george`) is+strings. Per-take attribution for other people (e.g. `people/bob-example`) isunaffected and correct.diff --git a/llms-full.txt b/llms-full.txtindex edf49a510b..57bab91e74 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -1591,7 +1591,7 @@ identity. This connection has no local database backup or `bin/gbrain-setup`helper; complete backups belong on the brain host. If the handoff was lost,recover it through the host's delivery procedure first.-Before this security migration, stop old servers and workers and take a protected backup. Start only runtimes that enforce the migrated grants. If rollout fails, disable the affected entry points and restore a compatible runtime while preserving memory and the tightened grants; do not run an older authorization implementation against the migrated database. Local installations can be released independently of hosted delegation.+Before applying the grant migration, stop old servers and workers and take a protected backup. Start only runtimes that enforce the migrated grants. If rollout fails, disable the affected entry points and restore a compatible runtime while preserving memory and the tightened grants; do not run an older authorization implementation against the migrated database. Local installations can be released independently of hosted delegation.Remove a managed configuration with the same private handoff and `gbrain connect... --remove`, or remove the native OAuth connection through its harness@@ -1674,8 +1674,8 @@ start here.and confirm their choice before continuing. Cost spread between cornersis 25x — silent acceptance is the wrong default. See[`./INSTALL_FOR_AGENTS.md`](./INSTALL_FOR_AGENTS.md) Step 3.5 for the- exact ask-the-user protocol. Same banner fires on `gbrain post-upgrade`- for existing users (search modes were added in v0.32.3).+ exact ask-the-user protocol. The same banner fires on `gbrain post-upgrade`+ for a brain created before v0.32.3, when search modes arrived.4. Read [`./INSTALL_FOR_AGENTS.md`](./INSTALL_FOR_AGENTS.md) for the full step-by-stepflow (keyless memory, optional API capabilities, maintenance, verification).@@ -2799,9 +2799,9 @@ gbrain skillpack scaffold --all # copy the 50+ bundled skills + RESOLVER.mScaffolded skills are first-class files in your repo. Edit freely; re-running scaffoldrefuses to overwrite anything that exists. Use `gbrain skillpack reference <name>` to-diff against gbrain's bundle when you want upstream improvements. (The legacy-`gbrain skillpack install` managed-block model was removed in v0.33 — run-`gbrain skillpack migrate-fence` once if upgrading from an older release.)+diff against gbrain's bundle when you want upstream improvements. (A workspace+that still carries the managed-block fence from `gbrain skillpack install`, a+model gbrain removed in v0.33, needs `gbrain skillpack migrate-fence` once.)> **PGLite brains are single-process (applies to every MCP registration> below).** PGLite is a single-writer embedded Postgres: the first running@@ -2901,7 +2901,7 @@ platform glue entirely with `gbrain autopilot --install` (built-in self-maintainworks during DB outages.- **Auto-update** (daily): `gbrain check-update --json` (tell user, never auto-install).- **Dream cycle** (nightly): `gbrain dream` runs the 8-phase overnight maintenance cycle.- Entity sweep, citation fixes, memory consolidation, plus (v0.23+) overnight conversation+ Entity sweep, citation fixes, memory consolidation, plus overnight conversationsynthesis and cross-session pattern detection. One cron-friendly command. This is whatis an opt-in maintenance capability. See `docs/guides/cron-schedule.md` for thefull protocol.@@ -2945,16 +2945,16 @@ consent gates around unattended remediation.## Upgrade-For v0.60.5.0 and later, confirm a database backup exists before upgrading,-upgrade every process that writes to the brain, then follow the+When an upgrade crosses v0.60.5.0, confirm a database backup exists before+upgrading, upgrade every process that writes to the brain, then follow the[v0.60.5.0 steps](skills/migrations/v0.60.5.0.md): one full `gbrain doctor`,then preview `gbrain repair` and apply only after the user agrees-([repair guide](docs/guides/repair.md)). For v0.60.6.0, also follow the-[one-time timeline prune and slug-collision steps](skills/migrations/v0.60.6.0.md). For v0.60.11.0, preview+([repair guide](docs/guides/repair.md)). Across v0.60.6.0, also follow the+[one-time timeline prune and slug-collision steps](skills/migrations/v0.60.6.0.md). Across v0.60.11.0, preview`gbrain repair contextual-mode` and rebuild PGLite vector indexes after a crashrepair ([steps](skills/migrations/v0.60.11.0.md)).-For v0.53.0.0, follow the+When an upgrade crosses v0.53.0.0, follow the[mechanical shared-skills migration](skills/migrations/v0.53.0.0.md) on the host,starting with `gbrain apply-migrations --dry-run --json`. Stop/exclude old writers,review writer status, and use the checklist's action-specific `--admin-intent`@@ -3003,20 +3003,20 @@ v0.31.x retrieval shape), then run `gbrain config set search.mode <mode>`. SeeStep 3.5 above for the full ask-the-user protocol — the upgrade path uses thesame matrix and same default.-For v0.12.0+ specifically: if your brain was created before v0.12.0, run+If the brain was created before v0.12.0, run`gbrain extract links --source db && gbrain extract timeline --source db` to-backfill the new graph layer (see Step 4.5 above).+backfill the graph layer (see Step 4.5 above).-For v0.12.2+ specifically: if your brain is Postgres- or Supabase-backed and-predates v0.12.2, the `v0_12_2` migration runs `gbrain repair-jsonb`-automatically during `gbrain post-upgrade` to fix the double-encoded JSONB-columns. PGLite brains no-op. If wiki-style imports were truncated by the old+If the brain is Postgres- or Supabase-backed and was created before v0.12.2,+the `v0_12_2` migration runs `gbrain repair-jsonb` automatically during+`gbrain post-upgrade` to fix double-encoded JSONB columns (PGLite brains+no-op). If wiki-style imports from before v0.12.2 were truncated by a`splitBody` bug, run `gbrain sync --full` after upgrading to rebuild`compiled_truth` from source markdown.## The onboard surface-`gbrain onboard` is the activation surface gbrain did not have before.+`gbrain onboard` is gbrain's activation surface.Once your brain has any content, run `gbrain onboard --check --json` tosee structured recommendations across 5 brain-health axes (orphans,stale embeddings, entity link coverage, timeline coverage, takes count).@@ -3060,8 +3060,8 @@ grants.writing/originals page content to your configured chat model (defaultAnthropic Haiku). Refuses to run unless `takes.bootstrap_enabled=true`is set in config AND `--yes` is passed. Two-gate opt-in by design.-- Autopilot's auto-apply tier for takes-bootstrap stays `manual_only`- until v0.42.1's eval gate (do not bypass).+- Autopilot's auto-apply tier for takes-bootstrap is `manual_only`+ (do not bypass).**Suppress nudges in CI / scripted environments:**```bash@@ -3637,7 +3637,7 @@ of an MCP `isError` result, and HTTP error bodies.| Field | Type | Meaning ||---|---|---|-| `error` | string | Legacy wire value, frozen forever under v1. Equals `code` for codes new in v1. |+| `error` | string | Legacy wire value, frozen forever under v1. Equals `code` except for the four legacy values listed under **Precedence** below. || `code` | string | Canonical registry code ([error codes](../guides/error-codes.md)). || `reason` | string? | Sub-cause where one code covers several (`embeddings_disabled`, `wired_running`, …). || `message` | string | What happened, one sentence. |@@ -3655,8 +3655,8 @@ Pre-existing keys keep their names and meaning: `detail`, `protocol_version`(memory verbs), `write_request` and `write_error` (write receipts).**Precedence.** Read `code`; fall back to `error` when `code` is absent (a-server older than v1). Four surfaces historically sent a different `error`-value and keep sending it; the canonical value rides `code`:+server older than v1). Four surfaces send a legacy `error` value that differs+from `code`; the canonical value rides `code`:| `error` (frozen) | `code` (canonical) ||---|---|@@ -3951,8 +3951,8 @@ that work in this conversation.| 130 | interrupted | ask the user whether to re-run |`gbrain mcp expose` and `gbrain google` still exit 2 when they need-confirmation (documented v1 legacy). Details and the "changed in this release"-table: [exit codes](../guides/exit-codes.md).+confirmation (documented v1 legacy). Details and the per-command exit table:+[exit codes](../guides/exit-codes.md).**`--json` documents.** A command whose `--help` documents `--json` writesexactly one JSON document to stdout (or NDJSON lines for `eval export`,@@ -4052,50 +4052,9 @@ Nested legacy errors keep their nesting and gain sibling `code` and `fix`.know.- Removing a legacy shape needs a written support policy and evidence aboutits consumers first. A breaking change means a new `AGENT_OPERATOR_v2`.--## Behavior changes for scripts and agents--What changed when contract v1 shipped, for scripts and agents that parsed the-old behaviour. The release's CHANGELOG entry carries the same table.--| Area | Before | Now | What to change |-| --- | --- | --- | --- |-| `gbrain embed --stale` time-budget stop | exit 3 | exit 11 (since v0.60.37.0) | treat 11 as "run `resume_command`"; 3 now only means `confirmation_required` |-| `gbrain dream --drain` with backlog left | exit 3 | exit 11, `--json` carries `resume_command` | treat 11 as a resumable stop |-| Other exit-3 sites (`agent run --follow` timeout, `providers test`, `sources harden`, `sources pull`, `sources remove/archive default`, `extract-conversation-facts`) | exit 3 | 124, 1 or 2 ([exit codes](../guides/exit-codes.md#changed-in-this-release)) | branch on the new codes |-| `migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | exit 2 ("pass `--yes`") | exit 3 with the consent payload | stop, relay `user_message`, run `fix.command` only after the user agrees |-| `pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | exit 1 | exit 3 with the consent payload | same |-| `book-mirror` paid fan-out without authorization | exit 0 ("cancelled", nothing ran) | exit 3 with the consent payload | same |-| `gbrain doctor --remediate` without a terminal | ran paid and mutating work with no `--yes` and no cap | refuses with exit 3; nothing runs. Repairs (`--include-repairs`) need `--yes --expect <plan_hash>` from `--remediation-plan --json` | relay `user_message`; pass `--yes` (derived cap) or `--max-usd <n>` only after the user agrees |-| Paid, destructive, credential, egress and install commands without a terminal | "re-run with `--yes`" text | exit 3 with `effects`, `user_message` and an `ask_user` fix | stop and ask; never add `--yes` on your own |-| `--yes` on paid work without `--max-usd` | no cap unless the command had its own default | runs under a derived cap (estimate x1.5, floor $0.25; the $5 default with no estimate), printed first; exhaustion exits 1 with a resume command | pass `--max-usd <n>` for a bigger job the user approved |-| Unpriced model (no per-token rate known) | refused whenever a cap was set | warns and runs under a derived or default cap; under a user cap refuses with a fix to look up the rate and run `gbrain pricing set` | register the rate, then retry |-| `gbrain reindex-frontmatter --json` | `--json` skipped the confirmation | `--json` never implies consent | pass the authorization the payload names |-| `gbrain jobs submit` on PGLite | queued with no worker to run it | refuses with `no_worker` unless `--follow` or `--queue-only` | add `--follow` (run it now) or `--queue-only` |-| Invalid input: `autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` | exit 1 | exit 2 (`invalid_params`) | treat 2 as "fix the command" |-| `gbrain doctor --json` with no brain configured | human text or nothing | one `no_brain` envelope with the `gbrain init` fix | parse the document |-| `gbrain serve` on a brain another serve holds, or with no brain | exited before the MCP handshake | completes the handshake in status-only mode with one `gbrain_status` tool; `--fail-fast` (or `GBRAIN_SERVE_FAIL_FAST=1`) restores the early exit for supervisors | read `gbrain_status`; supervisors pass `--fail-fast` |-| `gbrain doctor` (plain, `--only`, `--remediation-plan`, MCP `run_doctor`) with an embedding key | sent one paid embedding request on every run | no provider call; `embedding_provider` reports `configured, not probed` with a `paid`+`egress` fix (`--only embedding_provider --probe --yes`) | run the probe only after the user agrees |-| `gbrain embed`, `jobs submit embed*`, `features --auto-fix` with a billed embedding provider and no terminal | embedded without asking | exit 3 with the consent payload unless `--yes`, `--max-usd`, tokenmax or a preapproval covers it; writes that embed new content are unchanged | cron jobs that backfill on purpose pass `--yes` (or `--max-usd <n>`), or set a preapproval |-| `doctor --remediation-plan --json` steps | `command` only | each step also carries `fix` with `consent` (`paid` / `destructive`) and `next` | follow `fix.next` |-| A PGLite brain whose automatic repair failed | later commands kept opening it and wrote to `pg_wal/` | every command exits 3 with the consented `pglite-repair` until the user decides; nothing touches the data directory | relay `user_message`; never move or rebuild the brain files yourself |-| `gbrain serve` whose configured brain directory is missing (unmounted drive) or whose writer-lock file cannot be opened | exited before the MCP handshake (`internal_error`) | status-only mode: `gbrain_status` names the path (`missing_brain`, `brain_unopenable`); nothing is created at the path | relay it; the server reopens the brain once it is back |-| `gbrain transcripts recent` while `gbrain serve` holds the brain | `pglite_busy` | reads through the running serve | none |-| Error envelopes | `error`, `message`, `suggestion` | adds `code`, `fix`, `class`, `retryable`, `docs_cmd`, `contract_version`; `error` unchanged (legacy values frozen) | read `code`, fall back to `error` |-| Docs pointers in errors | repo-relative paths | absolute URLs pinned to the installed version | open the URL, or run `gbrain errors <code>` offline |-| MCP results with advice | advice in `_meta` or stderr only | extra `[gbrain notice …]` text blocks plus `_meta.gbrain_notices`; `content[0]` unchanged | parse `content[0]` alone; read the notice blocks |-| MCP error results | could carry several blocks | exactly one block; notices inside the envelope | parse the one block |-| MCP tool list on stdio | listed 10 owner-only tools that always refused there | those tools are not listed on stdio; their refusals name the CLI command | use the CLI command the refusal names |-| MCP advisor on stdio | off | on by default (read-only); remote HTTP stays opt-in | none |-| MCP `initialize` instructions | one fixed text | generated per surface (`verbs`, `starter`, `full`) from the tools that caller can call | none |-| Keyless brains (no embedding key) | doctor warned and the health score dropped | doctor reports `severity: info` with the enable command; the score is not penalized | none |-| stdin reads | could wait forever on an open, silent pipe | 30 s to the first byte, 60 s idle; `GBRAIN_STDIN_TIMEOUT_MS` overrides | close stdin or pipe the payload |-| Prompts under an agent process or `CI` | prompted whenever stdin was a terminal | decline unless `GBRAIN_INTERACTIVE=1` | answer through the consent payload instead |-| `--json` stdout for commands that declare it | could mix human text into stdout or print nothing on failure | exactly one JSON document; other output goes to stderr; a fallback document on a silent non-zero exit | parse stdout as one document |-| Fix commands (`fix.argv`, `command`, `preview_argv`, `verify.argv`, `then`) | a few named the brain and source; most ran against whatever `GBRAIN_BRAIN_ID`, `GBRAIN_SOURCE` or dotfile the shell had | every gbrain fix names `--brain <id>` (and `--source <id>` where the command routes a source), so it acts on the intended brain from any directory | run fixes exactly as given |-| `gbrain doctor --remediation-plan` on a brain with pending migrations | applied the migrations before computing the plan | never migrates; the plan carries a `migrations_pending` notice whose fix applies them | run the notice's fix, or `doctor --remediate` after consent |-| `sources harden` with no id, `migrate` without `--to`, `mcp grant` without a NAME, malformed `backup create/restore` | exit 1 (`sources harden`: `internal_error`) | exit 2, `invalid_params`, with the usage and an example | treat 2 as "fix the command" |-| `gbrain db-repair` under an ambient `GBRAIN_BRAIN_ID` pointing at a mount | refused, ignoring `--brain host` | `--brain host` repairs the host brain | none |+- Legacy values are frozen. The change table for scripts and agents written+ against gbrain v0.60.45.0 or earlier, before contract v1, is in the+ [v0.60.46.0 CHANGELOG entry](../../CHANGELOG.md#behavior-changes-for-scripts-and-agents).## Tool catalog changes (`tools/list_changed`)@@ -4106,7 +4065,7 @@ swaps in the full catalog. Harness support varies by version:| Harness | Behaviour ||---|---|| Claude Code | recent versions refresh the tool list on the notification; some versions and modes have been reported to keep the old list |-| Codex | refreshes the tool list (since openai/codex#12449); its deferred tool search can stay stale |+| Codex | versions that include openai/codex#12449 refresh the tool list; its deferred tool search can stay stale || other MCP clients | not measured |If a tool the fix names is not in your tool list after a recovery, restart the@@ -4598,17 +4557,17 @@ to keep daemon installation and paid reindexing opt-in.For a hosted brain, start with the [native OAuth and private machine connection guide](docs/guides/hosted-harness-access.md). To open the dashboard, register clients, edit access, or invalidate tokens, use [MCP administration](docs/mcp/ADMIN.md). A **profile** controls MCP authority; a **surface** controls which granted tools are visible. Neither grants owner dashboard access. New memory profiles use the starter surface. `--surface verbs` retains exactly the seven memory verbs, with orientation available through `gbrain://capabilities`. Thin CLI connections use the full surface and remain restricted by their grants.-The existing connection commands below remain supported. Choose the instructions for your actual product:+Choose the connection instructions for your actual product:-**Upgrading an existing brain:** existing search chunks need rebuilding before-remote chunk retrieval resumes. Semantic result caching is temporarily disabled;+**Upgrading a brain indexed before v0.48.3.0:** its search chunks need rebuilding+before remote chunk retrieval returns them. Semantic result caching is temporarily disabled;stored contradiction reports and code-inspection tools have local-only limits.Follow the [upgrade recovery guide](skills/migrations/v0.48.3.0.md) for rebuildcommands, embedding costs, and the restrictions that remain after rebuilding.**Say to your agent:** *"Upgrade gbrain and check whether my search index needs rebuilding."*- **[Claude Code](docs/mcp/CLAUDE_CODE.md)** — plugin: `/plugin marketplace add garrytan/gbrain` + `/plugin install gbrain@gbrain` (MCP + skills; persona variants `gbrain-coding` / `gbrain-daily` install curated subsets; pick one). Marketplace-free skills: `gbrain skillpack scaffold --harness claude-code` copies a persona-curated skill set into your user-scope skills dir. Or local one-liner: `claude mcp add gbrain -- "$(command -v gbrain)" serve`. Remote with just a bearer token: `gbrain connect https://your-host/mcp --token gbrain_xxx` prints a paste-ready block (or `--install` wires it up and smoke-tests the token).-- **[Codex](docs/mcp/CODEX.md)** — plugin (recommended): `codex plugin marketplace add garrytan/gbrain@codex-plugin` + `codex plugin add gbrain@gbrain` installs the MCP server AND the curated skill set. Or connect-only: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex` (or `--install`); That legacy path reads `$GBRAIN_REMOTE_TOKEN` at runtime. The new private-handoff installer writes a private managed HTTP header so the connection survives a new shell.+- **[Codex](docs/mcp/CODEX.md)** — plugin (recommended): `codex plugin marketplace add garrytan/gbrain@codex-plugin` + `codex plugin add gbrain@gbrain` installs the MCP server AND the curated skill set. Or connect-only: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex` (or `--install`); the token path reads `$GBRAIN_REMOTE_TOKEN` at runtime, while the private-handoff installer writes a private managed HTTP header so the connection survives a new shell.- **[Cursor / Windsurf / any stdio MCP client](docs/mcp/CLAUDE_CODE.md)** — same shape, add `{"command": "gbrain", "args": ["serve"]}` to your MCP config.- **[Hermes](docs/mcp/HERMES.md)** — `printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve`. Keep `--args` last, and verify with `hermes mcp test gbrain` (the add exits 0 even on failure).- **[Grok Bot](docs/guides/grok-bot.md)** — recommended: keep the brain on your computer, publish it with `gbrain mcp expose --funnel`, grant the Bot a `memory-writer` client and install the thin CLI at `/workspace/gbrain`; or install memory inside the Bot computer when no machine of yours stays online. Bots share local files and credentials; sources organize memory without isolating Bots. **Say to your agent:** *"connect grok bot to my brain"*.@@ -5240,7 +5199,7 @@ src/schema.sql (canonical for every other table) ─┴─> src/schema.sql BEGINchunk-index and FTS-language policies at runtime. An unknown statement kind, an unclassified`DO` block, or a rule that no longer matches fails the build.- **Guards**: `check:schema-fresh` regenerates the whole chain into a temp dir and names the source- to edit on drift; the E4 catalog goldens (`test/schema-catalog-golden.test.ts`,+ to edit on drift; the catalog goldens (`test/schema-catalog-golden.test.ts`,`test/e2e/schema-catalog-golden.test.ts`) and `test/pglite-upgrade-replay.test.ts` pin the endstate.@@ -5545,7 +5504,7 @@ and assert `jsonb_typeof` — the assertion PGLite cannot make.`dialect-pglite.ts` and `dialect-postgres.ts`, expose it through a private`engineSql` getter over the current connection, and delegate every methodof a migrated domain to `src/core/engine-sql/<domain>.ts` the way both- engines do. Declare its capabilities honestly. The E5 binding matrix+ engines do. Declare its capabilities honestly. The binding matrix(`test/helpers/executor-binding-matrix.ts`) and the engine-sql contracttests tell you whether the adapter binds, counts, fails and cancels like theothers. A non-SQL engine implements every method itself.@@ -6096,9 +6055,8 @@ Two more tips:request and why it waits. `gbrain doctor` reports a managed cursor'sremaining entries and ETA from any process.-Before this drain shipped, the workaround was a shell loop around-`gbrain sync --source <id> --no-pull` until it printed `synced`. That loop-still works, and each run now drains as far as its deadline allows.+A shell loop around `gbrain sync --source <id> --no-pull` until it prints+`synced` also works; each run drains as far as its deadline allows.## Implementation@@ -7687,12 +7645,12 @@ pull requests, issue comments, PR reviews, PR review comments, labels,milestones, assignees, check runs, check suites, workflow runs. Each eventsubmits a targeted `sync` job that refreshes exactly the item that changed(check events resolve the linked PR from the payload; events without an-item reference are acknowledged and skipped). Push events keep their-existing git-source behavior.+item reference are acknowledged and skipped). Push events follow the+git-source behavior.Without a public URL, use a tunnel (Tailscale Funnel, ngrok, or any HTTPShost). The webhook is HMAC-signed per source with the same-`X-Hub-Signature-256` verification as the existing push webhook. Out-of-scope+`X-Hub-Signature-256` verification as the push webhook. Out-of-scoperepos are acknowledged but never materialized.## Pages@@ -7718,15 +7676,12 @@ comments, reviews and checks). Two behaviors worth knowing:stay recallable by those facets. Without a body, the chunk would holdonly the title, and compound titles tokenize poorly.- **Near-identical pages** (the same PR merged across several mirrored- repos) are de-duplicated at search time by upstream gbrain (Jaccard- similarity, `src/core/search/dedup.ts`). Content recall is unaffected:+ repos) are de-duplicated at search time (Jaccard similarity,+ `src/core/search/dedup.ts`). Content recall is unaffected:the surviving copy carries the same text, and the hidden copy is stillreachable via a repo-scoped query or direct slug lookup. If you needthe per-repo copy to win, include the repo name in the query.-A feature-scoped retrieval bench (brain-bench style, hit@K against a live-mirror) ships with the QA notes; see `QA-REPORT.md` for the summary.-## Rate limitsThe client honors `x-ratelimit` headers, backs off on 403/429 and pauses@@ -8486,8 +8441,8 @@ are in [CHATGPT.md](CHATGPT.md#troubleshooting).**A claude.ai connector can search but not save**The `/mcp` challenge hints `read write`, and each token is capped to the-client's registered scope. A connector approved before v0.60.5.0 was-approved with the old `read` hint and keeps a read-only grant. Remove and+client's registered scope. A connector approved before v0.60.5.0 received a+`read`-only hint and keeps a read-only grant. Remove andre-add the connector, and approve `write` on the consent screen. If theclient is registered with `read` only, widen it first([ADMIN.md](ADMIN.md#inspect-clients-and-edit-access)).@@ -9406,8 +9361,10 @@ gbrain statsgbrain embed --stale```-If `OPENAI_API_KEY` is not set, embeddings can't be generated. Keyword search-still works without embeddings, but hybrid/semantic search won't.+Without a key for the configured embedding provider (`VOYAGE_API_KEY` for the+default `voyage:voyage-4`, `OPENAI_API_KEY` for OpenAI models), embeddings can't+be generated. Keyword search still works without embeddings, but+hybrid/semantic search won't.### 4c. End-to-End Test@@ -9452,10 +9409,12 @@ gbrain stats**Expected:** Embedded chunk count matches (or is close to) total chunk count.-**If zero or very low:** `OPENAI_API_KEY` may be missing or invalid. Check:+**If zero or very low:** the embedding provider key (`VOYAGE_API_KEY` for the+default model, `OPENAI_API_KEY` for OpenAI models) may be missing or invalid.+Check:```bash-echo $OPENAI_API_KEY | head -c 10+echo $VOYAGE_API_KEY | head -c 10 # or $OPENAI_API_KEY```If blank, set the key. Then:@@ -9699,7 +9658,7 @@ Source: https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/tro| `embed_staleness` | the stale-chunk count (the embed worker's own predicate) | the reason names the database error; re-run `gbrain doctor` once it is fixed || `schema_pack_consistency`, `schema_pack_source_drift` | the pages or config query, or a source's active schema pack | `gbrain schema lint --with-db` runs the same classification locally; `gbrain schema active` debugs pack resolution |-`bootstrap_push_health` and `gbrain bootstrap status` report only the push record of the workspace named by this machine's bootstrap receipt; another workspace's stale or failed push is listed as such (a warn naming that workspace), never as this workspace's state. `reranker_health` auth warnings are audit-log history (`details.live_probe_performed: false`), not a live check of the key. **Behavior change:** a doctor that used to read all green can now show these warns; each one is a check that did not run.+`bootstrap_push_health` and `gbrain bootstrap status` report only the push record of the workspace named by this machine's bootstrap receipt; another workspace's stale or failed push is listed as such (a warn naming that workspace), never as this workspace's state. `reranker_health` auth warnings are audit-log history (`details.live_probe_performed: false`), not a live check of the key. These warns can appear while every other check reads green; each one names a check that did not run.**`brain_score` shows a low "timeline density (entity and event pages)"?** The 15-point timeline component grades only linkable pages whose type's active-pack primitive is `entity` or `temporal` (people, companies, meetings, emails, events…); reference documents such as notes, writing and guides have no events and are not graded, so do not stamp "page created" rows onto them. Types the pack does not declare are still graded. Raise the score by giving those entity and event pages real timeline entries (`gbrain extract timeline`).@@ -9851,10 +9810,11 @@ agent runs `gbrain doctor` and reads the `vector_plan` check.embedding get fresh vectors.- warn, legacy guard: see below.-**Legacy guard (one-release rollback).** If vector search got slower or-returned different results right after the upgrade that moved the content-freshness check out of the HNSW candidate scan (#5824), you can restore the-previous statement while you report it:+**Legacy guard (temporary rollback).** Vector search checks content freshness+outside the HNSW candidate scan. `search.vector_legacy_guard` restores the older+statement, which checked freshness inside the scan. Use it only when vector+search is slower or returns different results than before your upgrade, and+report the regression:1. The setting belongs to the process that runs searches on the brain host(`gbrain serve`, autopilot, job workers), never to a thin client.@@ -9868,7 +9828,7 @@ previous statement while you report it:5. Remove it once the regression is fixed: `gbrain config setsearch.vector_legacy_guard false` (or unset the variable) and restart again.-The guard is retired in the next release; that release prints a one-time notice+The guard is temporary. The release that retires it prints a one-time noticewhen the inert setting is still present.## Global maintenance timeouts@@ -9876,7 +9836,7 @@ when the inert setting is still present.**Doctor warns `global_maintenance_timeouts`, or late maintenance phases(orphans, purge, the brain-wide embed) never seem to run?** On a large brainone `autopilot-global-maintenance` job may not fit every phase before its-deadline (30 minutes by default). Each job now stops starting phases that its+deadline (30 minutes by default). Each job stops starting phases that itsdeadline would cut off and the next job resumes at that phase, so one pass canspan several jobs; the resume point is the config row`autopilot.global_maintenance.progress`. A phase that was running when a job@@ -9897,7 +9857,7 @@ at the deadline).**Say to your agent:** *"Why aren't my meetings showing up as timeline events?"*-Automatic event extraction works again and is on by default. See the+Automatic event extraction is on by default. See the[Life Chronicle guide](life-chronicle.md) for what qualifies, the cost, thethree-step check, and the skip codes. `gbrain doctor` reports it as the`auto_chronicle` check. To turn it off, run@@ -9934,28 +9894,11 @@ the exit code first, then reads the JSON document (`--json`) for the details:`class` and `retryable` live only in the JSON document; the exit code stayscoarse so shell scripts can branch on it.-Under contract v1, `gbrain mcp expose` and `gbrain google` still exit 2 when-they need the user's confirmation (documented legacy; changing it is a v2 item).--## Changed in this release+Under contract v1, `gbrain mcp expose` and `gbrain google` exit 2 when they+need the user's confirmation (documented legacy; changing it is a v2 item).-| Command | Before | Now | Why |-|---|---|---|---|-| `gbrain embed --stale` time-budget stop | 3 | 11 | 3 means "ask the user first"; a budget stop means "run the resume command" |-| `gbrain dream --drain` backlog left (window/deadline/lock stop, busy cycle lock) | 3 | 11 | a resumable stop; `--json` carries `resume_command` |-| `gbrain agent run … --follow` timeout | 3 | 124 | a timeout, not a consent stop; the job keeps running |-| `gbrain providers test` transient provider error | 3 | 1 (retryable) | retryable failure |-| `gbrain sources harden` with sources needing attention | 3 | 1 | failure for cron; the report names what to fix |-| `gbrain sources pull` rebase conflict aborted | 3 | 1 | failure |-| `gbrain sources remove default` / `gbrain sources archive default` | 3 | 2 | invalid input |-| `gbrain extract-conversation-facts` pages skipped on a busy lock | 3 | 1 (retryable) | re-run to finish the skipped pages |-| `gbrain call` invalid parameters | 1 | 2 | invalid input; stdout now carries the error envelope |-| `gbrain migrate embeddings`, `reindex-search-vector`, `reindex-code`, `dream retriage`, `sources connect`, `bootstrap harness` without authorization | 2 | 3 | a consent stop: the payload names the effects and the words to ask the user |-| `gbrain pglite-repair`, `reinit-pglite`, `enrich`, `connect --install` without authorization | 1 | 3 | a consent stop, not a failure |-| `gbrain book-mirror` paid fan-out without authorization | 0 | 3 | nothing ran; it used to report "cancelled" and exit 0 |-| `gbrain doctor --remediate` without a terminal and without `--yes` | 0 (it ran) | 3 | paid and destructive work waits for the user |-| `gbrain autopilot --interval`, `serve --port`, `dream --phase`, `init --mcp-only` missing flags, `delta --since` with a bad value | 1 | 2 | invalid input |-| `gbrain jobs submit` on PGLite without `--follow` or `--queue-only` | 0 (queued, no worker) | 1 (`no_worker`) | the job would wait for a worker that is not running |+The per-command exit changes that came with contract v1 (v0.60.46.0) are in+the [CHANGELOG](../../CHANGELOG.md#exit-code-changes-by-command).---@@ -10592,9 +10535,9 @@ any other option the table below does not list, including `--max-usd`: arefused run changes nothing. To cap paid embedding work, run the repairsthrough `gbrain doctor --remediate --yes --include-repairs --expect <plan_hash> --max-usd <n>`(`<plan_hash>` comes from `gbrain doctor --remediation-plan --json`). `--all`-runs `timeline`, then `visibility`, then `safe-chunks`, then `contextual-mode`, then `connector-checkpoints`, then `request-indexes`, then `connector-fences`, then `orphan-bindings`, then `embedding-effects`, and stops at the+runs `timeline`, then `visibility`, then `safe-chunks`, then `contextual-mode`, then `connector-checkpoints`, then `request-indexes`, then `connector-fences`, then `orphan-bindings`, then `embedding-effects`, then `attribution-backfill`, then `planner-stats`, and stops at thefirst kind that stops.-The explicit-only kinds (`google-file-modes`, `stale-atoms`, `extractor-facts`) never run under+The explicit-only kinds never run under`--all`; it lists each with its preview command and still exits 0 when theyare the only findings left. `gbrain repair` with no kind does the same for apreview. With `--json` the list is `explicit_kinds[]` (`kind`, `code:@@ -10638,14 +10581,13 @@ should also check `results[].complete`.| `request-indexes` | `persistence_request_indexes` | Creates a missing managed sync request index, or drops an INVALID one (left by an interrupted concurrent build) and rebuilds it, on a brain whose schema version is already current. Postgres builds each index `CONCURRENTLY`, one at a time, so writes continue; PGLite builds inline. It changes no user data, takes no journal admission and runs brain-wide (`--source` does not narrow it). See [managed sync request indexes](#request-indexes). | `building`: an index another session is still building; it is never dropped. || `connector-fences` | none (a `connector_fence_below_timeline` refusal names it) | Moves a facts or takes fence that sits below the timeline sentinel of a Google or GitHub page into the page body through a revision-bound `put_page`, so the connector's next re-render carries the fence instead of refusing. Then re-attempt the held item with `gbrain sources retry-held <source>`. | `kept_ambiguous_pages`: pages whose fences are duplicated, unbalanced or unparseable. Move the fence by hand: read the page, place the fence above the `<!-- timeline -->` line, and save it with the current `expected_revision`. || `connector-checkpoints` | `connector_checkpoints` | Deletes managed connector checkpoint rows and retry pointers that no registered connector source can load and that are older than 7 days. They accumulate after a content setting such as `g_history_days` changes, or when a connector host older than v0.60.11.0 runs during an upgrade. Cleanup only: it never copies or re-keys a checkpoint, takes no journal admission and runs brain-wide (`--source` does not narrow it). | Rows a queued or running connector write, or a connector's recorded pending set, still references. |-| `orphan-bindings` | `orphan_persistence_bindings` | Deletes persistence source bindings whose source was removed, or that belong to an earlier incarnation of a source re-added under the same id. Releases before this one left the binding behind on `gbrain sources remove` and `gbrain sources purge`, so the re-added source read as claimed and every `gbrain sync --source <id>` failed with `writer_coordinator_required`. Bookkeeping only: no journal admission, no page or file changes, and it runs brain-wide (`--source` does not narrow it). See [orphan bindings](#orphan-bindings). | A binding that a queued, running or recovering write request of the same source incarnation still references. |+| `orphan-bindings` | `orphan_persistence_bindings` | Deletes persistence source bindings whose source was removed, or that belong to an earlier incarnation of a source re-added under the same id. `gbrain sources remove` and `gbrain sources purge` delete the binding; one an older gbrain left behind makes the re-added source read as claimed, so every `gbrain sync --source <id>` fails with `writer_coordinator_required`. Bookkeeping only: no journal admission, no page or file changes, and it runs brain-wide (`--source` does not narrow it). See [orphan bindings](#orphan-bindings). | A binding that a queued, running or recovering write request of the same source incarnation still references. || `embedding-effects` | `stale_embedding_effects` | Settles stale queued and failed embedding effects of committed writes, which block receipt compaction and activation: `reconciled` when current vectors pass the effect verifier, `superseded` when the page was deleted or a newer revision owns its own effect, `retry_queued` for the owner (paid; a used-up retry allowance gets one new bounded cycle per explicit apply). See [stale queued embedding effects](#stale-queued-embedding-effects). | `blocked` effects, counted by reason (`owner_unavailable`, `embedding_disabled`, `embedding_unconfigured`, `projection_pending`, `no_replacement_obligation`). || `attribution-backfill` | none | Fills write attribution (who wrote it) on pages, page versions and facts written before attribution was recorded, only where exactly one committed request in the write journal proves the writer: the page write whose recorded result is the row's revision, or the `remember` that inserted the fact. Fills NULLs only, in committed batches of 1,000 that resume after an interruption; no content, revision, page file or request ID changes. See [write attribution](../mcp/ADMIN.md#write-attribution). | `unrecorded_pages`, `unrecorded_page_versions`, `unrecorded_facts`: rows the journal cannot prove. They stay `unrecorded`; nothing is inferred. || `safe-chunks` | `safe_index_pending` (also `contextual_retrieval_coverage`, `details.unsealed_pages`) | Rebuilds the chunks of markdown and code pages indexed before the safe-chunk fence, which remote and MCP search withhold. It rebuilds projections only: no page write, no new page version and no request ID. Vectors whose embedding input did not change are kept; the rest are embedded unless you pass `--no-embed` or no embedding model is configured. | `code_without_source_path`: code pages with no recorded file to re-chunk. `unsupported_page_kind`: other page kinds, such as images. Their importer re-seals them. || `orphan-children` | `child_table_orphans` (also a `storage_corrupt` error) | Explicit-only. Deletes rows of page child tables (chunks, versions, tags, takes, raw data, timeline, links) whose page row no longer exists, and clears dangling `links.origin_page_id` and `files.page_id` references, each in one statement that rechecks the orphan condition. See [orphan children](#orphan-children). | `torn_pages`: page rows whose stored body cannot be read (torn TOAST). The preview names them; the repair never changes them. |-| `contextual-mode` | `contextual_retrieval_coverage` (pages with no recorded mode) | Stamps the contextual retrieval mode on markdown pages imported without one (for example by a large `--no-embed` sync or a connector source before this release), exactly as a fresh import of the page would: the page, source and brain settings decide, and the per-chunk synopsis tier lands at the free title tier. It rebuilds projections only: no page write, no new page version and no request ID. A page whose stored vectors already match the stamped convention keeps them and queues no re-embedding; a page whose embedding input changes has only those vectors cleared and is re-embedded once, unless you pass `--no-embed`. | `unsealed_projection`: pages whose chunks lag their text; `gbrain embed --stale` or `safe-chunks` seals them first, and the next run stamps them. `embed_skip`: pages marked to skip embedding keep their stored vectors and are not stamped. |-gbrain repair google-file-modes --apply # explicit-only: runs only when named-gbrain repair --all --apply # every automatic kind in order+| `planner-stats` | `planner_stats_stale` | Runs `ANALYZE` on the hot tables (pages, links, facts, takes, content_chunks, timeline_entries) whose planner statistics are stale, so search and graph reads stop planning as slow nested loops. PGLite also resets each table's pending row count; Postgres runs each `ANALYZE` with a 60 s statement timeout and a 2 s lock timeout. No journal admission, no user data changes, brain-wide. | none |+| `contextual-mode` | `contextual_retrieval_coverage` (pages with no recorded mode) | Stamps the contextual retrieval mode on markdown pages imported without one (for example by a large `--no-embed` sync, or by a connector source on an older gbrain), exactly as a fresh import of the page would: the page, source and brain settings decide, and the per-chunk synopsis tier lands at the free title tier. It rebuilds projections only: no page write, no new page version and no request ID. A page whose stored vectors already match the stamped convention keeps them and queues no re-embedding; a page whose embedding input changes has only those vectors cleared and is re-embedded once, unless you pass `--no-embed`. | `unsealed_projection`: pages whose chunks lag their text; `gbrain embed --stale` or `safe-chunks` seals them first, and the next run stamps them. `embed_skip`: pages marked to skip embedding keep their stored vectors and are not stamped. |Timeline rows that an earlier version of a page produced and its current textno longer has are removals, not history, so `timeline` neither counts nor@@ -10662,9 +10604,9 @@ bullet in a save that passes the current `expected_revision` deletes its entry.Managed Google and GitHub connector checkpoints are keyed on the parsedconnector settings minus credential-delivery fields, so the per-cycle-`last_source_cycle_at` stamp no longer makes every run start over. The-v0.60.11.0 migration copies each connector source's newest committed-checkpoint to the new key. A source whose newest checkpoint receipt was+`last_source_cycle_at` stamp does not make a run start over. On an upgrade+across v0.60.11.0, the migration copies each connector source's newest+committed checkpoint to the current key. A source whose newest checkpoint receipt wascompacted re-walks its window once; unchanged pages are not admitted again.**Say to your agent:** *"Did my Gmail connector stop re-importing everything@@ -10713,16 +10655,15 @@ Git-backed source and while the account differs### Managed sync request indexesA managed sync checkpoint checks that every page receipt of its run-committed. On a large `persistence_requests` table that check used to scan the-whole table and hit the coordinator's 5-second statement timeout, so the-checkpoint never committed and was retried ahead of every other write to the-source (#5762). Two indexes now serve it, `persistence_requests_sync_run_open`-and `persistence_requests_sync_run_committed`. On Postgres, migration 179+committed. Two indexes serve that check, `persistence_requests_sync_run_open`+and `persistence_requests_sync_run_committed`, so it stays inside the+coordinator's 5-second statement timeout on a large `persistence_requests`+table. On Postgres, migration 179builds them `CONCURRENTLY` after the upgrade; while it runs it prints`building <index> on ~N rows; this can take minutes; it is safe to leave-running`. A timeout that still happens fails the checkpoint with+running`. If the check still times out, the checkpoint fails with[`checkpoint_validation_timeout`](write-refusals.md#checkpoint-validation-timeout)-instead of retrying forever.+and is not retried ahead of other writes.**Say to your agent:** *"My sync says checkpoint_validation_timeout. What do I run?"*@@ -10751,10 +10692,10 @@ nothing is evicted.After an upgrade that re-queues text projections (for example the 0.51protocol activation), search and code results stay incomplete until every-queued Markdown and code page is rebuilt (#5401). Doctor+queued Markdown and code page is rebuilt. Doctor`text_projection_readiness` warns while any visible page is pending.-The upgraded resident owner (`gbrain serve` or autopilot) drains the queue on+The resident owner (`gbrain serve` or autopilot) drains the queue onits own: each pass rebuilds up to 100 pages and starts no new page after250 ms, and takes 2 pages while writes are waiting. A page whose rebuild failsis retried after 30 seconds.@@ -10785,7 +10726,7 @@ Verify: `gbrain doctor` shows `text_projection_readiness` ok.### Provider key sourceAn exported provider key (for example `OPENAI_API_KEY`) wins over the matching-config key (`openai_api_key` in `~/.gbrain/config.json`) (#5137). When both are+config key (`openai_api_key` in `~/.gbrain/config.json`). When both areset and differ, every gbrain command except `gbrain hook` prints one warningper process naming the variable, the config key and which one is in effect.No key or part of one is ever printed.@@ -10827,9 +10768,9 @@ the item's error code names, then re-attempt. See**Say to your agent:** *"I removed a source and added it back, and now syncsays it needs a coordinator. Fix it."*-Removing a source now also removes that source's persistence binding, and the-claim check only counts a binding of the source's current incarnation. A-binding left behind by an older release is reported by doctor's+Removing a source also removes that source's persistence binding, and the+claim check counts only a binding of the source's current incarnation. A+binding left behind by an older gbrain is reported by doctor's`orphan_persistence_bindings` check. Preview, then apply after you agree:```bash@@ -10878,8 +10819,9 @@ is written. A run that has neither says `scan incomplete` and is a lower bound;### Stale atoms-`gbrain repair stale-atoms` (explicit-only, #5770) retires atoms that drifted-before managed re-extraction learned to retire them. It lists live atoms bound+`gbrain repair stale-atoms` (explicit-only) retires atoms that drifted from+their source page and that managed re-extraction never retired (atoms left+by an older gbrain). It lists live atoms boundto a source page (`source_slug`) in two classes:- `origin_gone`: the source page is missing or deleted;@@ -10913,10 +10855,10 @@ threshold.### Extractor facts-Before v0.60.11.0, every managed write to a conversation page without a-Facts fence expired all of that page's conversation-extractor facts-(`expired_at` set, `row_num` cleared), and recall stopped returning them.-`gbrain repair extractor-facts` (#5731) restores them. It is explicit-only and+A managed write by a gbrain older than v0.60.11.0 to a conversation page+without a Facts fence expires all of that page's conversation-extractor facts+(`expired_at` set, `row_num` cleared), so recall stops returning them.+`gbrain repair extractor-facts` restores them. It is explicit-only andpreview-bound.```bash@@ -10956,18 +10898,17 @@ re-extraction (the old rows are gone), and facts on unmanaged brains without`--include-ambiguous`. On PGLite the same-transaction rule holds only to themillisecond (PGLite's clock resolution).-The preview warns, naming the host, when a consumer older than this release+The preview warns, naming the host, when a consumer older than v0.60.11.0published writes after `writer_version_cutoff`: an old consumer expiresrestored facts again. Upgrade and restart it first.<a id="captured-facts"></a>### Captured facts-Before v0.60.30.0, automatic capture (the writeback hook, the compaction-harvest and the corpus sweep) extracted facts from gbrain's own claude-cli-model sessions and from text you pasted into a conversation. New capture skips-both, but the facts already stored stay active, so recall and hot memory keep-returning them. `gbrain repair captured-facts` expires them. It is+Automatic capture (the writeback hook, the compaction harvest and the corpus+sweep) skips gbrain's own claude-cli model sessions and text you paste into a+conversation. Facts a gbrain older than v0.60.30.0 captured from them stay+active, so recall and hot memory keep returning them. `gbrain repair captured-facts` expires them. It isexplicit-only and preview-bound, and it runs on the brain host (it reads theClaude Code session directory and the session corpus there).@@ -11007,10 +10948,11 @@ maintenance request per page on a managed brain). Nothing is withdrawn, so### Loop factsClosing a commitment loop (`gbrain loops done`, `gbrain loops drop`, or the-`loops_close` tool) retires its commitment fact. A loop closed while that-retirement could not commit (for example on a managed brain, where the write-was refused but the close still reported `fact_expired: true`) left the fact-active, so entity cards and recall keep the finished promise. `gbrain repair+`loops_close` tool) retires its commitment fact.+A loop closed by a gbrain older than v0.60.32.0 while that retirement could+not commit (for example on a managed brain, where the write was refused but+the close still reported `fact_expired: true`) leaves the fact active, so+entity cards and recall keep the finished promise. `gbrain repairloop-facts` retires those facts. It is explicit-only and preview-bound.**Say to your agent:** *"Doctor says some closed loops still have an active@@ -11035,9 +10977,9 @@ withdrawal is recorded, so the same promise made again is stored normally.<a id="failed-writes"></a>### Failed writes-Before v0.60.38.0, on a managed brain whose `tags`, `timeline_entries` or-`takes` table had a `source_id` column gbrain does not create, the managed-writer guard refused writes it should have allowed (#5983). Each refused write+On a managed brain whose `tags`, `timeline_entries` or `takes` table has a+`source_id` column gbrain does not create, the managed writer guard of a+gbrain older than v0.60.38.0 refuses writes it should allow. Each refused writekeeps a failed receipt with its full intent until receipt compaction(`persistence.receipt_retention_days`, 30 days by default). `gbrain repairfailed-writes` submits those writes again. It is explicit-only and@@ -11091,8 +11033,7 @@ history.<a id="held-files"></a>### Held files-A file gbrain cannot import without guessing (#5988) no longer stops a sync.-Sync holds it, imports the rest of the source, advances the checkpoint and+A file gbrain cannot import without guessing does not stop a sync. Sync holds it, imports the rest of the source, advances the checkpoint andkeeps reporting the file until it changes, is deleted, or a newer gbrain canread it. A held new file has no page yet; a page whose newer file is held keepsits last good revision, search marks it `stale`, `get_page` carries@@ -11110,8 +11051,8 @@ The session below is real output (volatile ids, hashes and times shown asthese commands and checks every line shown). Before the upgrade, a generatorcommitted three notes to the `notes` source: `notes/standup.md` with a titlethat continues on an unquoted line, a new `notes/digest.md` with `title:`-twice, and a new `notes/roundup.md` with an unquoted `: ` in `author:`. The-older gbrain blocked the source on the first file it refused.+twice, and a new `notes/roundup.md` with an unquoted `: ` in `author:`. A+gbrain older than v0.60.47.0 blocks the source on the first file it refuses.1. After upgrading, `gbrain post-upgrade` names the blocked source and thecommand that unblocks it now. Doing nothing also works: the next scheduled@@ -11237,14 +11178,14 @@ default 50) and `frontmatter_repairable` (files the repair can fix, includingones that import only after quoting). Both are explicit-only findings:`gbrain doctor --remediation-plan --json` lists them as `explicit_kind_required`with `gbrain repair frontmatter --source <id>`, and `--remediate` never runs the-repair. `frontmatter_hook` warns when an installed pre-commit hook predates-this release; refresh it with `gbrain frontmatter install-hook --force`.+repair. `frontmatter_hook` warns when an installed pre-commit hook is older+than the running gbrain's hook; refresh it with `gbrain frontmatter install-hook --force`.Settings, all read by every sync:| Key | Default | Effect || --- | --- | --- |-| `sync.holds` | `hold` | `fail` restores fail-closed blocking: a content refusal blocks the sync as it did before holds. |+| `sync.holds` | `hold` | `fail` makes sync fail closed: a content refusal blocks the sync. || `sync.hold_cap` | `500` | How many holds a sync result lists in detail; storage is never capped and valid files always import. || `sync.hold_escalate_count` / `sync.hold_escalate_pct` | `50` / `5` | A source holding more files, or a run holding more than that share of at least 40 screened imports, reports `holds_escalated` and doctor `git_held_files` fails. || `sync.parser_regression` | `stop` | `hold` holds a file whose exact bytes imported under an earlier gbrain (`parser_regression`) instead of stopping the run with `sync_parser_regression`. |@@ -11260,7 +11201,7 @@ repository). See the `frontmatter-guard` skill.### FrontmatterA file whose YAML frontmatter gbrain cannot read without guessing is held by-sync instead of blocking it (#5988), and some files import only after gbrain+sync instead of blocking it, and some files import only after gbrainquotes an unquoted value. `gbrain repair frontmatter` fixes those files ondisk and imports them. It also finds pages an older import stored wrong: abody that begins with its own frontmatter block, or a title derived from the@@ -11454,10 +11395,12 @@ Exit status: `0` when no automatically repairable finding remains and no stepfailed, even if operator-required, explicit-only or unsupported findingsremain (they are listed); `1` when a repairable finding remains, a step failed, or the budgetran out; `2` when the score target is unreachable and there was no repair step-to run, or a resume was refused. `healthy` is true only when every wave check-is clean; `repairs_completed` counts the repair steps that finished.+to run, or a resume was refused. `healthy` is true only when every recovery+check is clean after the run; `repairs_completed` counts the repair steps that finished.++## Recover after an upgrade-## Recover after upgrading to this release+<a id="recover-after-upgrading-to-this-release"></a>**Say to your agent:** *"We just upgraded gbrain. Check what needs repair andwalk me through it before changing anything."*@@ -11480,19 +11423,19 @@ walk me through it before changing anything."*<a id="repair-upgrade-symptoms"></a>-| Symptom or error text | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- |-| Sync `BLOCKED` on one file (`Invalid YAML frontmatter`, a frontmatter slug conflict, `Content too large`); after upgrading, sync prints `Held <path>: …`; doctor `git_held_files` or `frontmatter_repairable` warns; the upgrade banner prints `frontmatter_holds:` | #5988 | `gbrain sources status <source>`, then `gbrain repair frontmatter --source <source>` (add `--include-ambiguous` for interpretations) | nothing to unblock: the next sync converts the blocked request in place (`gbrain sync --source <source> --no-pull` does it now); for the backlog, the printed `gbrain repair frontmatter … --apply --expect <hash> --yes` ([held files](#held-files)) | `gbrain doctor --only git_held_files,frontmatter_repairable --json` (both ok) | brain host; the repair apply after the user agrees | `destructive` (repair apply rewrites the previewed lines) |-| Tag, timeline or take writes fail with `writer_coordinator_required` or `storage_error: Publication failed (P0001)` on a managed brain; sync ends `PARTIAL` at a tagged page | #5983 | `gbrain doctor --json` (`schema_version` is 197 or later) | the original `gbrain sync --source <source> … --no-pull --retry-failed --json`, then `gbrain extract --stale --source-id <source>` and `gbrain extract timeline --source db --source-id <source>`, then `gbrain facts relink --source <source> --dry-run` (paid tier only after the user agrees), then `gbrain repair failed-writes --source <source>` and, after the user agrees, its printed `--apply --expect <hash>` | `gbrain sources status` shows the new `last_commit`; a second `gbrain extract timeline --source db` run adds no rows; a second `gbrain repair failed-writes` preview lists nothing to replay | brain host; the replay apply after the user agrees | paid (relink tier), destructive (replay apply) |-| Sync `BLOCKED` with `checkpoint_validation_timeout` | #5762 | `gbrain doctor` (`persistence_request_indexes`) | `gbrain repair request-indexes --apply` when an index is missing or INVALID, then the printed `gbrain sync --source <source> --no-pull --retry-failed …` | `gbrain doctor --only persistence_request_indexes --json` reports `ok`; `gbrain sources status` shows the new `last_commit` | brain host | none |-| Doctor `persistence_request_indexes` warns | #5762 | `gbrain repair request-indexes` | `gbrain repair request-indexes --apply` | `gbrain doctor --only persistence_request_indexes --json` | brain host | none |-| Doctor `persistence_request_growth` warns | #5751, #5762 | `gbrain doctor --json` | the printed `gbrain config set persistence.limits.<limit> <value>` | `gbrain doctor --only persistence_request_growth --json` | brain host | none |-| Working-tree sync prints `legacy file(s) skipped … no contextual retrieval mode` | #5751 | `gbrain repair contextual-mode` | `gbrain repair contextual-mode --apply` | the next `gbrain sync --working-tree` no longer prints the line | brain host, after the user agrees | none |-| Working-tree sync prints `legacy file(s) skipped … not valid UTF-8` | #5751 | `find <checkout> -name '*.md' ! -exec iconv -f UTF-8 -t UTF-8 -o /dev/null {} \; -print` | re-save each listed file as UTF-8 | the next `gbrain sync --working-tree` no longer prints the line | user (re-saves the files) | none |-| Doctor `google_file_modes` warns, or the upgrade printed `[google] Google source <id> keeps its files in <dir>, outside ~/.gbrain` | #5080 | `gbrain repair google-file-modes --source <id>` | `gbrain repair google-file-modes --source <id> --apply` | `gbrain doctor --only google_file_modes --json` (`google_file_modes` ok) | brain host, after the user agrees | none |-| Recall or hot memory returns facts from gbrain's own claude-cli sessions or from pasted text; doctor `captured_facts_active` warns; the upgrade banner prints `captured_facts_active: N (explicit_kind_required; …)` | #5812, #5820 | `gbrain repair captured-facts` (add `--include-ambiguous` to include paste candidates) | `gbrain repair captured-facts --apply --expect <hash>` with the hash that preview printed | `gbrain doctor --only captured_facts_active --json` (`captured_facts_active` ok) | brain host, after the user agrees | `destructive` (quarantines facts) |-| A finished promise still shows on entity cards and in recall after its loop was closed; doctor `loop_facts_drift` warns; the upgrade banner prints `loop_facts_drift: N (explicit_kind_required; …)` | #5869 | `gbrain repair loop-facts` | `gbrain repair loop-facts --apply --expect <hash>` | `gbrain doctor --only loop_facts_drift --json` (`loop_facts_drift` ok) | brain host, after the user agrees | `destructive` (retires facts) |-| `gbrain upgrade` refuses with `requires Bun >=<floor>` (exit 78), or doctor `self_upgrade_health` says `Auto-upgrade to <target> held` | #5855 | `bun --version` | `bun upgrade`, then `gbrain upgrade` ([Bun floor](upgrades-auto-update.md#bun-floor)) | `gbrain --version` shows the target; `gbrain doctor --only self_upgrade_health --json` (`self_upgrade_health` ok) | user | `persistent_install` |+| Symptom or error text | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- |+| Sync `BLOCKED` on one file (`Invalid YAML frontmatter`, a frontmatter slug conflict, `Content too large`); after upgrading, sync prints `Held <path>: …`; doctor `git_held_files` or `frontmatter_repairable` warns; the upgrade banner prints `frontmatter_holds:` | `gbrain sources status <source>`, then `gbrain repair frontmatter --source <source>` (add `--include-ambiguous` for interpretations) | nothing to unblock: the next sync converts the blocked request in place (`gbrain sync --source <source> --no-pull` does it now); for the backlog, the printed `gbrain repair frontmatter … --apply --expect <hash> --yes` ([held files](#held-files)) | `gbrain doctor --only git_held_files,frontmatter_repairable --json` (both ok) | brain host; the repair apply after the user agrees | `destructive` (repair apply rewrites the previewed lines) |+| Tag, timeline or take writes fail with `writer_coordinator_required` or `storage_error: Publication failed (P0001)` on a managed brain; sync ends `PARTIAL` at a tagged page | `gbrain doctor --json` (`schema_version` is 197 or later) | the original `gbrain sync --source <source> … --no-pull --retry-failed --json`, then `gbrain extract --stale --source-id <source>` and `gbrain extract timeline --source db --source-id <source>`, then `gbrain facts relink --source <source> --dry-run` (paid tier only after the user agrees), then `gbrain repair failed-writes --source <source>` and, after the user agrees, its printed `--apply --expect <hash>` | `gbrain sources status` shows the new `last_commit`; a second `gbrain extract timeline --source db` run adds no rows; a second `gbrain repair failed-writes` preview lists nothing to replay | brain host; the replay apply after the user agrees | paid (relink tier), destructive (replay apply) |+| Sync `BLOCKED` with `checkpoint_validation_timeout` | `gbrain doctor` (`persistence_request_indexes`) | `gbrain repair request-indexes --apply` when an index is missing or INVALID, then the printed `gbrain sync --source <source> --no-pull --retry-failed …` | `gbrain doctor --only persistence_request_indexes --json` reports `ok`; `gbrain sources status` shows the new `last_commit` | brain host | none |+| Doctor `persistence_request_indexes` warns | `gbrain repair request-indexes` | `gbrain repair request-indexes --apply` | `gbrain doctor --only persistence_request_indexes --json` | brain host | none |+| Doctor `persistence_request_growth` warns | `gbrain doctor --json` | the printed `gbrain config set persistence.limits.<limit> <value>` | `gbrain doctor --only persistence_request_growth --json` | brain host | none |+| Working-tree sync prints `legacy file(s) skipped … no contextual retrieval mode` | `gbrain repair contextual-mode` | `gbrain repair contextual-mode --apply` | the next `gbrain sync --working-tree` no longer prints the line | brain host, after the user agrees | none |+| Working-tree sync prints `legacy file(s) skipped … not valid UTF-8` | `find <checkout> -name '*.md' ! -exec iconv -f UTF-8 -t UTF-8 -o /dev/null {} \; -print` | re-save each listed file as UTF-8 | the next `gbrain sync --working-tree` no longer prints the line | user (re-saves the files) | none |+| Doctor `google_file_modes` warns, or the upgrade printed `[google] Google source <id> keeps its files in <dir>, outside ~/.gbrain` | `gbrain repair google-file-modes --source <id>` | `gbrain repair google-file-modes --source <id> --apply` | `gbrain doctor --only google_file_modes --json` (`google_file_modes` ok) | brain host, after the user agrees | none |+| Recall or hot memory returns facts from gbrain's own claude-cli sessions or from pasted text; doctor `captured_facts_active` warns; the upgrade banner prints `captured_facts_active: N (explicit_kind_required; …)` | `gbrain repair captured-facts` (add `--include-ambiguous` to include paste candidates) | `gbrain repair captured-facts --apply --expect <hash>` with the hash that preview printed | `gbrain doctor --only captured_facts_active --json` (`captured_facts_active` ok) | brain host, after the user agrees | `destructive` (quarantines facts) |+| A finished promise still shows on entity cards and in recall after its loop was closed; doctor `loop_facts_drift` warns; the upgrade banner prints `loop_facts_drift: N (explicit_kind_required; …)` | `gbrain repair loop-facts` | `gbrain repair loop-facts --apply --expect <hash>` | `gbrain doctor --only loop_facts_drift --json` (`loop_facts_drift` ok) | brain host, after the user agrees | `destructive` (retires facts) |+| `gbrain upgrade` refuses with `requires Bun >=<floor>` (exit 78), or doctor `self_upgrade_health` says `Auto-upgrade to <target> held` | `bun --version` | `bun upgrade`, then `gbrain upgrade` ([Bun floor](upgrades-auto-update.md#bun-floor)) | `gbrain --version` shows the target; `gbrain doctor --only self_upgrade_health --json` (`self_upgrade_health` ok) | user | `persistent_install` |**Say to your agent:** *"After the upgrade, preview the captured-facts andloop-facts repairs and tell me what each would expire before applying@@ -11508,7 +11451,7 @@ A line that says `Unknown:` means the check could not run; it is not a cleanresult. 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)+### Upgrading to v0.60.30.0**Say to your agent:** *"We upgraded gbrain to v0.60.30.0. Preview theunlinked facts relink and the link re-derivation for each source, and tell me@@ -11520,25 +11463,25 @@ worker so they run the new code, then work through what applies:<a id="repair-recall-symptoms"></a>-| Symptom | Check or code | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- | --- |-| "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 | brain host, after the user agrees | none |-| 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` | agent, after the user agrees | `paid` (capped by `--max-usd`) |-| `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 | agent | none |-| 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 | agent | none |-| 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 | agent, after the user agrees | `paid` |-| 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 | brain host | none |-| 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` | agent, after the user agrees | `destructive` (forgets the fact) |+| Symptom | Check or code | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- | --- |+| "Who invested in X?" or "Who attended <meeting>?" finds nobody; meeting attendance edges point meeting -> person, or notes-only mentions are typed attended | none | `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 | brain host, after the user agrees | none |+| Facts saved without an entity are missing from entity recall and skipped as `no_entity` by the conflict sweep | doctor `unlinked_facts` | `gbrain facts relink --dry-run` | `gbrain facts relink` (model tier capped by `--max-usd`, default $1.00) | `gbrain doctor` (`unlinked_facts`); `gbrain decide status` | agent, after the user agrees | `paid` (capped by `--max-usd`) |+| `remember` answers `warnings: ["NO_ENTITY"]` | none | 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 | agent | none |+| A CLI write on PGLite pauses for up to 30 s, then fails lock-busy | lock busy | none | wait for the other CLI call, or stop the long-running non-serve holder (for example a jobs daemon) | re-run the write | agent | none |+| The next `gbrain eval suspected-contradictions` estimates a full re-judge | none | the printed cost estimate | run it after you agree (judge prompt v3 invalidated the cache once) | the run reports judged pairs | agent, after the user agrees | `paid` |+| Hybrid search on Postgres returns keyword-only results or hits the vector timeout | doctor `vector_plan` | `gbrain doctor` | upgrade and restart; to roll back: `gbrain config set search.vector_legacy_guard true`, then restart serve and autopilot | `gbrain doctor` shows `vector_plan` ok | brain host | none |+| Facts about you that came from pasted text or from gbrain's own claude-cli calls | doctor `self_capture` | `gbrain recall` for the fact | `gbrain forget <fact id>`; doctor `self_capture` prints one-time quarantine commands for old self-capture files | `gbrain doctor` | agent, after the user agrees | `destructive` (forgets the fact) |<a id="fix-wave-5"></a>-### Upgrading to v0.60.28.0 (fix wave 5)+### Upgrading to v0.60.28.0**Say to your agent:** *"We upgraded gbrain to v0.60.28.0. Restart everythingthat runs it, then walk me through what doctor finds, in order, beforechanging anything."*-Most wave 5 fixes take effect only in a process that runs the new binary, so-restart first. `gbrain sources writer status --json` lists, in+Most of these fixes take effect only in a process that runs v0.60.28.0 or+later, so restart first. `gbrain sources writer status --json` lists, in`writer_versions[]`, the latest version each host and principal was seenwriting with in the retained requests. That is history, not proof: an idleolder `gbrain serve` never shows up there. Restart in this order:@@ -11575,38 +11518,38 @@ Then recover what doctor names, in this order (skip a step whose check is ok):<a id="repair-runtime-symptoms"></a>-| Symptom | Check or code | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- | --- |-| synthesize fails every run; `POST /ingest` 409 (was 500); workers refuse to start with "legacy jobs have missing or unsupported authority" | `legacy_job_authority` / `permission_denied` ([legacy job authority](#legacy-job-authority)) | #5157, #5114 | stop `gbrain serve`, autopilot and workers; `gbrain jobs cancel <active id>`; `gbrain jobs authorize-legacy --select "status=waiting\|delayed\|waiting-children\|paused"` | `gbrain jobs authorize-legacy --select "<same filter>" --expect <hash> --yes`, then restart | `gbrain doctor` shows `legacy_job_authority` ok; `/ingest` returns 202 | brain host, after the user agrees | `paid` (authorizes legacy jobs) |-| Search returns atoms quoting text a page no longer has, or atoms of deleted pages | doctor `atom_provenance_drift` | #5770 | `gbrain repair stale-atoms --source <id>` | `gbrain repair stale-atoms --source <id> --apply --expect <hash>` | `gbrain doctor` (`atom_provenance_drift` drops by the retired count) | brain host, after the user agrees | `destructive` (removes stale atoms) |-| `sources add`, `claim`, `rebind`, `archive`, `remove`, clone, reclone or `sources writer transfer` on a repo with more than ~10k files fails with "The verified source manifest exceeds the 1 MiB administration metadata bound" | `request_too_large` | #5790 | none: upgrade and restart every writer host and resident `gbrain serve` | Re-run the failed command (with the same `--request-id` if you kept it) | `gbrain sources writer status --json` shows the source bound, and its `manifest_digest` is set | agent | none |-| A stdio agent bound with `GBRAIN_SOURCE` (or `.gbrain-source`) gets `permission_denied` naming the binding when it passes `source_id` | `permission_denied` (hint starts "This connection is bound to source …") | #5081 | `gbrain sources list` (the source must show `federated`, not `isolated` or `unset`) | `gbrain sources federate <id>` on the brain host | Repeat the read with `source_id: "<id>"`; it returns only that source's rows. See [explicit reads from a bound agent connection](multi-source-brains.md#explicit-reads-from-a-bound-agent-connection) | brain host, after the user agrees | none |-| A new session's start-up context showed another session's text (`Last session activity: …`) | none | #5558 | none | Upgrade the `gbrain` each harness runs its hooks with and restart the harness. If you set `GBRAIN_HOOKS=0` as a workaround, remove it from the environment the harness starts from (shell profile or service) and restart the harness again | A new session shows no `Last session activity` line, and `gbrain doctor` reports `bootstrap_hooks_heartbeat` again after a few turns (capture and session persistence are back) | user (upgrades and restarts the harness) | `persistent_install` |-| `connect --harness codex\|claude-code\|opencode --install` stored the bearer token inline in the harness config without telling you | receipt `token_storage: "inline"` | #5775 | On the brain host: `gbrain mcp admin invalidate-tokens <client_id> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json` (only if the config file was exposed) | `gbrain mcp admin invalidate-tokens <client_id> --yes --if-version <revision> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json`, then `gbrain connect <mcp_url> --harness <harness> --credentials-file <handoff> --install --fresh-token`, then reload the harness | The new receipt prints `token_storage`, `config_path`, `renew_command` and `if_exposed`, and the harness answers a memory round trip | brain host, after the user agrees | `credentials` (invalidates tokens) |-| A second brain's autopilot replaced the first one's job, logs interleave in `~/.gbrain/autopilot.log`, or `gbrain autopilot --status --json` shows `job.needs_reinstall: "legacy_shared_job"` (or `"wrapper_missing"` after moving a brain); install refuses with `autopilot_job_owned_by_other_brain` | `gbrain autopilot --status --json` (`job.*`) / `autopilot_job_owned_by_other_brain` | #5195 | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` | `GBRAIN_HOME=<brain parent> gbrain autopilot --install` (every non-default brain first, then the default brain) | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` shows `job.needs_reinstall: null` and the brain's own `launchd_label` / `systemd_unit`. See [several brains on one host](live-sync.md#several-brains-on-one-host) | brain host, after the user agrees | `persistent_install` |-| `gbrain serve` started in a `.gbrain-mount` project: CLI writes fail `owner_unavailable` and MCP writes stay `queued` | `owner_unavailable` | #5237 | none | Upgrade and restart the resident `gbrain serve` (the harness that spawns it) | `gbrain sources writer status --probe --json` from the project answers | user (upgrades and restarts the harness) | `persistent_install` |-| Backup coverage reports `remote evidence: unavailable` for a private remote that is pushed | doctor `backup_coverage` | #5794 | none | Upgrade, then `gbrain backup check` | `gbrain backup status --json` shows `verification.state: "verified"`; see [remote unavailable](../operations/backup-check.md#remote-unavailable) | agent, after the user agrees | `persistent_install` (upgrade) |-| On Windows, a write or `gbrain sync` refuses a colon slug such as `calendar:abc` | [`colon_slug_windows_write_through`](write-refusals.md#colon_slug_windows_write_through) | #5032 | none | Use a slug without `:`, or write the page from a macOS or Linux host that owns the source | The write succeeds, or `gbrain sync` no longer lists the file | agent | none |-| Search empty or incomplete after upgrading; doctor `text_projection_readiness` warns | `text_projection_readiness` | #5401 | `gbrain doctor` (pending count, also while a PGLite resident runs) | `gbrain projections drain` (Postgres, or PGLite with no resident); on PGLite with a resident, wait or stop, drain and restart per [projection owner resident](#projection-owner-resident) | `gbrain doctor` shows `text_projection_readiness` ok | brain host | none |-| `Error [projection_owner_resident]` from `gbrain projections drain` (exit 2) | [`projection_owner_resident`](#projection-owner-resident) | #5401 | `gbrain doctor` | the printed stop, drain and restart commands | `gbrain doctor` | brain host | none |-| `[gbrain] warning: OPENAI_API_KEY in this process's environment differs from openai_api_key …`; doctor `embedding_key_source` warns | `embedding_key_source` ([provider key source](#embedding-key-source)) | #5137 | `gbrain doctor` (`embedding_key_source`) | remove the variable and restart that process, or `gbrain config unset openai_api_key` | the warning no longer prints; `gbrain doctor` shows `embedding_key_source` ok | user (owns the key) | `credentials` |-| `The OpenAI embedding provider rejected its key (HTTP 401)` | [`embedding_auth_failed`](write-refusals.md#embedding_auth_failed) | #5137 | `gbrain doctor` (`embedding_key_source`, `embedding_provider`) | the printed fix for the key source in effect, then `gbrain embed --stale` | `gbrain doctor` shows `embedding_provider` ok | user (owns the key) | `credentials`; `paid` for `embed --stale` |-| Conversation facts missing from recall after managed writes | `extractor_facts_expired` | #5731 | `gbrain repair extractor-facts` | `gbrain repair extractor-facts --apply --expect <hash>` (ambiguous: add `--include-ambiguous` to both) | `gbrain doctor` | brain host, after the user agrees | `destructive` (rewrites expired facts) |---### Symptoms from the lifecycle fixes in v0.60.20.0+| Symptom | Check or code | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- | --- |+| synthesize fails every run; `POST /ingest` returns 409 (500 on an older gbrain); workers refuse to start with "legacy jobs have missing or unsupported authority" | `legacy_job_authority` / `permission_denied` ([legacy job authority](#legacy-job-authority)) | stop `gbrain serve`, autopilot and workers; `gbrain jobs cancel <active id>`; `gbrain jobs authorize-legacy --select "status=waiting\|delayed\|waiting-children\|paused"` | `gbrain jobs authorize-legacy --select "<same filter>" --expect <hash> --yes`, then restart | `gbrain doctor` shows `legacy_job_authority` ok; `/ingest` returns 202 | brain host, after the user agrees | `paid` (authorizes legacy jobs) |+| Search returns atoms quoting text a page no longer has, or atoms of deleted pages | doctor `atom_provenance_drift` | `gbrain repair stale-atoms --source <id>` | `gbrain repair stale-atoms --source <id> --apply --expect <hash>` | `gbrain doctor` (`atom_provenance_drift` drops by the retired count) | brain host, after the user agrees | `destructive` (removes stale atoms) |+| `sources add`, `claim`, `rebind`, `archive`, `remove`, clone, reclone or `sources writer transfer` on a repo with more than ~10k files fails with "The verified source manifest exceeds the 1 MiB administration metadata bound" | `request_too_large` | none: upgrade and restart every writer host and resident `gbrain serve` | Re-run the failed command (with the same `--request-id` if you kept it) | `gbrain sources writer status --json` shows the source bound, and its `manifest_digest` is set | agent | none |+| A stdio agent bound with `GBRAIN_SOURCE` (or `.gbrain-source`) gets `permission_denied` naming the binding when it passes `source_id` | `permission_denied` (hint starts "This connection is bound to source …") | `gbrain sources list` (the source must show `federated`, not `isolated` or `unset`) | `gbrain sources federate <id>` on the brain host | Repeat the read with `source_id: "<id>"`; it returns only that source's rows. See [explicit reads from a bound agent connection](multi-source-brains.md#explicit-reads-from-a-bound-agent-connection) | brain host, after the user agrees | none |+| A new session's start-up context showed another session's text (`Last session activity: …`) | none | none | Upgrade the `gbrain` each harness runs its hooks with and restart the harness. If you set `GBRAIN_HOOKS=0` as a workaround, remove it from the environment the harness starts from (shell profile or service) and restart the harness again | A new session shows no `Last session activity` line, and `gbrain doctor` reports `bootstrap_hooks_heartbeat` again after a few turns (capture and session persistence are back) | user (upgrades and restarts the harness) | `persistent_install` |+| `connect --harness codex\|claude-code\|opencode --install` stored the bearer token inline in the harness config without telling you | receipt `token_storage: "inline"` | On the brain host: `gbrain mcp admin invalidate-tokens <client_id> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json` (only if the config file was exposed) | `gbrain mcp admin invalidate-tokens <client_id> --yes --if-version <revision> --url <mcp_url> --admin-token-file <owner-admin-token-file> --json`, then `gbrain connect <mcp_url> --harness <harness> --credentials-file <handoff> --install --fresh-token`, then reload the harness | The new receipt prints `token_storage`, `config_path`, `renew_command` and `if_exposed`, and the harness answers a memory round trip | brain host, after the user agrees | `credentials` (invalidates tokens) |+| A second brain's autopilot replaced the first one's job, logs interleave in `~/.gbrain/autopilot.log`, or `gbrain autopilot --status --json` shows `job.needs_reinstall: "legacy_shared_job"` (or `"wrapper_missing"` after moving a brain); install refuses with `autopilot_job_owned_by_other_brain` | `gbrain autopilot --status --json` (`job.*`) / `autopilot_job_owned_by_other_brain` | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` | `GBRAIN_HOME=<brain parent> gbrain autopilot --install` (every non-default brain first, then the default brain) | `GBRAIN_HOME=<brain parent> gbrain autopilot --status --json` shows `job.needs_reinstall: null` and the brain's own `launchd_label` / `systemd_unit`. See [several brains on one host](live-sync.md#several-brains-on-one-host) | brain host, after the user agrees | `persistent_install` |+| `gbrain serve` started in a `.gbrain-mount` project: CLI writes fail `owner_unavailable` and MCP writes stay `queued` | `owner_unavailable` | none | Upgrade and restart the resident `gbrain serve` (the harness that spawns it) | `gbrain sources writer status --probe --json` from the project answers | user (upgrades and restarts the harness) | `persistent_install` |+| Backup coverage reports `remote evidence: unavailable` for a private remote that is pushed | doctor `backup_coverage` | none | Upgrade, then `gbrain backup check` | `gbrain backup status --json` shows `verification.state: "verified"`; see [remote unavailable](../operations/backup-check.md#remote-unavailable) | agent, after the user agrees | `persistent_install` (upgrade) |+| On Windows, a write or `gbrain sync` refuses a colon slug such as `calendar:abc` | [`colon_slug_windows_write_through`](write-refusals.md#colon_slug_windows_write_through) | none | Use a slug without `:`, or write the page from a macOS or Linux host that owns the source | The write succeeds, or `gbrain sync` no longer lists the file | agent | none |+| Search empty or incomplete after upgrading; doctor `text_projection_readiness` warns | `text_projection_readiness` | `gbrain doctor` (pending count, also while a PGLite resident runs) | `gbrain projections drain` (Postgres, or PGLite with no resident); on PGLite with a resident, wait or stop, drain and restart per [projection owner resident](#projection-owner-resident) | `gbrain doctor` shows `text_projection_readiness` ok | brain host | none |+| `Error [projection_owner_resident]` from `gbrain projections drain` (exit 2) | [`projection_owner_resident`](#projection-owner-resident) | `gbrain doctor` | the printed stop, drain and restart commands | `gbrain doctor` | brain host | none |+| `[gbrain] warning: OPENAI_API_KEY in this process's environment differs from openai_api_key …`; doctor `embedding_key_source` warns | `embedding_key_source` ([provider key source](#embedding-key-source)) | `gbrain doctor` (`embedding_key_source`) | remove the variable and restart that process, or `gbrain config unset openai_api_key` | the warning no longer prints; `gbrain doctor` shows `embedding_key_source` ok | user (owns the key) | `credentials` |+| `The OpenAI embedding provider rejected its key (HTTP 401)` | [`embedding_auth_failed`](write-refusals.md#embedding_auth_failed) | `gbrain doctor` (`embedding_key_source`, `embedding_provider`) | the printed fix for the key source in effect, then `gbrain embed --stale` | `gbrain doctor` shows `embedding_provider` ok | user (owns the key) | `credentials`; `paid` for `embed --stale` |+| Conversation facts missing from recall after managed writes | `extractor_facts_expired` | `gbrain repair extractor-facts` | `gbrain repair extractor-facts --apply --expect <hash>` (ambiguous: add `--include-ambiguous` to both) | `gbrain doctor` | brain host, after the user agrees | `destructive` (rewrites expired facts) |+++### Upgrading to v0.60.20.0<a id="repair-migration-symptoms"></a>-| Symptom or error text | Issue | Preview | Apply | Verify | Who acts | Consent |-| --- | --- | --- | --- | --- | --- | --- |-| `gbrain upgrade` said the upgrade failed, or migrations ran twice | #5693 | `gbrain apply-migrations --list` | `gbrain apply-migrations --yes` | `gbrain doctor --only minions_migration --json` (`minions_migration` ok) | agent, after the user agrees | none |-| `another apply-migrations is running (host …, pid …)` | #5693 | `gbrain doctor` | wait, then `gbrain apply-migrations --yes` | `gbrain apply-migrations --list` | agent | none |-| doctor `orphan_persistence_bindings`; a re-added source fails with `writer_coordinator_required` | #5732 | `gbrain repair orphan-bindings` | `gbrain repair orphan-bindings --apply` | `gbrain doctor` | brain host, after the user agrees | none |-| doctor `stale_embedding_effects`; `writer_not_quiesced` names an embedding effect | #5629, #5734 | `gbrain repair embedding-effects --source <id>` | `gbrain repair embedding-effects --source <id> --apply` | `gbrain doctor` (pending until the owner run commits a `retry_queued` effect) | brain host, after the user agrees | none |-| autopilot never syncs a connector, or prints `has never synced` | #5673 | `gbrain sources status <id>` | `gbrain sync --source <id>` once | `gbrain sources status <id>` | agent | `egress` (fetches from the provider) |-| a connector source keeps a stale `local_path` | #5673 | `gbrain sources list` | `gbrain sources set-path <id> --clear` | `gbrain sources list` | agent, after the user agrees | none |-| classic writes refused after leaving managed mode, or `local_markers: pending` | #5628 | `gbrain sources writer deactivate --dry-run` | see the [deactivate runbook](../architecture/topologies.md#deactivate-runbook) | `gbrain sources writer status` on every host | brain host, after the user agrees | none |+| Symptom or error text | Preview | Apply | Verify | Who acts | Consent |+| --- | --- | --- | --- | --- | --- |+| `gbrain upgrade` said the upgrade failed, or migrations ran twice | `gbrain apply-migrations --list` | `gbrain apply-migrations --yes` | `gbrain doctor --only minions_migration --json` (`minions_migration` ok) | agent, after the user agrees | none |+| `another apply-migrations is running (host …, pid …)` | `gbrain doctor` | wait, then `gbrain apply-migrations --yes` | `gbrain apply-migrations --list` | agent | none |+| doctor `orphan_persistence_bindings`; a re-added source fails with `writer_coordinator_required` | `gbrain repair orphan-bindings` | `gbrain repair orphan-bindings --apply` | `gbrain doctor` | brain host, after the user agrees | none |+| doctor `stale_embedding_effects`; `writer_not_quiesced` names an embedding effect | `gbrain repair embedding-effects --source <id>` | `gbrain repair embedding-effects --source <id> --apply` | `gbrain doctor` (pending until the owner run commits a `retry_queued` effect) | brain host, after the user agrees | none |+| autopilot never syncs a connector, or prints `has never synced` | `gbrain sources status <id>` | `gbrain sync --source <id>` once | `gbrain sources status <id>` | agent | `egress` (fetches from the provider) |+| a connector source keeps a stale `local_path` | `gbrain sources list` | `gbrain sources set-path <id> --clear` | `gbrain sources list` | agent, after the user agrees | none |+| classic writes refused after leaving managed mode, or `local_markers: pending` | `gbrain sources writer deactivate --dry-run` | see the [deactivate runbook](../architecture/topologies.md#deactivate-runbook) | `gbrain sources writer status` on every host | brain host, after the user agrees | none |`orphan-bindings` and `embedding-effects` also run under `gbrain repair --all`and `gbrain doctor --remediate --include-repairs`; `embedding-effects` is paid@@ -11619,7 +11562,7 @@ work when it queues a retry. Retry commands: `gbrain sources writer retry-effect`gbrain doctor` reports `self_capture` when the dream session corpus(`dream.synthesize.session_corpus_dir`) still holds files captured from-gbrain's own `claude-cli` sessions (#5413). Dream and the sweep already skip+gbrain's own `claude-cli` sessions. Dream and the sweep skipthe ones they can identify, but nothing removes them. The check never movesor deletes files. It lists what it classified (a harness transcript under agbrain scratch project matches the file) and counts what it cannot decide (no@@ -11649,7 +11592,7 @@ activation. Settle it."*`gbrain doctor` reports `stale_embedding_effects` when a committed write stillhas an embedding effect that is queued an hour later with no consumer claiming-it (#5629), or that failed (#5734, for example after a provider outage). Either+it, or that failed (for example after a provider outage). Eitherone keeps the write receipt from compacting and blocks activation with`writer_not_quiesced`. Preview, then apply after you agree, on the brain host:@@ -11675,7 +11618,7 @@ covers the whole retry budget each grant authorizes. A resumed run replays thegrant it already made instead of granting another cycle. A signature-mismatchedvector is never reconciled; it is re-embedded.-## Wave 5 refusal codes+## Repair refusal codesEach heading below is the `docs` anchor a refusal carries.@@ -11717,7 +11660,7 @@ applies to `gbrain jobs authorize-legacy --select`, `gbrain jobs cancel### Legacy job authority`permission_denied` with this anchor means a queued job row has SQL NULL-`submission_authority`, left by an upgrade across v0.50 (#5157, #5114).+`submission_authority`, left by an upgrade across v0.50.- A resubmission over a **dead or cancelled** legacy key releases the key andqueues a fresh job. No step needed.@@ -11771,11 +11714,11 @@ message lists the valid statuses, and the hint is a complete example.`projection_owner_resident` (exit 2): `gbrain projections drain` did not runbecause a gbrain process (named with its pid) holds this PGLite brain. Nothing-changed. The upgraded resident drains the queue itself; re-run `gbrain doctor`+changed. The resident drains the queue itself; re-run `gbrain doctor`to watch the pending count in `text_projection_readiness` (doctor asks theresident over its local socket, so the count shows while the resident runs; a-resident that does not answer may predate this release and should be restarted-on the upgraded gbrain).+resident that does not answer runs an older gbrain, so restart it on the+current version).To drain faster, stop the owner, drain, then restart it. The restart runswhether or not the drain failed:@@ -11798,7 +11741,7 @@ follows `GBRAIN_AUTOPILOT_LABEL` when set.- [Write refusal reasons](write-refusals.md) — what a refused write means and the recovery command- [Concurrent writes and durable receipts](concurrent-writes.md) — receipts, retries and capacity limits-- [v0.60.5.0 upgrade steps](../../skills/migrations/v0.60.5.0.md) — the backup-first upgrade that introduced these repairs+- [v0.60.5.0 upgrade steps](../../skills/migrations/v0.60.5.0.md) — backup-first upgrade steps for a brain older than v0.60.5.0- [Topologies: claim and activate runbook](../architecture/topologies.md#claim-and-activate-runbook) — quiescence checklist, the writer admin lock---diff --git a/llms.txt b/llms.txtindex 15a9d7e9c0..32447f3102 100644--- a/llms.txt+++ b/llms.txt@@ -31,14 +31,14 @@ Repo: https://github.com/garrytan/gbrain- [docs/ENGINES.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/ENGINES.md): PGLite vs Postgres trade-off and when to migrate.- [docs/GBRAIN_RECOMMENDED_SCHEMA.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/GBRAIN_RECOMMENDED_SCHEMA.md): MECE directory structure (people/, companies/, concepts/).-- [docs/what-schemas-unlock.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/what-schemas-unlock.md): Why schemas matter: 7 killer use cases (4000 invisible meetings, founder ops brain, research brain, legal brain, team brain, agent-as-co-curator) + the structural argument for typed page kinds. Read this before pitching schema authoring (v0.40.7.0).-- [docs/schema-author-tutorial.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/schema-author-tutorial.md): 5-minute walkthrough: fork the bundled pack, add a custom `researcher` type, backfill existing pages via `gbrain schema sync --apply`, prove the T1.5 wiring via `gbrain whoknows` (v0.40.7.0).+- [docs/what-schemas-unlock.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/what-schemas-unlock.md): Why schemas matter: 7 killer use cases (4000 invisible meetings, founder ops brain, research brain, legal brain, team brain, agent-as-co-curator) + the structural argument for typed page kinds. Read this before pitching schema authoring.+- [docs/schema-author-tutorial.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/schema-author-tutorial.md): 5-minute walkthrough: fork the bundled pack, add a custom `researcher` type, backfill existing pages via `gbrain schema sync --apply`, prove the T1.5 wiring via `gbrain whoknows`.- [docs/guides/system-one.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/system-one.md): System One decision support (TypeSafe Jev or an llm: provider): every slot off or on, executed quickstart (`gbrain decide probe`, `probe --query`, `enable --recommended`, `status`), each slot in plain words, calibration and qualification, fail directions, egress rules, reading status/doctor, receipts, troubleshooting by refusal reason.- [docs/guides/live-sync.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/live-sync.md): Incremental markdown sync setup.- [docs/guides/cron-schedule.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/cron-schedule.md): Recurring job scheduling.- [docs/guides/minions-deployment.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/minions-deployment.md): Deploying the gbrain jobs worker: crontab + watchdog, inline --follow, systemd/Procfile/fly.toml, upgrade checklist.- [docs/guides/quiet-hours.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/quiet-hours.md): Notification hold + timezone-aware delivery.-- [docs/guides/scaling-skills.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/scaling-skills.md): Three-tier architecture for agents with 300+ skills: always-loaded, resolver-routed, and dormant. Per-turn token math, the v0.41.7.0 compact list-format resolver, and the `gbrain doctor` safety net. 306 skills, ~21K tokens freed per turn, zero capability loss.+- [docs/guides/scaling-skills.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/scaling-skills.md): Three-tier architecture for agents with 300+ skills: always-loaded, resolver-routed, and dormant. Per-turn token math, the compact list-format resolver, and the `gbrain doctor` safety net. 306 skills, ~21K tokens freed per turn, zero capability loss.- [docs/guides/life-chronicle.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/life-chronicle.md): Life Chronicle automatic event extraction (on by default): what qualifies, per-page cost and daily ceiling, privacy, the receipt -> `gbrain dream --phase chronicle` -> `gbrain day` check, skip/failure codes with fixes, opt-out `gbrain config set auto_chronicle false`, history backfill.- [docs/guides/push-context.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/push-context.md): Push-based context: the brain volunteers confidence-gated pages from the rolling conversation window. Three channels (ambient reflex, volunteer_context op, gbrain watch), config knobs, and the volunteered-vs-used feedback loop.- [docs/evidence-delivery.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/evidence-delivery.md): Evidence delivery (`return_unit`): window / section / page / auto evidence instead of chunks on search, query, recall and think, packed into a token budget; response fields, fallback codes, authorization guarantees, latency, and the frozen-hit `assemble_evidence` interface for evals.@@ -56,7 +56,7 @@ Repo: https://github.com/garrytan/gbrain- [docs/GBRAIN_VERIFY.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/GBRAIN_VERIFY.md): Post-setup verification checks for the capabilities you enabled. When a gbrain call fails or something feels off, start with docs/protocol/AGENT_OPERATOR_v1.md, then run these checks.- [docs/guides/troubleshooting.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/troubleshooting.md): Symptom table with who acts, consent and a read-only verify step per row, then the long-form fixes.- [docs/guides/error-codes.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/error-codes.md): Generated: every error code with meaning, why, next step, who acts and consent, verify, exit code and retryability. Offline: `gbrain errors <code>`.-- [docs/guides/exit-codes.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/exit-codes.md): Exit statuses (3 = confirmation_required only, 10 pending write, 11 resumable budget stop) and what changed in this release.+- [docs/guides/exit-codes.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/exit-codes.md): Exit statuses (3 = confirmation_required only, 10 pending write, 11 resumable budget stop) and what the agent does on each.- [docs/guides/minions-fix.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/minions-fix.md): Troubleshooting the Minions job queue.- [docs/guides/repair.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/repair.md): `gbrain repair <kind>`: dry run vs --apply, --source/--limit/--json, resume, capacity stop, thin-client refusal, what each kind fixes and costs; held files walkthrough (sync holds a broken file, `gbrain repair frontmatter` two-pass preview and apply).- [docs/guides/write-refusals.md](https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/write-refusals.md): Refusal reasons (file_database_drift, ambiguous_source_path, physical_root_device_changed, cursor_processing_options_conflict, take_row_collision, invalid_source_uri, queue_capacity, parked effects) and held-file content refusals (invalid_frontmatter and its reasons, frontmatter_slug_conflict, file_too_large, content_rejected, rename_held, sync_parser_regression) with the exact recovery command. Every refusal's `docs` field links its row directly.diff --git a/scripts/llms-config.ts b/scripts/llms-config.tsindex bd4c9b4f40..5de99f1198 100644--- a/scripts/llms-config.ts+++ b/scripts/llms-config.ts@@ -126,13 +126,13 @@ export const SECTIONS: DocSection[] = [// headroom, so this value-explainer rides the single-fetch bundle again.title: "docs/what-schemas-unlock.md",description:- "Why schemas matter: 7 killer use cases (4000 invisible meetings, founder ops brain, research brain, legal brain, team brain, agent-as-co-curator) + the structural argument for typed page kinds. Read this before pitching schema authoring (v0.40.7.0).",+ "Why schemas matter: 7 killer use cases (4000 invisible meetings, founder ops brain, research brain, legal brain, team brain, agent-as-co-curator) + the structural argument for typed page kinds. Read this before pitching schema authoring.",path: "docs/what-schemas-unlock.md",},{title: "docs/schema-author-tutorial.md",description:- "5-minute walkthrough: fork the bundled pack, add a custom `researcher` type, backfill existing pages via `gbrain schema sync --apply`, prove the T1.5 wiring via `gbrain whoknows` (v0.40.7.0).",+ "5-minute walkthrough: fork the bundled pack, add a custom `researcher` type, backfill existing pages via `gbrain schema sync --apply`, prove the T1.5 wiring via `gbrain whoknows`.",path: "docs/schema-author-tutorial.md",},{@@ -172,7 +172,7 @@ export const SECTIONS: DocSection[] = [{title: "docs/guides/scaling-skills.md",description:- "Three-tier architecture for agents with 300+ skills: always-loaded, resolver-routed, and dormant. Per-turn token math, the v0.41.7.0 compact list-format resolver, and the `gbrain doctor` safety net. 306 skills, ~21K tokens freed per turn, zero capability loss.",+ "Three-tier architecture for agents with 300+ skills: always-loaded, resolver-routed, and dormant. Per-turn token math, the compact list-format resolver, and the `gbrain doctor` safety net. 306 skills, ~21K tokens freed per turn, zero capability loss.",path: "docs/guides/scaling-skills.md",},{@@ -257,7 +257,7 @@ export const SECTIONS: DocSection[] = [},{title: "docs/guides/exit-codes.md",- description: "Exit statuses (3 = confirmation_required only, 10 pending write, 11 resumable budget stop) and what changed in this release.",+ description: "Exit statuses (3 = confirmation_required only, 10 pending write, 11 resumable budget stop) and what the agent does on each.",path: "docs/guides/exit-codes.md",},{diff --git a/scripts/structural-suites.tsv b/scripts/structural-suites.tsvindex a11ae084a4..91af9af8a5 100644--- a/scripts/structural-suites.tsv+++ b/scripts/structural-suites.tsv@@ -3,6 +3,7 @@# Fix misclassifications in the classifier, never by hand-editing rows.# Columns: file suite cases detectortest/agent-install.test.ts (file-level) 10 readFileSync+test/agent-journey-upgrade.serial.test.ts (1) existing scripts after the upgrade 3 readFileSynctest/agent-register.test.ts PGLite integration (pre-flight → tx → audit → exchange) 3 readFileSynctest/agent-register.test.ts resolvePreset 7 readFileSynctest/agent-register.test.ts structural guards 2 readFileSyncdiff --git a/src/core/error-docs.ts b/src/core/error-docs.tsindex 9170898cf7..f3365d4d41 100644--- a/src/core/error-docs.ts+++ b/src/core/error-docs.ts@@ -95,14 +95,14 @@ export function renderErrorCodesMarkdown(): string {'Every gbrain error carries a stable `code`. Read `code` first and fall back to `error`','(older servers send only `error`); then follow `fix.next` as described in','[AGENT_OPERATOR_v1](../protocol/AGENT_OPERATOR_v1.md). Exit codes are in [exit codes](exit-codes.md).',- 'Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the renamed codes.',+ 'Offline, `gbrain errors <code>` prints the same row and `gbrain errors --changed` the legacy pairs.','','**Say to your agent:** *"gbrain returned an error code I don\'t recognize. Look it up and tell me what to do."*','',- '## Renamed in this release',+ '## Legacy `error` values','',- 'Under contract v1 an existing `error` value never changes. Where a surface historically sent a',- 'different value, it keeps sending it in `error` and adds the canonical value in `code`.',+ 'Under contract v1 an `error` value never changes. Where a surface sends a legacy value in',+ '`error`, it also sends the canonical value in `code`:','','| `error` (frozen) | `code` (canonical) | Meaning |','|---|---|---|',diff --git a/src/core/error-registry.ts b/src/core/error-registry.tsindex 1ff419a60e..2a789918c2 100644--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@ -35,7 +35,7 @@ export interface CodeEntry {fix?: Action;effects?: readonly Effect[];actor?: Actor;- /** The code this one replaced (documented in error-codes.md "Renamed in this release"). */+ /** The code this one replaced (documented in error-codes.md "Legacy `error` values"). */renamed_from?: string;/** Frozen v1 `error` wire value some sites keep for this canonical code. */legacy_error?: string;diff --git a/test/agent-journey-upgrade.serial.test.ts b/test/agent-journey-upgrade.serial.test.tsindex 5eca0b99be..f136e95df5 100644--- a/test/agent-journey-upgrade.serial.test.ts+++ b/test/agent-journey-upgrade.serial.test.ts@@ -127,7 +127,13 @@ function splitArgs(command: string): string[] {return i < 0 ? command.split(' ') : [...command.slice(0, i).split(' '), command.slice(i + 1)];}-/** Rows of docs/guides/exit-codes.md "Changed in this release" this file proves on the real CLI. */+/** The v0.60.46.0 CHANGELOG section that starts at `heading`, up to the next release heading. */+function changelogSection(heading: string): string {+ const after = readFileSync(join(REPO, 'CHANGELOG.md'), 'utf8').split(heading)[1] ?? '';+ return after.split('\n## [')[0];+}++/** Rows of the CHANGELOG "Exit code changes by command" table this file proves on the real CLI. */const RENUMBERED: Record<string, { now: number; docRow: string }> = {'sources remove default --json': { now: 2, docRow: '`gbrain sources remove default` / `gbrain sources archive default`' },};@@ -154,7 +160,7 @@ describe('(1) existing scripts after the upgrade', () => {}, 300_000);test('the renumbered exits are the documented ones, on every lane that reaches them', async () => {- const changed = readFileSync(join(REPO, 'docs', 'guides', 'exit-codes.md'), 'utf8').split('## Changed in this release')[1] ?? '';+ const changed = changelogSection('#### Exit code changes by command');for (const { now, docRow } of Object.values(RENUMBERED)) expect(changed).toContain(`| ${docRow} | 3 | ${now} |`);expect(changed).toContain('| `gbrain call` invalid parameters | 1 | 2 |');@@ -188,7 +194,7 @@ describe('(2) scheduled jobs: cron and autopilot invocations, non-TTY', () => {beforeAll(async () => { h = await upgradedBrain('upgrade-cron'); }, 180_000);test('the one listed flip: doctor --remediate with runnable work now stops for consent (exit 3, nothing submitted)', async () => {- const table = readFileSync(join(REPO, 'docs', 'protocol', 'AGENT_OPERATOR_v1.md'), 'utf8').split('## Behavior changes for scripts and agents')[1] ?? '';+ const table = changelogSection('### Behavior changes for scripts and agents');expect(table).toContain('| `gbrain doctor --remediate` without a terminal | ran paid and mutating work');const r = await run(h, ['doctor', '--remediate', '--target-score', '30', '--json']);expect(r.exitCode, r.stdout + r.stderr).toBe(3);diff --git a/test/exit-codes.test.ts b/test/exit-codes.test.tsindex bb278fc076..30f932a095 100644--- a/test/exit-codes.test.ts+++ b/test/exit-codes.test.ts@@ -76,9 +76,10 @@ describe('exit code table', () => {expect(offenders).toEqual([]);});- test('the exit-codes guide documents every value', () => {+ test('the exit-codes guide documents every value; the CHANGELOG carries the contract v1 exit changes', () => {const doc = readFileSync(join(ROOT, 'docs/guides/exit-codes.md'), 'utf8');for (const v of [0, 1, 2, 3, 10, 11, 75, 124, 130]) expect(doc).toContain(`| ${v} |`);- expect(doc).toContain('## Changed in this release');+ expect(doc).toContain('CHANGELOG.md#exit-code-changes-by-command');+ expect(readFileSync(join(ROOT, 'CHANGELOG.md'), 'utf8')).toContain('#### Exit code changes by command');});});