# wesm/agentsview architecture

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

- Interactive diagram: https://gitdiagram.com/wesm/agentsview
- Repository: https://github.com/wesm/agentsview

## Overview

agentsview is a local-first archive and observability product for AI coding-agent sessions. Its main workflow discovers and syncs agent activity into a local SQLite archive, serves it through a daemon API, and presents sessions and reports in a web UI. The product also covers token costs, analytics, activity, semantic recall, project data, and optional archive sharing or database mirrors. README statements establish the high-level runtime flow; source excerpts and the index support the specific frontend, API, sync, and storage links shown. Unsampled subsystems are represented at their directory level.

Main entry points: [`cmd/agentsview/main.go`](https://github.com/wesm/agentsview/blob/main/cmd/agentsview/main.go) (CLI and daemon entry), [`frontend/src/App.svelte`](https://github.com/wesm/agentsview/blob/main/frontend/src/App.svelte) (Web application), [`internal/db`](https://github.com/wesm/agentsview/tree/main/internal/db) (Local archive), [`internal/sync`](https://github.com/wesm/agentsview/tree/main/internal/sync) (Session sync engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Capture and Sync"]
  node_capture["Source capture"]
  node_sync["Session sync engine"]
  node_parser["Agent parsers"]
end

subgraph group_archive["Archive and Query"]
  node_sqlite[("Local archive")]
  node_service["Session service<br/>[service.go]"]
  node_recall["Recall and insights"]
  node_vectors["Embedding search"]
end

subgraph group_serve["Daemon and API"]
  node_cli["CLI and daemon entry<br/>[main.go]"]
  node_server["HTTP API server"]
end

subgraph group_frontend["Web Experience"]
  node_web["Web application<br/>[App.svelte]"]
  node_api["Frontend API client<br/>[runtime.ts]"]
  node_messages["Session transcript view<br/>[MessageList.svelte]"]
  node_activity["Activity reports"]
  node_analytics["Analytics reports"]
  node_usage["Usage and costs<br/>[UsagePage.svelte]"]
end

subgraph group_extensions["Sharing and Mirrors"]
  node_artifacts["Archive exchange"]
  node_postgres[("PostgreSQL backend")]
  node_clickhouse[("ClickHouse backend")]
  node_duckdb[("DuckDB mirror")]
end

node_user(("Local user"))
node_agents["Agent session sources"]

node_user -->|"starts or queries"| node_cli
node_agents -->|"provides sessions"| node_capture
node_cli -->|"runs sync"| node_sync
node_capture -.->|"supplies sources"| node_sync
node_sync -->|"parses sessions"| node_parser
node_sync -->|"writes archive"| node_sqlite
node_cli -->|"starts daemon"| node_server
node_server -->|"serves session requests"| node_service
node_service -->|"reads archive"| node_sqlite
node_user -->|"browses archive"| node_web
node_web -.->|"requests data"| node_api
node_api -->|"calls API"| node_server
node_web -->|"renders transcripts"| node_messages
node_messages -.->|"loads session data"| node_api
node_web -->|"shows activity"| node_activity
node_web -.->|"shows analytics"| node_analytics
node_web -->|"shows costs"| node_usage
node_sqlite -.->|"provides archive reports"| node_activity
node_sqlite -.->|"provides archive reports"| node_analytics
node_sqlite -->|"stores usage data"| node_usage
node_user -.->|"requests recall"| node_recall
node_recall -.->|"uses archive"| node_sqlite
node_server -->|"routes embedding operations"| node_vectors
node_user -.->|"chooses sharing"| node_artifacts
node_cli -.->|"pushes archive"| node_postgres
node_cli -.->|"pushes archive"| node_clickhouse
node_cli -.->|"pushes mirror"| node_duckdb

click node_cli "https://github.com/wesm/agentsview/blob/main/cmd/agentsview/main.go"
click node_capture "https://github.com/wesm/agentsview/tree/main/internal/capture"
click node_sync "https://github.com/wesm/agentsview/tree/main/internal/sync"
click node_parser "https://github.com/wesm/agentsview/tree/main/internal/parser"
click node_sqlite "https://github.com/wesm/agentsview/tree/main/internal/db"
click node_service "https://github.com/wesm/agentsview/blob/main/internal/service/service.go"
click node_server "https://github.com/wesm/agentsview/blob/main/internal/server/huma_routes_sessions.go"
click node_web "https://github.com/wesm/agentsview/blob/main/frontend/src/App.svelte"
click node_api "https://github.com/wesm/agentsview/blob/main/frontend/src/lib/api/runtime.ts"
click node_messages "https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/content/MessageList.svelte"
click node_activity "https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/activity/ActivityPage.svelte"
click node_analytics "https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/analytics/AnalyticsPage.svelte"
click node_usage "https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/usage/UsagePage.svelte"
click node_recall "https://github.com/wesm/agentsview/tree/main/internal/recall"
click node_vectors "https://github.com/wesm/agentsview/tree/main/internal/vector"
click node_artifacts "https://github.com/wesm/agentsview/tree/main/internal/artifact"
click node_postgres "https://github.com/wesm/agentsview/tree/main/internal/postgres"
click node_clickhouse "https://github.com/wesm/agentsview/tree/main/internal/clickhouse"
click node_duckdb "https://github.com/wesm/agentsview/tree/main/internal/duckdb"

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_capture,node_sync,node_parser,node_user toneBlue
class node_sqlite,node_service,node_recall,node_vectors toneAmber
class node_cli,node_server toneMint
class node_web,node_api,node_messages,node_activity,node_analytics,node_usage toneRose
class node_artifacts,node_postgres,node_clickhouse,node_duckdb,node_agents toneIndigo
```

## Components

### Capture and Sync

- [Source capture](https://github.com/wesm/agentsview/tree/main/internal/capture): `internal/capture`
- [Session sync engine](https://github.com/wesm/agentsview/tree/main/internal/sync): `internal/sync`
- [Agent parsers](https://github.com/wesm/agentsview/tree/main/internal/parser): `internal/parser`

### Archive and Query

- [Local archive](https://github.com/wesm/agentsview/tree/main/internal/db): `internal/db`
- [Session service](https://github.com/wesm/agentsview/blob/main/internal/service/service.go): `internal/service/service.go`
- [Recall and insights](https://github.com/wesm/agentsview/tree/main/internal/recall): `internal/recall`
- [Embedding search](https://github.com/wesm/agentsview/tree/main/internal/vector): `internal/vector`

### Daemon and API

- [CLI and daemon entry](https://github.com/wesm/agentsview/blob/main/cmd/agentsview/main.go): `cmd/agentsview/main.go`
- [HTTP API server](https://github.com/wesm/agentsview/blob/main/internal/server/huma_routes_sessions.go): `internal/server/huma_routes_sessions.go`

### Web Experience

- [Web application](https://github.com/wesm/agentsview/blob/main/frontend/src/App.svelte): `frontend/src/App.svelte`
- [Frontend API client](https://github.com/wesm/agentsview/blob/main/frontend/src/lib/api/runtime.ts): `frontend/src/lib/api/runtime.ts`
- [Session transcript view](https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/content/MessageList.svelte): `frontend/src/lib/components/content/MessageList.svelte`
- [Activity reports](https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/activity/ActivityPage.svelte): `frontend/src/lib/components/activity/ActivityPage.svelte`
- [Analytics reports](https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/analytics/AnalyticsPage.svelte): `frontend/src/lib/components/analytics/AnalyticsPage.svelte`
- [Usage and costs](https://github.com/wesm/agentsview/blob/main/frontend/src/lib/components/usage/UsagePage.svelte): `frontend/src/lib/components/usage/UsagePage.svelte`

### Sharing and Mirrors

- [Archive exchange](https://github.com/wesm/agentsview/tree/main/internal/artifact): `internal/artifact`
- [PostgreSQL backend](https://github.com/wesm/agentsview/tree/main/internal/postgres): `internal/postgres`
- [ClickHouse backend](https://github.com/wesm/agentsview/tree/main/internal/clickhouse): `internal/clickhouse`
- [DuckDB mirror](https://github.com/wesm/agentsview/tree/main/internal/duckdb): `internal/duckdb`

### Other components

- **Local user**
- **Agent session sources**

## Connections

- Local user → CLI and daemon entry: starts or queries
- Agent session sources → Source capture: provides sessions
- CLI and daemon entry → Session sync engine: runs sync (evidence: `cmd/agentsview/main.go`)
- Source capture → Session sync engine: supplies sources
- Session sync engine → Agent parsers: parses sessions (evidence: `internal/sync/engine_sources.go`)
- Session sync engine → Local archive: writes archive
- CLI and daemon entry → HTTP API server: starts daemon
- HTTP API server → Session service: serves session requests (evidence: `internal/server/huma_routes_sessions.go`)
- Session service → Local archive: reads archive (evidence: `internal/service/service.go`)
- Local user → Web application: browses archive
- Web application → Frontend API client: requests data
- Frontend API client → HTTP API server: calls API
- Web application → Session transcript view: renders transcripts (evidence: `frontend/src/App.svelte`)
- Session transcript view → Frontend API client: loads session data
- Web application → Activity reports: shows activity (evidence: `frontend/src/App.svelte`)
- Web application → Analytics reports: shows analytics (evidence: `frontend/src/App.svelte`)
- Web application → Usage and costs: shows costs (evidence: `frontend/src/App.svelte`)
- Local archive → Activity reports: provides archive reports
- Local archive → Analytics reports: provides archive reports
- Local archive → Usage and costs: stores usage data
- Local user → Recall and insights: requests recall
- Recall and insights → Local archive: uses archive (evidence: `internal/recall/extract/manager.go`)
- HTTP API server → Embedding search: routes embedding operations
- Local user → Archive exchange: chooses sharing
- CLI and daemon entry → PostgreSQL backend: pushes archive
- CLI and daemon entry → ClickHouse backend: pushes archive
- CLI and daemon entry → DuckDB mirror: pushes mirror
