Skip to content
garrytanPublic

About

Garry's Opinionated OpenClaw/Hermes Agent Brain

Resources

Contributing

Security policy

Stars

33.8k stars

Watchers

134 watching

Forks

Latest commit

 

History

16,693 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GBrain

GBrain gives your AI agents shared, cited memory over plain Markdown. Save a decision in Claude Code and find it in Codex, Cursor, or ChatGPT: GBrain indexes Markdown into local PGLite or Postgres with keyword + vector search and a typed knowledge graph—returning cited answers that flag gaps instead of isolated search chunks, over MCP and a CLI.

MIT-licensed and free to self-host (starts keyless with local keyword + graph search; add an embedding key for vectors), or managed at gbrain.io.

What it looks like

Your notes stay plain Markdown—[[wikilinks]] and frontmatter become typed graph edges:

---
type: person
company: "[[companies/acme]]"
---
Alice leads engineering at [[companies/acme]].

Ask a connected agent (illustrative):

"What do I need to know before my meeting with Alice tomorrow?"

GBrain follows links across Alice, Acme, and past meetings—and flags where the record stops:

Alice leads engineering at Acme, a Series B fintech [people/alice, companies/acme].
Last met April 22 on the enterprise tier [meetings/2026-04-22-pricing]:
- Security review from Alice was due May 1 [meetings/2026-04-22-pricing].
- You sent a 500-seat quote April 25; no recorded reply [notes/2026-04-25-quote].

Gaps: no notes added for Alice or Acme since April 25—check email or Slack before
assuming these items are still open.

Quickstart

Self-hosted Hosted (gbrain.io)
Best for Local-first ownership, offline keyword + graph search, or your own Postgres + pgvector Always-on memory across Claude, ChatGPT, Codex, and Cursor with nothing to host
Storage & keys Local PGLite (zero API keys; add an embedding key for vector search) or Postgres + pgvector Managed Postgres + pgvector (hybrid search included; paid plans)
Access Local stdio MCP, or remote HTTPS via Tailscale Native HTTPS OAuth (notes hosted on gbrain.io)

Prefer your coding agent to handle setup? Point it at INSTALL_FOR_AGENTS.md.

Self-hosted

Prerequisites: macOS or Linux with Bun 1.4.4+.

Warning

Not on npm. Install only from GitHub or the release binary below—the gbrain package on npm is unrelated. If you installed it by mistake or hit an install error, remove it first and follow install recovery.

1. Install and connect your agent (swap claude-code for codex; for Hermes, see docs/mcp/HERMES.md):

bun install -g github:garrytan/gbrain#stable
gbrain --version
gbrain setup claude-code   # initializes ~/.gbrain (PGLite), wires MCP, and adds agent hooks (reversible)
No Bun? Release-binary installer (macOS Apple Silicon / Linux x86-64 glibc)

Verifies SHA-256 against GitHub build provenance before installing (scripts/install.sh; omit --setup claude-code for binary + keyless brain only):

( f="$(mktemp)"; trap 'rm -f "$f"' EXIT; curl -fsSL https://raw.githubusercontent.com/garrytan/gbrain/stable/scripts/install.sh -o "$f" && bash "$f" --setup claude-code )
Cursor or other stdio MCP clients

Install the compiled release binary above (avoids macOS GUI PATH issues and untrusted-repo bunfig.toml loading per SECURITY.md), initialize a keyless brain, and add its path to your MCP config (for example ~/.cursor/mcp.json):

gbrain init --pglite --no-embedding
which gbrain
{
  "mcpServers": {
    "gbrain": {
      "command": "<path-to-gbrain>",
      "args": ["serve", "--surface", "starter", "--advertise", "verbs"]
    }
  }
}

Client guides: Claude Desktop · OpenClaw (uses full tool surface) · All clients.

2. Try the offline sample brain, then index your own Markdown notes:

# Isolated offline sample brain: 15 company pages, prints cited answers, touches no personal files
gbrain sources demo company-brain

# Index a Markdown folder keyless (--no-embed skips vector embeddings) and search it
gbrain import <path-to-markdown-folder> --no-embed
gbrain search "pricing"

Optional—for standalone CLI synthesis, set ANTHROPIC_API_KEY or OPENAI_API_KEY in your environment (over MCP, your agent uses its own model):

gbrain think "what did we decide about pricing?"

For vector embeddings, Git sync, or Postgres + pgvector, see docs/INSTALL.md and move to Postgres.

Hosted (gbrain.io)

  1. Create a workspace at gbrain.io.
  2. Connect your client over HTTPS MCP and approve the browser OAuth prompt (one-click Claude/Cursor links; ChatGPT · OpenClaw · Hermes):
# Claude Code (skips if a gbrain MCP entry already exists)
claude mcp get gbrain >/dev/null 2>&1 || claude mcp add --transport http --scope user gbrain https://gbrain.io/mcp

# Codex (skips if a gbrain MCP entry already exists)
codex mcp get gbrain >/dev/null 2>&1 || codex mcp add gbrain --url https://gbrain.io/mcp

# Optional (requires gbrain CLI): add per-turn brain-first instructions without changing MCP
gbrain setup claude-code --instructions-only

Cursor and other HTTP MCP clients connect to https://gbrain.io/mcp (client config snippets).

Verify in a live agent session (both paths): Confirm your gbrain MCP entry points at the brain you want, then say "Remember that the Q3 launch moved to October 12." Open a new session and ask "When is the Q3 launch?"—it should return the fact with its source.

How it compares

Approach Strengths What GBrain adds
Raw Markdown + grep Zero setup; strong on single-user exact text lookups Hybrid keyword + vector ranking, typed entity graph, and server-enforced team permissions
Plain RAG Simple chunk-embed-retrieve pipeline Graph traversal across linked pages, gap-aware synthesis, and source trust labels (separating your notes from untrusted email/web text)
Standalone vector DB Fast semantic similarity search Plain Markdown files stay on disk, Git-diffable and rebuildable alongside full-text search and typed links

Measured benchmarks

Six comparisons from gbrain-evals (commit 898e0ebf; methodology, intervals, and caveats in docs/proof.md):

Benchmark Baseline With GBrain Delta
Personal-notes Q&A (98 tasks) 13.3% (no retrieval) 86.7% +73.5 pts (paired)
LongMemEval (500 questions, dev set) 89.0% plain Postgres hybrid; 94.2% full paste 93.6% +4.6 pts vs hybrid; tied with paste (−0.6 pts, p = 0.72) at ~1/7 answer-reader cost ($0.023 vs $0.172)
Role-scoped permissions (100 runs) Plain Postgres: 97/100 to context (4 to answers); grep: 100/100 to context (0 to answers) 0/100 to context or answers 0 restricted-doc leaks
Planted false claims (100 scenarios, 600 sessions) 10.2% adopted (plain Postgres) 2.8% adopted −7.3 pts (paired) with trust labels
Very long chat logs — BEAM-10M (199 questions) 67.4% (agent with grep) 55.2% GBrain behind by 12.2 pts
Window-sized chats — LoCoMo (200 questions) 84.2% (whole conversation pasted) 80.0% GBrain behind by 4.2 pts

When not to use GBrain: Skip it if your notes fit inside one prompt window, or if you are a single user grepping huge chat logs with no need for shared access or permissions (what you'd build without GBrain).

Architecture

flowchart LR
    Files[Markdown + wikilinks & frontmatter] <--> Sync[Sync & parse]
    Sync --> DB[(PGLite or Postgres + pgvector)]
    Agent[AI agents via MCP] <--> Engine[Keyword / hybrid search & typed graph]
    CLI[CLI search & optional gbrain think] <--> Engine
    Engine <--> DB
Loading
  • Markdown on disk, index in Postgres/PGLite: Plain Markdown files rebuild the index and Git-backed writes commit back to disk; database-only pages need a DB backup (memory boundaries). Local PGLite is single-writer—use Postgres or a shared HTTP server for concurrent clients (engines).
  • Permissions: HTTP MCP enforces per-member permissions on remote callers (sharing boundaries).
  • Privacy & data flow: Keyless retrieval makes zero model calls, and telemetry is off by default (telemetry). Adding an embedding or chat key sends indexed text—including default local session archiving (conversation archive)—to your configured provider.

Docs


MIT License · Contributing · Security · Origin story

About

Garry's Opinionated OpenClaw/Hermes Agent Brain

Resources

Contributing

Security policy

Stars

33.8k stars

Watchers

134 watching

Forks

Releases

Packages

Contributors

Languages