Development
Install Rust, tmux, and cargo-nextest (cargo install cargo-nextest --locked).
Node.js and npm are needed only for the web dashboard.
cargo build # debug: TUI + daemon, no Node
cargo build --release # shipping build with LTO
cargo build --profile dev-release # optimized, without LTO
cargo build --features web # include the web dashboard
cargo nextest run --workspace
cargo fmt --all
cargo clippy --workspace
Local dashboard end-to-end tests on Linux require bubblewrap, iproute2, and
tmux. Host security policy must allow CAP_NET_ADMIN in bubblewrap’s children
to configure their private network namespace. The
web-e2e CI leg requires this coverage with
AOE_REQUIRE_LOCAL_NETWORK_TESTS=1; unavailable confinement fails the job.
The core-rest CI leg requires the scoped cancellation case to run with
AOE_REQUIRE_SCOPED_TESTS=1; any setup path that skips it must fail. Local runs
may skip the scoped case when no usable user manager exists; unscoped
cancellation still runs.
The aoe-agent contract test needs npm ci in acp-worker/aoe-agent and skips
without it. Set AOE_REQUIRE_AOE_AGENT_TESTS=1 in a job that installs those
dependencies to fail instead of skip.
The process-inspection executor test is ignored by default on Linux because it
requires Python 3 and private user, mount and PID namespaces. Run it explicitly
on a host that supports unshare:
cargo test --lib cli::serve::tests::tui_control_inspection_keeps_the_async_executor_reactive -- --exact --ignored --nocapture
Missing prerequisites fail explicit Linux runs. On macOS this test runs by
default and requires Python 3, so a missing python3 also fails normal test runs.
Creation-progress events are advisory and publish independently of session snapshots. Tests that need a published session must wait for its ID in the canonical snapshot. Hold in-flight fixture gates until explicit release, with cleanup that waits for release acknowledgment and lets a late hook exit when its gate directory disappears. Keep request deadlines longer than the bounded scenario and assert the expected API error code, not merely any error. Keep an emergency hook watchdog beyond the request budget for abrupt test-process exit.
The binary is target/{profile}/aoe. Web commands and test selection live in web/AGENTS.md.
Live web fixtures own any Daemon started by seedFn, including when seeding
fails. Teardown stops that Daemon before its runners and removes the isolated
HOME only after cleanup succeeds. A shutdown failure retains HOME for diagnosis.
When adding a mutating REST route, classify it in the CityHall allow or deny table in src/server/access.rs. Audit its handler or declare an exact, justified exemption in src/server/api/mod.rs.
Debug builds carry line tables only, and dependencies carry no debug info, to keep target/ small across worktrees. Panics still name the file and line in this crate, but a debugger has no local values; rebuild with RUSTFLAGS="-Cdebuginfo=2" for a full debugging session.
Running and logs
cargo run
AGENT_OF_EMPIRES_DEBUG=1 cargo run
AOE_LOG_LEVEL=trace cargo run
AOE_ACP_TRACE=1 cargo run
AOE_TERMINAL_TRACE=1 cargo run
aoe logs
cargo xtask dev runs a --features web debug backend on 8081, embedding web/dist without rebuilding it, and Vite with HMR on 5173; --watch rebuilds and restarts the backend when Rust inputs change, leaving the previous backend running if a rebuild fails.
Use explicit dotted tracing area targets so per-target logging overrides affect
native and dashboard failures consistently. Every explicit tracing target in
src/ or aoe-daemon-client/src/ must have a root listed in DEFAULT_TARGET_ROOTS
in src/logging.rs. A unit test checks both trees. Targets outside the default
roots log at warn and above unless overridden. Clearing one override in
Settings > Logging restores inheritance without clearing other targets.
Filter changes saved in Settings > Logging apply to the TUI, running daemon and structured runners in the same app namespace (runners pick up filter changes within about 10 s). Sink and rotation changes require restart. No-op and unrelated saves preserve temporary runtime filters.
Debug builds are isolated from installed release state:
| Resource | Release and dev-release |
Debug |
|---|---|---|
| App dir, macOS | ~/.agent-of-empires |
~/.agent-of-empires-dev |
| App dir, Linux | ~/.config/agent-of-empires |
~/.config/agent-of-empires-dev |
| tmux prefix | aoe_ |
aoe_dev_ |
| serve port | 8080 |
8081 |
Debug also uses an app-directory tmux socket, which AOE_TMUX_SOCKET overrides.
Build cache across worktrees
Each worktree has its own target/. Developers with many worktrees can opt into kache, which shares dependency artifacts through a local content-addressed store. It is optional locally; CI uses it through .github/actions/kache, where merge-queue jobs are read-only (kache v2.0.0 applies the PR cache prefix only to pull_request), and Nix and release builds do not use it.
cargo binstall kache
export RUSTC_WRAPPER=kache
export CARGO_INCREMENTAL=0
cargo build --all-features
Install kache before exporting RUSTC_WRAPPER, to avoid a bootstrap loop, and unset the variable to disable it. The cache and the worktrees must share a filesystem for linking; crates with native linking may still rebuild. kache monitor and kache stats inspect it, and scripts/verify-shared-target.sh verifies shared artifacts.
Maintainers can share artifacts through the aoe-rust-kache S3 bucket. Ask a maintainer with AWS access for an access key for your kache-<github-user> IAM user, store it as the aoe-kache profile with aws configure --profile aoe-kache, then add this to ~/.config/kache/config.toml and check it with kache doctor:
[cache.remote]
type = "s3"
bucket = "aoe-rust-kache"
region = "us-east-1"
prefix = "maint"
profile = "aoe-kache"
Maintainer keys can only read and write maint/, so CI never consumes artifacts built on a laptop.
Demo recordings
web/scripts/record-tui-demo.mjs produces docs/assets/demo.gif, web/scripts/record-web-demo.mjs the desktop and mobile dashboard GIFs, and web/scripts/combine-showcase-videos.sh one video of every Playwright spec. Each documents its dependencies and setup in its file header. To record a PR’s change for review, use the record-pr-demo agent skill in .claude/skills/record-pr-demo/.