5 KiB
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 260505-le7 | 01 | claudebox.sh |
|
|
|
|
|
|
Phase 260505-le7 Plan 01: Add Harness Config File Support to claudebox Summary
Config file loading and alternate harness support for claudebox — users can pin gsd or any binary as the sandbox command via ~/.claudebox/config or <project>/.claudebox, with per-project home mounts and PATH augmentation.
Tasks Completed
| Task | Name | Commit | Files |
|---|---|---|---|
| 1 | Parse config files and CLI flags; globals; load_config_file; HARNESS_BIN resolution | fbbb355 |
claudebox.sh |
| 2 | Wire HARNESS_BIN, MOUNT_HOME, PATH_ADD into SANDBOX_CMD, BWRAP_ARGS, ENV_ARGS, audit, dry-run | fbbb355 |
claudebox.sh |
Both tasks were implemented in a single commit since Task 2 is a direct continuation of the same function/variable initialisation started in Task 1.
What Was Built
Config file format
Two config files are loaded in cascade order (later overrides scalar cmd; arrays mount_home/path_add accumulate):
~/.claudebox/config(global)<CANONICAL_ROOT>/.claudebox(per-project)
Format: KEY = VALUE lines; blank and #-prefixed lines ignored.
Supported keys:
cmd— alternate binary to launch inside sandbox (default:claude)mount_home— subdir of$HOMEto bind-mount read-write (can repeat)path_add— dir to prepend to sandbox PATH (can repeat;~expanded)
CLI flags
--cmd <binary>— overridescmdfrom config--mount-home <subdir>— appends tomount_homearray--path-add <dir>— appends topath_addarray
CLI values are applied on top of config (config loaded first, CLI appended/overridden last).
Harness binary resolution
- If
cmdis set (via config or--cmd): resolved viacommand -v; missing binary → error + exit 1 - Otherwise: defaults to
claudebinary fromruntimeInputs IS_DEFAULT_CLAUDEboolean gates--dangerously-skip-permissions: only added when launching the default claude binary
Ordering fix
compute_canonical_root moved to near-top of script (before --check block) so it is available in both --check mode and config loading. Config files are loaded after CANONICAL_ROOT is computed (post-instance-dir setup). CLI captures (CLI_*) collected during flag parsing and merged after config loading.
Audit/dry-run integration
=== Config ===header shown when config files are loaded or non-default harness is activemount_homeentries appear in Mounts section (skipped if dir doesn't exist)path_addentries appear at front of PATH in env section--dry-runshows extra--bindlines for existingmount_homedirs--checkreports presence/absence of~/.claudebox/configand<CWD-root>/.claudebox
Integration Test Results
All 6 integration checks passed:
- Default invocation preserved:
claude --dangerously-skip-permissionsstill the final exec when no config/flags cmd = bashin.claudebox→bashlaunched without--dangerously-skip-permissionsmount_home = .config→--bind $HOME/.config $HOME/.configin dry-run (when dir exists)path_add = ~/.local/bin→/home/toph/.local/binprepended to sandbox PATH--cmd totally-nonexistent-binary-xyz→ "Error: configured cmd ... not found in PATH", exit 1--checkreports~/.claudebox/config(WARN: not found) and<CWD>/.claudebox(WARN: not found)
Deviations from Plan
Implementation note
Tasks 1 and 2 were committed together in a single atomic commit (fbbb355) rather than two separate commits. The code flows were tightly coupled (Task 2 consumed globals initialized in Task 1, both in claudebox.sh) making separation artificial.
No functional deviations. All must-have truths from the plan's frontmatter are satisfied.
Known Stubs
None.
Threat Flags
None. No new network endpoints, auth paths, file access patterns, or schema changes at trust boundaries. Config files are read-only host files already under user control; no privilege escalation path.
Self-Check: PASSED
- claudebox.sh modified: FOUND
- Commit
fbbb355exists: FOUND nix build .#claudeboxsucceeded: PASSED (shellcheck clean)- All integration tests: PASSED