Unified TrajectoryOS Architecture Plan
TrajectoryOS was originally designed as **"an AI that interviews you like a Stanford professor, models your strengths like a McKinsey consultant, and tracks your life-trajectory like NASA mission control."**
Full Public Reader
Unified TrajectoryOS Architecture Plan
Status: Reconciliation of RAG++ Implementation with Original Conversational Interview Vision
Date: December 18, 2025
---
Executive Summary
TrajectoryOS was originally designed as "an AI that interviews you like a Stanford professor, models your strengths like a McKinsey consultant, and tracks your life-trajectory like NASA mission control."
The current implementation has RAG++ (state-based recommendations) working but is missing the conversational interview engine that was the core vision.
This plan reunifies the system into three integrated layers:
1. Interview Layer - Conversational AI that extracts skills, projects, constraints
2. RAG++ Layer - State-based recommendations from transition memory
3. Planning Layer - Background agent that generates action plans
---
Current State Analysis
✅ What Exists
| Component | Status | Location |
|---|---|---|
| Life Physics Model | ✅ Complete | `services/trajectory-core/src/domain/physics.ts` |
| RAG++ Services (5 services) | ✅ Complete | `services/trajectory-core/src/services/` |
| RAG++ API Endpoints | ✅ Complete | `services/trajectory-core/src/routes/ragpp.ts` |
| Interview Agent (Backend) | ✅ Exists | `services/agent-orchestrator/src/agents/InterviewAgent.ts` |
| Planner Agent (Backend) | ✅ Exists | `services/agent-orchestrator/src/agents/PlannerAgent.ts` |
| iOS App (RAG++ only) | ✅ Complete | `apps/ios/TrajectoryOS/` |
| Prisma Schema | ✅ Complete | `services/trajectory-core/prisma/schema.prisma` |
❌ What's Missing
| Component | Status | Impact |
|---|---|---|
| `/api/interviews` endpoints | ❌ Missing | Can't start/continue interviews from iOS |
| `/api/planner` endpoints | ❌ Missing | Can't trigger background planning |
| Interview UI in iOS app | ❌ Missing | No conversational interface |
| Voice input integration | ❌ Missing | Text-only, not voice-driven |
| Skill belief updates | ❌ Missing | Evidence extracted but not bayesian-updated |
| Echelon bridge | ❌ Missing | Embodied data not feeding physics |
---
Unified Architecture
System Diagram
┌──────────────────────────────────────────────────────────────┐
│ TrajectoryOS (iOS) │
├──────────────────────────────────────────────────────────────┤
│ Dashboard Tab │ Interview Tab │ Plans Tab │
│ - Current State (η) │ - Chat Interface │ - AI Plans │
│ - RAG++ Suggestions │ - Voice Input │ - Actions │
│ - Transition History │ - Skill Extraction │ - Leverage │
└─────────┬────────────────┴─────────┬───────────┴──────┬───────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ trajectory-core REST API (Express) │
├──────────────────┬──────────────────┬──────────────────────┤
│ /api/ragpp │ /api/interviews │ /api/planner │
│ - recommend │ - start │ - generate │
│ - state/current │ - continue │ - latest │
│ - transitions │ - end │ - history │
│ - feedback │ - history │ │
└──────────────────┴──────────────────┴──────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ Core Services Layer │
├──────────────────┬──────────────────┬──────────────────────┤
│ RAG++ Services │ Interview Agent │ Planner Agent │
│ - StateEstimator│ - LLM Chat │ - Background Gen │
│ - ActionClass │ - Evidence │ - Leverage Points │
│ - TransBuilder │ - Skill Extract │ - Action Plans │
│ - TransRetrieval│ - Session Mgmt │ │
│ - PolicySuggest │ │ │
└──────────────────┴──────────────────┴──────────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────┐
│ Prisma ORM + Database │
│ - LifeState (physics snapshots) │
│ - StateTransition (for RAG++) │
│ - InterviewSession (conversation transcripts) │
│ - SkillEvidence (extracted from interviews) │
│ - ActionPlan (generated by planner) │
└──────────────────────────────────────────────────────────────┘---
Three-Layer Integration
Layer 1: Interview (Conversational Input)
Purpose: Extract user context through conversational AI
Flow:
1. User opens "Interview" tab in iOS app
2. Taps "Start Interview" → POST `/api/interviews/start`
3. Agent asks focused questions (skills, projects, constraints)
4. User responds via text or voice (speech-to-text)
5. Each response → POST `/api/interviews/continue`
6. Agent extracts structured evidence (SkillEvidence, ProjectData, ConstraintData)
7. Session ends → POST `/api/interviews/end` → persists to DB
Data Generated:
- SkillEvidence: level (0-10), confidence (0-1), utilization (0-1)
- Projects: active projects with importance, time allocation
- Constraints: financial, time, health (gravity factors)
Triggers:
- Weekly scheduled interviews
- When RAG++ confidence is low ("I'm uncertain about your Python skills")
- User-initiated ("Run interview")
---
Layer 2: RAG++ (State-Based Recommendations)
Purpose: Recommend actions based on similar past transitions
Flow:
1. System computes current LifeState from SkillEvidence + Projects + Constraints
2. Physics derivation: T (thrust from skills), A (alignment from projects), G (gravity from constraints), M (mass from complexity)
3. Calculate escape index: η = T·A / (G×M)
4. Classify regime: falling, approaching, threshold, escaping, free
5. Retrieve similar transitions from history (state similarity)
6. Suggest actions that worked in similar states
Data Used:
- Input: Current LifeState (physics + regime + flags + phase)
- Memory: StateTransition records (from → to state, actions, Δη)
- Output: Top 3 suggestions with confidence, reasoning, evidence
Integration with Interview:
- Interview extracts skills → updates LifeState → triggers new RAG++ retrieval
- RAG++ low confidence → triggers interview to reduce uncertainty
---
Layer 3: Background Planning (Generative Output)
Purpose: Generate action plans, insights, structural simplifications
Flow:
1. Background job runs daily/weekly
2. Planner Agent analyzes:
- Current LifeState trajectory
- Interview transcripts
- RAG++ suggestions
- Skill gaps and transfer opportunities
3. Generates:
- Multi-step action plans
- Leverage points (high impact/low effort)
- Alignment opportunities (projects that converge)
- Constraint removal strategies
Data Generated:
- ActionPlan: goal, horizon, steps with priorities, ETA
- LeveragePoint: description, impact, effort, category
- SkillPriority: which skills to develop next, why
Triggers:
- Scheduled (weekly background generation)
- After interview completion
- When η changes significantly
---
API Specification
`/api/interviews` Endpoints
#### POST /api/interviews/start
Request:
{
"userId": "user-123",
"focus": "skills" | "projects" | "constraints" | "mixed"
}Response:
{
"sessionId": "session-456",
"agentMessage": "Hi! Let's talk about your skills. What are you working on these days?",
"createdAt": "2025-12-18T10:00:00Z"
}#### POST /api/interviews/continue
Request:
{
"sessionId": "session-456",
"userMessage": "I've been building Python backends and doing some choreography work."
}Response:
{
"agentMessage": "Interesting! How long have you been working with Python?",
"extractedEvidence": [
{
"skillId": "python",
"levelEstimate": 7.5,
"confidence": 0.6,
"utilization": 0.8,
"source": "interview",
"rawText": "building Python backends"
},
{
"skillId": "choreography",
"levelEstimate": 6.0,
"confidence": 0.5,
"utilization": 0.4,
"source": "interview",
"rawText": "doing some choreography work"
}
],
"followUpQuestions": [
"How long have you been working with Python?",
"What kind of choreography do you focus on?"
]
}#### POST /api/interviews/end
Request:
{
"sessionId": "session-456"
}Response:
{
"sessionId": "session-456",
"userId": "user-123",
"focus": "skills",
"evidence": [ /* all extracted SkillEvidence */ ],
"projects": { /* ProjectData */ },
"constraints": { /* ConstraintData */ },
"summary": "Extracted 8 skills, 3 active projects, 2 constraints"
}#### GET /api/interviews/history?userId=user-123&limit=10
Response:
{
"sessions": [
{
"id": "session-456",
"focus": "skills",
"createdAt": "2025-12-18T10:00:00Z",
"endedAt": "2025-12-18T10:15:00Z",
"messageCount": 12,
"evidenceExtracted": 8
}
],
"total": 24
}---
`/api/planner` Endpoints
#### POST /api/planner/generate
Request:
{
"userId": "user-123",
"horizonDays": 30,
"focus": "alignment" | "gravity" | "growth" | "all"
}Response:
{
"planId": "plan-789",
"processingTime": "3.2s",
"plansGenerated": 3
}#### GET /api/planner/latest?userId=user-123
Response:
{
"plan": {
"id": "plan-789",
"goal": "Increase alignment by consolidating projects",
"horizonDays": 30,
"steps": [
{
"description": "Merge BWB and Plaisir branding",
"priority": 1,
"etaDays": 7,
"dependencies": []
},
{
"description": "Archive Guinea project temporarily",
"priority": 2,
"etaDays": 3,
"dependencies": []
}
],
"leveragePoints": [
{
"description": "Coffee + choreography → embodied hospitality brand",
"impactEstimate": 0.9,
"effortEstimate": 0.3,
"category": "alignment"
}
]
},
"generatedAt": "2025-12-18T08:00:00Z"
}---
iOS App User Flow
Tab 1: Dashboard (Existing - RAG++)
Current State Card:
- Regime: 🟠 THRESHOLD
- η = 0.99 (escape index)
- Flags: scattered, pressured
- Phase: Monday, night
AI Recommendations (3):
1. 🚀 Increase Thrust (7
- "In similar states, shipping features improved η by 15
- [👍] [😮] [👎]
2. 🎯 Increase Alignment (7
- "Consolidating projects helped in 8 past transitions"
- [👍] [😮] [👎]
Tab 2: Interview (NEW)
Interview View:
- Chat interface with message bubbles
- Agent: "Hi! What are you working on this week?"
- User: [Voice input button] or [Text field]
- As chat progresses, show extracted skills in sidebar:
- Python: 7.5/10 (80
- Choreography: 6/10 (40
Interview History:
- List of past sessions
- "Skills Deep Dive - Dec 10" (12 messages, 8 skills)
- "Project Review - Dec 3" (18 messages, 3 projects)
Tab 3: Plans (NEW)
Latest Plan:
- Goal: Increase alignment by 20
- Horizon: 30 days
- Steps (3):
1. Merge BWB + Plaisir branding (7 days) [Start]
2. Archive Guinea project (3 days) [Start]
3. Consolidate CC-core + Echelon repos (14 days) [Pending]
Leverage Points:
- 🎯 Coffee + choreography → embodied hospitality (90
- 📉 Reduce NY burn rate → move operations (80
---
Implementation Phases
Phase 1: Backend Interview API (3-4 hours)
Tasks:
1. Create `services/trajectory-core/src/routes/interviews.ts`
2. Import InterviewAgent from agent-orchestrator
3. Implement 4 endpoints (start, continue, end, history)
4. Wire to Prisma for persistence
5. Test with curl
Files to Create:
- `src/routes/interviews.ts` (200 lines)
- Update `src/index.ts` to register router
Testing:
# Start interview
curl -X POST http://localhost:3003/api/interviews/start \
-d '{"userId":"user-123","focus":"skills"}'
# Continue
curl -X POST http://localhost:3003/api/interviews/continue \
-d '{"sessionId":"xyz","userMessage":"I build Python apps"}'
# End
curl -X POST http://localhost:3003/api/interviews/end \
-d '{"sessionId":"xyz"}'---
Phase 2: Backend Planner API (2-3 hours)
Tasks:
1. Create `services/trajectory-core/src/routes/planner.ts`
2. Import PlannerAgent from agent-orchestrator
3. Implement 3 endpoints (generate, latest, history)
4. Test plan generation
Files to Create:
- `src/routes/planner.ts` (150 lines)
---
Phase 3: iOS Interview UI (4-6 hours)
Tasks:
1. Create `InterviewView.swift` (chat interface)
2. Create `InterviewViewModel.swift` (manages session state)
3. Add InterviewAPIClient methods to TrajectoryAPIClient.swift
4. Add "Interview" tab to ContentView
5. Implement message list, input field, send button
6. (Optional) Add voice input via AVFoundation speech-to-text
Files to Create:
- `Views/InterviewView.swift` (300 lines)
- `ViewModels/InterviewViewModel.swift` (200 lines)
- Update `TrajectoryAPIClient.swift` (+150 lines)
- Update `ContentView.swift` (add TabView)
---
Phase 4: iOS Plans UI (2-3 hours)
Tasks:
1. Create `PlansView.swift`
2. Create `PlansViewModel.swift`
3. Add PlannerAPIClient methods
4. Display action plans and leverage points
Files to Create:
- `Views/PlansView.swift` (200 lines)
- `ViewModels/PlansViewModel.swift` (150 lines)
---
Phase 5: Integration & Testing (2 hours)
Tasks:
1. Run full flow: Interview → Extract → RAG++ → Plans
2. Test interview triggers RAG++ update
3. Test plan generation uses interview data
4. Fix any integration bugs
---
Data Flow Example
Complete User Journey
Day 1: Onboarding Interview
1. User opens TrajectoryOS app
2. Taps "Start Interview"
3. Agent: "Tell me about your main skills"
4. User (voice): "I'm a Python engineer and I do choreography"
5. Extracted: Python (8/10, 0.9 utilization), Choreography (7/10, 0.3 utilization)
6. Agent: "What are your active projects?"
7. User: "BWB coffee shop, Plaisir events, CC-core AI system, Guinea macro stuff"
8. Extracted: 4 projects, alignment = 0.5 (scattered)
9. Interview ends, data persists
Background Processing:
- LifeState computed: T=45, A=0.5, G=6, M=5 → η = 0.75 (approaching)
- StateTransition created (baseline)
Day 2: RAG++ Recommendations
1. User opens Dashboard
2. System retrieves current state (approaching, η=0.75)
3. RAG++ finds similar transitions
4. Shows: "Increase Alignment" (confidence 12
- Evidence: "In similar states, consolidating projects improved η by 22
Day 8: Weekly Planning
1. Background planner runs
2. Analyzes: η=0.75, scattered projects, Python underutilized in choreography
3. Generates plan:
- Step 1: Merge BWB + Plaisir under one brand
- Step 2: Build Python tools for choreography (leverage point)
- Step 3: Pause Guinea project
4. User sees plan in "Plans" tab
Day 15: Follow-up Interview
1. System detects low confidence on alignment progress
2. Triggers interview: "How's the project consolidation going?"
3. User: "I merged the brands, it's going well"
4. Updated: Alignment = 0.7, η = 1.05 (escaping!)
5. RAG++ now shows: "Maintain Momentum" suggestions
---
Success Metrics
### Technical Metrics
- Interview extraction accuracy: >80
- RAG++ relevance rate: >65
- Plan execution tracking:
- System latency: <2s for interview responses
### User Metrics
- Weekly interview completion rate: >70
- RAG++ feedback (👍/😮/👎): >60
- Plan engagement: >50
- η trajectory: Upward trend over 30 days
---
Technical Dependencies
Backend
{
"trajectory-core": {
"dependencies": {
"@prisma/client": "^5.22.0",
"express": "^4.18.2",
"agent-orchestrator": "workspace:*"
}
},
"agent-orchestrator": {
"dependencies": {
"openai": "^4.20.0",
"uuid": "^9.0.0"
}
}
}iOS
// Minimum iOS 17
import SwiftUI
import AVFoundation // For speech-to-text
import Foundation // URLSession async/await---
Next Actions
### Immediate (Next Session)
1. ✅ Create `/api/interviews` router
2. ✅ Create `/api/planner` router
3. ⏭️ Test interview flow end-to-end
4. ⏭️ Add interview UI to iOS app
### Short-term (This Week)
1. Voice input integration (iOS speech recognition)
2. Background job scheduler for weekly interviews
3. Plan generation automation
4. Skill belief Bayesian updates
### Medium-term (Next 2 Weeks)
1. Echelon bridge (embodied data → alignment)
2. Skill graph traversal (transfer learning)
3. Active learning (interview triggers based on uncertainty)
4. Dashboard analytics (η over time chart)
---
Conclusion
The original TrajectoryOS vision is interviews + recommendations + planning.
Current state: ✅ Recommendations (RAG++) working, ❌ Interviews + Planning missing from iOS app.
This plan reconnects all three layers into one coherent system where:
- Interviews extract user context
- RAG++ provides evidence-based suggestions
- Planning generates long-term action plans
All three feed each other:
- Interviews → update LifeState → trigger RAG++
- RAG++ low confidence → trigger interview
- Interview + RAG++ → feed planner → generate action steps
- Plans → user executes → creates transitions → improves RAG++
The flywheel is complete.
Promotion Decision
Promote into a technical note or architecture paper with implementation anchors.
Source Anchor
Comp-Core/backend/cc-trajectory/UNIFIED_TRAJECTORYOS_PLAN.md
Detected Structure
Method · Evaluation · Code Anchors · Architecture