# How to

Short recipes for the things people do with ahto, each with the commands to copy and what you should see.

Each recipe was run against a build of this repository. A recipe that only points to another
page says so and was not repeated here.

## Ask a question about a repository

```sh
ahto crawl ~/src/my-project
ahto query sql "select author_name, count(*) as commits from commits group by 1 order by 2 desc limit 3"
```

```text
author_name      commits
Nevio Vesic      293
Nevio Vesić      98
dependabot[bot]  6
```

(Names are from one repository's history; yours will differ.) The crawl prints a
table whose last column, `RUN`, is the id of this crawl. More in [getting started](/docs/getting-started)
and [querying](/docs/querying).

## Let an agent read your repositories

Run `ahto serve`, then point your agent's MCP settings at `http://127.0.0.1:8080/mcp`. How the
gateway serves its tools is in [the gateway](/docs/gateway#mcp). Not run for this page.

## Keep track of work with the task tree

A task tree lives on your machine. Add a project, two tasks under it, and list what can start:

```sh
ahto task add "Ship the docs"
ahto task add "Write networking page" --parent <project id> --hours 2 --state ready
ahto task add "Review it" --parent <project id> --hours 1
ahto task tree
ahto task ready
```

```text
ID                          STATE    HOURS  DUE  DONE  TITLE
01M8PB3VSRJF2BDPAG9ZAXRWYK  backlog  -      -    0/2   Ship the docs
01M8PB4DK1DCCADECGDCARB636  ready    2      -    -       Write networking page
01M8PB4DNX0QVKJKE6Z994Z9EP  backlog  1      -    -       Review it
```

`task ready` then lists only "Write networking page", the one in state `ready` with all its
dependencies done. Every command is in [commands](/docs/commands) and the rules (guards, states) in
[the gateway](/docs/gateway#the-task-service). While `ahto serve` runs it holds the task file; the
same commands reach it through the gateway with `--gateway host:port`.

## Skip CI checks whose inputs did not change

Put the checks in `ci/checks.json`, then run `ahto check run` twice. The second run says
`cached`. See [checks](/docs/checks).

## Speed up a second Go build

```sh
export GOCACHEPROG="ahto cas gocacheprog --dir $HOME/.cache/ahto-cas"
go build ./...
```

See [checks](/docs/checks#a-go-build-cache) for the measured hits and misses.

## Collect traces from your program

Start `ahto serve` and point your program's OpenTelemetry exporter at
`http://127.0.0.1:4318`. Read the traces with `GET /v1/debug/traces`. See [debugger](/docs/debugger).

## Connect two machines in a closed network

Make each machine's key, make a CA, admit both, and start `ahto serve` on each. The steps, with
the output of every command, are in [networking](/docs/networking#set-up-a-network). What the
network carries today is membership and sign-in; it does not yet carry your lake.

## Let a teammate sign in

Needs a members network whose node is in the authority group. See [identity](/docs/identity).

## Crawl a private repository

See [private repositories](/docs/private-repositories).

## Change a setting

See [configuration](/docs/configuration). A running gateway saves settings from the UI or with
`POST /v1/settings`; the keys that apply at once are marked there.