본문으로 건너뛰기
cccskills
무료GitHub에 공개

postgres-adopt

Check whether gbrain uses PGLite or Postgres, set up a Postgres-backed installation, or migrate existing PGLite data with its history. The workflow presents a migration plan for approval, verifies transferred tables, and supports interrupted migration recovery.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

설치 방법 보기

이럴 때 유용합니다

  • Checking which database engine gbrain uses
  • Setting up Postgres for a new gbrain installation
  • Moving PGLite data and history to Postgres
  • Checking and recovering an interrupted migration

포함된 파일(2)

  • SKILL.md8.3 KB
  • routing-eval.jsonl870 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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 --json answers 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_URL and 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) --probe says 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_engine differs from effective_engine → an env URL is 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).
  • 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 graduation block whose state is not none (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 a gbrain-postgres container that survives reboots) or --allow-create-db (it runs CREATE DATABASE on their local server).
  • --json reports {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.

  1. 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 set GBRAIN_DIRECT_DATABASE_URL to the session pooler.
  2. Plan. This changes nothing and exits 3 with the confirmation_required document:
    gbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --json
    
    Relay user_message, what moves, what stays on this computer, blockers and the estimate. Stop and wait for the user. A blocker with its own fix gets cleared first (ask when it says ask_user).
  3. Run, after the user agrees. Use fix.command from the document:
    gbrain migrate --to postgres --url-env GBRAIN_TARGET_URL --yes --expect <plan_hash>
    
    preview_changed means the plan changed: go back to step 2. For thousands of pages run it in the background and poll gbrain migrate --status --json.
  4. Report. Relay the target doctor verdict from the run's output, that existing tokens, OAuth clients and local writers stay valid, the gbrain mcp expose follow-up for other machines, and, if a serve handed the brain over, that the user restarts the MCP client.
  • A gbrain serve holding the brain hands it over on its own; never ask the user to stop it first. graduation_source_writer_held names the process to stop when one does not.
  • The old data dir is kept as <path>.graduated-<run_id> (doctor's pglite_leftovers reports it). Deleting it is the user's call.
  • gbrain doctor's pglite_scale check warns at 1000+ pages and points at the plan command — that warning is this skill's cue.

Step 4 — A move already underway

gbrain migrate --status --json

It is read-only and names the next command for the state. Exit 75 or a run in progress → wait and poll. Interrupted → gbrain migrate --resume (or gbrain migrate --rollback-to-source if the user wants to stay on PGLite). Every refusal names its fix; the recovery table is in the guide. A rollback that lists data loss runs only with the user's --rollback-to-source --yes --expect <hash>.

The tradeoff (say it when recommending)

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.

When it fails

Follow the agent operator protocol for any gbrain error code, exit code, [AGENT] block or notice block. Specific to this skill:

  • effective_engine: "postgres" but the probe fails: this is an access problem; run gbrain engine status --probe, then the db-repair skill.
  • Provisioning steps (Docker, installing Postgres) and the move itself need the user's explicit agreement; the docker rung needs --allow-docker, the move needs --yes --expect <plan_hash> after the user saw the plan.
  • gbrain config set engine … is refused by design: switch engines through the migrate path, never by editing config.

Anti-Patterns

  • NEVER gbrain config set engine ... — it is refused by design; an engine flip without a data migration splits the brain across two stores.
  • NEVER pick Postgres over a healthy PGLite brain without the migrate path.
  • NEVER add --yes before the user has seen the plan, and never use --force unless the plan listed what it wipes and the user agreed.
  • NEVER put the database URL or password in a command line; use --url-env GBRAIN_TARGET_URL.
  • NEVER run the docker rung without the operator's explicit yes.
  • NEVER paste or echo SUPABASE_ACCESS_TOKEN / passwords into output.

Output Format

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 postgres 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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Check research claims cited in books, articles, or conversations by tracing the original paper, methods, underlying data, and independent replication. Save a sourced assessment explaining whether the claim holds up and what remains uncertain.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Check a study cited in a book
  • Trace a numerical claim in an article to its source data
  • Verify research evidence before using it in writing
garrytan/gbrain3.1만2026년 10월 19일 업데이트

Explore old files and email archives to rediscover personal writing, ideas, and meaningful conversations. Review selected items one at a time, save worthwhile material as organized notes, and track progress within explicitly permitted folders.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Rediscover old journals and creative writing
  • Find meaningful letters and email conversations
  • Recover past product and business ideas
garrytan/gbrain3.1만2026년 10월 19일 업데이트

Restructure raw article text stored in gbrain into summaries, exact quotes, key insights, and links to related pages. Preserve the original text and connect the article's significance to projects and interests already recorded in gbrain.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Organizing saved articles into readable notes
  • Collecting exact quotes for essays
  • Connecting articles to current projects
garrytan/gbrain3.1만2026년 10월 19일 업데이트

ask-user

무료

Present clear choices when a task needs a human decision, then pause execution until the user replies. This reusable interaction pattern supports filing decisions, priority selection, and confirmation before destructive actions, with an option to decline.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Clarifying requests with several possible meanings
  • Confirming before bulk deletion or overwriting
  • Choosing where to file meeting notes
garrytan/gbrain3.1만2026년 10월 19일 업데이트

Collect public posts across a blog, newsletter, or feed archive and save clean Markdown pages for each article. The workflow avoids duplicates, supports resumed runs, repairs empty results, and hands articles to a separate enrichment skill.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Importing a blog's public article archive
  • Organizing public newsletter posts as knowledge pages
  • Rerunning a feed import without duplicates
garrytan/gbrain3.1만2026년 10월 19일 업데이트

Create a detailed chapter-by-chapter reading companion from an EPUB or PDF, connecting the book’s ideas to experiences and words saved in your personal knowledge store. The result highlights parallels without prescribing actions.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Connect a book’s ideas to personal experiences
  • Review detailed chapter summaries alongside personal reflections
  • Create a parent’s guide for reading a children’s book aloud
garrytan/gbrain3.1만2026년 10월 19일 업데이트

garrytan의 스킬 모두 보기

이 스킬의 문제 신고