db-repair

Diagnoses and repairs gbrain Postgres database access using a tiered, flag-gated command ladder.

29.4k|4.4k|Updated Apr 5, 2026
One-click install
npx skills add https://github.com/garrytan/gbrain --skill db-repair
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: db-repair
Source: https://github.com/garrytan/gbrain/tree/main/plugin/skills/db-repair
Command: npx skills add https://github.com/garrytan/gbrain --skill db-repair

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When gbrain's Postgres database becomes unreachable, every brain query fails and the session stalls. This Skill turns the GBRAIN_DB_ACCESS <reason> error marker into a one-turn recovery by running the hardcoded gbrain db-repair diagnose-fix-verify ladder instead of leaving the operator with a dead session.

Core Features & Use Cases

  • Marker-driven diagnosis: Triggers on GBRAIN_DB_ACCESS markers in MCP error results or stderr, then runs gbrain db-repair --json to read the reason, tier, and plan without mutating anything.
  • Tiered, consent-gated fixes: Applies the auto tier (--yes) for retries, migrations, and extension creation; the rewrite tier (--yes --apply-rewrites) for config database_url changes with receipts and undo; and relays manual-tier recipes (credentials, paused projects) verbatim to the operator.
  • Mandatory verification: Always re-probes with gbrain engine status --probe --json after a fix and never claims recovery without a clean probe.
  • Use Case: An agent session reports "GBRAIN_DB_ACCESS conn_refused" on every recall call. The Skill diagnoses the failure, applies the safe auto-tier fix, verifies the probe returns ok, and reports the result in a few lines.

Quick Start

When you see a GBRAIN_DB_ACCESS marker or the operator says the brain database is down, run the db-repair skill to diagnose, apply the safe fix tier, and verify recovery.

Frequently Asked Questions about db-repair

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix a gbrain database connection error?

Run gbrain db-repair --json to diagnose the failure without mutating anything, then apply the auto tier with gbrain db-repair --yes. Always verify recovery afterward with gbrain engine status --probe --json before reporting the fix.

What does the GBRAIN_DB_ACCESS marker mean?

The GBRAIN_DB_ACCESS marker appears in gbrain MCP error results or stderr when Postgres access fails, carrying a reason code like conn_refused or auth_failed. It is a trigger to diagnose, never proof of failure, since the repair command probes first and exits cleanly if healthy.

Can db-repair change my database credentials automatically?

No, credential changes are manual-tier only. The command prints the exact recipe for auth_failed, permission_denied, or paused Supabase projects, and the operator must apply it; the Skill never automates credential changes.

Is it safe to run gbrain db-repair while syncs are running?

Yes, a config rewrite only affects new processes, so in-flight syncs and backfills keep their existing connection pools. After a successful rewrite, restart long-lived serve or jobs processes so they pick up the new URL.

Why does db-repair refuse to run on my setup?

On thin-client configs there is no local database to repair, so the command refuses and points at the remote brain's operator. It also refuses when the marker names a mounted brain, returning that mount's diagnosis instead.

When should I migrate engines instead of repairing access?

Engine migration is out of scope for db-repair, which never switches engines to fix access since a silent PGLite fallback would split the brain across two stores. Route engine changes to the postgres-adopt skill wrapping gbrain migrate --to.