Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge origin/master into cat40-cost-wave; restamp v0.60.44.0; Cat 40 held-out numbers in CHANGELOG
garrytan3a5c376aef00
diff --cc .claude-plugin/plugin.jsonindex dad8abc3ce,794cf0e51b..87bd401c6e--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.","author": {"name": "Garry Tan",diff --cc .codex-plugin/plugin.jsonindex dc858cb259,36933d128d..b1da40391c--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Personal knowledge brain for your coding agent — hybrid search, synthesis, graph traversal, and durable cross-session memory over Postgres/PGLite with pgvector, plus a curated brain-first skill set.","author": {"name": "Garry Tan",diff --cc BOOTSTRAP_FOR_AGENTS.mdindex c833b0df21,6e9f5e3a8d..6310a01c76--- a/BOOTSTRAP_FOR_AGENTS.md+++ b/BOOTSTRAP_FOR_AGENTS.md@@@ -1,4 -1,4 +1,4 @@@- <!-- gbrain-runbook-stamp: 0.60.39.0 -->-<!-- gbrain-runbook-stamp: 0.60.41.0 -->++<!-- gbrain-runbook-stamp: 0.60.44.0 --><!-- This stamp must equal the VERSION file at every release; CI enforces it(scripts/check-bootstrap-tag.sh). `gbrain bootstrap status` compares it tothe installed binary and warns on skew. -->diff --cc CHANGELOG.mdindex 9b3a37837c,763cd33a9d..93a13f3602--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,67 -10,192 +10,254 @@@ credits are retained; no result has beeidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).- ## [0.60.39.0] - 2026-10-03++## [0.60.44.0] - 2026-10-03++**Your agent pays less for every gbrain call: search results, tool results and the tool list are all smaller, and search skips work it does not need.**++An agent connected to gbrain pays for two things on every turn: the list of tools it can call, and every tool result it has seen so far. Both were heavy. A typical search returned about 23 results of 1,200 characters each, but only a few hundred characters per result were the text the agent needed; the rest was ranking detail it never read, re-sent on every later turn. The starter tool list was about 60,000 characters before the agent asked anything.++Now a search or query from an agent returns the fields an agent acts on: the text, where it came from, how strong the match is, whether creating a new page would duplicate one, and any safety or provenance warning. Results are compact JSON. The starter tool list is 24,763 characters, with the longer guidance moved to a reference page. Notices about saved facts and other names under a search have a size cap. Your own `gbrain search` on the command line, local or thin client, still shows every field.++| Per agent call | Before | After |+| --- | --- | --- |+| Starter tool list (34 tools) | 59,969 characters (13,077 tokens) | 24,763 characters (5,568 tokens) |+| Search result rows for an agent | every ranking field, indented JSON | lean rows, compact JSON |+| Saved-facts / other-names notice | unbounded | 1,500 / 400 characters, whole items |- | Cat 40 cost per task, held-out world | $0.130 | **TODO(parent): fill in after the paid held-out run** |- | Cat 40 task success, held-out world | **TODO(parent)** | **TODO(parent)** |++| Cat 40 model cost per task, held-out world (6 models × 2 repeats) | $0.118 | $0.080 (−32%) |++| Cat 40 cost per successful task, held-out world | $0.161 | $0.106 (−34%) |++| Cat 40 tasks finished, held-out world (of 600) | 441 (73.5%) | 454 (75.7%) |+- Tokens are cl100k counts. The Cat 40 rows are measured by the paid runs in gbrain-evals and are filled in before this ships.++Tokens are cl100k counts. The Cat 40 rows come from gbrain-evals Cat 40 on a world held out from all tuning. They compare this wave with v0.60.35.0, run at the same time on the same harness: success changed by +2.2 points per task (95% CI −0.5 to +5.0), with no new leaks. Wall time per task barely changed (median 61 s before, 64 s after).++Things to watch: a script or third-party client that reads `page_id`, `cosine`, `keyword_hit` or another ranking field from agent-facing search results now gets lean rows. Pass `fields: "full"` per call, or set `gbrain config set mcp.result_rows full` on the brain host. A thin CLI older than this release gets lean rows until it is upgraded or the host sets that option.+- ## To take advantage of v0.60.39.0++## To take advantage of v0.60.44.0++`gbrain upgrade` installs it. No schema migration runs.++1. **Restart every `gbrain serve`** so stdio servers load the new tool list and row shape.- 2. **Your agent reads `skills/migrations/v0.60.39.0.md` the next time you talk to it.** It covers the lean rows and how to get full rows back. Nothing in it spends money.++2. **Your agent reads `skills/migrations/v0.60.44.0.md` the next time you talk to it.** It covers the lean rows and how to get full rows back. Nothing in it spends money.+3. **Verify:**+ ```bash+ gbrain doctor+ gbrain config get mcp.result_rows # empty: agents get lean rows+ ```+4. **If any step fails,** file an issue at https://github.com/garrytan/gbrain/issues with the output of `gbrain doctor` and `~/.gbrain/upgrade-errors.jsonl` if it exists.++### Behavior changes++- **Remote `search` and `query` callers get lean rows by default.** A row keeps `id`, `slug`, `title`, `type`, `chunk_text`, `score`, `effective_date`, `source_id`, `chunk_id`, `evidence`, `create_safety`, the markers `injection_suspected`, `injection_p`, `unverified`, `content_flag`, `status`, `superseded`, `superseded_by`, `message_id`, `thread_id` and `source_subject` when present, `modality` when not text, `stale` when true, and `delivered: {"truncated": true}` when delivery cut the text. `fields: "full"` per call, `mcp.result_rows: full` per host (DB plane wins over the config file) and gbrain's own thin client (it sends `X-Gbrain-Client: gbrain-remote-cli/<version>`) get every field. `_meta.retrieval.rows` reports the shape. Trusted local callers always get full rows. Examples and a client table: [docs/mcp/README.md](docs/mcp/README.md#search-and-query-result-rows).+- **Successful tool results are compact JSON** in the first content block. Error envelopes are unchanged.+- **Starter tool descriptions are short.** Every starter tool keeps its purpose, required inputs, consequential defaults, next call and recovery move; the longer text is in [docs/mcp/TOOL_REFERENCE.md](docs/mcp/TOOL_REFERENCE.md). The initialize instructions are unchanged.+- **The saved-facts notice is capped at 1,500 characters and the other-names notice at 400**, with whole items and a `(+N more)` count; the first item always shows.++### Itemized changes++#### Result rows and serialization++- `src/core/search/lean-rows.ts` projects rows at the end of `searchOutput` in `src/core/ops/search.ts`, after capture, response meta and the last-retrieved bump read full rows. `OperationContext.resultRows` is set by all three MCP transports (`src/mcp/result-rows.ts`: the header and dual-plane `mcp.result_rows`); the header selects a row shape only and never gates authority.+- `src/mcp/dispatch.ts` serializes successful results with `JSON.stringify(result)`.+- Tests: `test/search-lean-rows.test.ts` (field set, escape hatches, `assemble_evidence` and `fetch` from lean rows, truncation under omitted, configured and explicit `return_unit`, the duplicate-page guard), `test/mcp-result-rows-skew.test.ts` (old and new CLI against the host over OAuth HTTP, the legacy bearer transport and stdio, including `mcp.strict_params=reject`), `test/mcp-result-size-ceiling.test.ts` (the model-visible size of a canonical search and query result; re-pin procedure in the file).++#### Tool list++- Per-tool schema budgets, hard caps of 1,200 characters per description and 200 per parameter description, the 25,000-character served starter ceiling (with `mcp.publish_skills` on and off), a cl100k token ceiling and the instructions ceiling are pinned by `test/mcp-schema-budget.test.ts`, with the minimum guidance each tool must keep.++#### Notices++- `retrievalNoticeBlocks` (`src/mcp/dispatch.ts`) applies the ceilings; boundaries pinned by `test/mcp-notice-ceilings.test.ts`.++#### Search latency++- Search runs one indexed check for an active saved fact before scanning saved facts, and skips the scan when there is none. The declared-name scan skips rows without a declaration keyword and runs once per search when the response reads the same rows the other-name search did. Results are byte-identical (`test/search-c5-identical.test.ts`).+- Per-search stage profile on the 10,000-page scale harness (PGLite, keyless): primary hybrid search 19.5 ms, projection-readiness check 6.0 ms, unsealed-pages check 0.5 ms, declared-name scans 0.01 ms each; the saved-facts scan does not run in the harness (it runs on the MCP dispatch path, where it took 3.1 ms on this fixture, which has saved facts).+- `bun scripts/scale/run.ts --pages 10000 --seed 1`, agent (MCP) search p50: 41.1 ms before and 39.0 ms after this change, same machine and session. On the harness version that also runs v0.60.32.0, v0.60.32.0 measured 95.9 and 90.6 ms and this release 27.4 ms (27.3 ms before the search change); most of that gain is v0.60.37.0's planner statistics.+ ## [0.60.41.0] - 2026-10-04++ **A keyword-only `query` whose answer is in the top five now grades `moderate` again when the question merely uses a word the brain never writes, while questions about a missing attribute or an unknown company still grade `weak` (#5919). Conversation pages can set their own segmentation gap (#5918).**++ v0.60.32.0 started grading an OR-relaxed keyword top (no chunk matched every query word) `weak`. That correctly flagged questions the brain cannot answer, but it also flagged answerable ones such as "Which city is Acme Example headquartered in?" against a page that says "Acme Example is headquartered in ...": the word "city" is never written, so the strict match fails even though the answer is right there. An agent that gates on `moderate` or better then abstained on answers it had.++ The grade now checks the top five rows before calling a relaxed top weak. It grades `moderate`, with the new reason `keyword_relaxed_corroborated`, when all of these hold:+ - at most one content word of the question appears in none of the five rows;+ - that word is not a name (a capitalized or acronym word such as an unknown company), because an unmatched name means the question is about something the evidence never mentions;+ - one row holds every other matched word, so the entity and the asked attribute appear together instead of on different pages.++ Otherwise it stays `weak` with reason `keyword_relaxed_top`. On the gbrain-evals A4 abstention world (keyword-only, 240 questions), answerable questions graded `moderate` rise from 40 to 100 of 120, and unanswerable questions graded `moderate` stay at 0 of 120. The remaining 20 answerable questions ask for "annual recurring revenue" while the pages write "ARR"; with no shared words, a keyword-only grade cannot tell them from a missing attribute, so they stay `weak`. With an embedding provider configured, relaxed rows are not used whenever the vector search returns results, so this path is mainly the keyless and degraded one.++ `gbrain extract-conversation-facts` now reads an optional `conversation_segment_gap_minutes` from a page's frontmatter and splits that page on its own gap instead of the 30-minute default. Set it from a collector that knows its message cadence, as an unquoted whole number of minutes from 1 to 10080. Any other value is ignored. A warning names the page, the rejected value, the accepted range and the command to rerun after fixing it. Changing the value changes the page's content hash, so the next run extracts the page again.++ ## [0.60.40.0] - 2026-10-04++ **When a page repair fails, gbrain now says exactly what stopped it, and pages whose file only gained new lines can be repaired in a few commands instead of by hand.**++ Each page lives twice in a managed brain: as a markdown file and as a database row. When something edits the file directly, gbrain stops saving new facts to that page so it never overwrites one copy with the other. The repair tool for that (`gbrain sources reconcile`) could fail with `Publication failed (P0001). Inspect owner diagnostics.`, and the diagnostics said nothing. P0001 comes from a safety check inside the database, and gbrain threw away its reason. Now the failure names the table, the kind of write, which safety rule fired and the gbrain build that ran the job, so the next report pins the cause.++ Repairs got easier too. A new read-only classification sorts drifted pages by how they drifted. A new opt-in preview mode fills in the decisions for changes that only add things: contacts appended to a list, a "last used" date that moved forward. Lines added to the body or timeline are shown as suggestions you accept explicitly, because an added line can still contradict an older one. Anything that changed or removed existing text, or touched privacy, titles, tags or other policy fields, still waits for a person.++ ### How to use it++ ```bash+ # 1. See how a source's drifted pages drifted (read-only, no page text in the output)+ gbrain sources reconcile <source> --brain host --audit --classify --limit 25 --json++ # 2. Preview one page with the additive rules, read the inserted lines in the private file+ gbrain sources reconcile <source> <slug> --brain host --preview --auto-additive --out ~/.gbrain/repair/p.json --json++ # 3. Accept the inserted lines once you (or the user) have read them, then apply+ gbrain sources reconcile <source> <slug> --brain host --preview --auto-additive --accept-suggested --out ~/.gbrain/repair/p2.json --json+ gbrain sources reconcile <source> <slug> --brain host --apply ~/.gbrain/repair/p2.json --request-id "$(bun -e 'console.log(crypto.randomUUID())')" --json++ # 4. Retry the write that was blocked, with a new request id+ ```++ ### What you'd see++ | Drift on the page | Classification | What the preview does |+ | --- | --- | --- |+ | Contacts appended after every stored entry, repeats kept | `structurally_additive` | Decides it |+ | `updated` or `phone_last_used` moved forward | `structurally_additive` | Decides it |+ | New lines in the body or timeline, nothing removed | `additive_with_suggestions` | Suggests it; needs `--accept-suggested` |+ | A stored sentence edited or deleted | `review_required` | Leaves it for a person |+ | `visibility`, `access`, title, tags or an `expires_at` changed | `review_required` | Leaves it for a person |++ A refused write now reads like this in the receipt (`write_error_detail`), with no page text and no source names:++ | Field | Example |+ | --- | --- |+ | `write_error` | `writer_coordinator_required` |+ | `table` / `op` | `pages` / `INSERT` |+ | `branch` / `relationship` | `allowlist` / `different_source` |+ | `stage` | `publication` or `after_file_publication` |++ `gbrain sources writer status --probe --json` adds `recent_failures`, which also carries the source ids and the gbrain build and host that ran the failed attempt. Those stay owner-only because a source name can itself be private.++ ### Two new doctor checks++ - `managed_guard_schema_drift` warns when a guarded table (pages, tags, timeline entries, takes, facts, aliases, sources) carries a column gbrain never created, and calls out a `source_id` on tags, timeline entries or takes, the #5983 cause.+ - `publication_refusals` counts writes the database refused in the last 7 days, split by the managed-writer guard, another trigger, and older unclassified P0001 failures, and says what to run next.++ ### Things to watch++ - Restart every long-running gbrain process that shares the database (serve, autopilot, sync jobs) after upgrading. A refusal is most often one older process doing a write the current guard refuses, and the new record names that process's build.+ - "Structurally additive" checks structure, not truth. The rules never decide prose for you.+ - Preview files with automatic decisions use artifact format 2. An older gbrain refuses them as malformed rather than guessing.++ ### What we caught and fixed before merging++ The plan went through CEO, engineering and outside-voice review. The reviewers caught that an appended line can contradict an old one, so prose became a suggestion instead of an automatic decision. They caught that the first draft of the diagnostic would have shown source names to remote callers, so names moved behind the owner-only status command. They also caught that the failure record would have been erased by receipt compaction and lost across crash recovery, so it now survives both. We could not reproduce the reporter's P0001 on a clean schema: 14 page and brain states committed on v0.60.35.0 and v0.60.37.0 against real Postgres. The cause turned out to be a schema change on the reporter's brain (a `source_id` column on tags, timeline and take tables that gbrain never creates), fixed in v0.60.38.0 (#5983). With this release, that failure would have reported `relationship: missing_source` on `tags`, and the new doctor check names the stray column directly.++ ## To take advantage of v0.60.40.0++ `gbrain upgrade` applies schema migration v198 (a nullable `error_detail` column on write receipts and a re-installed managed-writer guard). If it did not, or `gbrain doctor` warns about a partial migration:++ 1. **Run the orchestrator:**+ ```bash+ gbrain apply-migrations --yes --no-autopilot-install+ ```+ 2. **Restart every gbrain process that shares this database** so all of them run the same build.+ 3. **Verify:**+ ```bash+ gbrain sources writer status --probe --json # recent_failures is present (often empty)+ gbrain sources reconcile <source> --brain host --audit --classify --limit 5 --json+ ```+ 4. **If any step fails,** file an issue at https://github.com/garrytan/gbrain/issues with the output of `gbrain doctor` and `~/.gbrain/upgrade-errors.jsonl` if it exists.++ ### Itemized changes++ #### Diagnostics (#5974)+ - `gbrain_require_managed_writer()` raises with `TABLE`, `SCHEMA`, `CONSTRAINT = managed_writer_guard:<checkpoint|topology|allowlist>` and a JSON `DETAIL` (`op`, `relationship`, source ids). Migration v198 re-installs it and adds `persistence_requests.error_detail jsonb`.+ - New `src/core/persistence/publication-failure.ts`: `databaseRefusal` maps a guard P0001 to `writer_coordinator_required` (`origin: database_guard`) and any other P0001 to `storage_error` naming the raising function from the error's `where`. Raw messages, SQL and row values are never kept. `withAttempt` stamps stage, build and host; `publicFailureDetail` strips source ids, build and host for receipts.+ - `requestError`, `finishUnpublishedFailure`, `markRecovering`, `recoverPublication` and `completeWrite` carry the detail; compaction keeps it. The consumer logs publication failures that used to return without a log line.+ - Receipts gain `write_error_detail`; refusals carry an agent-facing suggestion (`DATABASE_REFUSAL_HINT`). `sources writer status` gains `recent_failures`. New row in `docs/guides/write-refusals.md`.++ #### Additive drift resolution (#5974)+ - New `src/core/persistence/reconcile-additive.ts`: `classifyDrift` over the complete file/database delta; `additiveDecisions`; `assertAutoDecisions` rechecks rule, rule version and evidence digest at apply and owner preparation.+ - `sources reconcile --preview --auto-additive [--accept-suggested]`; preview returns `classification`, `drift_paths`, `auto_decided_paths` and `next_action`. Artifact `format_version: 2` adds `auto_decisions`.+ - `sources reconcile --audit --classify` adds per-page `classification`, `drift_paths` and `file_modified_after_database`, plus `classified` counts.+ - Docs: `docs/guides/concurrent-writes.md` (classify and additive section), `RECONCILE_HELP`.++ #### Doctor (#5983, #5974)+ - New `src/commands/doctor/checks/managed-guard.ts`: `managed_guard_schema_drift` (columns on `GUARDED_TABLES` outside `GUARDED_TABLE_COLUMNS`, pinned to the catalog goldens by `test/doctor-managed-guard.test.ts`) and `publication_refusals` (7-day count by origin). Both link `docs/guides/write-refusals.md#managed-guard-page-children`. `PAGE_CHILD_TABLES` and `GUARDED_TABLES` are now exported from `writer-guard-schema.ts`.+ - Migration v198 replaces only the guard function (`MANAGED_WRITER_GUARD_FUNCTION_SQL`, no table lock) on top of v197's page-child source resolution.++ #### Tests+ - `test/persistence-publication-refusal-5974.test.ts` (PGLite and Postgres): cross-source write inside publication, refusal after file replacement with exact restoration, redaction, compaction survival, other P0001 raisers.+ - `test/persistence-reconcile-additive-5974.test.ts` (PGLite and Postgres): classifier truth table; the reporter's page shape through audit, preview, apply, `remember` and MCP readback; a replaced page staying blocked; tampered evidence and a concurrent file change refusing apply. Both files join the PostgreSQL persistence-validation workflow.++ ## [0.60.39.0] - 2026-10-03++ **`gbrain repair failed-writes` replays the `put_page`, `add_timeline_entry` and `remember` calls the managed writer guard refused before v0.60.38.0 (#5983), from the content their failed receipts still hold. Each write is replayed once, and never over a later write of the same page.**++ v0.60.38.0 fixed the guard, but writes it had already refused stayed failed. Resubmitting under the same request id returns the stored failure, and the calling agent often has no copy of what it sent. Each failed receipt keeps the write's full intent until receipt compaction (30 days by default). The new repair kind finds receipts the guard refused, sorts them, and submits the caller writes again through their normal path as the local owner under new request ids.++ The preview gives every refused write a class:+ - `replay`: replayed on apply.+ - `already_written`: the same write committed later, or an earlier apply replayed it.+ - `duplicate`: a later attempt of the same write is the candidate instead.+ - `superseded`: the page was written or deleted later, or a newer failed save of the page exists, so replaying would overwrite or recreate it.+ - `unpinned_target`: a `remember` that was saved unattributed. Replaying it would guess its subject again, so it is kept.+ - `producer_owned`: gbrain produced the write itself, through sync or file imports, reconcile, relink or a maintenance page. The preview prints the command that produces it again from current content instead.++ The apply replays exactly the previewed set (`--expect <hash>`). It first re-checks each write's class and its original caller's authority. A write an agent sent over MCP is prepared as a remote write again, so it can do no more than the original. A page save is bound to the page revision the preview saw, so it never overwrites a page that changed. The failed receipts stay as history.++ `gbrain sources refresh` no longer refuses with `refresh_recovery_required` when it starts while another write to the same checkout is still being saved. That in-progress save is normal work, not stuck recovery, so the refresh now waits for it to finish, as `--wait-drain` intends. Recovery that no running write will finish is still refused.++ ## To take advantage of v0.60.39.0++ On the brain host, after the v0.60.38.0 recovery steps:++ 1. **Keep the receipts while you recover** (if you have not already):+ ```bash+ gbrain config set persistence.receipt_retention_days 90+ ```+ 2. **Preview, show the user the listing, then apply after they agree:**+ ```bash+ gbrain repair failed-writes --source <id>+ gbrain repair failed-writes --source <id> --apply --expect <hash>+ ```+ 3. **Verify:** a second preview lists nothing to replay (`already_written` instead), and the replayed pages show their tags, timeline entries and facts. For each `superseded` write, read the page and re-issue the change by hand if it is still wanted.++ ## [0.60.38.0] - 2026-10-03++ **On a managed brain whose `tags`, `timeline_entries` or `takes` table carries a `source_id` column gbrain never created, every tag, timeline and take write was refused, even coordinated ones. Managed sync stalled at the first tagged page, `facts relink` aborted, autopilot dropped timeline rows every cycle, and `remember`, `add_timeline_entry` and maintenance-page writes failed. Those writes commit again (#5983).**++ The managed writer guard (`gbrain_require_managed_writer`) decides which source a row belongs to before it lets a write through. It took the row's `source_id` whenever the column existed, even when the value was NULL. gbrain's schema has no such column on those three tables, so on a canonical brain the guard looked up the parent page instead. A brain where something else had added a nullable `source_id` column to them sent every insert and update to the "no source" branch and refused it as `writer_coordinator_required`. Deletes passed through the NULL-source cascade exemption, so delete-only work kept succeeding. The client saw `storage_error: Publication failed (P0001). Inspect owner diagnostics.`++ Tags, timeline entries and takes now always take their source from their page. A `source_id` column on them is ignored whatever it holds, so it can neither block a write nor let one through for another source. On such a brain, an uncoordinated delete of a tag, timeline or take row on a live page now needs the coordinator, as it always did on a canonical brain. Deleting a page still removes its children. Migration v197 replaces the guard function only; it re-creates no trigger.++ ## To take advantage of v0.60.38.0++ `gbrain upgrade` installs the binary and runs schema migration v197. Run the upgrade on the brain host (a thin client cannot run it; hand the owner these steps). Pause autopilot during the upgrade: as on every upgrade, the schema replay re-creates the guard triggers.++ 1. **Keep the failed writes' content while you recover.** Failed write requests keep their original content for 30 days (`persistence.receipt_retention_days`). Brains hit by this bug since activation should keep them longer until the replay tool lands:+ ```bash+ gbrain config set persistence.receipt_retention_days 90+ ```+ 2. **Run the migration if the upgrade did not, then verify:**+ ```bash+ gbrain apply-migrations --yes --no-autopilot-install+ gbrain doctor --json # the schema_version check reports 197 or later+ ```+ 3. **Unstick each managed sync.** Re-run the original sync invocation for each affected source unchanged (same brain, source, `--working-tree` and other options), adding `--no-pull --retry-failed --json`. A different sync can succeed while the original failed run stays unresolved.+ ```bash+ gbrain sync --source <id> --no-pull --retry-failed --json+ ```+ Check that the source's `last_commit` advances (`gbrain sources status <id>`).+ 4. **Rebuild the timeline rows autopilot dropped:**+ ```bash+ gbrain extract --stale --source-id <id> --json+ gbrain extract timeline --source db --source-id <id> --json # rows the page text has but the table lacks+ ```+ Run the second command until it reports no new rows.+ 5. **Re-link facts. Preview first; the model tier costs money, so ask the user before it:**+ ```bash+ gbrain facts relink --source <id> --dry-run+ gbrain facts relink --source <id> --no-llm+ gbrain facts relink --source <id> --max-usd <n> # only after the user agrees+ ```+ Follow the printed `next_command` until `has_more` is false. Exit 0 alone does not mean the backlog is done.+ 6. **Writes that failed outright are not replayed by the upgrade.** A `remember`, `add_timeline_entry` or maintenance-page write refused by this bug keeps its failed receipt; resubmitting the same request id returns that failure. From v0.60.39.0, `gbrain repair failed-writes` replays the caller writes from those receipts. Before that, re-issue the ones you have a record of with a new request id.## [0.60.37.0] - 2026-10-03diff --cc VERSIONindex 2d5d7d7c52,1889bf9064..cf91026bc4--- a/VERSION+++ b/VERSION@@@ -1,1 -1,1 +1,1 @@@- 0.60.39.0-0.60.41.0++0.60.44.0diff --cc openclaw.plugin.jsonindex 81523478fc,0cc22502e6..c6c8aa1d8c--- a/openclaw.plugin.json+++ b/openclaw.plugin.json@@@ -1,7 -1,7 +1,7 @@@{"id": "gbrain-context-engine","name": "gbrain",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Personal knowledge brain with Postgres + pgvector hybrid search","family": "bundle-plugin","kind": "context-engine",diff --cc package.jsonindex 21bbf20c38,94e3d59ac8..7367b7e049--- a/package.json+++ b/package.json@@@ -207,7 -207,7 +207,7 @@@"bun": ">=1.4.0"},"license": "MIT",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","overrides": {"@ai-sdk/provider-utils": "4.0.56","@hono/node-server": "^2.0.5",diff --cc plugin-variants/gbrain-coding/.claude-plugin/plugin.jsonindex 36359010d3,9bbe51034a..c6c8c05086--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain-coding",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)","author": {"name": "Garry Tan",diff --cc plugin-variants/gbrain-coding/.codex-plugin/plugin.jsonindex cf1986e3e1,13606a70e8..5b695020db--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain-coding",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant. (persona variant of the gbrain plugin — 21 skills)","author": {"name": "Garry Tan",diff --cc plugin-variants/gbrain-coding/README.mdindex 530c3ce2ef,fe84a490c6..f6d809db19--- a/plugin-variants/gbrain-coding/README.md+++ b/plugin-variants/gbrain-coding/README.md@@@ -1,4 -1,4 +1,4 @@@- <!-- gbrain-plugin-tree-stamp: 0.60.39.0 -->-<!-- gbrain-plugin-tree-stamp: 0.60.41.0 -->++<!-- gbrain-plugin-tree-stamp: 0.60.44.0 --># gbrain-coding (generated persona variant — do not hand-edit)Brain-first coding agent working inside a repo: retrieval, routing, ingest discipline, correction hygiene. Default persona for the claude-code harness bridge; also published as the gbrain-coding marketplace variant.diff --cc plugin-variants/gbrain-daily/.claude-plugin/plugin.jsonindex f009608193,371f5601a1..6ca75a4ee2--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain-daily",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)","author": {"name": "Garry Tan",diff --cc plugin-variants/gbrain-daily/.codex-plugin/plugin.jsonindex a1eef469c4,05cee2749f..e00012b411--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json@@@ -1,6 -1,6 +1,6 @@@{"name": "gbrain-daily",- "version": "0.60.39.0",- "version": "0.60.41.0",++ "version": "0.60.44.0","description": "Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant. (persona variant of the gbrain plugin — 20 skills)","author": {"name": "Garry Tan",diff --cc plugin-variants/gbrain-daily/README.mdindex 55012e5927,6787ab62ad..c14d960a82--- a/plugin-variants/gbrain-daily/README.md+++ b/plugin-variants/gbrain-daily/README.md@@@ -1,4 -1,4 +1,4 @@@- <!-- gbrain-plugin-tree-stamp: 0.60.39.0 -->-<!-- gbrain-plugin-tree-stamp: 0.60.41.0 -->++<!-- gbrain-plugin-tree-stamp: 0.60.44.0 --># gbrain-daily (generated persona variant — do not hand-edit)Personal knowledge-brain daily use: meetings, tasks, briefings, reading, research. Published as the gbrain-daily marketplace variant.diff --cc plugin/README.mdindex 09356a4da4,3f011cce54..29d5cfa11c--- a/plugin/README.md+++ b/plugin/README.md@@@ -1,4 -1,4 +1,4 @@@- <!-- gbrain-plugin-tree-stamp: 0.60.39.0 -->-<!-- gbrain-plugin-tree-stamp: 0.60.41.0 -->++<!-- gbrain-plugin-tree-stamp: 0.60.44.0 --># gbrain plugin skill tree (generated — do not hand-edit)This tree is the curated skill set for the gbrain Codex and Claude Codediff --cc skills/migrations/v0.60.44.0.mdindex 8ff07d2b70,0000000000..01dab19294mode 100644,000000..100644--- a/skills/migrations/v0.60.44.0.md+++ b/skills/migrations/v0.60.44.0.md@@@ -1,40 -1,0 +1,40 @@@- # Upgrade to v0.60.39.0: a cheaper gbrain per agent task++# Upgrade to v0.60.44.0: a cheaper gbrain per agent task++This release makes every MCP tool call cheaper for the agent that makes it.+Search and query results are smaller, tool results are compact JSON, the+starter tool list is less than half its old size, and search skips work it+does not need. Nothing here changes what gbrain finds. No schema migration+runs and nothing spends money.++1. **Restart every `gbrain serve`** after upgrading, so stdio servers pick up+ the new tool list and row shape.++2. **Know the new row shape.** Remote MCP callers (any harness talking to+ `gbrain serve`) now get lean `search` and `query` rows: `id`, `slug`,+ `title`, `type`, `chunk_text`, `score`, `effective_date`, `source_id`,+ `chunk_id`, `evidence`, `create_safety`, and every safety or provenance+ marker that is present. Ranking diagnostics (`page_id`, `chunk_index`,+ `chunk_source`, `keyword_hit`, `cosine`, `base_score`, boosts) are gone+ unless asked for. `_meta.retrieval.rows` says which shape came back.+ - To get every field for one call, pass `fields: "full"`.+ - If a script or client around this brain reads a dropped field, keep the+ old rows for every remote caller with the user's agreement:+ ```bash+ gbrain config set mcp.result_rows full+ ```+ then restart `gbrain serve` (OAuth HTTP picks it up on the next request).+ - The gbrain CLI on a thin-client install keeps full rows on its own once+ it is on this release. An older thin CLI gets lean rows until it is+ upgraded or the host sets `mcp.result_rows full`.++3. **Expect shorter tool descriptions.** The longer guidance for each starter+ tool is in `docs/mcp/TOOL_REFERENCE.md`. Read it when a tool's default is+ unclear. Notices about saved facts and other names under search results+ are capped (1,500 and 400 characters, whole items, with a `(+N more)`+ count); `recall` returns the full set of facts.++4. **Verify:**+ ```bash+ gbrain doctor+ gbrain config get mcp.result_rows # empty means lean rows for remote callers+ ```diff --cc skills/skills.lock.jsonindex 8ac7af0dfd,5e84bca7de..6d72c6a181--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@@ -160,7 -160,6 +160,7 @@@"migrations/v0.60.31.0.md": "fb8c0a98451a6f7826413ee7463421612511986252f6b803d91a26da94d378bf","migrations/v0.60.36.0.md": "8ce9aba221d24dec7f354b41c04d59fcbe947e9302a038e87e0ba807086c7ed7","migrations/v0.60.37.0.md": "e0e9d8ab0adb14cfb55d67f821614f25e0ab2f6281a1a1bfc10faefc95312015",- "migrations/v0.60.39.0.md": "2f4feef47daae3434958b803f9d0bec2e29a08e217d5506cfe52908a77443a9d",++ "migrations/v0.60.44.0.md": "415d05b4587e49c7bdad40b55878b0b50f5330915a5e49065638fb6680ced3fe","migrations/v0.60.5.0.md": "0d3ee19359a2740de08ac9ec388ddc15e7c72d663afe33832e1e54170528acab","migrations/v0.60.6.0.md": "1cbfca2c899e1348acbd61f0baa4c8e723b5283ff868c710c74e116c0cb6726e","migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",diff --cc templates/bootstrap/template-repo/README.mdindex e05410d5b3,25c0c89f98..1d1bc359b5--- a/templates/bootstrap/template-repo/README.md+++ b/templates/bootstrap/template-repo/README.md@@@ -1,6 -1,6 +1,6 @@@# gbrain agent workspace — template- <!-- gbrain-template-stamp: 0.60.39.0 -->-<!-- gbrain-template-stamp: 0.60.41.0 -->++<!-- gbrain-template-stamp: 0.60.44.0 -->This repository is the **"Use this template"** distribution artifact for a[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same