name: gbrain-sync
description: >-
N-repo selective sync of gbrain structure artifacts (agency org chart, client
pod skeletons) across ThakiCloud repos via the research hub, while gbrain DB
content (entity pages) stays accessible repo-independently through the gbrain CLI.
Use when the user runs /gbrain-sync, asks to "sync gbrain artifacts", "share
agency org chart across repos", "copy client pod structure", "gbrain 구조 동기화",
"에이전시 조직도 다른 리포에 공유". Do NOT use for .claude/ assets (use claude-sync),
.cursor/ assets (use cursor-sync), or gbrain DB↔KB entity sync (use gbrain-bridge).
gbrain-sync
Propagates lightweight gbrain structure artifacts — the agency org chart and
client pod skeletons — across all managed ThakiCloud repos, using research as the
merge hub (same pattern as claude-sync).
Why this skill exists (the data model)
gbrain data lives in two places. They sync differently:
| Layer | Where it lives | Cross-repo access | Handled by |
|---|---|---|---|
| DB entities (127 pages) | Postgres + pgvector | ✅ already repo-independent — gbrain query/get/search works from any directory |
gbrain CLI (no sync needed) |
| Structure files (agency-org 24K, client pod skeleton) | repo-local files | ❌ repo-local until synced | this skill |
Bulk KB (knowledge-bases/* 126M) |
repo-local files | intentionally NOT copied | gbrain query / research hub reference |
The design rule: copy structure, reference bulk, query DB. Never rsync the 126M
knowledge base into 5 repos (= 630M duplication + git bloat). Query it via the CLI.
Sync Scope (whitelist — structure only)
| Path | Synced? | Reason |
|---|---|---|
knowledge-bases/agency-org/ |
✅ full (24K) | org chart, pod template, coordinators, learnings index |
clients/*/README.md |
✅ | pod definition |
clients/*/orchestrator.md |
✅ | pod orchestration spec |
clients/*/approvals.md |
✅ | approval policy structure |
clients/*/workflows/ |
✅ | workflow skeletons |
clients/*/agents/ |
✅ | agent skeletons |
clients/*/brain/ |
❌ EXCLUDE | live entity data (sensitive, per-client) |
clients/*/memory/ |
❌ EXCLUDE | live session data (sensitive, per-client) |
knowledge-bases/ (everything except agency-org) |
❌ EXCLUDE | 126M — access via gbrain CLI, not copy |
output/ |
❌ EXCLUDE | gitignored, one-shot artifacts |
Target Repositories
Hub: research. Source of truth for these artifacts is ai-platform-strategy
(where the agency-org chart and client pods are authored). Sync is bidirectional
through the hub but in practice flows ai-platform-strategy → research → others.
| Alias | Path (relative to {BASE}) |
|---|---|
ai-platform-strategy |
ai-platform-strategy |
realtime-translator |
realtime-translator |
github-to-notion-sync |
github-to-notion-sync |
ai-template |
ai-template |
ai-model-event-stock-analytics |
ai-model-event-stock-analytics |
macro-factor-dashboards is listed in eod-ship managed-repos but is NOT present
locally — skip any target whose dir is absent (do not fail).
{BASE} resolves at runtime: $HOME/work/thakicloud if it exists, else $HOME/thaki.
Workflow
Step 1: Environment Detection
if [ -d "$HOME/work/thakicloud" ]; then BASE="$HOME/work/thakicloud"; else BASE="$HOME/thaki"; fi
EXCLUDES="--exclude brain/ --exclude memory/ --exclude node_modules/ --exclude __pycache__/ --exclude .DS_Store"
TARGETS="ai-platform-strategy realtime-translator github-to-notion-sync ai-template ai-model-event-stock-analytics"
Step 2: Pull Phase (Targets → research, newest-wins)
for T in $TARGETS; do
[ -d "$BASE/$T" ] || continue
# agency-org KB
if [ -d "$BASE/$T/knowledge-bases/agency-org" ]; then
mkdir -p "$BASE/research/knowledge-bases/agency-org"
rsync -au "$BASE/$T/knowledge-bases/agency-org/" "$BASE/research/knowledge-bases/agency-org/"
fi
# client pod structure (brain/ + memory/ excluded)
if [ -d "$BASE/$T/clients" ]; then
mkdir -p "$BASE/research/clients"
rsync -au $EXCLUDES "$BASE/$T/clients/" "$BASE/research/clients/"
fi
done
Step 3: Push Phase (research → Targets, checksum)
for T in $TARGETS; do
[ -d "$BASE/$T" ] || continue
if [ -d "$BASE/research/knowledge-bases/agency-org" ]; then
mkdir -p "$BASE/$T/knowledge-bases/agency-org"
rsync -ac "$BASE/research/knowledge-bases/agency-org/" "$BASE/$T/knowledge-bases/agency-org/"
fi
if [ -d "$BASE/research/clients" ]; then
mkdir -p "$BASE/$T/clients"
rsync -ac $EXCLUDES "$BASE/research/clients/" "$BASE/$T/clients/"
fi
done
Step 4: Verification & Report
echo "=== agency-org ==="
for R in research $TARGETS; do
[ -d "$BASE/$R" ] || continue
C=$(find "$BASE/$R/knowledge-bases/agency-org" -type f 2>/dev/null | wc -l | tr -d ' ')
echo " $R: $C files"
done
echo "=== clients (structure, no brain/memory) ==="
for R in research $TARGETS; do
[ -d "$BASE/$R" ] || continue
C=$(find "$BASE/$R/clients" -type f ! -path '*/brain/*' ! -path '*/memory/*' 2>/dev/null | wc -l | tr -d ' ')
echo " $R: $C files"
done
Report format:
gbrain-sync Complete
- agency-org/: 4 files (N repos aligned)
- clients/ (structure): M files (N repos aligned)
- brain/ + memory/ excluded: ✓ (no live data propagated)
- bulk KB (126M): not copied — access via `gbrain query` ✓
Implementation Rules
- Whitelist only — never
rsyncthe wholeknowledge-bases/tree brain/+memory/ALWAYS excluded (live per-client data — keep repo-local)- Pull uses
-au(newest-wins by mtime); Push uses-ac(checksum, idempotent) - Forbidden flags:
--delete(never remove target-only files),-i/-v(no output on openrsync) - Skip any target dir that does not exist (do not fail the run)
- When invoked by
eod-ship/sod-ship, run without confirmation
Relationship with other sync skills
| Skill | Syncs | Hub |
|---|---|---|
cursor-sync |
.cursor/ + .claude/skills/ |
research |
claude-sync |
.claude/{rules,commands,skills,hooks}/ |
research |
gbrain-sync |
knowledge-bases/agency-org/ + clients/* structure |
research |
gbrain-bridge |
gbrain DB ↔ KB wiki entities (DB-side) | gbrain Postgres |
No overlap: claude-sync owns .claude/, gbrain-sync owns repo content artifacts.
Running both in eod-ship is safe and idempotent.
DB access from other repos (no sync required)
The 127 gbrain entity pages need no copying. From any repo/dir:
gbrain query "what do we know about <entity>" # hybrid search
gbrain search "<keyword>" # keyword
gbrain get <slug> # full page
gbrain doctor --json # connectivity check
This is the canonical way to use gbrain knowledge in another repo. gbrain-sync only handles the file structure that the CLI cannot serve.