TrajectoryOS + CC-TPO Unification Plan
**Goal**: Merge TrajectoryOS and CC-TPO into a single unified system with clean architecture, removing redundancies and creating clear service boundaries.
Full Public Reader
TrajectoryOS + CC-TPO Unification Plan
Goal: Merge TrajectoryOS and CC-TPO into a single unified system with clean architecture, removing redundancies and creating clear service boundaries.
Date: December 15, 2025
Status: Planning Phase
---
Current State Analysis
Existing Directory Structure
cc-trajectory/
├── apps/
│ ├── api-gateway/ # TrajectoryOS API gateway (NEW)
│ └── web-dashboard/ # TrajectoryOS Next.js UI (NEW)
│
├── services/
│ ├── agent-orchestrator/ # TrajectoryOS LLM agents (NEW)
│ ├── background-worker/ # TrajectoryOS background processing (NEW)
│ ├── trajectory-core/ # TrajectoryOS physics engine (NEW)
│ ├── echelon-bridge/ # TrajectoryOS Echelon integration (NEW)
│ └── cc-tpo/ # ENTIRE CC-TPO PROJECT (LEGACY)
│ ├── apps/
│ │ ├── liquid-chat-ui/
│ │ ├── ircp-search-app/
│ │ └── liquid-chat-backend/
│ ├── services/
│ │ └── [9 search API services]
│ ├── packages/
│ │ ├── ircp/ # Core IRCP implementation ← KEEP
│ │ ├── tpo/ # DLM coordinates ← KEEP
│ │ ├── rcp/ # Ring propagation ← KEEP
│ │ ├── dlm/ # Liquid motion ← KEEP
│ │ └── ctsc/ # Topology search ← KEEP
│ ├── cc-navigator/ # Hierarchical knowledge browser ← ADAPT
│ ├── data/
│ │ └── databases/
│ │ ├── conversations_fixed.db ← MIGRATE
│ │ └── claude_full_embeddings_dlm_fixed.db ← MIGRATE
│ ├── training/ # IRCP model training ← KEEP
│ ├── scripts/ # Utility scripts
│ └── docs/ # DocumentationRedundancies to Remove
1. Duplicate Web Frontends:
- `apps/web-dashboard` (TrajectoryOS - skeletal)
- `services/cc-tpo/cc-navigator` (CC-TPO - functional)
- `services/cc-tpo/apps/liquid-chat-ui` (CC-TPO - different purpose)
- `services/cc-tpo/apps/ircp-search-app` (CC-TPO - search focused)
2. Duplicate Backend APIs:
- `apps/api-gateway` (TrajectoryOS - partial)
- `services/cc-tpo/apps/liquid-chat-backend` (CC-TPO - FastAPI)
- Multiple search services in `services/cc-tpo/services/`
3. Duplicate Database Management:
- TrajectoryOS: Prisma + SQLite (not fully set up)
- CC-TPO: SQLite databases with embeddings
4. Overlapping Agent Functionality:
- `services/agent-orchestrator` (TrajectoryOS - LLM interview)
- CC-TPO chat/search capabilities (integrated into apps)
---
Unified Architecture Vision
Design Principles
1. Single Source of Truth: One database, one schema
2. Modular Services: Clear boundaries, single responsibility
3. Python for ML/IRCP: Keep IRCP, DLM in Python where it belongs
4. TypeScript for Services: Keep trajectory-core, orchestrator, gateway in TypeScript
5. Next.js for Frontend: Single unified web application
6. Reuse Core Packages: Move CC-TPO packages to root level
Proposed Unified Structure
cc-trajectory/
│
├── packages/ # Shared Python libraries (from cc-tpo)
│ ├── ircp/ # Inverse Ring Contextual Propagation
│ ├── tpo/ # Temporal Positional Optimization (DLM coords)
│ ├── rcp/ # Ring Contextual Propagation
│ ├── dlm/ # Dynamic Liquid Motion
│ └── ctsc/ # Computational Topology Search Coordinates
│
├── services/
│ ├── ircp-service/ # Python FastAPI - IRCP inference & embedding
│ │ ├── main.py
│ │ ├── routes/
│ │ │ ├── embed.py # POST /embed - text → embedding + coords
│ │ │ ├── search.py # POST /search - topological search
│ │ │ └── coordinates.py # POST /calculate-coords - DLM coords
│ │ ├── models/
│ │ │ ├── ircp_model.py # SentenceTransformerICP wrapper
│ │ │ └── dlm_calculator.py # DLM coordinate computation
│ │ └── requirements.txt
│ │
│ ├── trajectory-core/ # TypeScript - Life physics & state management
│ │ ├── src/
│ │ │ ├── services/
│ │ │ │ ├── LifeStateService.ts
│ │ │ │ ├── SkillGraphService.ts # Bayesian updates + IRCP calls
│ │ │ │ ├── PhysicsEngine.ts
│ │ │ │ ├── DLMCoordinateService.ts # Wraps Python IRCP service
│ │ │ │ └── RingPatternDetector.ts
│ │ │ ├── routes/
│ │ │ │ ├── skills.ts
│ │ │ │ ├── projects.ts
│ │ │ │ ├── state.ts
│ │ │ │ ├── interviews.ts
│ │ │ │ └── search.ts # Unified search endpoint
│ │ │ ├── domain/
│ │ │ │ ├── types.ts
│ │ │ │ ├── physics.ts
│ │ │ │ └── coordinates.ts # DLM coordinate types
│ │ │ └── prisma/
│ │ │ └── schema.prisma # Unified schema
│ │ └── package.json
│ │
│ ├── agent-orchestrator/ # TypeScript - LLM agents
│ │ ├── src/
│ │ │ ├── agents/
│ │ │ │ ├── InterviewAgent.ts
│ │ │ │ ├── PlannerAgent.ts
│ │ │ │ └── EvidenceExtractor.ts # Uses IRCP search for historical evidence
│ │ │ ├── llm/
│ │ │ │ └── client.ts
│ │ │ └── adapters/
│ │ │ ├── TrajectoryCoreClient.ts
│ │ │ └── IRCPClient.ts # Calls Python IRCP service
│ │ └── package.json
│ │
│ ├── api-gateway/ # TypeScript - Unified REST + WebSocket API
│ │ ├── src/
│ │ │ ├── routes/
│ │ │ │ ├── sessions.ts # Interview sessions
│ │ │ │ ├── search.ts # Unified search (semantic + topo + physics)
│ │ │ │ ├── state.ts # Life state queries
│ │ │ │ ├── coordinates.ts # Coordinate calculations
│ │ │ │ └── patterns.ts # Ring pattern queries
│ │ │ ├── middleware/
│ │ │ │ └── auth.ts
│ │ │ └── websocket/
│ │ │ └── broadcaster.ts
│ │ └── package.json
│ │
│ └── background-worker/ # TypeScript - Scheduled jobs
│ ├── src/
│ │ ├── jobs/
│ │ │ ├── pattern-detector.ts
│ │ │ ├── state-updater.ts
│ │ │ └── planner.ts
│ │ └── scheduler.ts
│ └── package.json
│
├── apps/
│ └── web/ # Next.js - Unified Navigator
│ ├── app/
│ │ ├── page.tsx # Main navigation (tree + dashboard)
│ │ ├── layout.tsx
│ │ └── api/ # Next.js API routes (optional, proxy to gateway)
│ ├── components/
│ │ ├── LifeTree.tsx # Hierarchical event browser (from cc-navigator)
│ │ ├── CoordinateSpace.tsx # 3D DLM visualization
│ │ ├── RingTopology.tsx # Ring pattern visualization
│ │ ├── PhysicsDashboard.tsx # Escape index, thrust, etc.
│ │ ├── ChatInterface.tsx # Context-aware Q&A
│ │ └── SearchInterface.tsx # Multi-dimensional search
│ ├── lib/
│ │ ├── api-client.ts # Gateway API wrapper
│ │ └── types.ts
│ └── package.json
│
├── data/
│ ├── databases/
│ │ └── trajectoryos.db # Unified SQLite database
│ ├── models/
│ │ └── ircp_best_model.pt # Trained IRCP model
│ └── migrations/ # Data migration scripts
│ └── import_cc_tpo_conversations.py
│
├── training/ # Model training (from cc-tpo)
│ ├── ircp/
│ │ ├── train.py
│ │ ├── evaluate.py
│ │ └── config.yaml
│ └── notebooks/
│
├── scripts/
│ ├── setup/
│ │ ├── init-database.sh
│ │ └── download-model.sh
│ ├── migration/
│ │ ├── migrate-cc-tpo-data.py
│ │ └── validate-migration.py
│ └── dev/
│ └── start-all-services.sh
│
├── docs/
│ ├── architecture/
│ │ ├── UNIFIED_ARCHITECTURE.md
│ │ ├── SERVICE_BOUNDARIES.md
│ │ └── DATA_MODEL.md
│ ├── guides/
│ │ ├── GETTING_STARTED.md
│ │ ├── DEPLOYMENT.md
│ │ └── DEVELOPMENT.md
│ ├── research/
│ │ ├── RESEARCH_PAPER_TOPOLOGICAL_LIFE_MODELING.md
│ │ ├── TOPOLOGICAL_SEARCH_VISUALIZATION.md
│ │ └── EXAMPLE_TOPOLOGICAL_QUERIES.md
│ └── integration/
│ ├── TRAJECTORY_TPO_INTEGRATION.md
│ └── MIGRATION_GUIDE.md
│
├── docker/
│ ├── docker-compose.yml # All services orchestrated
│ ├── Dockerfile.ircp # Python IRCP service
│ ├── Dockerfile.trajectory # TypeScript services
│ └── Dockerfile.web # Next.js app
│
├── .env.example
├── package.json # Root workspace config (pnpm)
├── pnpm-workspace.yaml
├── tsconfig.json # Root TypeScript config
└── README.md---
Service Boundaries & Responsibilities
1. IRCP Service (Python FastAPI)
Responsibility: All IRCP model inference, embedding generation, and DLM coordinate calculation.
Endpoints:
- `POST /embed` - Embed text → 384-dim vector + predicted coords
- `POST /search` - Vector similarity search with filters
- `POST /calculate-coords` - Compute DLM coords for event (uses graph structure)
- `GET /model/info` - Model metadata
Dependencies:
- `packages/ircp`, `packages/tpo`, `packages/rcp`, `packages/dlm`
- PyTorch, sentence-transformers
- Reads: `data/models/ircp_best_model.pt`
Port: 3005
---
2. Trajectory Core (TypeScript Node.js)
Responsibility: Life physics engine, state management, skill graph, database ORM.
Endpoints:
- `POST /api/skills/evidence` - Submit skill evidence
- `GET /api/skills/user/:userId` - Get skill beliefs
- `POST /api/projects` - Create/update projects
- `GET /api/state/:userId/latest` - Get latest life state
- `GET /api/state/:userId/history` - Get state timeline
- `POST /api/interviews/summary` - Process interview results
- `POST /api/search` - Unified search (calls IRCP service internally)
Dependencies:
- IRCP Service (HTTP client)
- Prisma ORM
- Database: `data/databases/trajectoryos.db`
Port: 3003
---
3. Agent Orchestrator (TypeScript Node.js)
Responsibility: LLM-powered interview and planning agents.
Endpoints:
- `POST /api/sessions` - Start interview
- `POST /api/sessions/:id/messages` - Continue interview
- `POST /api/sessions/:id/complete` - End interview
- `POST /api/background/analyze` - Trigger planner agent
Dependencies:
- Trajectory Core (HTTP client)
- IRCP Service (HTTP client for historical evidence search)
- OpenAI/Anthropic API
Port: 3004
---
4. API Gateway (TypeScript Express)
Responsibility: Unified API, auth, WebSocket broadcasting, request routing.
Endpoints:
- Proxies to all backend services
- `/api/sessions/*` → Agent Orchestrator
- `/api/state/*` → Trajectory Core
- `/api/search` → Trajectory Core (which calls IRCP)
- `/api/coordinates/*` → IRCP Service
- `/api/patterns/*` → Background Worker
- WebSocket: `ws://host/ws` - Real-time updates
Dependencies:
- All backend services (reverse proxy)
Port: 8080
---
5. Background Worker (TypeScript Node.js)
Responsibility: Scheduled jobs (pattern detection, state updates, planning).
Jobs:
- Hourly: Update life state if activity detected
- Daily: Run pattern detector for ring cycles
- Weekly: Run planner agent for trajectory analysis
Dependencies:
- Trajectory Core
- IRCP Service
- Agent Orchestrator
No HTTP server - runs as cron/scheduler
---
6. Web App (Next.js React)
Responsibility: User interface with all visualizations.
Views:
- Life Tree (hierarchical events)
- Coordinate Space (3D scatter plot)
- Ring Topology (cycle visualization)
- Physics Dashboard (escape index, metrics)
- Search Interface (multi-dimensional query)
- Chat Interface (context-aware Q&A)
Dependencies:
- API Gateway (HTTP + WebSocket)
Port: 3000
---
Unified Database Schema
### Core Principle
Merge TrajectoryOS schema with CC-TPO conversation data into single unified schema.
Key Tables
// Unified Prisma Schema
model User {
id String @id @default(uuid())
email String? @unique
name String?
createdAt DateTime @default(now())
lifeEvents LifeEvent[]
skillBeliefs SkillBelief[]
projects Project[]
constraints Constraint[]
lifeStates LifeState[]
patterns LifePattern[]
}
model LifeEvent {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
eventType String // 'conversation', 'interview', 'journal', 'project_note', 'decision'
content String // Full text content
parentEventId String? // Hierarchical nesting
parentEvent LifeEvent? @relation("EventHierarchy", fields: [parentEventId], references: [id])
childEvents LifeEvent[] @relation("EventHierarchy")
timestamp DateTime
// Semantic embedding
embedding Bytes? // 384-dim float array (serialized)
// DLM coordinates
xCoord Float? // Hierarchical depth
yCoord Float? // Sibling position
zCoord Float? // Semantic homogeneity
tCoord Float? // Temporal position
nCoord Int? // Structural complexity
// Ring topology
ringId String?
ringPosition Int?
pattern LifePattern? @relation(fields: [ringId], references: [id])
// Physics context
physicsSnapshotId String?
physicsSnapshot LifeState? @relation(fields: [physicsSnapshotId], references: [id])
// Extracted evidence
skillEvidence SkillEvidence[]
// Flexible metadata
metadata Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([userId, timestamp])
@@index([userId, eventType])
@@index([xCoord, yCoord, zCoord])
}
model Skill {
id String @id @default(uuid())
name String
domain String
description String?
beliefs SkillBelief[]
edgesFrom SkillEdge[] @relation("FromSkill")
edgesTo SkillEdge[] @relation("ToSkill")
evidence SkillEvidence[]
@@unique([name, domain])
}
model SkillEdge {
id String @id @default(uuid())
fromSkillId String
toSkillId String
fromSkill Skill @relation("FromSkill", fields: [fromSkillId], references: [id])
toSkill Skill @relation("ToSkill", fields: [toSkillId], references: [id])
weight Float // Transfer strength (0-1)
description String?
@@unique([fromSkillId, toSkillId])
}
model SkillBelief {
id String @id @default(uuid())
userId String
skillId String
user User @relation(fields: [userId], references: [id])
skill Skill @relation(fields: [skillId], references: [id])
level Float // 0-10 scale (mean of posterior)
uncertainty Float // Standard deviation
lastUpdated DateTime
// Full posterior params (Beta distribution)
posteriorParams Json?
@@unique([userId, skillId])
@@index([userId, level])
}
model SkillEvidence {
id String @id @default(uuid())
userId String
skillId String
skill Skill @relation(fields: [skillId], references: [id])
eventId String?
event LifeEvent? @relation(fields: [eventId], references: [id])
timestamp DateTime
level Float // Observed level (0-10)
confidence Float // Confidence in observation (0-1)
source String // 'interview', 'artifact', 'echelon_flow', 'self_report'
sourceRef String? // Reference to source
notes String?
@@index([userId, skillId, timestamp])
}
model Project {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
name String
description String?
status String // 'active', 'paused', 'completed', 'archived'
embedding Bytes? // Semantic vector
importance Float? // 0-1
timeAllocation Float? // 0-1
// DLM coordinates for project as a whole
xCoord Float?
yCoord Float?
zCoord Float?
metadata Json?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([userId, status])
}
model Constraint {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
type String // 'financial', 'time', 'health', 'social', 'other'
description String
intensity Float // 0-1
urgency Float // 0-1
startDate DateTime
endDate DateTime?
decayFunction String? // 'constant', 'exponential', 'linear'
@@index([userId, endDate])
}
model LifeState {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
timestamp DateTime
latentVector Bytes // z_t encoded
// Physics variables
thrust Float
alignment Float
gravity Float
mass Float
escapeIndex Float
notes String?
events LifeEvent[]
@@index([userId, timestamp])
@@index([userId, escapeIndex])
}
model LifePattern {
id String @id @default(uuid())
userId String
user User @relation(fields: [userId], references: [id])
patternType String // 'daily_routine', 'creative_cycle', 'learning_cycle', 'work_cycle'
stages Json // Array of stage labels
transitions Json // Transition matrix
cycleDuration Float? // Average period in days
confidence Float // Detection confidence
detectedAt DateTime @default(now())
status String // 'active', 'archived'
events LifeEvent[]
@@index([userId, patternType])
}---
Migration Strategy
Phase 1: Setup Unified Structure (Week 1)
Tasks:
1. Create new directory structure
2. Move `packages/` from `services/cc-tpo/` to root
3. Create unified `services/ircp-service/` from cc-tpo backend code
4. Set up unified Prisma schema
5. Configure pnpm workspace
Commands:
# 1. Backup current state
cp -r services/cc-tpo services/cc-tpo.backup
# 2. Move packages to root
mv services/cc-tpo/packages ./packages
# 3. Create IRCP service structure
mkdir -p services/ircp-service/{routes,models}
# Copy relevant Python code from cc-tpo/apps/liquid-chat-backend
# Adapt to match new API spec
# 4. Update workspace config
cat > pnpm-workspace.yaml << EOF
packages:
- 'apps/*'
- 'services/*'
- 'packages/*'
EOF
# 5. Create unified Next.js app
mv apps/web-dashboard apps/web
# Integrate cc-navigator components---
Phase 2: Database Migration (Week 1-2)
Tasks:
1. Create unified Prisma schema
2. Generate initial migration
3. Write data migration script to import CC-TPO conversations
4. Validate migrated data
Migration Script (`scripts/migration/migrate-cc-tpo-data.py`):
import sqlite3
import json
from prisma import Prisma
async def migrate_conversations():
# Source: CC-TPO database
cc_tpo_db = sqlite3.connect('services/cc-tpo.backup/data/databases/conversations_fixed.db')
# Target: Unified database
prisma = Prisma()
await prisma.connect()
# Get all conversations
cursor = cc_tpo_db.execute("SELECT * FROM conversations")
for conv in cursor:
# Create root life event
root_event = await prisma.lifeevent.create({
'data': {
'userId': 'migrated_user', # Set actual user ID
'eventType': 'conversation',
'content': conv['summary'] or '',
'timestamp': conv['create_time'],
'metadata': json.dumps({
'source': 'cc-tpo',
'original_id': conv['conversation_id']
})
}
})
# Get messages for this conversation
msg_cursor = cc_tpo_db.execute(
"SELECT * FROM messages WHERE conversation_id = ?",
(conv['conversation_id'],)
)
for msg in msg_cursor:
# Get DLM coordinates
coords = cc_tpo_db.execute(
"SELECT * FROM dlm_coordinates WHERE message_id = ?",
(msg['message_id'],)
).fetchone()
# Get embedding
emb = cc_tpo_db.execute(
"SELECT embedding_vector FROM embeddings WHERE message_id = ?",
(msg['message_id'],)
).fetchone()
# Create child event
await prisma.lifeevent.create({
'data': {
'userId': 'migrated_user',
'eventType': 'conversation',
'content': msg['content'],
'parentEventId': root_event.id,
'timestamp': msg['create_time'],
'xCoord': coords['x_coord'] if coords else None,
'yCoord': coords['y_coord'] if coords else None,
'zCoord': coords['z_coord'] if coords else None,
'tCoord': coords['t_coord'] if coords else None,
'nCoord': calculate_n(msg['content']),
'embedding': emb['embedding_vector'] if emb else None
}
})
await prisma.disconnect()
def calculate_n(content: str) -> int:
return len(content.split('\n\n'))---
Phase 3: Service Implementation (Week 2-3)
Tasks:
1. Implement IRCP service in Python
2. Update trajectory-core to call IRCP service
3. Update agent-orchestrator to use IRCP for historical search
4. Implement unified search endpoint
5. Set up API gateway routing
IRCP Service Example (`services/ircp-service/main.py`):
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel
import torch
from typing import List, Optional
import sys
from pathlib import Path
# Add packages to path
sys.path.append(str(Path(__file__).parent.parent.parent / "packages" / "ircp"))
sys.path.append(str(Path(__file__).parent.parent.parent / "packages" / "tpo"))
from ircp.models.sentence_transformer_icp import SentenceTransformerICP
from tpo.core.dlm_coordinates import DLMCalculator
app = FastAPI(title="IRCP Service")
# Load model at startup
model_path = "../../data/models/ircp_best_model.pt"
model = SentenceTransformerICP.load(model_path)
dlm_calculator = DLMCalculator()
class EmbedRequest(BaseModel):
text: str
class EmbedResponse(BaseModel):
embedding: List[float]
coordinates: dict
class SearchRequest(BaseModel):
query: str
filters: Optional[dict] = None
top_k: int = 10
@app.post("/embed", response_model=EmbedResponse)
async def embed_text(request: EmbedRequest):
embedding = model.encode(request.text)
# Predict coordinates (simplified - needs event context for full calc)
coords_pred = model.predict_coordinates(embedding)
return EmbedResponse(
embedding=embedding.tolist(),
coordinates={
'x': coords_pred[0],
'y': coords_pred[1],
'z': coords_pred[2],
't': coords_pred[3],
'n': coords_pred[4]
}
)
@app.post("/calculate-coords")
async def calculate_coordinates(event: dict):
# Full DLM calculation with graph structure
coords = dlm_calculator.calculate(
event_id=event['id'],
parent_id=event.get('parentId'),
siblings=event.get('siblings', []),
timestamp=event['timestamp'],
content=event['content']
)
return coords
@app.get("/health")
async def health():
return {"status": "ok", "model_loaded": model is not None}---
Phase 4: Frontend Unification (Week 3-4)
Tasks:
1. Migrate cc-navigator components to `apps/web`
2. Add coordinate space visualization
3. Add ring topology visualization
4. Integrate physics dashboard
5. Unify search and chat interfaces
Component Integration:
// apps/web/app/page.tsx
import LifeTree from '@/components/LifeTree';
import PhysicsDashboard from '@/components/PhysicsDashboard';
import CoordinateSpace from '@/components/CoordinateSpace';
import RingTopology from '@/components/RingTopology';
import SearchInterface from '@/components/SearchInterface';
export default function Home() {
const [view, setView] = useState<'tree' | 'coords' | 'rings'>('tree');
const [currentContext, setCurrentContext] = useState(null);
return (
<div className="grid grid-cols-12 h-screen">
{/* Left sidebar: Navigation */}
<div className="col-span-3 border-r">
<LifeTree onNodeSelect={setCurrentContext} />
</div>
{/* Main content: View selection */}
<div className="col-span-6">
<ViewTabs value={view} onChange={setView} />
{view === 'tree' && <EventDetail context={currentContext} />}
{view === 'coords' && <CoordinateSpace />}
{view === 'rings' && <RingTopology />}
</div>
{/* Right sidebar: Physics + Search */}
<div className="col-span-3 border-l flex flex-col">
<PhysicsDashboard className="flex-shrink-0" />
<SearchInterface context={currentContext} className="flex-1" />
</div>
</div>
);
}---
Phase 5: Testing & Validation (Week 4)
Tasks:
1. End-to-end integration tests
2. Data migration validation
3. Performance testing
4. User acceptance testing
Test Scenarios:
- Import CC-TPO conversations → verify coordinates
- Run interview → verify evidence extraction
- Query with filters → verify topological search
- Detect patterns → verify ring detection
- View visualizations → verify rendering
---
Phase 6: Cleanup & Documentation (Week 4-5)
Tasks:
1. Remove redundant `services/cc-tpo/apps/`
2. Archive unused scripts
3. Update all documentation
4. Create deployment guides
Cleanup Commands:
# Remove redundant apps
rm -rf services/cc-tpo/apps/liquid-chat-ui
rm -rf services/cc-tpo/apps/ircp-search-app
rm -rf services/cc-tpo/apps/liquid-chat-backend
# Remove redundant services
rm -rf services/cc-tpo/services/
# Keep only essential CC-TPO structure
# services/cc-tpo/
# ├── data/databases/ (as backup)
# ├── training/ (model training code)
# └── docs/ (research documentation)
# Archive
mkdir archive/
mv services/cc-tpo.backup archive/---
Deployment Configuration
Docker Compose
# docker/docker-compose.yml
version: '3.8'
services:
ircp:
build:
context: ..
dockerfile: docker/Dockerfile.ircp
ports:
- "3005:3005"
volumes:
- ../data:/app/data
environment:
- MODEL_PATH=/app/data/models/ircp_best_model.pt
trajectory-core:
build:
context: ..
dockerfile: docker/Dockerfile.trajectory
ports:
- "3003:3003"
depends_on:
- ircp
environment:
- DATABASE_URL=file:/app/data/databases/trajectoryos.db
- IRCP_SERVICE_URL=http://ircp:3005
agent-orchestrator:
build:
context: ..
dockerfile: docker/Dockerfile.trajectory
ports:
- "3004:3004"
depends_on:
- trajectory-core
- ircp
environment:
- TRAJECTORY_CORE_URL=http://trajectory-core:3003
- IRCP_SERVICE_URL=http://ircp:3005
- OPENAI_API_KEY=${OPENAI_API_KEY}
api-gateway:
build:
context: ..
dockerfile: docker/Dockerfile.trajectory
ports:
- "8080:8080"
depends_on:
- trajectory-core
- agent-orchestrator
- ircp
environment:
- TRAJECTORY_CORE_URL=http://trajectory-core:3003
- AGENT_ORCHESTRATOR_URL=http://agent-orchestrator:3004
- IRCP_SERVICE_URL=http://ircp:3005
web:
build:
context: ..
dockerfile: docker/Dockerfile.web
ports:
- "3000:3000"
depends_on:
- api-gateway
environment:
- NEXT_PUBLIC_API_URL=http://api-gateway:8080
background-worker:
build:
context: ..
dockerfile: docker/Dockerfile.trajectory
depends_on:
- trajectory-core
- ircp
environment:
- TRAJECTORY_CORE_URL=http://trajectory-core:3003
- IRCP_SERVICE_URL=http://ircp:3005---
Success Criteria
### Architecture Cleanliness
- [ ] No duplicate services
- [ ] Clear service boundaries
- [ ] Single unified database
- [ ] Shared packages at root level
- [ ] No circular dependencies
### Functionality Preservation
- [ ] All CC-TPO data migrated successfully
- [ ] IRCP embeddings and coordinates working
- [ ] TrajectoryOS physics engine operational
- [ ] Unified search functional
- [ ] All visualizations working
### Performance
- [ ] Search latency < 500ms
- [ ] IRCP embedding < 200ms/batch
- [ ] Page load < 2s
- [ ] Real-time updates < 100ms
### Documentation
- [ ] Architecture clearly documented
- [ ] API specifications complete
- [ ] Deployment guide written
- [ ] Migration guide for existing users
---
Timeline Summary
| Week | Phase | Key Deliverables |
|---|---|---|
| 1 | Setup + DB Migration | Directory structure, unified schema, data migrated |
| 2 | Service Implementation | IRCP service, updated trajectory-core |
| 3 | Service Implementation | Agent updates, API gateway routing |
| 4 | Frontend Unification | Unified web app, all visualizations |
| 5 | Testing + Cleanup | Tests passing, documentation complete |
Total Duration: 5 weeks
Start Date: December 16, 2025
Target Completion: January 20, 2026
---
Next Immediate Steps
1. Review and approve this plan
2. Back up current `services/cc-tpo/`
3. Create new branch `unification`
4. Begin Phase 1: Directory restructuring
5. Set up unified Prisma schema
6. Test IRCP package imports from root
---
This unification creates a clean, maintainable system with clear boundaries, eliminating redundancy while preserving all core functionality from both TrajectoryOS and CC-TPO.
Promotion Decision
Attach run IDs, datasets, metrics, and reproduction commands.
Source Anchor
Comp-Core/backend/cc-trajectory/docs/guides/UNIFICATION_PLAN.md
Detected Structure
Method · Evaluation · References · Figures · Code Anchors · Architecture