# inorbithr/ahto architecture

> Architecture diagram of the GitHub repository inorbithr/ahto, 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/inorbithr/ahto
- Repository: https://github.com/inorbithr/ahto

## Overview

ahto is a local code-intelligence engine: a user crawls a repository, ahto ingests its Git history and parses code, then stores the results as a queryable Parquet lake backed by DuckDB. Users and coding agents access that lake through a local multi-protocol gateway and web app. The README documents these product-level flows and capabilities; sampled source confirms selected CLI, ingestion, API-client, and UI relationships, but many backend connections are not shown in the excerpts.

Main entry points: [`ui/app/src/app.tsx`](https://github.com/inorbithr/ahto/blob/main/ui/app/src/app.tsx) (Web application), [`src/lake/writer.go`](https://github.com/inorbithr/ahto/blob/main/src/lake/writer.go) (Parquet lake), [`src/protocol/server.go`](https://github.com/inorbithr/ahto/blob/main/src/protocol/server.go) (Protocol gateway), [`ui/app/src/views/workbench.tsx`](https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/workbench.tsx) (Code workbench)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Repository ingestion"]
  node_cli["CLI commands<br/>[cli.go]"]
  node_crawl["Crawl orchestration<br/>[crawl.go]"]
  node_git["Git history reader<br/>[runner.go]"]
  node_ingestwrite["History ingestion<br/>[ingest.go]"]
  node_parser["Code parser<br/>[run.go]"]
end

subgraph group_lake["Lake and analysis"]
  node_lake[("Parquet lake<br/>[writer.go]")]
  node_query["SQL query engine<br/>[query.go]"]
  node_storage["Lake maintenance<br/>[storage.go]"]
end

subgraph group_gateway["Gateway and services"]
  node_protocol["Protocol gateway<br/>[server.go]"]
  node_source["Source API service<br/>[service.go]"]
  node_function["Function service<br/>[service.go]"]
  node_agent["Agent service<br/>[service.go]"]
end

subgraph group_ui["Web application"]
  node_webapp["Web application<br/>[app.tsx]"]
  node_api["API client<br/>[api.ts]"]
  node_sourceclient["Source data client<br/>[source.ts]"]
  node_routes["Code navigation<br/>[code-route.ts]"]
  node_workbench["Code workbench<br/>[workbench.tsx]"]
  node_lakeview["Lake browser<br/>[lake.tsx]"]
  node_lenses["Repository lenses<br/>[lenses.tsx]"]
  node_queryview["SQL designer<br/>[query.tsx]"]
  node_querydata["SQL design model<br/>[query-data.ts]"]
  node_debugui["Debugger UI<br/>[debug.ts]"]
  node_highlight["Code highlighting<br/>[code-highlight.ts]"]
  node_highlightparse["Highlight parser"]
  node_uitypes["Generated API types<br/>[source_pb.ts]"]
  node_securitytypes["Security API types<br/>[security_pb.ts]"]
  node_format["Display formatting<br/>[format.ts]"]
  node_notifications["Notifications<br/>[notifications.tsx]"]
  node_parts["Shared UI components<br/>[parts.tsx]"]
end

subgraph group_operations["Security and operations"]
  node_advisory["Advisory matching<br/>[sync.go]"]
  node_secscan["Security scanning<br/>[secscan.go]"]
  node_identity["Identity service<br/>[service.go]"]
  node_p2p["Peer networking<br/>[service.go]"]
end

node_user(("Repository user"))

node_user -->|"runs commands"| node_cli
node_cli -->|"starts crawl"| node_crawl
node_crawl -.->|"reads history"| node_git
node_crawl -.->|"ingests objects"| node_ingestwrite
node_ingestwrite -.->|"writes tables"| node_lake
node_ingestwrite -.->|"parses source"| node_parser
node_parser -.->|"stores parse results"| node_lake
node_lake -->|"provides tables"| node_query
node_query -->|"reads lake data"| node_lake
node_cli -->|"executes SQL"| node_query
node_cli -->|"runs maintenance"| node_storage
node_storage -->|"rewrites lake"| node_lake
node_advisory -.->|"matches packages"| node_lake
node_secscan -.->|"scans code"| node_lake
node_user -->|"connects locally"| node_protocol
node_protocol -->|"serves source RPCs"| node_source
node_source -.->|"serves lake data"| node_lake
node_protocol -->|"serves function RPCs"| node_function
node_protocol -->|"serves agent API"| node_agent
node_protocol -->|"serves identity RPCs"| node_identity
node_protocol -->|"serves peer RPCs"| node_p2p
node_user -->|"uses browser"| node_webapp
node_webapp -->|"renders views"| node_workbench
node_webapp -->|"renders lake view"| node_lakeview
node_webapp -->|"renders debugger"| node_debugui
node_workbench -->|"parses routes"| node_routes
node_workbench -->|"loads repository data"| node_sourceclient
node_lenses -->|"opens workbench"| node_workbench
node_lenses -->|"opens lake view"| node_lakeview
node_queryview -->|"builds SQL"| node_querydata
node_queryview -->|"loads schema"| node_sourceclient
node_webapp -->|"uses API client"| node_api
node_sourceclient -->|"calls gateway"| node_api
node_api -->|"requests local API"| node_protocol
node_sourceclient -->|"decodes messages"| node_uitypes
node_workbench -.->|"renders code"| node_highlight
node_highlight -->|"uses parser"| node_highlightparse
node_webapp -.->|"uses security messages"| node_securitytypes
node_workbench -.->|"formats display"| node_format
node_webapp -->|"shows notifications"| node_notifications
node_webapp -->|"uses shared components"| node_parts
node_agent -.->|"runs code agents"| node_lake

click node_cli "https://github.com/inorbithr/ahto/blob/main/cli/cli.go"
click node_crawl "https://github.com/inorbithr/ahto/blob/main/src/crawl/crawl.go"
click node_git "https://github.com/inorbithr/ahto/blob/main/src/git/runner.go"
click node_ingestwrite "https://github.com/inorbithr/ahto/blob/main/src/crawl/ingest.go"
click node_parser "https://github.com/inorbithr/ahto/blob/main/src/parse/run.go"
click node_lake "https://github.com/inorbithr/ahto/blob/main/src/lake/writer.go"
click node_query "https://github.com/inorbithr/ahto/blob/main/src/query/query.go"
click node_storage "https://github.com/inorbithr/ahto/blob/main/src/query/storage.go"
click node_advisory "https://github.com/inorbithr/ahto/blob/main/src/advisory/sync.go"
click node_secscan "https://github.com/inorbithr/ahto/blob/main/src/secscan/secscan.go"
click node_protocol "https://github.com/inorbithr/ahto/blob/main/src/protocol/server.go"
click node_source "https://github.com/inorbithr/ahto/blob/main/src/source/service.go"
click node_function "https://github.com/inorbithr/ahto/blob/main/src/function/service.go"
click node_agent "https://github.com/inorbithr/ahto/blob/main/src/agent/service.go"
click node_identity "https://github.com/inorbithr/ahto/blob/main/src/identity/service.go"
click node_p2p "https://github.com/inorbithr/ahto/blob/main/src/p2p/service.go"
click node_webapp "https://github.com/inorbithr/ahto/blob/main/ui/app/src/app.tsx"
click node_api "https://github.com/inorbithr/ahto/blob/main/ui/app/src/api.ts"
click node_sourceclient "https://github.com/inorbithr/ahto/blob/main/ui/app/src/source.ts"
click node_routes "https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-route.ts"
click node_workbench "https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/workbench.tsx"
click node_lakeview "https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/lake.tsx"
click node_lenses "https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/lenses.tsx"
click node_queryview "https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/query.tsx"
click node_querydata "https://github.com/inorbithr/ahto/blob/main/ui/app/src/query-data.ts"
click node_debugui "https://github.com/inorbithr/ahto/blob/main/ui/app/src/debug.ts"
click node_highlight "https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-highlight.ts"
click node_highlightparse "https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-highlight-parse.ts"
click node_uitypes "https://github.com/inorbithr/ahto/blob/main/ui/app/src/gen/ahto/source/v1/source_pb.ts"
click node_securitytypes "https://github.com/inorbithr/ahto/blob/main/ui/app/src/gen/ahto/security/v1/security_pb.ts"
click node_format "https://github.com/inorbithr/ahto/blob/main/ui/app/src/format.ts"
click node_notifications "https://github.com/inorbithr/ahto/blob/main/ui/app/src/notifications.tsx"
click node_parts "https://github.com/inorbithr/ahto/blob/main/ui/app/src/parts.tsx"

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_crawl,node_git,node_ingestwrite,node_parser,node_user toneBlue
class node_lake,node_query,node_storage toneAmber
class node_protocol,node_source,node_function,node_agent toneMint
class node_webapp,node_api,node_sourceclient,node_routes,node_workbench,node_lakeview,node_lenses,node_queryview,node_querydata,node_debugui,node_highlight,node_highlightparse,node_uitypes,node_securitytypes,node_format,node_notifications,node_parts toneRose
class node_advisory,node_secscan,node_identity,node_p2p toneIndigo
```

## Components

### Repository ingestion

- [CLI commands](https://github.com/inorbithr/ahto/blob/main/cli/cli.go): `cli/cli.go`
- [Crawl orchestration](https://github.com/inorbithr/ahto/blob/main/src/crawl/crawl.go): `src/crawl/crawl.go`
- [Git history reader](https://github.com/inorbithr/ahto/blob/main/src/git/runner.go): `src/git/runner.go`
- [History ingestion](https://github.com/inorbithr/ahto/blob/main/src/crawl/ingest.go): `src/crawl/ingest.go`
- [Code parser](https://github.com/inorbithr/ahto/blob/main/src/parse/run.go): `src/parse/run.go`

### Lake and analysis

- [Parquet lake](https://github.com/inorbithr/ahto/blob/main/src/lake/writer.go): `src/lake/writer.go`
- [SQL query engine](https://github.com/inorbithr/ahto/blob/main/src/query/query.go): `src/query/query.go`
- [Lake maintenance](https://github.com/inorbithr/ahto/blob/main/src/query/storage.go): `src/query/storage.go`

### Gateway and services

- [Protocol gateway](https://github.com/inorbithr/ahto/blob/main/src/protocol/server.go): `src/protocol/server.go`
- [Source API service](https://github.com/inorbithr/ahto/blob/main/src/source/service.go): `src/source/service.go`
- [Function service](https://github.com/inorbithr/ahto/blob/main/src/function/service.go): `src/function/service.go`
- [Agent service](https://github.com/inorbithr/ahto/blob/main/src/agent/service.go): `src/agent/service.go`

### Web application

- [Web application](https://github.com/inorbithr/ahto/blob/main/ui/app/src/app.tsx): `ui/app/src/app.tsx`
- [API client](https://github.com/inorbithr/ahto/blob/main/ui/app/src/api.ts): `ui/app/src/api.ts`
- [Source data client](https://github.com/inorbithr/ahto/blob/main/ui/app/src/source.ts): `ui/app/src/source.ts`
- [Code navigation](https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-route.ts): `ui/app/src/code-route.ts`
- [Code workbench](https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/workbench.tsx): `ui/app/src/views/workbench.tsx`
- [Lake browser](https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/lake.tsx): `ui/app/src/views/lake.tsx`
- [Repository lenses](https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/lenses.tsx): `ui/app/src/views/lenses.tsx`
- [SQL designer](https://github.com/inorbithr/ahto/blob/main/ui/app/src/views/query.tsx): `ui/app/src/views/query.tsx`
- [SQL design model](https://github.com/inorbithr/ahto/blob/main/ui/app/src/query-data.ts): `ui/app/src/query-data.ts`
- [Debugger UI](https://github.com/inorbithr/ahto/blob/main/ui/app/src/debug.ts): `ui/app/src/debug.ts`
- [Code highlighting](https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-highlight.ts): `ui/app/src/code-highlight.ts`
- [Highlight parser](https://github.com/inorbithr/ahto/blob/main/ui/app/src/code-highlight-parse.ts): `ui/app/src/code-highlight-parse.ts`
- [Generated API types](https://github.com/inorbithr/ahto/blob/main/ui/app/src/gen/ahto/source/v1/source_pb.ts): `ui/app/src/gen/ahto/source/v1/source_pb.ts`
- [Security API types](https://github.com/inorbithr/ahto/blob/main/ui/app/src/gen/ahto/security/v1/security_pb.ts): `ui/app/src/gen/ahto/security/v1/security_pb.ts`
- [Display formatting](https://github.com/inorbithr/ahto/blob/main/ui/app/src/format.ts): `ui/app/src/format.ts`
- [Notifications](https://github.com/inorbithr/ahto/blob/main/ui/app/src/notifications.tsx): `ui/app/src/notifications.tsx`
- [Shared UI components](https://github.com/inorbithr/ahto/blob/main/ui/app/src/parts.tsx): `ui/app/src/parts.tsx`

### Security and operations

- [Advisory matching](https://github.com/inorbithr/ahto/blob/main/src/advisory/sync.go): `src/advisory/sync.go`
- [Security scanning](https://github.com/inorbithr/ahto/blob/main/src/secscan/secscan.go): `src/secscan/secscan.go`
- [Identity service](https://github.com/inorbithr/ahto/blob/main/src/identity/service.go): `src/identity/service.go`
- [Peer networking](https://github.com/inorbithr/ahto/blob/main/src/p2p/service.go): `src/p2p/service.go`

### Other components

- **Repository user**

## Connections

- Repository user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Crawl orchestration: starts crawl (evidence: `README.md`)
- Crawl orchestration → Git history reader: reads history
- Crawl orchestration → History ingestion: ingests objects
- History ingestion → Parquet lake: writes tables (evidence: `src/crawl/ingest.go`)
- History ingestion → Code parser: parses source
- Code parser → Parquet lake: stores parse results (evidence: `README.md`)
- Parquet lake → SQL query engine: provides tables (evidence: `README.md`)
- SQL query engine → Parquet lake: reads lake data (evidence: `src/query/query.go`)
- CLI commands → SQL query engine: executes SQL
- CLI commands → Lake maintenance: runs maintenance
- Lake maintenance → Parquet lake: rewrites lake (evidence: `src/query/storage.go`)
- Advisory matching → Parquet lake: matches packages (evidence: `README.md`)
- Security scanning → Parquet lake: scans code (evidence: `README.md`)
- Repository user → Protocol gateway: connects locally (evidence: `README.md`)
- Protocol gateway → Source API service: serves source RPCs (evidence: `src/source/service.go`)
- Source API service → Parquet lake: serves lake data (evidence: `README.md`)
- Protocol gateway → Function service: serves function RPCs (evidence: `src/function/service.go`)
- Protocol gateway → Agent service: serves agent API (evidence: `src/agent/service.go`)
- Protocol gateway → Identity service: serves identity RPCs (evidence: `src/identity/service.go`)
- Protocol gateway → Peer networking: serves peer RPCs (evidence: `src/p2p/service.go`)
- Repository user → Web application: uses browser (evidence: `README.md`)
- Web application → Code workbench: renders views (evidence: `ui/app/src/app.tsx`)
- Web application → Lake browser: renders lake view (evidence: `ui/app/src/app.tsx`)
- Web application → Debugger UI: renders debugger (evidence: `ui/app/src/app.tsx`)
- Code workbench → Code navigation: parses routes (evidence: `ui/app/src/views/workbench.tsx`)
- Code workbench → Source data client: loads repository data (evidence: `ui/app/src/views/workbench.tsx`)
- Repository lenses → Code workbench: opens workbench (evidence: `ui/app/src/views/lenses.tsx`)
- Repository lenses → Lake browser: opens lake view (evidence: `ui/app/src/views/lenses.tsx`)
- SQL designer → SQL design model: builds SQL (evidence: `ui/app/src/views/query.tsx`)
- SQL designer → Source data client: loads schema (evidence: `ui/app/src/source.ts`)
- Web application → API client: uses API client (evidence: `ui/app/src/api.ts`)
- Source data client → API client: calls gateway (evidence: `ui/app/src/source.ts`)
- API client → Protocol gateway: requests local API (evidence: `ui/app/src/api.ts`)
- Source data client → Generated API types: decodes messages (evidence: `ui/app/src/source.ts`)
- Code workbench → Code highlighting: renders code (evidence: `ui/app/src/views/query.tsx`)
- Code highlighting → Highlight parser: uses parser (evidence: `ui/app/src/code-highlight.ts`)
- Web application → Security API types: uses security messages
- Code workbench → Display formatting: formats display (evidence: `ui/app/src/views/workbench.tsx`)
- Web application → Notifications: shows notifications (evidence: `ui/app/src/app.tsx`)
- Web application → Shared UI components: uses shared components (evidence: `ui/app/src/app.tsx`)
- Agent service → Parquet lake: runs code agents (evidence: `README.md`)
