# hydrosemicon/kokomi_kernel architecture

> Architecture diagram of the GitHub repository hydrosemicon/kokomi_kernel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hydrosemicon/kokomi_kernel
- Repository: https://github.com/hydrosemicon/kokomi_kernel

## Overview

Kokomi Kernel is the embodied-state and action-control layer for the Waifu 3.0 research platform. Its core workflow normalizes environment and interaction events into observations, maintains freshness-aware state and derived world facts, then assembles bounded cognitive context for an LLM. Audited responses pass through action control; execution outcomes return as observations. Separate capabilities cover persistent memory and social state, ASR and TTS, drive-based proposals, and operational controls. README documents the overall loop; source-index import references and excerpts support selected internal links, while unsampled details are not inferred.

Main entry points: [`alice.js`](https://github.com/hydrosemicon/kokomi_kernel/blob/main/alice.js) (Kernel runtime), [`src/behavior/index.js`](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/index.js) (Behavior architecture), [`src/behavior/context-composer.js`](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/context-composer.js) (Context composer), [`src/behavior/observation.js`](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/observation.js) (Observation validation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and interfaces"]
  node_alice["Kernel runtime<br/>[alice.js]"]
  node_dashboard["Operations dashboard<br/>[app.js]"]
end

subgraph group_behavior["Behavior and state"]
  node_observations["Observation validation<br/>[observation.js]"]
  node_state[("Persistent state<br/>[state-store.js]")]
  node_world["World model<br/>[world-model.js]"]
  node_drives["Drive system<br/>[drive-system.js]"]
  node_proposals["Behavior proposals"]
  node_behavior_arch["Behavior architecture<br/>[index.js]"]
end

subgraph group_cognition["Cognition and persistence"]
  node_context["Context composer"]
  node_protocol["Response protocol<br/>[llm-response.js]"]
  node_memory[("Memory store<br/>[memory-store.js]")]
  node_social[("Social state")]
  node_event_store[("Event store<br/>[event-store.js]")]
  node_turns[("Turn registry<br/>[turn-registry.js]")]
end

subgraph group_speech["Speech I/O"]
  node_asr["ASR transcript<br/>[asr-transcript.js]"]
  node_capture["Capture coordinator"]
  node_echo["Echo guard<br/>[echo-guard.js]"]
  node_tts_adapter["TTS adapter<br/>[tts-adapter.js]"]
  node_elevenlabs["ElevenLabs provider<br/>[elevenlabs-tts.js]"]
  node_filler["Filler controller"]
  node_filler_manifest["Filler manifest<br/>[filler-manifest.js]"]
  node_playback["Playback coordinator"]
end

subgraph group_execution["Actions and world"]
  node_action_gate["Action gate<br/>[action-gate.js]"]
end

node_environment(("Physical and social environment"))
node_llm(("LLM cognition"))
node_hardware{{"Robot hardware and services"}}

node_environment -->|"sends events"| node_observations
node_observations -->|"reduces observations"| node_state
node_state -->|"derives facts"| node_world
node_state -->|"supplies inputs"| node_drives
node_world -->|"supplies facts"| node_drives
node_world -->|"informs proposals"| node_proposals
node_drives -->|"informs proposals"| node_proposals
node_state -->|"projects state"| node_context
node_world -->|"projects facts"| node_context
node_drives -->|"projects drives"| node_context
node_proposals -->|"includes options"| node_context
node_memory -->|"supplies memories"| node_context
node_social -->|"supplies social state"| node_context
node_context -->|"sends context"| node_llm
node_llm -->|"returns response"| node_protocol
node_protocol -->|"audits actions"| node_action_gate
node_action_gate -->|"dispatches actions"| node_hardware
node_hardware -->|"returns outcomes"| node_observations
node_alice -->|"composes runtime"| node_behavior_arch
node_behavior_arch -->|"uses validator"| node_observations
node_behavior_arch -->|"creates store"| node_state
node_behavior_arch -->|"creates model"| node_world
node_behavior_arch -->|"creates system"| node_drives
node_behavior_arch -->|"creates engine"| node_proposals
node_behavior_arch -->|"creates composer"| node_context
node_alice -->|"ingests events"| node_observations
node_alice -->|"retrieves memories"| node_memory
node_alice -->|"reads social context"| node_social
node_alice -->|"audits response"| node_protocol
node_protocol -->|"validates proposals"| node_memory
node_protocol -->|"validates proposals"| node_social
node_alice -->|"records events"| node_event_store
node_alice -->|"dispatches actions"| node_action_gate
node_alice -->|"tracks turns"| node_turns
node_capture -->|"coordinates capture"| node_asr
node_echo -->|"suppresses echo"| node_asr
node_asr -->|"forwards transcripts"| node_observations
node_alice -->|"configures ingestion"| node_asr
node_alice -->|"dispatches speech"| node_tts_adapter
node_tts_adapter -->|"delegates speech"| node_elevenlabs
node_elevenlabs -.->|"plays audio"| node_playback
node_filler -.->|"uses manifest"| node_filler_manifest
node_filler -.->|"coordinates clips"| node_playback
node_dashboard -->|"operates kernel"| node_alice

click node_alice "https://github.com/hydrosemicon/kokomi_kernel/blob/main/alice.js"
click node_dashboard "https://github.com/hydrosemicon/kokomi_kernel/blob/main/dashboard/app.js"
click node_observations "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/observation.js"
click node_state "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/state-store.js"
click node_world "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/world-model.js"
click node_drives "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/drive-system.js"
click node_proposals "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/spontaneous-behavior.js"
click node_behavior_arch "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/index.js"
click node_context "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/context-composer.js"
click node_protocol "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/protocol/llm-response.js"
click node_action_gate "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/action-gate.js"
click node_memory "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/memory/memory-store.js"
click node_social "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/social/social-state-store.js"
click node_event_store "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/event-store.js"
click node_turns "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/turn-registry.js"
click node_asr "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/asr-transcript.js"
click node_capture "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/asr-capture-coordinator.js"
click node_echo "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/echo-guard.js"
click node_tts_adapter "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/tts-adapter.js"
click node_elevenlabs "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/elevenlabs-tts.js"
click node_filler "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/filler-controller.js"
click node_filler_manifest "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/filler-manifest.js"
click node_playback "https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/playback-coordinator.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_alice,node_dashboard toneBlue
class node_observations,node_state,node_world,node_drives,node_proposals,node_behavior_arch toneAmber
class node_context,node_protocol,node_memory,node_social,node_event_store,node_turns toneMint
class node_asr,node_capture,node_echo,node_tts_adapter,node_elevenlabs,node_filler,node_filler_manifest,node_playback toneRose
class node_action_gate,node_environment,node_llm,node_hardware toneIndigo
```

## Components

### Runtime and interfaces

- [Kernel runtime](https://github.com/hydrosemicon/kokomi_kernel/blob/main/alice.js): `alice.js`
- [Operations dashboard](https://github.com/hydrosemicon/kokomi_kernel/blob/main/dashboard/app.js): `dashboard/app.js`

### Behavior and state

- [Observation validation](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/observation.js): `src/behavior/observation.js`
- [Persistent state](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/state-store.js): `src/behavior/state-store.js`
- [World model](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/world-model.js): `src/behavior/world-model.js`
- [Drive system](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/drive-system.js): `src/behavior/drive-system.js`
- [Behavior proposals](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/spontaneous-behavior.js): `src/behavior/spontaneous-behavior.js`
- [Behavior architecture](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/index.js): `src/behavior/index.js`

### Cognition and persistence

- [Context composer](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/context-composer.js): `src/behavior/context-composer.js`
- [Response protocol](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/protocol/llm-response.js): `src/protocol/llm-response.js`
- [Memory store](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/memory/memory-store.js): `src/memory/memory-store.js`
- [Social state](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/social/social-state-store.js): `src/social/social-state-store.js`
- [Event store](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/event-store.js): `src/behavior/event-store.js`
- [Turn registry](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/turn-registry.js): `src/behavior/turn-registry.js`

### Speech I/O

- [ASR transcript](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/asr-transcript.js): `src/speech/asr-transcript.js`
- [Capture coordinator](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/asr-capture-coordinator.js): `src/speech/asr-capture-coordinator.js`
- [Echo guard](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/echo-guard.js): `src/speech/echo-guard.js`
- [TTS adapter](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/tts-adapter.js): `src/speech/tts-adapter.js`
- [ElevenLabs provider](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/elevenlabs-tts.js): `src/speech/elevenlabs-tts.js`
- [Filler controller](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/filler-controller.js): `src/speech/filler-controller.js`
- [Filler manifest](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/filler-manifest.js): `src/speech/filler-manifest.js`
- [Playback coordinator](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/speech/playback-coordinator.js): `src/speech/playback-coordinator.js`

### Actions and world

- [Action gate](https://github.com/hydrosemicon/kokomi_kernel/blob/main/src/behavior/action-gate.js): `src/behavior/action-gate.js`

### Other components

- **Physical and social environment**
- **LLM cognition**
- **Robot hardware and services**

## Connections

- Physical and social environment → Observation validation: sends events (evidence: `README.md`)
- Observation validation → Persistent state: reduces observations (evidence: `README.md`)
- Persistent state → World model: derives facts (evidence: `README.md`)
- Persistent state → Drive system: supplies inputs (evidence: `README.md`)
- World model → Drive system: supplies facts (evidence: `README.md`)
- World model → Behavior proposals: informs proposals (evidence: `README.md`)
- Drive system → Behavior proposals: informs proposals (evidence: `README.md`)
- Persistent state → Context composer: projects state (evidence: `README.md`)
- World model → Context composer: projects facts (evidence: `README.md`)
- Drive system → Context composer: projects drives (evidence: `README.md`)
- Behavior proposals → Context composer: includes options (evidence: `README.md`)
- Memory store → Context composer: supplies memories (evidence: `README.md`)
- Social state → Context composer: supplies social state (evidence: `README.md`)
- Context composer → LLM cognition: sends context (evidence: `README.md`)
- LLM cognition → Response protocol: returns response (evidence: `README.md`)
- Response protocol → Action gate: audits actions (evidence: `README.md`)
- Action gate → Robot hardware and services: dispatches actions (evidence: `README.md`)
- Robot hardware and services → Observation validation: returns outcomes (evidence: `README.md`)
- Kernel runtime → Behavior architecture: composes runtime (evidence: `alice.js`)
- Behavior architecture → Observation validation: uses validator (evidence: `src/behavior/index.js`)
- Behavior architecture → Persistent state: creates store (evidence: `src/behavior/index.js`)
- Behavior architecture → World model: creates model (evidence: `src/behavior/index.js`)
- Behavior architecture → Drive system: creates system (evidence: `src/behavior/index.js`)
- Behavior architecture → Behavior proposals: creates engine (evidence: `src/behavior/index.js`)
- Behavior architecture → Context composer: creates composer (evidence: `src/behavior/index.js`)
- Kernel runtime → Observation validation: ingests events (evidence: `alice.js`)
- Kernel runtime → Memory store: retrieves memories (evidence: `alice.js`)
- Kernel runtime → Social state: reads social context (evidence: `alice.js`)
- Kernel runtime → Response protocol: audits response (evidence: `README.md`)
- Response protocol → Memory store: validates proposals (evidence: `src/protocol/llm-response.js`)
- Response protocol → Social state: validates proposals (evidence: `src/protocol/llm-response.js`)
- Kernel runtime → Event store: records events (evidence: `alice.js`)
- Kernel runtime → Action gate: dispatches actions (evidence: `alice.js`)
- Kernel runtime → Turn registry: tracks turns (evidence: `alice.js`)
- Capture coordinator → ASR transcript: coordinates capture (evidence: `README.md`)
- Echo guard → ASR transcript: suppresses echo (evidence: `src/speech/asr-transcript.js`)
- ASR transcript → Observation validation: forwards transcripts (evidence: `README.md`)
- Kernel runtime → ASR transcript: configures ingestion (evidence: `alice.js`)
- Kernel runtime → TTS adapter: dispatches speech (evidence: `README.md`)
- TTS adapter → ElevenLabs provider: delegates speech (evidence: `src/speech/tts-adapter.js`)
- ElevenLabs provider → Playback coordinator: plays audio
- Filler controller → Filler manifest: uses manifest
- Filler controller → Playback coordinator: coordinates clips
- Operations dashboard → Kernel runtime: operates kernel (evidence: `README.md`)
