Architecture overview
Follow the pipeline from CLI parsing and validated configuration to a rootless Podman launch plan.
View source Markdownags follows a simple pipeline:
- Parse CLI args.
- Load + validate config.
- Prepare assets/secrets/ssh/git metadata.
- Build a launch plan.
- Render plan into
podman runargs. - Execute container.
Main modules#
cli.rs- Defines command enums and parses args.
config/*- TOML deserialization + validation into strongly typed config.
cmd/*- Subcommand implementations (
setup,doctor,update, etc). - The tool configurator validates DNF or verified-archive providers and materializes selected downloads as a lock beside the owning config.
- Subcommand implementations (
agent.rs- Agent-specific profiles (command, mounts, env, browser integration).
plan/*- Converts config + runtime state into final
LaunchPlan.
- Converts config + runtime state into final
workspace_cache.rs/workspace_cache_{gc,usage,delete}.rs- Records checkout-scoped pnpm cache identities and shared launch-plan leases.
- Collection discovers orphan identities without Git subprocesses, refreshes running/stopped Podman mounts under a launch-registration gate, and quarantines only unreferenced/unleased trees after grace.
- Deletes quarantined trees outside the gate with a filesystem-deletion budget, retaining coordination metadata for crash recovery. Normal launches do not run collection.
cmd/prune_workspace_caches.rs- Low-priority, non-interactive maintenance entrypoint, intended for the daily systemd user timer or cron alternative in
config/. - Reads only the selected host config and bypasses config bootstrap, repository overlays/trust prompts, secrets, and release-check networking.
- Low-priority, non-interactive maintenance entrypoint, intended for the daily systemd user timer or cron alternative in
podman/*- Turns
LaunchPlanintopodman runarguments and executes. - Renders
podman buildarguments with explicit layer-cache and pull policies.
- Turns
image_update/*- The single image creation/update pipeline shared by
ags update-imageand first launch. - Resolves the recorded Fedora base and upstream metadata, reuses or builds content-keyed components (OS baseline and checkpoints, build foundation, Rust, pnpm, one artifact per vendor tool, Glimpse), assembles and verifies a candidate offline, and publishes it through a pending record under a per-image lock.
- Keeps a small per-image state manifest in
~/.cache/ags/image-state/; seedocs/COMMANDS.mdfor the invalidation table.
- The single image creation/update pipeline shared by
ssh.rs- Dedicated ssh-agent lifecycle + key loading.
secrets.rs- Multi-source secret resolution.
auth_proxy/*- Ephemeral auth proxy for sandbox browser opens and OAuth loopback callbacks.
protocol.rs: JSON-over-Unix-socket message types (ShimMessage,HostMessage).host.rs: host-side proxy — Unix socket listener, user prompt via shared AGS dialog, callback relay.
host_dialog.rs- Shared host prompt abstraction with Glimpse host-UI renderer first and zenity/kdialog fallback.
host_ui.rs- Session-scoped host UI sidecar lifecycle for sandbox-safe Glimpse windows.
- Starts
glimpse-host-ui, waits for its Unix socket, and cleans it up on session end.
clipboard.rs- Session-scoped clipboard bridge for sandbox
wl-paste/wl-copyshims. - Reads/writes the host clipboard through a narrow Unix socket instead of exposing the compositor.
- Gates clipboard contents reads through the shared host approval dialog by default.
- Session-scoped clipboard bridge for sandbox
agent/extensions/clipboard-paste/*- Session-scoped Pi editor integration mounted read-only by
plan/clipboard.rs. - Keeps one approval-gated read pending, then inserts image paths/text without replaying keystrokes or submitting a prompt.
- Composes the current editor factory and discards cancelled or stale-session/draft results.
- Session-scoped Pi editor integration mounted read-only by
webview_relay.rs- Session-scoped host HTTP relay for host-owned webviews that need to reach sandbox-local temporary app servers.
- Pairs with embedded sandbox helper scripts written by
assets.rs. glimpseuiis the intended owner of localhost-to-relay URL resolution for Glimpse-based packages.
assets.rs- Writes embedded Containerfile and component recipes (reference copies; image builds use a private snapshot), tmux, system-wide uv policy, guard, settings, auth-proxy-shim, clipboard, and webview relay assets.
node_runtime.rs- Validates numeric
.nvmrcselectors and bounds nearest-file discovery to the workspace.
- Validates numeric
cmd/node.rs- Implements the
ags node install|listhelper-container workflow and persistent mise store. - The store is read-only in ordinary agent containers; the install helper is its only AGS writer. Lockdown launch plans omit it and the runtime wrappers to retain ephemeral agent-runtime isolation.
- Implements the
Execution model#
Run mode#
- Immutable agent-generation mounts are read-only.
- Normal package-manager writes use a per-worktree pnpm store/cache; lockdown uses ephemeral storage. Launch plans retain shared cache leases until their last owner exits, protecting delayed launches from maintenance.
- The updater-only pnpm download cache is mounted only in installer containers and is absent from verification and runtime containers.
- User calls
ags --agent <name> .... - Config is validated.
- Secrets are resolved and written to an env file.
- Mounts and env are assembled per agent profile.
- Container entrypoint script runs chosen agent command.
Subcommands#
setup/doctor/update/update-agentsoperate as host-side utilities.prune-workspace-cachesperforms explicit orphan cleanup with grace, fresh container usage checks, leases, and bounded resumable deletion; it does not prune valid checkout caches or agent runtime generations. Scheduling is external and optional.installwrites embedded assets and optional self-link; it does not install maintenance timers or cron jobs.create-aliasesmanages shell alias blocks and wrapper scripts.completionsprints shell completion scripts (bash/zsh/fish).
Key design constraints#
- Rootless Podman execution.
- Principle of least privilege for mounts and env.
- Reproducible defaults via embedded assets.
- Config-driven behavior with validation before launch.
- Downloaded non-RPM tools use pinned architecture-specific HTTPS artifacts and are installed only after SHA-256 verification; DNF-provided tools are installed from configured Fedora packages.
- Agent state persisted on host volumes.
Found what you needed?
Suggest an edit ↗
Improve this page where the source lives.