# guithepc/kindle-claude architecture

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

- Interactive diagram: https://gitdiagram.com/guithepc/kindle-claude
- Repository: https://github.com/guithepc/kindle-claude

## Overview

Claudinho no Kindle is a local Claude Code activity dashboard for a jailbroken Kindle. Claude Code hooks record per-session activity, while its statusLine records usage limits; the server combines that state with token totals from local project histories, renders and rotates e-ink screens, and serves them for the Kindle to poll over Wi-Fi. The README documents the polling client and dashboard capabilities. Internal source excerpts are partial, so rendering and HTTP details remain grouped where their boundaries are not fully visible.

Main entry points: [`server.py`](https://github.com/guithepc/kindle-claude/blob/main/server.py) (Dashboard server), [`statusline.py`](https://github.com/guithepc/kindle-claude/blob/main/statusline.py) (Usage statusLine), [`setup.py`](https://github.com/guithepc/kindle-claude/blob/main/setup.py) (Hook setup), [`hook.py`](https://github.com/guithepc/kindle-claude/blob/main/hook.py) (Session hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Claude Code capture"]
  node_setup["Hook setup<br/>[setup.py]"]
  node_hook["Session hook<br/>[hook.py]"]
  node_statusline["Usage statusLine<br/>[statusline.py]"]
end

subgraph group_dashboard["Dashboard server"]
  node_session_state[("Session activity<br/>[hook.py]")]
  node_usage_state[("Usage limits<br/>[statusline.py]")]
  node_server["Dashboard server<br/>[server.py]"]
  node_session_selection["Urgency selection<br/>[server.py]"]
  node_token_totals["Token totals<br/>[server.py]"]
  node_screen_render["Screen rendering<br/>[server.py]"]
  node_sprite_frames["Chef animations<br/>[sprites.json]"]
end

subgraph group_device["Kindle display"]
  node_kindle_script["Polling script<br/>[claude_dash.sh]"]
  node_kindle(("Kindle"))
end

node_claude(("Claude Code"))
node_history[("Project histories")]

node_claude -->|"configures hooks"| node_setup
node_setup -->|"registers"| node_hook
node_setup -->|"registers"| node_statusline
node_claude -->|"sends events"| node_hook
node_hook -->|"writes"| node_session_state
node_claude -->|"sends usage"| node_statusline
node_statusline -->|"writes"| node_usage_state
node_statusline -->|"prints status"| node_claude
node_session_state -->|"reads"| node_server
node_usage_state -->|"reads"| node_server
node_history -->|"provides logs"| node_token_totals
node_server -->|"selects sessions"| node_session_selection
node_server -->|"sums usage"| node_token_totals
node_server -->|"renders dashboard"| node_screen_render
node_sprite_frames -.->|"supplies frames"| node_screen_render
node_kindle_script -->|"polls screens"| node_server
node_kindle_script -->|"updates display"| node_kindle

click node_setup "https://github.com/guithepc/kindle-claude/blob/main/setup.py"
click node_hook "https://github.com/guithepc/kindle-claude/blob/main/hook.py"
click node_statusline "https://github.com/guithepc/kindle-claude/blob/main/statusline.py"
click node_session_state "https://github.com/guithepc/kindle-claude/blob/main/hook.py"
click node_usage_state "https://github.com/guithepc/kindle-claude/blob/main/statusline.py"
click node_server "https://github.com/guithepc/kindle-claude/blob/main/server.py"
click node_session_selection "https://github.com/guithepc/kindle-claude/blob/main/server.py"
click node_token_totals "https://github.com/guithepc/kindle-claude/blob/main/server.py"
click node_screen_render "https://github.com/guithepc/kindle-claude/blob/main/server.py"
click node_sprite_frames "https://github.com/guithepc/kindle-claude/blob/main/sprites.json"
click node_kindle_script "https://github.com/guithepc/kindle-claude/blob/main/kindle/claude_dash.sh"

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_setup,node_hook,node_statusline toneBlue
class node_session_state,node_usage_state,node_server,node_session_selection,node_token_totals,node_screen_render,node_sprite_frames,node_history toneAmber
class node_kindle_script,node_kindle toneMint
class node_claude toneIndigo
```

## Components

### Claude Code capture

- [Hook setup](https://github.com/guithepc/kindle-claude/blob/main/setup.py): `setup.py`
- [Session hook](https://github.com/guithepc/kindle-claude/blob/main/hook.py): `hook.py`
- [Usage statusLine](https://github.com/guithepc/kindle-claude/blob/main/statusline.py): `statusline.py`

### Dashboard server

- [Session activity](https://github.com/guithepc/kindle-claude/blob/main/hook.py): `hook.py`
- [Usage limits](https://github.com/guithepc/kindle-claude/blob/main/statusline.py): `statusline.py`
- [Dashboard server](https://github.com/guithepc/kindle-claude/blob/main/server.py): `server.py`
- [Urgency selection](https://github.com/guithepc/kindle-claude/blob/main/server.py): `server.py`
- [Token totals](https://github.com/guithepc/kindle-claude/blob/main/server.py): `server.py`
- [Screen rendering](https://github.com/guithepc/kindle-claude/blob/main/server.py): `server.py`
- [Chef animations](https://github.com/guithepc/kindle-claude/blob/main/sprites.json): `sprites.json`

### Kindle display

- [Polling script](https://github.com/guithepc/kindle-claude/blob/main/kindle/claude_dash.sh): `kindle/claude_dash.sh`
- **Kindle**

### Other components

- **Claude Code**
- **Project histories**

## Connections

- Claude Code → Hook setup: configures hooks (evidence: `README.md`)
- Hook setup → Session hook: registers (evidence: `setup.py`)
- Hook setup → Usage statusLine: registers (evidence: `setup.py`)
- Claude Code → Session hook: sends events (evidence: `README.md`)
- Session hook → Session activity: writes (evidence: `hook.py`)
- Claude Code → Usage statusLine: sends usage (evidence: `README.md`)
- Usage statusLine → Usage limits: writes (evidence: `statusline.py`)
- Usage statusLine → Claude Code: prints status (evidence: `statusline.py`)
- Session activity → Dashboard server: reads (evidence: `README.md`)
- Usage limits → Dashboard server: reads (evidence: `README.md`)
- Project histories → Token totals: provides logs (evidence: `README.md`)
- Dashboard server → Urgency selection: selects sessions (evidence: `server.py`)
- Dashboard server → Token totals: sums usage (evidence: `README.md`)
- Dashboard server → Screen rendering: renders dashboard (evidence: `server.py`)
- Chef animations → Screen rendering: supplies frames
- Polling script → Dashboard server: polls screens (evidence: `README.md`)
- Polling script → Kindle: updates display (evidence: `README.md`)
