# debaucheryparty/packets architecture

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

- Interactive diagram: https://gitdiagram.com/debaucheryparty/packets
- Repository: https://github.com/debaucheryparty/packets

## Overview

Packets is a remote development-workload system: a developer uses the CLI to send project work to a daemon, which schedules execution on remote capacity and returns logs and artifacts. Workspace snapshots support source transfer and persistent caching; separate capabilities cover environments, persistent subspaces, services, transactions, Android workflows, and MCP access. The README and daemon wiring establish the main flow, but sampled excerpts do not expose every CLI RPC or scheduler-to-worker call, so uncertain links are omitted.

Main entry points: [`internal/scheduler/server.go`](https://github.com/debaucheryparty/packets/blob/main/internal/scheduler/server.go) (Job scheduler API), [`cmd/packetsd/main.go`](https://github.com/debaucheryparty/packets/blob/main/cmd/packetsd/main.go) (Packets daemon), [`internal/workspace/server.go`](https://github.com/debaucheryparty/packets/blob/main/internal/workspace/server.go) (Workspace API), [`cmd/packets/main.go`](https://github.com/debaucheryparty/packets/blob/main/cmd/packets/main.go) (Packets CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client workflows"]
  node_cli["Packets CLI<br/>[main.go]"]
  node_cli_build["Build and exec<br/>[build.go]"]
  node_cli_sync["Project sync<br/>[sync.go]"]
  node_mcp["MCP server<br/>[server.go]"]
end

subgraph group_execution["Remote execution"]
  node_daemon["Packets daemon<br/>[main.go]"]
  node_scheduler["Job scheduler API<br/>[server.go]"]
  node_dispatch["Job dispatcher<br/>[dispatch.go]"]
  node_executor["Remote executor<br/>[executor.go]"]
  node_toolchains["Toolchain routing<br/>[router.go]"]
  node_job_store[("Job database<br/>[sqlite.go]")]
end

subgraph group_workspace["Workspace and artifacts"]
  node_workspace_client["Snapshot client<br/>[client.go]"]
  node_workspace_api["Workspace API<br/>[server.go]"]
  node_object_store[("Object storage<br/>[objectstore.go]")]
  node_artifacts["Artifact handling<br/>[artifact.go]"]
end

subgraph group_state["Persistent workspaces"]
  node_subspace_api["Subspace API<br/>[server.go]"]
  node_subspaces["Subspace manager<br/>[manager.go]"]
  node_transactions["Workspace transactions<br/>[manager.go]"]
  node_services["Remote services<br/>[manager.go]"]
end

subgraph group_capabilities["Environment and integrations"]
  node_environment["Environment manager<br/>[manager.go]"]
  node_android["Android tooling<br/>[setup.go]"]
  node_policy["Execution policy<br/>[engine.go]"]
  node_providers["Build providers<br/>[provider.go]"]
end

node_developer(("Developer"))
node_ai(("AI assistant"))

node_developer -->|"runs commands"| node_cli
node_cli -->|"selects workflow"| node_cli_build
node_cli_build -->|"submits jobs"| node_scheduler
node_cli_sync -->|"uploads snapshots"| node_workspace_api
node_cli_build -->|"syncs project"| node_workspace_client
node_workspace_client -->|"transfers snapshots"| node_workspace_api
node_workspace_api -->|"stores chunks"| node_object_store
node_daemon -->|"registers API"| node_scheduler
node_daemon -->|"constructs dispatcher"| node_dispatch
node_daemon -->|"constructs executor"| node_executor
node_daemon -->|"registers API"| node_workspace_api
node_scheduler -->|"dispatches jobs"| node_dispatch
node_scheduler -->|"records jobs"| node_job_store
node_scheduler -->|"checks approval"| node_policy
node_scheduler -.->|"fetches artifacts"| node_providers
node_executor -->|"routes commands"| node_toolchains
node_executor -->|"reads snapshots"| node_object_store
node_scheduler -->|"serves artifact data"| node_workspace_api
node_cli -->|"downloads outputs"| node_artifacts
node_ai -.->|"invokes tools"| node_mcp
node_mcp -->|"requests job data"| node_scheduler
node_mcp -->|"requests approval"| node_policy
node_daemon -->|"constructs manager"| node_subspaces
node_subspace_api -->|"manages subspaces"| node_subspaces
node_daemon -->|"constructs manager"| node_transactions
node_daemon -->|"constructs manager"| node_services
node_cli -->|"checks environments"| node_environment
node_environment -->|"resolves Android"| node_android

click node_cli "https://github.com/debaucheryparty/packets/blob/main/cmd/packets/main.go"
click node_cli_build "https://github.com/debaucheryparty/packets/blob/main/internal/cli/build.go"
click node_cli_sync "https://github.com/debaucheryparty/packets/blob/main/internal/cli/sync.go"
click node_mcp "https://github.com/debaucheryparty/packets/blob/main/internal/mcp/server.go"
click node_daemon "https://github.com/debaucheryparty/packets/blob/main/cmd/packetsd/main.go"
click node_scheduler "https://github.com/debaucheryparty/packets/blob/main/internal/scheduler/server.go"
click node_dispatch "https://github.com/debaucheryparty/packets/blob/main/internal/scheduler/dispatch.go"
click node_executor "https://github.com/debaucheryparty/packets/blob/main/internal/worker/executor.go"
click node_toolchains "https://github.com/debaucheryparty/packets/blob/main/internal/toolchain/router.go"
click node_job_store "https://github.com/debaucheryparty/packets/blob/main/internal/storage/sqlite.go"
click node_workspace_client "https://github.com/debaucheryparty/packets/blob/main/internal/workspace/client.go"
click node_workspace_api "https://github.com/debaucheryparty/packets/blob/main/internal/workspace/server.go"
click node_object_store "https://github.com/debaucheryparty/packets/blob/main/internal/storage/objectstore.go"
click node_artifacts "https://github.com/debaucheryparty/packets/blob/main/internal/workspace/artifact.go"
click node_subspace_api "https://github.com/debaucheryparty/packets/blob/main/internal/subspace/server.go"
click node_subspaces "https://github.com/debaucheryparty/packets/blob/main/internal/subspace/manager.go"
click node_transactions "https://github.com/debaucheryparty/packets/blob/main/internal/transaction/manager.go"
click node_services "https://github.com/debaucheryparty/packets/blob/main/internal/service/manager.go"
click node_environment "https://github.com/debaucheryparty/packets/blob/main/internal/environment/manager.go"
click node_android "https://github.com/debaucheryparty/packets/blob/main/internal/android/setup.go"
click node_policy "https://github.com/debaucheryparty/packets/blob/main/internal/policy/engine.go"
click node_providers "https://github.com/debaucheryparty/packets/blob/main/internal/provider/provider.go"

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_cli_build,node_cli_sync,node_mcp toneBlue
class node_daemon,node_scheduler,node_dispatch,node_executor,node_toolchains,node_job_store toneAmber
class node_workspace_client,node_workspace_api,node_object_store,node_artifacts toneMint
class node_subspace_api,node_subspaces,node_transactions,node_services toneRose
class node_environment,node_android,node_policy,node_providers,node_developer,node_ai toneIndigo
```

## Components

### Client workflows

- [Packets CLI](https://github.com/debaucheryparty/packets/blob/main/cmd/packets/main.go): `cmd/packets/main.go`
- [Build and exec](https://github.com/debaucheryparty/packets/blob/main/internal/cli/build.go): `internal/cli/build.go`
- [Project sync](https://github.com/debaucheryparty/packets/blob/main/internal/cli/sync.go): `internal/cli/sync.go`
- [MCP server](https://github.com/debaucheryparty/packets/blob/main/internal/mcp/server.go): `internal/mcp/server.go`

### Remote execution

- [Packets daemon](https://github.com/debaucheryparty/packets/blob/main/cmd/packetsd/main.go): `cmd/packetsd/main.go`
- [Job scheduler API](https://github.com/debaucheryparty/packets/blob/main/internal/scheduler/server.go): `internal/scheduler/server.go`
- [Job dispatcher](https://github.com/debaucheryparty/packets/blob/main/internal/scheduler/dispatch.go): `internal/scheduler/dispatch.go`
- [Remote executor](https://github.com/debaucheryparty/packets/blob/main/internal/worker/executor.go): `internal/worker/executor.go`
- [Toolchain routing](https://github.com/debaucheryparty/packets/blob/main/internal/toolchain/router.go): `internal/toolchain/router.go`
- [Job database](https://github.com/debaucheryparty/packets/blob/main/internal/storage/sqlite.go): `internal/storage/sqlite.go`

### Workspace and artifacts

- [Snapshot client](https://github.com/debaucheryparty/packets/blob/main/internal/workspace/client.go): `internal/workspace/client.go`
- [Workspace API](https://github.com/debaucheryparty/packets/blob/main/internal/workspace/server.go): `internal/workspace/server.go`
- [Object storage](https://github.com/debaucheryparty/packets/blob/main/internal/storage/objectstore.go): `internal/storage/objectstore.go`
- [Artifact handling](https://github.com/debaucheryparty/packets/blob/main/internal/workspace/artifact.go): `internal/workspace/artifact.go`

### Persistent workspaces

- [Subspace API](https://github.com/debaucheryparty/packets/blob/main/internal/subspace/server.go): `internal/subspace/server.go`
- [Subspace manager](https://github.com/debaucheryparty/packets/blob/main/internal/subspace/manager.go): `internal/subspace/manager.go`
- [Workspace transactions](https://github.com/debaucheryparty/packets/blob/main/internal/transaction/manager.go): `internal/transaction/manager.go`
- [Remote services](https://github.com/debaucheryparty/packets/blob/main/internal/service/manager.go): `internal/service/manager.go`

### Environment and integrations

- [Environment manager](https://github.com/debaucheryparty/packets/blob/main/internal/environment/manager.go): `internal/environment/manager.go`
- [Android tooling](https://github.com/debaucheryparty/packets/blob/main/internal/android/setup.go): `internal/android/setup.go`
- [Execution policy](https://github.com/debaucheryparty/packets/blob/main/internal/policy/engine.go): `internal/policy/engine.go`
- [Build providers](https://github.com/debaucheryparty/packets/blob/main/internal/provider/provider.go): `internal/provider/provider.go`

### Other components

- **Developer**
- **AI assistant**

## Connections

- Developer → Packets CLI: runs commands
- Packets CLI → Build and exec: selects workflow
- Build and exec → Job scheduler API: submits jobs
- Project sync → Workspace API: uploads snapshots
- Build and exec → Snapshot client: syncs project
- Snapshot client → Workspace API: transfers snapshots
- Workspace API → Object storage: stores chunks
- Packets daemon → Job scheduler API: registers API
- Packets daemon → Job dispatcher: constructs dispatcher
- Packets daemon → Remote executor: constructs executor
- Packets daemon → Workspace API: registers API
- Job scheduler API → Job dispatcher: dispatches jobs
- Job scheduler API → Job database: records jobs
- Job scheduler API → Execution policy: checks approval
- Job scheduler API → Build providers: fetches artifacts
- Remote executor → Toolchain routing: routes commands
- Remote executor → Object storage: reads snapshots
- Job scheduler API → Workspace API: serves artifact data
- Packets CLI → Artifact handling: downloads outputs
- AI assistant → MCP server: invokes tools
- MCP server → Job scheduler API: requests job data
- MCP server → Execution policy: requests approval
- Packets daemon → Subspace manager: constructs manager
- Subspace API → Subspace manager: manages subspaces
- Packets daemon → Workspace transactions: constructs manager
- Packets daemon → Remote services: constructs manager
- Packets CLI → Environment manager: checks environments
- Environment manager → Android tooling: resolves Android
