A community member reported docs 'have quite a bit of drift and some broken
links' and contradictions like 'says don't use bun but also to use bun.' This
PR is a top-to-bottom audit + fix across every doc file at the repo root and
under docs/. Where docs disagreed with each other, the code was the tie-breaker.
## Categories of fix
### 1. Stale CLI commands (skillpack install → scaffold)
`gbrain skillpack install` was retired in v0.36.0.0 (replaced by the
scaffold/reference/migrate-fence model). The CLI now errors out with a hint:
$ gbrain skillpack install
Error: 'gbrain skillpack install' was removed in v0.33.
Use 'gbrain skillpack scaffold <name>' instead.
But the docs still recommended it:
- README.md line 29 — primary install path
- docs/INSTALL.md lines 12 — primary install path
Both updated to `gbrain skillpack scaffold --all` with the v0.36.0.0 retirement
explained inline + the migrate-fence escape hatch for users upgrading from older
releases.
### 2. The 'bun install -g vs bun link' contradiction
The community member's exact complaint. The drift:
- README.md + docs/INSTALL.md: recommended `bun install -g github:garrytan/gbrain`
- INSTALL_FOR_AGENTS.md line 29: 'Do NOT use `bun install -g github:garrytan/gbrain`.'
Reading the code + CHANGELOG: `bun install -g` IS the canonical path. Bun
occasionally blocks the top-level postinstall hook on global installs (issue #218),
but the postinstall now prints a loud recovery hint when that happens, and
`gbrain doctor` flags `schema_version: 0` and routes users to
`gbrain apply-migrations --yes`. The 'do not use' warning was correct in 2024
when the postinstall silently swallowed errors with `|| true`; it's stale now.
Reconciled:
- INSTALL_FOR_AGENTS.md Step 1: now recommends `bun install -g` as the primary
path, documents #218 as a known issue with the recovery command, and keeps
`git clone + bun link` as a documented fallback.
- AGENTS.md Install (5 min): same reconciliation; clone path is the fallback,
not the default.
- docs/INSTALL.md CLI standalone: added the #218 callout so the deterministic
fallback is one click away when the default fails.
### 3. Broken internal links
- README.md → `docs/integrations/voice.md` (file doesn't exist). The real voice
recipe lives at `recipes/twilio-voice-brain.md` (Twilio + OpenAI Realtime).
Fixed to point there with an accurate one-line summary.
- CONTRIBUTING.md → `docs/SQLITE_ENGINE.md` (file doesn't exist; superseded by
PGLite per docs/ENGINES.md). Replaced with a paragraph explaining the
supersession and pointing at the live ENGINES.md.
- docs/GBRAIN_V0.md → `docs/SQLITE_ENGINE.md` (2 references; same supersession).
Added a historical-doc banner at the top + rewrote both references to point at
the current ENGINES.md.
### 4. Stale API key recommendations
INSTALL_FOR_AGENTS.md Step 2 only mentioned OpenAI + Anthropic. As of v0.36.2.0
ZeroEntropy is the default embedding + reranker stack (README opens with this);
the agent install guide didn't reflect it. Added `ZEROENTROPY_API_KEY` as the
default, kept OpenAI/Voyage as documented fallbacks, noted that keys can live in
`~/.gbrain/config.json` (file plane) or env.
### 5. Stale upgrade workflow
INSTALL_FOR_AGENTS.md 'Upgrade' section assumed the clone+bun-install model
(`cd ~/gbrain && git pull && bun install && gbrain init && gbrain post-upgrade`)
and didn't mention `gbrain upgrade` (the single-command path that exists in the
CLI today: binary self-update + schema migrations + post-upgrade prompts in one).
Split into two paths — `gbrain upgrade` for the bun-install-g case (now the
default per Step 1), clone-path for the fallback case.
Also fixed AGENTS.md 'Migrate' bullet (was `gbrain apply-migrations` only;
now leads with `gbrain upgrade` and keeps apply-migrations as the manual
schema-only path).
### 6. Stale cron-workflow
INSTALL_FOR_AGENTS.md Step 7 referenced cron docs but didn't mention
`gbrain autopilot --install` (the built-in self-maintaining daemon that
exists in the CLI today) or `gbrain sync --watch` (continuous loop). Added
both as alternatives to platform-cron glue.
### 7. ZeroEntropy version typo
docs/INSTALL.md said 'the v0.36.0.0 ZE switch' — ZE landed in v0.36.2.0
(v0.36.0.0 was the skillpack-scaffold retirement). Fixed.
## What I did NOT change
- CHANGELOG.md, CLAUDE.md, TODOS.md prose mentions of historical commands like
`gbrain skillpack install` are correct as history — they're documenting what
was true in past releases. Only forward-looking docs got updated.
- The 'broken link' false-positive matches in CHANGELOG / CLAUDE / TODOS are
inside code-fence examples or regex patterns (`[Name](people/slug)`,
`[a-z0-9](?:[a-z0-9-]{0,30}[a-z0-9])`, `[--json](interrupted)`); they're
illustrative syntax, not real links. Leaving alone.
- llms.txt / llms-full.txt regenerated via `bun run build:llms` so the
agent-fetch documentation map matches the new content.
## Verification
- `bun run src/cli.ts --help` cross-checked against every command/flag the
install docs reference: init, doctor, apply-migrations, upgrade, post-upgrade,
skillpack scaffold/reference/migrate-fence, embed --stale, sync --watch,
autopilot --install, dream, integrations list, extract links/timeline,
graph-query, query, search modes — all real, all current.
- `bun run src/cli.ts skillpack install` confirmed to error out with the
retirement hint pointing at scaffold (proves the README guidance was actively
misleading users into a dead-end).
- Re-ran the broken-internal-link scanner across all root .md + docs/**/*.md;
zero real broken links remain (5 residual matches are illustrative syntax
inside prose, not actionable links).
Co-authored-by: garrytan-agents <agents@garrytan-agents.local>
5.7 KiB
Agents working on GBrain
This is your install + operating protocol. Claude Code reads ./CLAUDE.md automatically.
Everyone else (Codex, Cursor, OpenClaw, Aider, Continue, or an LLM fetching via URL):
start here.
Install (5 min)
- Install gbrain via Bun (the canonical path):
If
curl -fsSL https://bun.sh/install | bash export PATH="$HOME/.bun/bin:$PATH" bun install -g github:garrytan/gbrainbun install -gaborts orgbrain doctorreportsschema_version: 0, the CLI prints a recovery hint pointing at #218. Rungbrain apply-migrations --yesto recover, or fall back to the deterministic install:git clone https://github.com/garrytan/gbrain.git ~/gbrain && cd ~/gbrain && bun install && bun link. - Init the brain:
gbrain init(defaults to PGLite, zero-config). For 1000+ files or multi-machine sync, init suggests Postgres + pgvector via Supabase. - STOP — ask the user about search mode.
gbrain initauto-applied a default but printed a 9-cell cost matrix (mode × downstream model) preceded by[AGENT]markers. You MUST relay the matrix to the operator and confirm their choice before continuing. Cost spread between corners is 25x — silent acceptance is the wrong default. See./INSTALL_FOR_AGENTS.mdStep 3.5 for the exact ask-the-user protocol. Same banner fires ongbrain post-upgradefor existing users (search modes were added in v0.32.3). - Read
./INSTALL_FOR_AGENTS.mdfor the full 9-step flow (API keys, identity, cron, verification).
Read this order
./AGENTS.md(this file) — install + operating protocol../CLAUDE.md— architecture reference, key files, trust boundaries, test layout../docs/architecture/brains-and-sources.md— the two-axis mental model (brain = which DB, source = which repo in the DB). Every query routes on both axes. Read before writing anything that touches brain ops../skills/conventions/brain-routing.md— agent-facing decision table: when to switch brain, when to switch source, how cross-brain federation works (latent-space only; the agent decides)../skills/RESOLVER.md— skill dispatcher. Read before any task.
Trust boundary (critical)
GBrain distinguishes trusted local CLI callers (OperationContext.remote = false,
set by src/cli.ts) from untrusted agent-facing callers (remote = true, set by
src/mcp/server.ts). Security-sensitive operations like file_upload tighten filesystem
confinement when remote = true and default to strict behavior when unset. If you are
writing or reviewing an operation, consult src/core/operations.ts for the contract.
Common tasks
- Configure:
docs/ENGINES.md,docs/guides/live-sync.md,docs/mcp/DEPLOY.md. - Debug:
docs/GBRAIN_VERIFY.md,docs/guides/minions-fix.md,gbrain doctor --fix. - Migrate / upgrade:
gbrain upgrade(binary self-update + schema migrations + post-upgrade prompts),docs/UPGRADING_DOWNSTREAM_AGENTS.md,skills/migrations/,gbrain apply-migrations --yes(manual schema-only). - Eval retrieval changes: capture is off by default. To benchmark a
retrieval change against real captured queries, set
GBRAIN_CONTRIBUTOR_MODE=1, thengbrain eval export --since 7d > base.ndjsonandgbrain eval replay --against base.ndjson. For public benchmark coverage (LongMemEval, ground-truth scoring),gbrain eval longmemeval <dataset.jsonl>(v0.28.8) runs against an isolated in-memory PGLite per question — your~/.gbrainis never opened. Full guide:docs/eval-bench.md. - Track a founder/company over time (v0.35.7): when an entity has
typed metric claims in its
## Factsfence (metric: mrr,value: 50000,unit: USD,period: monthlycolumns), rungbrain eval trajectory <entity-slug>for the chronological history with regressions auto-flagged, orgbrain founder scorecard <entity-slug>for a four-signal JSON rollup (claim_accuracy / consistency / growth_trajectory / red_flags). MCP opfind_trajectoryexposes the same data — read scope, visibility-filtered for remote callers. - Everything else:
./llms.txtis the full documentation map../llms-full.txtis the same map with core docs inlined for single-fetch ingestion.
Before shipping
Easiest path: bun run ci:local runs the full CI gate inside Docker (gitleaks,
unit tests with DATABASE_URL unset, then all 29 E2E files sequentially against a
fresh pgvector container) and tears down. Use bun run ci:local:diff for the
diff-aware subset during fast iteration on a focused branch. Requires Docker
(Docker Desktop / OrbStack / Colima) and gitleaks (brew install gitleaks).
Manual path: bun test plus the E2E lifecycle described in ./CLAUDE.md (spin
up the test Postgres container, run bun run test:e2e, tear it down).
Ship via the /ship skill, not by hand.
Privacy
Never commit real names of people, companies, or funds into public artifacts. See the
Privacy rule in ./CLAUDE.md. GBrain pages reference real contacts; public docs must
use generic placeholders (alice-example, acme-example, fund-a).
Forks
If you are a fork, regenerate llms.txt + llms-full.txt with your own URL base before
publishing: LLMS_REPO_BASE=https://raw.githubusercontent.com/your-org/your-fork/main bun run build:llms.