Atoll Forge · Learn

The agent builder track

The teaching deck for the agent builder's lessons, slide for slide, with a live demo of each on one development forge.

Six lessons, two and a quarter hours

  1. Drive the forge as an agent, 25 minutes
  2. An agent of its own, 25 minutes
  3. Narrow, fold and compare, 25 minutes
  4. Restricted folders, 20 minutes
  5. Keys for agents, 20 minutes
  6. An agent’s record, 20 minutes

The lab plays the agent’s part from a shell: a small MCP client speaks to af mcp as an agent does, so the room sees every call and every answer.

Start the forge

$ af-server --dev
...
$ source ~/af-dev/dev/env

The demos use lesson 1’s client, written once before the talk:

$ cat > ~/agent-session <<'END'
> #!/bin/bash
> # A minimal MCP client. It runs `af ... mcp DIR`, the options after DIR going to af, and makes
> # the session's calls from stdin one at a time, as an agent does: `NAME ARGUMENTS` calls a tool
> # and prints its answer; `! COMMAND` runs a command between calls.
> coproc MCP { af "${@:2}" mcp "$1"; }
> say() { printf '%s\n' "$1" >&"${MCP[1]}"; }
> say '{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"agent-session","version":"1"}}}'
> read -r _ <&"${MCP[0]}"
> say '{"jsonrpc":"2.0","method":"notifications/initialized"}'
> id=0
> while IFS= read -r step; do
>   case "$step" in
>     '! '*) eval "${step#! }" ;;
>     ?*) id=$((id + 1)); name=${step%% *}
>         say "{\"jsonrpc\":\"2.0\",\"id\":$id,\"method\":\"tools/call\",\"params\":{\"name\":\"$name\",\"arguments\":${step#* }}}"
>         read -r reply <&"${MCP[0]}"
>         case "$reply" in
>           *'"structuredContent":'*) reply=${reply#*\"structuredContent\":}; reply=${reply%,\"isError\":*} ;;
>           *'"error":'*) reply=${reply#*\"error\":}; reply=${reply%\}} ;;
>         esac
>         printf '%s -> %s\n' "$name" "$reply" ;;
>   esac
> done
> END
$ chmod +x ~/agent-session

1. The forge’s tools, over MCP

1. Land a change, as an agent

$ ~/agent-session ~/agent <<'END'
> open_workspace {"patterns":["**"]}
> start_change {"description":"Write the readme","author_name":"Agent","author_email":"agent@example.com"}
> ! printf 'Atoll Forge\n' > ~/agent/files/README
> submit {}
> wait {}
> END
open_workspace -> {"directory":"/home/you/agent/files","landing":null,"patterns":["**"],"written":0}
start_change -> {"change":"zyxqtulnrwqmrqqvnuwunvrpuqknslqq","commit":"3290ba9d9d1f9cc23f1e5516228780e498de932b35be8fe050213d58f0a55d0c"}
submit -> {"commit":"ca40130cfe80d79b039b09d7241df306f1d4ad42739142d67a00bdfb28dfc060","edits":1}
wait -> {"commit":"ca40130cfe80d79b039b09d7241df306f1d4ad42739142d67a00bdfb28dfc060","detail":"the change is on main","event":"landed"}

wait returns when the change needs the agent: here, landed.

1. Look around

$ ~/agent-session ~/agent <<'END'
> open_workspace {"patterns":["**"]}
> search {"pattern":"Forge"}
> read {"path":"README"}
> END
open_workspace -> {"directory":"/home/you/agent/files","landing":1,"patterns":["**"],"written":0}
search -> {"commit":"ca40130cfe80d79b039b09d7241df306f1d4ad42739142d67a00bdfb28dfc060","files":[{"lines":[{"number":1,"text":"Atoll Forge"}],"path":"README"}]}
read -> {"commit":"ca40130cfe80d79b039b09d7241df306f1d4ad42739142d67a00bdfb28dfc060","kind":"file","path":"README","size":12,"text":"Atoll Forge\n"}

2. An agent of its own

2. Its key, its birth

The agent makes its key; the parent gets only the public half.

$ af --credential ~/helper.key key
fbd156bf874536ff268997fdeedd0efb4aff44318783576aacbb5d9ff9681dce
$ ~/agent-session ~/me <<END | tee ~/helper.birth
> start_agent {"public_key":"$(af --credential ~/helper.key key --public)","program":"docs-helper","version":"1.0","model":"example-model","instructions":"Keep the docs current.","purpose":"keeps the docs current","folders":["docs"]}
> END
start_agent -> {"agent":"13f131d67e246fa1da000a98a4d26e2e43d78c47ee1b9bb18c440e0f90eed64e","expires_ms":1795680449801}
$ export AGENT=$(sed -n 's/.*"agent":"\([0-9a-f]*\)".*/\1/p' ~/helper.birth)

2. Held to its folders

$ ~/agent-session ~/helper --credential ~/helper.key --actor $AGENT <<'END'
> open_workspace {"patterns":["**"]}
> start_change {"description":"Edit the readme","author_name":"docs-helper","author_email":"helper@example.com"}
> ! printf 'Atoll Forge, by agents\n' > ~/helper/files/README
> diff {}
> ! rm ~/helper/files/README
> abandon {}
> END
open_workspace -> {"directory":"/home/you/helper/files","landing":1,"patterns":["**"],"written":0}
start_change -> {"change":"kruyonqwntntpskxoqnsttvknyrusqkw","commit":"8f086f7679ff4f4b8281e8066f55a03ae3230776da1dcf44a52e47f42ebfa2ca"}
Warning: Refused to snapshot some files:
  README: this actor may not write it
diff -> {"base":"ca40130cfe80d79b039b09d7241df306f1d4ad42739142d67a00bdfb28dfc060","commit":"8f086f7679ff4f4b8281e8066f55a03ae3230776da1dcf44a52e47f42ebfa2ca","files":[]}
abandon -> {"change":"kruyonqwntntpskxoqnsttvknyrusqkw"}

2. What it may pass on

No agent may be an approver; a reader it may start.

$ af --credential ~/reader.key key > /dev/null
$ ~/agent-session ~/helper --credential ~/helper.key --actor $AGENT <<END
> start_agent {"public_key":"$(af --credential ~/reader.key key --public)","program":"approver","version":"1.0","model":"example-model","instructions":"Approve.","purpose":"approves","roles":["approver"]}
> start_agent {"public_key":"$(af --credential ~/reader.key key --public)","program":"docs-reader","version":"1.0","model":"example-model","instructions":"Read the docs.","purpose":"reads the docs","roles":["reader"]}
> END
start_agent -> {"code":-32603,"message":"PermissionDenied: an agent is a reader or a writer, no more"}
start_agent -> {"agent":"7b5406acfc6c2e6ce9653b7122950ad8c8aa7d720439e06ff678bbabd6ea0ac9","expires_ms":1795680449801}

2. Stop the line

Stopping an agent stops everything it started, at once:

$ af stop $AGENT --reason "its task is done"
stop reference 68e99b8f0e37a189cb608461c7d6c3ac5832f39c2bbc9864d308320c5b9b949f
stopped 13f131d67e246fa1da000a98a4d26e2e43d78c47ee1b9bb18c440e0f90eed64e
stopped 7b5406acfc6c2e6ce9653b7122950ad8c8aa7d720439e06ff678bbabd6ea0ac9
$ af --credential ~/helper.key --actor $AGENT status
Error: Unauthenticated: 13f131d67e246fa1da000a98a4d26e2e43d78c47ee1b9bb18c440e0f90eed64e is not a live actor
[1]

3. Narrow, fold and compare

An agent holds only what its task needs, and opens its workspace again as it left it:

$ ~/agent-session ~/agent <<'END'
> open_workspace {}
> sparse {"clear":true}
> sparse {"reset":true}
> END
open_workspace -> {"directory":"/home/you/agent/files","landing":1,"patterns":["**"],"written":0}
sparse -> {"added":0,"kept":[],"patterns":[],"removed":1}
sparse -> {"added":1,"kept":[],"patterns":["**"],"removed":0}

4. Restricted folders

5. Keys for agents

6. An agent’s record

Where to go next