Agent-box workflow internals
This page explains the runtime flow behind ab new and ab spawn.
Repository/workspace model
- Source repositories are discovered under
base_repo_dir. - Workspaces are created under
workspace_dir. - Workspace mode is either JJ workspace or Git worktree.
ab new flow
- Resolve repository ID (explicit or from current directory).
- Choose workspace type (JJ default, or Git).
- Create workspace for selected session name.
ab spawn flow
- Resolve workspace path (
--sessionmode) or current dir (--local). - Load and validate layered configuration.
- Resolve profile graph (
default_profile+ CLI profiles). - Build runtime-specific container configuration, including a deterministic human-readable container name derived from the workspace path.
- Apply mounts/env/ports/hosts/network options, including automatic terminal env passthrough (
TERM,COLORTERM) and terminfo mounting when available. - If portal is enabled:
portal.global = true: mount configured portal socket and setAGENT_PORTAL_SOCKET.portal.global = false: start a per-container in-process portal host, mount its socket, and setAGENT_PORTAL_SOCKET.
- Execute selected runtime backend (Podman or Docker).
Path resolution notes
- Home-relative paths are translated for host/container user homes.
- Relative mount source paths are resolved from current working directory.
- Symlinked paths are expanded to preserve resolution behavior inside container.