# microsoft/scope architecture

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

- Interactive diagram: https://gitdiagram.com/microsoft/scope
- Repository: https://github.com/microsoft/scope

## Overview

Scope is an agentic experience-evaluation platform: users define evaluation criteria, submit agent runs, follow execution, and inspect evidence and results through the Portal or CLI. The graph preserves run orchestration, worker execution, evaluation, reporting, and proxy/HAR evidence capture as distinct product stages. Source excerpts and the SOURCE INDEX establish only some internal calls; undocumented runtime links are shown as dashed and unverified rather than inferred.

Main entry points: [`apps/portal/src/App.tsx`](https://github.com/microsoft/scope/blob/main/apps/portal/src/App.tsx) (Web Portal), [`apps/workers/coder-acp-claude-code/src/index.ts`](https://github.com/microsoft/scope/blob/main/apps/workers/coder-acp-claude-code/src/index.ts) (Agent workers), [`apps/gateway/src/proxy/handler.rs`](https://github.com/microsoft/scope/blob/main/apps/gateway/src/proxy/handler.rs) (Dev proxy gateway), [`apps/api/src/index.ts`](https://github.com/microsoft/scope/blob/main/apps/api/src/index.ts) (Scope API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_portal["Web Portal<br/>[App.tsx]"]
  node_cli["CLI<br/>[run.ts]"]
  node_cli_http["CLI API client<br/>[api-client.ts]"]
end

subgraph group_control["Run control"]
  node_api["Scope API<br/>[index.ts]"]
  node_run_routes["Run routes<br/>[index.ts]"]
  node_scheduler["Run scheduler"]
  node_run_store[("Run records<br/>[runs-repo.ts]")]
end

subgraph group_execution["Agent execution"]
  node_worker["Agent workers<br/>[index.ts]"]
end

subgraph group_evaluation["Evaluation and results"]
  node_postprocessor["Run post-processing<br/>[post-processor.ts]"]
  node_judge["Agent judge<br/>[judge-agent.ts]"]
  node_criteria["Evaluation criteria<br/>[criteria.ts]"]
  node_reports["Report generation"]
end

subgraph group_evidence["Evidence capture"]
  node_gateway["Dev proxy gateway<br/>[handler.rs]"]
  node_sessions[("Proxy sessions<br/>[session.rs]")]
  node_har[("HAR capture<br/>[storage.rs]")]
  node_blob[("Blob storage<br/>[blob-storage.ts]")]
end

node_user(("Evaluator"))

node_user -->|"uses"| node_portal
node_user -->|"uses"| node_cli
node_portal -.->|"requests data"| node_api
node_cli -.->|"calls"| node_cli_http
node_cli_http -->|"sends HTTP"| node_api
node_api -.->|"routes requests"| node_run_routes
node_run_routes -.->|"schedules runs"| node_scheduler
node_scheduler -.->|"dispatches runs"| node_worker
node_worker -.->|"records outcomes"| node_run_store
node_postprocessor -.->|"evaluates runs"| node_judge
node_judge -.->|"applies criteria"| node_criteria
node_postprocessor -.->|"enables reporting"| node_reports
node_portal -->|"defines success"| node_criteria
node_portal -->|"inspects results"| node_reports
node_portal -.->|"inspects runs"| node_run_store
node_worker -.->|"routes product traffic"| node_gateway
node_gateway -->|"manages sessions"| node_sessions
node_gateway -->|"notifies plugins"| node_har
node_har -.->|"stores captures"| node_blob

click node_portal "https://github.com/microsoft/scope/blob/main/apps/portal/src/App.tsx"
click node_cli "https://github.com/microsoft/scope/blob/main/apps/cli/src/commands/run.ts"
click node_cli_http "https://github.com/microsoft/scope/blob/main/apps/cli/src/utils/api-client.ts"
click node_api "https://github.com/microsoft/scope/blob/main/apps/api/src/index.ts"
click node_run_routes "https://github.com/microsoft/scope/blob/main/apps/api/src/routes/requests/index.ts"
click node_scheduler "https://github.com/microsoft/scope/blob/main/apps/scheduler/src/request-scheduler.ts"
click node_worker "https://github.com/microsoft/scope/blob/main/apps/workers/coder-acp-claude-code/src/index.ts"
click node_postprocessor "https://github.com/microsoft/scope/blob/main/apps/workers/post-processor/src/post-processor.ts"
click node_judge "https://github.com/microsoft/scope/blob/main/apps/judge/src/judge-agent.ts"
click node_criteria "https://github.com/microsoft/scope/blob/main/apps/api/src/routes/criteria.ts"
click node_reports "https://github.com/microsoft/scope/blob/main/apps/workers/report-generator/src/report-queue-processor.ts"
click node_run_store "https://github.com/microsoft/scope/blob/main/apps/api/src/runs-repo.ts"
click node_gateway "https://github.com/microsoft/scope/blob/main/apps/gateway/src/proxy/handler.rs"
click node_sessions "https://github.com/microsoft/scope/blob/main/apps/gateway/src/session.rs"
click node_har "https://github.com/microsoft/scope/blob/main/apps/gateway/src/plugins/har/storage.rs"
click node_blob "https://github.com/microsoft/scope/blob/main/packages/shared/src/storage/blob-storage.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_portal,node_cli,node_cli_http toneBlue
class node_api,node_run_routes,node_scheduler,node_run_store toneAmber
class node_worker toneMint
class node_postprocessor,node_judge,node_criteria,node_reports toneRose
class node_gateway,node_sessions,node_har,node_blob,node_user toneIndigo
```

## Components

### User interfaces

- [Web Portal](https://github.com/microsoft/scope/blob/main/apps/portal/src/App.tsx): `apps/portal/src/App.tsx`
- [CLI](https://github.com/microsoft/scope/blob/main/apps/cli/src/commands/run.ts): `apps/cli/src/commands/run.ts`
- [CLI API client](https://github.com/microsoft/scope/blob/main/apps/cli/src/utils/api-client.ts): `apps/cli/src/utils/api-client.ts`

### Run control

- [Scope API](https://github.com/microsoft/scope/blob/main/apps/api/src/index.ts): `apps/api/src/index.ts`
- [Run routes](https://github.com/microsoft/scope/blob/main/apps/api/src/routes/requests/index.ts): `apps/api/src/routes/requests/index.ts`
- [Run scheduler](https://github.com/microsoft/scope/blob/main/apps/scheduler/src/request-scheduler.ts): `apps/scheduler/src/request-scheduler.ts`
- [Run records](https://github.com/microsoft/scope/blob/main/apps/api/src/runs-repo.ts): `apps/api/src/runs-repo.ts`

### Agent execution

- [Agent workers](https://github.com/microsoft/scope/blob/main/apps/workers/coder-acp-claude-code/src/index.ts): `apps/workers/coder-acp-claude-code/src/index.ts`

### Evaluation and results

- [Run post-processing](https://github.com/microsoft/scope/blob/main/apps/workers/post-processor/src/post-processor.ts): `apps/workers/post-processor/src/post-processor.ts`
- [Agent judge](https://github.com/microsoft/scope/blob/main/apps/judge/src/judge-agent.ts): `apps/judge/src/judge-agent.ts`
- [Evaluation criteria](https://github.com/microsoft/scope/blob/main/apps/api/src/routes/criteria.ts): `apps/api/src/routes/criteria.ts`
- [Report generation](https://github.com/microsoft/scope/blob/main/apps/workers/report-generator/src/report-queue-processor.ts): `apps/workers/report-generator/src/report-queue-processor.ts`

### Evidence capture

- [Dev proxy gateway](https://github.com/microsoft/scope/blob/main/apps/gateway/src/proxy/handler.rs): `apps/gateway/src/proxy/handler.rs`
- [Proxy sessions](https://github.com/microsoft/scope/blob/main/apps/gateway/src/session.rs): `apps/gateway/src/session.rs`
- [HAR capture](https://github.com/microsoft/scope/blob/main/apps/gateway/src/plugins/har/storage.rs): `apps/gateway/src/plugins/har/storage.rs`
- [Blob storage](https://github.com/microsoft/scope/blob/main/packages/shared/src/storage/blob-storage.ts): `packages/shared/src/storage/blob-storage.ts`

### Other components

- **Evaluator**

## Connections

- Evaluator → Web Portal: uses (evidence: `README.md`)
- Evaluator → CLI: uses (evidence: `README.md`)
- Web Portal → Scope API: requests data
- CLI → CLI API client: calls
- CLI API client → Scope API: sends HTTP (evidence: `apps/cli/src/utils/api-client.ts`)
- Scope API → Run routes: routes requests
- Run routes → Run scheduler: schedules runs
- Run scheduler → Agent workers: dispatches runs
- Agent workers → Run records: records outcomes
- Run post-processing → Agent judge: evaluates runs
- Agent judge → Evaluation criteria: applies criteria
- Run post-processing → Report generation: enables reporting
- Web Portal → Evaluation criteria: defines success (evidence: `README.md`)
- Web Portal → Report generation: inspects results (evidence: `README.md`)
- Web Portal → Run records: inspects runs
- Agent workers → Dev proxy gateway: routes product traffic
- Dev proxy gateway → Proxy sessions: manages sessions (evidence: `apps/gateway/src/proxy/handler.rs`)
- Dev proxy gateway → HAR capture: notifies plugins
- HAR capture → Blob storage: stores captures
