# csp911/poke architecture

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

- Interactive diagram: https://gitdiagram.com/csp911/poke
- Repository: https://github.com/csp911/poke

## Overview

POKE is a hub-and-edge system that turns natural-language requests into ephemeral machine code for bare-metal devices. The main path runs from a user request through hub routing, code generation and compilation, then transport to an edge kernel for execution and a result back to the hub. Other documented capabilities include persona caching, voice and event handling, distributed compute, and autonomous multi-hub operation. Some branches are supported only by the README and source index; their detailed runtime wiring is not shown in the excerpts.

Main entry points: [`hub/server.js`](https://github.com/csp911/poke/blob/main/hub/server.js) (HTTP API), [`hub/transport.js`](https://github.com/csp911/poke/blob/main/hub/transport.js) (Edge transport), [`hub/agent.js`](https://github.com/csp911/poke/blob/main/hub/agent.js) (Agent loop), [`index.js`](https://github.com/csp911/poke/blob/main/index.js) (Hub entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hub["Hub runtime"]
  node_hub_entry["Hub entry<br/>[index.js]"]
  node_http_server["HTTP API<br/>[server.js]"]
  node_agent["Agent loop<br/>[agent.js]"]
  node_llm["LLM planning<br/>[llm.js]"]
  node_compiler["Code compiler<br/>[compiler.js]"]
  node_cache[("Persona cache<br/>[asmcache.js]")]
  node_registry[("Edge registry<br/>[nodes.js]")]
  node_transport["Edge transport<br/>[transport.js]"]
  node_serial_transport["Serial transport<br/>[frame-transport.js]"]
  node_context["Edge context<br/>[context.js]"]
  node_memory[("Conversation memory<br/>[memory.js]")]
end

subgraph group_edge["Bare-metal edges"]
  node_x86["x86 edge<br/>[kernel.c]"]
  node_pi4["Pi 4 edge<br/>[kernel.c]"]
  node_arm64["ARM64 edge<br/>[kernel.c]"]
  node_rv32["RISC-V edge<br/>[kernel.c]"]
  node_esp32["ESP32-C3 edge<br/>[kernel.c]"]
  node_pi0["Pi Zero edge<br/>[kernel.c]"]
end

subgraph group_cli["User interfaces"]
  node_cli["POKE CLI<br/>[persona.js]"]
  node_burst["Distributed compute<br/>[burst.js]"]
end

subgraph group_distributed["Distributed operation"]
  node_orchestrator["Federation modes<br/>[autonomous.js]"]
  node_simulator["Edge simulator<br/>[simulator.js]"]
end

subgraph group_body["Body simulation"]
  node_coach["Voice skill coaching<br/>[coach.py]"]
  node_edge_store[("Edge skill store<br/>[edgestore.py]")]
  node_pokeedge["Simulated edge<br/>[pokeedge.py]"]
end

node_user(("User"))

node_user -->|"sends request"| node_http_server
node_hub_entry -->|"starts API"| node_http_server
node_hub_entry -->|"loads profiles"| node_registry
node_hub_entry -->|"routes edge events"| node_agent
node_http_server -->|"invokes agent"| node_agent
node_http_server -->|"generates assembly"| node_llm
node_agent -->|"compiles code"| node_compiler
node_agent -->|"sends binary"| node_transport
node_agent -->|"selects edge"| node_registry
node_http_server -->|"reads context"| node_context
node_context -->|"reads and writes"| node_transport
node_transport -->|"sends machine code"| node_x86
node_transport -->|"sends machine code"| node_pi4
node_transport -->|"sends machine code"| node_rv32
node_transport -->|"sends machine code"| node_pi0
node_serial_transport -.->|"frames commands"| node_esp32
node_http_server -.->|"uses persona cache"| node_cache
node_cli -.->|"requests transformation"| node_http_server
node_burst -.->|"dispatches workers"| node_x86
node_orchestrator -.->|"runs federation"| node_simulator
node_coach -->|"stores learned skills"| node_edge_store
node_coach -.->|"trains simulated edge"| node_pokeedge

click node_hub_entry "https://github.com/csp911/poke/blob/main/index.js"
click node_http_server "https://github.com/csp911/poke/blob/main/hub/server.js"
click node_agent "https://github.com/csp911/poke/blob/main/hub/agent.js"
click node_llm "https://github.com/csp911/poke/blob/main/hub/llm.js"
click node_compiler "https://github.com/csp911/poke/blob/main/hub/compiler.js"
click node_cache "https://github.com/csp911/poke/blob/main/hub/asmcache.js"
click node_registry "https://github.com/csp911/poke/blob/main/hub/nodes.js"
click node_transport "https://github.com/csp911/poke/blob/main/hub/transport.js"
click node_serial_transport "https://github.com/csp911/poke/blob/main/hub/frame-transport.js"
click node_context "https://github.com/csp911/poke/blob/main/hub/context.js"
click node_memory "https://github.com/csp911/poke/blob/main/hub/memory.js"
click node_x86 "https://github.com/csp911/poke/blob/main/edge/kernel/x86/kernel.c"
click node_pi4 "https://github.com/csp911/poke/blob/main/edge/kernel/pi4/kernel.c"
click node_arm64 "https://github.com/csp911/poke/blob/main/edge/kernel/arm64/kernel.c"
click node_rv32 "https://github.com/csp911/poke/blob/main/edge/kernel/rv32/kernel.c"
click node_esp32 "https://github.com/csp911/poke/blob/main/edge/kernel/esp32c3/kernel.c"
click node_pi0 "https://github.com/csp911/poke/blob/main/edge/kernel/pi0w/kernel.c"
click node_cli "https://github.com/csp911/poke/blob/main/lib/cli/persona.js"
click node_burst "https://github.com/csp911/poke/blob/main/lib/cli/burst.js"
click node_orchestrator "https://github.com/csp911/poke/blob/main/orchestration/autonomous.js"
click node_simulator "https://github.com/csp911/poke/blob/main/orchestration/simulator.js"
click node_coach "https://github.com/csp911/poke/blob/main/sim/body/coach.py"
click node_edge_store "https://github.com/csp911/poke/blob/main/sim/body/edgestore.py"
click node_pokeedge "https://github.com/csp911/poke/blob/main/sim/body/pokeedge.py"

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_hub_entry,node_http_server,node_agent,node_llm,node_compiler,node_cache,node_registry,node_transport,node_serial_transport,node_context,node_memory,node_user toneBlue
class node_x86,node_pi4,node_arm64,node_rv32,node_esp32,node_pi0 toneAmber
class node_cli,node_burst toneMint
class node_orchestrator,node_simulator toneRose
class node_coach,node_edge_store,node_pokeedge toneIndigo
```

## Components

### Hub runtime

- [Hub entry](https://github.com/csp911/poke/blob/main/index.js): `index.js`
- [HTTP API](https://github.com/csp911/poke/blob/main/hub/server.js): `hub/server.js`
- [Agent loop](https://github.com/csp911/poke/blob/main/hub/agent.js): `hub/agent.js`
- [LLM planning](https://github.com/csp911/poke/blob/main/hub/llm.js): `hub/llm.js`
- [Code compiler](https://github.com/csp911/poke/blob/main/hub/compiler.js): `hub/compiler.js`
- [Persona cache](https://github.com/csp911/poke/blob/main/hub/asmcache.js): `hub/asmcache.js`
- [Edge registry](https://github.com/csp911/poke/blob/main/hub/nodes.js): `hub/nodes.js`
- [Edge transport](https://github.com/csp911/poke/blob/main/hub/transport.js): `hub/transport.js`
- [Serial transport](https://github.com/csp911/poke/blob/main/hub/frame-transport.js): `hub/frame-transport.js`
- [Edge context](https://github.com/csp911/poke/blob/main/hub/context.js): `hub/context.js`
- [Conversation memory](https://github.com/csp911/poke/blob/main/hub/memory.js): `hub/memory.js`

### Bare-metal edges

- [x86 edge](https://github.com/csp911/poke/blob/main/edge/kernel/x86/kernel.c): `edge/kernel/x86/kernel.c`
- [Pi 4 edge](https://github.com/csp911/poke/blob/main/edge/kernel/pi4/kernel.c): `edge/kernel/pi4/kernel.c`
- [ARM64 edge](https://github.com/csp911/poke/blob/main/edge/kernel/arm64/kernel.c): `edge/kernel/arm64/kernel.c`
- [RISC-V edge](https://github.com/csp911/poke/blob/main/edge/kernel/rv32/kernel.c): `edge/kernel/rv32/kernel.c`
- [ESP32-C3 edge](https://github.com/csp911/poke/blob/main/edge/kernel/esp32c3/kernel.c): `edge/kernel/esp32c3/kernel.c`
- [Pi Zero edge](https://github.com/csp911/poke/blob/main/edge/kernel/pi0w/kernel.c): `edge/kernel/pi0w/kernel.c`

### User interfaces

- [POKE CLI](https://github.com/csp911/poke/blob/main/lib/cli/persona.js): `lib/cli/persona.js`
- [Distributed compute](https://github.com/csp911/poke/blob/main/lib/cli/burst.js): `lib/cli/burst.js`

### Distributed operation

- [Federation modes](https://github.com/csp911/poke/blob/main/orchestration/autonomous.js): `orchestration/autonomous.js`
- [Edge simulator](https://github.com/csp911/poke/blob/main/orchestration/simulator.js): `orchestration/simulator.js`

### Body simulation

- [Voice skill coaching](https://github.com/csp911/poke/blob/main/sim/body/coach.py): `sim/body/coach.py`
- [Edge skill store](https://github.com/csp911/poke/blob/main/sim/body/edgestore.py): `sim/body/edgestore.py`
- [Simulated edge](https://github.com/csp911/poke/blob/main/sim/body/pokeedge.py): `sim/body/pokeedge.py`

### Other components

- **User**

## Connections

- User → HTTP API: sends request
- Hub entry → HTTP API: starts API (evidence: `index.js`)
- Hub entry → Edge registry: loads profiles (evidence: `index.js`)
- Hub entry → Agent loop: routes edge events (evidence: `index.js`)
- HTTP API → Agent loop: invokes agent (evidence: `hub/server.js`)
- HTTP API → LLM planning: generates assembly (evidence: `hub/server.js`)
- Agent loop → Code compiler: compiles code (evidence: `hub/agent.js`)
- Agent loop → Edge transport: sends binary (evidence: `hub/agent.js`)
- Agent loop → Edge registry: selects edge (evidence: `hub/agent.js`)
- HTTP API → Edge context: reads context (evidence: `hub/server.js`)
- Edge context → Edge transport: reads and writes (evidence: `hub/context.js`)
- Edge transport → x86 edge: sends machine code
- Edge transport → Pi 4 edge: sends machine code
- Edge transport → RISC-V edge: sends machine code
- Edge transport → Pi Zero edge: sends machine code
- Serial transport → ESP32-C3 edge: frames commands
- HTTP API → Persona cache: uses persona cache (evidence: `hub/server.js`)
- POKE CLI → HTTP API: requests transformation
- Distributed compute → x86 edge: dispatches workers
- Federation modes → Edge simulator: runs federation
- Voice skill coaching → Edge skill store: stores learned skills (evidence: `sim/body/coach.py`)
- Voice skill coaching → Simulated edge: trains simulated edge (evidence: `sim/body/coach.py`)
