# doctorjei/kanibako-cli architecture

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

- Interactive diagram: https://gitdiagram.com/doctorjei/kanibako-cli
- Repository: https://github.com/doctorjei/kanibako-cli

## Overview

Kanibako provides isolated, persistent workspaces for AI coding agents. The primary workflow is: a user starts a box through the CLI; lifecycle handling resolves the project and its settings, prepares a container rig, and launches an agent in the box. Worksets, templates, credentials, channels, helper agents, and VS Code extend that workflow. The lifecycle module is large but only partially sampled, so its documented and indexed dependencies are shown; unsampled subsystem links are omitted where their callers are unclear.

Main entry points: [`src/kanibako/commands/box/_lifecycle.py`](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/commands/box/_lifecycle.py) (Box lifecycle), [`src/kanibako/targets/base.py`](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/targets/base.py) (Agent plugin contract), [`src/kanibako/runtime/container.py`](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/runtime/container.py) (Container runtime), [`src/kanibako/cli.py`](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/cli.py) (CLI commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry"]
  node_cli["CLI commands<br/>[cli.py]"]
end

subgraph group_workspace["Workspace management"]
  node_lifecycle["Box lifecycle<br/>[_lifecycle.py]"]
  node_worksets[("Worksets<br/>[workset.py]")]
  node_workset_cmd["Workset commands<br/>[workset_cmd.py]"]
  node_settings["Settings resolution"]
  node_config["Configuration<br/>[config.py]"]
  node_paths["Host and box paths<br/>[paths.py]"]
  node_dirkeys["Workset path keys<br/>[workset_dirkeys.py]"]
end

subgraph group_runtime["Box runtime"]
  node_container["Container runtime<br/>[container.py]"]
  node_rigs[("Rig management<br/>[rig_registry.py]")]
end

subgraph group_agents["Agents and launch"]
  node_templates["Launch templates<br/>[templates.py]"]
  node_targets["Agent plugin contract<br/>[base.py]"]
  node_claude["Claude plugin<br/>[target.py]"]
  node_codex["Codex plugin<br/>[target.py]"]
  node_goose["Goose plugin<br/>[target.py]"]
end

subgraph group_support["Persistence and extensions"]
  node_boxfs["Box filesystem<br/>[boxfs.py]"]
  node_channels["Channels<br/>[channels.py]"]
  node_helpers["Helper agents<br/>[helper_client.py]"]
  node_vscode["VS Code integration<br/>[vscode_remote.py]"]
  node_proxy["Network proxy<br/>[server.py]"]
end

node_user(("User"))
node_container_engine["Podman or Docker"]

node_user -->|"runs"| node_cli
node_cli -.->|"dispatches"| node_lifecycle
node_lifecycle -->|"resolves"| node_worksets
node_workset_cmd -->|"manages"| node_worksets
node_lifecycle -->|"resolves"| node_settings
node_lifecycle -->|"reads"| node_config
node_lifecycle -->|"resolves"| node_paths
node_lifecycle -->|"resolves"| node_dirkeys
node_lifecycle -->|"launches"| node_container
node_lifecycle -->|"applies"| node_templates
node_lifecycle -.->|"launches agent"| node_targets
node_container -->|"controls"| node_container_engine
node_lifecycle -.->|"selects rig"| node_rigs
node_targets -->|"implements"| node_claude
node_targets -->|"implements"| node_codex
node_targets -->|"implements"| node_goose
node_lifecycle -->|"configures"| node_channels
node_lifecycle -.->|"supports"| node_helpers
node_lifecycle -.->|"opens"| node_vscode
node_container -.->|"uses"| node_proxy
node_targets -->|"uses"| node_boxfs

click node_cli "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/cli.py"
click node_lifecycle "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/commands/box/_lifecycle.py"
click node_worksets "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/project/workset.py"
click node_workset_cmd "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/commands/workset_cmd.py"
click node_settings "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/settings_resolve.py"
click node_config "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/config.py"
click node_paths "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/paths.py"
click node_dirkeys "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/workset_dirkeys.py"
click node_container "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/runtime/container.py"
click node_rigs "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/runtime/rig_registry.py"
click node_templates "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/launch/templates.py"
click node_targets "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/targets/base.py"
click node_claude "https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-claude/src/kanibako/plugins/claude/target.py"
click node_codex "https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-codex/src/kanibako/plugins/codex/target.py"
click node_goose "https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-goose/src/kanibako/plugins/goose/target.py"
click node_boxfs "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/boxfs.py"
click node_channels "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/channels/channels.py"
click node_helpers "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/channels/helper_client.py"
click node_vscode "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/vscode/vscode_remote.py"
click node_proxy "https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/proxy/server.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_cli,node_user toneBlue
class node_lifecycle,node_worksets,node_workset_cmd,node_settings,node_config,node_paths,node_dirkeys toneAmber
class node_container,node_rigs toneMint
class node_templates,node_targets,node_claude,node_codex,node_goose toneRose
class node_boxfs,node_channels,node_helpers,node_vscode,node_proxy,node_container_engine toneIndigo
```

## Components

### User entry

- [CLI commands](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/cli.py): `src/kanibako/cli.py`

### Workspace management

- [Box lifecycle](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/commands/box/_lifecycle.py): `src/kanibako/commands/box/_lifecycle.py`
- [Worksets](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/project/workset.py): `src/kanibako/project/workset.py`
- [Workset commands](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/commands/workset_cmd.py): `src/kanibako/commands/workset_cmd.py`
- [Settings resolution](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/settings_resolve.py): `src/kanibako/settings/settings_resolve.py`
- [Configuration](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/config.py): `src/kanibako/settings/config.py`
- [Host and box paths](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/paths.py): `src/kanibako/settings/paths.py`
- [Workset path keys](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/settings/workset_dirkeys.py): `src/kanibako/settings/workset_dirkeys.py`

### Box runtime

- [Container runtime](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/runtime/container.py): `src/kanibako/runtime/container.py`
- [Rig management](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/runtime/rig_registry.py): `src/kanibako/runtime/rig_registry.py`

### Agents and launch

- [Launch templates](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/launch/templates.py): `src/kanibako/launch/templates.py`
- [Agent plugin contract](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/targets/base.py): `src/kanibako/targets/base.py`
- [Claude plugin](https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-claude/src/kanibako/plugins/claude/target.py): `packages/agent-claude/src/kanibako/plugins/claude/target.py`
- [Codex plugin](https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-codex/src/kanibako/plugins/codex/target.py): `packages/agent-codex/src/kanibako/plugins/codex/target.py`
- [Goose plugin](https://github.com/doctorjei/kanibako-cli/blob/main/packages/agent-goose/src/kanibako/plugins/goose/target.py): `packages/agent-goose/src/kanibako/plugins/goose/target.py`

### Persistence and extensions

- [Box filesystem](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/boxfs.py): `src/kanibako/boxfs.py`
- [Channels](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/channels/channels.py): `src/kanibako/channels/channels.py`
- [Helper agents](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/channels/helper_client.py): `src/kanibako/channels/helper_client.py`
- [VS Code integration](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/vscode/vscode_remote.py): `src/kanibako/vscode/vscode_remote.py`
- [Network proxy](https://github.com/doctorjei/kanibako-cli/blob/main/src/kanibako/proxy/server.py): `src/kanibako/proxy/server.py`

### Other components

- **User**
- **Podman or Docker**

## Connections

- User → CLI commands: runs (evidence: `README.md`)
- CLI commands → Box lifecycle: dispatches
- Box lifecycle → Worksets: resolves (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Workset commands → Worksets: manages (evidence: `src/kanibako/commands/workset_cmd.py`)
- Box lifecycle → Settings resolution: resolves (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Configuration: reads (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Host and box paths: resolves (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Workset path keys: resolves (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Container runtime: launches (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Launch templates: applies (evidence: `src/kanibako/launch/templates.py`)
- Box lifecycle → Agent plugin contract: launches agent
- Container runtime → Podman or Docker: controls (evidence: `README.md`)
- Box lifecycle → Rig management: selects rig
- Agent plugin contract → Claude plugin: implements (evidence: `packages/agent-claude/src/kanibako/plugins/claude/target.py`)
- Agent plugin contract → Codex plugin: implements (evidence: `packages/agent-codex/src/kanibako/plugins/codex/target.py`)
- Agent plugin contract → Goose plugin: implements (evidence: `packages/agent-goose/src/kanibako/plugins/goose/target.py`)
- Box lifecycle → Channels: configures (evidence: `src/kanibako/commands/box/_lifecycle.py`)
- Box lifecycle → Helper agents: supports
- Box lifecycle → VS Code integration: opens
- Container runtime → Network proxy: uses
- Agent plugin contract → Box filesystem: uses (evidence: `src/kanibako/targets/base.py`)
