API CALL LOG

API Layer

All cognitive endpoints, the SHIFT protocol for emotion modulation, and body integration APIs. The left panel shows simulated API traffic.

SHIFT Protocol

// Claude embeds emotion shifts in response text
// ThoughtBridge parses and applies to SelfState

Response: "I understand how that feels..."
SHIFT: {"valence": -0.2, "social": +0.15, "arousal": +0.05}

// Applied via EMA: state = state * 0.65 + shift * 0.35
// Shift values are relative deltas, not absolute targets

Mind Endpoints

Body Endpoints

GET/api/body/manifest
Fetch body capabilities
POST/api/body/execute
Send BodyIntent for execution
GET/api/body/tasks
Poll task statuses
GET/api/body/tasks/[taskId]
Get specific task details
POST/api/body/decompose
Decompose intent → task steps

Cognitive Middleware

// Server-side enrichment pipeline
// Runs in parallel before each Claude call

cognitive-middleware.ts {
  async enrich(input) {
    const [emotion, tom, memories] = await Promise.all([
      detectEmotion(input.text),    // Haiku
      inferToM(input.context),       // Haiku
      searchMemory(input.text),      // Vector DB
    ])

    return {
      ...input,
      cognitiveFoundation: {
        detectedEmotions: emotion,
        theoryOfMind: tom,
        relevantMemories: memories,
        behavioralDirectives: buildDirectives(emotion),
      }
    }
  }
}