Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

chore(release): PR4 as v0.60.101.0: migration note, behavior row and CHANGELOG entry (#6188)

garrytan58334f47e65d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 79e45862b0..a4af416bc2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,54 @@ 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.101.0] - 2026-10-07
+
+**Broken facts and takes tables in your notes now get repaired by themselves.**
+
+The last three releases stopped a broken table from blocking a sync, fixed the ones with only one possible meaning, and made `gbrain doctor` count the rest. This release repairs the rest. The background maintenance run now works through every broken table it finds, each with the cheapest method that is exactly right: fixed rules first, then holder names checked against your own people and company pages, and only for a table whose columns are scrambled, the chat model you configured. The model sees only that table's header and the rows it has to move, never the rest of the page, and it may move cells but never change what they say. Model spend has a hard cap of $0.05 per page and $1.00 per day. Every repair is committed with a message naming the file, so `git revert` undoes it.
+
+### How to use it
+
+```bash
+gbrain doctor --only fence_integrity # how many broken tables per source, and what would fix each
+gbrain repair fences --source <id> # preview: read-only, no model call, prints the apply command
+gbrain repair fences --source <id> --apply --expect <hash> # apply exactly what the preview showed
+gbrain config set fences.repair.enabled false # pause the automatic repair
+gbrain config set fences.repair.llm false # keep table rows away from the model; the free fixes keep running
+```
+
+### What you see
+
+| Where | What changed |
+|---|---|
+| Maintenance run | A new `fence_repair` step runs right after sync, on the computer that owns the source. Its first run after upgrading repairs every broken table it finds in each source. |
+| `gbrain repair fences` | The preview shows one sample diff per fix method (`--diff` shows all), what the model would cost against what is left of today's cap, and an apply command bound to exactly that plan. Applying skips anything that changed since the preview. `--only`/`--skip` pick files, `--slug` picks stored pages, `--no-llm` stays free, `--max-usd` lowers the cap for one run. The result says what was repaired and what is left, and why. |
+| Managed sources | Each repaired file is committed as `gbrain: repair fence in <path> (<classes>)`. |
+| Other sources | The original file is backed up under `~/.gbrain/backups/fences/` before the write, and `gbrain sources status` plus doctor show the repair until you commit it. |
+| Held files | Every `invalid_fence` hold and the doctor `fence_integrity` fix point at the `gbrain repair fences` preview (`--only <path>` for one file). A table only a person can decide still names the exact edit. |
+| Model choice | `models.fence_repair` picks the model (listed in `gbrain models`). |
+
+### Things to watch
+
+- How often the model's rewrites pass the checks is not measured yet.
+- A model gbrain has no price for still runs under the default caps, metered at the highest chat rate gbrain knows; under a cap you set, it waits until you register its price with `gbrain pricing set`.
+- When the daily cap runs out, repair stops and the remaining tables wait until 00:00 UTC; the run says when and how many.
+- Turning the settings off stops future repairs and does not undo past ones. A broken table you restore is held again on the next sync and repaired again by the next maintenance run, so pause first if you want to keep it.
+
+### Itemized changes
+
+- `src/core/repair/fences.ts`: the `fences` repair kind (preview-bound, `spends: 'llm'`). Candidates come from the fence census after a bounded scan (`GBRAIN_FENCE_REPAIR_SCAN_MS`, default 10 s); `--only`, `--skip` and `--slug` also reach files and pages the census has not judged yet. A candidate whose source is owned by another host (`owner_unavailable`) or mid-sync (`sync_in_progress`) is skipped, and every candidate is re-read before any fix runs.
+- Holder names (`src/core/fence-repair/repair-tiers.ts`) resolve strictly, without same-name guessing, only to `people/` and `companies/` pages, and never to a private page from a world-visible one. A model repair claims the attempt memo, checks the per-page cap and the run's allowance, reserves on the daily ledger before each call and settles the real tokens after; a rewrite the checks rejected for unchanged bytes is never paid for again. The call (`src/core/fence-repair/llm.ts`) uses no tools, no fallback model and no temperature, and gets at most one corrective re-ask.
+- Every rewrite passes the same validation gates as the inline repair, plus a fixed-point check, before it is written. A misaligned cell whose text is unchanged is now moved to the column it belongs to rather than rejected.
+- Write-back (`src/core/fence-repair/repair-io.ts`): managed sources go through `managed_file_repair` with a location-only `fence_repair` receipt checked at submission and again when prepared (remote callers are refused); other checkouts are confined, re-hashed (`changed_since_read`), backed up, written and imported, with the backup restored if the import refuses; database-only pages and mirrors get a revision-bound write.
+- Repair kinds can carry a per-item model cost (the preview estimate follows `--limit`, and an apply stops before an item it cannot afford), a deadline and an early stop. `--expect` works for every preview-bound kind; `--max-usd` only for kinds that call a paid model, and only lowers the cap.
+- The `fence_repair` cycle phase (`src/core/cycle/fence-repair.ts`) runs after `sync` within min(300 s, a third of the job's remaining time), honors both switches and reports what it verified.
+- Holds carry the fence location and the last repair state; `docs/guides/fence-format.md` is generated from the parser's own tables, and `docs/guides/repair.md#fences` walks through a real run.
+
+### For contributors
+
+- `test/repair-fences.test.ts` (PGLite, and Postgres through `test/postgres-unit-arms.txt`) covers preview then the printed apply across all three fix methods, rejected rewrites never paid twice, transient errors, `--no-llm`, unpriced models under default and user caps, the budget stop, every skip reason, mirrors, remote refusal, backups and the uncommitted notice, doctor remediation budgets, the time budget, two concurrent appliers at the cap and the cycle phase across ticks, with a privacy sentinel throughout. `test/fence-repair-llm.test.ts` pins the prompt bytes; `test/fence-walkthrough.test.ts` checks the guide's walkthrough line by line against a local provider stand-in.
+
## [0.60.100.0] - 2026-10-07
**`gbrain doctor` now counts every broken facts or takes table still waiting in your brain, and says what would fix each one.**
diff --git a/skills/migrations/v0.60.84.0.md b/skills/migrations/v0.60.101.0.md
similarity index 80%
rename from skills/migrations/v0.60.84.0.md
rename to skills/migrations/v0.60.101.0.md
index 32de0402e5..73b2698f73 100644
--- a/skills/migrations/v0.60.84.0.md
+++ b/skills/migrations/v0.60.101.0.md
@@ -1,14 +1,15 @@
-# Upgrade to v0.60.84.0: malformed facts and takes fences repair themselves
+# Upgrade to v0.60.101.0: malformed facts and takes fences repair themselves
-A facts or takes fence gbrain cannot import no longer blocks a sync. A fence
-with one exact meaning is rewritten and committed in the same write; the rest
-is **held** while the source keeps syncing, and the maintenance run now
-repairs held files and stored pages by itself. A source such a fence blocked
-before this release recovers by itself. No schema migration.
+Since v0.60.98.0 a facts or takes fence gbrain cannot import is **held**
+instead of blocking a sync, and since v0.60.99.0 a fence with one exact
+meaning is rewritten in the same write. This release repairs the rest: the
+maintenance run's new `fence_repair` phase repairs held files and stored pages
+by itself, and `gbrain repair fences` previews and applies the same repair on
+demand. No schema migration.
The repairs need no extra consent, but they rewrite the user's files: tell the
-user what the first maintenance run will change (step 3) before it runs, and
-leave spend decisions to them (step 4).
+user what the first maintenance run will change (step 2) before it runs, and
+leave spend decisions to them (step 3).
1. **Finish the upgrade.** `gbrain upgrade` runs it. To be sure, on the brain
host:
@@ -19,16 +20,7 @@ leave spend decisions to them (step 4).
Restart every `gbrain serve`, autopilot and worker so the maintenance run
picks up the `fence_repair` phase.
-2. **Unblock a source a fence blocked.** `gbrain post-upgrade` names each
- source a fence refusal blocked. The next scheduled or manual sync recovers
- it automatically; to do it now run:
- ```bash
- gbrain sync --source <id> --no-pull
- ```
- The blocked request is converted in place: the file is held and everything
- else imports. No `--retry-failed` and no ledger edits.
-
-3. **Tell the user what the first maintenance run rewrites.** The first
+2. **Tell the user what the first maintenance run rewrites.** The first
maintenance run after the upgrade repairs every malformed fence it finds
across each source (held files, stored pages and checkout files not yet
synced), rewriting those files and committing each one (a legacy source's
@@ -50,7 +42,7 @@ leave spend decisions to them (step 4).
rewriting fixable fences inline either way; `gbrain config set fences.normalize false`
makes them hold such a fence instead.
-4. **Spend and what leaves the machine.** Most repairs are free rules. A
+3. **Spend and what leaves the machine.** Most repairs are free rules. A
fence only a rewrite can realign goes to the configured chat provider
(`models.fence_repair`): only the fence header and the rows it must
realign are sent, never valid rows and never the rest of the page. Spend is
@@ -68,7 +60,7 @@ leave spend decisions to them (step 4).
The free tiers keep running. Raising a cap or turning model repair back on
is the user's call.
-5. **Tell the user what stays held.**
+4. **Tell the user what stays held.**
```bash
gbrain sources status <id> # each fence hold: reason, fence, section, rows, next attempt
```
@@ -80,7 +72,7 @@ leave spend decisions to them (step 4).
`docs/guides/write-refusals.md#invalid_fence`; the format:
`docs/guides/fence-format.md`.
-6. **Inspect or undo a repair.**
+5. **Inspect or undo a repair.**
- Managed sources: each repaired file is committed with the subject
`gbrain: repair fence in <path> (<classes>)`. `git log --grep 'repair fence in'`
lists them, `git show <commit>` shows the change, and `git revert <commit>`
@@ -101,10 +93,10 @@ leave spend decisions to them (step 4).
(`gbrain config set fences.repair.enabled false`) if the user wants to keep
the original.
-7. **Which steps need the user.**
+6. **Which steps need the user.**
- Nothing to approve for the repairs themselves: the maintenance run and
`gbrain repair fences --apply` need no extra consent.
- - Tell the user before the first maintenance run (step 3); pausing is
+ - Tell the user before the first maintenance run (step 2); pausing is
their choice.
- Raising a cap (`fences.repair.max_usd_per_day`,
`fences.repair.max_usd_per_page`), turning model repair back on
@@ -113,7 +105,7 @@ leave spend decisions to them (step 4).
- Relay the one-time `behavior_changes` notice when gbrain prints it
(`gbrain doctor --only behavior_changes` shows it again).
-8. **Verify:**
+7. **Verify:**
```bash
gbrain doctor --only fence_integrity,git_held_files --json
gbrain sources status --json
diff --git a/skills/skills.lock.json b/skills/skills.lock.json
index 3588627814..5229fd0c80 100644
--- a/skills/skills.lock.json
+++ b/skills/skills.lock.json
@@ -153,6 +153,7 @@
"migrations/v0.59.10.0.md": "e0268a05ab184d5518f88747313e772629b2af91db59eacbba728f2ebd9db3cd",
"migrations/v0.59.2.0.md": "b6d61af8ef48c154a26e8d427dd6f6570e99efb82b891728426046eea493247b",
"migrations/v0.60.100.0.md": "63583a73e957c5421bb826f2be48ac1aafaaa994392c1a05f26d1516b48c8573",
+ "migrations/v0.60.101.0.md": "6782981f3a318c6d8c22ef76333e7a1322a21a82ab8211368f0a669d7cda3ea8",
"migrations/v0.60.11.0.md": "1e503113f591c5cd142b78ab4472bbdbceb890c6cbac2fbdf8aa61cd087200b8",
"migrations/v0.60.20.0.md": "9266863a9f76164c64a72b1be17b8ddb3bb97e1c3c5db9f666b69ebc7a228fdd",
"migrations/v0.60.26.0.md": "30d761ef5a2361bad66053f97b7b659304a591274be33e281f4f6df0d7d5566e",
@@ -175,7 +176,6 @@
"migrations/v0.60.63.0.md": "cdc9f862a719bdb76140b5069fb659987978bc2d90498d808bc5d766dbf16891",
"migrations/v0.60.74.0.md": "cfd0e9fe6e7d506d60b3673cdb077b52ce292c12e74a81e8cb71c407cc926009",
"migrations/v0.60.77.0.md": "3a588974cea1db36a9f063ed056fae155adc5cb54fb606d49f69625e94e15c9d",
- "migrations/v0.60.84.0.md": "842169f5bbcfe9f3e6edc7a0adb72a7b33bf332547ec2a5d680e9690d11969ef",
"migrations/v0.60.98.0.md": "006598c5fc107e1a61510a54e029059183d4f4c0879c2c86640a2988f0b2d33c",
"migrations/v0.60.99.0.md": "f56aeec78556eed9cc789ba5cca12c0953c1888368fee0b462cb72581dd8c5a8",
"migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 8d72c815dc..994e5c7ee4 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -261,7 +261,7 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText }
{ since: '0.60.98.0', text: 'Managed sync now holds a file whose facts or takes fence cannot be imported (code `invalid_fence`; `gbrain sources status <id>` names the fence, section and rows) instead of blocking the whole source, and a source such a fence blocked before recovers on its next sync. Coordinated writes refuse such a fence with `invalid_fence` (wire `error` stays `invalid_params`, or `take_row_collision`). `gbrain config set sync.holds fail` keeps fail-closed blocking.' },
{ since: '0.60.99.0', text: 'Fixable facts and takes fences are now rewritten instead of held or refused: managed sync, put_page and the fact and take writers normalize a fence whose meaning is unambiguous (a missing end marker after the table, two-dash takes markers, zero or duplicate row numbers, header aliases, invented kinds and enum synonyms, assistant holders, percent confidences) without changing a claim or an existing row number, and managed sync commits the rewritten file. Results report `fences_normalized`; `gbrain sync --dry-run` lists `would_normalize`. `gbrain config set fences.normalize false` turns it off (such fences are then held or refused).' },
{ since: '0.60.100.0', text: '`gbrain doctor` has a new `fence_integrity` check: it counts malformed facts and takes fences still waiting (held files, stored pages, unsynced checkout files) by the tier that would fix them, and warns when a source had 20 or more fences normalized in 7 days. Each doctor run scans stored pages and source checkouts for up to 10 seconds (`GBRAIN_DOCTOR_FENCE_TIMEOUT_MS`) and resumes where it stopped; until a scan finishes the check reports partial instead of ok. New settings `fences.repair.max_usd_per_page` (0.05) and `fences.repair.max_usd_per_day` (1.00) cap model fence repair.' },
- { since: '0.60.84.0', text: `Malformed facts and takes fences are now repaired automatically: the maintenance run repairs held files and stored pages on the owner host, and its first run after upgrading repairs every malformed fence it finds in each source, rewriting and committing those files (\`gbrain doctor --only fence_integrity\` counts them; \`gbrain repair fences\` previews the plan). A fence only a rewrite can realign sends just its header and those rows, never the rest of the page, to the configured chat model, within $0.05 per page and $1.00 per day (\`fences.repair.max_usd_per_page\`, \`fences.repair.max_usd_per_day\`); every rewrite passes validation gates before it is written. ${FENCE_REPAIR_MEASURED} \`gbrain config set fences.repair.llm false\` keeps fence rows away from the model; \`gbrain config set fences.repair.enabled false\` pauses automatic repair. On a managed source each repaired file is committed, so \`git revert\` undoes it (page history keeps the earlier version); turning these settings off stops future repairs and does not undo past ones.` },
+ { since: '0.60.101.0', text: `Malformed facts and takes fences are now repaired automatically: the maintenance run repairs held files and stored pages on the owner host, and its first run after upgrading repairs every malformed fence it finds in each source, rewriting and committing those files (\`gbrain doctor --only fence_integrity\` counts them; \`gbrain repair fences\` previews the plan). A fence only a rewrite can realign sends just its header and those rows, never the rest of the page, to the configured chat model, within $0.05 per page and $1.00 per day (\`fences.repair.max_usd_per_page\`, \`fences.repair.max_usd_per_day\`); every rewrite passes validation gates before it is written. ${FENCE_REPAIR_MEASURED} \`gbrain config set fences.repair.llm false\` keeps fence rows away from the model; \`gbrain config set fences.repair.enabled false\` pauses automatic repair. On a managed source each repaired file is committed, so \`git revert\` undoes it (page history keeps the earlier version); turning these settings off stops future repairs and does not undo past ones.` },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --git a/test/fence-docs-config-commands.test.ts b/test/fence-docs-config-commands.test.ts
index ea5946c8db..c315c7c053 100644
--- a/test/fence-docs-config-commands.test.ts
+++ b/test/fence-docs-config-commands.test.ts
@@ -2,7 +2,7 @@
* Printed fence settings commands are real (#6188 D29).
*
* Protects: every `gbrain config set fences.* <value>` command that the fence
- * docs, the v0.60.84.0 migration note, the behavior-change rows and the fence
+ * docs, the v0.60.101.0 migration note, the behavior-change rows and the fence
* reason fixes print names a registered key with a value `config set`
* accepts, and the three opt-outs (`fences.normalize`, `fences.repair.enabled`,
* `fences.repair.llm` set false) are printed where an agent upgrading a brain
@@ -22,7 +22,7 @@ import { FENCE_CONFIG_KEYS, validateFenceConfigValue } from '../src/core/fence-r
import { FENCE_REASON_CODES, FENCE_REASONS } from '../src/core/fence-repair/reasons.ts';
const ROOT = join(import.meta.dir, '..');
-const MIGRATION_NOTE = 'skills/migrations/v0.60.84.0.md';
+const MIGRATION_NOTE = 'skills/migrations/v0.60.101.0.md';
const DOCS = [
'AGENTS.md', MIGRATION_NOTE, 'docs/guides/fence-format.md', 'docs/guides/write-refusals.md', 'docs/guides/live-sync.md',
'docs/guides/troubleshooting.md', 'docs/guides/repair.md', 'docs/operations/spend-controls.md',