Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
`docs/RELEASE-PROCESS.md` §8.

## Unreleased
- fix(exec): **`exec.sh` called by relative paths from another folder no longer skips the plan rule**: `_XD="${0%/*}"` stayed relative (`../../bin`), and after exec.sh's `cd` to the project root the guard `[ -f "$_XD/_position.sh" ]` failed in silence, so `cd apps/Orders && ../../bin/exec.sh ../../mdlsource/x.mdl` wrote under `Interview mode: auto` where the same call by absolute path was refused; a relative MDL script path broke every `[ -f "$SCRIPT" ]` guard the same way. Both are made absolute before the `cd`, only when the caller is not at the project root (a run from the root is unchanged). Arguments passed through to a `--patch` script are still taken as given. Fixture `test-mode-contract.sh` X — independent review of #789
- fix(ready, multi-app): **`bin/ready.sh` reads the per-app look ledger, so a multi-app project can reach READY**: it printed `NOT MEASURED — the look ledger is not kept per app yet` for every app, so a four-app build could never be READY. Now a whole-project run prints one `app:<App>` row per app, `K of N page(s) seen since their last build` with the unseen pages named (`look-ledger.sh status --by-app`), and READY needs every app's row; `--app <App>` scopes the gate-check stage 5 and ledger steps to that app (`MXTK_APP`). A single-tree project's output is byte-identical. Fixture `test-ready.sh` R11 (two apps: one looked, one not, then both) — requested for the multi-app trial of #789
- fix(_common, multi-app): **a toolkit copy installed inside an app folder (`apps/<App>/bin/`, an `init-project.sh` run there) defers to the outer multi-app project** by the same rule as the root walk, so its `exec.sh` reads the outer register and the plan rule fires under auto; any other installed copy keeps its own root (#489 R17g). Fixture `test-mode-contract.sh` X — review of #789
- fix(_common, multi-app): **an app folder that is a project of its own because `mxcli init` ran in it (its own `.claude/` + `PROJECT.md`) resolves to the OUTER project when that is a multi-app project** (no model at its root or under `app/`, and a `PROJECT.md` beside two or more app folders holding a model — any content, since a field root register was hand-written — or, for one app, a `PROJECT.md` with `## Current stage`, `## Decisions` or an Entry mode line — for that one-app case a deliberate change from #489, where `apps/X` kept its own root) — a stated refinement of #489, decided by the maintainer: one register, one LOOK ledger, one set of gates. Before it, `look-ledger owe` from an app folder wrote `apps/<App>/.claude/loop/look/owed.tsv` while `seen` wrote the root's (the ledger split), and `MXTK_APP` was a no-op inside an app folder. Any other nested project keeps its own root. Also: `mxtk_apps` lists one line per app FOLDER (`<App>.mpr` preferred; `-` and a refusal when it holds several and none is named for it); an env `MXTK_APP` that does not apply is dropped by gate-check instead of exiting 2 (an explicit `--app` still errors); the per-app readers compute the app list once and read the LOOK ledger once (`look-ledger.sh status --by-app`), status on six apps 1.41 s -> 1.03 s; no "from the shared" label without a shared fit-gap; `status.sh` with no argument finds the project from the current folder (an app subfolder included) instead of printing usage — from the independent review of #789 on a field run's six-app tree
- new(gate-check, status, look-ledger, init, sync): **multi-app projects are reported per app, never "nothing checked"**: with two or more `apps/<App>/<App>.mpr` and no app chosen, `gate-check.sh` prints `Marketplace installs: per app (N apps)` with one `[App]` line each (an app's own `architecture/apps/<App>/fit-gap.md` can FAIL; a package missing through the shared fit-gap reads PENDING, since it does not say which app owes it, and a finding that reads the same for several apps prints once, `[all N apps, from the shared architecture/fit-gap.md]`; build-ready counts a FAIL) and an `Apps:` section with each app's model, `mdlsource/` scripts and LOOK debt (with no ledger — it is git-ignored — `LOOK: no ledger here (N page(s) in its scripts)`, never "no pages owed"); `status.sh` prints one `APP` line per app (`bin/lib/app-scope.sh`, shared). `--app <App>` (gate-check, `look-ledger.sh status`) or `MXTK_APP=<App>` scopes a run to one app. The LOOK ledger stays one file keyed by app: owed rows gain a 5th column only in a multi-app tree. `init-project.sh` / `sync-project.sh` scaffold `architecture/apps/<App>/{intake,triage}.md` and the index `architecture/apps/README.md` (one shared build plan, one `## App:` section each), and the Wiring rows name the app selection; module briefs stay in `architecture/modules/` with an `**App:**` line. The root `PROJECT.md` is the one register: an app's own `PROJECT.md` (from `mxcli init` per app; the field repo held seven) that holds register lines (Entry mode, Current stage, Adopted at stage, CONFIRMED/ASSUMED rows) gets a warn-only line in gate-check's Apps section, status WATCH and a sync note. Convention: `skills/module-folder-convention.md` § Several apps in one repo (baseline 64,984 -> 65,155 words). Single-tree and two-tree output is byte-identical to before. Fixture `tests/wave2/test-multi-app-scope.sh` (tree shape in `fixtures/multi-app/` from a field repo's `git ls-files`, six apps, anonymised — see its PROVENANCE.txt) — two field runs, Nov 2026
- new(_common, multi-app): **a repo holding several apps (`apps/<App>/<App>.mpr`, one `mdlsource/` per app) gets a resolver interface every reader can scope by**: `project-bin/_common.sh` adds `mxtk_apps` (one line per app), `mxtk_app_count`, `mxtk_select_app <App>` (exports `MPR_FILE` + `MXTK_APP`) and `mxtk_app_of <path>`, and honours `MXTK_APP=<App>` at source time (a user's `MPR_FILE` still wins; the cwd auto-pick never does). `find_mpr` still refuses two models and now names `MXTK_APP`. Single-tree and two-tree projects are never multi-app: `mxtk_apps` prints nothing there — two field runs, Nov 2026

## v2026.11.17
- fix(exec, ready, gate-check): **unattended mode is recognised by its first word, and an agent cannot approve its own skipped plan** (composition review of the entry-mode PRs): one helper, `mxtk_auto_word` (`project-bin/_position.sh`), now decides "is this Interview mode unattended" for `exec.sh`, `gate-check.sh --adopt` and `ready.sh` — a register line `Interview mode: auto (gate questions go to questions.md …)` was read as attended by the first two, and in a field smoke run the second write of an unattended build got past the plan rule on refuse-once. `ready.sh` reports NOT READY (row `adoption`, named in the evidence file) while any `consentBy: auto-mode` adoption row is unconfirmed — the ✋ only failed Stage 6, which ready.sh does not run before the register reaches Stage 6. Auto is now the STRICTEST of `$CLAUDE_INTERVIEW_MODE`, `.claude/.interview-mode` and the register line, so `CLAUDE_INTERVIEW_MODE=steering` no longer overrides a register that says auto (intended: an override must not quietly switch the unattended guards off). Under auto, a project with no `Entry mode:` is refused like a pipeline mode until build-ready passes or it adopts (attended: banner only, as before). Checkpoint skills no longer describe greenfield as a live mode. Fixtures: `test-mode-contract.sh` W and U, `test-ready.sh` R4 — composition review of #790–#792, Nov 2026
Expand Down
4 changes: 2 additions & 2 deletions bin/doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ if [ -n "$PS_MODE" ]; then
fi
PMXCLI_PROBE="$(find_project_mxcli 2>/dev/null || true)"
head_ "Property sets (Studio Pro merge safety): $PROJECT_DIR"
[ -n "$_ps_apps" ] && note "multi-app folder ($_ps_apps): checking ${MPR#"$PROJECT_DIR"/} only — rerun with MPR_FILE=apps/<X>/<X>.mpr for each other app"
[ -n "$_ps_apps" ] && note "multi-app folder ($_ps_apps): checking ${MPR#"$PROJECT_DIR"/} only — rerun with MXTK_APP=<X> (or MPR_FILE=apps/<X>/<X>.mpr) for each other app"
if [ "$PS_IF_STALE" = 1 ] && [ "$PS_MODE" = check ] && [ -n "$PMXCLI_PROBE" ]; then
PS_VER="$(ps_version "$PMXCLI_PROBE")"
if [ -n "$PS_VER" ] && ! ps_stale; then
Expand Down Expand Up @@ -2045,7 +2045,7 @@ if [ -n "$PROJECT_DIR" ]; then
if [ -z "$MPR" ] && ls "$PROJECT_DIR"/apps/*/*.mpr >/dev/null 2>&1; then
MPR="$(ls "$PROJECT_DIR"/apps/*/*.mpr | head -1)"
_apps="$(cd "$PROJECT_DIR" && ls apps/*/*.mpr | paste -s -d, - | sed 's/,/, /g')"
[ "$(ls "$PROJECT_DIR"/apps/*/*.mpr | wc -l | tr -d ' ')" -gt 1 ] && note "multi-app folder: $_apps — instruments need MPR_FILE=apps/<X>/<X>.mpr to pick one"
[ "$(ls "$PROJECT_DIR"/apps/*/*.mpr | wc -l | tr -d ' ')" -gt 1 ] && note "multi-app folder: $_apps — instruments need MXTK_APP=<X> (or MPR_FILE=apps/<X>/<X>.mpr) to pick one; gate-check and status report per app"
fi
[ -n "$MPR" ] && ok "model: ${MPR#$PROJECT_DIR/}" || {
warn "no .mpr found in the project root"
Expand Down
57 changes: 55 additions & 2 deletions bin/gate-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
# Usage: bin/gate-check.sh [--html|--no-html] [--ack-protocol [--approved-in-chat]|--force-stale] [--verbose]
# [--adopt <stage> --reason "..."]
# [--waive <stage|obligation[/module]|source/<file>|marketplace/<Name>> --reason "..."]
# <project-dir> [stage]
# [--app <App>] <project-dir> [stage]
# - --app <App> (or MXTK_APP=<App>) scopes the model-reading checks to one app of a multi-app
# project (apps/<App>/<App>.mpr). Without it, a project with two or more apps gets one line
# per app for those checks (the "Apps:" section) — never a pick, never "nothing checked".
# - With a stage-number, additionally exits non-zero if that specific stage's check fails.
# - Without one, evaluates and reports all stages, exits 0 regardless (informational run).
# - --html forces the dashboard write; --no-html suppresses it. Neither changes any verdict.
Expand Down Expand Up @@ -67,6 +70,7 @@ ADOPT_STAGE=""
WAIVE_STAGE=""
CLOSEOUT=0
WAIVER_REASON=""
GC_APP="${MXTK_APP:-}"; GC_APP_ARG=0 # 1: named by --app (an error when it does not apply); 0: from the environment (dropped)
declare -a GC_ARGS
GC_ARGS=()
while [ $# -gt 0 ]; do
Expand All @@ -80,6 +84,8 @@ while [ $# -gt 0 ]; do
--closeout) CLOSEOUT=1; HTML_MODE="never" ;;
--waive) shift; WAIVE_STAGE="${1:-}" ;;
--reason) shift; WAIVER_REASON="${1:-}" ;;
--app) shift; GC_APP="${1:-}"; GC_APP_ARG=1 ;;
--app=*) GC_APP="${1#--app=}"; GC_APP_ARG=1 ;;
--force-stale) FORCE_STALE=1 ;;
--strict-protocol) STRICT_PROTOCOL=1 ;;
--) shift; while [ $# -gt 0 ]; do GC_ARGS[${#GC_ARGS[@]}]="$1"; shift; done; break ;;
Expand Down Expand Up @@ -295,6 +301,32 @@ if [ ! -d "$PROJECT_DIR" ]; then
exit 1
fi

# --- Multi-app projects (apps/<App>/<App>.mpr): which apps, and was one chosen? ------------
# One subshell over project-bin/_common.sh's resolver (mxtk_apps / mxtk_select_app), with
# PROJECT_ROOT pinned, so the layout rules are the crash net's and not a copy. GC_APPS stays
# empty on single-tree and two-tree projects, and nothing below prints for them.
GC_APPS=""
_gc_common="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/project-bin/_common.sh"
if [ -f "$_gc_common" ] && [ -d "$PROJECT_DIR/apps" ]; then
GC_APPS="$( PROJECT_ROOT="$(cd "$PROJECT_DIR" && pwd)"; MPR_FILE=""; MXTK_APP=""
. "$_gc_common" >/dev/null 2>&1 || exit 0
mxtk_apps "$PROJECT_ROOT" 2>/dev/null )"
fi
# An env MXTK_APP that does not apply (not a multi-app project, or no such app) is dropped, as
# _common.sh drops it; only an explicit --app is an error.
if [ -n "$GC_APP" ] && [ -z "$GC_APPS" ] && [ "$GC_APP_ARG" = 0 ]; then GC_APP=""; fi
if [ -n "$GC_APP" ]; then
[ -n "$GC_APPS" ] || { echo "Error: --app $GC_APP: $PROJECT_DIR is not a multi-app project (no apps/<App>/*.mpr)." >&2; exit 2; }
if _gc_sel="$( PROJECT_ROOT="$(cd "$PROJECT_DIR" && pwd)"; MPR_FILE=""; MXTK_APP=""
. "$_gc_common" >/dev/null 2>&1
mxtk_select_app "$GC_APP" "$PROJECT_ROOT" && printf '%s\t%s\n' "$MXTK_APP" "$MPR_FILE" )"; then
MXTK_APP="${_gc_sel%% *}"; MPR_FILE="${_gc_sel#* }"; GC_APP="$MXTK_APP"; export MXTK_APP MPR_FILE
elif [ "$GC_APP_ARG" = 1 ]; then exit 2
else echo "note: MXTK_APP=$GC_APP names no app here; reporting every app" >&2; GC_APP=""; unset MXTK_APP; fi
fi
# The app list, computed once, for every per-app reader in this run (bin/lib/app-scope.sh).
MXTK_SCOPE_APPS="$GC_APPS"; MXTK_SCOPE_ROOT="$PROJECT_DIR"; export MXTK_SCOPE_APPS MXTK_SCOPE_ROOT # the same string the readers are given

# Resolve the knowledge-base dir the same way this project's artifacts actually live.
# Convention: analysis/<name>/knowledge-base/ under the project dir; fall back to
# knowledge-base/ directly under the project dir if that's how the project is laid out.
Expand Down Expand Up @@ -3802,12 +3834,33 @@ case "${MXTK_ROWS_UPTO:-}" in P|p|0|1|2|3|4) ;; *)
if [ -r "$TOOLKIT_DIR/bin/lib/marketplace-check.sh" ]; then
# shellcheck source=lib/marketplace-check.sh
. "$TOOLKIT_DIR/bin/lib/marketplace-check.sh"
mxtk_mkt_report "$PROJECT_DIR" "${REGISTER:-$PROJECT_DIR/PROJECT.md}" "$(resolve_artifact_nonempty "architecture/fit-gap.md")"
if [ -n "$GC_APP" ] && [ -s "$PROJECT_DIR/architecture/apps/$GC_APP/fit-gap.md" ]; then
mxtk_mkt_report "$PROJECT_DIR" "${REGISTER:-$PROJECT_DIR/PROJECT.md}" "$PROJECT_DIR/architecture/apps/$GC_APP/fit-gap.md"
elif [ -z "$GC_APP" ] && [ "$(printf '%s' "$GC_APPS" | grep -c .)" -ge 2 ]; then
mxtk_mkt_report_apps "$PROJECT_DIR" "${REGISTER:-$PROJECT_DIR/PROJECT.md}" "$(resolve_artifact_nonempty "architecture/fit-gap.md")" "$GC_APPS"
else
mxtk_mkt_report "$PROJECT_DIR" "${REGISTER:-$PROJECT_DIR/PROJECT.md}" "$(resolve_artifact_nonempty "architecture/fit-gap.md")"
fi
else
printf 'Marketplace installs: NOT CHECKED — bin/lib/marketplace-check.sh missing from %s\n' "$TOOLKIT_DIR"
fi ;;
esac

# Multi-app projects: one register (PROJECT.md, read above), per-app evidence here — one line per
# app, full runs only (bin/lib/app-scope.sh, the same lines bin/status.sh shows). Prints nothing
# for single-tree and two-tree projects, or for one app under apps/.
if [ -z "$REQUESTED_STAGE" ] && [ -z "$GC_APP" ] && [ -r "$TOOLKIT_DIR/bin/lib/app-scope.sh" ]; then
# shellcheck source=lib/app-scope.sh
. "$TOOLKIT_DIR/bin/lib/app-scope.sh"
_gc_al="$(mxtk_app_lines "$PROJECT_DIR" "$TOOLKIT_DIR")"
if [ -n "$_gc_al" ]; then
printf 'Apps: %s (one register, %s; per-app evidence below; --app <App> scopes a run to one)\n' \
"$(printf '%s\n' "$_gc_al" | grep -c .)" "$(basename "${REGISTER:-PROJECT.md}")"
printf '%s\n' "$_gc_al" | while IFS=' ' read -r _a _l; do printf ' [%s] %s\n' "$_a" "$_l"; done
mxtk_app_register_notes "$PROJECT_DIR" "$TOOLKIT_DIR" | while IFS=' ' read -r _a _l; do printf ' ⚠ [%s] %s\n' "$_a" "$_l"; done
fi
fi

# ---------------------------------------------------------------------------
# Artifacts — did the stages that promise a file actually leave one?
#
Expand Down
15 changes: 13 additions & 2 deletions bin/init-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ fi

TOOLKIT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# Multi-app projects (two or more apps/<App>/<App>.mpr): per-app intake/triage under
# architecture/apps/<App>/, an index listing every app, and the two Wiring rows that name the app
# selection (bin/lib/app-scope.sh; skills/module-folder-convention.md § Several apps in one repo).
# Nothing happens, and nothing prints, for any other layout.
. "$SCRIPT_DIR/lib/app-scope.sh"
mxtk_scope_init "$(cd "$PROJECT_DIR" && pwd)" "$TOOLKIT_ROOT"
mxtk_scaffold_apps "$PROJECT_DIR" "$TOOLKIT_ROOT"
_WIRE_MPR=""; _WIRE_MDL=""
_wr="$(mxtk_wiring_rows "$PROJECT_DIR" "$TOOLKIT_ROOT")"
[ -n "$_wr" ] && { _WIRE_MPR="${_wr%% *}"; _WIRE_MDL="${_wr#* }"; }

# docs/progress/RESUME.md — the file every generated entry point tells an agent to read FIRST.
# Written here so that instruction is true on a project that is two seconds old. Never
# overwritten: after the first close-the-loop this file is the project's own, and clobbering it
Expand Down Expand Up @@ -269,8 +280,8 @@ at build time and correct any that differ**; a path that doesn't resolve is a wi
|---|---|---|
| Toolkit root | \`$TOOLKIT_ROOT\` | The process authority |
| Toolkit commit | see \`PROJECT.md\` \`Toolkit commit:\` | Authoritative there; ritual keeps it fresh |
| Project MPR | \`$(ls "$PROJECT_DIR"/*.mpr 2>/dev/null | head -1 | xargs -r basename || echo "<name>.mpr")\` | The model file |
| MDL source dir | \`mdlsource/\` | Numbered build scripts |
| Project MPR | ${_WIRE_MPR:-\`$(ls "$PROJECT_DIR"/*.mpr 2>/dev/null | head -1 | xargs -r basename || echo "<name>.mpr")\` | The model file} |
| MDL source dir | ${_WIRE_MDL:-\`mdlsource/\` | Numbered build scripts} |
| Module briefs | \`architecture/modules/<Module>/\` | one \`module-brief.md\` per module |
| Wireframes | \`design/wireframes/\` | one annotated HTML per screen |
| Design system | \`design/ds.css\` + \`design/design-system.html\` | tokens + component showcase |
Expand Down
Loading
Loading