# nicedreamzapp/claude-code-local architecture

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

- Interactive diagram: https://gitdiagram.com/nicedreamzapp/claude-code-local
- Repository: https://github.com/nicedreamzapp/claude-code-local

## Overview

Claude Code Local makes Claude Code continue using locally hosted models after cloud usage limits, translating Anthropic Messages requests to model backends. The main workflow is Claude Code → local proxy/server → model inference → Anthropic-compatible response; the separate keepgoing workflow finds the current folder’s conversation and resumes it on a chosen local or free-cloud model. Linux/Windows add a portable llama.cpp path, while the native terminal agent and smart router are distinct product modes. Edges reflect README statements or shown excerpts; unsampled subsystem links are omitted where ownership is not established.

Main entry points: [`bin/keepgoing.py`](https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing.py) (Conversation selector), [`proxy/server.py`](https://github.com/nicedreamzapp/claude-code-local/blob/main/proxy/server.py) (MLX Messages server), [`portable/portable_server.py`](https://github.com/nicedreamzapp/claude-code-local/blob/main/portable/portable_server.py) (Portable Messages server), [`bin/keepgoing`](https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing) (Keepgoing command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API serving"]
  node_mlx["MLX Messages server<br/>[server.py]"]
  node_mlxmodel[("Local MLX model")]
end

subgraph group_resume["Conversation resume"]
  node_keepgoing["Conversation selector<br/>[keepgoing.py]"]
  node_cclcmd["Keepgoing command"]
  node_conversation[("Claude session files")]
  node_cloudmodel["Free cloud model"]
  node_handoff["Limit handoff hook<br/>[limit-handoff.py]"]
end

subgraph group_portable["Portable runtime"]
  node_portablecli["Portable installer and launcher<br/>[ccl.py]"]
  node_portableapi["Portable Messages server<br/>[portable_server.py]"]
  node_llamaserver["llama.cpp server"]
  node_portablemodel[("Local GGUF model")]
end

subgraph group_modes["Agent and routing"]
  node_nativeagent["Native terminal agent<br/>[agent.py]"]
  node_router["Smart model router<br/>[router.py]"]
  node_backends["Local model backends"]
end

subgraph group_setup["Setup and health"]
  node_installer["Platform setup<br/>[install.sh]"]
  node_setupscript["Model setup<br/>[setup.sh]"]
  node_doctor["Environment doctor<br/>[doctor.sh]"]
end

node_claude(("Claude Code"))
node_user(("User"))

node_claude -->|"sends Messages"| node_mlx
node_mlx -->|"runs inference"| node_mlxmodel
node_mlx -->|"returns API response"| node_claude
node_user -->|"starts resume"| node_cclcmd
node_cclcmd -->|"invokes"| node_keepgoing
node_keepgoing -->|"finds latest"| node_conversation
node_keepgoing -->|"offers selection"| node_cloudmodel
node_keepgoing -->|"resumes session"| node_claude
node_claude -->|"signals rate limit"| node_handoff
node_handoff -->|"starts continuation"| node_cclcmd
node_portablecli -->|"starts server"| node_llamaserver
node_llamaserver -->|"loads model"| node_portablemodel
node_claude -.->|"sends Messages"| node_portableapi
node_portableapi -->|"sends inference request"| node_llamaserver
node_portableapi -->|"reuses translation"| node_mlx
node_user -->|"prompts agent"| node_nativeagent
node_router -->|"forwards requests"| node_backends
node_user -->|"installs product"| node_installer
node_installer -->|"sets up runtime"| node_setupscript
node_user -->|"checks environment"| node_doctor

click node_mlx "https://github.com/nicedreamzapp/claude-code-local/blob/main/proxy/server.py"
click node_keepgoing "https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing.py"
click node_cclcmd "https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing"
click node_handoff "https://github.com/nicedreamzapp/claude-code-local/blob/main/scripts/limit-handoff.py"
click node_portablecli "https://github.com/nicedreamzapp/claude-code-local/blob/main/portable/ccl.py"
click node_portableapi "https://github.com/nicedreamzapp/claude-code-local/blob/main/portable/portable_server.py"
click node_nativeagent "https://github.com/nicedreamzapp/claude-code-local/blob/main/agent/agent.py"
click node_router "https://github.com/nicedreamzapp/claude-code-local/blob/main/smart-router/router.py"
click node_installer "https://github.com/nicedreamzapp/claude-code-local/blob/main/install.sh"
click node_setupscript "https://github.com/nicedreamzapp/claude-code-local/blob/main/setup.sh"
click node_doctor "https://github.com/nicedreamzapp/claude-code-local/blob/main/scripts/doctor.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_mlx,node_mlxmodel,node_user toneBlue
class node_keepgoing,node_cclcmd,node_conversation,node_cloudmodel,node_handoff toneAmber
class node_portablecli,node_portableapi,node_llamaserver,node_portablemodel toneMint
class node_nativeagent,node_router,node_backends toneRose
class node_installer,node_setupscript,node_doctor,node_claude toneIndigo
```

## Components

### API serving

- [MLX Messages server](https://github.com/nicedreamzapp/claude-code-local/blob/main/proxy/server.py): `proxy/server.py`
- **Local MLX model**

### Conversation resume

- [Conversation selector](https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing.py): `bin/keepgoing.py`
- [Keepgoing command](https://github.com/nicedreamzapp/claude-code-local/blob/main/bin/keepgoing): `bin/keepgoing`
- **Claude session files**
- **Free cloud model**
- [Limit handoff hook](https://github.com/nicedreamzapp/claude-code-local/blob/main/scripts/limit-handoff.py): `scripts/limit-handoff.py`

### Portable runtime

- [Portable installer and launcher](https://github.com/nicedreamzapp/claude-code-local/blob/main/portable/ccl.py): `portable/ccl.py`
- [Portable Messages server](https://github.com/nicedreamzapp/claude-code-local/blob/main/portable/portable_server.py): `portable/portable_server.py`
- **llama.cpp server**
- **Local GGUF model**

### Agent and routing

- [Native terminal agent](https://github.com/nicedreamzapp/claude-code-local/blob/main/agent/agent.py): `agent/agent.py`
- [Smart model router](https://github.com/nicedreamzapp/claude-code-local/blob/main/smart-router/router.py): `smart-router/router.py`
- **Local model backends**

### Setup and health

- [Platform setup](https://github.com/nicedreamzapp/claude-code-local/blob/main/install.sh): `install.sh`
- [Model setup](https://github.com/nicedreamzapp/claude-code-local/blob/main/setup.sh): `setup.sh`
- [Environment doctor](https://github.com/nicedreamzapp/claude-code-local/blob/main/scripts/doctor.sh): `scripts/doctor.sh`

### Other components

- **Claude Code**
- **User**

## Connections

- Claude Code → MLX Messages server: sends Messages (evidence: `README.md`)
- MLX Messages server → Local MLX model: runs inference (evidence: `README.md`)
- MLX Messages server → Claude Code: returns API response (evidence: `README.md`)
- User → Keepgoing command: starts resume (evidence: `README.md`)
- Keepgoing command → Conversation selector: invokes (evidence: `README.md`)
- Conversation selector → Claude session files: finds latest (evidence: `bin/keepgoing.py`)
- Conversation selector → Free cloud model: offers selection (evidence: `bin/keepgoing.py`)
- Conversation selector → Claude Code: resumes session (evidence: `README.md`)
- Claude Code → Limit handoff hook: signals rate limit (evidence: `scripts/limit-handoff.py`)
- Limit handoff hook → Keepgoing command: starts continuation (evidence: `scripts/limit-handoff.py`)
- Portable installer and launcher → llama.cpp server: starts server (evidence: `portable/ccl.py`)
- llama.cpp server → Local GGUF model: loads model
- Claude Code → Portable Messages server: sends Messages
- Portable Messages server → llama.cpp server: sends inference request (evidence: `portable/portable_server.py`)
- Portable Messages server → MLX Messages server: reuses translation (evidence: `portable/portable_server.py`)
- User → Native terminal agent: prompts agent (evidence: `README.md`)
- Smart model router → Local model backends: forwards requests (evidence: `smart-router/router.py`)
- User → Platform setup: installs product (evidence: `README.md`)
- Platform setup → Model setup: sets up runtime (evidence: `README.md`)
- User → Environment doctor: checks environment (evidence: `README.md`)
