Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs: user guides for the GBRA-35 wave 2 fixes (D1)

garrytan244a70076812
diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.md
index 49559bd8fa..1a585a8b81 100644
--- a/INSTALL_FOR_AGENTS.md
+++ b/INSTALL_FOR_AGENTS.md
@@ -525,21 +525,21 @@ DB-only export, explicit regrants, parent/client reconnection, and native
verification are separate stages; report pending stages rather than claiming
the whole migration completed.
-For memory-only upgrades, keep services and paid reindexing opt-in. If you
-installed via `bun install -g`:
+For memory-only upgrades, keep services and paid reindexing opt-in. The same
+command works for `bun install -g` and `git clone + bun link` installs:
```bash
GBRAIN_NO_AUTOPILOT_INSTALL=1 GBRAIN_NO_REEMBED=1 gbrain upgrade --no-autopilot-install
```
-If you installed via `git clone + bun link`:
-
-```bash
-cd ~/gbrain && git pull --ff-only origin master
-GBRAIN_NO_AUTOPILOT_INSTALL=1 bun install
-gbrain apply-migrations --yes --no-autopilot-install
-GBRAIN_NO_REEMBED=1 gbrain post-upgrade --no-autopilot-install
-```
+On a clone it fetches, checks the new release's Bun floor, fast-forwards to
+exactly the checked commit and runs `bun install`; a bare `git pull` skips the
+check and can leave a release the host's Bun cannot start. When the floor is
+above the host's Bun, the upgrade refuses with `requires Bun >=<floor>` and
+changes nothing (exit 78): run `bun upgrade`, then the same upgrade command
+again. Pass `--no-bun-floor-check` only after checking the target yourself
+when the floor cannot be read (offline). See
+[Bun floor](docs/guides/upgrades-auto-update.md#bun-floor).
The autopilot opt-out skips installation and service rewrites, including package
postinstall hooks; it does not skip other migrations. Keep the environment form
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index c9d21e1ce9..d052cc9a04 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -52,10 +52,12 @@ GBRAIN_NO_AUTOPILOT_INSTALL=1 GBRAIN_NO_REEMBED=1 gbrain upgrade --no-autopilot-
The autopilot opt-out reaches package postinstall hooks and migration
orchestrators, and skips existing service-unit rewrites. Other migrations still
run. `GBRAIN_NO_REEMBED=1` independently skips potentially paid reindexing.
-For a clone linked with Bun, use `git pull --ff-only`, then
-`GBRAIN_NO_AUTOPILOT_INSTALL=1 bun install`,
-`gbrain apply-migrations --yes --no-autopilot-install`, and
-`GBRAIN_NO_REEMBED=1 gbrain post-upgrade --no-autopilot-install`.
+The same command upgrades a clone linked with Bun: it fetches, checks the new
+release's Bun floor, fast-forwards to the checked commit and runs
+`bun install`. Avoid a bare `git pull`, which skips that check. When the new
+release needs a newer Bun, `gbrain upgrade` refuses and changes nothing (exit
+78): run `bun upgrade`, then the upgrade again
+([Bun floor](guides/upgrades-auto-update.md#bun-floor)).
Verify a known keyword result, saved fact and process reopen after upgrading.
See the [agent upgrade steps](../INSTALL_FOR_AGENTS.md#upgrade).
diff --git a/docs/guides/ambient-writeback.md b/docs/guides/ambient-writeback.md
index 5a86720da8..67142f40a3 100644
--- a/docs/guides/ambient-writeback.md
+++ b/docs/guides/ambient-writeback.md
@@ -124,7 +124,10 @@ bank remains harmless — the target serve's own DB gate decides.
again. The provider also starts its `claude` child with your Claude Code
hooks disabled, and the serve-side harvest and the sweep skip any such
file an older binary left behind. `gbrain doctor` (`self_capture`) lists
- leftover files with one-time quarantine commands.
+ leftover files with one-time quarantine commands, and
+ `captured_facts_active` counts facts already extracted from such sessions;
+ `gbrain repair captured-facts` previews and expires them
+ ([repair guide](repair.md#captured-facts)).
## Pasted content
@@ -144,8 +147,12 @@ captured as a fact about you.
`gbrain transcripts ingest`, ambient recall and the dream `synthesize`
phase (which writes idea pages, not facts about you) still see the pasted
text with its tags.
-- **Repair.** Facts extracted from pastes before this release stay until you
- remove them. Find one with `gbrain recall`, then withdraw it with
+- **Repair.** Facts extracted from pastes by releases before v0.60.30.0 stay
+ active until removed. `gbrain repair captured-facts --include-ambiguous`
+ lists likely paste-derived facts (a word-overlap heuristic against the
+ retained session corpus) and expires the previewed set only with
+ `--apply --expect <hash>` ([repair guide](repair.md#captured-facts)). For a
+ single fact, find it with `gbrain recall` and withdraw it with
`gbrain forget <fact-id> --reason "came from a pasted email"`.
To keep something you pasted, save it explicitly with its provenance:
@@ -275,12 +282,20 @@ retention are deleted, so a keyless brain — or one whose serve AND sweep
stayed away for a month — does eventually shed unbanked turns; serve restarts
reset the counter). Keyless brains skip extraction entirely (typed `keyless` skip)
and still get agent-authored `remember` writes; note that keyless dedup is
-degraded (`degraded_dedup`) — near-duplicate phrasings may insert. See
+degraded (`degraded_dedup`) — near-duplicate phrasings may insert. The
+maintenance sweep's corpus pass costs one call per transcript window (see
+[Long transcripts](#long-transcripts-windowed-extraction)). See
[spend-controls](../operations/spend-controls.md) for the brain-wide
extraction switches.
### Long transcripts: windowed extraction
+**Say to your agent:** *"How much of my long sessions has the sweep
+extracted?"* (the agent runs `gbrain sweep --once --json` and reads
+`corpus_files[]`) or *"Lower how many transcript windows the sweep extracts at
+once."* (the agent sets `GBRAIN_CORPUS_WINDOWS_PER_SWEEP` for the process that
+runs the sweep).
+
The extractor reads at most 8,000 characters per call, so the maintenance
sweep reads a session transcript in windows cut at turn boundaries. Each
window carries its `[user]` or `[assistant]` label, and pasted blocks are
@@ -298,8 +313,9 @@ the process that runs the sweep (`gbrain serve` or `gbrain sweep --once`) to
change the 32-window total; the per-file cap of 8 is fixed. The off switch
for all of this is the brain-wide `facts.extraction_enabled`. `gbrain sweep
--once --json` lists `corpus_files[]` with `windows_done` and
-`windows_remaining` per file. Transcripts marked done before this release are
-not re-read; only turns added after the upgrade are extracted.
+`windows_remaining` per file. Transcripts marked done before windowed
+extraction existed are not re-read; only turns added after the upgrade are
+extracted, so their tails past the first 8,000 characters stay unextracted.
## Diagnostics
@@ -314,8 +330,15 @@ lingering instruction blocks and warns — the off switch is incomplete until a
`bootstrap harness` re-run converges them. It also reports 7-day counters —
`remember` outcomes over MCP (all callers — the
wire cannot distinguish ambient from explicit saves) and persisted backstop
-results from the serve-side harvest receipts. Counters are local, append-only,
-loss-tolerant observability — never a source of truth.
+results from the serve-side harvest receipts, plus the capture dedup totals
+`cross_lane_duplicates_7d` and `near_duplicates_shadow_7d` (see
+[Duplicates across lanes](#duplicates-across-lanes)). Counters are local,
+append-only, loss-tolerant observability — never a source of truth.
+
+Two neighbouring checks cover capture residue: `self_capture` counts corpus
+files from gbrain's own claude-cli sessions, and `captured_facts_active`
+counts facts captured before v0.60.30.0 from those sessions or from pasted
+text (cleared by `gbrain repair captured-facts`).
## Enable / verify / disable
diff --git a/docs/guides/google-connect.md b/docs/guides/google-connect.md
index 5fb23d9b67..0b1fabb395 100644
--- a/docs/guides/google-connect.md
+++ b/docs/guides/google-connect.md
@@ -159,6 +159,42 @@ deep backfill carries on. A thread that keeps failing is held (see
source synced after its first sync; a source that has never synced stays idle
until you run `gbrain sync --source <id>` once.
+### What runs on synced mail and calendar pages
+
+**Say to your agent:** *"Make sure my Gmail threads are checked for open loops
+and linked to the people in them"* or *"Also extract atoms from my email and
+calendar pages."*
+
+- **Links and timelines.** Every autopilot or dream cycle extracts links and
+ timeline entries for connector pages straight from the database (a connector
+ source has no checkout), source-scoped and bounded by the cycle's 3-minute
+ stale-drain budget; a large backlog finishes over later cycles. The cycle
+ reports `extract: ok` with `database_only: true`. On demand:
+ `gbrain extract --stale`.
+- **Open loops.** Every Gmail sweep queues commitment extraction for the
+ threads it touched, on managed and unmanaged brains. The sync result carries
+ `loops_enqueue` (`enqueued`, `deferred`, `skipped_reason`), and every skip is
+ logged with its reason (extraction off, no chat model, the enqueue ceiling).
+ On a managed brain the first sweep also runs a one-time catch-up over email
+ threads whose newest message is from the last 30 days, so threads synced
+ before extraction was queued are analyzed once; it finishes over later
+ sweeps when the enqueue ceiling binds.
+- **Quiet threads.** A thread still inside its waiting window (24 h for
+ inbound, 72 h for your own question) is re-checked when the window ends,
+ even if no new mail arrives, and opens its loop then. See
+ [open loops](open-loops.md#quiet-threads-and-grace-holds).
+- **Atoms (opt-in).** Atom extraction skips Gmail threads and Calendar events
+ until you opt in with `gbrain config set cycle.extract_atoms.connector_pages
+ true`. After that, the text of each extracted email thread or calendar event
+ is sent to the configured `extract_atoms` model under the daily auto-drain
+ cap. `gbrain config set cycle.extract_atoms.connector_pages false` stops new
+ extraction. Caps, the off switch and exactly what leaves the machine:
+ [spend controls](../operations/spend-controls.md#atom-extraction-auto-drain-cap-and-connector-pages).
+
+`gbrain doctor`'s `orphan_ratio` reports orphaned email and meeting renders of
+a connector source apart (`connector_renders_excluded`), since a mail page
+with no links is normal, and leaves them out of the ratio.
+
### Rate limits during backfill
A large mailbox backfilling a wide `--history-days` window can trip Gmail's
@@ -313,6 +349,10 @@ upstream failures rather than triggering a full re-list.
capped per sweep) to your configured chat provider. Kill switch:
`gbrain config set loops.extraction_enabled false`. The deterministic
unanswered-thread detector is free and always on.
+- Atom extraction from email and calendar pages is off until you run
+ `gbrain config set cycle.extract_atoms.connector_pages true`; then page
+ text goes to the `extract_atoms` model under the auto-drain cap
+ ([spend controls](../operations/spend-controls.md#atom-extraction-auto-drain-cap-and-connector-pages)).
## File permissions
diff --git a/docs/guides/open-loops.md b/docs/guides/open-loops.md
index be1146a315..b6a56ff661 100644
--- a/docs/guides/open-loops.md
+++ b/docs/guides/open-loops.md
@@ -126,6 +126,34 @@ thread is a no-op and that key is the only dedupe in play. A generous safety
ceiling (500/sweep) remains purely as a spend backstop for pathological
sweeps; when it binds, the log names the drop honestly.
+The sweep queues extraction on managed and unmanaged brains alike. Its sync
+result carries `loops_enqueue` (`enqueued`, `deferred`, `skipped_reason`:
+`extraction_disabled`, `chat_unavailable`, `no_candidates` or
+`enqueue_failed`), and every skip is logged. On a managed brain a one-time
+catch-up also re-candidates email threads whose newest message is from the
+last 30 days. A thread counts as done only when the extractor recorded an
+outcome for its current revision (`extracted` or `skipped:<reason>`), so a
+thread whose job ran while extraction was off is analyzed later; a
+dead-lettered job is retried once. The catch-up honors the kill switch and
+the enqueue ceiling and marks itself done once every candidate is settled.
+
+### Quiet threads and grace holds
+
+A thread inside its waiting window (an inbound message under 24 h old, or
+your own question under 72 h) opens nothing yet. The sweep records a **grace
+hold** with the time the window ends and re-checks the thread on the first
+sweep after that time, even when no new mail arrives: an unchanged thread
+opens its loop from the stored page without a Gmail read, and a thread that
+changed or whose page is missing is re-fetched (at most 100 per sweep). A
+reply or a mute in the meantime means no loop opens. The first sweep after
+upgrading seeds holds for email pages active in the last 14 days from stored
+pages only, with no Gmail calls.
+
+Grace holds are kept apart from [held items](google-connect.md#held-items):
+they never appear in `connector_held_items`, never make `gbrain waiting`
+report partial coverage, and are capped at 2,000 per source (the oldest is
+dropped and logged).
+
## The surfaces
```bash
@@ -142,8 +170,8 @@ gbrain waiting [--top N] [--json] [--stale-ok]
coverage is partial instead of "You are clean".
gbrain loops list|show <id> inspect
-gbrain loops done <id> | drop <id> close (a closed commitment expires its
- projected fact too)
+gbrain loops done <id> | drop <id> close (a closed commitment retires its
+ projected fact too; see Close semantics)
gbrain loops mute sender <email> never open loops for this sender again
gbrain loops mute thread <id> ...or this thread (existing loops keep
their state)
@@ -215,6 +243,26 @@ carry additive optional fields (`direction`, `due`, `counterparty`,
same thread never resurrects a loop you closed by hand.
- Fulfillment-by-reply detection for commitments is future work, not
pretended at.
+- **Closing a commitment retires its fact.** `gbrain loops done`/`drop` and
+ the `loops_close` tool expire the commitment fact and strike its row in the
+ entity page's `## Facts` fence in one coordinated write, so entity cards
+ and recall stop showing the finished promise. A fact that another open loop
+ still references stays active until that loop closes too. The result
+ reports what actually happened: `{ closed, id, status, fact_expired,
+ retryable, reason? }`. `fact_expired: false, retryable: true` means the
+ loop closed but the fact retirement did not commit (`reason` names the
+ refusal); closing the same loop again retries it. `reason:
+ "shared_with_open_loop"` comes with `retryable: false`. No withdrawal is
+ recorded, so the same promise made again is stored normally.
+- **Loops closed before the fact was retired.** `gbrain doctor` reports them
+ as `loop_facts_drift`. Preview with `gbrain repair loop-facts`, then apply
+ the printed `gbrain repair loop-facts --apply --expect <hash>` after you
+ agree ([repair guide](repair.md#loop-facts)).
+
+**Say to your agent:** *"I finished the deck for Alice Example; close that
+loop."* (the agent runs `gbrain loops done <id>` and checks `fact_expired`) or
+*"Doctor says closed loops still have active commitments. Preview the fix."*
+(the agent runs `gbrain repair loop-facts`).
## Ranking
diff --git a/docs/guides/repair.md b/docs/guides/repair.md
index 0cdfbe16e5..8d702a7567 100644
--- a/docs/guides/repair.md
+++ b/docs/guides/repair.md
@@ -8,8 +8,8 @@ can load, and Google source files other local users can read. `gbrain repair`
fixes those and the other kinds listed in
[What each kind fixes](#what-each-kind-fixes). Every run is a preview unless
you pass `--apply`.
-Three explicit-only kinds, `google-file-modes`, `stale-atoms` and `extractor-facts`, run only when
-you name them (see [Explicit-only repair kinds](#explicit-only-repair-kinds)).
+Five explicit-only kinds, `google-file-modes`, `stale-atoms`, `extractor-facts`,
+`captured-facts` and `loop-facts`, run only when you name them (see [Explicit-only repair kinds](#explicit-only-repair-kinds)).
`gbrain doctor --remediation-plan` lists the same kinds as repair steps, and
`gbrain doctor --remediate --yes --include-repairs` runs them under a budget
(see [Run repairs through doctor](#run-repairs-through-doctor)).
@@ -99,8 +99,8 @@ gives each a fresh row number); it never deletes or rewrites a page.
| `--limit <n>` | Repair at most `n` items per kind in this run (a positive integer; with `--all`, up to `n` for each kind). Rerun the same command to continue. |
| `--no-embed` | `safe-chunks` and `contextual-mode`: skip the embedding provider. Run `gbrain embed --stale` later. `timeline` and `visibility` pages are re-embedded by their publication either way. |
| `--all` | Run every automatic kind in order. Explicit-only kinds are listed with their preview command, never run. |
-| `--expect <hash>` | Explicit-only kinds: apply exactly the set the preview printed under this hash. Required with `--apply` for `stale-atoms` and `extractor-facts`. |
-| `--include-ambiguous` | `extractor-facts` only: widen the hashed set to `ambiguous` facts. Pass it to both the preview and the apply. See [Extractor facts](#extractor-facts). |
+| `--expect <hash>` | Explicit-only kinds: apply exactly the set the preview printed under this hash. Required with `--apply` for `stale-atoms`, `extractor-facts`, `captured-facts` and `loop-facts`. |
+| `--include-ambiguous` | `extractor-facts` and `captured-facts` only: widen the hashed set to `ambiguous` facts. Pass it to both the preview and the apply. See [Extractor facts](#extractor-facts) and [Captured facts](#captured-facts). |
| `--json` | Print `{ scope, mode, results[], paid_kinds }`, one result per kind with `paid`, `affected`, `sample`, `residuals`, `cost`, `capacity`, `resumed_from`, `applied`, `skipped`, `complete`, `stopped` and `apply_command`, plus `explicit_kinds[]` when the run skipped explicit-only kinds. |
The command exits 1 when a run stops early (capacity, a pending write, or a
@@ -398,6 +398,78 @@ The preview warns, naming the host, when a consumer older than this release
published writes after `writer_version_cutoff`: an old consumer expires
restored 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
+explicit-only and preview-bound, and it runs on the brain host (it reads the
+Claude Code session directory and the session corpus there).
+
+**Say to your agent:** *"Doctor says some facts were captured from gbrain's own
+sessions or from pasted text. Show me which ones before removing anything."*
+The agent runs `gbrain repair captured-facts`, shows you the list and, after
+you agree, runs the printed apply command.
+
+```bash
+gbrain doctor # captured_facts_active
+gbrain repair captured-facts # preview: every candidate with its class
+gbrain repair captured-facts --apply --expect <hash>
+gbrain doctor
+```
+
+| Class | Meaning | Expired |
+| --- | --- | --- |
+| `evidenced` | The fact's session is one of gbrain's own claude-cli sessions: a harness transcript in a gbrain scratch project, or a corpus file `gbrain doctor` (`self_capture`) quarantined. | By `--apply --expect <hash>` |
+| `ambiguous` | A paste candidate: at least 60% of the fact's content words appear in the session's retained corpus file only inside pasted blocks. A heuristic, so it is listed in every preview but expired only on request. | Only with `--include-ambiguous` and that preview's hash |
+| `excluded:legitimate_duplicate` | The same claim and entity also has an active fact from another lane or an unsuspected session, so the claim is legitimate. | Never |
+
+Sessions that cannot be classified on this host (the harness transcript was
+pruned, the corpus file is gone) are counted as `unclassifiable` and kept.
+`captured_facts_active` counts facts; the `self_capture` check counts corpus
+files. Clear both: quarantine the files with the commands `self_capture`
+prints, then expire the facts here.
+
+The apply expires exactly the previewed set. A fact that changed since the
+preview reports `changed_since_preview` and stays active. A fact with a row in
+its entity page's `## Facts` fence is struck in the page (one revision-bound
+`put_page` per page, which re-embeds the page), so a later write of the page
+cannot reactivate it; a fact with no fence row expires database-only (one
+maintenance request per page on a managed brain). Nothing is withdrawn, so
+`gbrain remember` can save the same claim again.
+
+<a id="loop-facts"></a>
+### Loop facts
+
+Closing 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
+loop-facts` retires those facts. It is explicit-only and preview-bound.
+
+**Say to your agent:** *"Doctor says some closed loops still have an active
+commitment. Preview retiring those facts, then apply after I agree."* The agent
+runs `gbrain repair loop-facts` and, after you agree, the printed apply command.
+
+```bash
+gbrain doctor # loop_facts_drift
+gbrain repair loop-facts # preview: closed_loop_facts=N
+gbrain repair loop-facts --apply --expect <hash>
+gbrain doctor
+```
+
+Each candidate is a `done` or `dropped` loop whose commitment fact is active
+and lives in the loop's own source. A fact that another open loop still
+references is skipped (`shared_with_open_loop`); it is retired when the last
+loop that uses it closes. The apply expires the fact and strikes its fence row
+in one coordinated write, exactly for the previewed set; a loop or fact that
+changed since the preview reports `changed_since_preview` and is kept. No
+withdrawal is recorded, so the same promise made again is stored normally.
+
## Resume
Runs are resumable. After each page commits, the position is saved under the
@@ -574,6 +646,16 @@ walk me through it before changing anything."*
| 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 |
| 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 |
| 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` (`google_file_modes` ok) |
+| 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` (`captured_facts_active` ok) |
+| 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` (`loop_facts_drift` ok) |
+| `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` (`self_upgrade_health` ok) |
+
+**Say to your agent:** *"After the upgrade, preview the captured-facts and
+loop-facts repairs and tell me what each would expire before applying
+anything."* The agent runs `gbrain repair captured-facts` and `gbrain repair
+loop-facts`, shows you both lists, and after you agree runs each printed
+`--apply --expect <hash>` command. See [Captured facts](#captured-facts) and
+[Loop facts](#loop-facts).
Hosted and thin-client callers see the same checks in `gbrain remote doctor`
as one line each, for example
@@ -749,10 +831,10 @@ Each heading below is the `docs` anchor a refusal carries.
### Explicit-only repair kinds
-`google-file-modes`, `stale-atoms` and `extractor-facts` run only when named:
-`gbrain repair <kind>` previews, and `gbrain repair <kind> --apply` applies
-(`stale-atoms` and `extractor-facts` also need `--expect <hash>`, so they apply
-exactly the previewed set; `google-file-modes` re-checks each file's owner,
+`google-file-modes`, `stale-atoms`, `extractor-facts`, `captured-facts` and
+`loop-facts` run only when named: `gbrain repair <kind>` previews, and
+`gbrain repair <kind> --apply` applies (every kind but `google-file-modes`
+also needs `--expect <hash>`, so it applies exactly the previewed set; `google-file-modes` re-checks each file's owner,
type and mode at apply time). They are excluded everywhere else:
- `gbrain repair --all` (and `gbrain repair` with no kind) lists each with its
@@ -779,7 +861,8 @@ saved preview is older than 7 days, or the selection no longer matches it (for
"The preview changed since <hash>; re-run <preview command> and use the new
hash." Re-run the printed preview command and apply with the new hash. It
applies to `gbrain jobs authorize-legacy --select`, `gbrain jobs cancel
---select`, `gbrain repair stale-atoms` and `gbrain repair extractor-facts`.
+--select`, `gbrain repair stale-atoms`, `gbrain repair extractor-facts`,
+`gbrain repair captured-facts` and `gbrain repair loop-facts`.
### Legacy job authority
diff --git a/docs/guides/upgrades-auto-update.md b/docs/guides/upgrades-auto-update.md
index caf4476c9a..3f25495c91 100644
--- a/docs/guides/upgrades-auto-update.md
+++ b/docs/guides/upgrades-auto-update.md
@@ -59,6 +59,10 @@ hook into it.
### Bun floor
+**Say to your agent:** *"gbrain says the upgrade needs a newer Bun. Upgrade Bun
+and finish the gbrain upgrade."* The agent runs `bun upgrade`, then
+`gbrain upgrade`, then `gbrain doctor` to confirm `self_upgrade_health` is ok.
+
A source (bun-link) or package install runs the new release on the host's
Bun, and a release refuses to start on a Bun below its `engines.bun` floor.
So before swapping, `gbrain upgrade`, `gbrain self-upgrade` and the autopilot
@@ -105,8 +109,19 @@ start, the upgrade exits non-zero and prints recovery: `bun upgrade`, then
rolled back automatically, and the autopilot channel records that version as
failed.
-Hosts still running a release from before this check do not run it, so a Bun
-floor raise reaches them only after they have upgraded past this release.
+Recovery when autopilot is holding an upgrade:
+
+```bash
+gbrain doctor # self_upgrade_health: Auto-upgrade to <target> held: ...
+bun upgrade # raise the host's Bun to the floor or above
+gbrain upgrade # apply now instead of waiting for quiet hours
+gbrain doctor # self_upgrade_health ok
+```
+
+Restart `gbrain serve` and autopilot afterwards if a service manager does not
+restart them for you, so they run on the new Bun. Hosts still running a
+release from before this check do not run it, so a Bun floor raise reaches
+them only after they have upgraded past this release.
`gbrain config set self_upgrade.<key>` writes `~/.gbrain/config.json` (the
file plane every self-upgrade reader uses) and refuses a value the readers