# lumekh000/papaerclip architecture

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

- Interactive diagram: https://gitdiagram.com/lumekh000/papaerclip
- Repository: https://github.com/lumekh000/papaerclip

## Overview

Paperclip is an AI-agent orchestration control plane: users manage companies, goals, projects, agents, work, budgets, and governance through a dashboard and API. The principal workflow is to define organizational goals and projects, assign work to agents, execute it through agent adapters, and observe outcomes and spending. This map emphasizes documented product capabilities and sampled schema/runtime evidence; several server and UI stages are located only at directory level because their implementations were not excerpted.

Main entry points: [`server/src`](https://github.com/lumekh000/papaerclip/tree/main/server/src) (REST API), [`packages/db/src`](https://github.com/lumekh000/papaerclip/tree/main/packages/db/src) (Relational database), [`packages/db/src/schema/companies.ts`](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/companies.ts) (Company model), [`packages/db/src/schema/projects.ts`](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/projects.ts) (Projects)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_org["Organization &amp; planning"]
  node_company["Company model<br/>[companies.ts]"]
  node_goals["Goals<br/>[goals.ts]"]
  node_projects["Projects<br/>[projects.ts]"]
  node_issues["Work issues<br/>[issues.ts]"]
  node_pipeline["Pipelines &amp; cases<br/>[pipeline_cases.ts]"]
end

subgraph group_execution["Agent execution"]
  node_agents["Agent registry<br/>[agents.ts]"]
  node_heartbeat["Heartbeat runs<br/>[heartbeat_runs.ts]"]
  node_adapters["Agent adapters"]
  node_runner["Agent runner"]
  node_workspace["Execution workspaces"]
end

subgraph group_governance["Governance &amp; operations"]
  node_budgets["Budgets &amp; costs<br/>[agents.ts]"]
  node_approvals["Approvals &amp; access<br/>[tool_access.ts]"]
  node_auth["Authentication"]
end

subgraph group_platform["Application platform"]
  node_dashboard["Unified dashboard"]
  node_api["REST API"]
  node_connectors["Chat &amp; connectors"]
  node_voice["Voice sessions"]
  node_storage["Workspace snapshots"]
  node_restore["Git restore points"]
  node_database[("Relational database")]
  node_cli["Admin CLI"]
end

node_user(("Team user"))
node_external_agents{{"Agent providers"}}

node_user -->|"manages"| node_dashboard
node_dashboard -.->|"API requests"| node_api
node_api -.->|"manages"| node_company
node_api -.->|"tracks"| node_goals
node_api -.->|"manages"| node_projects
node_api -.->|"coordinates"| node_issues
node_api -.->|"configures"| node_agents
node_issues -.->|"records runs"| node_heartbeat
node_api -.->|"manages cases"| node_pipeline
node_api -.->|"enforces limits"| node_budgets
node_api -.->|"applies governance"| node_approvals
node_api -.->|"authenticates"| node_auth
node_api -.->|"integrates channels"| node_connectors
node_api -->|"coordinates calls"| node_voice
node_api -->|"authorizes runtime"| node_workspace
node_workspace -.->|"enables execution"| node_runner
node_runner -.->|"dispatches agents"| node_adapters
node_adapters -.->|"runs tasks"| node_external_agents
node_workspace -.->|"snapshots state"| node_storage
node_workspace -.->|"captures restore points"| node_restore
node_company -->|"persists"| node_database
node_agents -->|"persists"| node_database
node_projects -->|"persists"| node_database
node_cli -->|"configures instance"| node_user

click node_dashboard "https://github.com/lumekh000/papaerclip/tree/main/ui/src"
click node_api "https://github.com/lumekh000/papaerclip/tree/main/server/src"
click node_company "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/companies.ts"
click node_goals "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/goals.ts"
click node_projects "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/projects.ts"
click node_issues "https://github.com/lumekh000/papaerclip/blob/main/server/src/services/issues.ts"
click node_agents "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/agents.ts"
click node_heartbeat "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/heartbeat_runs.ts"
click node_adapters "https://github.com/lumekh000/papaerclip/tree/main/packages/adapters"
click node_runner "https://github.com/lumekh000/papaerclip/tree/main/packages/paperclip-runner/src"
click node_pipeline "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/pipeline_cases.ts"
click node_budgets "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/agents.ts"
click node_approvals "https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/tool_access.ts"
click node_auth "https://github.com/lumekh000/papaerclip/tree/main/server/src"
click node_connectors "https://github.com/lumekh000/papaerclip/tree/main/server/src/services/connectors"
click node_voice "https://github.com/lumekh000/papaerclip/blob/main/server/src/services/voice/voice-session-service.ts"
click node_storage "https://github.com/lumekh000/papaerclip/blob/main/server/src/services/remote-workspace-snapshot-storage.ts"
click node_restore "https://github.com/lumekh000/papaerclip/blob/main/server/src/services/git-restore-point-storage.ts"
click node_database "https://github.com/lumekh000/papaerclip/tree/main/packages/db/src"
click node_cli "https://github.com/lumekh000/papaerclip/tree/main/cli/src"

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_company,node_goals,node_projects,node_issues,node_pipeline,node_user toneBlue
class node_agents,node_heartbeat,node_adapters,node_runner,node_workspace toneAmber
class node_budgets,node_approvals,node_auth toneMint
class node_dashboard,node_api,node_connectors,node_voice,node_storage,node_restore,node_database,node_cli toneRose
class node_external_agents toneIndigo
```

## Components

### Organization & planning

- [Company model](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/companies.ts): `packages/db/src/schema/companies.ts`
- [Goals](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/goals.ts): `packages/db/src/schema/goals.ts`
- [Projects](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/projects.ts): `packages/db/src/schema/projects.ts`
- [Work issues](https://github.com/lumekh000/papaerclip/blob/main/server/src/services/issues.ts): `server/src/services/issues.ts`
- [Pipelines & cases](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/pipeline_cases.ts): `packages/db/src/schema/pipeline_cases.ts`

### Agent execution

- [Agent registry](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/agents.ts): `packages/db/src/schema/agents.ts`
- [Heartbeat runs](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/heartbeat_runs.ts): `packages/db/src/schema/heartbeat_runs.ts`
- [Agent adapters](https://github.com/lumekh000/papaerclip/tree/main/packages/adapters): `packages/adapters`
- [Agent runner](https://github.com/lumekh000/papaerclip/tree/main/packages/paperclip-runner/src): `packages/paperclip-runner/src`
- **Execution workspaces**

### Governance & operations

- [Budgets & costs](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/agents.ts): `packages/db/src/schema/agents.ts`
- [Approvals & access](https://github.com/lumekh000/papaerclip/blob/main/packages/db/src/schema/tool_access.ts): `packages/db/src/schema/tool_access.ts`
- [Authentication](https://github.com/lumekh000/papaerclip/tree/main/server/src): `server/src`

### Application platform

- [Unified dashboard](https://github.com/lumekh000/papaerclip/tree/main/ui/src): `ui/src`
- [REST API](https://github.com/lumekh000/papaerclip/tree/main/server/src): `server/src`
- [Chat & connectors](https://github.com/lumekh000/papaerclip/tree/main/server/src/services/connectors): `server/src/services/connectors`
- [Voice sessions](https://github.com/lumekh000/papaerclip/blob/main/server/src/services/voice/voice-session-service.ts): `server/src/services/voice/voice-session-service.ts`
- [Workspace snapshots](https://github.com/lumekh000/papaerclip/blob/main/server/src/services/remote-workspace-snapshot-storage.ts): `server/src/services/remote-workspace-snapshot-storage.ts`
- [Git restore points](https://github.com/lumekh000/papaerclip/blob/main/server/src/services/git-restore-point-storage.ts): `server/src/services/git-restore-point-storage.ts`
- [Relational database](https://github.com/lumekh000/papaerclip/tree/main/packages/db/src): `packages/db/src`
- [Admin CLI](https://github.com/lumekh000/papaerclip/tree/main/cli/src): `cli/src`

### Other components

- **Team user**
- **Agent providers**

## Connections

- Team user → Unified dashboard: manages (evidence: `README.md`)
- Unified dashboard → REST API: API requests (evidence: `README.md`)
- REST API → Company model: manages
- REST API → Goals: tracks
- REST API → Projects: manages (evidence: `packages/db/src/schema/projects.ts`)
- REST API → Work issues: coordinates (evidence: `server/src/services/voice/voice-session-service.ts`)
- REST API → Agent registry: configures (evidence: `packages/db/src/schema/agents.ts`)
- Work issues → Heartbeat runs: records runs
- REST API → Pipelines & cases: manages cases (evidence: `packages/db/src/schema/pipeline_cases.ts`)
- REST API → Budgets & costs: enforces limits
- REST API → Approvals & access: applies governance
- REST API → Authentication: authenticates
- REST API → Chat & connectors: integrates channels (evidence: `README.md`)
- REST API → Voice sessions: coordinates calls (evidence: `server/src/services/voice/voice-session-service.ts`)
- REST API → Execution workspaces: authorizes runtime (evidence: `server/src/routes/workspace-runtime-service-authz.ts`)
- Execution workspaces → Agent runner: enables execution
- Agent runner → Agent adapters: dispatches agents (evidence: `README.md`)
- Agent adapters → Agent providers: runs tasks (evidence: `README.md`)
- Execution workspaces → Workspace snapshots: snapshots state
- Execution workspaces → Git restore points: captures restore points
- Company model → Relational database: persists (evidence: `packages/db/src/schema/companies.ts`)
- Agent registry → Relational database: persists (evidence: `packages/db/src/schema/agents.ts`)
- Projects → Relational database: persists (evidence: `packages/db/src/schema/projects.ts`)
- Admin CLI → Team user: configures instance (evidence: `README.md`)
