garrytan/gbrainmarkdown explorer
garrytan/gbrainmaster
docs

GBRAIN SKILLPACK

docs/GBRAIN_SKILLPACK.md

<!-- source: https://raw.githubusercontent.com/garrytan/gbrain/master/docs/GBRAIN_SKILLPACK.md -->

GBrain Skillpack: Reference Architecture for AI Agents

This is a reference architecture for how a production AI agent uses gbrain as its knowledge backbone. Based on patterns from a real deployment with 14,700+ brain files, the 50+ bundled skills (skills/manifest.json), and 20+ cron jobs running continuously.

The memex vision, realized. Vannevar Bush imagined a device where an individual stores everything, mechanized so it may be consulted with exceeding speed. GBrain is that device, except the memex builds itself. The agent detects entities, enriches pages, creates cross-references, and maintains compiled truth automatically.

Each section below is a standalone guide. Click through to the full content.


Core Patterns

The foundational read-write loop and data model.

GuideWhat It Covers
The Brain-Agent LoopThe read-write cycle that makes the brain compound over time
Entity DetectionRun it on every message. Capture original thinking + entity mentions
The Originals FolderCapturing WHAT YOU THINK, not just what you found
Brain-First LookupCheck the brain before calling any external API
Push-Based Contextvolunteer_context: the brain volunteers relevant pages instead of waiting to be asked
Compiled Truth + TimelineAbove the line: current synthesis. Below: append-only evidence
Source AttributionEvery fact needs a citation. Format and hierarchy

Data Pipelines

Getting data in and keeping it current.

GuideWhat It Covers
Enrichment Pipeline7-step protocol, tier system (Tier 1/2/3 by importance)
Meeting IngestionAlways pull complete transcript, propagate to all entity pages
Content & Media IngestionYouTube, social media bundles, PDFs/documents
Diligence IngestionData room materials: pitch decks, financial models, cap tables
Deterministic CollectorsCode for data, LLMs for judgment. The collector pattern
Idea Capture & OriginalsDepth test, originality distribution, deep cross-linking
Getting Data InIntegration recipes: voice, email, X, calendar

Operations

Running a production brain.

GuideWhat It Covers
Reference Cron Schedule20+ recurring jobs, quiet hours, dream cycle
Cron via MinionsWhy scheduled work runs as Minion jobs, not agentTurn. Auto-applied by v0.11.0 migration for built-in handlers; host-specific handlers use the plugin contract below.
Plugin HandlersRegistering host-specific Minion handlers via code (no data-file exec surface).
Minions fixRepairing a half-migrated v0.11.0 install.
Shell jobs (v0.14.0+)Move deterministic crons (API fetch, token refresh, scrape+write) off the LLM gateway. Zero tokens per fire, ~60% gateway headroom. Follow skills/migrations/v0.14.0.md for the adoption playbook.
Quiet Hours & TimezoneHold notifications during sleep, timezone-aware delivery
Executive Assistant PatternEmail triage, meeting prep, scheduling
Operational DisciplinesSignal detection, brain-first, sync-after-write, heartbeat, dream cycle
Skill Development Cycle5-step cycle: concept, prototype, evaluate, codify, cron

Subagent routing (v0.11.0+): agents that dispatch background work should route through skills/conventions/subagent-routing.md — it reads ~/.gbrain/preferences.json#minion_mode and branches between native subagents and Minion jobs. The v0.11.0 migration auto-injects a marker into AGENTS.md pointing at this convention.

Cron routing (v0.11.0+): scheduled work goes through Minions, not OpenClaw's agentTurn. See skills/conventions/cron-via-minions.md for the rewrite pattern. The v0.11.0 migration auto-rewrites entries whose handler is a gbrain builtin; host-specific handlers (e.g. ea-inbox-sweep) need a code-level registration per docs/guides/plugin-handlers.md.

Architecture

How to structure your system.

GuideWhat It Covers
Two-Repo ArchitectureAgent repo vs brain repo, boundary rules, decision tree
Sub-Agent Model RoutingWhich model for which task, signal detector pattern, cost optimization
The Three Search ModesKeyword, hybrid, direct. When to use each
Brain vs Agent Memory3 layers: GBrain (world knowledge), agent memory, session

Integrations

Wiring up your life.

GuideWhat It Covers
Credential GatewayClawVisor / Hermes for Gmail, Calendar, Contacts
Meeting & Call WebhooksCircleback transcripts + Quo/OpenPhone SMS/calls
Voice-to-BrainPhone calls + WebRTC browser calls create brain pages. 25 production patterns: identity separation, bid system, conversation timing, proactive advisor, prompt compression, caller routing, dynamic VAD, real-time logging, belt-and-suspenders post-call
Email-to-BrainGmail messages flow into entity pages via deterministic collector
X-to-BrainTwitter monitoring with deletion detection + engagement velocity
Calendar-to-BrainGoogle Calendar events become searchable daily brain pages
Meeting SyncCircleback transcripts auto-import with attendee propagation

Administration

Keeping it running and up to date.

GuideWhat It Covers
Agent BootstrapThe paste-in install: gbrain bootstrap, hooks, bootstrap verify, keyless mode
Upgrades & Auto-Updatecheck-update, agent notifications, migration files
Live SyncKeep the index current: cron, --watch, webhook approaches

Getting Started

After setup, the brain is empty. The cold-start skill sequences the highest-leverage data sources to populate it:

GuideWhat It Covers
Cold StartDay-one bootstrapping: contacts, calendar, email, conversations, social, archives. Uses ClawVisor for safe credential handling — agents never hold raw API keys.
Ask UserChoice-gate pattern for human input at decision points. Used by cold-start and other skills.

Appendix: GBrain CLI Quick Reference

CommandPurpose
gbrain search "term"Keyword search across all brain pages
gbrain query "question"Hybrid search (vector + keyword + RRF)
gbrain get <slug>Read a specific brain page by slug
gbrain syncSync local markdown repo to gbrain index
gbrain import <path>Import files into the brain
gbrain embed --staleRe-embed pages with stale or missing embeddings
gbrain integrationsManage integration recipes (senses + reflexes)
gbrain statsShow brain statistics (page count, last sync, etc.)
gbrain doctorDiagnose brain health issues
gbrain check-updateCheck for new versions and integration recipes

Run gbrain --help for the full command reference.


Architecture & Philosophy

Continue exploring589 Markdown documents in the local repository