Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(docs): keep README and core-utilities key-files under their size caps (GBRA-202)
garrytan1542e2163e60
diff --git a/README.md b/README.mdindex 753bc60bf1..6536f5b4af 100644--- a/README.md+++ b/README.md@@ -2,7 +2,7 @@**Give the agent you already use a memory you control.** GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents. Start with keyless memory and keyword retrieval; add semantic search, synthesis, and background enrichment when you need them.-GBrain is MIT-licensed and free to self-host. [gbrain.io](https://gbrain.io/?ref=readme) is optional paid hosting for when you'd rather not run it yourself.+GBrain is MIT-licensed and free to self-host; gbrain.io is optional paid hosting.> [!TIP]> **Need hosted? First time running an agent?** Try **[gbrain.io](https://gbrain.io/?ref=readme)**, hosted GBrain, for the easiest experience: one brain for you and your team, connected to ChatGPT, Claude and Cursor, with nothing to install or keep online. Stuck? Email [email protected] and a person will set it up with you, free.@@ -28,7 +28,7 @@ I'm Garry Tan, President and CEO of Y Combinator. I built GBrain to run my own AAlongside keyword and semantic retrieval, GBrain offers two optional ways to use your stored knowledge:- **A synthesis layer that gives you the actual answer.** Synthesized, well-cited prose across people, companies, deals, and ideas. Not "here are 10 chunks that mention your query"; an actual answer with citations and an explicit note on what the brain doesn't know yet. The gap analysis is the part that changes how you use the brain.-- **A typed knowledge graph.** Trusted local page writes extract supported references without LLM calls when auto-linking is enabled. Remote `put_page` edges arrive later, via sweeps, maintenance or `add_link`. Ask "who works at acme-example?": walks are breadth-first, milliseconds on dense clusters ([how](docs/architecture/RETRIEVAL.md#breadth-first-graph-walks)). On the 145 BrainBench relationship questions, turning on relationship retrieval in the production search pipeline raised **R@5 from 0.6626 to 0.7241**, better on 45 of 435 question runs and worse on none ([2026-09-09 refresh](https://github.com/garrytan/gbrain-evals/blob/main/docs/benchmarks/2026-09-09-retrieval-refresh.md#production-relationship-retrieval-one-switch)). The often-quoted R@5 0.9791 is `graph-oracle-parse`, an adapter that knows the four question forms in advance: an upper bound, not a product score.+- **A typed knowledge graph.** Trusted local page writes extract supported references without LLM calls when auto-linking is enabled. Remote `put_page` edges arrive later, via sweeps, maintenance or `add_link`. Ask "who works at acme-example?": walks are breadth-first, milliseconds on dense clusters ([how](docs/architecture/RETRIEVAL.md#breadth-first-graph-walks)). On BrainBench relationship questions, relationship retrieval lifts production **R@5 from 0.6626 to 0.7241** ([benchmark](docs/architecture/RETRIEVAL.md#the-benchmark)); 0.9791 is the `graph-oracle-parse` upper bound, not a product score.The point of building a 150K-page brain is to use it as a strategic moat. To never lose context. To query what's in your own head without re-reading it. The brain layer is what makes the moat usable. The 24/7 dream cycle is what keeps it sharp. Both run on your hardware, your DB, your keys.@@ -99,8 +99,7 @@ before restarting services with this version.> can shadow the real binary, so never run `npm install -g gbrain` or> `bun add -g gbrain`. Install only via `bun install -g github:garrytan/gbrain#latest-stable`> or `git clone` + `bun install && bun link`.-> Installed it by mistake? `npm uninstall -g gbrain` / `bun remove -g gbrain`, then-> reinstall; `gbrain doctor` detects it.+> Installed by mistake? `gbrain doctor` gives the fix.> Schema not migrated ([#218](https://github.com/garrytan/gbrain/issues/218))?> Run `gbrain apply-migrations --yes --no-autopilot-install`; exit 1 means it's still> behind: run `gbrain doctor --json`, not `--yes` (`wedged`: relay its fix).diff --git a/docs/architecture/key-files/core-utilities-1.md b/docs/architecture/key-files/core-utilities-1.mdindex 91211a4ea0..36cc03e832 100644--- a/docs/architecture/key-files/core-utilities-1.md+++ b/docs/architecture/key-files/core-utilities-1.md@@ -64,7 +64,7 @@ The `src/core/cycle.ts` entry is on its own page: [Core Cycle primitive](core-cy- `src/core/mcp-usage.ts` — `readClientOpUsage(engine, {days})`: the ONE shared reader over `mcp_request_log`, consumed by `gbrain auth clients --usage`, the advisor `mcp-client-fit` collector, and `scripts/derive-starter-ops.ts`. Encodes the row-hygiene rules once (`normalizeLoggedOperation`): JSON-RPC method rows (`tools/list`, `initialize`, …) and `surface_change` audit rows drop; the legacy `tools/call:<name>` prefix strips to the op name, and the hygiene check re-runs on the stripped name (`tools/call:tools/list` is still not an op call). Only `status IN ('success','success_with_warnings')` rows count as usage — denied or erroring traffic cannot "use" its way into starter derivation or advisor fit findings. Windows on `created_at` (rides `idx_mcp_log_time_agent`); plain SQL through `engine.executeRaw`, both engines. Behavioral automation classification: `likely_automation` = >90% of calls are `context_pack`/`delta` boundary verbs (the hook lane is stdio and never logs, so there is no name convention to key on). Sees HTTP clients ONLY — stdio never writes the log. Pinned by test/mcp-usage.test.ts.-- `src/core/npm-squat-check.ts` — classifies `gbrain` PATH entries as real, foreign npm package, broken, or unknown for doctor's `npm_squat` check, plus the `gbrain` package directories under the global roots the caller passes (`<npm root -g>/gbrain`, `$BUN_INSTALL/install/global/node_modules/gbrain`): an unrelated global package no PATH entry reaches is appended after the PATH entries, so it warns when no real gbrain is on PATH and is noted when one wins. A warn caused by an unrelated package carries a structured `fix`: remove it (`npm uninstall -g gbrain`, or `bun remove -g gbrain` for Bun's global dir; always `ask_user`), then, only when no real gbrain remains on PATH, `bun install -g github:garrytan/gbrain#latest-stable` and the #218 schema recovery `gbrain apply-migrations --yes --no-autopilot-install`. On Windows it normalizes Git Bash/MSYS drive paths (`/c/...` → `C:/...`) and tries the native `.exe` suffix before reporting a broken entry; non-Windows classification keeps the original single-candidate behavior. Pinned by `test/npm-squat-check.test.ts` and, through the CLI, `test/doctor-npm-squat.test.ts`.+- `src/core/npm-squat-check.ts` — doctor's `npm_squat`: classifies `gbrain` PATH entries (real, foreign, broken, unknown) plus unrelated packages in `npm root -g` and Bun's global dir. A foreign winner's `fix` removes it (ask_user), then installs `#latest-stable` and runs the #218 recovery if no real gbrain is left. Windows: MSYS drive paths, `.exe` suffix. Tests: `npm-squat-check`, `doctor-npm-squat`.- `src/core/operations-descriptions.ts` — Constants module for tool descriptions. Pinned via `test/operations-descriptions.test.ts`. Houses `GET_RECENT_SALIENCE_DESCRIPTION`, `FIND_ANOMALIES_DESCRIPTION`, `GET_RECENT_TRANSCRIPTS_DESCRIPTION` plus `LIST_PAGES_DESCRIPTION`, `QUERY_DESCRIPTION`, `SEARCH_DESCRIPTION`. Stable surface for the Tier-2 LLM routing eval — keeping them here keeps the test from binding to whatever is in `operations.ts` at test-run time. Description-edit checklist for `QUERY_DESCRIPTION` / `SEARCH_DESCRIPTION` (and any other text a starter tool serves): no pre-merge lane carries a provider key, so run the routing eval yourself with `GBRAIN_TEST_KEEP_PROVIDER_KEYS=1 bun test test/e2e/salience-llm-routing.test.ts` (Haiku 4.5 at temperature 0, ≈ $0.04; a `search`/`query` rewrite can move concept phrasings such as "all the people that work on X" from `query` to `search` without any unit test noticing), then `bun test test/mcp-schema-budget.test.ts` (per-tool budget, 25,000-character served starter ceiling and its 200-character headroom floor, `MINIMUM_GUIDANCE` pins), `test/operations-descriptions.test.ts`, `test/mcp-instructions-batching.test.ts`, and regenerate with `bun run build:operation-manifest`, `bun run scripts/generate-tool-catalog.ts` and `GBRAIN_TEST_UPDATE_GOLDENS=1 bun test test/cli-goldens.test.ts`. Both descriptions say that people/companies/projects by topic are `query` work: Haiku 4.5 otherwise reads "all the X that do Y" as a `search` list lookup (measured at temperature 1: 28/80 concept phrasings misrouted without the clause, 1/80 with it).diff --git a/llms-full.txt b/llms-full.txtindex 89f2d060ce..b1cfbd3220 100644--- a/llms-full.txt+++ b/llms-full.txt@@ -4983,7 +4983,7 @@ Source: https://raw.githubusercontent.com/garrytan/gbrain/master/README.md**Give the agent you already use a memory you control.** GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents. Start with keyless memory and keyword retrieval; add semantic search, synthesis, and background enrichment when you need them.-GBrain is MIT-licensed and free to self-host. [gbrain.io](https://gbrain.io/?ref=readme) is optional paid hosting for when you'd rather not run it yourself.+GBrain is MIT-licensed and free to self-host; gbrain.io is optional paid hosting.> [!TIP]> **Need hosted? First time running an agent?** Try **[gbrain.io](https://gbrain.io/?ref=readme)**, hosted GBrain, for the easiest experience: one brain for you and your team, connected to ChatGPT, Claude and Cursor, with nothing to install or keep online. Stuck? Email [email protected] and a person will set it up with you, free.@@ -5009,7 +5009,7 @@ I'm Garry Tan, President and CEO of Y Combinator. I built GBrain to run my own AAlongside keyword and semantic retrieval, GBrain offers two optional ways to use your stored knowledge:- **A synthesis layer that gives you the actual answer.** Synthesized, well-cited prose across people, companies, deals, and ideas. Not "here are 10 chunks that mention your query"; an actual answer with citations and an explicit note on what the brain doesn't know yet. The gap analysis is the part that changes how you use the brain.-- **A typed knowledge graph.** Trusted local page writes extract supported references without LLM calls when auto-linking is enabled. Remote `put_page` edges arrive later, via sweeps, maintenance or `add_link`. Ask "who works at acme-example?": walks are breadth-first, milliseconds on dense clusters ([how](docs/architecture/RETRIEVAL.md#breadth-first-graph-walks)). On the 145 BrainBench relationship questions, turning on relationship retrieval in the production search pipeline raised **R@5 from 0.6626 to 0.7241**, better on 45 of 435 question runs and worse on none ([2026-09-09 refresh](https://github.com/garrytan/gbrain-evals/blob/main/docs/benchmarks/2026-09-09-retrieval-refresh.md#production-relationship-retrieval-one-switch)). The often-quoted R@5 0.9791 is `graph-oracle-parse`, an adapter that knows the four question forms in advance: an upper bound, not a product score.+- **A typed knowledge graph.** Trusted local page writes extract supported references without LLM calls when auto-linking is enabled. Remote `put_page` edges arrive later, via sweeps, maintenance or `add_link`. Ask "who works at acme-example?": walks are breadth-first, milliseconds on dense clusters ([how](docs/architecture/RETRIEVAL.md#breadth-first-graph-walks)). On BrainBench relationship questions, relationship retrieval lifts production **R@5 from 0.6626 to 0.7241** ([benchmark](docs/architecture/RETRIEVAL.md#the-benchmark)); 0.9791 is the `graph-oracle-parse` upper bound, not a product score.The point of building a 150K-page brain is to use it as a strategic moat. To never lose context. To query what's in your own head without re-reading it. The brain layer is what makes the moat usable. The 24/7 dream cycle is what keeps it sharp. Both run on your hardware, your DB, your keys.@@ -5080,8 +5080,7 @@ before restarting services with this version.> can shadow the real binary, so never run `npm install -g gbrain` or> `bun add -g gbrain`. Install only via `bun install -g github:garrytan/gbrain#latest-stable`> or `git clone` + `bun install && bun link`.-> Installed it by mistake? `npm uninstall -g gbrain` / `bun remove -g gbrain`, then-> reinstall; `gbrain doctor` detects it.+> Installed by mistake? `gbrain doctor` gives the fix.> Schema not migrated ([#218](https://github.com/garrytan/gbrain/issues/218))?> Run `gbrain apply-migrations --yes --no-autopilot-install`; exit 1 means it's still> behind: run `gbrain doctor --json`, not `--yes` (`wedged`: relay its fix).