Grand Diomande Research · Full HTML Reader

Comp-Core: Computational Choreography Platform

1. [Executive Summary](#executive-summary) 2. [System Architecture Overview](#system-architecture-overview) 3. [Core Subsystems](#core-subsystems) 4. [Application Layer](#application-layer) 5. [Data Flow Architecture](#data-flow-architecture) 6. [API Reference](#api-reference) 7. [Deployment Architecture](#deployment-architecture) 8. [Current Status](#current-status)

Embodied Trajectory Systems architecture technical paper candidate score 54 .md

Full Public Reader

Comp-Core: Computational Choreography Platform

Master Architecture Documentation

Version: 2.0.0
Last Updated: December 26, 2024
Status: Production Development

---

Table of Contents

1. [Executive Summary](#executive-summary)
2. [System Architecture Overview](#system-architecture-overview)
3. [Core Subsystems](#core-subsystems)
4. [Application Layer](#application-layer)
5. [Data Flow Architecture](#data-flow-architecture)
6. [API Reference](#api-reference)
7. [Deployment Architecture](#deployment-architecture)
8. [Current Status](#current-status)

---

1. Executive Summary

Comp-Core is an integrated motion-to-music platform that transforms human movement into generative audio experiences. The system combines:

  • Real-time Motion Capture: Dual-source tracking via MediaPipe (camera) and Mocopi (IMU sensors)
  • Audio Synthesis: Conductor-orchestrated Strudel patterns driven by body movement
  • Machine Learning: CC-MotionGen diffusion models with RAG++ retrieval for motion generation
  • Multi-Platform Applications: iOS, Desktop (Tauri), and Web interfaces

Key Capabilities

CapabilityTechnologyStatus
Camera-based pose trackingMediaPipe HolisticProduction
IMU-based skeleton trackingSony Mocopi (6 sensors)Production
Real-time audio synthesisStrudel/Tidal CyclesProduction
Motion-conditioned generationCC-MotionGen DiffusionDevelopment
Semantic motion retrievalRAG++ with FAISSDevelopment
Cross-platform appsTauri, SwiftUI, Next.jsProduction

---

2. System Architecture Overview

┌─────────────────────────────────────────────────────────────────────────────────┐
│                           COMP-CORE SYSTEM ARCHITECTURE                          │
├─────────────────────────────────────────────────────────────────────────────────┤
│                                                                                  │
│  ┌─────────────────────────────────────────────────────────────────────────┐    │
│  │                         APPLICATION LAYER                                │    │
│  │  ┌─────────────┐  ┌─────────────────┐  ┌──────────────────────────┐    │    │
│  │  │ TrajectoryOS│  │ EchelonCapture  │  │     CC-Dashboard         │    │    │
│  │  │   Desktop   │  │      iOS        │  │        Web               │    │    │
│  │  │   (Tauri)   │  │   (SwiftUI)     │  │      (Next.js)           │    │    │
│  │  └──────┬──────┘  └────────┬────────┘  └────────────┬─────────────┘    │    │
│  └─────────┼──────────────────┼────────────────────────┼───────────────────┘    │
│            │                  │                        │                         │
│  ┌─────────┴──────────────────┴────────────────────────┴───────────────────┐    │
│  │                        INTEGRATION LAYER                                 │    │
│  │  ┌─────────────────┐  ┌──────────────────┐  ┌─────────────────────┐    │    │
│  │  │   WebSocket     │  │   REST APIs      │  │   Cloud Sync        │    │    │
│  │  │   Streaming     │  │   (trajectory)   │  │   (GCS/S3)          │    │    │
│  │  └────────┬────────┘  └────────┬─────────┘  └──────────┬──────────┘    │    │
│  └───────────┼────────────────────┼───────────────────────┼────────────────┘    │
│              │                    │                       │                      │
│  ┌───────────┴────────────────────┴───────────────────────┴────────────────┐    │
│  │                          CORE SERVICES                                   │    │
│  │                                                                          │    │
│  │  ┌──────────────────────────────────────────────────────────────────┐  │    │
│  │  │                    MOTION CAPTURE PIPELINE                        │  │    │
│  │  │  ┌─────────────┐      ┌─────────────┐      ┌─────────────────┐  │  │    │
│  │  │  │  MediaPipe  │──┬──▶│   Fusion    │──┬──▶│   Skeleton      │  │  │    │
│  │  │  │  (Camera)   │  │   │   Engine    │  │   │   Mapping       │  │  │    │
│  │  │  └─────────────┘  │   └─────────────┘  │   └─────────────────┘  │  │    │
│  │  │  ┌─────────────┐  │                    │                        │  │    │
│  │  │  │   Mocopi    │──┘                    │                        │  │    │
│  │  │  │   (IMU)     │                       │                        │  │    │
│  │  │  └─────────────┘                       │                        │  │    │
│  │  └────────────────────────────────────────┼────────────────────────┘  │    │
│  │                                           │                            │    │
│  │  ┌────────────────────────────────────────┼────────────────────────┐  │    │
│  │  │                    AUDIO SYNTHESIS                              │  │    │
│  │  │                                        ▼                        │  │    │
│  │  │  ┌─────────────┐      ┌─────────────────┐      ┌────────────┐  │  │    │
│  │  │  │  Conductor  │◀─────│   Motion-to-    │◀─────│  Skeleton  │  │  │    │
│  │  │  │   Engine    │      │   Audio Map     │      │   State    │  │  │    │
│  │  │  └──────┬──────┘      └─────────────────┘      └────────────┘  │  │    │
│  │  │         │                                                       │  │    │
│  │  │         ▼                                                       │  │    │
│  │  │  ┌─────────────┐      ┌─────────────────┐                      │  │    │
│  │  │  │   Strudel   │─────▶│   Web Audio     │──────▶ 🔊 Audio Out  │  │    │
│  │  │  │   Patterns  │      │   API           │                      │  │    │
│  │  │  └─────────────┘      └─────────────────┘                      │  │    │
│  │  └────────────────────────────────────────────────────────────────┘  │    │
│  │                                                                       │    │
│  │  ┌────────────────────────────────────────────────────────────────┐  │    │
│  │  │                    ML / GENERATION                              │  │    │
│  │  │  ┌─────────────┐      ┌─────────────────┐      ┌────────────┐  │  │    │
│  │  │  │ CC-MotionGen│◀─────│   RAG++         │◀─────│  Motion    │  │  │    │
│  │  │  │  Diffusion  │      │   Retrieval     │      │  Phrases   │  │  │    │
│  │  │  └──────┬──────┘      └─────────────────┘      └────────────┘  │  │    │
│  │  │         │                                                       │  │    │
│  │  │         ▼                                                       │  │    │
│  │  │  ┌─────────────────────────────────────────────────────────┐   │  │    │
│  │  │  │              Generated Motion Sequences                  │   │  │    │
│  │  │  └─────────────────────────────────────────────────────────┘   │  │    │
│  │  └────────────────────────────────────────────────────────────────┘  │    │
│  └───────────────────────────────────────────────────────────────────────┘    │
│                                                                                  │
│  ┌───────────────────────────────────────────────────────────────────────┐    │
│  │                         DATA LAYER                                     │    │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  │    │
│  │  │   Prisma    │  │   SQLite    │  │   FAISS     │  │   GCS/S3    │  │    │
│  │  │   (ORM)     │  │   (Local)   │  │   (Vector)  │  │   (Cloud)   │  │    │
│  │  └─────────────┘  └─────────────┘  └─────────────┘  └─────────────┘  │    │
│  └───────────────────────────────────────────────────────────────────────┘    │
│                                                                                  │
└─────────────────────────────────────────────────────────────────────────────────┘

---

3. Core Subsystems

3.1 Motion Capture Pipeline

The motion capture system provides dual-source tracking with sensor fusion capabilities.

3.1.1 MediaPipe Integration

Location: `apps/web/cc-dashboard/src/lib/mediapipe/`

mediapipe/
├── core/
│   ├── EventEmitter.ts      # Type-safe pub/sub system
│   ├── CameraService.ts     # Webcam lifecycle management
│   └── index.ts
├── analyzers/
│   ├── BaseAnalyzer.ts      # Abstract base with smoothing
│   ├── FaceAnalyzer.ts      # Expression detection
│   ├── HandAnalyzer.ts      # Gesture recognition
│   ├── PoseAnalyzer.ts      # Body pose analysis
│   └── index.ts
├── pipeline/
│   └── HolisticPipeline.ts  # Orchestrates all analyzers
├── types.ts                  # Shared type definitions
├── MediaPipeService.ts       # Legacy singleton service
└── useMediaPipe.ts          # React hooks

Architecture Pattern: Plugin-based modular design

typescript
// Modern API Usage
import { HolisticPipeline } from '@/lib/mediapipe'

const pipeline = new HolisticPipeline({
  face: { smoothing: 0.3, detectBlinks: true },
  hands: { detectGestures: true },
  pose: { smoothing: 0.5 }
})

pipeline.on('face', (face) => {
  console.log(face.smileIntensity, face.eyeOpenLeft)
})

pipeline.on('hands', (hands) => {
  console.log(hands.left?.gesture, hands.right?.openness)
})

pipeline.on('pose', (pose) => {
  console.log(pose.bodyLean, pose.armSpread)
})

await pipeline.initialize(videoElement)
pipeline.start()

Landmark Count: 543 total
- Face: 468 landmarks
- Pose: 33 landmarks
- Hands: 21 landmarks × 2 = 42 landmarks

3.1.2 Mocopi Integration

Location: `apps/web/cc-dashboard/src/lib/mocopi/`

mocopi/
├── types.ts                 # Mocopi data structures
├── useMocopiStream.ts       # WebSocket connection hook
├── MocopiLimbFusion.ts      # IMU sensor fusion
├── conductorAdapter.ts      # Bridge to Conductor
└── index.ts

Sensor Configuration:

SensorPlacementData
HEADForeheadQuaternion + Accel
BODYChest/HipQuaternion + Accel
L_WRISTLeft wristQuaternion + Accel
R_WRISTRight wristQuaternion + Accel
L_ANKLELeft ankleQuaternion + Accel
R_ANKLERight ankleQuaternion + Accel

Data Flow:

Mocopi App (iOS)
      │
      ▼ UDP (14ch BVH)
┌─────────────────┐
│  BVH Sender     │
│  (macOS App)    │
└────────┬────────┘
         │ WebSocket
         ▼
┌─────────────────┐
│  Mocopi Relay   │
│  (VPS/Cloud)    │
└────────┬────────┘
         │ WebSocket
         ▼
┌─────────────────┐
│  CC-Dashboard   │
│  (Browser)      │
└─────────────────┘

3.1.3 Sensor Fusion

Location: `apps/web/cc-dashboard/src/lib/mocopi/MocopiLimbFusion.ts`

Combines MediaPipe camera data with Mocopi IMU data for enhanced accuracy:

typescript
interface FusedSkeletonState {
  // From Mocopi (high frequency, orientation-accurate)
  limbOrientations: Map<LimbId, Quaternion>
  limbAngularVelocities: Map<LimbId, Vector3>

  // From MediaPipe (position-accurate, visual)
  jointPositions: Map<JointId, Vector3>
  faceLandmarks: Vector3[]
  handLandmarks: { left: Vector3[], right: Vector3[] }

  // Fused outputs
  confidence: number
  timestamp: number
}

---

3.2 Audio Synthesis System

3.2.1 Conductor Engine

Location: `apps/web/cc-dashboard/src/lib/conductor/`

The Conductor orchestrates musical sections based on motion trajectories.

conductor/
├── ConductorEngine.ts       # Main orchestrator
├── SectionState.ts          # Musical section management
├── TrajectoryPredictor.ts   # Motion trajectory analysis
├── types.ts                 # Type definitions
└── index.ts

State Machine:

                    ┌─────────────────┐
                    │     IDLE        │
                    └────────┬────────┘
                             │ motion detected
                             ▼
                    ┌─────────────────┐
            ┌───────│    BUILDUP      │───────┐
            │       └────────┬────────┘       │
            │                │ energy > 0.7   │ energy < 0.3
            │                ▼                │
            │       ┌─────────────────┐       │
            │       │     DROP        │       │
            │       └────────┬────────┘       │
            │                │ sustain < 8s   │
            │                ▼                │
            │       ┌─────────────────┐       │
            └──────▶│   BREAKDOWN     │◀──────┘
                    └────────┬────────┘
                             │ motion stops
                             ▼
                    ┌─────────────────┐
                    │    OUTRO        │
                    └─────────────────┘

3.2.2 Strudel Integration

Location: Multiple locations for platform-specific implementations

# Web (Dashboard)
apps/web/cc-dashboard/src/lib/strudel/
├── MotionStrudel.ts         # Motion-to-pattern mapping
└── PatternTemplates.ts      # Pre-defined patterns

# iOS (EchelonCapture)
apps/ios/EchelonCapture/EchelonCapture/Services/
└── StrudelEngine.swift      # Native Strudel bridge

# Desktop (Echelon Tauri)
apps/desktop/cc-echelon/apps/echelon-tauri/src/
├── audio/StrudelEngine.js
└── hooks/useStrudelEngine.js

Pattern Mapping:

javascript
// Example: Arm movement controls filter cutoff
const motionToAudio = {
  armHeight: {
    min: 0, max: 1,
    target: 'lpf',
    range: [200, 8000]  // Hz
  },
  bodyEnergy: {
    min: 0, max: 1,
    target: 'gain',
    range: [0.3, 1.0]
  },
  handGesture: {
    'fist': { pattern: 'bd sd bd sd' },
    'open': { pattern: 'bd hh sd hh' },
    'point': { pattern: 'bd [hh hh] sd [hh oh]' }
  }
}

---

3.3 Machine Learning Systems

3.3.1 CC-MotionGen

Location: `core/cc-ml/cc_motiongen/`

Diffusion-based motion generation conditioned on music features.

cc_motiongen/
├── model/
│   ├── diffusion.py         # DDPM implementation
│   ├── unet.py              # U-Net architecture
│   ├── decoder.py           # Motion decoder
│   └── conditioning.py      # Music conditioning
├── inference/
│   ├── sampler.py           # DDPM sampling
│   ├── mpms_sampler.py      # Multi-Person Motion Sampler
│   ├── postprocess.py       # Output processing
│   └── selection.py         # Best sample selection
├── training/
│   ├── trainer.py           # Training loop
│   └── losses.py            # Loss functions
├── data/
│   ├── dataset.py           # Data loading
│   └── loader.py            # Batch preparation
├── evaluation/
│   ├── benchmarks.py        # Evaluation metrics
│   └── harness.py           # Testing harness
└── config.py                # Configuration

Model Architecture:

┌─────────────────────────────────────────────────────────────────┐
│                      CC-MotionGen Pipeline                       │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────────┐                                               │
│  │ Music Audio  │──────┐                                        │
│  └──────────────┘      │                                        │
│                        ▼                                        │
│  ┌──────────────┐  ┌──────────────┐                            │
│  │ Music        │  │ Jukebox      │                            │
│  │ Embeddings   │◀─│ Encoder      │                            │
│  └──────┬───────┘  └──────────────┘                            │
│         │                                                        │
│         ▼                                                        │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │                 Diffusion U-Net                           │  │
│  │  ┌─────────┐    ┌─────────┐    ┌─────────┐              │  │
│  │  │ Down    │───▶│ Middle  │───▶│  Up     │              │  │
│  │  │ Blocks  │    │ Block   │    │ Blocks  │              │  │
│  │  └─────────┘    └─────────┘    └─────────┘              │  │
│  │       ▲              ▲              │                     │  │
│  │       │              │              │                     │  │
│  │  ┌────┴──────────────┴──────────────┘                    │  │
│  │  │  Cross-Attention (Music Conditioning)                  │  │
│  │  └────────────────────────────────────────────────────┘  │  │
│  └──────────────────────────────────────────────────────────┘  │
│         │                                                        │
│         ▼                                                        │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────────┐  │
│  │ Motion       │  │ Temporal     │  │ Generated Motion     │  │
│  │ Decoder      │─▶│ Smoothing    │─▶│ Sequence (T×J×3)     │  │
│  └──────────────┘  └──────────────┘  └──────────────────────┘  │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Key Parameters:

ParameterValueDescription
Sequence Length196 frames~6.5s at 30fps
Joint Count22SMPL skeleton
Latent Dim512Diffusion latent
Diffusion Steps1000Training steps
Inference Steps50DDIM accelerated

3.3.2 RAG++ Policy

Location: `core/cc-core/cc_core/policy/rag_motionphrase/`

Retrieval-Augmented Generation for motion priors.

rag_motionphrase/
├── retriever.py             # FAISS-based retrieval
├── reranker.py              # Cross-encoder reranking
├── prior_builder.py         # Motion prior construction
├── cache.py                 # LRU caching
├── index_store.py           # Index management
├── config.py                # Configuration
├── schemas.py               # Pydantic models
├── service.py               # Main service
└── __init__.py

RAG++ Flow:

┌─────────────────────────────────────────────────────────────────┐
│                        RAG++ Pipeline                            │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  Query: "energetic dance with arm waves"                        │
│                    │                                             │
│                    ▼                                             │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │              1. Dense Retrieval (FAISS)                   │  │
│  │  ┌─────────┐      ┌─────────────┐      ┌─────────────┐  │  │
│  │  │ Query   │─────▶│ Embedding   │─────▶│ Top-K       │  │  │
│  │  │ Encoder │      │ (768-dim)   │      │ Retrieval   │  │  │
│  │  └─────────┘      └─────────────┘      └──────┬──────┘  │  │
│  └───────────────────────────────────────────────┼──────────┘  │
│                                                   │              │
│                                                   ▼              │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │              2. Cross-Encoder Reranking                   │  │
│  │  ┌─────────────────────────────────────────────────────┐ │  │
│  │  │  Score each (query, motion_phrase) pair             │ │  │
│  │  │  Reorder by relevance score                         │ │  │
│  │  └──────────────────────────────────────────┬──────────┘ │  │
│  └─────────────────────────────────────────────┼────────────┘  │
│                                                 │                │
│                                                 ▼                │
│  ┌──────────────────────────────────────────────────────────┐  │
│  │              3. Prior Construction                        │  │
│  │  ┌─────────────────────────────────────────────────────┐ │  │
│  │  │  Weighted blend of top motion phrases               │ │  │
│  │  │  Temporal alignment and interpolation               │ │  │
│  │  │  Output: Motion prior for diffusion                 │ │  │
│  │  └─────────────────────────────────────────────────────┘ │  │
│  └──────────────────────────────────────────────────────────┘  │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

---

3.4 Skeleton System

Location: `core/cc-core/cc_core/skeleton/`

Unified skeleton representation for cross-platform motion data.

skeleton/
├── pose_frame.py            # Single frame representation
├── mapping.py               # Skeleton mapping utilities
├── limb_windows.py          # Temporal windowing
├── derived_kinematics.py    # Velocity, acceleration
└── __init__.py

Skeleton Hierarchy:

                    ROOT (HIPS)
                        │
          ┌─────────────┼─────────────┐
          │             │             │
       SPINE         L_HIP         R_HIP
          │             │             │
       SPINE1        L_KNEE        R_KNEE
          │             │             │
       SPINE2        L_ANKLE       R_ANKLE
          │             │             │
       NECK          L_FOOT        R_FOOT
          │
       HEAD
          │
    ┌─────┴─────┐
    │           │
L_SHOULDER  R_SHOULDER
    │           │
L_ELBOW     R_ELBOW
    │           │
L_WRIST     R_WRIST
    │           │
L_HAND      R_HAND

---

4. Application Layer

4.1 TrajectoryOS Desktop (Tauri)

Location: `apps/tauri-desktop/`

Full-featured desktop application for life trajectory planning and motion capture.

tauri-desktop/
├── src/
│   ├── components/
│   │   ├── skills/              # Skill graph, learning paths
│   │   │   ├── SkillGraph/
│   │   │   ├── SkillDecay/
│   │   │   ├── LearningPaths/
│   │   │   ├── Competency/
│   │   │   └── PhysicsIntegration/
│   │   ├── speak/               # Voice capture integration
│   │   ├── tabs/                # Main navigation tabs
│   │   └── charts/              # Data visualizations
│   ├── lib/
│   │   ├── database.ts          # SQLite operations
│   │   ├── tauri.ts             # Tauri IPC
│   │   └── hooks/               # React hooks
│   └── App.tsx
├── src-tauri/
│   ├── src/
│   │   ├── main.rs              # Tauri entry
│   │   ├── commands.rs          # IPC commands
│   │   └── database.rs          # Rust database ops
│   └── tauri.conf.json
└── package.json

Features:

FeatureDescriptionStatus
Skill GraphVisual skill dependency trackingProduction
Skill DecayEbbinghaus-based retention modelingProduction
Learning PathsAI-generated learning roadmapsProduction
Voice CapturesSpeak integration for audio journalingProduction
Prompt LogsClaude conversation history syncProduction
Daily ReflectionGuided journaling with AIProduction
Physics SimulationLife trajectory physics engineProduction

4.2 EchelonCapture (iOS)

Location: `apps/ios/EchelonCapture/`

iOS app for motion capture sessions with Mocopi integration.

EchelonCapture/
├── EchelonCaptureApp.swift
├── Views/
│   ├── MainView.swift
│   ├── StreamView.swift
│   ├── SettingsView.swift
│   ├── PerformView.swift
│   ├── SensorDataView.swift
│   └── Session/
│       ├── SessionLobbyView.swift
│       ├── LiveCaptureView.swift
│       └── ContractDebugOverlay.swift
├── Services/
│   ├── ComprehensiveSensorManager.swift
│   ├── MotionStreamer.swift
│   ├── WebSocketService.swift
│   ├── StrudelEngine.swift
│   ├── LatentStreamService.swift
│   └── Session/
│       ├── SessionCompiler.swift
│       ├── SessionReplayEngine.swift
│       └── InstrumentStreamService.swift
├── Models/
│   └── Session/
│       ├── SessionDataModel.swift
│       └── InstrumentModels.swift
└── Audio/
    └── InstrumentAudioEngine.swift

Capabilities:

FeatureDescriptionStatus
Device MotionAccelerometer, gyroscope captureProduction
Session RecordingFull motion capture sessionsProduction
Live StreamingReal-time WebSocket streamingProduction
Strudel AudioEmbedded audio synthesisDevelopment
Session ReplayPlayback recorded sessionsProduction
Multi-DeviceCoordinate multiple iOS devicesProduction

4.3 CC-Dashboard (Web)

Location: `apps/web/cc-dashboard/`

Next.js web application for motion visualization and audio control.

cc-dashboard/
├── src/
│   ├── app/
│   │   ├── (dashboard)/
│   │   │   ├── live/            # Real-time visualization
│   │   │   ├── trainer/         # ML model training UI
│   │   │   ├── planner/         # Session planning
│   │   │   ├── rekordbox/       # DJ integration
│   │   │   └── body/            # Full body tracking
│   │   └── mocopi/              # Mocopi-specific view
│   ├── components/
│   │   ├── mediapipe/           # MediaPipe visualizations
│   │   ├── webviz/              # 3D visualizations
│   │   ├── conductor/           # Audio control panels
│   │   └── viz/                 # General visualizations
│   ├── lib/
│   │   ├── mediapipe/           # MediaPipe integration
│   │   ├── mocopi/              # Mocopi integration
│   │   ├── conductor/           # Conductor engine
│   │   ├── strudel/             # Strudel patterns
│   │   └── instrument/          # Instrument control
│   └── store/
│       ├── vizStore.ts          # Visualization state
│       ├── conductorStore.ts    # Conductor state
│       └── instrumentStore.ts   # Instrument state
└── package.json

Routes:

RouteDescription
`/`Landing with overview
`/live`Real-time motion + audio
`/body`Full body MediaPipe tracking
`/mocopi`Mocopi sensor dashboard
`/trainer`ML training interface
`/planner`Session planning
`/rekordbox`DJ software integration

---

5. Data Flow Architecture

5.1 Real-Time Motion-to-Audio Flow

┌─────────────────────────────────────────────────────────────────────────────┐
│                        REAL-TIME DATA FLOW                                   │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  INPUT SOURCES                                                               │
│  ═══════════════                                                            │
│                                                                              │
│  ┌─────────────┐   ┌─────────────┐   ┌─────────────┐                       │
│  │   Webcam    │   │   Mocopi    │   │   iPhone    │                       │
│  │  (30 fps)   │   │  (60 Hz)    │   │   Sensors   │                       │
│  └──────┬──────┘   └──────┬──────┘   └──────┬──────┘                       │
│         │                 │                 │                                │
│         ▼                 ▼                 ▼                                │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    CAPTURE LAYER (16-60 Hz)                          │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────────┐ │   │
│  │  │  MediaPipe  │  │   Mocopi    │  │    CoreMotion/CMMotion      │ │   │
│  │  │  Holistic   │  │   Parser    │  │    Manager                  │ │   │
│  │  └──────┬──────┘  └──────┬──────┘  └─────────────┬───────────────┘ │   │
│  └─────────┼────────────────┼───────────────────────┼──────────────────┘   │
│            │                │                       │                        │
│            └────────────────┼───────────────────────┘                        │
│                             ▼                                                │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    FUSION LAYER (30 Hz)                              │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐│   │
│  │  │  Kalman Filter / Complementary Filter                           ││   │
│  │  │  - Mocopi orientation (high weight)                             ││   │
│  │  │  - MediaPipe position (high weight)                             ││   │
│  │  │  - iOS acceleration (supplementary)                             ││   │
│  │  └──────────────────────────────────────┬──────────────────────────┘│   │
│  └─────────────────────────────────────────┼────────────────────────────┘   │
│                                            │                                 │
│                                            ▼                                 │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    ANALYSIS LAYER (30 Hz)                            │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  ┌───────────┐  │   │
│  │  │  Skeleton   │  │   Derived   │  │   Gesture   │  │  Energy   │  │   │
│  │  │   State     │  │ Kinematics  │  │   Detect    │  │  Metrics  │  │   │
│  │  │             │  │  (vel,acc)  │  │             │  │           │  │   │
│  │  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘  └─────┬─────┘  │   │
│  └─────────┼────────────────┼────────────────┼───────────────┼─────────┘   │
│            │                │                │               │              │
│            └────────────────┼────────────────┼───────────────┘              │
│                             ▼                ▼                               │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    MAPPING LAYER                                     │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐│   │
│  │  │  Motion-to-Audio Parameter Mapping                              ││   │
│  │  │                                                                 ││   │
│  │  │  armHeight     ────▶  filter.cutoff   [200-8000 Hz]            ││   │
│  │  │  bodyEnergy    ────▶  master.gain     [0.3-1.0]                ││   │
│  │  │  handGesture   ────▶  pattern.select  [kick,snare,hihat...]    ││   │
│  │  │  bodyLean      ────▶  pan.position    [-1.0 to 1.0]            ││   │
│  │  │  armSpread     ────▶  reverb.wet      [0.0-0.8]                ││   │
│  │  │  legEnergy     ────▶  tempo.adjust    [0.8-1.2×]               ││   │
│  │  └──────────────────────────────────────┬──────────────────────────┘│   │
│  └─────────────────────────────────────────┼────────────────────────────┘   │
│                                            │                                 │
│                                            ▼                                 │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                    SYNTHESIS LAYER                                   │   │
│  │  ┌─────────────┐      ┌─────────────┐      ┌─────────────────────┐ │   │
│  │  │  Conductor  │─────▶│   Strudel   │─────▶│     Web Audio       │ │   │
│  │  │   Engine    │      │   Pattern   │      │       API           │ │   │
│  │  │             │      │   Engine    │      │                     │ │   │
│  │  └─────────────┘      └─────────────┘      └──────────┬──────────┘ │   │
│  └───────────────────────────────────────────────────────┼─────────────┘   │
│                                                          │                  │
│                                                          ▼                  │
│                                                    ┌─────────────┐          │
│                                                    │  🔊 Audio   │          │
│                                                    │   Output    │          │
│                                                    └─────────────┘          │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

5.2 ML Generation Flow

┌─────────────────────────────────────────────────────────────────────────────┐
│                        ML GENERATION FLOW                                    │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                         INPUT                                        │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────────┐ │   │
│  │  │   Music     │  │   Text      │  │   Motion Seed               │ │   │
│  │  │   Audio     │  │   Prompt    │  │   (optional)                │ │   │
│  │  └──────┬──────┘  └──────┬──────┘  └─────────────┬───────────────┘ │   │
│  └─────────┼────────────────┼───────────────────────┼──────────────────┘   │
│            │                │                       │                        │
│            ▼                ▼                       │                        │
│  ┌─────────────────────────────────────────────────┼────────────────────┐   │
│  │              CONDITIONING                        │                    │   │
│  │  ┌─────────────┐  ┌─────────────┐              │                    │   │
│  │  │   Jukebox   │  │   CLIP/     │              │                    │   │
│  │  │   Encoder   │  │   T5        │              │                    │   │
│  │  └──────┬──────┘  └──────┬──────┘              │                    │   │
│  │         │                │                      │                    │   │
│  │         ▼                ▼                      │                    │   │
│  │  ┌─────────────────────────────────────────────┼─────────────────┐ │   │
│  │  │              Conditioning Vector            │                  │ │   │
│  │  │              (music_emb + text_emb)         │                  │ │   │
│  │  └─────────────────────────┬───────────────────┘                  │ │   │
│  └────────────────────────────┼──────────────────────────────────────┘ │   │
│                               │                                         │   │
│                               ▼                                         │   │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │              RAG++ RETRIEVAL                                         │   │
│  │  ┌─────────────────────────────────────────────────────────────┐   │   │
│  │  │  1. Query FAISS index with conditioning vector              │   │   │
│  │  │  2. Retrieve top-K motion phrases                           │   │   │
│  │  │  3. Rerank with cross-encoder                               │   │   │
│  │  │  4. Build motion prior from top-N                           │   │   │
│  │  └─────────────────────────────────────────┬───────────────────┘   │   │
│  └────────────────────────────────────────────┼────────────────────────┘   │
│                                               │                             │
│                          ┌────────────────────┼─────────────────────┐       │
│                          │                    │                     │       │
│                          ▼                    ▼                     ▼       │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │              CC-MotionGen DIFFUSION                                  │   │
│  │                                                                      │   │
│  │  for t in [T, T-1, ..., 1]:                                         │   │
│  │      noise_pred = unet(x_t, t, conditioning, motion_prior)          │   │
│  │      x_{t-1} = denoise_step(x_t, noise_pred)                        │   │
│  │                                                                      │   │
│  │  motion_latent = x_0                                                │   │
│  │                                                                      │   │
│  └─────────────────────────────────────────┬────────────────────────────┘   │
│                                            │                                 │
│                                            ▼                                 │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │              POST-PROCESSING                                         │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────────┐ │   │
│  │  │   Motion    │  │  Temporal   │  │      Foot Contact           │ │   │
│  │  │   Decoder   │──▶  Smoothing  │──▶      Cleanup                │ │   │
│  │  └─────────────┘  └─────────────┘  └─────────────┬───────────────┘ │   │
│  └───────────────────────────────────────────────────┼──────────────────┘   │
│                                                      │                       │
│                                                      ▼                       │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │              OUTPUT                                                  │   │
│  │  ┌─────────────────────────────────────────────────────────────┐   │   │
│  │  │  Motion Sequence: (T=196, J=22, D=3)                        │   │   │
│  │  │  - Joint positions over ~6.5 seconds                        │   │   │
│  │  │  - 30 fps, SMPL skeleton format                             │   │   │
│  │  └─────────────────────────────────────────────────────────────┘   │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

---

6. API Reference

6.1 WebSocket APIs

Motion Stream (Dashboard ↔ Mocopi)

typescript
// Connection
ws://localhost:8765/mocopi

// Incoming Message Format
interface MocopiFrame {
  timestamp: number
  sensors: {
    [sensorId: string]: {
      quaternion: [w, x, y, z]
      acceleration: [x, y, z]
    }
  }
  skeleton?: {
    joints: Array<{
      name: string
      position: [x, y, z]
      rotation: [w, x, y, z]
    }>
  }
}

// Outgoing Commands
interface MocopiCommand {
  type: 'calibrate' | 'reset' | 'set_config'
  payload?: Record<string, unknown>
}

Cloud Relay (VPS)

typescript
// Connection
wss://your-vps.com:443/relay

// Client Registration
interface RegisterMessage {
  type: 'register'
  clientType: 'sender' | 'receiver'
  sessionId: string
}

// Motion Data Relay
interface RelayedFrame {
  type: 'motion'
  sessionId: string
  data: MocopiFrame
}

6.2 REST APIs

Trajectory Core Service

typescript
// Base URL: http://localhost:3001/api

// Sessions
GET    /sessions              // List sessions
POST   /sessions              // Create session
GET    /sessions/:id          // Get session
PUT    /sessions/:id          // Update session
DELETE /sessions/:id          // Delete session

// Speak Integration
GET    /speak/captures        // List voice captures
POST   /speak/captures/sync   // Sync from Speak
GET    /speak/captures/:id    // Get capture details

// Prompt Logs
GET    /prompt-logs           // List prompt logs
POST   /prompt-logs/sync      // Sync from Claude
GET    /prompt-logs/:id       // Get log details

6.3 Tauri IPC Commands

rust
// src-tauri/src/commands.rs

#[tauri::command]
async fn get_goals() -> Result<Vec<Goal>, Error>

#[tauri::command]
async fn create_goal(goal: NewGoal) -> Result<Goal, Error>

#[tauri::command]
async fn get_skills() -> Result<Vec<Skill>, Error>

#[tauri::command]
async fn update_skill_proficiency(
    skill_id: i64,
    proficiency: f64
) -> Result<Skill, Error>

#[tauri::command]
async fn get_skill_decay_predictions() -> Result<Vec<DecayPrediction>, Error>

#[tauri::command]
async fn sync_speak_captures(path: String) -> Result<SyncResult, Error>

#[tauri::command]
async fn sync_prompt_logs(path: String) -> Result<SyncResult, Error>

---

7. Deployment Architecture

7.1 Development Environment

┌─────────────────────────────────────────────────────────────────┐
│                    LOCAL DEVELOPMENT                             │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │                    Developer Machine                     │   │
│  │                                                          │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐ │   │
│  │  │   Next.js   │  │   Tauri     │  │   Xcode         │ │   │
│  │  │   Dev       │  │   Dev       │  │   Simulator     │ │   │
│  │  │  :3000      │  │  :1420      │  │                 │ │   │
│  │  └──────┬──────┘  └──────┬──────┘  └────────┬────────┘ │   │
│  │         │                │                  │           │   │
│  │         └────────────────┼──────────────────┘           │   │
│  │                          │                               │   │
│  │                          ▼                               │   │
│  │  ┌─────────────────────────────────────────────────┐   │   │
│  │  │              trajectory-core                     │   │   │
│  │  │              (Express + Prisma)                  │   │   │
│  │  │              :3001                               │   │   │
│  │  └─────────────────────────────────────────────────┘   │   │
│  │                                                          │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────┐ │   │
│  │  │   SQLite    │  │   Redis     │  │   Python venv   │ │   │
│  │  │  (local)    │  │  (optional) │  │   (cc-core)     │ │   │
│  │  └─────────────┘  └─────────────┘  └─────────────────┘ │   │
│  │                                                          │   │
│  └─────────────────────────────────────────────────────────┘   │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

7.2 Production Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                         PRODUCTION ARCHITECTURE                              │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │                         CLIENT DEVICES                               │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────────┐ │   │
│  │  │   macOS     │  │   iOS       │  │        Browser              │ │   │
│  │  │   (Tauri)   │  │   (Swift)   │  │        (Next.js)            │ │   │
│  │  └──────┬──────┘  └──────┬──────┘  └─────────────┬───────────────┘ │   │
│  └─────────┼────────────────┼───────────────────────┼──────────────────┘   │
│            │                │                       │                        │
│            │                │         HTTPS         │                        │
│            │                │                       │                        │
│  ┌─────────┼────────────────┼───────────────────────┼────────────────────┐   │
│  │         │                │                       │                    │   │
│  │         ▼                ▼                       ▼                    │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐│   │
│  │  │                    Cloudflare / CDN                             ││   │
│  │  │  ┌─────────────────┐  ┌─────────────────────────────────────┐  ││   │
│  │  │  │  Static Assets  │  │           WAF / DDoS Protection     │  ││   │
│  │  │  │  (Dashboard)    │  │                                     │  ││   │
│  │  │  └─────────────────┘  └─────────────────────────────────────┘  ││   │
│  │  └─────────────────────────────────────────────────────────────────┘│   │
│  │                              │                                       │   │
│  │                              ▼                                       │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐│   │
│  │  │                    Google Cloud Platform                        ││   │
│  │  │                                                                 ││   │
│  │  │  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐││   │
│  │  │  │   Cloud Run     │  │   Cloud Run     │  │   Vertex AI     │││   │
│  │  │  │   (API)         │  │   (ML Serving)  │  │   (Training)    │││   │
│  │  │  │                 │  │                 │  │                 │││   │
│  │  │  └────────┬────────┘  └────────┬────────┘  └─────────────────┘││   │
│  │  │           │                    │                               ││   │
│  │  │           ▼                    ▼                               ││   │
│  │  │  ┌─────────────────────────────────────────────────────────┐  ││   │
│  │  │  │                    Cloud SQL (PostgreSQL)               │  ││   │
│  │  │  └─────────────────────────────────────────────────────────┘  ││   │
│  │  │                                                                 ││   │
│  │  │  ┌─────────────────┐  ┌─────────────────────────────────────┐  ││   │
│  │  │  │   GCS Buckets   │  │         Pub/Sub                     │  ││   │
│  │  │  │   (Models/Data) │  │         (Event Queue)               │  ││   │
│  │  │  └─────────────────┘  └─────────────────────────────────────┘  ││   │
│  │  │                                                                 ││   │
│  │  └─────────────────────────────────────────────────────────────────┘│   │
│  │                                                                      │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐│   │
│  │  │                    VPS (Mocopi Relay)                           ││   │
│  │  │  ┌─────────────────────────────────────────────────────────┐   ││   │
│  │  │  │   Python WebSocket Server                               │   ││   │
│  │  │  │   - Real-time motion relay                              │   ││   │
│  │  │  │   - Session management                                  │   ││   │
│  │  │  │   - SSL termination                                     │   ││   │
│  │  │  └─────────────────────────────────────────────────────────┘   ││   │
│  │  └─────────────────────────────────────────────────────────────────┘│   │
│  │                                                                      │   │
│  └──────────────────────────────────────────────────────────────────────┘   │
│                                                                              │
└─────────────────────────────────────────────────────────────────────────────┘

---

8. Current Status

8.1 Component Status Matrix

ComponentStatusCompletionNotes
Motion Capture
MediaPipe IntegrationProduction95
Mocopi IntegrationProduction90
Sensor FusionDevelopment70
Audio Synthesis
Conductor EngineProduction90
Strudel PatternsProduction85
Motion-Audio MapProduction80
Machine Learning
CC-MotionGenDevelopment75
RAG++ RetrievalDevelopment70
Motion PhrasesDevelopment65
Applications
CC-DashboardProduction90
TrajectoryOS DesktopProduction85
EchelonCapture iOSProduction85
Infrastructure
Mocopi Cloud RelayProduction95
Trajectory Core APIProduction80
ML Training PipelineDevelopment60

8.2 Recent Milestones

DateMilestone
Dec 26, 2024Unified codebase merge (MediaPipe + MotionGen)
Dec 25, 2024RAG++ policy integration
Dec 24, 2024Mocopi cloud relay v4 deployment
Dec 22, 2024Conductor engine state machine
Dec 21, 2024TrajectoryOS Desktop skill decay
Dec 20, 2024MediaPipe modular architecture

8.3 Roadmap

Q1 2025

  • [ ] CC-MotionGen model training on Vertex AI
  • [ ] RAG++ production deployment
  • [ ] iOS App Store submission (EchelonCapture)
  • [ ] macOS App Store submission (TrajectoryOS)

Q2 2025

  • [ ] Multi-person motion capture
  • [ ] Real-time collaborative sessions
  • [ ] VR/AR integration exploration
  • [ ] Motion-to-MIDI export

Q3 2025

  • [ ] Production ML inference API
  • [ ] Motion phrase marketplace
  • [ ] Advanced audio synthesis (spatial)
  • [ ] Performance optimization

---

Appendix A: Quick Start Commands

bash
# Clone and setup
git clone [email]:Diomandeee/Comp-Core.git
cd Comp-Core

# Dashboard (Web)
cd apps/web/cc-dashboard
npm install
npm run dev  # http://localhost:3000

# TrajectoryOS (Desktop)
cd apps/tauri-desktop
npm install
npm run tauri dev

# Trajectory Core (API)
cd core/cc-trajectory/services/trajectory-core
npm install
npx prisma migrate dev
npm run dev  # http://localhost:3001

# CC-Core (Python)
cd core/cc-core
python -m venv venv
source venv/bin/activate
pip install -e .

# Mocopi Relay (VPS)
cd deploy/mocopi-relay
./setup-vps.sh
python mocopi_relay_v4.py

---

Appendix B: Environment Variables

bash
# .env.example

# API Keys
OPENAI_API_KEY=sk-...
GOOGLE_CLOUD_PROJECT=comp-core-prod

# Database
DATABASE_URL=file:./dev.db
REDIS_URL=redis://localhost:6379

# Services
TRAJECTORY_CORE_URL=http://localhost:3001
MOCOPI_RELAY_URL=wss://relay.comp-core.io

# Feature Flags
ENABLE_ML_INFERENCE=false
ENABLE_CLOUD_SYNC=true

---

Document Version: 2.0.0
Generated: December 26, 2024
Maintainer: Comp-Core Team

Promotion Decision

Promote into a technical note or architecture paper with implementation anchors.

Source Anchor

projects/Documentation/_archive/2024-12/superseded-guides/MERGED_COMP_CORE_MASTER_ARCHITECTURE.md

Detected Structure

Method · Evaluation · Code Anchors · Architecture