mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-27 21:19:18 +00:00
* docs: rewrite README lead around search-vs-think differentiator The current README opened with a generic "smart but forgetful" tagline that buried the actual differentiator. Garry's 2026-05-23 X thread crystallized the positioning: "Search gives you raw pages. Think gives you the answer." That plus graph traversal plus gap analysis is what nobody else ships in one box. Changes: - README lead now leads with the search-vs-think frame, the "nobody else does this" claim, and the "strategic moat / so you don't lose context" framing. - Collapsed five stacked "New in vX.Y.Z" paragraphs in the lead into one Recent Releases section after the install path, freeing the first viewport to be about what gbrain IS, not what shipped last week. - New ## Search vs think section with side-by-side CLI example, gap-analysis explanation, and the find_trajectory + think compounding story. - ORIGIN.md closing paragraph names think as the reason the brain is worth building. - No em dashes used as connectors (per humanizer rules). - All factual claims (page counts, benchmark numbers, version references) preserved verbatim. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: add v0.40.6.0 to README Recent Releases Picked up sync --all + per-source locks + sources status dashboard from the v0.40.6.0 merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): add visceral "what this looks like" before/after table Pulled verbatim from BrainBench Cat 29 — same question, same brain, Haiku judge. Shows what a typical personal-knowledge brain (top-K vector retrieval, what MemPalace / Mem0 / Hindsight ship) returns vs what gbrain think returns. Search hallucinates three people who actually work at OTHER companies; think correctly identifies what's known + flags the gap. Score: search 1/10 vs think 9/10. The before/after lands above Install so the reader sees concrete differentiation before they decide to install. Backs the abstract "search vs think" claim from the lead with a real receipt. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): swap before/after example to verbatim Cat 29 receipt (Q2 ARR) Per @garrytan — the prior example used the synthetic Q1 (employees of Horizon TECH 6) with paraphrased answer text. Replaced with the verbatim Cat 29 Q2 receipt: actual question (with the in-question typo that exists in the eval), actual truncated search-answer text from the JSON receipt, actual think-answer text with all three ARR readings + citations, and the actual Haiku judge verdicts pasted verbatim. Also strips Mem0 + Hindsight references from the comparator phrasing — Mem0 is a YC company we don't want to single out, and Hindsight was a hackathon-stage project that never launched. The comparison phrasing now reads "MemPalace and most peer AI-memory stacks" — accurate without naming systems we shouldn't be benchmarking against. The three things gbrain think did that a typical top-K retrieval cannot are listed below the table for readers who want the takeaway in plain English: 1. Caught the name typo (question said "Acme AI 0", brain has "Acme CO 0") 2. Walked the typed-claim Facts fence to build a chronological trajectory 3. Cited every claim Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): add "Your brain's shape (schema packs)" section Per @garrytan — the README had nothing on schema packs (v0.38/v0.39 dynamic-schema cathedral). New section lands between "How to get data in" and "Recent releases" so the narrative flow reads: what gbrain is → concrete example → install → query (search vs think) → get data in → schema packs (how the brain understands your shape) → recent releases → loop → capabilities → ... The section opens by naming the differentiator out loud: "Most personal- knowledge tools force one fixed layout: their idea of notes + people + tags. Drop a Notion export or your own years-old Obsidian vault and the agent doesn't know what your folders mean." Three options surfaced: - gbrain-base (default, zero-config Garry layout) - gbrain-recommended (extends base with 13 more dirs) - your own pack via the schema detect → suggest → review-candidates three-command magical moment Six representative CLI verbs shown verbatim. Closes with one paragraph explaining the threading through every read/write path (parseMarkdown, whoknows, extract_facts, search cache) and a one-line summary of the 7-tier resolution chain pointing at docs/architecture/schema-packs.md for the full reference. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): de-brand "Think" in the lead; reframe as GBrain's brain layer Per @garrytan — "we don't need to brand it Think, we want to say the think command later but we don't lead on it!" Changes: - Lead sentence: "Search gives you raw pages. Think gives you the answer" → "Search gives you raw pages. GBrain gives you the answer, through a brain layer." The product is GBrain; think is the CLI verb that runs the brain layer, introduced later. - Two-bullet differentiator list: the "gbrain think" bullet now leads with the capability ("A synthesis layer that gives you the actual answer.") rather than the CLI command. The bullet body still names what the layer does (synthesized prose, citations, gap analysis). - Strategic-moat paragraph: "`gbrain think` is what makes the moat usable" → "The brain layer is what makes the moat usable." - "What this looks like" table header: "GBrain `think`" → "GBrain's brain layer (one synthesized answer, run via `gbrain think`)". CLI command stays in the cell so the example is reproducible; the framing leads with what it IS, not the verb. - Three-bullet takeaway under the table: "Three things `gbrain think` did" → "Three things the brain layer did". Aggregate sentence: "gbrain think averages 5.60/10" → "GBrain's synthesis layer averages 5.60/10". - Section heading: "## Search vs think" → "## Two ways to query your brain". The section still introduces `gbrain search` and `gbrain think` as the two CLI verbs side by side; the heading no longer brands "think" as the thing. The "think command" comes through naturally where it appears as a CLI example. The PRODUCT is GBrain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): switch to first-person voice (Garry speaking directly) Per @garrytan — drop "Built by..." third-person framing and write in first person. Edits: - Lead credibility paragraph: "Built by the President and CEO of Y Combinator to run his actual AI agents" → "I'm Garry Tan, President and CEO of Y Combinator. I built GBrain to run my own AI agents." Subsequent sentences switch "his deployments" → "my deployments", "the agent ingests... you wake up smarter" → "my agent ingests... I wake up smarter — and so will you" (the closing "and so will you" connects Garry's experience to the reader's). - Compounding paragraph: "As Garry's personal agent gets smarter, so does yours" → "As my personal agent gets smarter, so does yours." - Schema packs section: "the layout used by Garry's production brain" → "the layout my production brain uses". - License + credit: "Built by Garry Tan to run his OpenClaw and Hermes deployments — the production brain behind his actual AI agents" → "I built GBrain to run my OpenClaw and Hermes deployments — the production brain behind my AI agents." The whole top of the README now reads as Garry talking directly to the reader about what he built and why. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): DRY the lead — drop redundant "through a brain layer" + repeat GBrain "GBrain gives you the answer, through a brain layer. GBrain is the brain layer your AI agent has been missing..." — two GBrains, two brain layers. Tightened to: "GBrain gives you the answer. It's the brain layer your AI agent has been missing — the only one that does synthesis, graph traversal, and gap analysis in one box." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): frame GBrain as a company brain too, link to YC RFS Per @garrytan — GBrain is now usable as a company brain (federated sync, OAuth scoping, Cat 22 source isolation), and YC just put company-brain on its Request for Startups. Added a paragraph after the personal-brain lead that names the three v0.34+ features that make multi-user safe (federated sync, per-source OAuth scoping, the Cat 22 leak-free source isolation), then links to https://www.ycombinator.com/rfs#company-brain with a one-line pitch: "if you're building in that space, you might as well build on this." The framing carries forward the personal-brain story while opening the aperture: GBrain works for one person (Garry's production deployment) AND for a team (per the features Cat 22 just verified). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): rewrite company-brain paragraph in plain English @garrytan caught me writing internal eval-suite jargon ("Cat 22 proves source isolation is leak-free across hybrid search, listPages, getPage, and federated reads") in a paragraph aimed at someone deciding whether to use GBrain. Rewritten in plain English: "Each person on the team gets their own slice of the brain, scoped by login. When you query, you only see what you're allowed to see — never another person's notes, never another team's data. We fuzz- tested this across every way you can read the brain (search, list, lookup, multi-source reads) and got zero leaks." Same factual content, zero internal vocabulary. The "Cat 22" name belongs in the benchmark page, not the front-door README. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(tutorials): add company-brain tutorial (Diataxis tutorial quadrant) End-to-end walkthrough for setting up GBrain as a multi-user company brain. Audience: founder / CTO / head of ops at a 10-50 person company who has heard about GBrain (from the YC RFS company-brain page or my tweets) and wants to set it up as their team's shared institutional memory. ~3700 words, written for a learner with zero prior gbrain knowledge. Twelve parts walk the reader from "I've never run gbrain" to "three teammates each query the brain through their own AI agent and see the correctly scoped answer": 1. The mental model (personal brain vs company brain, federated sources, OAuth scoping, what you get) 2. Prerequisites table (Postgres, embedding key, Anthropic key, git repo, Bun, host machine + cost projection) 3. Install + Postgres + API keys + doctor verify 4. Create three sources (shared / customers / internal) + sync 5. Spin up HTTP MCP server with --bind 0.0.0.0 + --public-url 6. Register one OAuth client per teammate with --source + --federated-read 7. Verify scoping works (alice can't see internal, bob can't see customers) 8. Connect each teammate's AI agent via thin-client install 9. First real `gbrain think` query showing sourced + synthesized + gap-analysis answer 10. Operating the brain (autopilot, doctor --remediate, sources status, admin dashboard) 11. Cost + speed expectations from the v0.40.6.0 benchmark 12. Common gotchas + troubleshooting Voice: - First-person Garry in intro / motivation paragraphs - Zero internal jargon. No "Cat 22", "P@5", "knobsHash", "RRF", "MRR" - Plain English throughout - No em dashes used as connectors (zero in final draft) - "Brain layer" / "synthesized answer" framing, not "Think" branding - No Hindsight, no Mem0 (per repeated session feedback) - Every example uses placeholder names (alice-example, bob-example, acme-co) Cross-linked from: - README.md company-brain paragraph - docs/INSTALL.md (under the migrate --to supabase block) - docs/architecture/topologies.md (See also section) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): drop version chatter, add Tutorials section, expand tutorial roadmap Per @garrytan: the README should read as the current docs written for people who have never known GBrain before. Versions are what the CHANGELOG is for. Version-chatter sweep across the README: - Killed the entire ## Recent releases section. That's a changelog summary, not docs. CHANGELOG.md owns it. - Stripped "(v0.38+)" from the ## How to get data in heading. - Rewrote "(the v0.38 put_page write-through plumbing)" as "(the database and on disk in one move)" — describes WHAT happens, not WHEN it shipped. - Stripped "(The legacy gbrain skillpack install managed-block model was retired in v0.36.0.0; run gbrain skillpack migrate-fence once if you're upgrading from an older release.)" from the skillpack paragraph. Upgrade history goes in the CHANGELOG. - Stripped "New in v0.40.4.0:" from the hybrid-search graph-signals description. Just describes what the feature does. - Stripped "As of v0.37," from the embedding-provider auto-detect paragraph in the Troubleshooting section. - Stripped "the embedding + reranker stack that became the v0.36.2.0 default" → "ships as the default" in the License + credit section. - Stripped "in Cat 29" from the synthesis-benchmark sentence (same internal-jargon class as Cat 22 which @garrytan called out earlier). Replaced ## Recent releases with ## Tutorials: - Links to the one shipped tutorial (company-brain.md) with a one-line description. - Names the next several planned tutorials in prose (not as broken links): personal brain quickstart, connect your agent, VC dealflow, vault migration, code brain. No fake links. - Points at the tutorial index page for the full roadmap. - Closes with "Open an issue describing the workflow you want documented" to invite prioritization input from real users. New tutorial index at docs/tutorials/README.md: - Shipped section: company-brain.md - In-progress roadmap with 7 candidate tutorials (personal brain quickstart, connect your agent, VC dealflow, vault migration, code brain, fully local, dream cycle setup) - Each roadmap entry names the persona, the core commands the tutorial would demonstrate, and the differentiator - "Want to write one?" section invites community PRs and points at company-brain.md as the model Reverted the obscure topologies.md "See also" link from pointing at company-brain.md specifically to pointing at the tutorials index overall — the tutorial belongs in the README's Tutorials section where users actually look, not buried in an architecture doc. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(tutorials): land personal-brain tutorial (full-stack install) The canonical solo install walkthrough, adapted from Garry's live setup session notes (the "Apple I, soldering breadboards" session). Builds the full stack: 2 GitHub repos, Telegram bot, AlphaClaw on Render, OpenClaw + GBrain + Supabase. About 2 hours end-to-end, $100-150/month sustained. Replaces the "Set up your personal brain in 30 minutes" stub on the tutorials roadmap with something genuinely complete. Edits to the source draft: - Stripped brain-page YAML frontmatter (type/access/links/etc — not needed for a public docs file) - Privacy sweep per CLAUDE.md: removed real-name references to the collaborator and the agents involved in the session, replaced with "a collaborator" / "my main agent" / generic placeholder names - First-person voice consistency: the source draft slipped between first person and third person ("Garry walked through"); rewrote everything in first person - Zero em-dashes used as connectors (verified by grep) - Added ZeroEntropy to the providers list (it's the default; not mentioning it would leave readers paying 2.6× more on embeddings) - Opened with a router paragraph that points brain-layer-only readers at INSTALL.md and team readers at company-brain.md, so each audience finds the right walkthrough fast Tutorials index updated: - personal-brain.md promoted from In Progress to Shipped (it IS the "set up your personal brain in 30 minutes" entry that was on the roadmap, just better-named and more complete) README.md Tutorials section now lists both shipped tutorials side by side. Reads naturally: solo install first (broader audience), team install second. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(tutorials): rewrite company-brain as a true superset of personal-brain Per @garrytan: the company brain tutorial should pick up from where the personal brain tutorial leaves off, not duplicate the install. Pedagogical flow now reads: "you already did personal-brain; here is what to add to make it multi-user." Restructure: - Opens with explicit "this tutorial picks up where the personal brain tutorial leaves off" + a router for readers who haven't done that one yet. No duplicated install steps. - Part 1 (mental model) reframed as "what changes when you go from personal to company" + "what this is NOT" (not a different install, not a thin-client-everywhere replacement). - Part 2 is now "switch the brain backend to multi-user Postgres" — surfacing the migrate --to supabase path for readers who started on PGLite, skip-to-Part-3 for readers already on Postgres. - Part 3 adds the new content @garrytan called for: per-person folder structure inside each source. customers/alice-example/, internal/ alice-example/, internal/bob-example/, internal/legal/ etc. So teammates' writes don't collide and the per-person/per-role abstraction is real on disk, not just in OAuth scope. - NEW Part 6: per-person crons. Each teammate gets their own scheduled tasks (7am customer digest for alice, 9am ops status for bob, weekly contract compliance for carol) scoped to their OAuth client so the cron can only touch their slice. - NEW Part 7: per-person skills. The 60+ shipped skills are generic; teams want a few specific ones (onboarding-new-hire, customer-success-followup, weekly-team-digest). Scaffolded via gbrain skillify scaffold, scoped via allowed_clients in frontmatter. - Existing strong parts retained: OAuth scoping + verify, per- teammate AI client connect, first synthesized query, operating notes, gotchas. Reworded where needed to refer back to personal- brain steps instead of re-explaining them. Voice + style sweeps: - Zero em-dashes used as connectors (verified by grep) - Zero internal jargon (no "Cat 22", "P@5", "RRF", "MRR", etc.) - Zero version chatter in body text (only the one acceptable reference to the dated benchmark filename in a docs link) - "Brain layer" / "synthesized answer" framing, not "Think" branding - First-person Garry voice in intro/motivation paragraphs - All examples use placeholder names (alice-example, bob-example, carol-example, acme-co, diana-example) - No mentions of Mem0 / Hindsight (per session-long convention) Word count: 3608 (vs 3717 before — about the same length, but more of those words now describe the NEW content rather than re-explaining prereq install). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(tutorials): enrich company-brain with real-world patterns from production deployment Mined production patterns from my own running company-brain deployment to ground the tutorial in shapes that actually work. Added four substantive sections. Part 3 (sources) gains "Two scoping models" sidebar: - Model A: separate sources with OAuth scoping (SQL-enforced isolation, right for multi-user with different AI clients per person — what the tutorial walks you through). - Model B: one source with partners/<slug>/ directory convention (simpler ops, scoping is convention-only, right when one agent serves everyone over Telegram — what I actually run in production). - Mix-and-match guidance: separate sources for the obviously-different ones AND partners/<slug>/ inside the shared source for per-person workspace. Part 7 (skills) gains "Shared rule files at the skills root" subsection: - _brain-filing-rules.md: iron-rule decision tree for where new pages belong. Every ingest skill consults it before creating a page. - _output-rules.md: output quality standards (deterministic links built from API data not LLM-composed strings, citation format, no AI-slop). - _excluded-people.md: privacy gate naming people the brain must never reference even when they appear in source material. Re-attribute or discard. The file that prevents accidental publication of things about people who aren't fair game. - _operating-rules.md, _x-ingestion-rules.md, _x-api-rules.md. - These turn into the de facto company policy for the agent. Edit one, every skill picks it up next request. NEW Part 8 "Wire Slack carefully": - Two crons, two jobs (scan every 5-15min for live signals + archive nightly for full history). - Channel-to-task-ID mapping via topic-registry.json (don't reference raw Slack channel IDs in skills; friendly names that resolve at runtime). - Deterministic links rule (LLM-composed Slack URLs hallucinate constantly; build from API data only). - Dismissed-items state so re-scans don't surface noise that was already triaged. - Per-channel scoping mirrors per-person scoping. Sensitive channels scope by OAuth client. - Names the actual production skills (slack, slack-scan, slack-archive) for scaffold reference. NEW Part 9 "Onboard each teammate yourself (the botmaster pattern)": - The load-bearing UX gate for adoption. Don't hand a teammate an OAuth credential and tell them to "try it out." That's how internal tools die. - Step 1: pre-populate their slice (partners/<their-slug>/USER.md with role/focus/priorities/preferences, 5-10 concepts that are theirs, 2-3 example brain entries that demonstrate the shape). About 20 minutes per teammate. - Step 2: walk them through 2-3 wow flows personally. A synthesis query (show the brain layer). A gap-analysis query (build trust). A write-back flow (show capture value). About 15 minutes. - Step 3: graduate to DM only after the wow moment lands. The order flips the conversion rate. - About 45 minutes per person total. Cheaper than an unadopted tool. Parts 8-12 renumbered to 10-14 to make room. Cross-references in body text checked (Part 3 ref in Part 5, Part 4 ref in operating notes, Part 5 ref in Slack section all still correct). Word count: 4938 (vs 3608 before). Still readable in one sitting per the original target; added content is all load-bearing patterns from production. Voice gates: - Zero em-dashes used as connectors (sed-replaced all 8 introduced by the additions with periods) - Zero internal jargon (no Cat N, no P@5, no RRF, no MRR) - Zero banned names (no Brad, Gessler, Wintermute, Zion, Straylight, Seibel, Caldwell, Mem0, Hindsight) - "Brain layer" / "synthesized answer" framing preserved - First-person Garry voice throughout - All examples use placeholder names (alice-example, bob-example, carol-example, diana-example, acme-co) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(tutorials): expand personal-brain Step 7 with the three real Supabase gotchas @garrytan: the personal-brain tutorial needs to surface the specific Supabase setup gotchas I hit the hard way. Rewrote Step 7 with the operational detail. Three new subsections: - 7a: Turn on pgvector. The vector extension has to be toggled in Database → Extensions before GBrain's schema migrations will run. Five seconds in the dashboard, an hour of debugging if you forget. - 7b: Use the CONNECTION POOLER string, not the direct connection. Direct is port 5432, IPv6-only. Pooler is port 6543 via pgbouncer, IPv4-compatible, survives connection storms from parallel workers. Shows the exact pooler hostname format and the gbrain config set command. - 7c: Buy the IPv4 add-on. About $4/month. Even with the pooler, some Supabase regions / Render plans hit IPv6 resolution snags. Symptom: network-unreachable errors or connect hangs in gbrain doctor. Toggle on in Project Settings → Add-ons. Saves debugging time on multiple installs. - 7d: Verify with gbrain doctor — names which of 7a / 7b / 7c to revisit if a check fails. The old "Operating note" about Supabase being the scaling bottleneck preserved at the end of the section since it's a different concern (scale, not setup). Voice gates: 0 em-dashes (verified), first-person Garry voice ("I hit the hard way"), no internal jargon, no banned names. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): rewrite "What this looks like" for someone arriving cold @garrytan: the prior version assumed too much. "Eval receipt", "top-K vector retrieval", "MemPalace", "Haiku judge", "Facts fence", "synthesis layer" — all jargon that requires reading the rest of the project to parse. A new reader bounces. New version requires zero prior context: - Sets up a universal scenario anyone gets: "you have a meeting with alice tomorrow, what do you need to know?" - Shows what a typical tool returns (a list of 5 pages with snippets) so the reader sees the gap themselves - Shows what gbrain returns (a real briefing with the open items surfaced, plus a "heads up" about what's missing from the brain) - Lets the two outputs speak for themselves, no judge scores or benchmark numbers in the body - Closes with one plain-English sentence on the difference: "Search finds the pages. The brain reads them for you and writes the answer." What got cut: - The eval-receipt path reference (means nothing to a new reader) - The Haiku judge scores (0/10 vs 9/10) — not useful out of context - The verbatim judge verdict quotes (long, internal vocabulary) - The "Facts fence", "typed-claim", "synthesis layer" feature names - The MemPalace name-drop - The link to the comprehensive benchmark page (it's still reachable from the Tutorials and benchmark sections; doesn't need to be in the intro) - The numbered "three things gbrain think did" breakdown The example content is illustrative (same scenario shape as a real production query) but stripped of the internal benchmark wrapper. Reads naturally as "imagine you're about to ask gbrain something." Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: capitalize proper-noun names in prose across README + tutorials @garrytan caught lowercase "alice" in prose — proper nouns should be capitalized. The lowercase was leaking from the slug convention (people/alice as the actual storage slug) into descriptive text. Rule applied: capitalize Alice / Bob / Carol / Diana / Acme when used as a person or company name in prose. Keep lowercase in: - Slugs and file paths (people/alice, customers/acme-co) - Code identifiers in fenced blocks where the slug IS the value - URLs and hostnames (brain.acme-co.com) - Channel-name-style references (#alice-customers) Files swept: README.md, docs/tutorials/company-brain.md, docs/tutorials/personal-brain.md, docs/tutorials/README.md. The README sweep was the primary target (Garry's actual call-out); the tutorial sweep keeps voice consistent across all the front-door docs. Hand-fixed four occurrences inside code-fenced blocks that were human comments rather than code (terminal session comments "# Terminal 1, as Alice", "# Terminal 2, as Bob", directory-tree inline comments "← Alice's customer notebook"). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(readme-hero-anchors): rotate ZeroEntropy anchor → search-vs-answer headline CI caught one expected regression after v0.40.8.1's README rewrite. The D9 hero-anchors guard required "ZeroEntropy" in the first 50 lines of README.md (the v0.36.0.0 default story). The post-rewrite hero intentionally rotated that out per Garry's "no version chatter in README" directive — ZeroEntropy still appears further down (line 211, 231, 279) but no longer in the hero. The guard's docstring explicitly handles this case: "did we deliberately rotate the headline? If yes: update the anchors here." Rotation: - Dropped: regex /ZeroEntropy|\bZE\b/ in the first 50 lines - Added: regex matching the new headline "Search gives you raw pages. GBrain gives you the answer." which is the load-bearing differentiator of the post-rewrite hero. If a future cleanup PR accidentally rewords the search-vs-answer framing, the new anchor catches it the same way the ZeroEntropy anchor caught accidental drops before. Other 4 anchors unchanged (OpenClaw + Hermes + production-number + P@5/R@5 — all still load-bearing). Updated docstring records the v0.40.8.1 rotation as the audit trail for the next time this happens. Verified: `bun test test/readme-hero-anchors.test.ts` → 5 pass / 0 fail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): restore agent-led install path + per-client MCP guides The README install section had collapsed to three generic shapes ("agent platform", "CLI", "MCP server") that buried the load-bearing flow: paste a URL pointing at INSTALL_FOR_AGENTS.md into your agent and let it do the work. That's the path most users actually take. Restored the original three-tier structure with an explicit second tier for "install it into your existing agent" (Codex, Claude Code, Cursor), plus surfaced the per-client MCP guides individually so users see the command shape they actually need instead of one generic docs/mcp/ link. Six per-client MCP links now in the README itself: Claude Code, Cursor/Windsurf (stdio), Claude Desktop, Claude Cowork, Perplexity Computer, ChatGPT. Each carries the one-line shape that matters (claude mcp add, Settings > Integrations, OAuth 2.1, etc.). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(README): link personal-brain tutorial from the agent-install path People landing on the README without an existing OpenClaw or Hermes deployment need a starting point that walks the whole flow, not just "paste this URL into your agent." The personal-brain tutorial already covers picking a platform, deploying it, pointing it at INSTALL_FOR_AGENTS.md, and verifying the first query. Surfaced as a callout right under the agent-install snippet so the path is visible to first-time users without burying the experienced-user flow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
404 lines
16 KiB
Markdown
404 lines
16 KiB
Markdown
# GBrain Deployment Topologies
|
|
|
|
GBrain supports three deployment shapes. They compose: a single user can mix
|
|
all three on the same machine without conflict, because every shape resolves
|
|
to "which `~/.gbrain/config.json` is active right now?" and `GBRAIN_HOME`
|
|
controls that selection.
|
|
|
|
This page covers the three topologies, when each fits, and concrete setup
|
|
recipes. Pair this doc with `docs/architecture/brains-and-sources.md` (which
|
|
covers the in-brain organization axes) — that doc is about WHICH database;
|
|
this doc is about WHERE that database lives.
|
|
|
|
## Quick decision tree
|
|
|
|
```
|
|
"I'm setting up gbrain..."
|
|
│
|
|
▼
|
|
Just for me, on one machine? ─── yes ───▶ Topology 1 (single brain)
|
|
│
|
|
no
|
|
│
|
|
▼
|
|
Will a remote machine host the brain
|
|
while my agent runs locally? ──── yes ───▶ Topology 2 (cross-machine thin client)
|
|
│
|
|
no
|
|
│
|
|
▼
|
|
Multiple Conductor worktrees that
|
|
shouldn't share a code index? ─── yes ───▶ Topology 3 (split-engine)
|
|
```
|
|
|
|
Topologies 2 and 3 stack: a thin-client install can also host per-worktree
|
|
code engines, and a per-worktree code engine can also point its artifact
|
|
brain at a remote server.
|
|
|
|
## Topology 1 — Single brain (today's default)
|
|
|
|
```
|
|
┌────────────────┐
|
|
│ one machine │
|
|
│ ┌──────────┐ │
|
|
│ │ gbrain │──┼──→ ~/.gbrain/ → PGLite or Supabase
|
|
│ │ CLI │ │
|
|
│ └──────────┘ │
|
|
└────────────────┘
|
|
```
|
|
|
|
What you get: one local DB (PGLite for small brains, Supabase for ~1000+
|
|
files). All commands work directly against it. `gbrain serve` exposes it
|
|
to a single agent over MCP.
|
|
|
|
When it fits: solo use, single machine, one agent, no Conductor parallelism.
|
|
This is the default; `gbrain init` (no flags) gives you this.
|
|
|
|
Setup:
|
|
|
|
```
|
|
gbrain init # interactive — defaults to PGLite
|
|
gbrain init --pglite # explicit local
|
|
gbrain init --supabase # remote Supabase (recommended for 1000+ files)
|
|
```
|
|
|
|
Nothing else here is special. The other two topologies are variations on
|
|
"who owns the DB" and "how does the agent talk to it."
|
|
|
|
## Topology 2 — Cross-machine thin client
|
|
|
|
```
|
|
┌────────────┐ ┌──────────────────┐
|
|
│ neuromancer│ │ brain-host │
|
|
│ ┌────────┐ │ HTTP MCP / OAuth │ ┌────────────┐ │
|
|
│ │ Hermes │─┼───────────────────→│ │ gbrain │──┼──→ Supabase
|
|
│ │ agent │ │ │ │ serve --http│ │
|
|
│ └────────┘ │ │ └────────────┘ │
|
|
│ │ │ (with autopilot)│
|
|
│ no local │ │ │
|
|
│ gbrain DB │ │ │
|
|
└────────────┘ └──────────────────┘
|
|
```
|
|
|
|
What you get: the agent on one machine ("neuromancer") consumes a brain
|
|
hosted on another machine ("brain-host") over HTTP MCP with OAuth. The
|
|
agent's machine has NO local engine. All queries, searches, embeddings,
|
|
and indexing happen on the host.
|
|
|
|
When it fits:
|
|
|
|
- Heavy brain (Supabase + autopilot) lives on a beefy machine; agents
|
|
elsewhere just consume it.
|
|
- You want one source of truth across many machines.
|
|
- Spinning up a parallel local install would create source-ID contention or
|
|
duplicate work.
|
|
|
|
The thin client's `~/.gbrain/config.json` carries a `remote_mcp` field
|
|
instead of a local DB connection:
|
|
|
|
```jsonc
|
|
{
|
|
"engine": "postgres", // ignored — never used
|
|
"remote_mcp": {
|
|
"issuer_url": "https://brain-host.local:3001",
|
|
"mcp_url": "https://brain-host.local:3001/mcp",
|
|
"oauth_client_id": "neuromancer-...",
|
|
"oauth_client_secret": "..." // or set GBRAIN_REMOTE_CLIENT_SECRET
|
|
}
|
|
}
|
|
```
|
|
|
|
The CLI dispatch guard refuses any DB-bound command (`sync`, `embed`,
|
|
`extract`, `migrate`, `apply-migrations`, `repair-jsonb`, `orphans`,
|
|
`integrity`, `serve`) on a thin-client install with a clear error pointing
|
|
at the remote host. `gbrain doctor` runs a dedicated thin-client check set
|
|
(OAuth discovery, token round-trip, MCP smoke).
|
|
|
|
### Setup
|
|
|
|
**Step 1 — On the host (brain-host):**
|
|
|
|
```bash
|
|
gbrain init --supabase # or --pglite, doesn't matter
|
|
gbrain serve --http --port 3001 --bind 0.0.0.0 # v0.34: bind explicitly for remote access
|
|
# (defaults to 127.0.0.1 since v0.34)
|
|
gbrain auth register-client neuromancer \
|
|
--grant-types client_credentials \
|
|
--scopes read,write,admin # admin needed for ping/doctor
|
|
|
|
# v0.34: source-scoped client (write to one source, federate reads across
|
|
# multiple sources). Omit both flags for a v0.33-compatible super-client.
|
|
gbrain auth register-client neuromancer-dept \
|
|
--grant-types client_credentials \
|
|
--scopes read,write \
|
|
--source dept-x \
|
|
--federated-read dept-x,shared,parent-canon
|
|
```
|
|
|
|
The `register-client` command prints a `client_id` and `client_secret`.
|
|
Note both. **Scope must include `admin`** — `submit_job` (used by
|
|
`gbrain remote ping`) and `run_doctor` (used by `gbrain remote doctor`)
|
|
both require it.
|
|
|
|
**Step 2 — On the thin client (neuromancer):**
|
|
|
|
```bash
|
|
gbrain init --mcp-only \
|
|
--issuer-url https://brain-host.local:3001 \
|
|
--mcp-url https://brain-host.local:3001/mcp \
|
|
--oauth-client-id <id> \
|
|
--oauth-client-secret <secret>
|
|
```
|
|
|
|
Pre-flight smoke runs three probes (OAuth discovery, token round-trip,
|
|
MCP initialize). If any fails, init exits with an actionable error. On
|
|
success, `~/.gbrain/config.json` gets `remote_mcp` set and NO local DB
|
|
is created.
|
|
|
|
**Step 3 — Configure your agent's MCP client.**
|
|
|
|
For Claude Desktop / Hermes / openclaw, add a single MCP server entry
|
|
pointing at the host's `mcp_url` with the bearer token from `register-client`.
|
|
Example for Claude Desktop's `~/.config/claude/claude_desktop_config.json`:
|
|
|
|
```jsonc
|
|
{
|
|
"mcpServers": {
|
|
"gbrain": {
|
|
"type": "url",
|
|
"url": "https://brain-host.local:3001/mcp",
|
|
"headers": { "Authorization": "Bearer <client_secret>" }
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**Step 4 — Verify.**
|
|
|
|
```bash
|
|
gbrain doctor # runs thin-client checks (no local DB needed)
|
|
gbrain remote ping # triggers an autopilot cycle on the host (Tier B)
|
|
gbrain remote doctor # asks the host to run its own doctor (Tier B)
|
|
```
|
|
|
|
`gbrain sync` and friends will refuse with a clear thin-client error
|
|
naming the `mcp_url`. That's the correct behavior — those commands need
|
|
a local engine that doesn't exist here.
|
|
|
|
### Re-run guard
|
|
|
|
Running `gbrain init` (no flags) on a machine that already has thin-client
|
|
config set refuses without `--force`. This catches the scripted-setup-loop
|
|
friction where an orchestrator keeps trying to create a local DB. Use
|
|
`gbrain init --mcp-only --force` to refresh thin-client config.
|
|
|
|
### Storing the OAuth secret
|
|
|
|
Three storage paths in priority order:
|
|
|
|
1. **`GBRAIN_REMOTE_CLIENT_SECRET` env var** (preferred for headless agents).
|
|
When set, overrides whatever's in the config file. The init flow doesn't
|
|
persist a config-file copy when the env var was the source.
|
|
2. **`~/.gbrain/config.json` with 0600 perms** (default for interactive
|
|
setup; mirrors how Supabase keys are stored today).
|
|
3. macOS Keychain integration is on the roadmap; not in v1.
|
|
|
|
## Topology 3 — Split-engine, per-worktree code + remote artifacts
|
|
|
|
```
|
|
┌──────────────────────────────────────────────────────┐
|
|
│ one machine │
|
|
│ │
|
|
│ ┌─ worktree A ──────────────┐ │
|
|
│ │ GBRAIN_HOME=A/.conductor │ │
|
|
│ │ gbrain serve --port 3001 │── PGLite (code A) │
|
|
│ └───────────────────────────┘ │
|
|
│ │
|
|
│ ┌─ worktree B ──────────────┐ │
|
|
│ │ GBRAIN_HOME=B/.conductor │ │
|
|
│ │ gbrain serve --port 3002 │── PGLite (code B) │
|
|
│ └───────────────────────────┘ │
|
|
│ │
|
|
│ ┌─ default ~/.gbrain ───────┐ HTTP MCP / OAuth │
|
|
│ │ gbrain serve --port 3000 │──────────────────────→ remote artifacts
|
|
│ └───────────────────────────┘ (Supabase / brain-host)
|
|
│ │
|
|
│ Agent's MCP config (Hermes / Claude Desktop): │
|
|
│ mcp__gbrain_code__* → http://localhost:3001 │
|
|
│ mcp__gbrain_artifacts__* → http://brain-host/mcp │
|
|
└──────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
What you get: each Conductor worktree has its own per-worktree code index
|
|
(local PGLite, disposable when the worktree dies). Artifacts (plans,
|
|
learnings, transcripts) still live in a shared brain that all worktrees
|
|
can see and write to.
|
|
|
|
When it fits:
|
|
|
|
- Multiple Conductor worktrees on one machine, all touching the same code
|
|
repo.
|
|
- You don't want each worktree's code-import to clobber the others'
|
|
`last_commit`, source IDs, or symbol tables.
|
|
- You DO want artifacts (plans, learnings, retros, transcripts) to be
|
|
visible across worktrees.
|
|
|
|
### How it works
|
|
|
|
`GBRAIN_HOME` selects which `~/.gbrain` directory is active. Set per worktree:
|
|
|
|
```bash
|
|
export GBRAIN_HOME=/path/to/worktree-A/.conductor/gbrain
|
|
gbrain init --pglite
|
|
gbrain serve --http --port 3001
|
|
```
|
|
|
|
Each worktree's `gbrain serve` instance binds its own port and indexes its
|
|
own DB. Multiple `gbrain serve` processes coexist fine — they're separate
|
|
OS processes with separate config and separate connection pools.
|
|
|
|
The artifact brain runs as a separate `gbrain serve` instance with the
|
|
default `~/.gbrain` (no GBRAIN_HOME override) — or remote, in which case
|
|
it's a Topology 2 setup.
|
|
|
|
The agent's MCP client config lists multiple servers, each with a unique
|
|
alias. Tool names are namespaced as `mcp__<alias>__<tool>`, so the agent
|
|
calls `mcp__gbrain_code__search` for code lookups and `mcp__gbrain_artifacts__search`
|
|
for artifact lookups.
|
|
|
|
### Recommended embedding model
|
|
|
|
Per-worktree code brains index source files only — no meeting notes,
|
|
no people pages, no transcripts. Configure each code brain to use
|
|
Voyage's code-tuned model at init time so the config can't be lost to a
|
|
later `init` overwrite:
|
|
|
|
```bash
|
|
export GBRAIN_HOME=/path/to/worktree-A/.conductor/gbrain
|
|
gbrain init --pglite \
|
|
--embedding-model voyage:voyage-code-3 \
|
|
--embedding-dimensions 1024
|
|
```
|
|
|
|
`voyage-code-3` is Voyage's code-specialized embedding model with
|
|
head-to-head numbers above their general flagships on code retrieval
|
|
([voyageai.com/blog](https://voyageai.com/blog)). For already-initialized
|
|
brains, switch with the one-command wipe-and-reinit (preserves every
|
|
other config field):
|
|
|
|
```bash
|
|
gbrain reinit-pglite --embedding-model voyage:voyage-code-3 --embedding-dimensions 1024
|
|
gbrain reindex --code --yes
|
|
```
|
|
|
|
(`gbrain config set embedding_model` is refused as of v0.37.11.0 because
|
|
the schema column has to resize alongside the config.)
|
|
|
|
`gbrain reindex --code` prints a recommendation when the configured
|
|
embedding model isn't code-tuned. Suppress with
|
|
`GBRAIN_NO_CODE_MODEL_NUDGE=1` if you've intentionally chosen another
|
|
provider (single-vendor procurement, compliance, no Voyage key).
|
|
|
|
### CRITICAL: alias-level routing is manual
|
|
|
|
Topology 3 has no smart per-tool routing inside gbrain. The agent picks
|
|
which brain to query when it picks the alias. **A wrong alias writes (or
|
|
queries) the wrong brain silently.** This is intentional (explicit beats
|
|
magic) but real:
|
|
|
|
- If the agent calls `mcp__gbrain_artifacts__put_page` with code-shaped
|
|
content, that page lands in the artifact brain forever.
|
|
- If the agent calls `mcp__gbrain_code__search` for a question that
|
|
actually wants artifact context, the search comes back empty.
|
|
|
|
Mitigations:
|
|
|
|
- Name aliases clearly. `gbrain_code` vs `gbrain_artifacts` is unambiguous;
|
|
`gbrain` vs `gbrain_local` is not.
|
|
- Document in your agent's system prompt or rules which alias goes where.
|
|
Be explicit about "code questions → `gbrain_code`; everything else →
|
|
`gbrain_artifacts`."
|
|
- Pair Topology 3 with `gstack`'s per-worktree wiring (which sets the
|
|
alias names + agent rules consistently across worktrees).
|
|
|
|
### Setup (manual; gstack automates this side)
|
|
|
|
The gbrain side requires zero new code — `GBRAIN_HOME` and `--port` already
|
|
exist. Setup looks like:
|
|
|
|
```bash
|
|
# Start the artifact brain (default ~/.gbrain) on port 3000
|
|
gbrain serve --http --port 3000 &
|
|
|
|
# Start a per-worktree code brain on port 3001
|
|
export GBRAIN_HOME=/path/to/worktree-A/.conductor/gbrain
|
|
gbrain init --pglite
|
|
gbrain serve --http --port 3001 &
|
|
unset GBRAIN_HOME
|
|
```
|
|
|
|
Then configure the agent's MCP config with two entries (different aliases,
|
|
different ports). For Claude Desktop:
|
|
|
|
```jsonc
|
|
{
|
|
"mcpServers": {
|
|
"gbrain_artifacts": {
|
|
"type": "url",
|
|
"url": "http://localhost:3000/mcp",
|
|
"headers": { "Authorization": "Bearer <token-A>" }
|
|
},
|
|
"gbrain_code": {
|
|
"type": "url",
|
|
"url": "http://localhost:3001/mcp",
|
|
"headers": { "Authorization": "Bearer <token-B>" }
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
The gstack-side wiring (per-worktree home setup, port allocation, automatic
|
|
MCP config generation, gitignore for the per-worktree DB) is in the gstack
|
|
repo's setup-gbrain skill — it composes these primitives, gbrain doesn't
|
|
have to know about Conductor.
|
|
|
|
## Combining topologies
|
|
|
|
The three shapes compose. A single machine can run:
|
|
|
|
- A thin-client default config pointing at a remote artifact brain
|
|
(Topology 2).
|
|
- Plus per-worktree code brains under their own `GBRAIN_HOME` (Topology 3).
|
|
- Each worktree's `gbrain serve` instance is local; the agent's MCP config
|
|
lists them alongside the remote artifact brain.
|
|
|
|
`GBRAIN_HOME` controls which config file is active for any one CLI
|
|
invocation. `gbrain serve --port` controls which port a server listens on.
|
|
The agent's MCP client picks the alias and thus the destination per tool
|
|
call. There's no global gbrain orchestrator that knows about all of them
|
|
simultaneously — that's by design.
|
|
|
|
## When NOT to use these topologies
|
|
|
|
- **Don't use Topology 2 if your agent only ever runs on the same machine
|
|
as the brain.** A local `gbrain` install + `gbrain serve` (stdio) is
|
|
simpler and faster.
|
|
- **Don't use Topology 3 if you only have one Conductor worktree at a
|
|
time.** Per-worktree engines exist to prevent contention; one-at-a-time
|
|
use has no contention.
|
|
- **Don't use a `remote_mcp` thin client AND a local engine on the same
|
|
machine in the same `GBRAIN_HOME`.** The dispatch guard refuses DB-bound
|
|
commands when `remote_mcp` is set. If you genuinely want both modes on
|
|
one machine, use `GBRAIN_HOME` to separate them (one home for the thin
|
|
client, another for the local engine).
|
|
|
|
## See also
|
|
|
|
- `docs/architecture/brains-and-sources.md` — in-brain organization (brains
|
|
vs sources axes).
|
|
- `docs/mcp/CLAUDE_DESKTOP.md` and siblings — per-client MCP setup.
|
|
- `gbrain init --help` and `gbrain auth --help` for command-level details.
|
|
- [`docs/tutorials/`](../tutorials/) — end-to-end walkthroughs that combine
|
|
these topologies into working setups (company brain, personal brain,
|
|
agent integration, etc.).
|