Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
v0.60.63.0: retrieval feedback (opt-in) and declared single-value relations
garrytan2f98071ec367
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 674f241c05..920a43afd0 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.62.0",+ "version": "0.60.63.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 f2ad355ff3..a13e869bb9 100644--- a/.codex-plugin/plugin.json+++ b/.codex-plugin/plugin.json@@ -1,6 +1,6 @@{"name": "gbrain",- "version": "0.60.62.0",+ "version": "0.60.63.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 a34995e100..c14dbb3b1b 100644--- a/BOOTSTRAP_FOR_AGENTS.md+++ b/BOOTSTRAP_FOR_AGENTS.md@@ -1,4 +1,4 @@-<!-- gbrain-runbook-stamp: 0.60.62.0 -->+<!-- gbrain-runbook-stamp: 0.60.63.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 f695bbf2c4..22178ac068 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,6 +10,81 @@ 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.63.0] - 2026-10-05++**Your brain can learn which pages actually helped, if you turn it on.**++Retrieval feedback records which pages each answer used. When you or your agent rate an answer (`rate_answer`, or `gbrain rate <answer_id> 1-5`), those pages rank a little higher or lower next time: a capped 0.9x to 1.1x multiplier, no model call, nothing leaves the machine. It ships **off**. In held-out tests with consistent ratings it improved ranking on entity-centric brains (people, companies, deals: +2.0 NDCG@10) and did not help on chat-history brains, which is why it is opt-in. `gbrain post-upgrade` prints a one-time notice with the same facts and the command.++A schema pack can now also declare a state relation single-valued (`cardinality: one_per_from`, for example `works_at` meaning the one current employer). The nightly relationship check then proposes, without a model, which competing relationship ended and when. It only proposes: held-out testing found an advisory timeline line read as a new job, so every closure waits for review.++### How to use it++```bash+gbrain config set feedback.enabled true # opt in (explicit ratings only)+gbrain search "acme renewal" # prints: answer: ans_… (rate with: gbrain rate ans_… 1-5)+gbrain rate ans_01J… 5 # the pages that answer used rank a little higher+gbrain search "acme renewal" --explain # shows feedback ×1.01 on rated pages+gbrain feedback status # what the brain has learned; gbrain feedback reset undoes it+gbrain schema cardinality-preview # with a pack that declares cardinality: what would close+```++Over MCP, `rate_answer { answer_id, rating }` rates an answer, or `pages: [{ ref, rating }]` rates single pages. Guide: `docs/guides/retrieval-feedback.md`.++### The numbers that matter++| Measure (held-out, custodian) | Result |+|---|---|+| Entity brain (world-v1 relational), consistent ratings, NDCG@10 | +2.04 [+1.03, +3.28]; beats a frequency-only baseline (−1.50) |+| Chat-history brain (LoCoMo), consistent ratings, NDCG@10 | −0.12 [−1.02, +0.61]: no gain |+| Feedback on, no ratings: LongMemEval-S retrieval lists (500 questions) | identical; mean read latency +0.6 ms |+| Declared single-value closures (temporal-edges set C) | 3 of 3 applied closures wrong, so closures are review-only |++Full record: `docs/eval/decisions/p3-retrieval-feedback/VERDICTS.md`.++### Things to watch++- With feedback on, answers carry an `answer_id` and a `how_to_rate` line; agents should rate answers they used. A brain with no ratings ranks exactly as before.+- A rating applies to the page revision the answer read; a page edited since is skipped.+- Relational triplet scoring was tested and is not included: the relational arm recognized too few held-out phrasings for it to matter.++## To take advantage of v0.60.63.0++`gbrain upgrade` should do this automatically. If it didn't, or if `gbrain doctor` warns about a partial migration:++1. **Run the orchestrator manually:**+ ```bash+ gbrain apply-migrations --yes+ ```+2. **Your agent reads `skills/migrations/v0.60.63.0.md` the next time you interact with it.** It relays the retrieval feedback notice and turns feedback on only if you say yes.+3. **Verify the outcome:**+ ```bash+ gbrain doctor --only retrieval_feedback_health --json+ gbrain feedback status --json+ ```+4. **If any step fails or the numbers look wrong,** please file an issue:+ https://github.com/garrytan/gbrain/issues with:+ - output of `gbrain doctor`+ - contents of `~/.gbrain/upgrade-errors.jsonl` if it exists+ - which step broke++ This feedback loop is how the gbrain maintainers find fragile upgrade paths. Thank you.++### Itemized changes++- **Retrieval feedback store** (migration v207): `retrieval_events`, `retrieval_event_pages`, `retrieval_event_links`, `retrieval_feedback`, `retrieval_weights`; a write-behind recording queue with overflow and drain accounting; retention in the purge phase; all five tables classified in the engine graduation inventory.+- **Feedback ranking stage** after fusion (`src/core/search/feedback-boost.ts`), bounded by `feedback.influence` λ; `--explain` shows the per-row factor.+- **`rate_answer`** MCP operation, `gbrain rate`, and CLI-only `gbrain feedback status|reset`, with agent-first refusal codes (`invalid_rating`, `answer_pending`, `answer_unavailable`, `answer_not_yours`, `ref_not_in_answer`, `ambiguous_ref`, `feedback_disabled`, `feedback_not_authorized`).+- **Defaults**: `feedback.enabled=false`, `feedback.implicit=false`; doctor `retrieval_feedback_health` and the post-upgrade notice say how to turn it on.+- **Declared single-value relations** (`src/core/link-single-value.ts`): schema pack `cardinality: one_per_from` on state relations (built in or `temporal: state`), lint rule `link_types_cardinality`, the declared pass in `edge_contradictions`, `gbrain schema cardinality-preview`, `dream.single_value.mode` (default `propose`).+- **Raw-query routing guard**: a test asserts no operation reachable by a remote caller accepts SQL or graph-query text.++### For contributors++- Tests: `test/feedback-*.test.ts`, `test/e2e/feedback-parity.test.ts` (PGLite and Postgres), `test/link-single-value.test.ts`, `test/raw-query-routing-guard.test.ts`.+- Preregistration and verdicts: `docs/eval/decisions/p3-retrieval-feedback/`. Eval runners live in gbrain-evals.+- Catalog, doctor, migration and upgrade-replay goldens regenerated for migration v207.+## [0.60.62.0] - 2026-10-05**Ask your agent for a brief on an account and it now finds the open ticket, the latest contact and the blocker, and it spends about a quarter less to get there.**diff --git a/VERSION b/VERSIONindex 220bb5ecf5..4f57079898 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-0.60.62.0+0.60.63.0diff --git a/openclaw.plugin.json b/openclaw.plugin.jsonindex 022b14024a..777b3cf942 100644--- a/openclaw.plugin.json+++ b/openclaw.plugin.json@@ -1,7 +1,7 @@{"id": "gbrain-context-engine","name": "gbrain",- "version": "0.60.62.0",+ "version": "0.60.63.0","description": "Personal knowledge brain with Postgres + pgvector hybrid search","family": "bundle-plugin","kind": "context-engine",diff --git a/package.json b/package.jsonindex e1eaa684a4..0aa256aed9 100644--- a/package.json+++ b/package.json@@ -218,7 +218,7 @@"bun": ">=1.4.0"},"license": "MIT",- "version": "0.60.62.0",+ "version": "0.60.63.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 09662aff67..6c51d6e6a0 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.62.0",+ "version": "0.60.63.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 9cfb221b21..85db478733 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.62.0",+ "version": "0.60.63.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 f4337afa70..e675e4d0c9 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.62.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.63.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 8117b7b5d6..eaafa84ef4 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.62.0",+ "version": "0.60.63.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 984675f5f9..8fbef15bf2 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.62.0",+ "version": "0.60.63.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 68d0a8d5d4..369af3915f 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.62.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.63.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 ab867648bf..e87d3b3b7d 100644--- a/plugin/README.md+++ b/plugin/README.md@@ -1,4 +1,4 @@-<!-- gbrain-plugin-tree-stamp: 0.60.62.0 -->+<!-- gbrain-plugin-tree-stamp: 0.60.63.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.63.0.md b/skills/migrations/v0.60.63.0.mdnew file mode 100644index 0000000000..3157e8b651--- /dev/null+++ b/skills/migrations/v0.60.63.0.md@@ -0,0 +1,35 @@+# Upgrade to v0.60.63.0: retrieval feedback (opt-in) and declared single-value relations++Two additions, both off or review-only by default. Nothing changes for the user until they opt in.++1. **Finish the upgrade.** `gbrain upgrade` runs it. To be sure, on the brain host:+ ```bash+ gbrain apply-migrations --yes --no-autopilot-install+ ```+ Migration v207 adds the retrieval feedback tables (`retrieval_events`, `retrieval_event_pages`,+ `retrieval_event_links`, `retrieval_feedback`, `retrieval_weights`). They stay empty while feedback is off.++2. **Relay the post-upgrade notice.** `gbrain post-upgrade` prints a one-time [AGENT] block about retrieval feedback.+ Show the user its message and ask whether to turn it on. Only after they say yes:+ ```bash+ gbrain config set feedback.enabled true+ ```+ With it on, every `query`, `search`, `think`, `synthesize` and `recall` answer carries an `answer_id`; rate+ it with `rate_answer { answer_id, rating: 1-5 }` (or `gbrain rate <answer_id> <1-5>`) after you use it. Ratings+ nudge the ranking of the pages that answer used by at most 0.9x to 1.1x. Held-out tests with consistent+ ratings showed a gain on entity-centric brains and none on chat-history brains, so tell the user that.++3. **Single-value relations need a pack declaration.** A schema pack can mark a state relation+ `cardinality: one_per_from` (for example `works_at` meaning the one current employer). The nightly+ `edge_contradictions` phase then proposes closures for that type without a model call; nothing is written to+ pages until the user accepts one. No bundled pack declares a cardinality. Before activating a pack that does:+ ```bash+ gbrain schema cardinality-preview+ gbrain edge-proposals list+ ```++4. **Verify.**+ ```bash+ gbrain doctor --only retrieval_feedback_health --json+ gbrain feedback status --json+ ```diff --git a/templates/bootstrap/template-repo/README.md b/templates/bootstrap/template-repo/README.mdindex 92b5b9e5de..964cce72ca 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.62.0 -->+<!-- gbrain-template-stamp: 0.60.63.0 -->This repository is the **"Use this template"** distribution artifact for a[gbrain](https://github.com/garrytan/gbrain) personal-agent workspace — the same