postgres-adopt
Ce qu’il fait
Cette skill vérifie si votre GBrain utilise sa base de données locale intégrée ou Postgres. Elle vous aide à migrer une base locale existante vers Postgres tout en conservant son historique.
Quand l’utiliser
- ✓Quand vous voulez savoir quel moteur de base de données utilise votre base.
- ✓Quand vous voulez migrer une base locale vers Postgres en conservant son historique.
- ✓Quand vous avez besoin d'une base Postgres pour une base utilisée par plusieurs ordinateurs ou personnes.
Lien du skill
https://github.com/garrytan/gbrain/blob/master/plugin-variants/gbrain-coding/skills/postgres-adopt/SKILL.mdCopiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.
Comment l’utiliser
Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.
Message prêt à coller
Pour Claude Code, Codex ou Cursor : lancez-la dans le dossier du projet et le skill est installé.
Téléchargez le SKILL.md et placez-le dans le dossier de skills de votre agent.
Exemple de demande à votre IA
“Vérifie quelle base de données utilise ma base de connaissances et, si c'est la version de base, prépare un passage à Postgres.”
5 nouveaux skills par semaine. 1 minute de lecture.
Comment ça marche
L'agent commence par lire la configuration actuelle sans rien modifier. Il présente ensuite un plan de migration et attend votre approbation avant de copier les données et de vérifier chaque table.
Contenu technique (SKILL.md original)
Texte original de l’auteur, en anglais, directement depuis GitHub.
Postgres Adopt
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.
Contract
This skill guarantees:
- Detection is engine-free and read-only:
gbrain engine status --jsonanswers with the database down (that is the point of the command). - Engine changes NEVER happen by editing config. A PGLite brain moves with
gbrain migrate --to postgres(alias--to supabase), which graduates it: plan first (exit 3), run only with the user's--yes --expect <plan_hash>, verify every table, then flip routing. This skill wraps it; it never reimplements it. - The target URL never appears in a command, transcript or output: it lives
in
GBRAIN_TARGET_URLand every command uses--url-env GBRAIN_TARGET_URL. - Provisioning consent is explicit: the docker rung needs
--allow-docker, creating a database on a local server needs--allow-create-db. Headless mutation of infrastructure the operator didn't opt into never happens.
Step 1 — Detect
gbrain engine status --json
Branch on the output:
effective_engine: "postgres"and (optionally)--probesays ok → report healthy, done.effective_engine: "postgres"but the probe fails → this is an ACCESS problem, not an adoption problem: route to db-repair.config_file_enginediffers fromeffective_engine→ an env URL is overriding the config file; tell the operator which one wins — the signal isdb_url_source(env:GBRAIN_DATABASE_URL/env:DATABASE_URLmeans env wins;env.noteadditionally fires when both env URLs are set or the cwd-.env shadow guard excluded one).thin_client: true→ the brain lives on a remote server; engine choices belong to that host. Stop.effective_engine: null(no brain) → Step 2.effective_engine: "pglite"with data → Step 3.- The output has a
graduationblock whosestateis notnone(in progress, interrupted, graduated or split) → Step 4.
Step 2 — Fresh install, Postgres-first
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.
- Ask the operator BEFORE adding
--allow-docker(it creates and owns agbrain-postgrescontainer that survives reboots) or--allow-create-db(it runs CREATE DATABASE on their local server). --jsonreports{engine, ladder_rung, url_source}— relay which rung won.- If the ladder lands on PGLite, that is a fine outcome: say so, and note the upgrade path below is available whenever they want it.
Step 3 — Existing PGLite brain: plan, ask, run
Full reference: Move a PGLite brain to Postgres.
- Target URL. Ask the user to put the connection string in an
environment variable without pasting it into the conversation
(
read -rs GBRAIN_TARGET_URL && export GBRAIN_TARGET_URL). On Supabase use the transaction pooler; on an IPv4-only host also setGBRAIN_DIRECT_DATABASE_URLto the session pooler. - Plan. This changes nothing and exits 3 with the
confirmation_requireddocument:
Relaygbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --jsonuser_message, what moves, what stays on this computer, blockers and the estimate. Stop and wait for the user. A blocker with its ownfixgets cleared first (ask when it saysask_user). - Run, after the user agrees. Use
fix.commandfrom the document:gbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --yes --expect <plan_hash>preview_changedmeans the plan changed: go back to step 2. For thousands of pages run it in the background and pollgbrain migrate --status --json. - Report. Relay the target doctor verdict from the run's output, that
existing tokens, OAuth clients and local writers stay valid, the
gbrain mcp exposefoll
Questions fréquentes
L'adresse de ma base apparaîtra-t-elle dans les résultats ?
Non. L'adresse est conservée dans une variable d'environnement et n'est jamais affichée dans les commandes ni dans les résultats.
Crée-t-il des bases sans demander ?
Non. La création d'une base ou le lancement d'un conteneur Docker nécessitent des indicateurs explicites de votre part.
Puis-je changer de moteur en modifiant un fichier de configuration ?
Non. Les changements de moteur ne se font pas en modifiant la configuration. La migration s'effectue avec la commande de migration.
Détails
Description originale de l’auteur
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 to Postgres with its history (plan, ask, run). Detection is one engine-free command; the install ladder is one flag.
repo: garrytan/gbrain
Popularité
- Étoiles GitHub
- 31k
- Position au classement
- #9264
- Licence
- MIT
- Mis à jour
- 02/11/2026
Commentaires
- …
Autres skills de ce dépôt
gbrain
31kPermet à votre agent de chercher dans un cerveau de connaissances partagé de l'entreprise des faits sur les personnes, les projets et les décisions, et d'y enregistrer des notes durables.
brain-ingest-gate
31kVérifie le nouveau contenu par rapport à un cerveau de connaissances existant avant de l'ajouter, pour éviter les doublons et résoudre d'abord les entités nommées.
brain-link-discipline
31kVeille à ce que votre agent inclue dans le même message un lien fonctionnel vers chaque page du cerveau qu'il mentionne, pour que vous puissiez l'ouvrir tout de suite.
brain-ops
31kDonne à votre agent la routine de base d'un cerveau de connaissances : consulter d'abord le contexte existant, enregistrer les notes explicites avec leur source et relier les pages liées.
Skills similaires
api-connector-builder
280kPermet à votre agent de créer de nouvelles connexions API en suivant le modèle existant. À utiliser pour ajouter une intégration sans inventer une nouvelle façon de faire.
api-design
280kAide votre agent à concevoir des API REST selon les bonnes pratiques. Utile pour définir la communication entre API, l'affichage des erreurs et l'organisation des données.
backend-patterns
280kAide votre agent avec les architectures côté serveur et l'optimisation des bases de données. Utile pour créer ou relire du code qui s'exécute sur le serveur.