# gaoscode/planweave architecture

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

- Interactive diagram: https://gitdiagram.com/gaoscode/planweave
- Repository: https://github.com/gaoscode/planweave

## Overview

PlanWeave is a local-first, file-backed engineering workflow that turns plans into task graphs, assigns focused implementation and review work to agents, and preserves run history for recovery. Its primary loop is plan creation or import, task execution, review and feedback, then continuation or recovery. The graph also includes desktop and CLI entry points, team collaboration with remote Agent Hosts, and MCP authoring. Several subsystem links are documented in the README; the sampled source excerpts show only selected UI-to-bridge and internal runtime calls, so unsampled connections are not inferred.

Main entry points: [`packages/runtime/src/autoRun/acpExecutionEngine.ts`](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/autoRun/acpExecutionEngine.ts) (Agent execution engine), [`packages/agent-host/src/execution/remoteAcpExecutor.ts`](https://github.com/gaoscode/planweave/blob/main/packages/agent-host/src/execution/remoteAcpExecutor.ts) (Agent Host), [`packages/runtime/src/desktop/reviewPipelineApi.ts`](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/desktop/reviewPipelineApi.ts) (Review pipeline), [`packages/desktop/src/renderer/bridge.ts`](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/bridge.ts) (Desktop bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_authoring["Plan authoring"]
  node_cli["CLI commands"]
  node_mcp["MCP server<br/>[server.ts]"]
  node_task_graph["Task graph"]
end

subgraph group_execution["Execution loop"]
  node_review_pipeline["Review pipeline"]
  node_runtime_engine["Agent execution engine"]
  node_run_history[("Run history")]
  node_runtime_types["Task and result contracts<br/>[taskManager.ts]"]
end

subgraph group_desktop["Desktop experience"]
  node_desktop_app["Desktop app<br/>[main.ts]"]
  node_desktop_bridge["Desktop bridge<br/>[bridge.ts]"]
  node_task_workspace["Task workspace"]
  node_review_ui["Review controls"]
  node_remote_run_ui["Remote run panel"]
end

subgraph group_collaboration["Team collaboration"]
  node_collaboration_ui["Collaboration controls"]
  node_authority_service["Work authority"]
  node_collaboration_server["Collaboration server"]
end

subgraph group_agent_host["Remote agents"]
  node_agent_host["Agent Host"]
  node_host_enrollment["Host enrollment"]
  node_host_admin["Host administration"]
end

node_cli_user(("CLI user"))
node_desktop_user(("Desktop user"))
node_chatgpt(("ChatGPT"))
node_agent_provider["Agent providers"]

node_cli_user -->|"authors or inspects"| node_cli
node_cli -->|"creates and edits"| node_task_graph
node_chatgpt -->|"authors through"| node_mcp
node_mcp -->|"creates plan content"| node_task_graph
node_desktop_user -->|"plans and runs"| node_desktop_app
node_desktop_app -.->|"exposes renderer APIs"| node_desktop_bridge
node_desktop_bridge -->|"serves workspace API"| node_task_workspace
node_desktop_bridge -->|"serves desktop API"| node_review_ui
node_task_workspace -->|"starts agent runs"| node_runtime_engine
node_task_workspace -->|"shows run records"| node_run_history
node_runtime_engine -->|"runs agent sessions"| node_agent_provider
node_runtime_engine -.->|"produces run results"| node_runtime_types
node_review_ui -->|"edits review stages"| node_review_pipeline
node_review_pipeline -->|"updates graph"| node_task_graph
node_review_pipeline -.->|"routes review runs"| node_runtime_engine
node_collaboration_ui -->|"collaborates with"| node_collaboration_server
node_collaboration_server -.->|"authorizes work assignments"| node_authority_service
node_collaboration_server -->|"coordinates remote work"| node_agent_host
node_host_admin -->|"enrolls hosts"| node_host_enrollment
node_host_enrollment -->|"activates host credentials"| node_agent_host
node_agent_host -.->|"executes remote agent work"| node_runtime_engine
node_remote_run_ui -->|"monitors remote runs"| node_agent_host

click node_cli "https://github.com/gaoscode/planweave/tree/main/packages/cli/src/commands"
click node_mcp "https://github.com/gaoscode/planweave/blob/main/packages/mcp/src/server.ts"
click node_task_graph "https://github.com/gaoscode/planweave/tree/main/packages/runtime/src/graph"
click node_review_pipeline "https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/desktop/reviewPipelineApi.ts"
click node_desktop_app "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/main/main.ts"
click node_desktop_bridge "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/bridge.ts"
click node_task_workspace "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/task-workspace/useTaskWorkspaceController.ts"
click node_review_ui "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useReviewPipeline.ts"
click node_remote_run_ui "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useRemoteRunPanelController.ts"
click node_runtime_engine "https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/autoRun/acpExecutionEngine.ts"
click node_run_history "https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/autoRun/blockRunIndexStorage.ts"
click node_runtime_types "https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/types/taskManager.ts"
click node_collaboration_ui "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useCommentsPanelController.ts"
click node_authority_service "https://github.com/gaoscode/planweave/blob/main/packages/server/src/work/authorityService.ts"
click node_collaboration_server "https://github.com/gaoscode/planweave/blob/main/packages/server/src/loopbackController.ts"
click node_agent_host "https://github.com/gaoscode/planweave/blob/main/packages/agent-host/src/execution/remoteAcpExecutor.ts"
click node_host_enrollment "https://github.com/gaoscode/planweave/blob/main/packages/agent-host/src/enrollment/enrollmentService.ts"
click node_host_admin "https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useHostAdministrationController.ts"

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_mcp,node_task_graph,node_cli_user,node_desktop_user toneBlue
class node_review_pipeline,node_runtime_engine,node_run_history,node_runtime_types toneAmber
class node_desktop_app,node_desktop_bridge,node_task_workspace,node_review_ui,node_remote_run_ui toneMint
class node_collaboration_ui,node_authority_service,node_collaboration_server toneRose
class node_agent_host,node_host_enrollment,node_host_admin,node_chatgpt,node_agent_provider toneIndigo
```

## Components

### Plan authoring

- [CLI commands](https://github.com/gaoscode/planweave/tree/main/packages/cli/src/commands): `packages/cli/src/commands`
- [MCP server](https://github.com/gaoscode/planweave/blob/main/packages/mcp/src/server.ts): `packages/mcp/src/server.ts`
- [Task graph](https://github.com/gaoscode/planweave/tree/main/packages/runtime/src/graph): `packages/runtime/src/graph`

### Execution loop

- [Review pipeline](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/desktop/reviewPipelineApi.ts): `packages/runtime/src/desktop/reviewPipelineApi.ts`
- [Agent execution engine](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/autoRun/acpExecutionEngine.ts): `packages/runtime/src/autoRun/acpExecutionEngine.ts`
- [Run history](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/autoRun/blockRunIndexStorage.ts): `packages/runtime/src/autoRun/blockRunIndexStorage.ts`
- [Task and result contracts](https://github.com/gaoscode/planweave/blob/main/packages/runtime/src/types/taskManager.ts): `packages/runtime/src/types/taskManager.ts`

### Desktop experience

- [Desktop app](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/main/main.ts): `packages/desktop/src/main/main.ts`
- [Desktop bridge](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/bridge.ts): `packages/desktop/src/renderer/bridge.ts`
- [Task workspace](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/task-workspace/useTaskWorkspaceController.ts): `packages/desktop/src/renderer/task-workspace/useTaskWorkspaceController.ts`
- [Review controls](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useReviewPipeline.ts): `packages/desktop/src/renderer/hooks/useReviewPipeline.ts`
- [Remote run panel](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useRemoteRunPanelController.ts): `packages/desktop/src/renderer/hooks/useRemoteRunPanelController.ts`

### Team collaboration

- [Collaboration controls](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useCommentsPanelController.ts): `packages/desktop/src/renderer/hooks/useCommentsPanelController.ts`
- [Work authority](https://github.com/gaoscode/planweave/blob/main/packages/server/src/work/authorityService.ts): `packages/server/src/work/authorityService.ts`
- [Collaboration server](https://github.com/gaoscode/planweave/blob/main/packages/server/src/loopbackController.ts): `packages/server/src/loopbackController.ts`

### Remote agents

- [Agent Host](https://github.com/gaoscode/planweave/blob/main/packages/agent-host/src/execution/remoteAcpExecutor.ts): `packages/agent-host/src/execution/remoteAcpExecutor.ts`
- [Host enrollment](https://github.com/gaoscode/planweave/blob/main/packages/agent-host/src/enrollment/enrollmentService.ts): `packages/agent-host/src/enrollment/enrollmentService.ts`
- [Host administration](https://github.com/gaoscode/planweave/blob/main/packages/desktop/src/renderer/hooks/useHostAdministrationController.ts): `packages/desktop/src/renderer/hooks/useHostAdministrationController.ts`

### Other components

- **CLI user**
- **Desktop user**
- **ChatGPT**
- **Agent providers**

## Connections

- CLI user → CLI commands: authors or inspects (evidence: `README.md`)
- CLI commands → Task graph: creates and edits (evidence: `README.md`)
- ChatGPT → MCP server: authors through (evidence: `README.md`)
- MCP server → Task graph: creates plan content (evidence: `README.md`)
- Desktop user → Desktop app: plans and runs (evidence: `README.md`)
- Desktop app → Desktop bridge: exposes renderer APIs
- Desktop bridge → Task workspace: serves workspace API (evidence: `packages/desktop/src/renderer/bridge.ts`)
- Desktop bridge → Review controls: serves desktop API (evidence: `packages/desktop/src/renderer/bridge.ts`)
- Task workspace → Agent execution engine: starts agent runs (evidence: `README.md`)
- Task workspace → Run history: shows run records (evidence: `README.md`)
- Agent execution engine → Agent providers: runs agent sessions (evidence: `README.md`)
- Agent execution engine → Task and result contracts: produces run results
- Review controls → Review pipeline: edits review stages (evidence: `packages/desktop/src/renderer/hooks/useReviewPipeline.ts`)
- Review pipeline → Task graph: updates graph (evidence: `packages/runtime/src/desktop/reviewPipelineApi.ts`)
- Review pipeline → Agent execution engine: routes review runs
- Collaboration controls → Collaboration server: collaborates with (evidence: `README.md`)
- Collaboration server → Work authority: authorizes work assignments
- Collaboration server → Agent Host: coordinates remote work (evidence: `README.md`)
- Host administration → Host enrollment: enrolls hosts (evidence: `README.md`)
- Host enrollment → Agent Host: activates host credentials (evidence: `packages/agent-host/src/enrollment/enrollmentService.ts`)
- Agent Host → Agent execution engine: executes remote agent work
- Remote run panel → Agent Host: monitors remote runs (evidence: `README.md`)
