Context is Everything logo

0. Build Order

Recommended build sequence for rebuilding Sasha Studio from scratch, based on dependency analysis of the current codebase.

Phase Overview

Phase Name Depends On Parallel? Estimated Effort
1 Foundation & Database -- No 1 week
2 Authentication & Users Phase 1 No 3 days
3 Project & File System Phase 1 Yes (with 2) 1 week
4 Claude CLI Integration Phase 2, 3 No 1 week
5 Chat Interface & Streaming Phase 4 No 2 weeks
6 Knowledge Base & Docs Phase 3 Yes (with 5) 1 week
7 Onboarding Flow Phase 2, 3 Yes (with 5) 3 days
8 Skills & Workflows Phase 4 Yes (with 5) 1 week
9 Scheduling & Automation Phase 8 No 1 week
10 Git Integration Phase 3 Yes 3 days
11 Cloud Drive Integration Phase 3 Yes 1 week
12 MCP Integration Framework Phase 4 Yes 1 week
13 Admin Portal & Analytics Phase 2 Yes (with 5+) 1 week
14 Meeting & Transcription Phase 4, 5 No 1 week
15 AI Provider Management Phase 4 Yes (with 13) 1 week
16 Report Publisher & Exports Phase 6 Yes 1 week
17 Polish, Theming & Deployment All No 1 week

Dependency Graph

Phase 1 (Foundation)
├── Phase 2 (Auth)
│   ├── Phase 7 (Onboarding)
│   └── Phase 13 (Admin)
├── Phase 3 (Files)
│   ├── Phase 6 (Knowledge Base)
│   ├── Phase 10 (Git)
│   └── Phase 11 (Cloud Drives)
└── Phase 4 (Claude CLI) ← requires 2 + 3
    ├── Phase 5 (Chat) ← CRITICAL PATH
    │   └── Phase 14 (Meetings)
    ├── Phase 8 (Skills)
    │   └── Phase 9 (Scheduling)
    ├── Phase 12 (MCP Framework)
    └── Phase 15 (AI Providers)

Critical Path

Phase 1 → 2 → 3 → 4 → 5 is the critical path. Chat with Claude CLI is the core product value. Everything else extends it.

Phase Details

Phase 1: Foundation & Database

  • Express server with static file serving
  • SQLite database with better-sqlite3
  • Schema initialization from init.sql
  • Migration system (column additions, table creates)
  • Path resolution utilities (SHARED_ROOT, DOCS_ROOT, etc.)
  • Environment variable loading
  • Health check endpoint
  • Rate limiting and security headers (Helmet)

Phase 2: Authentication & Users

  • User registration (first user = admin, single-tenant)
  • bcrypt password hashing
  • JWT token generation (no expiry)
  • Authentication middleware (authenticateToken)
  • Admin authorization middleware (requireAdmin)
  • Localhost bypass for Claude CLI integration
  • Password reset flow (Postmark email + token)

Phase 3: Project & File System

  • Project directory management
  • File upload (multer) with size limits
  • File download, move, delete operations
  • File type detection and classification
  • Document conversion (Word → HTML → Markdown)
  • safePath() for path traversal prevention
  • File tree caching

Phase 4: Claude CLI Integration

  • Claude CLI process spawning via node-pty
  • Session management (filesystem-based)
  • --append-system-prompt injection pipeline
  • Permission mode configuration
  • Model selection and provider routing
  • Environment variable passthrough to CLI

Phase 5: Chat Interface & Streaming

  • WebSocket server for real-time streaming
  • React chat interface with message rendering
  • Tool call visualization
  • Markdown rendering with syntax highlighting
  • Mermaid diagram support
  • Session history and auto-titling
  • Message grouping and normalization
  • Terminal/shell component (xterm.js)

Phase 6: Knowledge Base & Documentation

  • Markdown file serving and preview
  • Doc-builder integration for HTML generation
  • PDF/DOCX/Markdown download endpoints
  • SPA generation for knowledge base
  • Live reload for doc changes

Phase 7: Onboarding Flow

  • 3-step employee metaphor onboarding
  • Company profile creation
  • Organization research (Claude-powered)
  • Document upload during onboarding
  • Skip/complete flow management

Phase 8: Skills & Workflows

  • Skill CRUD (markdown-based, .claude/skills/)
  • Skill parser/serializer (frontmatter + body)
  • Workflow parser/serializer (multi-step flows)
  • React Flow visual editor
  • Step types: transform, skill, tool, decision, gate, parallel
  • Layer inference (0-3 complexity)
  • Skill execution via Claude CLI

Phase 9: Scheduling & Automation

  • Cron expression parsing and scheduling
  • Scheduled prompt execution
  • Execution history logging
  • Enable/disable/run-now controls
  • Timezone support
  • JSONL-based execution logs

Phase 10: Git Integration

  • Git status, diff, log, branch operations
  • Commit with message generation
  • Push/pull/fetch to remote
  • Branch creation and checkout
  • Conflict detection

Phase 11: Cloud Drive Integration

  • OAuth flow for Google Drive, OneDrive, SharePoint
  • rclone-based virtual filesystem
  • Cloud file browsing, download, upload
  • Mount point management
  • VFS caching with TTL
  • Credential encryption and refresh

Phase 12: MCP Integration Framework

  • MCP server registration and configuration
  • 21 MCP service adapters
  • Claude CLI MCP listing endpoint
  • Per-service configure/test/register/deregister
  • Config directory management per service

Phase 13: Admin Portal & Analytics

  • User CRUD (create, update, delete, welcome email)
  • Hook event analytics (usage, sessions, commands, timeseries)
  • Stats refresh worker (forked process)
  • Execution log viewing
  • Output style management
  • System configuration

Phase 14: Meeting & Transcription

  • Meeting start/stop/status
  • Transcript capture and display
  • Meeting analysis (Claude-powered)
  • Advisor orchestration
  • Quick links management

Phase 15: AI Provider Management

  • Anthropic direct API configuration
  • AWS Bedrock configuration and testing
  • Model selection and switching
  • Extended context (1M tokens) management
  • Provider status and health checks
  • Encrypted credential storage

Phase 16: Report Publisher & Exports

  • Design pack system (JSON layouts)
  • Chart rendering
  • PPTX/PDF generation
  • Template management

Phase 17: Polish, Theming & Deployment

  • Dark/light theme support
  • Responsive mobile layout
  • Docker multi-stage build
  • Sliplane deployment configuration
  • AWS ECS Fargate deployment
  • GitHub Actions CI/CD
  • Security scanning (CodeQL, Semgrep, OSV)