postgres-adopt
Fungsinya
Skill ini memeriksa apakah GBrain Anda memakai database lokal bawaannya atau Postgres. Skill membantu Anda memindahkan brain lokal yang sudah ada ke Postgres dengan tetap menjaga riwayatnya.
Kapan dipakai
- βSaat Anda ingin tahu mesin database mana yang dipakai brain Anda.
- βKetika Anda ingin memindahkan brain lokal ke Postgres dan menjaga riwayatnya.
- βSaat Anda membutuhkan database Postgres untuk brain yang akan dipakai banyak komputer atau orang.
Link skill
https://github.com/garrytan/gbrain/blob/master/plugin-variants/gbrain-coding/skills/postgres-adopt/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βPeriksa database apa yang dipakai brain saya, dan jika itu yang dasar, rencanakan pemindahan ke Postgres.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent terlebih dahulu membaca pengaturan saat ini tanpa mengubah apa pun. Setelah itu agent menampilkan rencana migrasi dan menunggu persetujuan Anda sebelum menyalin data dan memeriksa setiap tabel.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum
Apakah alamat database saya akan muncul di output?
Tidak. Alamat itu disimpan di variabel lingkungan dan tidak pernah dicetak dalam perintah atau hasil.
Apakah database dibuat tanpa bertanya?
Tidak. Membuat database atau menjalankan container Docker membutuhkan flag eksplisit dari Anda.
Bisakah saya mengganti mesin dengan mengedit file konfigurasi?
Tidak. Perubahan mesin tidak dilakukan dengan mengedit konfigurasi. Pemindahan dilakukan dengan perintah migrasi.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 31k
- Peringkat
- #9264
- Lisensi
- MIT
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
gbrain
31kMemungkinkan agent Anda mencari fakta tentang orang, proyek, dan keputusan di basis pengetahuan bersama perusahaan, serta menyimpan catatan penting.
brain-ingest-gate
31kMemeriksa konten baru terhadap basis pengetahuan yang sudah ada sebelum ditambahkan, untuk menghindari duplikat dan menyelesaikan entitas bernama lebih dulu.
brain-link-discipline
31kMemastikan agent Anda menyertakan tautan yang berfungsi ke setiap halaman basis pengetahuan yang dilaporkannya, dalam pesan yang sama, agar Anda bisa langsung membukanya.
brain-ops
31kMemberi agent Anda rutinitas inti untuk basis pengetahuan: memeriksa konteks yang ada terlebih dahulu, menyimpan catatan eksplisit beserta sumbernya, dan menautkan halaman terkait.
Skill serupa
api-connector-builder
280kMembuat agent Anda membangun koneksi API baru mengikuti pola yang sudah ada. Gunakan saat ingin menambah integrasi lagi tanpa membuat cara baru.
api-design
280kMembantu agent Anda merancang REST API sesuai praktik terbaik. Berguna untuk mengatur cara API berkomunikasi, menampilkan error, dan mengorganisasi data.
backend-patterns
280kMembantu agent Anda dengan pola arsitektur sisi server dan optimasi database. Berguna untuk membangun atau meninjau kode yang berjalan di server.