-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Single Source of Truth for all Sage.ai project documentation
This repository contains all authoritative documentation, specifications, and architecture guidelines for the Sage.ai platform - an AI-powered investment mentor that helps users make smarter financial decisions.
Sage.ai is organized across 4 independent repositories:
- Purpose: Documentation and specifications
- Repository: https://github.com/5010-dev/sage-docs
- Role: Single Source of Truth for all specs and architecture docs
- Purpose: React web application
- Repository: https://github.com/5010-dev/sage-front
- Tech Stack: React 18.3, Vite 5, TypeScript, Zustand, TanStack Query
-
Deployment: AWS Amplify (automatic on push to
main)
- Purpose: Nest.js API server
- Repository: https://github.com/5010-dev/sage-back (to be created)
- Tech Stack: Nest.js 10.x, Prisma 5.x, PostgreSQL 18, Valkey 8.x
- Deployment: AWS ECS Fargate via GitHub Actions
- Purpose: Infrastructure as Code (Pulumi)
- Repository: https://github.com/5010-dev/sage-infra (to be created)
- Tech Stack: Pulumi 3.x (TypeScript)
- Resources: ECS, RDS, ElastiCache, ALB, Amplify
sage-docs/
βββ specs/ # Technical specifications (AUTHORITATIVE)
β βββ backend-spec.md # Backend API, Agent Pipeline, SSE streaming
β βββ frontend-spec.md # React components, SSE client, state management
β βββ infrastructure-spec.md # Pulumi, ECS, RDS, ElastiCache, Amplify
β
βββ architecture/ # System architecture
β βββ system-overview.md # Multi-repo structure, data flow, tech stack
β
βββ business/ # Business context (informational, not prescriptive)
β βββ mvp-definition.md # MVP scope, timeline, success criteria
β βββ business-plan.md # Market analysis, revenue model
β βββ development-roadmap.md # Phase 1-4 feature timeline
β βββ executive-brief.md # Executive summary
β βββ ai-team-strategy.md # AI team composition
β βββ branding-guide.md # Brand identity
β βββ sage-overview-kr.md # Overview (Korean)
β
βββ product/ # Product requirements
β βββ product-spec.md # Features, user journeys, Agent Pipeline
β
βββ operations/ # GTM and operations
β βββ operations-roadmap.md # Operations timeline
β βββ genesis-operations.md # Launch operations
β βββ live-ops-playbook.md # Live operations guide
β βββ mystery-campaign.md # Mystery campaign strategy
β βββ discord-management.md # Discord community management
β
βββ docs/ # Legacy documentation (to be migrated)
β βββ technical/ # Old specs (use specs/ instead)
β βββ ai-guides/ # Claude Code development guides
β
βββ wiki/ # GitHub Wiki sync (auto-generated, do not edit)
β
βββ CLAUDE.md # AI development constitution
βββ README.md # This file
βββ README-kr.md # Korean version
-
Read the specs first:
- Backend:
specs/backend-spec.md - Frontend:
specs/frontend-spec.md - Infrastructure:
specs/infrastructure-spec.md
- Backend:
-
Understand the architecture:
-
Check MVP scope:
- Read
CLAUDE.mdfirst - it's the constitution for AI development - Always reference
specs/when implementing features - Follow terminology guidelines (Agent Pipeline, not "multi-agent system")
- Preserve performance targets: <2s first token, <0.5s context load
- Framework: React 18.3 + Vite 5
- State: Zustand 4.x (client), TanStack Query 5.x (server)
- Styling: Tailwind CSS 3.x + shadcn/ui
- Real-time: SSE (Server-Sent Events) for AI streaming
- Framework: Nest.js 10.x
- Database: PostgreSQL 18 (via Prisma 5.x)
- Cache: Valkey 8.x (Redis-compatible)
- AI: Claude Sonnet 4 + Haiku 4 (@anthropic-ai/sdk)
- Auth: Auth.js with Google OAuth
- IaC: Pulumi 3.x (TypeScript)
- Compute: AWS ECS Fargate
- Database: AWS RDS PostgreSQL 18
- Cache: AWS ElastiCache Valkey 8.x
- CDN: AWS Amplify (frontend), CloudFront
- LB: AWS ALB
- Agent Pipeline: Manager β Analyst β Persona β Risk
- Streaming: SSE for token-by-token response (<2s first token)
- Context: 20-message window (no RAG in MVP)
- Virtual Trading: No real money, practice-only
- AI Signals: Extracted from chat conversations
- Performance: Historical performance tracking
- Market Alerts: BTC -5%, ETH -7% triggers notification
- Deep Links: Push notification β Auto-open chat with context
- Multi-channel: PWA push + Discord webhook
Code repositories contain local copies of relevant specs:
# Frontend repo
sage-front/docs/frontend-spec.md # Copied from specs/frontend-spec.md
# Backend repo
sage-back/docs/backend-spec.md # Copied from specs/backend-spec.md
# Infrastructure repo
sage-infra/docs/infrastructure-spec.md # Copied from specs/infrastructure-spec.mdWhen updating specs:
- Edit in
sage-docs/specs/(Source of Truth) - Copy to relevant code repository
- Commit with message:
Sync [spec] from sage-docs@[commit-hash]
Example:
# Update frontend spec in sage-docs
cd sage-docs
git commit specs/frontend-spec.md -m "Update SSE reconnection logic"
git push
# Sync to frontend repo
cd ../sage-front
cp ../sage-docs/specs/frontend-spec.md docs/
git commit docs/frontend-spec.md -m "Sync frontend-spec from sage-docs@abc123"
git pushThese are hard requirements, not suggestions:
| Metric | Target | Measurement |
|---|---|---|
| SSE First Token | < 2s | Time from POST to first SSE token |
| Context Load | < 0.5s | Fetch 20 messages from PostgreSQL |
| API Response | < 200ms (P95) | REST endpoint latency |
| Cache Hit Rate | > 80% | Valkey hit/miss ratio |
| Hallucination Rate | < 1% | Risk Agent rejection rate |
Use these terms correctly in all documentation and code:
| Correct Term | Definition | Wrong Usage |
|---|---|---|
| Agent Pipeline | Manager β Analyst β Persona β Risk sequence | β "multi-agent system" |
| Agent | Functional unit within ONE persona (Manager, Analyst, etc.) | β Agent = Persona |
| Persona | Character + LLM combination (Warren Buffett + Claude) | β "agent" when referring to persona |
| SSE Streaming | Server-Sent Events for AI response | β "WebSocket" (not used in MVP) |
| Shadow Portfolio | Virtual/practice portfolio | β "paper trading", "simulated" |
- β Tech stack finalized
- β Specs written (backend, frontend, infrastructure)
- β Repository split planned
- π Amplify migration planned
- π SSE vs WebSocket decision: Keep SSE
- Create sage-infra repository
- Define Pulumi resources (ECS, RDS, ElastiCache)
- Set up AWS Amplify app via Pulumi
- Create sage-back repository
- Implement Agent Pipeline
- Set up SSE streaming endpoints
- Connect to Claude API
- Create sage-front repository
- Implement SSE client
- Build chat interface
- Deploy to Amplify
-
Specs (
specs/): Create PR with clear description -
Architecture (
architecture/): Discuss with team first -
Business/Product (
business/,product/): Requires product owner approval -
Operations (
operations/): Requires operations lead approval
Go to the relevant code repository:
- Frontend changes β sage-front
- Backend changes β sage-back
- Infrastructure changes β sage-infra
- Independent deployment cycles: Frontend, backend, infra deploy at different rates
- Team autonomy: Each team can work independently
- Clearer boundaries: Docs vs code separation
- Simplified CI/CD: Each repo has focused pipelines
- Complexity: Submodules add overhead (init, update, nested commits)
- Independence: Each repo should work standalone
- Simplicity: Copy + README link is simpler for our team size
- Automatic deployment: Git push β auto build (no GitHub Actions needed)
- PR previews: Auto preview URL for every PR
- Simplicity: Less manual configuration
- MVP speed: Faster time to market
Possibly in Phase 2+ if we add:
- Real-time collaborative features (group chat, shared portfolio)
- Live market data streaming to UI (ticker)
- User interrupt during AI response
For MVP, SSE is sufficient and simpler.
- GitHub Issues: sage-docs/issues
- Discord: (to be added)
- Email: (to be added)
(To be determined)
Last Updated: 2026-01-05 Migration Status: Converted from monorepo to multi-repository structure
π Home
- π sage-docs (Documentation)
- π¨ sage-frontend (React App)
- βοΈ sage-backend (Nest.js API)
- ποΈ sage-infra (Pulumi IaC)