Grand Diomande Research · Full HTML Reader

CC-MCS Daemon Architecture

The "Living Timeline" daemon is an always-on motion processing service that runs on a GCP VM. It maintains continuous sensor alignment, anticipation computation, and gesture detection.

Embodied Trajectory Systems architecture technical paper candidate score 40 .md

Full Public Reader

CC-MCS Daemon Architecture

Overview

The "Living Timeline" daemon is an always-on motion processing service that runs on a GCP VM. It maintains continuous sensor alignment, anticipation computation, and gesture detection.

Architecture

┌─────────────────────────────────────────────────────────────────────────────┐
│                         LIVING TIMELINE DAEMON                               │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                              │
│  Devices (iPhone/Watch/Mocopi/AirPods)                                       │
│                    │                                                         │
│                    │ UDP/HTTP                                                │
│                    ▼                                                         │
│  ┌──────────────────────────────────────────────────────────────────────┐   │
│  │                    DO Relay ([ip])                           │   │
│  │  ──────────────────────────────────────────────────────────────────  │   │
│  │  • NAT traversal for mobile devices                                   │   │
│  │  • Geographic flexibility                                             │   │
│  │  • Forwards to GCP VM via HTTP                                        │   │
│  └───────────────────────────────┬──────────────────────────────────────┘   │
│                                  │ HTTP POST                                │
│                                  ▼                                          │
│  ┌──────────────────────────────────────────────────────────────────────┐   │
│  │            GCP VM (cc-infrastructure-vm @ [ip])             │   │
│  │  ══════════════════════════════════════════════════════════════════  │   │
│  │                                                                       │   │
│  │  ┌─────────────────────────────────────────────────────────────────┐ │   │
│  │  │                     cc-mcs-headless (Rust)                       │ │   │
│  │  │  ───────────────────────────────────────────────────────────────│ │   │
│  │  │                                                                  │ │   │
│  │  │  1. INGRESS LOOP (sensor_receiver)                              │ │   │
│  │  │     ├─ HTTP POST /api/data (from DO relay)                      │ │   │
│  │  │     ├─ UDP :12351 (Mocopi direct)                               │ │   │
│  │  │     └─ Decode → Timestamp → Enqueue                             │ │   │
│  │  │                         │                                        │ │   │
│  │  │  2. FUSION LOOP (fusion_loop @ 60Hz)                            │ │   │
│  │  │     ├─ cc-collection sensor fusion                              │ │   │
│  │  │     ├─ Multi-device clock normalization                         │ │   │
│  │  │     ├─ Extended Kalman filtering                                │ │   │
│  │  │     └─ Output: FusedSkeleton                                    │ │   │
│  │  │                         │                                        │ │   │
│  │  │  3. WINDOW LOOP (anticipation_bridge @ 50Hz)                    │ │   │
│  │  │     ├─ SkeletonFrame conversion                                 │ │   │
│  │  │     ├─ Deterministic window slicing                             │ │   │
│  │  │     ├─ Coverage & validity checks                               │ │   │
│  │  │     └─ Output: MotionWindow + AnticipationPacket                │ │   │
│  │  │                         │                                        │ │   │
│  │  │  4. GESTURE LOOP (gesture_bridge)                               │ │   │
│  │  │     ├─ Full-body: GestureClassifier                             │ │   │
│  │  │     ├─ Hand: HandAnticipationKernel                             │ │   │
│  │  │     ├─ Action mapping (gesture → DJ command)                    │ │   │
│  │  │     └─ Output: GestureDetectionEvent                            │ │   │
│  │  │                         │                                        │ │   │
│  │  │  5. CONDUCTOR LOOP (conductor_bridge)                           │ │   │
│  │  │     ├─ Policy evaluation                                        │ │   │
│  │  │     ├─ Event gating                                             │ │   │
│  │  │     └─ Output: PolicySignals                                    │ │   │
│  │  │                         │                                        │ │   │
│  │  │  6. EMIT                                                         │ │   │
│  │  │     ├─ WebSocket broadcast (visualization)                      │ │   │
│  │  │     ├─ Supabase persistence (replay)                            │ │   │
│  │  │     └─ HTTP API (on-demand queries)                             │ │   │
│  │  │                                                                  │ │   │
│  │  └─────────────────────────────────────────────────────────────────┘ │   │
│  │                                                                       │   │
│  │  Ports:                                                               │   │
│  │    • 8765  - HTTP API (health, config, session)                      │   │
│  │    • 8766  - WebSocket (real-time streaming)                         │   │
│  │    • 12351 - UDP (Mocopi direct)                                     │   │
│  │                                                                       │   │
│  └──────────────────────────────────────────────────────────────────────┘   │
│                                  │                                          │
│                    ┌─────────────┼─────────────┐                            │
│                    ▼             ▼             ▼                            │
│  ┌────────────────────┐ ┌────────────────┐ ┌──────────────────────┐         │
│  │  Cloud Run         │ │  MacBook       │ │  Supabase            │         │
│  │  (RAG++/Orbit)     │ │  (Audio)       │ │  (Storage)           │         │
│  │  On-demand compute │ │  WebSocket rx  │ │  Windows, sessions   │         │
│  └────────────────────┘ └────────────────┘ └──────────────────────┘         │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘

Components

### 1. DO Relay (DigitalOcean)
- Purpose: UDP ingress, NAT traversal
- IP: [ip]
- Cost: ~$5/month
- Why: Mobile devices need a stable public endpoint

### 2. GCP VM (cc-infrastructure-vm)
- Purpose: Always-on alignment and processing daemon
- IP: [ip]
- Machine: e2-small (2 vCPU, 2GB RAM)
- Cost: ~$19/month
- Container: cc-mcs-daemon

### 3. Cloud Run Services
- Purpose: Heavy compute (RAG, training), on-demand
- orbit-server: Project orchestration, RAG proxy
- rag-plusplus: Semantic search, CognitiveTwin training
- Cost: ~$0-5/month (pay per use)

Data Flow

StageInputOutputRate
IngressRaw packetsDeviceFrameVariable
FusionDeviceFramesFusedSkeleton60Hz
WindowFusedSkeletonMotionWindow50Hz
AnticipationMotionWindowAnticipationPacket50Hz
GestureAnticipationPacketGestureEventOn detection
ConductorAnticipationPacketPolicySignals50Hz

Session Management

Sessions are managed by the daemon:

POST /session/start    → Initializes new session
POST /session/stop     → Ends session, flushes buffers
GET  /session/status   → Current session info

Session Invariants

1. Clock Reset: All device clocks re-synchronized on session start
2. Buffer Clear: All rolling buffers emptied
3. ID Generation: New session UUID minted
4. Persistence: Session metadata written to Supabase

Device Join Protocol

When a new device joins mid-session:

t=0.0s   Device sends first packet
t=0.0s   Daemon marks device as "JOINING"
t=0.0s   Clock offset estimation begins
t=0.2s   Jitter buffer accumulates samples
t=0.5s   Offset/drift stabilized
t=0.5s   Device marked as "ACTIVE"
t=0.5s   Authority weight gradually increases
t=2.0s   Device at full authority weight

Replay Stability

Every emitted window includes:

json
{
  "window_id": "w_1735567890.123_1735567891.123",
  "session_id": "uuid",
  "config_hash": "sha256(aligner_config)",
  "aligner_version": "0.1.0",
  "checksum": "crc32(frames)",
  "coverage": 0.98,
  "device_mask": ["left_iphone", "right_iphone", "watch"]
}

This ensures windows can be reproduced exactly from raw packet recordings.

Deployment

Build & Deploy

bash
cd backend/cc-mcs
./deploy-gcp-daemon.sh all

Check Status

bash
./deploy-gcp-daemon.sh status

View Logs

bash
./deploy-gcp-daemon.sh logs

SSH to VM

bash
./deploy-gcp-daemon.sh ssh

Firewall Rules

RulePortProtocolSource
allow-cc-mcs-api8765TCP[ip]/0
allow-cc-mcs-ws8766TCP[ip]/0
allow-cc-mcs-udp12351UDP[ip]/0

Environment Variables

VariableRequiredDescription
`SUPABASE_URL`YesSupabase project URL
`SUPABASE_ANON_KEY`YesSupabase anonymous key
`SENSOR_PORT`NoHTTP API port (default: 8765)
`MOCOPI_UDP_PORT`NoMocopi UDP port (default: 12351)
`PHRASE_LIBRARY_PATH`NoPath to phrase library binary
`ORBIT_SERVER_URL`NoOrbit Cloud Run URL
`RAG_SERVICE_URL`NoRAG++ Cloud Run URL
`RUST_LOG`NoLog level (default: info)

Cost Summary

ServiceMonthly Cost
DO Relay~$5
GCP VM~$19
Cloud Run~$0-5
Supabase~$0-25
Total~$24-54

Upgrade Path

More CPU/RAM

bash
gcloud compute instances stop cc-infrastructure-vm --zone=us-central1-a
gcloud compute instances set-machine-type cc-infrastructure-vm \
    --zone=us-central1-a --machine-type=e2-medium
gcloud compute instances start cc-infrastructure-vm --zone=us-central1-a

Add GPU (for ML inference)

bash
# Switch to n1-standard with GPU
gcloud compute instances set-machine-type cc-infrastructure-vm \
    --zone=us-central1-a --machine-type=n1-standard-4
gcloud compute instances add-accelerator cc-infrastructure-vm \
    --zone=us-central1-a --accelerator=type=nvidia-tesla-t4,count=1

Promotion Decision

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

Source Anchor

Comp-Core/backend/cc-mcs/DAEMON_ARCHITECTURE.md

Detected Structure

Method · Evaluation · Architecture