How geek-sogang/career-piggybank works
목적과 실행 진입점
커리어 저금통은 긱워커의 거래·정산 이력에서 소득 구조와 금융 행동을 파악하고, 입금별 예산 배분·세금 준비·예측·상품 연결을 지원하는 AI 생활금융 플랫폼이다. 백엔드는 FastAPI 앱인 apps/api/app/main.py로 실행되며, 모바일/웹 데모는 Expo Router의 apps/mobile/app/_layout.tsx와 apps/mobile/app/index.tsx에서 시작한다.
API 계층과 계약 경계
HTTP API는 라우트 계층이 담당하며, 은행 연결·배분·분류·코치·프로필·예측·상품 기능을 별도 엔드포인트로 노출한다. 입력/출력 계약은 Pydantic 스키마로 분리되어 있다.
• apps/api/app/api/routes/bank.py
• apps/api/app/api/routes/allocations.py
• apps/api/app/schemas/allocation.py
API는 오케스트레이션과 엔진을 호출할 뿐, 금융 계산 및 AI 판단의 직접 구현 위치가 아니다.
사실·프로필 기반 금융 의사결정
원장/행동 데이터에서 FactSheet를 만들고 단일 사용자 프로필에 합성한 뒤, 소득 스트림·지출 성향·개인화를 계산한다. 이 프로필은 AI와 결정론 엔진이 공유하는 SSOT 경계다.
• apps/api/app/engines/facts.py
• apps/api/app/profile/user_profile.py
• apps/api/app/profile/personalization_v2.py
소득은 플랫폼 정산, 반복 발주처, 착수금·잔금 등의 스트림으로 분해하고 예측은 단일 날짜 대신 확률 구간을 다룬다.
• apps/api/app/engines/income_streams.py
• apps/api/app/engines/forecast.py
결정론 금융 엔진과 안전 순서
금액 계산은 AI가 아니라 엔진이 수행한다. 입금 배분은 세금→경비→생활비→안전자금→목표자금의 정책 순서를 적용하며, 세금 봉투·배분 제안·페이싱 및 상품 적합성 veto를 결정론적으로 처리한다.
• apps/api/app/engines/allocation_policy.py
• apps/api/app/engines/allocator.py
• apps/api/app/engines/tax_envelope.py
상품 추천은 적합하지 않은 후보를 먼저 제외한 후에만 AI 판단으로 넘긴다.
• apps/api/app/engines/product_match.py
로컬 LLM 에이전트와 오케스트레이션
Ollama 기반 EXAONE 모델을 외부 API 없이 사용한다. 모델 설정과 호출 경계는 core에 있고, 에이전트는 의도 라우팅·분류·명확화·봉투 추천·페이싱·코치 등 판단 역할을 분리한다.
• apps/api/app/core/config.py
• apps/api/app/core/llm.py
• apps/api/app/agents/registry.py
라이브 코치와 은행 흐름은 여러 에이전트/엔진을 조합하고, 애매하거나 위험한 판단은 질문·폴백·사용자 확인으로 전환한다.
• apps/api/app/orchestration/coach_live.py
• apps/api/app/orchestration/bank_flow.py
승인·영속성·클라이언트 흐름
실제 잔액 이동이나 금융 실행은 제안 단계에서 발생하지 않으며 사용자 승인 뒤에만 반영된다. SQLite 저장소는 거래, 봉투 잔액, 배분 제안, 결정, 프로필 스냅샷 및 이벤트 로그의 영속 경계다.
• apps/api/app/store/db.py
• apps/api/app/store/seed.py
React Native 클라이언트는 API 어댑터를 통해 백엔드에 연결하고, 홈·커리어 동기화·봉투 제안·세금·상품·채팅 화면으로 결과를 표현한다.
• apps/mobile/src/lib/api.ts
• apps/mobile/src/screens/Home.tsx
• apps/mobile/src/screens/EnvelopeSuggest.tsx
Main entry points: user_profile.py User profile SSOT · bank.py Bank & allocation routes · allocator.py Deposit allocator · db.py SQLite store
Components 21
Mobile demo
- Expo Router entry
apps/mobile/app/_layout.tsx - Finance screens · Home and envelope suggestion views present outcomes.
apps/mobile/src/screens/Home.tsx - API adapter
apps/mobile/src/lib/api.ts
FastAPI backend
- FastAPI app
apps/api/app/main.py - Bank & allocation routes · Exposes banking and allocation endpoints.
apps/api/app/api/routes/bank.py - Allocation contracts
apps/api/app/schemas/allocation.py - Bank flow · Combines agents and engines for bank workflows.
apps/api/app/orchestration/bank_flow.py - Live coach · Falls back to questions or confirmation for uncertain decisions.
apps/api/app/orchestration/coach_live.py
Financial decisioning
- FactSheet builder · Derives facts from ledger and behavior data.
apps/api/app/engines/facts.py - User profile SSOT · Shared profile boundary for AI and deterministic engines.
apps/api/app/profile/user_profile.py - Personalization
apps/api/app/profile/personalization_v2.py - Income streams · Separates platform, recurring-client, and milestone income.
apps/api/app/engines/income_streams.py - Probabilistic forecast · Models income timing as probability ranges.
apps/api/app/engines/forecast.py - Allocation policy · Applies tax, expenses, living, safety, then goals order.
apps/api/app/engines/allocation_policy.py - Deposit allocator
apps/api/app/engines/allocator.py - Tax envelope
apps/api/app/engines/tax_envelope.py - Product suitability veto · Rejects unsuitable products before AI evaluation.
apps/api/app/engines/product_match.py
Local AI
- Agent registry · Separates intent, classification, clarification, pacing, and coach roles.
apps/api/app/agents/registry.py - Ollama EXAONE · Uses a local model without an external API.
apps/api/app/core/llm.py
Approval & storage
- SQLite store · Persists transactions, envelopes, proposals, decisions, profiles, and events.
apps/api/app/store/db.py - User approval · Only approved proposals can change balances or execute actions.
Connections 23
- Expo Router entry → Finance screens: renders
- Finance screens → API adapter: requests
- API adapter → FastAPI app: HTTP
- FastAPI app → Bank & allocation routes: mounts
- Bank & allocation routes → Allocation contracts: validates
- Bank & allocation routes → Bank flow: orchestrates
- Bank & allocation routes → Live coach: starts coaching
- Bank flow → FactSheet builder: builds
- FactSheet builder → User profile SSOT: composes
- User profile SSOT → Personalization: drives
- User profile SSOT → Income streams: analyzes
- Income streams → Probabilistic forecast: forecasts
- User profile SSOT → Deposit allocator: input
- Allocation policy → Deposit allocator: policy order
- Tax envelope → Deposit allocator: tax reserve
- Deposit allocator → User approval: proposes allocation
- Product suitability veto → Agent registry: eligible candidates only
- Live coach → Agent registry: delegates judgment
- Agent registry → Ollama EXAONE: invokes
- Bank flow → SQLite store: reads and records
- User profile SSOT → SQLite store: profile snapshots
- User approval → SQLite store: persists approved decision
- SQLite store → FactSheet builder: ledger and behavior