CLI
Use this page to look up commands, options, exit codes, and environment variables for afe.
The afe command runs flows, serves the engine, and inspects tickets. It talks to a server over
the API unless a command says --local.
afe --help
afe <command> --help
afe validate
Check every manifest in a folder and print all the issues.
afe validate config/ # the folder positionally
afe validate -c config/ # or with the flag
| Option | Default | Meaning |
|---|---|---|
[folder] | — | The configuration folder, positionally (the same as --config). |
--config, -c | . | The configuration folder. |
Exit code 1 when there is any error, 0 otherwise.
afe serve
Serve the engine API on a configuration folder. The token comes from AFE_API_TOKEN.
| Option | Default | Meaning |
|---|---|---|
--config, -c | . | The configuration folder. |
--host | 127.0.0.1 | Interface to listen on. |
--port | 8765 | Port to listen on. |
--ops-host | 127.0.0.1 | Interface for /livez, /readyz and /metrics. |
--ops-port | off | Port for /livez, /readyz and /metrics; off when absent. |
--session-hours | 8 | Hours a browser session lasts. |
--ui | off | Serve the web UI too. |
afe worker
Run queued tickets until SIGINT or SIGTERM.
| Option | Default | Meaning |
|---|---|---|
--config, -c | . | The configuration folder. |
--concurrency | 1 | Tickets to run at once. |
--dry | off | Run agents on the dry harness. |
--ops-host | 127.0.0.1 | Interface for /livez, /readyz and /metrics. |
--ops-port | off | Port for /livez, /readyz and /metrics; off when absent. |
afe run
Start a ticket and follow it; answer its questions when there is a terminal.
| Option | Default | Meaning |
|---|---|---|
<flow> | — | The flow to run (positional). |
--input, -i | — | The ticket input (YAML). Required. |
--config, -c | . | The configuration folder, with --local. |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
--local | off | Run the engine in process. |
--dry | off | With --local: agents on the dry harness. |
--project | — | The project the flow works on. |
--revision | current | Run on this configuration revision, not the current one. |
afe resume
Answer a paused ticket (or restart it) and follow it.
| Option | Default | Meaning |
|---|---|---|
<ticket> | — | The ticket to resume (positional). |
[action] | — | The answer, one of the offered actions (positional). |
--comment | — | A comment with the answer. |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe rerun
Start a ticket again on the same configuration revision, and follow it.
| Option | Default | Meaning |
|---|---|---|
<ticket> | — | The ticket to run again (positional). |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe cancel
Cancel a ticket; its artifacts are kept.
| Option | Default | Meaning |
|---|---|---|
<ticket> | — | The ticket to cancel (positional). |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe clean
Remove a finished ticket's worktrees, branches, sandbox and bundles. A ticket that is not finished is refused. Running the command again finds nothing to remove.
It removes:
- The ticket's folder under
worktreesand its worktree registrations. - The
afe/<ticket key>/*branches in the clone the engine made for the project. - The ticket's sandbox and its stored bundles.
It keeps every branch when the repository is not a clone the engine made. That covers the project's own source, a local path and a repository whose .git is linked elsewhere. Only the ticket's worktree folder goes, and the command adds a line, branches kept: <repository>.
A clone made before V9f has no .git/afe-clone marker, so the engine does not delete its branches. Delete them by hand.
| Option | Default | Meaning |
|---|---|---|
<ticket> | — | The finished ticket to clean (positional). |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe inspect
Show a ticket: state, totals, the question it waits on, artifacts.
| Option | Default | Meaning |
|---|---|---|
<ticket> | — | The ticket to show (positional). |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe tickets
List tickets, the most recent first, reading every page of ticket.list until the last.
| Option | Default | Meaning |
|---|---|---|
--state | all | Only tickets in this state. |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe workers
List live workers and queue metrics.
| Option | Default | Meaning |
|---|---|---|
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe login
Sign in with the OpenID Connect device flow and keep the token for later commands. The command prints the address and the code the provider asks for, waits while you approve them, then stores the token for that server. No client secret is needed.
The token goes to ~/.config/afe/token, or to $XDG_CONFIG_HOME/afe/token when that variable is set.
The file holds one entry per server and is created with mode 0600. The CLI refuses to read a file
other accounts can read, and says to run chmod 600 on it. It renews an expired access token with the
refresh token, so you sign in again only when the provider ends the session.
| Option | Default | Meaning |
|---|---|---|
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
It exits 1 with one line when the provider denies the request, when the code expires, or when
the server has single sign-on turned off.
afe logout
Forget the token saved for one server. It prints signed out from <url>, or no saved token for <url>
when there was none.
| Option | Default | Meaning |
|---|---|---|
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe audit
Read the audit trail, newest first, with filters. jsonl and csv write one record per line as
each page arrives, so a long export streams.
| Option | Default | Meaning |
|---|---|---|
--since | — | Only entries at or after this instant. |
--until | — | Only entries before this instant. |
--actor | — | Only entries by this caller id. |
--action | — | Only entries with this action. |
--object | — | Only entries on this object id. |
--project | — | Only entries about this project. |
--outcome | — | accepted or refused. |
--format | table | table, jsonl or csv. |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
afe service-account
Create, list and revoke the engine's service accounts. The token of a new account is printed once.
| Option | Default | Meaning |
|---|---|---|
create <name> | — | Create an account, with --expires for the day it stops working. |
list | — | List the accounts, revoked ones included. |
revoke <name> | — | Revoke one account by name. |
--url | ws://127.0.0.1:8765/rpc | The engine API URL. |
Exit codes
| Code | Meaning |
|---|---|
0 | The ticket is done. |
2 | The ticket waits for a person. |
1 | Anything else: a failure, a bad configuration, an API error. |
Environment
| Variable | Read by | Meaning |
|---|---|---|
AFE_API_TOKEN | the remote commands | The bearer token. It wins over a token saved by afe login. |
XDG_CONFIG_HOME | afe login, afe logout and the remote commands | The folder that holds afe/token. Defaults to ~/.config. |
AFE_POSTGRES_DSN, AFE_REDIS_URL | serve, worker | The connection strings named by a Runtime (see Runtime). |
A remote command with no AFE_API_TOKEN and no saved token prints one line, error: set AFE_API_TOKEN to talk to a server, and exits 1 instead of a traceback.
When the saved session cannot be renewed, a command prints session expired: sign in again with afe login and exits 1. The same line appears when a watching command loses its connection because the
session ended.