Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

docs: point the operating lessons at commit-push, set-sync, cron_gbrain_home and the upgrade restart; CHANGELOG entry

garrytan579b6a76d36b
diff --git a/AGENTS.md b/AGENTS.md
index 9ef80d1827..e6b80cf8a7 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -168,8 +168,10 @@ writing or reviewing an operation, consult `src/core/operations.ts` for the cont
`no_brain` refusal then reads as "no results"), check the exit code, keep
hook output off stdout, allow at least 10 s per call, and never print the
process environment into a transcript. On a managed brain, schedule
- `gbrain sources refresh <id>` and never commit files into the checkout from a
- script. Wrapper and rules:
+ `gbrain sources refresh <id>`, and have scripts commit the files they write
+ with `gbrain git commit-push -- <paths>`, never plain `git commit`
+ (`gbrain doctor --only cron_gbrain_home` flags cron lines that skip the
+ wrapper). Wrapper and rules:
[cron-schedule.md](docs/guides/cron-schedule.md#calling-gbrain-unattended),
[scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout).
- **Delete or purge pages:** `gbrain delete --purge` skips the 72-hour soft
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f43fc07740..cdd6296ba4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,30 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.436.0] - 2026-10-24
+
+**The install and operating guides now cover what an agent running gbrain beside a harness (cron jobs, workspace scripts, hooks, a managed checkout, a remote Postgres) needs to get right the first time: one wrapper for every scheduled call, scripts that commit through gbrain, purge consent, exact-match identity, the database's region, and the attended upgrade order.**
+
+### What changed
+
+| Situation | Before | Now |
+|---|---|---|
+| A cron job, workspace script or hook calls gbrain | the guides showed bare `gbrain` lines; a job with another `HOME` found no database (every lookup silently empty) or acted as a second host (`refresh_not_owner`) | [cron-schedule.md](docs/guides/cron-schedule.md#calling-gbrain-unattended) gives one wrapper that sets `GBRAIN_HOME` (never `HOME`) and runs the installed binary, with rules for stderr, exit codes, clean `--json` stdout, timeouts of at least 10 s, quoted env files and never printing the environment; the cron-scheduler skill, INSTALL Step 7, AGENTS.md and the OpenClaw guide point at it |
+| A script writes files into a managed checkout | nothing said not to commit them with plain `git commit`, which made the checkout diverge and every refresh refuse `refresh_diverged` | [Scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout): commit with `gbrain git commit-push -- <paths>`, keep the checkout current with a scheduled `gbrain sources refresh <id>`, `gbrain sources set-sync <id> off` before rewriting a source's history, and decide what a `git_target_ignored` path is |
+| An agent purges pages | the data-loss gate covered `pages purge-deleted` but not `gbrain delete --purge` | `delete --purge` needs an explicit go for that purge ("scrub the repo" is not one), runs one page at a time with each removal verified, and a stopped batch stays stopped |
+| A write exits 10 | the meaning lived only in the exit-code table | AGENTS.md says next to exit 3 that 10 is accepted and still pending, never "not found" or "failed" |
+| An agent resolves an email sender or attendee to a person page | the briefing, meeting-ingestion and executive-assistant guides took the first search hit | only an exact frontmatter email or an exact title match counts ([identity rule](skills/conventions/brain-first.md#identity-exact-match)) |
+| Choosing or switching the brain's Postgres | no guidance on region or on proving a switch | INSTALL puts the database in the agent host's region and lists every URL variable to change, the restart and the database-side proof |
+| Upgrading an always-on host | no order for autopilot and running jobs | pause autopilot, wait for a quiet queue, `gbrain upgrade` (which restarts and verifies), check every process, resume; production brains follow the stable channel |
+| OpenClaw's `openclaw doctor --fix` removes the rendered `HEARTBEAT.md` | nothing said what to do | INSTALL Step 6 explains how to restore it until the render adapts (#7470) |
+
+The troubleshooting table gains eight symptom rows for these cases, and the v0.60.427.0 entry now names `gbrain sources writer retry-effects`.
+
+### What to watch for after you upgrade
+
+- Nothing changes in gbrain's behavior: this is documentation and bundled skills only. Nothing is rewritten on upgrade, and there is no schema migration.
+- Harnesses that copied the cron-scheduler, data-loss-gate, gbrain-upgrade, briefing or meeting-ingestion skills pick up the new rules on their next skill sync.
+
## [0.60.434.0] - 2026-10-24
**Each darwin native-locks cell now ends its own heartbeat status in `success`. Before, one slow post could leave it `pending` on a green job. Two drain-governor tests no longer fail when a loaded runner stalls the event loop.**
diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.md
index b3ec4cb450..ed160199f3 100644
--- a/INSTALL_FOR_AGENTS.md
+++ b/INSTALL_FOR_AGENTS.md
@@ -588,10 +588,12 @@ timeout of at least 10 s. The wrapper and its rules:
- **Managed brain checkout** (every 15 min, on the owner host):
`gbrain sources refresh <id>` is the only sanctioned fast-forward; it drains
- writes, fast-forwards and re-syncs. Scripts save pages through
- `put_page`/`capture`, never by writing and committing files in the
- checkout: an unpushed local commit makes the checkout diverge and every
- refresh refuse `refresh_diverged`
+ writes, fast-forwards and re-syncs. Scripts commit the files they write
+ with `gbrain git commit-push -- <paths>` (or save pages through
+ `put_page`/`capture`), never with plain `git commit`: an unpublished local
+ commit makes the checkout diverge and every refresh refuse
+ `refresh_diverged`. `gbrain doctor --only cron_gbrain_home` flags cron
+ lines that skip the wrapper
([scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout)).
- **Workers**: start `gbrain jobs supervisor` with `--max-rss <MB>`; with
`--job-isolation process` the cap also covers each job child's process tree
@@ -702,10 +704,14 @@ verification are separate stages; report pending stages rather than claiming
the whole migration completed.
On a host with resident processes (autopilot, a jobs worker, a serve), pause
-autopilot (`gbrain autopilot pause`), wait until no job is active, upgrade
-every install, restart every gbrain process and verify that each reports the
-new version, then `gbrain autopilot resume`
-([the order](skills/gbrain-upgrade/SKILL.md#always-on-hosts-pause-drain-upgrade-verify-resume)).
+autopilot (`gbrain autopilot pause`), wait until no job is active, run
+`gbrain upgrade` on every install (it restarts every gbrain process onto the
+new build and verifies one build runs, or refuses `restart_refused` naming the
+process it cannot restart), check that each process reports the new version,
+then `gbrain autopilot resume`. A production brain follows the stable channel
+(`gbrain config set self_upgrade.channel stable`)
+([the order](skills/gbrain-upgrade/SKILL.md#always-on-hosts-pause-drain-upgrade-verify-resume),
+[stable channel](docs/guides/upgrades-auto-update.md#stable-channel)).
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:
diff --git a/docs/guides/cron-schedule.md b/docs/guides/cron-schedule.md
index 713cae990e..8c38f2ec88 100644
--- a/docs/guides/cron-schedule.md
+++ b/docs/guides/cron-schedule.md
@@ -159,8 +159,12 @@ Rules for the wrapper and everything that calls it:
On a managed brain the same wrapper runs `gbrain-run sources refresh <id>` on
a schedule ([the managed cron line](../../skills/cron-scheduler/SKILL.md#managed-brain)).
-Scripts never write files and `git commit` straight into the managed checkout;
-see [shared-checkout git](shared-checkout-git.md#scripts-and-the-managed-checkout).
+Scripts commit the files they write with `gbrain git commit-push -- <paths>`,
+never plain `git commit`, in the managed checkout; see
+[shared-checkout git](shared-checkout-git.md#scripts-and-the-managed-checkout).
+`gbrain doctor --only cron_gbrain_home --json` reads the crontab and the scripts
+it names and warns about a line that runs `src/cli.ts` straight from a checkout,
+or calls gbrain without the brain's `GBRAIN_HOME`.
### Quiet Hours Gate (MANDATORY)
diff --git a/docs/guides/shared-checkout-git.md b/docs/guides/shared-checkout-git.md
index d5f7cf5013..97b49c637e 100644
--- a/docs/guides/shared-checkout-git.md
+++ b/docs/guides/shared-checkout-git.md
@@ -230,32 +230,37 @@ On a managed brain the persistence owner is the only Git writer in the
canonical checkout, and `gbrain sources refresh` is the only way upstream
commits come in. Four rules keep that checkout able to move:
-1. **Scripts write through gbrain, never with `git commit`.** A cron job or
- hook that writes files into the checkout and commits them without pushing
- leaves commits the upstream lacks. The checkout diverges, and every later
- refresh refuses `refresh_diverged` and changes nothing. Save pages with
- `put_page`, `edit_page`, `remember` or `capture` (CLI calls go through
- the [one wrapper](cron-schedule.md#calling-gbrain-unattended)). On a classic
- shared checkout, commit with `gbrain git commit-push -- <paths>`.
+1. **Scripts commit through gbrain, never with plain `git commit`.** A cron
+ job or hook that writes files into the checkout and commits them with
+ plain git leaves commits the upstream lacks and nobody publishes. The
+ checkout diverges, and every later refresh refuses `refresh_diverged` and
+ changes nothing. Commit the files a script wrote with
+ `gbrain git commit-push -m "<msg>" -- <paths>`: on a managed worktree it
+ commits only those paths under the commit lock (`committed_local`) and the
+ owner publishes them on its next Git publish. Pages can also go through
+ `put_page`, `edit_page`, `remember` or `capture`. CLI calls go through
+ the [one wrapper](cron-schedule.md#calling-gbrain-unattended).
2. **Refresh on a schedule.** `gbrain sources refresh <id>` drains queued
writes, refuses new ones until it finishes, fast-forwards with
`git merge --ff-only` and re-syncs every source on the checkout; run it
from cron on the owner host
([cron line](../../skills/cron-scheduler/SKILL.md#managed-brain)).
- `refresh_diverged` means something commits outside gbrain:
+ `refresh_diverged` means something committed outside gbrain:
`git log --format='%h %an %ad %s' @{upstream}..HEAD` lists the stray
- commits, so find and fix that writer, then reconcile as the
- [refusal](write-refusals.md#refresh_diverged) says. Never force the
- checkout.
+ commits. Fix that writer first, then, after the user agrees, publish the
+ stray commits merged with the upstream
+ (`gbrain git commit-push --push-only --keep-checkout --path <checkout>`)
+ and retry the refresh, as the [refusal](write-refusals.md#refresh_diverged)
+ says. Never force the checkout.
3. **Stop syncing a source before rewriting its history.** Before a
- force-push or `git filter-repo`, take the source out of automatic sync
- (`syncEnabled: false` in its config, with the user's agreement; there is
- no CLI verb for it yet) and run `gbrain sources mirror-readonly <id>` so
- no managed write touches its checkout. A sync whose recorded base commit no
- longer exists makes sync and the maintenance cycle re-read the whole tree.
- After the rewrite, move the checkout onto the new history
+ force-push or `git filter-repo`, run `gbrain sources set-sync <id> off`
+ (with the user's agreement) so automatic sync skips it, and
+ `gbrain sources mirror-readonly <id>` so no managed write touches its
+ checkout. A sync whose recorded base commit no longer exists makes sync and
+ the maintenance cycle re-read the whole tree. After the rewrite, move the
+ checkout onto the new history
([upstream rewritten](troubleshooting.md#upstream-rewritten)), then
- `gbrain sources mirror-writable <id>` and turn sync back on.
+ `gbrain sources mirror-writable <id>` and `gbrain sources set-sync <id> on`.
4. **Decide what a gitignored path is.** A page whose file a `.gitignore`
rule excludes cannot be committed, so its Git effect parks at once as
`git_target_ignored` naming the rule (since v0.60.427.0). Either un-ignore
diff --git a/docs/guides/troubleshooting.md b/docs/guides/troubleshooting.md
index e1656c51b0..91852044ac 100644
--- a/docs/guides/troubleshooting.md
+++ b/docs/guides/troubleshooting.md
@@ -29,14 +29,14 @@
| A gbrain call failed with a code you don't recognize | follow `fix.next` ([protocol](../protocol/AGENT_OPERATOR_v1.md)); `gbrain errors <code>` | agent | as the fix's `consent` | the fix's `verify` |
| A graph read omits a relationship you know existed, or says someone still works somewhere they left | the default read returns relationships true today: repeat with `status: "all"` or `as_of`; to record an end, add a dated timeline line (`Ended works_at [[companies/x]]`) or `add_link ... valid_until` ([temporal edges](temporal-edges.md)) | agent | none | `gbrain doctor --only edge_validity --json` |
| A command exited 3 (`confirmation_required`) | relay `user_message`; run `fix.command` only after the user agrees | agent, after the user agrees | the payload's `effects` | the fix's `verify` |
-| A scheduled job, workspace script or hook finds nothing in the brain (every lookup empty), or its log shows `no_brain` or `GBRAIN_DB_ACCESS no_url`, while the same command works by hand | the job runs without the brain's config: call gbrain through one wrapper that sets `GBRAIN_HOME` and loads the brain's env file, and stop discarding its stderr ([the wrapper](cron-schedule.md#calling-gbrain-unattended)) | agent | none | the job's log shows results, and `gbrain engine status --json` run through the wrapper names the expected `db_url_source` |
+| A scheduled job, workspace script or hook finds nothing in the brain (every lookup empty), or its log shows `no_brain` or `GBRAIN_DB_ACCESS no_url`, while the same command works by hand | the job runs without the brain's config: call gbrain through one wrapper that sets `GBRAIN_HOME` and loads the brain's env file, and stop discarding its stderr ([the wrapper](cron-schedule.md#calling-gbrain-unattended)); `gbrain doctor --only cron_gbrain_home --json` names crontab lines that skip it | agent | none | the job's log shows results, and `gbrain engine status --json` run through the wrapper names the expected `db_url_source` |
| `gbrain sources refresh` refuses `refresh_not_owner` from cron or a script but works by hand | the caller resolves another gbrain home, so it is another host; the refusal names the identity file, `HOME` and `GBRAIN_HOME` it read. Set the owner's `GBRAIN_HOME` in the wrapper (not `HOME`, which also swaps git credentials); never copy or delete a `host.json` | agent | none | `gbrain sources refresh <id> --dry-run` through the wrapper |
-| `gbrain sources refresh` refuses `refresh_diverged` on every run | something commits into the managed checkout outside gbrain, usually a script that writes files and runs `git commit` without pushing. `git log @{upstream}..HEAD` names the commits; move that writer to `put_page` or `capture`, then reconcile as the [refusal](write-refusals.md#refresh_diverged) says; never force ([scripts and the managed checkout](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent; reconciling after the user agrees | `destructive` when reconciling drops local commits | `gbrain sources refresh <id> --dry-run` |
+| `gbrain sources refresh` refuses `refresh_diverged` on every run | something commits into the managed checkout outside gbrain, usually a script that writes files and runs `git commit` without pushing. `git log @{upstream}..HEAD` names the commits; move that writer to `gbrain git commit-push -- <paths>`, then publish the stray commits merged with the upstream (`gbrain git commit-push --push-only --keep-checkout --path <checkout>`) and retry, as the [refusal](write-refusals.md#refresh_diverged) says; never force ([scripts and the managed checkout](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent; reconciling after the user agrees | `destructive` when reconciling drops local commits | `gbrain sources refresh <id> --dry-run` |
| A `--json` caller fails to parse gbrain's output | something other than gbrain wrote to stdout, usually a wrapper or a hook it runs; send that output to a log file or stderr (gbrain's own notices already go to stderr) | agent | none | the same call piped to `jq .` parses |
| gbrain calls time out from a script or language runtime but finish by hand, or each search takes several seconds | a cold CLI start takes 3–6 s on a pooled Postgres brain: set caller timeouts of at least 10 s in both the shell and the runtime (a runtime exec timeout can override the shell's), and turn on the [warm CLI socket](cli-socket.md). If warm searches stay slow, measure the round trip to the database; one in another region dominates search time | agent; moving the database after the user agrees | none | `GBRAIN_DEBUG=1 gbrain search <query>` prints a `[cli-socket] warm:` line |
| After a database change some processes still use the old server, or a URL variable silently keeps its old value | a shell-sourced env file has an unquoted `&` (the assignment ends there), or a process kept the environment it started with. Quote every value, keep Postgres URLs to `?sslmode=require` (driver options as variables, such as `GBRAIN_PREPARE=false`), update every URL variable the tooling reads, restart every gbrain process, and prove the switch from the database side ([switching a database](../../INSTALL_FOR_AGENTS.md#switching-a-database)). Never paste `env` output into a transcript while debugging | agent, after the user agrees | none | a row written after the restart appears on the new server |
| Doctor `parked_effects` lists `git_target_ignored` effects | a `.gitignore` rule excludes those pages' files, so their Git effects cannot commit. The user decides: un-ignore (narrow the rule, commit it, then `gbrain sources writer retry-effects <source> --parked-code git_target_ignored`) or keep the pages database-only and leave the effects parked ([gitignored paths](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent, after the user decides | none | `gbrain sources writer status --source <id> --json` |
-| Sync and the maintenance cycle re-read a whole source on every run after its Git history was rewritten (force-push, `git filter-repo`) | the recorded base commit no longer exists. Move the checkout onto the new history ([upstream rewritten](#upstream-rewritten)); before the next rewrite, take the source out of automatic sync and run `gbrain sources mirror-readonly <id>` first | agent; the reset after the user agrees | `destructive` (the reset keeps a backup ref) | `gbrain doctor --only sync_failures --json` |
+| Sync and the maintenance cycle re-read a whole source on every run after its Git history was rewritten (force-push, `git filter-repo`) | the recorded base commit no longer exists. Move the checkout onto the new history ([upstream rewritten](#upstream-rewritten)); before the next rewrite, run `gbrain sources set-sync <id> off` and `gbrain sources mirror-readonly <id>` first | agent; the reset after the user agrees | `destructive` (the reset keeps a backup ref) | `gbrain doctor --only sync_failures --json` |
| [Database unreachable or `GBRAIN_DB_ACCESS <reason>`](#database-unreachable) | `gbrain engine status --probe`, then `gbrain db-repair` (diagnose); `gbrain db-repair --yes` applies safe fixes | agent; `--yes` after the user agrees | none to diagnose; `--apply-rewrites` rewrites the config URL (undoable) | `gbrain engine status --probe --json` |
| [PGLite `RuntimeError: Aborted()` at startup](#pglite-aborted) | automatic repair on the next command; else `gbrain pglite-repair --dry-run`, then `gbrain pglite-repair --yes` | agent; `--yes` after the user agrees | `destructive` (a WAL backup is kept and the restore command printed) | `gbrain doctor --only connection --json` |
| [`expected N dimensions, not M` on import](#embedding-dimensions) | `gbrain doctor` prints the exact `gbrain config set …` or `gbrain migrate embeddings --to <provider:model>` command | agent, after the user agrees | `migrate embeddings`: `paid`, needs the brain's writer lock | `gbrain doctor --only embeddings,embedding_width_consistency --json` |
diff --git a/docs/guides/upgrades-auto-update.md b/docs/guides/upgrades-auto-update.md
index 08acb6947d..409d6dfe8e 100644
--- a/docs/guides/upgrades-auto-update.md
+++ b/docs/guides/upgrades-auto-update.md
@@ -275,6 +275,11 @@ gbrain upgrade --restart-only # restart onto the installed bu
gbrain upgrade --no-restart # install only; doctor fails runtime_build_skew until the restart runs
```
+On an always-on host, start with `gbrain autopilot pause --reason "upgrade"`
+and wait until `gbrain jobs list --status active --json` returns no jobs, so no
+job runs half on each build; resume with `gbrain autopilot resume` once the
+checks below pass ([the order](../../skills/gbrain-upgrade/SKILL.md#always-on-hosts-pause-drain-upgrade-verify-resume)).
+
The autopilot `--swap-only` channel still exits for its own supervisor to
relaunch and restarts nothing else; doctor's `runtime_build_skew` fails while
two builds run, with `gbrain upgrade --restart-only` as its fix.
diff --git a/docs/mcp/OPENCLAW.md b/docs/mcp/OPENCLAW.md
index 13b0389150..3680eab69d 100644
--- a/docs/mcp/OPENCLAW.md
+++ b/docs/mcp/OPENCLAW.md
@@ -78,8 +78,9 @@ environment than the gateway's MCP server. Route every one of them through a
single wrapper that sets `GBRAIN_HOME`, loads the brain's env file and runs the
installed `gbrain` by absolute path; log its stderr and check its exit code
([the wrapper and its rules](../guides/cron-schedule.md#calling-gbrain-unattended)).
-On a managed brain, scripts save pages through `put_page` or `capture` and
-never commit into the checkout; a scheduled `gbrain sources refresh <id>`
+On a managed brain, scripts commit the files they write with
+`gbrain git commit-push -- <paths>` (never plain `git commit`); a scheduled
+`gbrain sources refresh <id>`
keeps it current
([scripts and the managed checkout](../guides/shared-checkout-git.md#scripts-and-the-managed-checkout)).
diff --git a/llms-full.txt b/llms-full.txt
index 9a3445b878..873d607883 100644
--- a/llms-full.txt
+++ b/llms-full.txt
@@ -1927,8 +1927,10 @@ writing or reviewing an operation, consult `src/core/operations.ts` for the cont
`no_brain` refusal then reads as "no results"), check the exit code, keep
hook output off stdout, allow at least 10 s per call, and never print the
process environment into a transcript. On a managed brain, schedule
- `gbrain sources refresh <id>` and never commit files into the checkout from a
- script. Wrapper and rules:
+ `gbrain sources refresh <id>`, and have scripts commit the files they write
+ with `gbrain git commit-push -- <paths>`, never plain `git commit`
+ (`gbrain doctor --only cron_gbrain_home` flags cron lines that skip the
+ wrapper). Wrapper and rules:
[cron-schedule.md](docs/guides/cron-schedule.md#calling-gbrain-unattended),
[scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout).
- **Delete or purge pages:** `gbrain delete --purge` skips the 72-hour soft
@@ -3238,10 +3240,12 @@ timeout of at least 10 s. The wrapper and its rules:
- **Managed brain checkout** (every 15 min, on the owner host):
`gbrain sources refresh <id>` is the only sanctioned fast-forward; it drains
- writes, fast-forwards and re-syncs. Scripts save pages through
- `put_page`/`capture`, never by writing and committing files in the
- checkout: an unpushed local commit makes the checkout diverge and every
- refresh refuse `refresh_diverged`
+ writes, fast-forwards and re-syncs. Scripts commit the files they write
+ with `gbrain git commit-push -- <paths>` (or save pages through
+ `put_page`/`capture`), never with plain `git commit`: an unpublished local
+ commit makes the checkout diverge and every refresh refuse
+ `refresh_diverged`. `gbrain doctor --only cron_gbrain_home` flags cron
+ lines that skip the wrapper
([scripts and the managed checkout](docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout)).
- **Workers**: start `gbrain jobs supervisor` with `--max-rss <MB>`; with
`--job-isolation process` the cap also covers each job child's process tree
@@ -3352,10 +3356,14 @@ verification are separate stages; report pending stages rather than claiming
the whole migration completed.
On a host with resident processes (autopilot, a jobs worker, a serve), pause
-autopilot (`gbrain autopilot pause`), wait until no job is active, upgrade
-every install, restart every gbrain process and verify that each reports the
-new version, then `gbrain autopilot resume`
-([the order](skills/gbrain-upgrade/SKILL.md#always-on-hosts-pause-drain-upgrade-verify-resume)).
+autopilot (`gbrain autopilot pause`), wait until no job is active, run
+`gbrain upgrade` on every install (it restarts every gbrain process onto the
+new build and verifies one build runs, or refuses `restart_refused` naming the
+process it cannot restart), check that each process reports the new version,
+then `gbrain autopilot resume`. A production brain follows the stable channel
+(`gbrain config set self_upgrade.channel stable`)
+([the order](skills/gbrain-upgrade/SKILL.md#always-on-hosts-pause-drain-upgrade-verify-resume),
+[stable channel](docs/guides/upgrades-auto-update.md#stable-channel)).
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:
@@ -7849,8 +7857,12 @@ Rules for the wrapper and everything that calls it:
On a managed brain the same wrapper runs `gbrain-run sources refresh <id>` on
a schedule ([the managed cron line](../../skills/cron-scheduler/SKILL.md#managed-brain)).
-Scripts never write files and `git commit` straight into the managed checkout;
-see [shared-checkout git](shared-checkout-git.md#scripts-and-the-managed-checkout).
+Scripts commit the files they write with `gbrain git commit-push -- <paths>`,
+never plain `git commit`, in the managed checkout; see
+[shared-checkout git](shared-checkout-git.md#scripts-and-the-managed-checkout).
+`gbrain doctor --only cron_gbrain_home --json` reads the crontab and the scripts
+it names and warns about a line that runs `src/cli.ts` straight from a checkout,
+or calls gbrain without the brain's `GBRAIN_HOME`.
### Quiet Hours Gate (MANDATORY)
@@ -10099,14 +10111,14 @@ Source: https://raw.githubusercontent.com/garrytan/gbrain/master/docs/guides/tro
| A gbrain call failed with a code you don't recognize | follow `fix.next` ([protocol](../protocol/AGENT_OPERATOR_v1.md)); `gbrain errors <code>` | agent | as the fix's `consent` | the fix's `verify` |
| A graph read omits a relationship you know existed, or says someone still works somewhere they left | the default read returns relationships true today: repeat with `status: "all"` or `as_of`; to record an end, add a dated timeline line (`Ended works_at [[companies/x]]`) or `add_link ... valid_until` ([temporal edges](temporal-edges.md)) | agent | none | `gbrain doctor --only edge_validity --json` |
| A command exited 3 (`confirmation_required`) | relay `user_message`; run `fix.command` only after the user agrees | agent, after the user agrees | the payload's `effects` | the fix's `verify` |
-| A scheduled job, workspace script or hook finds nothing in the brain (every lookup empty), or its log shows `no_brain` or `GBRAIN_DB_ACCESS no_url`, while the same command works by hand | the job runs without the brain's config: call gbrain through one wrapper that sets `GBRAIN_HOME` and loads the brain's env file, and stop discarding its stderr ([the wrapper](cron-schedule.md#calling-gbrain-unattended)) | agent | none | the job's log shows results, and `gbrain engine status --json` run through the wrapper names the expected `db_url_source` |
+| A scheduled job, workspace script or hook finds nothing in the brain (every lookup empty), or its log shows `no_brain` or `GBRAIN_DB_ACCESS no_url`, while the same command works by hand | the job runs without the brain's config: call gbrain through one wrapper that sets `GBRAIN_HOME` and loads the brain's env file, and stop discarding its stderr ([the wrapper](cron-schedule.md#calling-gbrain-unattended)); `gbrain doctor --only cron_gbrain_home --json` names crontab lines that skip it | agent | none | the job's log shows results, and `gbrain engine status --json` run through the wrapper names the expected `db_url_source` |
| `gbrain sources refresh` refuses `refresh_not_owner` from cron or a script but works by hand | the caller resolves another gbrain home, so it is another host; the refusal names the identity file, `HOME` and `GBRAIN_HOME` it read. Set the owner's `GBRAIN_HOME` in the wrapper (not `HOME`, which also swaps git credentials); never copy or delete a `host.json` | agent | none | `gbrain sources refresh <id> --dry-run` through the wrapper |
-| `gbrain sources refresh` refuses `refresh_diverged` on every run | something commits into the managed checkout outside gbrain, usually a script that writes files and runs `git commit` without pushing. `git log @{upstream}..HEAD` names the commits; move that writer to `put_page` or `capture`, then reconcile as the [refusal](write-refusals.md#refresh_diverged) says; never force ([scripts and the managed checkout](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent; reconciling after the user agrees | `destructive` when reconciling drops local commits | `gbrain sources refresh <id> --dry-run` |
+| `gbrain sources refresh` refuses `refresh_diverged` on every run | something commits into the managed checkout outside gbrain, usually a script that writes files and runs `git commit` without pushing. `git log @{upstream}..HEAD` names the commits; move that writer to `gbrain git commit-push -- <paths>`, then publish the stray commits merged with the upstream (`gbrain git commit-push --push-only --keep-checkout --path <checkout>`) and retry, as the [refusal](write-refusals.md#refresh_diverged) says; never force ([scripts and the managed checkout](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent; reconciling after the user agrees | `destructive` when reconciling drops local commits | `gbrain sources refresh <id> --dry-run` |
| A `--json` caller fails to parse gbrain's output | something other than gbrain wrote to stdout, usually a wrapper or a hook it runs; send that output to a log file or stderr (gbrain's own notices already go to stderr) | agent | none | the same call piped to `jq .` parses |
| gbrain calls time out from a script or language runtime but finish by hand, or each search takes several seconds | a cold CLI start takes 3–6 s on a pooled Postgres brain: set caller timeouts of at least 10 s in both the shell and the runtime (a runtime exec timeout can override the shell's), and turn on the [warm CLI socket](cli-socket.md). If warm searches stay slow, measure the round trip to the database; one in another region dominates search time | agent; moving the database after the user agrees | none | `GBRAIN_DEBUG=1 gbrain search <query>` prints a `[cli-socket] warm:` line |
| After a database change some processes still use the old server, or a URL variable silently keeps its old value | a shell-sourced env file has an unquoted `&` (the assignment ends there), or a process kept the environment it started with. Quote every value, keep Postgres URLs to `?sslmode=require` (driver options as variables, such as `GBRAIN_PREPARE=false`), update every URL variable the tooling reads, restart every gbrain process, and prove the switch from the database side ([switching a database](../../INSTALL_FOR_AGENTS.md#switching-a-database)). Never paste `env` output into a transcript while debugging | agent, after the user agrees | none | a row written after the restart appears on the new server |
| Doctor `parked_effects` lists `git_target_ignored` effects | a `.gitignore` rule excludes those pages' files, so their Git effects cannot commit. The user decides: un-ignore (narrow the rule, commit it, then `gbrain sources writer retry-effects <source> --parked-code git_target_ignored`) or keep the pages database-only and leave the effects parked ([gitignored paths](shared-checkout-git.md#scripts-and-the-managed-checkout)) | agent, after the user decides | none | `gbrain sources writer status --source <id> --json` |
-| Sync and the maintenance cycle re-read a whole source on every run after its Git history was rewritten (force-push, `git filter-repo`) | the recorded base commit no longer exists. Move the checkout onto the new history ([upstream rewritten](#upstream-rewritten)); before the next rewrite, take the source out of automatic sync and run `gbrain sources mirror-readonly <id>` first | agent; the reset after the user agrees | `destructive` (the reset keeps a backup ref) | `gbrain doctor --only sync_failures --json` |
+| Sync and the maintenance cycle re-read a whole source on every run after its Git history was rewritten (force-push, `git filter-repo`) | the recorded base commit no longer exists. Move the checkout onto the new history ([upstream rewritten](#upstream-rewritten)); before the next rewrite, run `gbrain sources set-sync <id> off` and `gbrain sources mirror-readonly <id>` first | agent; the reset after the user agrees | `destructive` (the reset keeps a backup ref) | `gbrain doctor --only sync_failures --json` |
| [Database unreachable or `GBRAIN_DB_ACCESS <reason>`](#database-unreachable) | `gbrain engine status --probe`, then `gbrain db-repair` (diagnose); `gbrain db-repair --yes` applies safe fixes | agent; `--yes` after the user agrees | none to diagnose; `--apply-rewrites` rewrites the config URL (undoable) | `gbrain engine status --probe --json` |
| [PGLite `RuntimeError: Aborted()` at startup](#pglite-aborted) | automatic repair on the next command; else `gbrain pglite-repair --dry-run`, then `gbrain pglite-repair --yes` | agent; `--yes` after the user agrees | `destructive` (a WAL backup is kept and the restore command printed) | `gbrain doctor --only connection --json` |
| [`expected N dimensions, not M` on import](#embedding-dimensions) | `gbrain doctor` prints the exact `gbrain config set …` or `gbrain migrate embeddings --to <provider:model>` command | agent, after the user agrees | `migrate embeddings`: `paid`, needs the brain's writer lock | `gbrain doctor --only embeddings,embedding_width_consistency --json` |
diff --git a/plugin/skills/cron-scheduler/SKILL.md b/plugin/skills/cron-scheduler/SKILL.md
index ffc1632833..bd94cc47e0 100644
--- a/plugin/skills/cron-scheduler/SKILL.md
+++ b/plugin/skills/cron-scheduler/SKILL.md
@@ -54,6 +54,9 @@ This skill guarantees:
the installed binary. Log stderr to a file, check the exit code, keep hook
output off stdout, and give each call a timeout of at least 10 s.
The lines below write `gbrain-run`; doctor prints the bare command.
+ `gbrain doctor --only cron_gbrain_home` warns about any crontab line or
+ script that runs `src/cli.ts` directly or calls gbrain without the brain's
+ `GBRAIN_HOME`.
## Idempotency Requirement
@@ -115,8 +118,10 @@ sources:
`;` is deliberate: the sync still runs when a refresh refuses.
- `refresh_diverged`: the checkout has commits its upstream lacks, so
something commits outside gbrain (usually a script that writes files and
- runs `git commit` in the checkout). Fix that writer so it saves pages
- through `put_page` or `capture`; never force the checkout
+ runs `git commit` in the checkout). Fix that writer so it commits with
+ `gbrain git commit-push -- <paths>`, then reconcile as the refusal says
+ (`gbrain git commit-push --push-only --keep-checkout`, after the user
+ agrees); never force the checkout
([scripts and the managed checkout](https://github.com/garrytan/gbrain/blob/master/docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout)).
- `--hard-deadline 13m` stays under the 15-minute interval. Managed sync takes
no per-source lock, so a run that outlives the interval would overlap the
@@ -162,7 +167,8 @@ Follow the [agent operator protocol](../conventions/agent-operator-protocol.md)
- A bare `gbrain` or `bun run src/cli.ts` in a cron line, script or hook
instead of the wrapper; a wrapper that sets `HOME` instead of `GBRAIN_HOME`
- `2>/dev/null` on a gbrain call, or ignoring its exit code
-- A script that writes files and `git commit`s them in a managed checkout
+- A script that writes files and runs plain `git commit` in a managed checkout
+ instead of `gbrain git commit-push -- <paths>`
- Printing `env` or a process environment into a log or transcript while
debugging (it holds the database URL and keys)
- Separate per-source `gbrain sync --source <id>` cron entries when
diff --git a/plugin/skills/gbrain-upgrade/SKILL.md b/plugin/skills/gbrain-upgrade/SKILL.md
index c369531864..af5b634fa3 100644
--- a/plugin/skills/gbrain-upgrade/SKILL.md
+++ b/plugin/skills/gbrain-upgrade/SKILL.md
@@ -121,24 +121,31 @@ rather than blocking — the version numbers alone are enough to decide.
## Always-on hosts: pause, drain, upgrade, verify, resume
-A host that runs autopilot, a jobs worker or a serve keeps the old build
-running after the binary swaps, and a job that starts mid-swap can run half on
-each. With the operator's go-ahead, upgrade in this order:
+A host that runs autopilot, a jobs worker or a serve must end the upgrade with
+every process on the new build, and a job that starts mid-swap can run half on
+each. A large or production brain follows the stable channel
+(`gbrain config set self_upgrade.channel stable`, or `gbrain upgrade --channel stable`
+once), which offers only releases that passed the production-shaped soak.
+With the operator's go-ahead, upgrade in this order:
1. `gbrain autopilot pause --reason "upgrade"` so no new cycle starts.
2. Wait for a quiet queue: `gbrain jobs list --status active --json` returns
no jobs (`gbrain jobs stats --json` for the totals). Let running jobs
finish; don't cancel them to hurry.
-3. `gbrain upgrade` on every install that touches the brain. `which -a gbrain`
+3. Preview the restart: `gbrain upgrade --restart-only --dry-run --json` lists
+ every gbrain process on the host, its build and how it restarts.
+4. `gbrain upgrade` on every install that touches the brain (`which -a gbrain`
lists the installs on PATH; a harness, cron wrapper or service may run
- another one by absolute path.
-4. Restart every resident gbrain process (serve, jobs supervisor, autopilot,
- MCP servers), then verify that each install and each process reports the
- new version: `gbrain --version` per install, and
- `gbrain doctor --only runtime_build_skew,serve_build_drift --json` ok.
- On a managed brain, `gbrain sources writer movement` must exit 0
+ another by absolute path). It restarts serve, autopilot and the jobs
+ supervisor onto the new build and verifies one build runs. A process it
+ cannot restart (one started by hand, a running `gbrain sync`, an MCP server
+ a harness started) refuses with `restart_refused` (exit 3) before anything
+ installs: relay the step it names; `--stop-mcp` only after the user agrees.
+5. Verify: `gbrain --version` per install, and
+ `gbrain doctor --only runtime_build_skew,serve_build_drift --json` ok. On a
+ managed brain, `gbrain sources writer movement` must exit 0
([restart and verify](https://github.com/garrytan/gbrain/blob/master/docs/guides/upgrades-auto-update.md#restart-and-verify)).
-5. `gbrain autopilot resume`.
+6. `gbrain autopilot resume`.
Report the version every process runs, not just the version the upgrade
printed.
diff --git a/skills/cron-scheduler/SKILL.md b/skills/cron-scheduler/SKILL.md
index dd2239abc5..50dc43d8a8 100644
--- a/skills/cron-scheduler/SKILL.md
+++ b/skills/cron-scheduler/SKILL.md
@@ -53,6 +53,9 @@ This skill guarantees:
the installed binary. Log stderr to a file, check the exit code, keep hook
output off stdout, and give each call a timeout of at least 10 s.
The lines below write `gbrain-run`; doctor prints the bare command.
+ `gbrain doctor --only cron_gbrain_home` warns about any crontab line or
+ script that runs `src/cli.ts` directly or calls gbrain without the brain's
+ `GBRAIN_HOME`.
## Idempotency Requirement
@@ -114,8 +117,10 @@ sources:
`;` is deliberate: the sync still runs when a refresh refuses.
- `refresh_diverged`: the checkout has commits its upstream lacks, so
something commits outside gbrain (usually a script that writes files and
- runs `git commit` in the checkout). Fix that writer so it saves pages
- through `put_page` or `capture`; never force the checkout
+ runs `git commit` in the checkout). Fix that writer so it commits with
+ `gbrain git commit-push -- <paths>`, then reconcile as the refusal says
+ (`gbrain git commit-push --push-only --keep-checkout`, after the user
+ agrees); never force the checkout
([scripts and the managed checkout](https://github.com/garrytan/gbrain/blob/master/docs/guides/shared-checkout-git.md#scripts-and-the-managed-checkout)).
- `--hard-deadline 13m` stays under the 15-minute interval. Managed sync takes
no per-source lock, so a run that outlives the interval would overlap the
@@ -161,7 +166,8 @@ Follow the [agent operator protocol](../conventions/agent-operator-protocol.md)
- A bare `gbrain` or `bun run src/cli.ts` in a cron line, script or hook
instead of the wrapper; a wrapper that sets `HOME` instead of `GBRAIN_HOME`
- `2>/dev/null` on a gbrain call, or ignoring its exit code
-- A script that writes files and `git commit`s them in a managed checkout
+- A script that writes files and runs plain `git commit` in a managed checkout
+ instead of `gbrain git commit-push -- <paths>`
- Printing `env` or a process environment into a log or transcript while
debugging (it holds the database URL and keys)
- Separate per-source `gbrain sync --source <id>` cron entries when
diff --git a/skills/gbrain-upgrade/SKILL.md b/skills/gbrain-upgrade/SKILL.md
index b7c16ef7d2..08e2669208 100644
--- a/skills/gbrain-upgrade/SKILL.md
+++ b/skills/gbrain-upgrade/SKILL.md
@@ -120,24 +120,31 @@ rather than blocking — the version numbers alone are enough to decide.
## Always-on hosts: pause, drain, upgrade, verify, resume
-A host that runs autopilot, a jobs worker or a serve keeps the old build
-running after the binary swaps, and a job that starts mid-swap can run half on
-each. With the operator's go-ahead, upgrade in this order:
+A host that runs autopilot, a jobs worker or a serve must end the upgrade with
+every process on the new build, and a job that starts mid-swap can run half on
+each. A large or production brain follows the stable channel
+(`gbrain config set self_upgrade.channel stable`, or `gbrain upgrade --channel stable`
+once), which offers only releases that passed the production-shaped soak.
+With the operator's go-ahead, upgrade in this order:
1. `gbrain autopilot pause --reason "upgrade"` so no new cycle starts.
2. Wait for a quiet queue: `gbrain jobs list --status active --json` returns
no jobs (`gbrain jobs stats --json` for the totals). Let running jobs
finish; don't cancel them to hurry.
-3. `gbrain upgrade` on every install that touches the brain. `which -a gbrain`
+3. Preview the restart: `gbrain upgrade --restart-only --dry-run --json` lists
+ every gbrain process on the host, its build and how it restarts.
+4. `gbrain upgrade` on every install that touches the brain (`which -a gbrain`
lists the installs on PATH; a harness, cron wrapper or service may run
- another one by absolute path.
-4. Restart every resident gbrain process (serve, jobs supervisor, autopilot,
- MCP servers), then verify that each install and each process reports the
- new version: `gbrain --version` per install, and
- `gbrain doctor --only runtime_build_skew,serve_build_drift --json` ok.
- On a managed brain, `gbrain sources writer movement` must exit 0
+ another by absolute path). It restarts serve, autopilot and the jobs
+ supervisor onto the new build and verifies one build runs. A process it
+ cannot restart (one started by hand, a running `gbrain sync`, an MCP server
+ a harness started) refuses with `restart_refused` (exit 3) before anything
+ installs: relay the step it names; `--stop-mcp` only after the user agrees.
+5. Verify: `gbrain --version` per install, and
+ `gbrain doctor --only runtime_build_skew,serve_build_drift --json` ok. On a
+ managed brain, `gbrain sources writer movement` must exit 0
([restart and verify](https://github.com/garrytan/gbrain/blob/master/docs/guides/upgrades-auto-update.md#restart-and-verify)).
-5. `gbrain autopilot resume`.
+6. `gbrain autopilot resume`.
Report the version every process runs, not just the version the upgrade
printed.
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 5a517da68a..f87ddf939c 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -66,7 +66,7 @@
"conversation-archive/routing-eval.jsonl": "ae087a84b1fd5b108b7cdab8d035a09b3ccecd8aad53ba5f71e463059108cfca",
"correction-pipeline/SKILL.md": "04b4aee06d7fcdd75db314da432ed7c08b5fbc20f117f18062c64aaf795bc564",
"correction-pipeline/routing-eval.jsonl": "7f8d96606a8d7bed3d79fdcee6904764c8abb9fa0b506adb414b5c4805b69d0b",
- "cron-scheduler/SKILL.md": "65615bf63cca791eb43b42e338246a697a526fd81653f735d2b9f5d5601882c4",
+ "cron-scheduler/SKILL.md": "a35d24206d7a309b3630f0492048676c75c6f3d6f8b58518cc9afe8dbcae533b",
"cross-modal-review/SKILL.md": "fc00a04e2ff9f498bee9b0b636bceba9dcfdc869c35d9a983109f408170f0807",
"daily-task-manager/SKILL.md": "e93264a83b5fd0a19b2f06a322b3a4ad92d418f6a968c1cd51f4bea79cbca4d9",
"daily-task-manager/routing-eval.jsonl": "e98b2592e65c26952242436a960d8b2061e375b269004a18c230cbcf1d692ff9",
@@ -88,7 +88,7 @@
"functional-area-resolver/SKILL.md": "fe6e35fbb34dffec7af9ce4a6cc9c0b0eaa8345f97f33262a2abe0983431b421",
"functional-area-resolver/routing-eval.jsonl": "f80674d915acdfe229046737a5b171da834be15ac6524b5a3fd18048e9b37028",
"gbrain-advisor/SKILL.md": "976b3c5c3798f9fec764fa5bacd1567f751875bd837fe188a0c6df041805ed51",
- "gbrain-upgrade/SKILL.md": "b4a637605234fd748b0501a244ffad491a9d8f16e537fbfdbf2d9de41f0aaaab",
+ "gbrain-upgrade/SKILL.md": "c68187b205ed2f5d097c62cb05b0a80ec70a2cdbd9fe3ca09fc6bc3cc73d4d34",
"google-loops/SKILL.md": "20955fac0a94bbe9298a8aa7416e851cac86eb145bc551ed0fc556d2f583fa5e",
"idea-ingest/SKILL.md": "863be3660ead12a45d3b86309d73df0ffda6c5db6ca69873cce1810680df79b4",
"idea-lineage/SKILL.md": "8cb36179dbf94abc17065613b8e773b1bb2b22670742aa77347b91ac885a05c5",