Bin Architecture
bin/ now follows a directional pipeline instead of sharing one mutable global state bag across loosely related files.
Runtime flow:
bin/safehouse.shbootstraps the environment and sources modules frombin/lib/bootstrap/source-manifest.sh.bin/lib/cli/parse.shparses argv once into thecli_*namespace.- Command handlers in
bin/lib/commands/decide whether the request is policy output, execution, or self-update. bin/lib/policy/request.shnormalizes cwd, environment inputs, trusted workdir config, app-bundle context, launch-time Git worktree auto-grants, and raw policy inputs intopolicy_req_*.bin/lib/policy/plan.shderives selected profiles, optional integration inclusion, normalized path grants, and profile runtime env defaults intopolicy_plan_*.bin/lib/policy/render.shrenders the final SBPL policy directly to disk from the completed request + plan.bin/lib/runtime/builds the wrapped execution environment and launchessandbox-execwhen a command should run.
Module boundaries:
bootstrap/: project constants and the ordered source manifest.support/: pure helper functions only.cli/: argv parsing and user-facing CLI text.commands/: top-level command handlers and process exit boundaries.policy/: request building, scoped profile selection, plan derivation, policy rendering, and explain output.runtime/: app bundle detection, execution-environment assembly, and process launch.
Namespace contract:
cli_*is written only by CLI parsing.policy_req_*is written only by request building.policy_plan_*is written only by plan building.runtime_*is written only by runtime helpers.- Only
safehouse_mainandcmd_*handlers should terminate the process.
Packaging rule:
scripts/generate-dist.sh sources the same bin/lib/bootstrap/source-manifest.sh file and inlines modules in that order, so source and dist builds share one authoritative module list.