Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/master' into capy/catch-openrouter-groq-xai
garrytanac314375a742
diff --cc CHANGELOG.mdindex c975f41d97,c0bcb2c267..606d210b30--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -10,27 -10,27 +10,48 @@@ credits are retained; no result has beeidentifiers and attribution are available in the pre-removal Git revision`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).+## [Unreleased]++**The secret scanner now catches OpenRouter, Groq, xAI, Perplexity and Replicate API keys.**++A raw OpenRouter key (`sk-or-v1-` plus 64 hex) slipped past every lane: the bare OpenAI rule stops at the dash after `sk-or`, so the key didn't block `gbrain sources push`, wasn't replaced with `<REDACTED:…>` in search, recall or transcript import, and wasn't counted by `gbrain transcripts audit-secrets`, which left doctor's `transcript_secret_exposure` reading clean. Groq (`gsk_`), xAI (`xai-`), Perplexity (`pplx-`) and Replicate (`r8_`) keys had the same gap. Each now has its own rule with the provider's published fixed length and a hard right edge, so a longer run of the same characters is never cut into a false key. Anthropic (`sk-ant-`), project-scoped OpenAI (`sk-proj-`) and Google (`AIza`) keys were already caught and are unchanged.++### What to do after upgrading++- A push that worked before can now stop with `rule [openrouter] blocks pushes since gbrain v0.60.499.0` (or groq, xai, perplexity, replicate). Rotate the key with the provider and remove it from the page. Don't allowlist a live key.+- `gbrain doctor` asks for a fresh transcript audit once, because the audit's detectors changed. Run `gbrain transcripts audit-secrets --json` to list conversation pages that still hold such a key (slugs and line numbers, never values).++### Itemized changes++- `src/core/secret-scan.ts`: five vendor rules (`openrouter`, `groq`, `xai`, `perplexity`, `replicate`) with `since` `PROVIDER_KEYS_SINCE`, placed with the vendor rules ahead of the catch-alls, so `Bearer <key>` keeps the vendor name. No existing rule changed or moved.+- `src/core/transcripts/secret-audit.ts`: `TRANSCRIPT_SECRET_AUDIT_VERSION` 1 → 2, so a clean audit cached by the old detectors no longer reads ok.+- Tests build every key at runtime (`test/helpers/provider-keys.ts`) and pin each rule through the scanner, retrieval redaction, transcript import, the audit and the push gate, plus near misses (one character short or long, wrong case or separator, the prefix inside a longer word) that fire no rule.++Reported by @lelle-bot (#7959). Contributed by @Masashi-Ono0611 (#7961), who proposed the OpenRouter rule.++Supersedes #7961++ ## [0.60.499.0] - 2026-10-29++ **The install docs now lead with hosted GBrain at gbrain.io, the fastest way to use GBrain with any harness, and `gbrain doctor` catches the unrelated npm `gbrain` package even when it is not on your PATH.**++ README, docs/INSTALL.md and INSTALL_FOR_AGENTS.md open with one box: install the `gbrainio` CLI, connect your terminal, create a workspace in the browser, and add `https://gbrain.io/mcp` to Claude Code or Codex. Self-hosting follows under "Here's how to self-host it" and is much shorter. GBrain stays MIT-licensed and free to self-host, and the self-host install line now uses `#latest-stable`, the gated release ref, instead of master. The graph-recall claim now gives the production number, R@5 0.6626 to 0.7241 on BrainBench relationship questions; 0.9791 appears only as the labeled `graph-oracle-parse` upper bound. `gbrain doctor`'s `npm_squat` check now also reads the global npm and Bun package directories, so an unrelated `gbrain` package that is installed but not on PATH warns, and the warning carries the command that removes it when npm or Bun installed it (and reinstalls the real one only when no gbrain is left), each one asked first. `gbrain sources harden` on a source with no `_brain-filing-rules.json` now lists the folders that source actually has in its AGENTS.md filing rule, instead of gbrain's default folders.++ ### How to use it++ ```bash+ gbrain doctor --only npm_squat --json # names an unrelated npm gbrain package and the command that removes it+ bun install -g github:garrytan/gbrain#latest-stable+ ```++ ### Itemized changes++ - README Install, docs/INSTALL.md, INSTALL_FOR_AGENTS.md and AGENTS.md: hosted gbrain.io box first, with the public gbrain.io/cli commands and a note to read the shell installer before running it; shorter self-host sections; the npm-trap and #218 recovery text is shorter and kept in sync.+ - README, docs/architecture/RETRIEVAL.md and docs/guides/capabilities.md: production relationship-retrieval R@5 (0.6626 to 0.7241, 45 of 435 runs better, none worse) replaces the oracle number as the headline.+ - `src/core/npm-squat-check.ts`: scans `npm root -g` and Bun's global dir; a warn from an unrelated package carries an `ask_user` fix (`npm uninstall -g gbrain` or `bun remove -g gbrain`, only for a package in that tool's own global dir; a package from pnpm, yarn or another prefix is the user's step), then the #218 reinstall only when no gbrain is left at all.+ - `src/core/brain-repo-durability.ts`: without a filing-rules file, Rule 1 lists the source's top-level content folders (plain names only, at most 50; skipping dot-folders, `skills/`, `scripts/`, `node_modules/`), else the bundled default (#7629).+ - Tests: `test/npm-squat-check.test.ts`, `test/doctor-npm-squat.test.ts` (new), `test/filing-rules-resolution.serial.test.ts`.+## [0.60.498.0] - 2026-10-29**The Claude Code and Codex plugins now put gbrain's brain-first rule beside every turn, the same way `gbrain setup` does.**