Skip to content

Latest commit

 

History

History
79 lines (62 loc) · 3.62 KB

multitrack_bootstrap.md

File metadata and controls

79 lines (62 loc) · 3.62 KB

multitrack_bootstrap.sh

Revision: 1 Last modified: 2026-12-04T17:00:00Z Authority: constitution §11.4.164 / §11.4.187 / §11.4.28 / §11.4.177 / §11.4.133 / §11.4.6 Scope: §11.4.18 companion doc for constitution/scripts/multitrack/multitrack_bootstrap.sh

Overview

The ONE idempotent command that wires the multi-track engine into a consuming project out of the box — run when a project first adds the constitution submodule, and on every later constitution pull (auto-fired from the §11.4.164 post-update seam).

Idempotency is structural, not memoised: the script writes no timestamped or per-run state file of its own and delegates to already-idempotent siblings, so a second run against the same environment produces byte-identical resulting state.

The six steps

  1. Install the cwd-hook symlink (delegated to multitrack_cwd_hook.sh --install).
  2. Verify (never install) that the toolkit alias exists and that the symlink resolves to this constitution copy — purely informational.
  3. Validate the config; MT_TRACK_COUNT>=1. A missing/unparsable host config is the only genuinely fatal path.
  4. Seed orchestrator state with reconcile and confirm status runs.
  5. Operator-gate drive-prep: a READ-ONLY probe per track. An unmounted drive is an informational note and does not affect the exit code. Nothing is ever mounted or formatted.
  6. Opt-in (MT_SUPERVISOR_WATCH_ENABLE=1, default OFF): start the multitrack_supervisor.sh watch daemon, pgrep-guarded so it is idempotent.

Usage

multitrack_bootstrap.sh [--check|--dry-run] [PROJECT_ROOT]
PROJECT_ROOT=/path/to/project multitrack_bootstrap.sh

With no argument PROJECT_ROOT defaults to $PWD; $1 takes priority over the env var. There is no hardcoded project path, by design.

Exit codes

Code Meaning
0 wired (informational NOTES are still possible and non-fatal)
1 a required sibling engine script is missing, or cwd-hook --install failed
2 no per-host config resolvable and no default single-track fallback could be established (prints the YAML template + operator step). Also the strict fatal path when MT_REQUIRE_HOST_CONFIG=1
3 config resolved but failed to parse, or parsed with zero tracks
4 orchestrator reconcile or status failed unexpectedly

Edge cases and failure modes

  • Exit 0 with notes is the normal state on a fresh host — a missing toolkit alias and an unmounted track drive are both reported as NOTES. Read the report; do not infer "fully ready" from the exit code.
  • Exit 3 is never defaulted past. A malformed config with zero tracks will not be silently replaced by a one-track default.
  • --check / --dry-run write nothing; use them in CI where you only want the diagnosis.
  • The only filesystem write it can cause is the cwd-hook symlink (default ~/.local/bin/claude-cwd-hook, override CMA_CWD_HOOK) plus the orchestrator's atomic bindings.snapshot rewrite.

Related scripts

Last verified

2026-12-04 — the six steps, argument handling and the exit-code table re-read from the working tree.