Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
v0.60.39.0 chore(release): cat40 cost wave version stamps, CHANGELOG, migration note, plugin trees, skills manifest
garrytana714410a5628
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex b5d014ca8a..dad8abc3ce 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.jsonindex a789917002..dc858cb259 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/BOOTSTRAP_FOR_AGENTS.md b/BOOTSTRAP_FOR_AGENTS.mdindex ffbcad7368..c833b0df21 100644--- a/BOOTSTRAP_FOR_AGENTS.md+++ b/BOOTSTRAP_FOR_AGENTS.md@@ -1,4 +1,4 @@-<!-- gbrain-runbook-stamp: 0.60.37.0 -->+<!-- gbrain-runbook-stamp: 0.60.39.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 --git a/CHANGELOG.md b/CHANGELOG.mdindex 8642e139b6..9b3a37837c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,68 @@ credits are retained; no result has been reassigned to another provider. Originaidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [0.60.39.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)** |++Tokens are cl100k counts. The Cat 40 rows are measured by the paid runs in gbrain-evals and are filled in before this ships.++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++`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.+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.37.0] - 2026-10-03**Foundations 1: a 10,000-page PGLite brain answers health and orphan checks in well under a second instead of 12 to 15 seconds, imports in about a third less time, records who wrote each page version, fact, take and timeline entry, lets several agents share one brain without losing track of whose session produced what, and gives every legacy token the same grant shape as an OAuth client.**diff --git a/VERSION b/VERSIONindex da2b97e132..2d5d7d7c52 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-0.60.37.0+0.60.39.0diff --git a/openclaw.plugin.json b/openclaw.plugin.jsonindex d350f981d3..81523478fc 100644--- a/openclaw.plugin.json+++ b/openclaw.plugin.json@@ -1,7 +1,7 @@{"id": "gbrain-context-engine","name": "gbrain",- "version": "0.60.37.0",+ "version": "0.60.39.0","description": "Personal knowledge brain with Postgres + pgvector hybrid search","family": "bundle-plugin","kind": "context-engine",diff --git a/package.json b/package.jsonindex 682c56ce12..21bbf20c38 100644--- a/package.json+++ b/package.json@@ -207,7 +207,7 @@"bun": ">=1.4.0"},"license": "MIT",- "version": "0.60.37.0",+ "version": "0.60.39.0","overrides": {"@ai-sdk/provider-utils": "4.0.56","@hono/node-server": "^2.0.5",diff --git a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json b/plugin-variants/gbrain-coding/.claude-plugin/plugin.jsonindex 95970d5537..36359010d3 100644--- a/plugin-variants/gbrain-coding/.claude-plugin/plugin.json+++ b/plugin-variants/gbrain-coding/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain-coding",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json b/plugin-variants/gbrain-coding/.codex-plugin/plugin.jsonindex 8f0139692e..cf1986e3e1 100644--- a/plugin-variants/gbrain-coding/.codex-plugin/plugin.json+++ b/plugin-variants/gbrain-coding/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain-coding",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/plugin-variants/gbrain-coding/README.md b/plugin-variants/gbrain-coding/README.mdindex fd6cce50f0..530c3ce2ef 100644--- a/plugin-variants/gbrain-coding/README.md+++ b/plugin-variants/gbrain-coding/README.md@@ -1,4 +1,4 @@-<!-- gbrain-plugin-tree-stamp: 0.60.37.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.39.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 --git a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json b/plugin-variants/gbrain-daily/.claude-plugin/plugin.jsonindex 1dff32bab5..f009608193 100644--- a/plugin-variants/gbrain-daily/.claude-plugin/plugin.json+++ b/plugin-variants/gbrain-daily/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain-daily",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json b/plugin-variants/gbrain-daily/.codex-plugin/plugin.jsonindex 96bd91d926..a1eef469c4 100644--- a/plugin-variants/gbrain-daily/.codex-plugin/plugin.json+++ b/plugin-variants/gbrain-daily/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain-daily",- "version": "0.60.37.0",+ "version": "0.60.39.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 --git a/plugin-variants/gbrain-daily/README.md b/plugin-variants/gbrain-daily/README.mdindex 64a28cb4da..55012e5927 100644--- a/plugin-variants/gbrain-daily/README.md+++ b/plugin-variants/gbrain-daily/README.md@@ -1,4 +1,4 @@-<!-- gbrain-plugin-tree-stamp: 0.60.37.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.39.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 --git a/plugin/README.md b/plugin/README.mdindex 5b51f6a44e..09356a4da4 100644--- a/plugin/README.md+++ b/plugin/README.md@@ -1,4 +1,4 @@-<!-- gbrain-plugin-tree-stamp: 0.60.37.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.39.0 --># gbrain plugin skill tree (generated — do not hand-edit)This tree is the curated skill set for the gbrain Codex and Claude Codediff --git a/skills/migrations/v0.60.39.0.md b/skills/migrations/v0.60.39.0.mdnew file mode 100644index 0000000000..8ff07d2b70--- /dev/null+++ b/skills/migrations/v0.60.39.0.md@@ -0,0 +1,40 @@+# Upgrade to v0.60.39.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 --git a/skills/skills.lock.json b/skills/skills.lock.jsonindex 5e84bca7de..8ac7af0dfd 100644--- a/skills/skills.lock.json+++ b/skills/skills.lock.json@@ -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.5.0.md": "0d3ee19359a2740de08ac9ec388ddc15e7c72d663afe33832e1e54170528acab","migrations/v0.60.6.0.md": "1cbfca2c899e1348acbd61f0baa4c8e723b5283ff868c710c74e116c0cb6726e","migrations/v0.7.0.md": "97c2740445a10b1c5c7123c17dbd625fa27a94095b85d27c2b278da756c4c59a",diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.mdindex 448935d487..e05410d5b3 100644--- a/templates/bootstrap/template-repo/README.md+++ b/templates/bootstrap/template-repo/README.md@@ -1,6 +1,6 @@# gbrain agent workspace — template-<!-- gbrain-template-stamp: 0.60.37.0 -->+<!-- gbrain-template-stamp: 0.60.39.0 -->This repository is the **"Use this template"** distribution artifact for a[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same