--- id: wiki-2026-0508-connect-ai-architecture title: Connect AI Architecture category: 10_Wiki/Topics status: needs_review canonical_id: self aliases: ["{{UUID}}"] duplicate_of: none source_trust_level: A confidence_score: 1.0 tags: [ai, architecture, git-sync, automation, connect-ai] raw_sources: [] last_reinforced: 2026-04-29 github_commit: pending inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08) tech_stack: language: unspecified framework: unspecified --- # Connect AI: Brain-GitHub 동기화 아키텍처 ## 📌 한 줄 통찰 (The Karpathy Summary) > "지식의 파편은 기록하는 순간 흐르기 시작해야 하며, 로컬의 정교함과 클라우드의 영속성이 만나는 지점에 진정한 '제2의 뇌'가 존재한다." — 로컬 AI 워크스페이스와 GitHub 저장소를 실시간으로 동기화하여 지식의 유실을 방지하고 연속성을 확보하는 P-Reinforce의 핵심 아키텍처 레퍼런스. ## 📖 구조화된 지식 (Synthesized Content) - **핵심 메커니즘: _safeGitAutoSync** - **트리거**: Brain Pack 주입 완료 또는 P-Reinforce 구조화 완료 시 자동 호출. - **동작 방식**: 로컬의 변경사항을 감지하여 `git add` -> `commit` -> `pull (ours strategy)` -> `push` 과정을 일괄 처리. - **특이사항**: 충돌 발생 시 로컬 지식을 우선시(`-X ours`)하여 마스터의 최신 의도를 보호함. - **설정 및 구성 (Configuration)** - `localBrainPath`: 로컬 지식 폴더의 절대 경로 (기본값: `~/.connect-ai-brain`). - `secondBrainRepo`: 클라우드 백업을 위한 GitHub 저장소 URL. - **데이터 흐름 (Pipeline)** 1. **Ingest**: 웹/API를 통해 `00_Raw/` 폴더에 데이터 유입. 2. **Process**: UI 피드백(매트릭스 애니메이션)과 함께 지식 저장. 3. **Sync**: 백그라운드에서 GitHub 원격 저장소와 즉각적인 동기화 수행. ## ⚠️ 모순 및 업데이트 (Contradictions & Updates) - **플랫폼 제약**: 기존 레퍼런스는 Mac 경로(`/Users/jay/...`)를 기준으로 작성되었으나, Antigravity 프로젝트는 이를 Windows 환경(`E:/Wiki/...`)에 맞게 동적으로 처리하도록 수정함. - **보안 정책**: Zero Cloud API 원칙에 따라 모든 연산은 로컬에서 수행되지만, GitHub 동기화 시 개인 인증(Credential) 관리가 보안의 핵심 변수로 작용함. ## 🔗 지식 연결 (Graph) - **Raw Source:** E:/Wiki/Wonseok_AI_original/ARCHITECTURE.md ## 🤖 LLM 활용 **언제**: 매 ConnectAI brain-GitHub sync 의 reference. 매 P-Reinforce 의 architecture review. **언제 X**: 매 다른 project (project-specific). ## 💻 패턴 ### Git auto-sync (safeGitAutoSync) ```bash #!/bin/bash # 매 P-Reinforce / Brain Pack 후 자동 호출 cd "$LOCAL_BRAIN_PATH" git add -A git commit -m "auto: brain pack injection $(date +%Y-%m-%dT%H:%M)" --allow-empty git pull --rebase -X ours origin main || git pull -X ours origin main git push origin main ``` ### Conflict resolution policy ``` - Local 의 priority (ours strategy). - 매 master 의 latest intent 의 protect. - 매 manual review 의 ambiguous. ``` ### Pipeline (3-stage) ``` 1. Ingest: 매 web / API → 00_Raw/. 2. Process: 매 UI feedback + 매 P-Reinforce skill. 3. Sync: 매 background GitHub push. ``` ## 🤔 결정 기준 | 상황 | Policy | |---|---| | Local edit | Push to remote with ours | | Conflict | Local wins (P-Reinforce intent) | | Backup interval | Real-time on event | | Recovery | Git history + clone | ## ❌ 안티패턴 - **No conflict policy**: 매 silent overwrite. - **No event trigger** (manual only): 매 sync drift. - **No dry-run**: 매 destructive. ## 🕓 변경 이력 | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — TODO 의 fill — sync mechanism + pipeline + 매 git code |