Development
This page says how to build and test ahto, how to run its web app, and where each part of the code lives.
mise tasks # list every task
mise run build # dist/ahto, one binary
mise run install:global # dist/ahto, then ~/.local/bin/ahto (mise install runs it too)
mise run test # tests with the race detector
mise run check # format, tidy, protos, vet, lint, tests, vulnerabilities, secrets
mise run ci # check, then the build; the same thing the CI workflow runs
mise run proto # regenerate src/pb/ from proto/
mise run bench # benchmarks with allocation counts
mise run compose:up # local PostgreSQL and ClickHouse (see adapters.md)
mise run test:adapters # adapter tests against them
mise run release # dist/ahto-<os>-<arch> for linux and darwin, with SHA256SUMSThe engine uses cgo (CGO_ENABLED=1) for DuckDB and the tree-sitter grammars, so the
build needs a C compiler. A target that is not this machine needs a C cross-compiler in
CC, for example CC="zig cc -target x86_64-linux-gnu" scripts/build.sh linux/amd64;
without one the script stops with that hint. The ahto front binary uses the standard
library only and builds without cgo.
Install from a release
scripts/get.sh installs a release for this user: it picks the binary for this machine,
checks it against SHA256SUMS, puts it in ~/.local/bin without sudo, then runs
ahto version and ahto doctor. --claude also registers the gateway in Claude Code, as
mise run mcp:add does. --dry-run says every step and changes nothing. On a terminal it
draws a progress bar for the download and colours its steps (NO_COLOR=1 turns colour
off); piped into a log it writes the same steps as plain lines.
sh scripts/get.sh --dry-run --claude # see what it would do
sh scripts/get.sh # the newest GitHub release
sh scripts/get.sh --version v0.1.0 # that release
sh scripts/get.sh --from dist # the release `mise run release` wrote to dist/
sh scripts/get.sh --help # every optionThe script runs the same when it is downloaded and piped to sh -s -- <options>; each
release carries it as get.sh. scripts/install.sh (mise run install:global) uses its
install step for dist/ahto.
Releases
Pushing a tag v* runs .github/workflows/release.yml. It builds ahto for linux and darwin
on amd64 and arm64, each on its own runner (cgo needs a native build), checks that each
binary reports the tag, and publishes a GitHub release with the binaries, SHA256SUMS,
get.sh and a build provenance attestation per binary. Linux builds on Ubuntu 22.04, so they
need glibc 2.35 or newer; musl systems such as Alpine are not supported yet.
git tag v0.1.0 && git push origin v0.1.0Protos live in proto/ (buf). To add a package, add a file under proto/ and run
mise run proto.
The web app
The web app is in ui/app (React, Vite, pnpm). The gateway does not serve it; in
development Vite does, and sends /api to the gateway.
mise run ui:setup # install its packages as pnpm-lock.yaml pins them, once
mise run dev:all # the gateway on 127.0.0.1:8080, then the UI on 127.0.0.1:8081
mise run ui:dev # the UI only, against a gateway already running (AHTO_UI_PORT, AHTO_API)
mise run ui:check # its typecheck and tests
mise run ui:build # build it into ui/app/dist
mise run ui:proto # regenerate its TypeScript from proto/ahto/sourceThe docs pages of the web app are built from README.md and the files of docs/, so a
change here shows up there.
Repository layout
| Path | What is there |
|---|---|
entrypoint/ | main.go of ahto, the one binary (answers a cached files listing before opening DuckDB, hands the rest to cli); check/main.go, ahto check alone for CI (standard library only) |
cli/ | The command line (urfave/cli v3): flags, config and logger wiring, commands |
src/crawl/, src/git/ | Crawling: ref selection, fetch and ingest, over the real git binary |
src/lake/ | The lake: Parquet tables, the manifest, the writer lock, the mirrors, the read models |
src/syncer/ | The steps after a crawl that crawl and serve share, and the periodic sync |
src/parse/ | The parsing tables, with go/parser and the tree-sitter grammars |
src/query/ | SQL over the lake with DuckDB, one view per table |
src/function/ | Functions over the lake: the built-ins and WebAssembly modules run by wazero |
src/advisory/, src/deps/, src/secscan/ | Security: the advisory feeds, manifests and lockfiles, and the code scan |
src/filelist/, src/filerole/, src/records/ | The files listing and its cache, file roles, and the output formats |
src/protocol/ | The gateway: catalog, surfaces, transcoding |
src/base/, src/source/, src/settings/ | The gateway's own services: base, the source service of the code browser, settings |
src/p2p/, src/identity/ | The peer-to-peer node, its membership log and authority group; sign-in and people on top of them |
src/agent/, src/debug/, src/task/ | The agents, debugger and task services of the gateway |
src/check/, src/cas/ | ahto check and the content-addressed store behind it |
src/egress/ | The credential proxy for agents that run with auth: api_key |
src/workspace/, src/runs/ | Building blocks for agents (patch workspace, run table), with no command or API yet |
src/adapters/ | Storage adapters: PostgreSQL, ClickHouse, DuckDB, Parquet |
src/config/, src/logger/, src/perf/ | Layered settings, zerolog, profiling |
src/internal/ | Small shared helpers (digest, lru) |
src/pb/ | Generated Go code and the embedded descriptor set |
proto/ | Proto sources and buf configuration |
migrations/ | Schema migrations per adapter kind, embedded in the binary |
third_party/ | The vendored tree-sitter grammars and their licences |
examples/ | A WebAssembly function to start from |
ui/app/ | The web app |
docs/ | These docs; also the docs pages of the web app |
scripts/, mise.toml | Build and dev scripts, pinned tools and tasks |
compose.yaml | Local PostgreSQL and ClickHouse |
atlas/ | Design documents: what was asked, found, decided and built |
The design documents cover how the project is built, the gateway, the adapters, and parsing and the lake.