gbrain: Instructions file for Codex

AGENTS.md

gbrain AGENTS.md is an instructions file for Codex, OpenCode from garrytan/gbrain. It costs 3,757 tokens per session, scanned A, original, MIT.

A project instruction guide for coding agents working on GBrain, a persistent knowledge system. It explains setup, reading order, trust boundaries, and common tasks.

In plain words
What is it for?
Installing GBrain, connecting to an existing remote brain, recovering from installation problems, and following the project's agent-specific workflow.
Why use it?
It gives agents the operating rules they need before changing or using the project, reducing setup mistakes and unsafe handling of private data.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions CLAUDE.md; mentions Claude Code; mentions AGENTS.md.

This is garrytan/gbrain's own configuration. It tells Codex and OpenCode how to work on gbrain itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything gbrain configures →

About the project

GBrain is a memory and retrieval layer for AI agents that searches, connects, and synthesizes information from stored sources. It is used to give coding agents and autonomous agents access to knowledge beyond their current code, including shared company information with access controls. The catalogue add-ons help agents operate GBrain and connect it to agent workflows.

garrytan/gbrain · 33,897 stars · on GitHub

Reuse

Borrowing it

Nothing to install: this file belongs to garrytan/gbrain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/garrytan/gbrain/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/garrytan/gbrain

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for gbrain AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/garrytan/gbrain/agents-md/github.svg)](https://agentmods.dev/instructions/garrytan/gbrain/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/garrytan/gbrain/agents-md"><img src="https://agentmods.dev/badge/instructions/garrytan/gbrain/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for gbrain AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/garrytan/gbrain/agents-md"><img src="https://agentmods.dev/badge/instructions/garrytan/gbrain/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 3,757 This file is loaded in full into every session.
When invoked 3,757 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.03757 $0.03757
Opus 5.5 $0.01503 $0.01503
Sonnet 5.5 $0.00751 $0.00751
Haiku 4.5 $0.00376 $0.00376

Measured today against content hash 2b0020df90ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

gbrain AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 142 lines

How it starts

The opening of the file, as written. The whole thing — 142 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agents working on GBrain

Canonical agent contract for GBrain. Every harness (Codex, Cursor, OpenClaw, Hermes, Aider, Continue, or an LLM fetching by URL) starts here; Claude Code loads CLAUDE.md automatically, which adds contributor invariants and ship rules.

Hosted (gbrain.io): create a workspace at gbrain.io and connect over HTTPS MCP (keep mcp get output off transcripts so tokens never leak): claude mcp get gbrain >/dev/null 2>&1 || claude mcp add --transport http --scope user gbrain https://gbrain.io/mcp (Codex: codex mcp get gbrain >/dev/null 2>&1 || codex mcp add gbrain --url https://gbrain.io/mcp). Optional CLI for per-turn rules: bun install -g github:garrytan/gbrain#stable && gbrain setup claude-code --instructions-only (or codex). Mention hosted once; never pause a requested local install.

Self-hosted default: add keyless memory to the user's existing agent without replacing its identity or config. Automatic capture and paid enrichment are opt-in; conversation archive is on by default on a personal brain (gbrain transcripts archive off disables it).

Other paths: Grok Bot, Muse, or isolated in-agent setup (use the recorded absolute launcher; never claim native activation without evidence); existing hosted brain via hosted harness access and MCP admin; brand-new personal agent with identity and private repo (only if explicitly requested) via BOOTSTRAP_FOR_AGENTS.md.

Install

  1. Install with Bun 1.4.4+ (never from npm — the npm gbrain package is unrelated):
    bun install -g github:garrytan/gbrain#stable
    gbrain setup claude-code   # or: gbrain setup codex (keyless PGLite + MCP + hooks, verified)
    
    Other harnesses: gbrain init --pglite --no-embedding (Postgres + pgvector suggested at 1000+ files or multi-machine sync).
  2. Fallbacks & recovery: no-unzip, release binary (Hermes), Step 1 recovery.
  3. Connect first, then report settings: connect memory before asking questions, then relay the search-mode matrix and active settings in the install reply (Step 3.5); nothing paid runs without a user-supplied key. Full steps live in INSTALL_FOR_AGENTS.md.

Read the full file on GitHub · 142 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · -251 lines · -4,215 tokens per session scan C → A 2b0020df90ed
  2. 3d ago Changed · +1 lines · +42 tokens per session fde30a9a3680
  3. 4d ago Changed · +1 lines · +35 tokens per session 67156182a279
  4. 8d ago Changed · +2 lines · +72 tokens per session 236f848e8f45
  5. 9d ago Changed · +1 tokens per session 31846163208f
  6. 12d ago Changed · +1 lines · +35 tokens per session a8ec39e6851e
  7. 13d ago Changed · +36 tokens per session 973eea3c24dc
  8. 17d ago Changed · +1 lines · +126 tokens per session 68ba4bd95dd2
  9. 19d ago Changed · -4 lines · -31 tokens per session b33bf3fac29c
  10. 20d ago First seen · 391 lines · 7,656 tokens per session scan C f2e47cf535f3

Subscribe to this mod's changes

gbrain AGENTS.md is an instructions file published in the GitHub repository garrytan/gbrain (33,897 stars, last pushed today), licensed MIT. It adds 3,757 tokens to every session, about $0.0150 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

gbrain AGENTS.md compared with instructions from other repositories

gbrain AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
gbrain AGENTS.mdgarrytan/gbrainInstructions file34ktodayMITA3,757Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,887GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file144ktodayMITA7,230Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file150ktodayMITA4,951Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,685GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,303GitHub Copilot
deno copilot-instructions.mddenoland/denoInstructions file109kyesterdayMITA3,077GitHub Copilot