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…
Health smoke tests + auto-fix for gbrain installs (and OpenClaw services when present). Run after machine/container restarts or whenever something seems broken. Tests critical services, auto-fixes bounded local issues, and reports worker topology without starting daemons.
$ npx -y skills add garrytan/gbrain --skill smoke-test --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/smoke-testContext preview
The summary Claude sees to decide when to auto-load this skill.
Health smoke tests + auto-fix for gbrain installs (and OpenClaw services when present). Run after machine/container restarts or whenever something seems broken. Tests critical services, auto-fixes bounded local issues, and reports worker topology without starting daemons.
name: smoke-test description: | Health smoke tests + auto-fix for gbrain installs (and OpenClaw services when present). Run after machine/container restarts or whenever something seems broken. Tests critical services, auto-fixes bounded local issues, and reports worker topology without starting daemons. Extensible via user-defined test scripts in ~/.gbrain/smoke-tests.d/*.sh. triggers: - "smoke test" - "run smoke tests" - "container restart check" - "health check" - "did the restart break anything" - "did the container restart break anything" tools: - exec - read mutating: true
> Run `gbrain smoke-test` after any machine or container restart, or whenever > something seems broken.
This skill guarantees:
present; skipped otherwise)
explicit because process topology and shell-job policy are operator choices
| # | Test | Auto-Fix | |---|------|----------| | 1 | Bun runtime | Install from bun.sh | | 2 | GBrain CLI loads | Reinstall deps | | 3 | GBrain database (engine identity via `gbrain engine status --json`, then `doctor --json`'s `connection` check) | `gbrain db-repair --yes`, re-test | | 4 | GBrain worker process | — (native supervisor status + duplicate detection) | | 5 | OpenClaw Codex plugin (Zod CJS); skips if OpenClaw absent | `npm install zod@4 --force` | | 6 | OpenClaw gateway; skips if OpenClaw absent | — (may not be started yet) | | 7 | Embedding API key | — (check .env) | | 8 | Brain repo exists | — |
gbrain smoke-test
This is the invocation for all installs; it resolves the test script from the installed package.
gbrain smoke-test >> /tmp/bootstrap.log 2>&1
Add to your `ensure-services.sh` or equivalent:
bash /path/to/gbrain/scripts/smoke-test.sh >> /tmp/bootstrap.log 2>&1
exec: gbrain smoke-test
Contributor note: inside a gbrain repo checkout you can also run the script directly with `bash scripts/smoke-test.sh`.
Create executable scripts in `~/.gbrain/smoke-tests.d/`:
# ~/.gbrain/smoke-tests.d/check-redis.sh #!/bin/bash redis-cli ping | grep -q PONG
Rules:
This section is for contributors working in the gbrain source repo. Plugin installs ship the script read-only and upgrades overwrite it; if you just want extra checks, use the `~/.gbrain/smoke-tests.d/` drop-in scripts above.
Edit `scripts/smoke-test.sh`. Follow this pattern:
# ── N. [Service Name] ──────────────────────────────────────
if [test condition]; then
pass "[Service Name]"
else
# Auto-fix attempt
[fix command]
if [re-test condition]; then
fixed "[What was fixed]"
pass "[Service Name] (after fix)"
else
fail "[Service Name] — [error detail]"
fi
fi1. **Test first** — never fix without confirming broken 2. **Re-test after fix** — verify the fix worked 3. **Timeout everything** — `timeout N` on any command that could hang 4. **Use helpers** — `pass()`, `fail()`, `fixed()`, `skip()` 5. **Idempotent fixes** — safe to run repeatedly 6. **Skip gracefully** — `skip()` when a prerequisite is missing, don't fail
| Var | Default | Description | |-----|---------|-------------| | `GBRAIN_SMOKE_LOG` | `/tmp/gbrain-smoke-test.log` | Log file path | | `GBRAIN_DIR_OVERRIDE` | (auto-detect) | Force gbrain install path | | `GBRAIN_BUN_PATH` | (auto-detect) | Force Bun binary path | | `GBRAIN_DATABASE_URL` | (from .env) | Database connection URL | | `GBRAIN_SMOKE_WORKER_PID_FILE` | `/tmp/gbrain-worker.pid` | Legacy bare-worker PID path | | `OPENCLAW_GATEWAY_PORT` | `18789` | Gateway port to test | | `GBRAIN_BRAIN_PATH` | (deployment-specific) | Brain repo path. Container deployments default to `/data/brain`; set it to your brain repo path otherwise. Test 8 skips (not fails) when unset. |
(OpenClaw gateway deployments only: this concerns OpenClaw's Codex ACP plugin, not the OpenAI Codex CLI.)
on user request) is plenty. The script is cheap but it's not free.
could hang. A single hung drop-in stalls every subsequent run.
The `pass → fail-detected → fix → re-test` loop is the contract; fixes that skip the re-test can report success on a still-broken state.
no brain repo configured) are skips, not failures. Exi
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…