# reddishjade/cade architecture

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

- Interactive diagram: https://gitdiagram.com/reddishjade/cade
- Repository: https://github.com/reddishjade/cade

## Overview

Cade is a terminal-first coding agent, with a browser workbench and Python app interface. The main workflow is a user submitting a task through a CLI surface; the assembled agent builds model requests, invokes project tools under mode and approval policies, and streams progress and results back to the surface. Distinct supporting capabilities include provider authentication, session resume and history, skills, MCP tools, long-term memory, and subagents. The graph reflects the README and sampled excerpts; unsampled wiring is shown only where the README or sampled assembly explicitly supports it.

Main entry points: [`src/cade/agent/agent_loop.py`](https://github.com/reddishjade/cade/blob/main/src/cade/agent/agent_loop.py) (Agent loop), [`src/cade/main.py`](https://github.com/reddishjade/cade/blob/main/src/cade/main.py) (Command entry), [`src/cade/harness/session/history.py`](https://github.com/reddishjade/cade/blob/main/src/cade/harness/session/history.py) (Session history), [`src/cade/cli/tui/app.py`](https://github.com/reddishjade/cade/blob/main/src/cade/cli/tui/app.py) (Terminal workbench)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_main["Command entry<br/>[main.py]"]
  node_tui["Terminal workbench<br/>[app.py]"]
  node_repl["Traditional REPL<br/>[repl.py]"]
  node_web["Browser API<br/>[api.py]"]
  node_webui["Browser workbench<br/>[app.js]"]
end

subgraph group_runtime["Agent runtime"]
  node_app["App assembly<br/>[app.py]"]
  node_agent["Agent loop<br/>[agent_loop.py]"]
  node_context["Context manager<br/>[context_manager.py]"]
end

subgraph group_capabilities["Agent capabilities"]
  node_tools["Coding tools<br/>[tools_manager.py]"]
  node_execution["Execution environment<br/>[sandbox.py]"]
  node_skills["Skills<br/>[registry.py]"]
  node_subagents["Subagents<br/>[subagents.py]"]
end

subgraph group_integrations["Models and integrations"]
  node_provider["Model providers<br/>[registry.py]"]
  node_auth["Credential manager<br/>[manager.py]"]
  node_mcp["MCP client<br/>[client.py]"]
end

subgraph group_state["Security and state"]
  node_security["Approval and permissions<br/>[permissions.py]"]
  node_sessions["Session history<br/>[history.py]"]
  node_memory[("Long-term memory<br/>[manager.py]")]
end

node_user(("User"))
node_modelservice(("Model service"))
node_workspace[("Project workspace")]

node_user -->|"starts"| node_main
node_main -->|"launches"| node_tui
node_main -->|"launches"| node_repl
node_main -->|"launches"| node_web
node_user -->|"submits task"| node_tui
node_user -->|"submits task"| node_repl
node_user -->|"submits task"| node_webui
node_webui -->|"WebSocket requests"| node_web
node_tui -->|"runs tasks"| node_app
node_repl -->|"runs tasks"| node_app
node_web -->|"dispatches tasks"| node_app
node_app -->|"assembles"| node_agent
node_agent -->|"manages context"| node_context
node_agent -->|"requests completions"| node_provider
node_provider -->|"sends requests"| node_modelservice
node_auth -->|"resolves credentials"| node_provider
node_agent -->|"dispatches tools"| node_tools
node_tools -->|"runs commands"| node_execution
node_execution -->|"reads and writes"| node_workspace
node_agent -->|"checks permissions"| node_security
node_agent -->|"records history"| node_sessions
node_agent -->|"uses skills"| node_skills
node_agent -.->|"invokes tools"| node_mcp
node_agent -->|"reads and updates"| node_memory
node_agent -->|"delegates tasks"| node_subagents
node_sessions -->|"restores sessions"| node_tui
node_sessions -->|"restores sessions"| node_repl
node_sessions -->|"restores sessions"| node_web

click node_main "https://github.com/reddishjade/cade/blob/main/src/cade/main.py"
click node_tui "https://github.com/reddishjade/cade/blob/main/src/cade/cli/tui/app.py"
click node_repl "https://github.com/reddishjade/cade/blob/main/src/cade/cli/repl.py"
click node_web "https://github.com/reddishjade/cade/blob/main/src/cade/server/api.py"
click node_webui "https://github.com/reddishjade/cade/blob/main/src/cade/server/static/app.js"
click node_app "https://github.com/reddishjade/cade/blob/main/src/cade/coding_agent/app.py"
click node_agent "https://github.com/reddishjade/cade/blob/main/src/cade/agent/agent_loop.py"
click node_context "https://github.com/reddishjade/cade/blob/main/src/cade/agent/context_manager.py"
click node_provider "https://github.com/reddishjade/cade/blob/main/src/cade/ai/providers/registry.py"
click node_auth "https://github.com/reddishjade/cade/blob/main/src/cade/harness/auth/manager.py"
click node_tools "https://github.com/reddishjade/cade/blob/main/src/cade/coding_agent/tools/tools_manager.py"
click node_execution "https://github.com/reddishjade/cade/blob/main/src/cade/harness/execution_env/sandbox.py"
click node_security "https://github.com/reddishjade/cade/blob/main/src/cade/harness/security/permissions.py"
click node_sessions "https://github.com/reddishjade/cade/blob/main/src/cade/harness/session/history.py"
click node_skills "https://github.com/reddishjade/cade/blob/main/src/cade/harness/skills/registry.py"
click node_mcp "https://github.com/reddishjade/cade/blob/main/src/cade/harness/mcp/client.py"
click node_memory "https://github.com/reddishjade/cade/blob/main/src/cade/harness/memory/manager.py"
click node_subagents "https://github.com/reddishjade/cade/blob/main/src/cade/harness/agent_runtime/subagents.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_main,node_tui,node_repl,node_web,node_webui,node_user toneBlue
class node_app,node_agent,node_context,node_workspace toneAmber
class node_tools,node_execution,node_skills,node_subagents toneMint
class node_provider,node_auth,node_mcp toneRose
class node_security,node_sessions,node_memory,node_modelservice toneIndigo
```

## Components

### User interfaces

- [Command entry](https://github.com/reddishjade/cade/blob/main/src/cade/main.py): `src/cade/main.py`
- [Terminal workbench](https://github.com/reddishjade/cade/blob/main/src/cade/cli/tui/app.py): `src/cade/cli/tui/app.py`
- [Traditional REPL](https://github.com/reddishjade/cade/blob/main/src/cade/cli/repl.py): `src/cade/cli/repl.py`
- [Browser API](https://github.com/reddishjade/cade/blob/main/src/cade/server/api.py): `src/cade/server/api.py`
- [Browser workbench](https://github.com/reddishjade/cade/blob/main/src/cade/server/static/app.js): `src/cade/server/static/app.js`

### Agent runtime

- [App assembly](https://github.com/reddishjade/cade/blob/main/src/cade/coding_agent/app.py): `src/cade/coding_agent/app.py`
- [Agent loop](https://github.com/reddishjade/cade/blob/main/src/cade/agent/agent_loop.py): `src/cade/agent/agent_loop.py`
- [Context manager](https://github.com/reddishjade/cade/blob/main/src/cade/agent/context_manager.py): `src/cade/agent/context_manager.py`

### Agent capabilities

- [Coding tools](https://github.com/reddishjade/cade/blob/main/src/cade/coding_agent/tools/tools_manager.py): `src/cade/coding_agent/tools/tools_manager.py`
- [Execution environment](https://github.com/reddishjade/cade/blob/main/src/cade/harness/execution_env/sandbox.py): `src/cade/harness/execution_env/sandbox.py`
- [Skills](https://github.com/reddishjade/cade/blob/main/src/cade/harness/skills/registry.py): `src/cade/harness/skills/registry.py`
- [Subagents](https://github.com/reddishjade/cade/blob/main/src/cade/harness/agent_runtime/subagents.py): `src/cade/harness/agent_runtime/subagents.py`

### Models and integrations

- [Model providers](https://github.com/reddishjade/cade/blob/main/src/cade/ai/providers/registry.py): `src/cade/ai/providers/registry.py`
- [Credential manager](https://github.com/reddishjade/cade/blob/main/src/cade/harness/auth/manager.py): `src/cade/harness/auth/manager.py`
- [MCP client](https://github.com/reddishjade/cade/blob/main/src/cade/harness/mcp/client.py): `src/cade/harness/mcp/client.py`

### Security and state

- [Approval and permissions](https://github.com/reddishjade/cade/blob/main/src/cade/harness/security/permissions.py): `src/cade/harness/security/permissions.py`
- [Session history](https://github.com/reddishjade/cade/blob/main/src/cade/harness/session/history.py): `src/cade/harness/session/history.py`
- [Long-term memory](https://github.com/reddishjade/cade/blob/main/src/cade/harness/memory/manager.py): `src/cade/harness/memory/manager.py`

### Other components

- **User**
- **Model service**
- **Project workspace**

## Connections

- User → Command entry: starts
- Command entry → Terminal workbench: launches
- Command entry → Traditional REPL: launches
- Command entry → Browser API: launches
- User → Terminal workbench: submits task
- User → Traditional REPL: submits task
- User → Browser workbench: submits task
- Browser workbench → Browser API: WebSocket requests
- Terminal workbench → App assembly: runs tasks
- Traditional REPL → App assembly: runs tasks
- Browser API → App assembly: dispatches tasks
- App assembly → Agent loop: assembles
- Agent loop → Context manager: manages context
- Agent loop → Model providers: requests completions
- Model providers → Model service: sends requests
- Credential manager → Model providers: resolves credentials
- Agent loop → Coding tools: dispatches tools
- Coding tools → Execution environment: runs commands
- Execution environment → Project workspace: reads and writes
- Agent loop → Approval and permissions: checks permissions
- Agent loop → Session history: records history
- Agent loop → Skills: uses skills
- Agent loop → MCP client: invokes tools
- Agent loop → Long-term memory: reads and updates
- Agent loop → Subagents: delegates tasks
- Session history → Terminal workbench: restores sessions
- Session history → Traditional REPL: restores sessions
- Session history → Browser API: restores sessions
