Grand Diomande Research · Full HTML Reader

Project Restructuring - December 17, 2025

Completed comprehensive directory restructuring to create a clean, unified folder structure for TrajectoryOS. This migration consolidates scattered components, archives legacy code, and establishes clear organizational boundaries.

Agents That Account for Themselves research note backlog reference score 22 .md

Full Public Reader

Project Restructuring - December 17, 2025

Overview

Completed comprehensive directory restructuring to create a clean, unified folder structure for TrajectoryOS. This migration consolidates scattered components, archives legacy code, and establishes clear organizational boundaries.

Changes Summary

New Directory Structure

cc-trajectory/
├── apps/web/                   # ← MERGED from apps/web-dashboard + cc-navigator
├── services/                   # ← CLEANED UP, removed cc-tpo
│   ├── trajectory-core/
│   ├── ircp-service/
│   ├── agent-orchestrator/
│   ├── background-worker/
│   └── echelon-bridge/
├── packages/                   # ← NEW: Python IRCP libraries from cc-tpo
│   ├── ircp/
│   ├── tpo/
│   ├── rcp/
│   └── dlm/
├── ai-models/                  # ← RENAMED from models/, kebab-case names
│   ├── echelon-fusion/
│   ├── gravity-mass/
│   ├── life-state/
│   └── alignment/
├── data/                       # ← NEW: Centralized data storage
│   ├── databases/
│   ├── uploads/
│   └── cache/
├── infra/                      # ← CONSOLIDATED infrastructure
│   ├── docker/
│   └── k8s/
├── docs/guides/                # ← MOVED all .md files from root
└── legacy/                     # ← ARCHIVED old code
    ├── cc-tpo-original/
    └── cc-tpo.backup.20251215/

Detailed Changes

#### 1. Apps Consolidation
MERGED: `apps/web-dashboard` + `services/cc-tpo/cc-navigator` → `apps/web/`
- Combined modern Next.js 16 setup from web-dashboard
- Integrated navigation components from cc-navigator
- Updated package.json with unified dependencies (d3, lucide-react, etc.)
- Removed: `apps/api-gateway/` (functionality moved to trajectory-core)

#### 2. Services Cleanup
ARCHIVED:
- `services/cc-tpo/` → `legacy/cc-tpo-original/`
- `services/cc-tpo.backup.20251215/` → `legacy/`

EXTRACTED from CC-TPO before archiving:
- Python packages (ircp, tpo, rcp, dlm) → `packages/`
- Database files → `data/databases/`

KEPT: Clean, active services only
- trajectory-core
- ircp-service
- agent-orchestrator
- background-worker
- echelon-bridge

#### 3. Models Reorganization
RENAMED: `models/` → `ai-models/`

STANDARDIZED directory names to kebab-case:
- `echelon_fusion` → `echelon-fusion`
- `gravity_mass` → `gravity-mass`
- `life_state` → `life-state`
- `skill_graph` → `skill-graph`

#### 4. Infrastructure Consolidation
MOVED:
- `docker-compose.unified.yml` → `infra/docker/docker-compose.yml`
- `k8s/*` → `infra/k8s/`

DELETED:
- Empty `infra/docker/` placeholder
- Root-level `k8s/` directory

#### 5. Documentation Organization
MOVED all root-level .md files → `docs/guides/`:
- QUICKSTART.md
- PRODUCTION.md
- TESTING.md
- IMPLEMENTATION_STATUS.md
- UNIFICATION_PLAN.md
- DETAILED_UNIFICATION_PLAN.md
- TRAJECTORY_TPO_INTEGRATION.md
- PROJECT_STATUS.md
- INTEGRATION_GUIDE.md
- FRONTEND_TRANSFORMATION.md
- IMPLEMENTATION_SUMMARY.md
- START.md
- convo.md

CREATED: New root README.md with updated structure

#### 6. Data Centralization
CREATED: `data/` directory structure

MIGRATED databases:
- `legacy/cc-tpo-original/data/databases/*.db` → `data/databases/`
- `services/trajectory-core/prisma/dev.db` → `data/databases/trajectory.db`

7. Configuration Updates

Updated `pnpm-workspace.yaml`:

yaml
packages:
  - 'apps/*'
  - 'services/*'

Removed: `'ingestion/*'` (directory deleted)

Updated `package.json` scripts:

json
"dev": "pnpm run dev:web & pnpm run dev:core",
"dev:web": "pnpm --filter web dev",        // was web-dashboard
"dev:core": "pnpm --filter trajectory-core dev",
"dev:ircp": "cd services/ircp-service && python src/main.py",

#### 8. Cleanup
DELETED:
- `apps/web-dashboard/` (merged into apps/web)
- `apps/api-gateway/` (functionality in trajectory-core)
- `models/` (renamed to ai-models)
- `k8s/` (moved to infra/k8s)
- `ingestion/` (empty directory)
- `docker-compose.unified.yml` (moved to infra/)

Legacy Apps Analysis

Before archiving, analyzed three legacy apps for reusable components:

### 1. ircp-search-app
Extracted for future use:
- Ring Context Pruner (423 lines) - intent-aware context pruning
- Database Manager (376 lines) - multi-database search with ring topology
- Context Manager (429 lines) - state management with persistence

### 2. liquid-chat-ui
Extracted for future use:
- Prisma Schema (134 lines) - production-ready with embeddings
- IRCP API Client (244 lines) - clean API abstraction
- OpenAI Service (~120 lines) - reusable AI integration

### 3. chain_memory
Extracted for future use:
- Advanced DLM Generator (465+ lines) - DPO preference generation
- Analysis Scripts - coordinate and tree structure analysis

Note: These components are documented in legacy analysis but not yet integrated. They remain available in `legacy/cc-tpo-original/` for future extraction.

Migration Steps Taken

1. ✅ Created backup branch: `backup-pre-restructure-20251217`
2. ✅ Created feature branch: `feature/unified-structure`
3. ✅ Created new directory structure
4. ✅ Merged web-dashboard + cc-navigator
5. ✅ Moved CC-TPO packages to root
6. ✅ Renamed models to ai-models (kebab-case)
7. ✅ Archived CC-TPO legacy code
8. ✅ Centralized data directory
9. ✅ Moved infrastructure files
10. ✅ Organized documentation
11. ✅ Removed old directories
12. ✅ Updated configuration files
13. ✅ Created new README

Breaking Changes

Import Path Updates Required

If you have external references to this codebase, update imports:

OldNew:
- `apps/web-dashboard` → `apps/web`
- `apps/api-gateway` → `services/trajectory-core` (API routes)
- `models/` → `ai-models/`
- `services/cc-tpo/packages/ircp` → `packages/ircp`
- Root-level docs → `docs/guides/`

Script Updates

Update any scripts referencing:
- `pnpm --filter web-dashboard` → `pnpm --filter web`
- `pnpm --filter api-gateway` → (removed, use trajectory-core)
- `docker-compose.unified.yml` → `infra/docker/docker-compose.yml`
- Database paths → `data/databases/`

Environment Variables

No environment variable changes required. Existing `.env` files remain compatible.

Post-Migration Checklist

  • [ ] Update CI/CD pipelines with new paths
  • [ ] Update deployment scripts
  • [ ] Rebuild Docker images
  • [ ] Test all development workflows
  • [ ] Update team documentation
  • [ ] Extract valuable components from legacy apps (future task)

Rollback Procedure

If issues arise, rollback to backup:

bash
git checkout backup-pre-restructure-20251217

Full project state is preserved in that branch.

Benefits

1. Clarity: Clear separation between apps, services, packages, and ML models
2. Maintainability: Consistent naming (kebab-case), logical grouping
3. Discoverability: Documentation centralized, README at root
4. Cleanliness: Legacy code archived, empty directories removed
5. Scalability: Room to grow within each category

Next Steps

1. Test builds: `pnpm install && pnpm build`
2. Test development: `pnpm dev`
3. Verify Docker setup: `docker-compose -f infra/docker/docker-compose.yml up`
4. Extract critical components from legacy apps:
- Ring Context Pruner
- Database Manager
- Prisma Schema enhancements
- DLM Generator (TypeScript port)

Questions or Issues?

Contact: Mo Diomande
Branch: `feature/unified-structure`
Backup: `backup-pre-restructure-20251217`

---

Migration Date: December 17, 2025
Status: Complete ✅
Impact: High (structural changes)
Risk: Low (full backup preserved)

Promotion Decision

Keep in the searchable backlog until it intersects a live paper or system.

Source Anchor

Comp-Core/backend/cc-trajectory/docs/guides/MIGRATION_2025-12-17.md

Detected Structure

Method · References · Code Anchors · Architecture