# jackulau/coding.sh architecture

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

- Interactive diagram: https://gitdiagram.com/jackulau/coding.sh
- Repository: https://github.com/jackulau/coding.sh

## Overview

coding.sh is a local observability and evaluation platform for AI coding agents. The main workflow is: configure agent capture, record agent activity, normalize and index sessions locally, then inspect and query them or turn failures into replayable evals and experiments. Separate capabilities include OpenTelemetry ingestion, an agent-facing MCP interface, production serving and SDKs, and benchmarking. The graph emphasizes runtime domains rather than setup tooling. Some subsystem links are based on README descriptions; unsampled implementation details are not inferred as direct calls.

Main entry points: [`packages/coding.sh/src/core/ingest.ts`](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/ingest.ts) (Session ingest), [`packages/coding.sh/src/server/routes.ts`](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/server/routes.ts) (Ingest and API server), [`packages/coding.sh/src/cli/commands`](https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/cli/commands) (CLI commands), [`packages/coding.sh/src/adapters/index.ts`](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/adapters/index.ts) (Agent adapters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Capture and ingest"]
  node_cli["CLI commands<br/>[commands]"]
  node_adapters["Agent adapters<br/>[index.ts]"]
  node_otel["OTel receiver<br/>[receiver.ts]"]
end

subgraph group_local["Local session data"]
  node_ingest["Session ingest<br/>[ingest.ts]"]
  node_schema["Trace schema<br/>[index.ts]"]
  node_redaction["Secret redaction<br/>[redact.ts]"]
  node_context["Store context<br/>[context.ts]"]
  node_pricing["Usage pricing<br/>[pricing.ts]"]
  node_sessions[("Session index<br/>[sessions.ts]")]
end

subgraph group_inspect["Inspect and access"]
  node_viewer["Local viewer<br/>[server.ts]"]
  node_query["Query engine<br/>[where.ts]"]
  node_mcp["MCP interface<br/>[server.ts]"]
end

subgraph group_evaluation["Evaluation and experiments"]
  node_eval["Eval workflows<br/>[eval]"]
  node_experiments["Experiments<br/>[experiments]"]
  node_bench["Benchmarks<br/>[bench]"]
end

subgraph group_production["Production interfaces"]
  node_server["Ingest and API server<br/>[routes.ts]"]
  node_gateway["Model gateway<br/>[route.ts]"]
  node_sdk["TypeScript SDK<br/>[client.ts]"]
  node_pgstore[("Postgres store<br/>[index-store.ts]")]
  node_chstore[("ClickHouse store<br/>[client.ts]")]
end

node_user(("Developer"))
node_agents{{"Coding agents"}}
node_apps{{"Instrumented apps"}}

node_user -->|"runs commands"| node_cli
node_cli -->|"configures capture"| node_adapters
node_agents -.->|"emits sessions"| node_adapters
node_apps -->|"sends telemetry"| node_otel
node_otel -->|"routes ingest"| node_server
node_server -.->|"accepts events"| node_ingest
node_adapters -.->|"provides capture data"| node_ingest
node_ingest -->|"redacts content"| node_redaction
node_ingest -->|"folds sessions"| node_sessions
node_ingest -->|"normalizes events"| node_schema
node_context -->|"runs backfill"| node_ingest
node_ingest -->|"prices usage"| node_pricing
node_context -.->|"opens stores"| node_sessions
node_user -->|"browses sessions"| node_viewer
node_viewer -.->|"queries sessions"| node_query
node_cli -->|"filters results"| node_query
node_agents -->|"reads sessions"| node_mcp
node_user -->|"creates evals"| node_eval
node_eval -->|"runs comparisons"| node_experiments
node_user -->|"runs benchmarks"| node_bench
node_apps -->|"adds instrumentation"| node_sdk
node_user -->|"serves production"| node_server
node_server -.->|"stores sessions"| node_pgstore
node_server -.->|"stores sessions"| node_chstore
node_user -.->|"routes model calls"| node_gateway

click node_cli "https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/cli/commands"
click node_adapters "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/adapters/index.ts"
click node_otel "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/otel/receiver.ts"
click node_ingest "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/ingest.ts"
click node_schema "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/schema/index.ts"
click node_redaction "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/redact.ts"
click node_context "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/context.ts"
click node_pricing "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/pricing.ts"
click node_sessions "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/sessions.ts"
click node_viewer "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/viewer/server.ts"
click node_query "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/query/where.ts"
click node_mcp "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/mcp/server.ts"
click node_eval "https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/eval"
click node_experiments "https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/experiments"
click node_bench "https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/bench"
click node_server "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/server/routes.ts"
click node_gateway "https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/integrations/gateway/route.ts"
click node_sdk "https://github.com/jackulau/coding.sh/blob/main/packages/sdk/src/client.ts"
click node_pgstore "https://github.com/jackulau/coding.sh/blob/main/packages/store-postgres/src/index-store.ts"
click node_chstore "https://github.com/jackulau/coding.sh/blob/main/packages/store-clickhouse/src/client.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_adapters,node_otel toneBlue
class node_ingest,node_schema,node_redaction,node_context,node_pricing,node_sessions toneAmber
class node_viewer,node_query,node_mcp toneMint
class node_eval,node_experiments,node_bench toneRose
class node_server,node_gateway,node_sdk,node_pgstore,node_chstore,node_user,node_agents,node_apps toneIndigo
```

## Components

### Capture and ingest

- [CLI commands](https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/cli/commands): `packages/coding.sh/src/cli/commands`
- [Agent adapters](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/adapters/index.ts): `packages/coding.sh/src/adapters/index.ts`
- [OTel receiver](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/otel/receiver.ts): `packages/coding.sh/src/otel/receiver.ts`

### Local session data

- [Session ingest](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/ingest.ts): `packages/coding.sh/src/core/ingest.ts`
- [Trace schema](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/schema/index.ts): `packages/coding.sh/src/schema/index.ts`
- [Secret redaction](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/redact.ts): `packages/coding.sh/src/core/redact.ts`
- [Store context](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/context.ts): `packages/coding.sh/src/core/context.ts`
- [Usage pricing](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/pricing.ts): `packages/coding.sh/src/core/pricing.ts`
- [Session index](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/core/sessions.ts): `packages/coding.sh/src/core/sessions.ts`

### Inspect and access

- [Local viewer](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/viewer/server.ts): `packages/coding.sh/src/viewer/server.ts`
- [Query engine](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/query/where.ts): `packages/coding.sh/src/query/where.ts`
- [MCP interface](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/mcp/server.ts): `packages/coding.sh/src/mcp/server.ts`

### Evaluation and experiments

- [Eval workflows](https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/eval): `packages/coding.sh/src/eval`
- [Experiments](https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/experiments): `packages/coding.sh/src/experiments`
- [Benchmarks](https://github.com/jackulau/coding.sh/tree/main/packages/coding.sh/src/bench): `packages/coding.sh/src/bench`

### Production interfaces

- [Ingest and API server](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/server/routes.ts): `packages/coding.sh/src/server/routes.ts`
- [Model gateway](https://github.com/jackulau/coding.sh/blob/main/packages/coding.sh/src/integrations/gateway/route.ts): `packages/coding.sh/src/integrations/gateway/route.ts`
- [TypeScript SDK](https://github.com/jackulau/coding.sh/blob/main/packages/sdk/src/client.ts): `packages/sdk/src/client.ts`
- [Postgres store](https://github.com/jackulau/coding.sh/blob/main/packages/store-postgres/src/index-store.ts): `packages/store-postgres/src/index-store.ts`
- [ClickHouse store](https://github.com/jackulau/coding.sh/blob/main/packages/store-clickhouse/src/client.ts): `packages/store-clickhouse/src/client.ts`

### Other components

- **Developer**
- **Coding agents**
- **Instrumented apps**

## Connections

- Developer → CLI commands: runs commands
- CLI commands → Agent adapters: configures capture
- Coding agents → Agent adapters: emits sessions
- Instrumented apps → OTel receiver: sends telemetry
- OTel receiver → Ingest and API server: routes ingest (evidence: `packages/coding.sh/src/server/routes.ts`)
- Ingest and API server → Session ingest: accepts events
- Agent adapters → Session ingest: provides capture data
- Session ingest → Secret redaction: redacts content (evidence: `packages/coding.sh/src/core/ingest.ts`)
- Session ingest → Session index: folds sessions (evidence: `packages/coding.sh/src/core/ingest.ts`)
- Session ingest → Trace schema: normalizes events (evidence: `packages/coding.sh/src/core/ingest.ts`)
- Store context → Session ingest: runs backfill (evidence: `packages/coding.sh/src/core/context.ts`)
- Session ingest → Usage pricing: prices usage (evidence: `packages/coding.sh/src/core/ingest.ts`)
- Store context → Session index: opens stores
- Developer → Local viewer: browses sessions
- Local viewer → Query engine: queries sessions (evidence: `packages/coding.sh/src/viewer/server.ts`)
- CLI commands → Query engine: filters results
- Coding agents → MCP interface: reads sessions
- Developer → Eval workflows: creates evals
- Eval workflows → Experiments: runs comparisons
- Developer → Benchmarks: runs benchmarks
- Instrumented apps → TypeScript SDK: adds instrumentation
- Developer → Ingest and API server: serves production
- Ingest and API server → Postgres store: stores sessions
- Ingest and API server → ClickHouse store: stores sessions
- Developer → Model gateway: routes model calls
