postgres-adopt
하는 일
이 스킬은 GBrain이 내장 로컬 데이터베이스를 쓰는지 Postgres를 쓰는지 확인합니다. 기존 로컬 브레인을 이력을 유지하면서 Postgres로 옮기는 것을 돕습니다.
사용하는 경우
- ✓브레인이 어떤 데이터베이스 엔진을 쓰는지 알고 싶을 때.
- ✓로컬 브레인을 이력을 유지한 채 Postgres로 옮기고 싶을 때.
- ✓여러 컴퓨터나 사람이 쓸 브레인에 Postgres 데이터베이스가 필요할 때.
스킬 링크
https://github.com/garrytan/gbrain/blob/master/plugin-variants/gbrain-coding/skills/postgres-adopt/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 브레인이 어떤 데이터베이스를 쓰는지 확인하고, 기본 방식이라면 Postgres로 옮기는 계획을 세워 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 아무것도 바꾸지 않고 먼저 현재 설정을 읽습니다. 그다음 마이그레이션 계획을 보여 주고, 데이터를 복사하고 모든 테이블을 확인하기 전에 승인을 기다립니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 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
자주 묻는 질문
출력에 데이터베이스 주소가 보이나요?
아닙니다. 주소는 환경 변수에 보관되며 명령이나 결과에 출력되지 않습니다.
묻지 않고 데이터베이스를 만드나요?
아닙니다. 데이터베이스를 만들거나 Docker 컨테이너를 시작하려면 명시적인 플래그가 필요합니다.
설정 파일을 편집해서 엔진을 바꿀 수 있나요?
아닙니다. 엔진 변경은 설정 편집으로 하지 않으며, 마이그레이션 명령으로 합니다.
상세 정보
작성자의 원본 설명
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
인기도
- GitHub 스타
- 31k
- 순위
- #9264
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
gbrain
31k에이전트가 공유 회사 지식 브레인에서 사람, 프로젝트, 결정에 관한 사실을 검색하고, 지속적인 메모를 저장하도록 돕습니다.
brain-ingest-gate
31k새 콘텐츠를 지식 브레인에 추가하기 전에 기존 내용과 비교해 중복을 막고, 고유 명칭을 먼저 확인합니다.
brain-link-discipline
31k에이전트가 브레인 페이지를 보고할 때 같은 메시지에 각 페이지의 작동하는 링크를 포함해, 바로 열어 볼 수 있게 합니다.
brain-ops
31k지식 브레인의 기본 루틴을 제공합니다. 먼저 기존 맥락을 확인하고, 메모는 출처와 함께 저장하며, 관련 페이지를 연결합니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.