Layer 05 · Repository map

Repository map

One Bun monorepo holds everything: four deployable programs, three shared packages, and the definitions of the stores they run against. This is the layer where the concepts from the earlier pages get an address.

Major folders and what each one encapsulates

PathDomain concern
cli/The command-line tool and TUI: agent adapters (one per coding agent), local SQLite event store and indexer, share/sync client, git and agent hooks, release tooling.
api/The backend: self-hosted Convex functions, the /v1 HTTP REST API, auth and policies, the dual-write service layer to Tinybird, crons, the analysis outbox/worker, migrations, seeds, and the Docker compose stack for Postgres + backend.
frontend/The web app: Next.js App Router pages (catalog, profiles, trace viewer, settings, docs), the server-only data layer, same-origin API proxies, and the assistant chat UI.
agent/The assistant service: a Hono HTTP server running the Flue agent runtime, trace tools (search/list/show via the API, lookups via direct SQL), streaming chat, and write-behind conversation persistence.
packages/shared/@traces/shared: the cross-program type contract — trace/message/part models, API types generated from OpenAPI, typed Convex function references, Tinybird row types, and their generators.
packages/ai/@traces/ai: the AI-analysis data product — prompt program, input selection, output schema, and the deterministic fallback.
packages/launcher/@traces/launcher: opens commands in a new terminal window per platform; used by the CLI's resume feature.
tinybird/The analytics store as code: datasource schemas, pipes (SQL endpoints), fixtures, tests, and local/backup tooling.
cache/The shared cache deployment: Valkey fronted by the webdis HTTP gateway, plus the script that wires it into the backend.
observability/Telemetry plumbing: OpenTelemetry collector configs (including the SigNoz gateway) and translators that adapt Convex logs/metrics.
data/Captured real agent session files (per agent) plus scenario fixtures — shared test and seed material for adapters and the backend.
docs/Architecture references and per-project design documents kept alongside the code.
scripts/Repo-level operations scripts: the dev orchestrator, worktree helpers, reset tooling.
skills/The installable "share to Traces" skill content that traces setup writes into coding agents.
okf/A curated, structured knowledge folder about the system itself, aimed at machine readers.

Entry points worth opening first

BoundaryWhere
Database schema (the domain's source of truth)api/convex/schema.ts
Every HTTP route the platform exposesapi/convex/http.tsapi/convex/http/v1/
Scheduled work (crons)api/convex/crons.ts
The dual-write rule between the two storesapi/convex/services/traces.ts with api/convex/lib/tinybird.ts
CLI process entry and command treecli/src/index.ts, cli/src/commands/
The adapter contract all agents implementcli/src/adapters/adapter.ts
Assistant service entryagent/src/server.ts
Web app routesfrontend/app/

How the packages depend on each other

One shared type package fans out to every program; the AI package is consumed only by the backend; the launcher only by the CLI. Nothing depends on the deployable programs themselves — all coupling flows through @traces/shared or through HTTP at runtime.

flowchart TD
  SHARED["@traces/shared
types + generated contracts"] AI["@traces/ai
analysis program"] LAUNCH["@traces/launcher
terminal launcher"] CLI["@traces/cli
deployable: CLI + TUI"] API["api
deployable: Convex backend"] FE["frontend
deployable: Next.js web app"] AGENT["@traces/agent
deployable: assistant service"] TB[(Tinybird project
datasources + pipes)] CACHE[(Valkey + webdis)] CLI -- "message/part types, API client types" --> SHARED CLI -- "resume in a new terminal" --> LAUNCH API -- "domain types, generated API + Tinybird types" --> SHARED API -- "runs the analysis program" --> AI FE -- "API + assistant types" --> SHARED AGENT -- "session + tool contracts" --> SHARED AI -- "analysis schema types" --> SHARED API -. "pushes events, queries pipes" .-> TB API -. "caches via HTTP" .-> CACHE

Solid arrows are build-time package dependencies (from workspace manifests); dotted arrows are runtime couplings to the stores defined in this repo. The CLI and the web app never import each other's code, and the backend's public contract reaches the other programs only as generated types — which is why regenerating @traces/shared is the required ritual after changing an API shape.

Technology stack

LayerTechnologyGrounded in
Monorepo & runtimeBun workspaces, TypeScript 6, Biome for format/lintpackage.json, biome.json
BackendSelf-hosted Convex 1.42 (backend pinned by image digest) on Postgres 18; migrations, rate-limiter, and workpool componentsapi/package.json, api/docker-compose.yml, api/convex/convex.config.ts
Analytics storeTinybird (ClickHouse, ReplacingMergeTree tables), local dev via Tinybird Localtinybird/datasources/, tinybird/package.json
CacheValkey behind webdis (HTTP)cache/docker-compose.yml
Web appNext.js 16, React 19, Tailwind CSS v4, Radix UI, Fumadocs, Sentry, Vercel analyticsfrontend/package.json
CLIBun, OpenTUI + Solid.js for the TUI, SQLite for local storage, compiled binaries via npm and Homebrewcli/package.json, cli/scripts/
Assistant serviceBun + Hono, Flue agent runtime, Vercel AI SDK, Slonik/pg for direct SQL, OpenTelemetry, Sentryagent/package.json
LLM accessVercel AI SDK and Ax against OpenAI/Anthropic-compatible endpointsagent/package.json, packages/ai/package.json
External integrationsGitHub OAuth + GitHub App, Google OIDC, Hugging Face hub, models.dev, SigNoz via OpenTelemetry collectorsapi/convex/services/oauth/, api/convex/internal/github.ts, observability/