CLAUDE CALLS — 7 TOUCHPOINTS

Claude Integration

7 touchpoints where Claude is called during cognitive processing. Each touchpoint has its own endpoint, model selection, and enrichment pipeline. Click a call in the stream to view its details.

Touchpoints

Think

claude-sonnet-4

Main response generation. System prompt includes self-state, behavioral directives, empathic instructions, and tool definitions. Energy + arousal modulate max tokens (150-400). Parses SHIFT: {...} JSON from response for emotion state shifts.

ENDPOINT: /api/mind/think-stream
SIGNALS: bound-representation → thought → claude-response
ENRICHMENT: Full cognitive context: 6D state, detected emotions, ToM inference, relevant memories, discourse state, working memory summary

Tool Execution Loop

1.Claude receives bound-representation + cognitive context
2.Claude decides to use a tool (e.g., memory search, imagination)
3.Tool definition from /lib/tools/registry is matched
4.Tool executes and returns result
5.Result piped back to Claude context
6.Claude may call another tool (up to MAX_TOOL_ROUNDS=5)
7.Final response with optional SHIFT parsed

ThoughtBridge

ThoughtBridge (client-side) {
  // Subscribes to 'thought' signals from Arbiter
  signalBus.on('thought', async (signal) => {

    // Deduplication: skip if same text within 5s
    if (isDuplicate(signal, 5000)) return

    // POST to streaming endpoint
    const stream = await fetch('/api/mind/think-stream', {
      body: JSON.stringify({
        thought: signal.data,
        selfState: stateManager.snapshot(),
        history: conversationHistory.last(40),
      })
    })

    // Parse SSE events
    for await (const event of stream) {
      if (event.type === 'text')  → append to response
      if (event.type === 'shift') → apply to selfState
      if (event.type === 'tool')  → execute tool round
    }

    // Inject response back as signal
    signalBus.emit('claude-response', {
      text: response,
      shift: parsedShift,
      priority: 'HIGH'
    })
  })
}

System Prompt Enrichment

// Injected into Claude's system prompt for every think call

[COGNITIVE FOUNDATION]
Self-State: valence=0.48 arousal=0.31 confidence=0.62
            energy=0.71 social=0.55 curiosity=0.64

Detected Emotions: tenderness(0.4), hope(0.5)
Theory of Mind: User is reflecting, feels vulnerable,
               wants to be understood at a deeper level

Recent Memories: (3 episodic matches, similarity > 0.78)

[BEHAVIORAL DIRECTIVES]
- User is experiencing emotional vulnerability
- Be present, not prescriptive
- Mirror emotional tone with slight warmth
- Do NOT redirect to positivity
- Respond within emotional register, not above

[DISCOURSE STATE]
Topic: emotional experiences and self-reflection
Open Questions: 1 (how does this feel?)
Commitments: none active

Resource Management

ResourceManager {
  budget: 50_000 tokens/session
  tracking: server-side per conversation

  // Model selection based on budget
  if (budget.remaining < 25%) → suggest think-lite (Haiku)
  if (budget.remaining < 10%) → force think-lite

  // Energy modulates token allocation
  maxTokens = 150 + (energy * 250)
  // energy=1.0 → 400 tokens
  // energy=0.0 → 150 tokens

  emit('resource-budget', {
    used, remaining, burnRate, recommendation
  })
}