brain-ingest-gate
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for agent-harness installs, install/provision Postgres (Supabase discovery via SUPABASE_ACCESS_TOKEN, local Postgres, opt-in Docker), and move an existing PGLite brain with the guarded engine migration.
$ npx -y skills add garrytan/gbrain --skill postgres-adopt --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/postgres-adoptContext preview
The summary Claude sees to decide when to auto-load this skill.
Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for agent-harness installs, install/provision Postgres (Supabase discovery via SUPABASE_ACCESS_TOKEN, local Postgres, opt-in Docker), and move an existing PGLite brain with the guarded engine migration.
name: postgres-adopt description: | Detect which gbrain engine is in use (PGLite vs Postgres), prefer Postgres for agent-harness installs, install/provision Postgres (Supabase discovery via SUPABASE_ACCESS_TOKEN, local Postgres, opt-in Docker), and move an existing PGLite brain with the guarded engine migration. Detection is one engine-free command; the install ladder is one flag. triggers: - "which gbrain engine" - "pglite or postgres" - "gbrain engine status" - "upgrade to postgres" - "switch gbrain to postgres" - "install postgres for gbrain" - "move my brain to supabase" - "set up postgres for the brain" tools: - exec mutating: true brain_first: exempt
> The engine is the brain's foundation: PGLite is the zero-config floor, > Postgres is where concurrency, multi-machine access, and 1000+ pages live. > This skill answers "which one am I on?", prefers Postgres when the > operator wants it, and moves data safely — never by flipping config.
This skill guarantees:
answers with the database down (that is the point of the command).
`gbrain migrate --to <supabase|pglite>` — which brings its own guardrails (quiesce mutex, resume manifest, non-empty-target guard, and a config flip only on a fully clean run). This skill wraps it; it never reimplements it.
creating a database on a local server needs `--allow-create-db`. Headless mutation of infrastructure the operator didn't opt into never happens.
gbrain engine status --json
Branch on the output:
report healthy, done.
problem, not an adoption problem: route to [db-repair](../db-repair/SKILL.md).
overriding the config file; tell the operator which one wins — the signal is `db_url_source` (`env:GBRAIN_DATABASE_URL` / `env:DATABASE_URL` means env wins; `env.note` additionally fires when both env URLs are set or the cwd-.env shadow guard excluded one).
belong to that host. Stop.
gbrain init --prefer-postgres
The ladder tries, in order: an env URL → Supabase Management-API discovery (`SUPABASE_ACCESS_TOKEN`, plus `SUPABASE_PROJECT_REF` on multi-project accounts and `SUPABASE_DB_PASSWORD` for the connection string) → a local Postgres (only when `PGHOST`/`PGPORT`/`PGUSER`/`PGPASSWORD` are set or `--local-postgres` is passed) → docker → PGLite. Each unusable rung prints a one-line note and falls through; nothing is silent.
`gbrain-postgres` container that survives reboots) or `--allow-create-db` (it runs CREATE DATABASE on their local server).
upgrade path below is available whenever they want it.
Confirm with the operator first (this copies every page/fact into the target and, only on a fully clean run, flips the config). Then:
gbrain migrate --to supabase --url <postgres-connection-string>
command resumes from its manifest. Never "fix" a partial by editing config.
`brain.pglite/` dir is preserved (doctor's `pglite_leftovers` tracks it).
is this skill's cue.
Postgres wins on concurrency, multi-machine access, and scale. PGLite keeps the per-turn bootstrap hook lane (hook injection is PGLite-only today — `docs/guides/bootstrap.md`); on Postgres, ambient context rides MCP-every-session and the pull protocol instead. Recommend Postgres when the operator has concurrent agents, multiple machines, or a 1000+ page brain; otherwise PGLite is genuinely fine.
flip without a data migration splits the brain across two stores.
Detection reports in one line; changes report in 2-4:
Engine: <pglite|postgres> (source: <db_url_source>) [probe: ok, 42ms] Action: <none | init rung that won | migrate --to supabase result> Next: <upgrade note, or "healthy — nothing to do">
Quote `gbrain engine status` output as-is (it is already redacted); name the winning ladder rung when an install ran; after a migration, include the target's `gbrain doctor` verdict.
Give the agent you already use a memory you control. GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents.
Repo: garrytan/gbrain
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
When you report a brain page to the user — created, edited, committed, or relayed from a subagent — a working link is part of the deliverable, in the SAME…
Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking.…
Deduplicate and synthesize raw concept stubs into a tiered intellectual map (T1 Canon to T4 Riff), tracing idea evolution across sources over time. Transforms…
Token-hygiene audit of the always-loaded context stack — CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md,…
When the user corrects a factual error, root-cause it immediately. Don't just note the correction — trace the error to its source, fix the source, and prevent…