Gbrain brain-ops
git clone https://github.com/garrytan/gbrain
T=$(mktemp -d) && git clone --depth=1 https://github.com/garrytan/gbrain "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/brain-ops" ~/.claude/skills/garrytan-gbrain-brain-ops && rm -rf "$T"
skills/brain-ops/SKILL.mdBrain Operations — The Ambient Context Layer
The brain is not an archive. It is a live context membrane that every interaction flows through in both directions.
Convention: See
for the 5-step lookup protocol. Convention: Seeskills/conventions/brain-first.mdfor citation and back-link rules.skills/conventions/quality.md
Contract
This skill guarantees:
- Brain is checked BEFORE any external API call (brain-first lookup)
- Every inbound signal triggers the READ → ENRICH → WRITE loop
- Every outbound response checks brain for relevant context
- Source attribution on every fact written (inline
citations)[Source: ...] - User's direct statements are highest-authority data
- Back-links maintained on every brain write (Iron Law)
Iron Law: Back-Linking (MANDATORY)
Every mention of a person or company with a brain page MUST create a back-link FROM that entity's page TO the page mentioning them. An unlinked mention is a broken brain. See
skills/conventions/quality.md for format.
Phases
Phase 1: Brain-First Lookup (MANDATORY)
Before using ANY external API to research a person, company, or topic:
— keyword search for existing pagesgbrain search "name"
— hybrid search for contextgbrain query "natural question about name"
— if you know the slug, read the full pagegbrain get <slug>- Check backlinks: who references this entity?
- Check timeline: recent events involving this entity
The brain almost always has something. External APIs fill gaps, not start from scratch.
Phase 2: On Every Inbound Signal (READ → ENRICH → WRITE)
Every message, meeting, email, or conversation that references a person or company:
- Detect entities — people, companies, deals mentioned
- Load brain pages — read existing pages for context before responding
- Identify new information — what does this signal tell us that the page doesn't know?
- Write it back — update the brain page with new info + timeline entry + source citation
- Create if missing — if notable and no page exists, create via enrich skill
User's direct statements are the highest-value data source. Write them to brain pages immediately with attribution
[Source: User, YYYY-MM-DD].
Phase 2.5: Structured Graph Updates (automatic)
Every
put_page call automatically extracts entity references and writes them
to the graph (links table) with inferred relationship types. Stale links
(refs no longer in the page text) are removed in the same call. This is
"auto-link" reconciliation.
- No manual
calls needed for ordinary page writes.add_link - Inferred link types:
(meeting -> person),attended
,works_at
,invested_in
,founded
,advises
(frontmatter),source
(default).mentions - The
MCP response includesput_page
so the agent can verify outcomes.auto_links: { created, removed, errors } - To disable:
. Default is on.gbrain config set auto_link false - Timeline entries with specific dates still need explicit
(or batch viagbrain timeline-add
).gbrain extract timeline --source db
Phase 3: On Every Outbound Response (READ → PULL → RESPOND)
Before answering any question about a person, company, or topic:
- Check the brain — read relevant pages
- Pull context — use compiled truth + recent timeline
- Respond with context — the brain makes every answer better
Don't answer from general knowledge when a brain page exists.
Phase 4: Ambient Enrichment
This is not a special mode. This is the default. Everything the user says is an ingest event.
- Person mentioned → check brain, create/enrich if needed (spawn background)
- Company mentioned → same
- Link shared → ingest it (delegate to idea-ingest)
- Data shared → delegate to appropriate skill
Rules:
- Never interrupt the conversation to do enrichment
- Spawn sub-agents for anything that would slow down the response
- Never announce "I'm enriching the brain" — just do it silently
Output Format
No separate output. Brain-ops is an always-on behavior layer, not a report generator. The output is updated brain pages and enriched responses.
Anti-Patterns
- Answering questions about people/companies without checking the brain first
- Using external APIs before checking the brain
- Writing facts without inline
citations[Source: ...] - Blocking the response to do enrichment
- Overwriting user's direct statements with lower-authority sources
- Creating brain pages for non-notable entities
Tools Used
— keyword searchsearch
— hybrid vector+keyword searchquery
— read a brain pageget_page
— create/update brain pagesput_page
— cross-reference entitiesadd_link
— record eventsadd_timeline_entry
— check who references an entityget_backlinks
— sync changes to the indexsync_brain