# rjshree20/paperclip architecture

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

- Interactive diagram: https://gitdiagram.com/rjshree20/paperclip
- Repository: https://github.com/rjshree20/paperclip

## Overview

Paperclip is an open-source platform for operating AI-agent organizations. A user defines company goals, sets up agents and governance, assigns work, and starts execution; the dashboard then supports review, monitoring, and cost oversight. The server and runner provide orchestration, while adapters connect varied agent runtimes. The README also highlights training and skills, routines, integrations, and infrastructure controls. The excerpts establish schema responsibilities and selected storage behavior, but do not expose the main server routing or execution call chain, so those links are documented rather than inferred.

Main entry points: [`server/src/app.ts`](https://github.com/rjshree20/paperclip/blob/master/server/src/app.ts) (Server API), [`ui/src/App.tsx`](https://github.com/rjshree20/paperclip/blob/master/ui/src/App.tsx) (Dashboard), [`packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts`](https://github.com/rjshree20/paperclip/blob/master/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts) (Runner control plane), [`server/src/services/heartbeat/run-lifecycle.ts`](https://github.com/rjshree20/paperclip/blob/master/server/src/services/heartbeat/run-lifecycle.ts) (Heartbeat lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_work["Goals and work"]
  node_projects["Projects<br/>[projects.ts]"]
  node_goals["Goals<br/>[goals.ts]"]
  node_issues["Tasks and issues<br/>[issues.ts]"]
  node_pipelines["Workflow pipelines<br/>[pipelines.ts]"]
  node_pipeline_cases["Pipeline cases<br/>[pipeline_cases.ts]"]
  node_routines["Routines<br/>[routines.ts]"]
end

subgraph group_org["Organization and governance"]
  node_company["Companies<br/>[companies.ts]"]
  node_agents["Agents<br/>[agents.ts]"]
  node_skills["Skills and training"]
  node_training["Evaluations and history"]
  node_cost["Budgets and costs<br/>[companies.ts]"]
end

subgraph group_runtime["Execution runtime"]
  node_heartbeat["Heartbeat lifecycle<br/>[run-lifecycle.ts]"]
  node_runner["Runner control plane"]
  node_adapters["Agent adapters"]
end

subgraph group_platform["Platform services"]
  node_integrations["Connections and MCP"]
  node_db[("Postgres data<br/>[client.ts]")]
  node_workspace["Workspace snapshots"]
  node_backup["Harness backups"]
  node_storage["Storage service<br/>[types.ts]"]
  node_cli["CLI setup and operations<br/>[index.ts]"]
end

subgraph group_experience["User experience"]
  node_ui["Dashboard<br/>[App.tsx]"]
  node_api["Server API<br/>[app.ts]"]
end

node_user(("Human operator"))

node_user -->|"sets goals"| node_ui
node_ui -.->|"requests work"| node_api
node_api -.->|"manages organization"| node_company
node_api -.->|"configures agents"| node_agents
node_api -.->|"organizes goals"| node_projects
node_api -.->|"records intent"| node_goals
node_api -.->|"assigns tasks"| node_issues
node_api -.->|"configures workflows"| node_pipelines
node_api -.->|"tracks cases"| node_pipeline_cases
node_api -.->|"manages routines"| node_routines
node_api -.->|"persists state"| node_db
node_api -.->|"starts runs"| node_heartbeat
node_heartbeat -.->|"orchestrates"| node_runner
node_runner -.->|"dispatches agents"| node_adapters
node_adapters -.->|"returns results"| node_user
node_ui -.->|"manages training"| node_skills
node_ui -.->|"reviews quality"| node_training
node_ui -.->|"configures connections"| node_integrations
node_ui -.->|"monitors spend"| node_cost
node_runner -.->|"uses snapshots"| node_workspace
node_runner -.->|"stores backups"| node_backup
node_workspace -->|"uses storage"| node_storage
node_backup -->|"uses storage"| node_storage
node_cli -.->|"configures instance"| node_user

click node_ui "https://github.com/rjshree20/paperclip/blob/master/ui/src/App.tsx"
click node_api "https://github.com/rjshree20/paperclip/blob/master/server/src/app.ts"
click node_company "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/companies.ts"
click node_agents "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/agents.ts"
click node_projects "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/projects.ts"
click node_goals "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/goals.ts"
click node_issues "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/issues.ts"
click node_pipelines "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/pipelines.ts"
click node_pipeline_cases "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/pipeline_cases.ts"
click node_routines "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/routines.ts"
click node_heartbeat "https://github.com/rjshree20/paperclip/blob/master/server/src/services/heartbeat/run-lifecycle.ts"
click node_runner "https://github.com/rjshree20/paperclip/blob/master/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts"
click node_adapters "https://github.com/rjshree20/paperclip/tree/master/packages/adapters"
click node_skills "https://github.com/rjshree20/paperclip/tree/master/packages"
click node_integrations "https://github.com/rjshree20/paperclip/tree/master/packages"
click node_db "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/client.ts"
click node_workspace "https://github.com/rjshree20/paperclip/blob/master/server/src/services/remote-workspace-snapshot-storage.ts"
click node_backup "https://github.com/rjshree20/paperclip/blob/master/server/src/services/native-runtime/native-harness-backup-storage.ts"
click node_storage "https://github.com/rjshree20/paperclip/blob/master/server/src/storage/types.ts"
click node_cli "https://github.com/rjshree20/paperclip/blob/master/cli/src/index.ts"
click node_training "https://github.com/rjshree20/paperclip/tree/master/packages"
click node_cost "https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/companies.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_projects,node_goals,node_issues,node_pipelines,node_pipeline_cases,node_routines toneBlue
class node_company,node_agents,node_skills,node_training,node_cost toneAmber
class node_heartbeat,node_runner,node_adapters toneMint
class node_integrations,node_db,node_workspace,node_backup,node_storage,node_cli toneRose
class node_ui,node_api,node_user toneIndigo
```

## Components

### Goals and work

- [Projects](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/projects.ts): `packages/db/src/schema/projects.ts`
- [Goals](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/goals.ts): `packages/db/src/schema/goals.ts`
- [Tasks and issues](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/issues.ts): `packages/db/src/schema/issues.ts`
- [Workflow pipelines](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/pipelines.ts): `packages/db/src/schema/pipelines.ts`
- [Pipeline cases](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/pipeline_cases.ts): `packages/db/src/schema/pipeline_cases.ts`
- [Routines](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/routines.ts): `packages/db/src/schema/routines.ts`

### Organization and governance

- [Companies](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/companies.ts): `packages/db/src/schema/companies.ts`
- [Agents](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/agents.ts): `packages/db/src/schema/agents.ts`
- [Skills and training](https://github.com/rjshree20/paperclip/tree/master/packages): `packages`
- [Evaluations and history](https://github.com/rjshree20/paperclip/tree/master/packages): `packages`
- [Budgets and costs](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/schema/companies.ts): `packages/db/src/schema/companies.ts`

### Execution runtime

- [Heartbeat lifecycle](https://github.com/rjshree20/paperclip/blob/master/server/src/services/heartbeat/run-lifecycle.ts): `server/src/services/heartbeat/run-lifecycle.ts`
- [Runner control plane](https://github.com/rjshree20/paperclip/blob/master/packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts): `packages/paperclip-runner/src/control-plane/durable-prp-control-plane.ts`
- [Agent adapters](https://github.com/rjshree20/paperclip/tree/master/packages/adapters): `packages/adapters`

### Platform services

- [Connections and MCP](https://github.com/rjshree20/paperclip/tree/master/packages): `packages`
- [Postgres data](https://github.com/rjshree20/paperclip/blob/master/packages/db/src/client.ts): `packages/db/src/client.ts`
- [Workspace snapshots](https://github.com/rjshree20/paperclip/blob/master/server/src/services/remote-workspace-snapshot-storage.ts): `server/src/services/remote-workspace-snapshot-storage.ts`
- [Harness backups](https://github.com/rjshree20/paperclip/blob/master/server/src/services/native-runtime/native-harness-backup-storage.ts): `server/src/services/native-runtime/native-harness-backup-storage.ts`
- [Storage service](https://github.com/rjshree20/paperclip/blob/master/server/src/storage/types.ts): `server/src/storage/types.ts`
- [CLI setup and operations](https://github.com/rjshree20/paperclip/blob/master/cli/src/index.ts): `cli/src/index.ts`

### User experience

- [Dashboard](https://github.com/rjshree20/paperclip/blob/master/ui/src/App.tsx): `ui/src/App.tsx`
- [Server API](https://github.com/rjshree20/paperclip/blob/master/server/src/app.ts): `server/src/app.ts`

### Other components

- **Human operator**

## Connections

- Human operator → Dashboard: sets goals
- Dashboard → Server API: requests work
- Server API → Companies: manages organization
- Server API → Agents: configures agents
- Server API → Projects: organizes goals
- Server API → Goals: records intent
- Server API → Tasks and issues: assigns tasks
- Server API → Workflow pipelines: configures workflows
- Server API → Pipeline cases: tracks cases
- Server API → Routines: manages routines
- Server API → Postgres data: persists state
- Server API → Heartbeat lifecycle: starts runs
- Heartbeat lifecycle → Runner control plane: orchestrates
- Runner control plane → Agent adapters: dispatches agents
- Agent adapters → Human operator: returns results
- Dashboard → Skills and training: manages training
- Dashboard → Evaluations and history: reviews quality
- Dashboard → Connections and MCP: configures connections
- Dashboard → Budgets and costs: monitors spend
- Runner control plane → Workspace snapshots: uses snapshots
- Runner control plane → Harness backups: stores backups
- Workspace snapshots → Storage service: uses storage (evidence: `server/src/services/remote-workspace-snapshot-storage.ts`)
- Harness backups → Storage service: uses storage (evidence: `server/src/services/native-runtime/native-harness-backup-storage.ts`)
- CLI setup and operations → Human operator: configures instance
