From cf0d2b25c583edfcfd4caa289e7e3dafb166a37d Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:23:11 +0000 Subject: [PATCH 1/9] process(exec, entry modes): declared position banner, refuse-once plan rule, design front end With no Entry mode and no Adopted at stage line, status.sh, gate-check.sh's summary and every exec.sh run print one banner. In Entry mode migration or requirements-driven, the first MDL write with no plan evidence is refused once (remedy: run stages 1-4, or gate-check.sh --adopt 5 --reason ...). Outside evidence clears it; a-la-carte (new), greenfield, poc, change-an-existing-app and --patch are never refused. The entry-mode tokeniser moves to project-bin/_position.sh (pure bash, no process starts) so the installed exec.sh can read it; bin/lib/entry-mode.sh is a shim. Runbook greenfield row reuses poc-build steps 1-4 plus a short plan; design-artifacts Step 2a maps supplied prototypes in PAGE-MAP.tsv and ui-preflight-pages' wireframe STOP accepts a mapped prototype. Field evidence: two field runs (2026-11), requirements-driven with a frozen spec and clickable prototypes, built ~78 pages with no plan or target. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- CHANGELOG.md | 1 + bin/gate-check.sh | 9 +- bin/lib/entry-mode.sh | 83 +-------- bin/lib/install-manifest.sh | 4 +- bin/status.sh | 7 + docs/pipeline-walks.html | 2 +- project-bin/_position.sh | 155 ++++++++++++++++ project-bin/exec.sh | 55 +++++- skills/conversion-runbook.md | 8 +- skills/design-artifacts.md | 24 +++ skills/ui-preflight-pages.md | 4 +- .../fixtures/entry-mode-plan-rule/PROJECT.md | 63 +++++++ .../fixtures/entry-mode-plan-rule/README.md | 9 + .../fixtures/entry-mode-plan-rule/intake.md | 161 +++++++++++++++++ tests/wave2/test-entry-mode-plan-rule.sh | 165 ++++++++++++++++++ 15 files changed, 664 insertions(+), 86 deletions(-) create mode 100755 project-bin/_position.sh create mode 100644 tests/wave2/fixtures/entry-mode-plan-rule/PROJECT.md create mode 100644 tests/wave2/fixtures/entry-mode-plan-rule/README.md create mode 100644 tests/wave2/fixtures/entry-mode-plan-rule/intake.md create mode 100755 tests/wave2/test-entry-mode-plan-rule.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 105d7619..cf1ecfe6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m `docs/RELEASE-PROCESS.md` §8. ## Unreleased +- process(exec, entry modes): **the entry mode is a declared fact every tool reads, and a pipeline-mode project no longer builds without a plan by default**: with no `Entry mode:` and no `Adopted at stage:` line (register or intake), `bin/status.sh` (both views, plus a NEXT rule), `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner, and the BUILD-LOG row is tagged `no entry mode declared`; warn-only. In `Entry mode: migration` or `requirements-driven`, the first MDL write with no plan evidence is refused ONCE (nothing locked, snapshotted or written; `verdict=refused`), remedy in one line: run stages 1–4, or `gate-check.sh --adopt 5 --reason ...`. Cleared by outside evidence (guard rule 6): adoption at 5+, a reasoned `Waived stage 4:`, gate-check's readout at Stage 5+, or `architecture/build-plan.md` plus a module brief (root or `apps//`); a re-run after the one refusal goes on, tagged `no plan`. Never refused: `a-la-carte` (new explicit mode: no pipeline, audit or tooling use; gate-check reads its stages WAIVED by mode), `greenfield`, `Build type: poc`, change an existing app, `--patch`. The one entry-mode tokeniser moves to `project-bin/_position.sh` (pure bash, no process starts; installed beside exec.sh, `bin/lib/entry-mode.sh` is now a shim) — identical output on 44 inputs against the old one. Runbook: greenfield's "stages 1–4 collapse to whatever plan the user already has" becomes a design front end (`poc-build.md` steps 1–4, then a short plan with a few lines per module); `design-artifacts.md` Step 2a adopts a supplied prototype by mapping every screen in `design/wireframes/PAGE-MAP.tsv`, and `ui-preflight-pages.md`'s wireframe STOP accepts a mapped prototype. Fixture `tests/wave2/test-entry-mode-plan-rule.sh` (single tree + `apps//`, register and intake captured from `init-project.sh`) — two field runs, Nov 2026, requirements-driven with a frozen spec and clickable prototypes: ~78 pages built with no plan or target - fix(status, agents): **`bin/status.sh` WATCHes an Agent Editor project whose extension module does not travel with the model (#778)**: Studio Pro reads `agenteditor.agent` from `modules/AgentEditor.mxmodule` beside the `.mpr`, and a sync of only `.mpr` + `mprcontents/` left it out of git, so the builder stayed green while every colleague's clone showed `unknown type 'agenteditor.agent'`. Two WATCH items, warn-only (exit code and every verdict unchanged), local files and `git ls-files` only, root and `app/` layouts: a `modules/*.mxmodule` git does not track, and a project using Agent Editor (`AgentEditorCommons` in `analysis/app-facts/inventory.json`, or a `create agent` statement in `mdlsource/`) with no `modules/AgentEditor*.mxmodule`. `skills/mendix-agents.md` (on demand) gains the rule plus the note that the GenAI key, `Encryption.EncryptionKey` and `GenAICommons.StoreTraces` belong in the Default configuration, not a start script. Empty agent references / missing model version (mendixlabs/mxcli#1867) and unset runtime constants are not checked: they need a captured agent document (option 2). Fixture `tests/wave2/test-status-extension-modules.sh` — field report from an Agent Editor project, Nov 2026 - fix(permissions): **exec approval `auto` no longer prompts on every exec's mode check, and `install-claude-hooks.sh` no longer runs unprompted (#782)**: `install-claude-permissions.sh` now allow-lists `exec-approval.sh`, `interview-mode.sh` and `permission-profile.sh`, so their reads run without a prompt, while their only writers, `--set` and `--clear`, prompt through six `ask` rules (`Bash(*exec-approval.sh*--set*)`, …) in the shared settings under every profile (an ask rule beats an allow rule, `full`'s bare `Bash` included). `install-claude-hooks.sh`, which writes `~/.claude/settings.json` for every repo on the machine, gets no allow rule. A re-install adds the ask rules and removes the hooks-installer rule an earlier install added (sidecar); entries someone else wrote are untouched, and `sync-project.sh`'s permission check names both until then. Field run on claude 2.1.325: the read ran, `--set auto` and `--clear` were refused, and with the ask rules removed `--set` ran — from the two independent reviews of #781 - process(skills): **trim PR, moves only: always-loaded words 66,271 -> 64,984 (budget 80,000); Stage 5 test 21,906 -> 20,619, gate 22,954 -> 21,744, review 31,681 -> 30,394 (#783)**: `testing-shape.md` §5's stack and scratch-copy mechanics move verbatim to `e2e-harness-base.md` § Bringing the stack up (the rule and a one-line list of its rules stay in §5); the three new Unit false-green rows move to `unit-test.md` § False-green rows (a pointer row stays in the register); `module-review.md`'s re-shoot mechanics move to `iterative-build-loop.md` § Pipeline mode (the rule, the denominator and the failure example stay) and its MXTK-AI001 sentence to `marketplace-catalogue.md` § Reviewing a built module. Every removed line is in its destination, checked line by line — weekly word-budget audit (#783) diff --git a/bin/gate-check.sh b/bin/gate-check.sh index 4c15089d..22db54a3 100755 --- a/bin/gate-check.sh +++ b/bin/gate-check.sh @@ -733,7 +733,7 @@ stage_waiver() { case "$ENTRY_MODE" in greenfield) case "$st" in - 1|2|3|4) printf 'mode|greenfield entry mode — stages 1–4 collapse into the plan the user already has (conversion-runbook.md → Entry Modes)\n'; return 0 ;; + 1|2|3|4) printf 'mode|greenfield entry mode — stages 1–4 collapse into the design front end and short plan (conversion-runbook.md → Entry Modes)\n'; return 0 ;; esac ;; requirements-driven) case "$st" in @@ -743,6 +743,10 @@ stage_waiver() { case "$st" in 7) printf 'mode|existing-app entry mode — the app is live and stays live; there is no cutover (existing-app-change.md → Deliverables)\n'; return 0 ;; esac ;; + a-la-carte) + case "$st" in + [0-7]) printf 'mode|a-la-carte entry mode — no pipeline: audit or tooling use only (existing-app-assurance.md); declare another mode to run the stages\n'; return 0 ;; + esac ;; esac return 1 } @@ -4096,6 +4100,9 @@ echo "not a gate failure and does not affect the exit code — it is a stage nob echo "" printf "Summary: %d passed · %d not started · %d waived · %d need attention · %d manual\n" \ "$N_PASS" "$N_PENDING" "$N_WAIVED" "$N_FAIL" "$N_MANUAL" +# Declared position (project-bin/_position.sh; conversion-runbook.md → Entry Modes). The field runs +# that built with no plan (2026-11) had neither line, and this summary read like any other. +[ -z "$ENTRY_MODE" ] && [ -z "$ADOPTED_AT" ] && printf '⚠ %s\n' "$MXTK_POS_BANNER" # The stage counts above are about STAGES. They say nothing about the per-module passes and the # per-stage artifacts checked further up, and for a long time nothing down here did either — so diff --git a/bin/lib/entry-mode.sh b/bin/lib/entry-mode.sh index 2ae14343..de2598fe 100644 --- a/bin/lib/entry-mode.sh +++ b/bin/lib/entry-mode.sh @@ -1,77 +1,6 @@ -# entry-mode.sh — ONE tokeniser for the register's "Entry mode:" line. -# -# WHY THIS EXISTS. Two parsers (bin/gate-check.sh and bin/lib/artifact-check.sh) each -# carried the same unanchored-glob case: -# -# *greenfield*) ... ;; *requirement*) ... ;; *migration*) ... ;; -# -# Unanchored globs plus first-arm-wins means the token that appears EARLIEST IN THE -# CASE wins, not the one the line actually declares. "migration (not greenfield)" -# parsed as greenfield. The consumer stage_waiver() then excuses stages on that label -# with `mode` scope, and the manifest consumer marks rows N/A — so a misread here -# silently switches gates off. bin/status.sh used a third, anchored regex and so -# DISPLAYED the right mode while the gate acted on the wrong one, which is why this -# survived: the screen and the verdict disagreed and only the screen was read. -# -# The rule: match the documented multi-word phrase first, else take the FIRST word of -# the value and exact-match it against the known set. -# A value we do not recognise resolves to empty AND says so on stderr. Silence was -# the second half of the bug — a run could not tell you whether the mode had parsed. -# -# Unknown mode means every row applies and no stage is excused: louder, never quieter. - -# entry_mode_token -> canonical token on stdout, "" if unrecognised. -# -# Canonical set: greenfield | requirements-driven | migration | existing-app-change -entry_mode_token() { - local raw="${1-}" v full - v="$(printf '%s' "$raw" | tr -d '\r' | tr '[:upper:]' '[:lower:]')" - # gate-check.sh's intake fallback passes the WHOLE answer line, not just the value — - # "answered: migration", "decision: requirements-driven", "assumed (2026-09-01): - # greenfield" — because that same line is re-parsed downstream for its qualifier. - # Strip the question-answer prefix (and the qualifier's OWN parenthetical, e.g. the - # date in "assumed (...)") here, before the trailing-parenthetical stripping below — - # doing it after would let that stripping treat "(2026-09-01)" as if it opened at the - # start of the value and eat everything from "assumed (" onward, value included. The - # register's bare value ("migration") has no such prefix and passes through untouched. - v="$(printf '%s' "$v" | sed -E 's/^[[:blank:]>*_-]*(answered|answer|a|decision|assumed)[[:blank:]]*(\([^)]*\))?[[:blank:]]*:[[:blank:]]*//')" - v="${v%%(*}" # drop a trailing parenthetical: "migration (not greenfield)" - v="${v%%,*}" # drop anything after the first comma - v="${v%%;*}" # ...or semicolon - # Trim leading/trailing noise, INCLUDING markdown emphasis markers on both ends - # ("**migration**", "_greenfield_") — the old trailing trim only stripped spaces, - # tabs and a period, so a bolded or italicised value never matched anything. - v="$(printf '%s' "$v" | sed 's/^[[:blank:]>*_-]*//; s/[[:blank:].*_-]*$//')" - full="$v" - # Documented multi-word phrases resolve on the WHOLE value, before the first-word - # truncation below: the runbook's own label for the fourth mode is "Change an existing - # app", whose first word is "change" and matches nothing. Matched as a phrase, not as a - # bare `*existing*` glob, so "Migration from an existing Oracle Forms system" still reads - # as migration (its own first word) rather than being waived as an existing-app change. - case "$full" in - *"change an existing app"*|*"existing app change"*|*"existing-app change"*) - echo "existing-app-change"; return ;; - esac - - # First word only — space, tab, or "/" as a separator ("migration/brownfield" reads - # as migration, its own leading declaration, not as an unrecognised compound value). - v="${v%%[ /]*}" - # ...and trim emphasis/punctuation off THAT word too. The whole-value trim above only - # reaches the value's last character, so "**Migration**. Evidence: 409 .java files" - # (an auto-mode intake answer, #634) left the first word as "migration**." and the mode - # silently vanished. Re-trimming after the cut is what makes the header's "bolded - # values are handled" true for a bolded value with prose after it. - v="$(printf '%s' "$v" | sed 's/^[*_]*//; s/[.:!*_-]*$//')" - - case "$v" in - greenfield) echo "greenfield" ;; - requirements-driven|requirements|requirement) echo "requirements-driven" ;; - migration) echo "migration" ;; - existing-app-change|existing-app|existing) echo "existing-app-change" ;; - "") echo "" ;; - *) - printf 'entry mode "%s" not recognised; no stage is excused\n' "$raw" >&2 - echo "" - ;; - esac -} +# entry-mode.sh — shim. The ONE tokeniser for the register's "Entry mode:" line now lives in +# project-bin/_position.sh, because the installed exec.sh needs it too and cannot reach bin/lib/ +# (2026-11-17). Sourcing this file defines the same entry_mode_token() it always did, plus the +# position reader (mxtk_pos_read) and the banner. Why there is only one tokeniser: the header +# of project-bin/_position.sh. +. "$(cd "$(dirname "${BASH_SOURCE[0]}")/../../project-bin" && pwd)/_position.sh" diff --git a/bin/lib/install-manifest.sh b/bin/lib/install-manifest.sh index d6a962ef..028aee31 100644 --- a/bin/lib/install-manifest.sh +++ b/bin/lib/install-manifest.sh @@ -129,7 +129,9 @@ MXTK_AGENTS_STAGE_BUILD="mdl-agent.md gate-agent.md test-agent.md review-agent.m # runs it per module (informational; see project-bin/mf-canvas-facts.py header). # model-scope.py joined on 2026-10-21: it imports mxpatch.py (and through it mxunit_bson.py) from # its own directory. It puts back units a write changed only in XPath whitespace (mxcli#1596). -MXTK_PROJECT_BIN="reload.sh module-close.sh build-tree.py row-groups.sh process-map.js process-map.template.html app-restart.sh test-scratch.sh script-owners.sh describe-baseline.sh assemble-prototype.js prototype-route.js check-prototype-links.js wf-add-path-terminators.py wf-set-call-captions.py model-scope.py mf-canvas-facts.py mxunit_bson.py mxpatch.py _common.sh app-facts.sh _claims.sh snapshot-mpr.sh restore-mpr.sh exec.sh idempotence-check.sh persona-preflight.sh affected-tests.sh rollback-scan.sh rollback-scan.py rollback-effects.tsv look-ledger.sh look-shots.js save-sp.sh restart-sp.sh check-sp-health.sh verify-module.sh harness-scan.sh test-stack-up.sh fixture-manifest.sh check-root-clean.sh lint-gate.sh lint-trend.sh metrics-ledger.sh metrics-trend.sh close-task.sh conformance-check.sh coverage-preflight.sh graph-sweep.sh review-module.sh coherence-cadence.sh build-plan-status.sh progress-report.py done-drift-check.sh page-scope.sh render-improvement-register.sh check-design-portability.sh check-design-reaches-app.sh check-page-shell.sh page-fidelity.js model-stamp.sh verify-model.sh install-project-hooks.sh mx-metadata-note.py session-check.sh constants-audit.sh context-pack.sh check-staged-secrets.sh project-facts.sh security-check.sh demo-login-tiles.sh" +# _position.sh joined on 2026-11-17: exec.sh sources it as its sibling (the register's position +# lines + the one entry-mode tokeniser; bin/lib/entry-mode.sh is a shim onto the same file). +MXTK_PROJECT_BIN="reload.sh module-close.sh build-tree.py row-groups.sh process-map.js process-map.template.html app-restart.sh test-scratch.sh script-owners.sh describe-baseline.sh assemble-prototype.js prototype-route.js check-prototype-links.js wf-add-path-terminators.py wf-set-call-captions.py model-scope.py mf-canvas-facts.py mxunit_bson.py mxpatch.py _common.sh _position.sh app-facts.sh _claims.sh snapshot-mpr.sh restore-mpr.sh exec.sh idempotence-check.sh persona-preflight.sh affected-tests.sh rollback-scan.sh rollback-scan.py rollback-effects.tsv look-ledger.sh look-shots.js save-sp.sh restart-sp.sh check-sp-health.sh verify-module.sh harness-scan.sh test-stack-up.sh fixture-manifest.sh check-root-clean.sh lint-gate.sh lint-trend.sh metrics-ledger.sh metrics-trend.sh close-task.sh conformance-check.sh coverage-preflight.sh graph-sweep.sh review-module.sh coherence-cadence.sh build-plan-status.sh progress-report.py done-drift-check.sh page-scope.sh render-improvement-register.sh check-design-portability.sh check-design-reaches-app.sh check-page-shell.sh page-fidelity.js model-stamp.sh verify-model.sh install-project-hooks.sh mx-metadata-note.py session-check.sh constants-audit.sh context-pack.sh check-staged-secrets.sh project-facts.sh security-check.sh demo-login-tiles.sh" # Files in project-bin/ that are deliberately NOT installed into projects. The reverse check # below flags anything named by NEITHER list, so a new file in project-bin/ has to be either diff --git a/bin/status.sh b/bin/status.sh index 3fde58bb..276d79f7 100755 --- a/bin/status.sh +++ b/bin/status.sh @@ -72,6 +72,10 @@ ENTRY_RAW="$(awk ' } ' "$REG")" ENTRY="$(entry_mode_token "$ENTRY_RAW" 2>/dev/null)" +# Declared position (project-bin/_position.sh, the reader exec.sh and gate-check.sh share): no +# Entry mode (register or intake) and no adoption line → the one banner, first line of either view. +# Field runs (2026-11) built ~78 pages with neither line, and nothing here said so. +mxtk_pos_read "$PROJECT_DIR"; POS_BANNER=""; mxtk_pos_undeclared && POS_BANNER="$MXTK_POS_BANNER" ADOPTED="$(grep -m1 -oE '^Adopted at stage: *[0-9P]+' "$REG" | sed 's/^Adopted at stage: *//')" SKELETON="$(grep -m1 -oE '^Skeleton proven [0-9-]+' "$REG" | sed 's/^Skeleton proven //')" UNSYNCED="$(grep -c 'UNSYNCED' "$REG" 2>/dev/null)"; UNSYNCED="${UNSYNCED:-0}" @@ -250,6 +254,7 @@ fi next_action() { if [ -n "$APPROVED_OVER" ]; then echo "$APPROVED_OVER is approved in PROJECT.md but its gate FAILS — fix the gate, or re-open the approval with the user (bin/gate-check.sh)"; return; fi # conversion-runbook.md §2 if [ "$N_ATTN" -gt 0 ]; then echo "fix what gate-check flags: $(printf '%s\n' "$NEED_ATTN" | head -1)"; return; fi # conversion-runbook.md §2 + if [ -n "$POS_BANNER" ]; then echo "declare the entry mode (intake Q1, kickoff) or adopt a stage: bin/gate-check.sh $PROJECT_DIR --adopt --reason \"...\""; return; fi # conversion-runbook.md → Entry Modes case "$STAGE_LINE" in *"Stage 5"*|*"Stage 6"*|*"Stage 7"*) if [ -z "$SKELETON" ]; then echo "run the walking skeleton before the first module (skills/walking-skeleton.md)"; return; fi ;; # walking-skeleton.md esac @@ -379,6 +384,7 @@ for _w in "$STAGE_STALE" "${APPROVED_OVER:+APPROVED OVER A FAILING GATE: $APPROV [ -n "$_w" ] && WATCH="${WATCH:+$WATCH · }$_w" done if [ "$BRIEF" = 1 ]; then + [ -n "$POS_BANNER" ] && echo "⚠ $POS_BANNER" [ -n "$CWD_NOTE" ] && echo "CWD $CWD_NOTE" echo "WHERE $NAME · $STAGE_LINE${ENTRY:+ · $ENTRY}${ADOPTED:+ · joined at $ADOPTED}" [ -n "$ROUND_LINE" ] && echo "ROUND $ROUND_LINE" @@ -390,6 +396,7 @@ if [ "$BRIEF" = 1 ]; then fi printf '\n%s — %s%s%s\n' "$NAME" "$STAGE_LINE" "${ENTRY:+ · $ENTRY}" "${ADOPTED:+ · joined at stage $ADOPTED}" printf '%s\n\n' "$TK" +[ -n "$POS_BANNER" ] && printf '⚠ %s\n\n' "$POS_BANNER" [ -n "$CWD_NOTE" ] && printf 'CWD %s\n' "$CWD_NOTE" [ -n "$ROUND_LINE" ] && printf 'ROUND %s\n' "$ROUND_LINE" printf 'DONE scripts: %s written, %s gate-pass, %s done- · modules opened: %s%s\n' "$N_SCRIPTS" "$N_PASS" "$N_DONE" "$MOD_OPENED" "${SKELETON:+ · skeleton proven $SKELETON}" diff --git a/docs/pipeline-walks.html b/docs/pipeline-walks.html index ad08b7bb..da14e045 100644 --- a/docs/pipeline-walks.html +++ b/docs/pipeline-walks.html @@ -216,7 +216,7 @@

Requirements-driven Specs, BRDs, work

Greenfield Just an idea, or a running start on the model

-

The narrowest mode. Stages 1 to 4 collapse to whatever plan the user already has. Stage 0 does not collapse: the scope conversation still runs. If you find yourself inventing requirements mid-build, you are in requirements-driven mode and should back up to Stage 2.

+

The narrowest mode. Stages 1 to 4 collapse to a design front end (poc-build.md steps 1 to 4: design questions, wireframes or the supplied prototype, a buildability check, one approval stop) and a short plan, then the normal build. Stage 0 does not collapse: the scope conversation still runs. If you find yourself inventing requirements mid-build, you are in requirements-driven mode and should back up to Stage 2.

 flowchart TD
   P["P Kickoff light
init-project.sh
intake answered"] --> S0["0 Scope only ✋
CAC-1 brainstorm
sign-off in triage.md"] diff --git a/project-bin/_position.sh b/project-bin/_position.sh new file mode 100755 index 00000000..2f9e9e39 --- /dev/null +++ b/project-bin/_position.sh @@ -0,0 +1,155 @@ +#!/usr/bin/env bash +# _position.sh — where a project says it is: the ONE reader of the register's position lines +# (Entry mode, Adopted at stage, Build type, Waived stage 4, the Current-stage readout) and the +# ONE tokeniser for "Entry mode:". Sourced by project-bin/exec.sh (installed as bin/_position.sh) +# and, through the shim bin/lib/entry-mode.sh, by bin/gate-check.sh, bin/status.sh and +# bin/lib/artifact-check.sh. +# +# PURE BASH, no process starts: exec.sh runs this on every model write and its per-exec budget is +# counted (tests/wave2/test-exec-process-budget.sh). Bash 3.2 safe (macOS): no ${v,,}, no +# associative arrays; case-insensitive matching is `shopt -s nocasematch` inside [[ ]] only, +# restored on every return. +# +# WHY THE TOKENISER LIVES HERE (2026-11-17). It used to be bin/lib/entry-mode.sh, which an +# installed exec.sh cannot reach. exec.sh now has to know the mode (the plan rule below), and a +# second tokeniser is exactly what the old header warned against: two parsers once disagreed on +# "migration (not greenfield)" and the gate excused stages the screen said were owed. +# +# The rule: match the documented multi-word phrase first, else take the FIRST word of the value +# and exact-match it against the known set. A value we do not recognise resolves to empty AND +# says so on stderr. Unknown mode means every row applies and no stage is excused: louder, never +# quieter. + +# entry_mode_token -> canonical token on stdout, "" if unrecognised. +# Canonical set: greenfield | requirements-driven | migration | existing-app-change | a-la-carte +entry_mode_token() { _mxtk_emt "${1-}"; echo "$_EMT"; } + +# _mxtk_emt — the tokeniser itself; sets _EMT instead of printing, so exec.sh's reader +# below needs no command substitution (a fork is ~100 ms on Git Bash). +_mxtk_emt() { + local raw="${1-}" v full _nc=0 + shopt -q nocasematch && _nc=1; shopt -s nocasematch + v="${raw//$'\r'/}" + # gate-check.sh's intake fallback passes the WHOLE answer line ("answered: migration", + # "assumed (2026-09-01): greenfield"). Strip the question-answer prefix and the qualifier's own + # parenthetical first, so the trailing-parenthetical cut below cannot eat the value with it. + if [[ "$v" =~ ^[[:blank:]\>*_-]*(answered|answer|a|decision|assumed)[[:blank:]]*(\([^\)]*\))?[[:blank:]]*:[[:blank:]]*(.*)$ ]]; then + v="${BASH_REMATCH[3]}" + fi + v="${v%%(*}"; v="${v%%,*}"; v="${v%%;*}" # "migration (not greenfield)", "x, y", "x; y" + # Trim markdown emphasis and noise on both ends ("**migration**", "_greenfield_"). + [[ "$v" =~ ^[[:blank:]\>*_-]*(.*)$ ]] && v="${BASH_REMATCH[1]}" + if [[ "$v" =~ ^(.*[^[:blank:].*_-])[[:blank:].*_-]*$ ]]; then v="${BASH_REMATCH[1]}"; else v=""; fi + full="$v" + # Phrases on the WHOLE value, before the first-word cut: "Change an existing app" starts with + # "change", which matches nothing; "a la carte" starts with "a". Phrases, not bare globs, so + # "Migration from an existing Oracle Forms system" still reads as migration. + if [[ "$full" == *"change an existing app"* || "$full" == *"existing app change"* || "$full" == *"existing-app change"* ]]; then + [ "$_nc" = 1 ] || shopt -u nocasematch; _EMT="existing-app-change"; return 0 + fi + if [[ "$full" == "a la carte"* || "$full" == "à la carte"* ]]; then + [ "$_nc" = 1 ] || shopt -u nocasematch; _EMT="a-la-carte"; return 0 + fi + # First word only — space, tab or "/" ("migration/brownfield" reads as migration) — then trim + # emphasis/punctuation off THAT word ("**Migration**. Evidence: 409 .java files", #634). + v="${v%%[ /]*}" + [[ "$v" =~ ^[*_]*(.*)$ ]] && v="${BASH_REMATCH[1]}" + if [[ "$v" =~ ^(.*[^.:!*_-])[.:!*_-]*$ ]]; then v="${BASH_REMATCH[1]}"; else v=""; fi + local tok="" known=1 + if [[ "$v" == greenfield ]]; then tok="greenfield" + elif [[ "$v" == requirements-driven || "$v" == requirements || "$v" == requirement ]]; then tok="requirements-driven" + elif [[ "$v" == migration ]]; then tok="migration" + elif [[ "$v" == existing-app-change || "$v" == existing-app || "$v" == existing ]]; then tok="existing-app-change" + elif [[ "$v" == a-la-carte || "$v" == à-la-carte || "$v" == alacarte || "$v" == ala-carte ]]; then tok="a-la-carte" + elif [ -n "$v" ]; then known=0; fi + [ "$_nc" = 1 ] || shopt -u nocasematch + [ "$known" = 1 ] || printf 'entry mode "%s" not recognised; no stage is excused\n' "$raw" >&2 + _EMT="$tok" +} + +# mxtk_pos_read — reads /PROJECT.md once (HTML comments skipped: the +# scaffold's own comments name these labels) and, when the register has no Entry mode line, the +# intake.md §1 answer. Sets, never prints: +# POS_REG 1 when PROJECT.md exists +# POS_ENTRY canonical token, or "" (none declared / not recognised) +# POS_ADOPTED the "Adopted at stage:" stage (P|0-7), or "" +# POS_BUILD "poc" when "Build type: poc", else "full" +# POS_WAIVED4 1 when a "Waived stage 4:" line carries a reason +# POS_READOUT the stage in gate-check.sh's "## Current stage" readout ("**Stage 5 — ..."), or "" +mxtk_pos_read() { + local root="$1" reg line key val in_c=0 in_cur=0 entry_raw="" ad="" bt="" _nc=0 + POS_REG=0; POS_ENTRY=""; POS_ADOPTED=""; POS_BUILD="full"; POS_WAIVED4=0; POS_READOUT="" + reg="$root/PROJECT.md" + shopt -q nocasematch && _nc=1; shopt -s nocasematch + if [ -f "$reg" ]; then + POS_REG=1 + while IFS= read -r line || [ -n "$line" ]; do + line="${line//$'\r'/}" + if [ "$in_c" = 1 ]; then [[ "$line" == *"-->"* ]] && in_c=0; continue; fi + if [[ "$line" == *""* ]] || in_c=1; continue; fi + if [[ "$line" == "## "* ]]; then [[ "$line" == "## Current stage"* ]] && in_cur=1 || in_cur=0; continue; fi + if [ "$in_cur" = 1 ] && [ -z "$POS_READOUT" ] && [[ "$line" =~ ^\*\*Stage[[:blank:]]+([Pp0-7])([^0-9]|$) ]]; then + POS_READOUT="${BASH_REMATCH[1]}"; continue + fi + [[ "$line" =~ ^[[:blank:]\>*_-]*([^:]+):[[:blank:]]*(.*)$ ]] || continue + key="${BASH_REMATCH[1]}"; val="${BASH_REMATCH[2]}" + key="${key%"${key##*[!*[:blank:]]}"}"; val="${val//\*/}" + [ -n "${val//[[:blank:]]/}" ] || continue + if [ -z "$entry_raw" ] && [[ "$key" == "entry mode" ]]; then entry_raw="$val" + elif [ -z "$ad" ] && [[ "$key" == "adopted at stage" ]]; then ad="$val" + elif [ -z "$bt" ] && [[ "$key" == "build type" ]]; then bt="$val" + elif [[ "$key" == "waived stage 4" ]]; then POS_WAIVED4=1 + fi + done < "$reg" + fi + # The intake answer is where the mode is decided and the only copy a young project has + # (gate-check.sh reads it the same way). + if [ -z "$entry_raw" ] && [ -f "$root/intake.md" ]; then + local in_q=0 + while IFS= read -r line || [ -n "$line" ]; do + if [[ "$line" =~ ^##[[:blank:]]*1\. ]] && [[ "$line" == *"entry mode"* ]]; then in_q=1; continue; fi + [ "$in_q" = 1 ] || continue + [[ "$line" == "##"* ]] && break + if [[ "$line" =~ ^[[:blank:]\>*_-]*(answered|answer|a|decision|assumed)[[:blank:]]*(\([^\)]*\))?[[:blank:]]*: ]]; then + entry_raw="$line"; break + fi + done < "$root/intake.md" + fi + [[ "$bt" =~ ^[[:blank:]]*poc([^a-z]|$) ]] && POS_BUILD="poc" + [[ "$ad" =~ ^[[:blank:]]*([Pp0-7])([^0-9]|$) ]] && POS_ADOPTED="${BASH_REMATCH[1]}" + [ "$_nc" = 1 ] || shopt -u nocasematch + if [ -n "$entry_raw" ]; then _mxtk_emt "$entry_raw" 2>/dev/null; POS_ENTRY="$_EMT"; fi + return 0 +} + +# The banner (conversion-runbook.md → Entry Modes). One sentence, printed by status.sh, +# gate-check.sh's summary and every exec.sh run while the register declares no position. +MXTK_POS_BANNER='No entry mode declared: the toolkit treats this project as Stage P, not started. Declare the mode (kickoff) or adopt a stage with a reason: gate-check.sh --adopt --reason ...' + +# mxtk_pos_undeclared — true when nothing in the register (or intake) says where the project is. +# The bold Current-stage readout does not count: the scaffold writes it and gate-check rewrites it; +# it is a measurement, not a declaration. +mxtk_pos_undeclared() { [ -z "$POS_ENTRY" ] && [ -z "$POS_ADOPTED" ]; } + +# mxtk_plan_evidence — sets POS_EVIDENCE to what proves a plan exists before a +# pipeline-mode model write, returns 1 when nothing does (no fork: exec.sh calls it per write). Guard rule 6: evidence the toolkit did not create counts. +# - Adopted at stage 5+ (the register line --adopt writes) +# - Waived stage 4, with a reason +# - gate-check's readout at Stage 5+ (every stage before it PASS or WAIVED) +# - a build plan plus at least one module brief (architecture/ at the root or under apps//) +mxtk_plan_evidence() { + local root="$1" d f + POS_EVIDENCE="" + case "$POS_ADOPTED" in 5|6|7) POS_EVIDENCE="Adopted at stage: $POS_ADOPTED"; return 0 ;; esac + [ "$POS_WAIVED4" = 1 ] && { POS_EVIDENCE="Waived stage 4"; return 0; } + case "$POS_READOUT" in 5|6|7) POS_EVIDENCE="gate-check readout: Stage $POS_READOUT"; return 0 ;; esac + for d in "$root/architecture" "$root"/apps/*/architecture; do + [ -s "$d/build-plan.md" ] || continue + for f in "$d"/modules/*/module-brief.md; do + [ -s "$f" ] && { POS_EVIDENCE="${d#"$root"/}/build-plan.md + module briefs"; return 0; } + done + local _bp; IFS= read -r -d '' _bp < "$d/build-plan.md" || true + [[ "$_bp" =~ (^|$'\n')#+[[:blank:]]*[Mm]odule[[:blank:]]+[Bb]rief ]] && { POS_EVIDENCE="${d#"$root"/}/build-plan.md (briefs inline)"; return 0; } + done + return 1 +} diff --git a/project-bin/exec.sh b/project-bin/exec.sh index ccee4d86..77b96c2b 100755 --- a/project-bin/exec.sh +++ b/project-bin/exec.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # exec.sh — the guard chain around a model write. # -# STOP-row scan → concurrent-writer guard → module-brief advisory → mxcli check → snapshot → baseline → exec +# position banner + plan rule → STOP-row scan → concurrent-writer guard → module-brief advisory → mxcli check → snapshot → baseline → exec # → model-scope restore (units changed only in whitespace go back to HEAD; model-scope.py) # → mxbuild delta gate → auto-restore only on a NEW error → lint ratchet → SP reopen # @@ -704,7 +704,7 @@ HDR2 # The gate cell is read from GATE_STATE rather than passed in, so no caller # can omit it — a blank cell in this table reads as "fine", which is the exact # false-green the gate exists to prevent. - _detail="$2${CHANGE_CLASS:+ · change: $CHANGE_CLASS}${CR_ID:+ · cr: $CR_ID}${SCAN_NOTE:+ · $SCAN_NOTE}${ROWS_NOTE:+ · $ROWS_NOTE}${MKT_NOTE:+ · $MKT_NOTE}${RESTATE_NOTE:+ · $RESTATE_NOTE}${GATE_NOTE:+ · $GATE_NOTE}${MXB_LOG_NOTE:+ · $MXB_LOG_NOTE}${HV_NOTE:+ · $HV_NOTE}${SCOPE_NOTE:+ · $SCOPE_NOTE}$_EXEC_APPROVAL_SUFFIX${STEP_TIMES:+ · steps: $STEP_TIMES}" + _detail="$2${CHANGE_CLASS:+ · change: $CHANGE_CLASS}${CR_ID:+ · cr: $CR_ID}${POS_NOTE:+ · $POS_NOTE}${SCAN_NOTE:+ · $SCAN_NOTE}${ROWS_NOTE:+ · $ROWS_NOTE}${MKT_NOTE:+ · $MKT_NOTE}${RESTATE_NOTE:+ · $RESTATE_NOTE}${GATE_NOTE:+ · $GATE_NOTE}${MXB_LOG_NOTE:+ · $MXB_LOG_NOTE}${HV_NOTE:+ · $HV_NOTE}${SCOPE_NOTE:+ · $SCOPE_NOTE}$_EXEC_APPROVAL_SUFFIX${STEP_TIMES:+ · steps: $STEP_TIMES}" if [ -n "${EPOCHSECONDS:-}" ]; then printf -v _when '%(%Y-%m-%dT%H:%M:%S%z)T' -1; else _when="$(date '+%Y-%m-%dT%H:%M:%S%z')"; fi printf '| %s | `%s` | %s | %s | %s |\n' \ "$_when" "$LOG_NAME" \ @@ -755,6 +755,57 @@ take_score() { fi } +# ── Declared position + plan rule (2026-11-17) ────────────────────────────── +# _position.sh reads PROJECT.md (and intake.md §1) once, in-shell: no process starts. +# +# BANNER. No `Entry mode:` and no `Adopted at stage:` → one line on every run and a BUILD-LOG tag, +# so an unattended run cannot miss it. Two field runs (2026-11, requirements-driven, full spec and +# prototypes supplied) built ~78 pages with no BRDs, blueprint, wireframes or plan, and the +# register said nothing about where the project was; every guard stayed silent because the +# project had declared nothing for it to check against. +# +# PLAN RULE — a policy change. The module-brief block below says "exec.sh is not the pipeline's +# gatekeeper", and for an undeclared or a-la-carte project it still is not. But a project that +# DECLARED `Entry mode: migration` or `requirements-driven` has said it runs stages 1-4, so its +# first model write with no plan is refused ONCE (conversion-runbook.md → Entry Modes, "Plan +# before build"). Cheap to clear, never a wall: +# - outside evidence counts (guard rule 6): Adopted at stage 5+, a reasoned `Waived stage 4:`, +# gate-check's readout at Stage 5+, or architecture/build-plan.md plus a module brief (root +# or apps//) — see mxtk_plan_evidence; +# - the clearing commands are gate-check.sh --adopt/--waive and writing the plan, none of which +# goes through here (guard rule 7), and the refusal is ONCE per clone (.mpr-snapshots/ +# .plan-rule-refused): a re-run goes on, tagged "no plan" in every BUILD-LOG row; +# - never refused: --patch (opaque repair; doctor.sh's recovery path), `Build type: poc`, +# greenfield, change-an-existing-app, a-la-carte, and no declared mode at all. +POS_NOTE="" +if [ -f "$_XD/_position.sh" ]; then + . "$_XD/_position.sh" + mxtk_pos_read "$PROJECT_ROOT" + if mxtk_pos_undeclared; then + echo "⚠ $MXTK_POS_BANNER" + POS_NOTE="no entry mode declared" + elif [ "$PATCH_MODE" != "1" ] && [ "$POS_BUILD" != poc ] \ + && { [ "$POS_ENTRY" = migration ] || [ "$POS_ENTRY" = requirements-driven ]; } \ + && ! mxtk_plan_evidence "$PROJECT_ROOT"; then + _PLAN_STAMP="$PROJECT_ROOT/.mpr-snapshots/.plan-rule-refused" + _GC="${MXTK_ROOT:-${_TKR:-}}/bin/gate-check.sh" + if [ -f "$_PLAN_STAMP" ]; then + echo "⚠ Plan rule: Entry mode $POS_ENTRY and no plan (Stage 4 not passed or adopted) — refused once already, going on; this row is tagged \"no plan\"." + POS_NOTE="no plan (Entry mode $POS_ENTRY, before Stage 4)" + else + [ -d "$PROJECT_ROOT/.mpr-snapshots" ] || mkdir -p "$PROJECT_ROOT/.mpr-snapshots" + if [ -n "${EPOCHSECONDS:-}" ]; then printf -v _pw '%(%Y-%m-%dT%H:%M:%S%z)T' -1; else _pw="now"; fi + printf '%s %s\n' "$_pw" "$SCRIPT" > "$_PLAN_STAMP" + result_line refused no skipped 1 + echo "✗ Plan rule: Entry mode $POS_ENTRY, and Stage 4 has not passed or been adopted — no build plan, no module briefs. NOTHING was written." + echo " Remedy: run stages 1-4 (conversion-runbook.md), or record why not: $_GC $PROJECT_ROOT --adopt 5 --reason \"...\" (it shows in the register)." + echo " Refused once only: a re-run goes on, and its BUILD-LOG row says \"no plan\"." + log_build "🚫 blocked" "plan rule: Entry mode $POS_ENTRY, no build plan/briefs and Stage 4 not adopted — refused once, nothing written" + exit 1 + fi + fi +fi + # ── STOP-row scan (added 2026-10-14, #349) ─────────────────────────────────── # The toolkit's bin/mdl-scan.sh greps the script for the STOP rows of learned-mdl-preflight.md # that a text pattern identifies — each one a script that passed `mxcli check`, cost a full diff --git a/skills/conversion-runbook.md b/skills/conversion-runbook.md index 9b846294..5d9ed321 100644 --- a/skills/conversion-runbook.md +++ b/skills/conversion-runbook.md @@ -68,18 +68,20 @@ The stages are the same for everyone; what differs is where you enter and which **The entry mode is a Stage-P interview decision, not a silent inference.** The agent proposes a mode *with evidence* ("you have specs in X and source in Y, so…") and records it `CONFIRMED` in `PROJECT.md` before any stage is skipped. A skipped stage in the wrong mode is a gap; in the confirmed mode it's correct. Classification rules — apply in order, first match wins: -1. **The app you are changing already exists in Mendix and stays** — a live `.mpr` you are adding to or altering, not rebuilding → **Change an existing app** (`existing-app-change.md`). The knowledge base comes from the model itself (Path D), stages 2–4 run over the slice being changed, and every gate from Stage 5 on is also a regression gate. Auditing or testing an app nobody is changing is not this mode — that is à-la-carte `existing-app-assurance.md`, no pipeline. +1. **The app you are changing already exists in Mendix and stays** — a live `.mpr` you are adding to or altering, not rebuilding → **Change an existing app** (`existing-app-change.md`). The knowledge base comes from the model itself (Path D), stages 2–4 run over the slice being changed, and every gate from Stage 5 on is also a regression gate. Auditing or testing an app nobody is changing is not this mode — that is à-la-carte `existing-app-assurance.md`, no pipeline; with a `PROJECT.md`, record `Entry mode: a-la-carte` (no pipeline: audit or tooling use). 2. **Any legacy/source code exists** (even a reference implementation you're not "migrating" — if it encodes behavior you want, it gets analyzed) → **Migration** (or at minimum, Stage 1 Path A runs on it). 3. **Any requirements artifacts exist** — specs, BRDs, context docs, wireframes, workshop outputs → **Requirements-driven**. Having "complete" specs does *not* mean skipping to Stage 5: stages 2–4 are where those specs become validated BRDs, an architecture, module boundaries, a design system, and an ordered plan. Skipping them means improvising all of that mid-build. 4. **None of the above** — you're genuinely starting from a conversation → **Greenfield**. This is the narrowest mode, not the default for "no legacy system." (Failure: a project with full specs + analyzable source was classified greenfield "because there's nothing to migrate" and proposed skipping 0–4 — `process/baseline-incident-history.md` §R1.) +**Declared, or the toolkit says so.** With no `Entry mode:` and no `Adopted at stage:` line, `bin/status.sh`, `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner: *No entry mode declared: the toolkit treats this project as Stage P, not started.* **Plan before build:** in `migration` or `requirements-driven`, the first `exec.sh` model write before Stage 4 has passed or been adopted is refused once — run stages 1–4, or `bin/gate-check.sh

--adopt 5 --reason "..."` (a register line). A build plan plus a module brief, `Waived stage 4:` or adoption at 5+ clears it; never refused: `a-la-carte`, `greenfield`, `Build type: poc`, change an existing app, `--patch`. *Failure (two field runs, 2026-11): a full frozen spec plus clickable prototypes, "requirements-driven" in the brief, and ~78 pages built with no plan or wireframe target, missing whole sections the prototypes showed; nothing spoke, because nothing was declared.* + | You're starting from… | Mode | Stages that run | What changes | |---|---|---|---| | **Legacy source code** (± docs, ± SME) | **Migration** | P, 0–7 (all) | The default everything below describes. Path A (code extractors) always runs. | -| **Requirements only** — BRDs, specs, workshop outputs, wireframes; no legacy code | **Requirements-driven** | P, 0–6 (skip 7) | Stage 0 runs. `document-discovery.md` runs over the whole corpus for the inventory, **and** the extraction call runs per extractable structure inside it — a schema, a table dump, a data export or entity tables in a spec each get one; `N/A` is earned on evidence, never on the mode label (`source-triage.md` owns that rule — see "Stage 0 runs in every entry mode" below). Stage 1 runs Path B (`kb-generation.md`) + Path C (SME) only; Path A is declared not-applicable, not "skipped". Stages 2–6 run unchanged — BRDs come from documents instead of extraction. Stage 7 only if legacy data exists somewhere to cut over. **A text-native corpus — Markdown and HTML pages, no legacy code, no Office/PDF containers — takes the docs-ready fast path below.** | -| **Just an idea / a running start on the model** | **Greenfield** | P (light), 0 (scope only), 5–6 | Stages 1–4 collapse to whatever plan the user already has. Stage 0 does **not** collapse: with no corpus there is nothing to grade, but the scope conversation is exactly as load-bearing as it is anywhere else, so Stage 0 reduces to CAC-1's brainstorm and its sign-off. If you find yourself inventing requirements mid-build, you're actually in requirements-driven mode — back up to Stage 2. | +| **Requirements only** — BRDs, specs, workshop outputs, wireframes; no legacy code | **Requirements-driven** | P, 0–6 (skip 7) | Stage 0 runs. `document-discovery.md` runs over the whole corpus for the inventory, **and** the extraction call runs per extractable structure inside it — a schema, a table dump, a data export or entity tables in a spec each get one; `N/A` is earned on evidence, never on the mode label (`source-triage.md` owns that rule — see "Stage 0 runs in every entry mode" below). Stage 1 runs Path B (`kb-generation.md`) + Path C (SME) only; Path A is declared not-applicable, not "skipped". Stages 2–6 run unchanged — BRDs come from documents instead of extraction; supplied prototypes are adopted, not redrawn (`design-artifacts.md` Step 2a). Stage 7 only if legacy data exists somewhere to cut over. **A text-native corpus — Markdown and HTML pages, no legacy code, no Office/PDF containers — takes the docs-ready fast path below.** | +| **Just an idea / a running start on the model** | **Greenfield** | P (light), 0 (scope only), design front end, 5–6 | Stages 1–4 collapse to a **design front end**: `poc-build.md` steps 1–4 (design questions; wireframes, or the supplied prototype as the wireframe set; buildability check; one approval stop, recorded as the Stage-4 `CONFIRMED` decision), then a short `architecture/build-plan.md` — apps, modules, screen list, and a `## Module brief — ` of a few lines per module — then the normal build. Stage 0 does **not** collapse: with no corpus there is nothing to grade, but the scope conversation is exactly as load-bearing as it is anywhere else, so Stage 0 reduces to CAC-1's brainstorm and its sign-off. If you find yourself inventing requirements mid-build, you're actually in requirements-driven mode — back up to Stage 2. | | **A live Mendix app you are changing** — a feature or flow is being added or altered, the rest stays as it is | **Change an existing app** | P, 0–6 per change (skip 7 — the app is live) | `existing-app-change.md` owns the mode. Stage 1 runs **Path D** — `mxcli` queries the `.mpr` into the knowledge base, scoped to the change **plus what it touches**, which Stage 0 writes into `triage.md` as its own section. A regression net (Track B baseline) goes under the app before anything changes. Stages 2–4 run over the change only: one as-is/to-be BRD per capability being changed, Stage 3 in full only when the change crosses a module boundary, adds an integration or alters the domain model — otherwise it collapses to "which existing module owns this". Stage 7 is N/A in the register with that reason. The coverage ledger is `mxcli brain plan`, not a hand-kept file. | ### Stage 0 runs in every entry mode diff --git a/skills/design-artifacts.md b/skills/design-artifacts.md index cec1c7fc..2ae3add5 100644 --- a/skills/design-artifacts.md +++ b/skills/design-artifacts.md @@ -224,6 +224,30 @@ screen it reuses so a reviewer can trace it. `bin/gate-check.sh`'s Stage-3 gate table against `design/wireframes/*.html` and reports `MANUAL wireframes for inventoried screens` when the build falls short of the inventory. +### Step 2a: Adopt a supplied design — map, do not redraw + +**Trigger:** the corpus supplies clickable HTML prototypes or a design system (requirements-driven +or migration; greenfield and POC use `poc-build.md` steps 1–4 instead). The prototype is the +target; Stage 3 maps it rather than drawing a second, drifting copy. + +1. Screen Inventory rows (Step 2) get Basis `SUPPLIED` and the file in Notes. +2. Write `design/wireframes/PAGE-MAP.tsv`, one row per page: ``. The path + resolves against `design/wireframes/`, so a supplied file reads + `Orders_List../../prototypes/orders/list.html` (a route form, `…prototype.html#/`, + works too). `check-page-shell.sh`, `page-fidelity.js` (given the mapped file) and + `ui-preflight-pages.md` Step 1 then treat the mapped prototype as the page's wireframe. +3. A supplied design-system stylesheet seeds Step 1 (`mxcli theme create --from `); + do not invent tokens next to it. +4. Buildability pass as `poc-build.md` step 3: each interactive element BUILDABLE or + REDESIGNED/DEVIATION, 0 unchecked; deviations go to the Stage 3 sign-off. +5. A screen with no supplied file is drawn per Step 3; a supplied screen with no requirement goes + to Step 3b. Step 3d's LOOK runs over the supplied prototype. + +**Done when:** "N of N inventoried screens mapped" (every page a row, every row's file on disk: +`check-page-shell.sh` reports a stale row), and the deviation list is in the sign-off. *Failure +(field run, 2026-11): prototypes supplied for every screen, none mapped; ~78 pages built against no +target, missing whole sections the prototypes show.* + --- ## Step 2b: Interaction Model — before the first wireframe diff --git a/skills/ui-preflight-pages.md b/skills/ui-preflight-pages.md index 4ec15e91..fa96d184 100644 --- a/skills/ui-preflight-pages.md +++ b/skills/ui-preflight-pages.md @@ -78,7 +78,9 @@ Read the full wireframe file and extract: | Conditional visibility | Callout notes describing "shown only when…" or "edit mode vs. view mode" states | | Navigation entry point | `.origin` annotation or a nav-link callout stating what opens this page | -**If no wireframe exists:** ⛔ STOP. Report to the main session that the wireframe is missing and that the page script cannot be drafted until one exists. Do not proceed, do not guess layout or bindings, do not ask whether to proceed without one — the wireframe is not optional. See `design-artifacts.md` to produce one first. +**A supplied prototype mapped in `design/wireframes/PAGE-MAP.tsv` IS the wireframe** (`design-artifacts.md` Step 2a): read the mapped file and extract the same table; where it carries no binding annotations, take bindings from the BRD and the module brief. + +**If no wireframe exists** — no `design/wireframes/.html`, and no `PAGE-MAP.tsv` row naming a file or route on disk: ⛔ STOP. Report to the main session that the wireframe is missing and that the page script cannot be drafted until one exists. Do not proceed, do not guess layout or bindings, do not ask whether to proceed without one — the wireframe is not optional. See `design-artifacts.md` to produce one first. **If an annotated `.md` companion exists** (e.g. `item-management.md` alongside `item-management.html`): read it — it often contains the binding table, widget-type decisions, and diff --git a/tests/wave2/fixtures/entry-mode-plan-rule/PROJECT.md b/tests/wave2/fixtures/entry-mode-plan-rule/PROJECT.md new file mode 100644 index 00000000..723fad75 --- /dev/null +++ b/tests/wave2/fixtures/entry-mode-plan-rule/PROJECT.md @@ -0,0 +1,63 @@ +# PROJECT.md — Fixture Decision Register + +Every gate decision lands here as `CONFIRMED` or `ASSUMED`, never silently decided. See +`conversion-runbook.md` §1 for the interview protocol this file supports. + +## Current stage + +**Stage P — Kickoff**, needs attention — gates passed: none yet (derived by gate-check on 2026-11-17; re-run it rather than editing this line). + +Toolkit commit: ff4103b +Exec approval: auto +Permission profile: project +Unit tests default: no +Gate mode: check +Pipeline mode: balanced +Build type: full + + + + + + + + + + + +## Decisions + +| Stage | Decision | Status | Notes | +|---|---|---|---| + +## Change log + +Feedback and change requests, one row each, written BEFORE any edit (`skills/change-intake.md`). Status: open → refined → agreed → applied → proven, or rejected (reason); Closed-by cites the commit, journey or test. Escape a `|` inside the ask as `\|`. + +| CR | Date | Source | Verbatim ask | Class | Size | Entry artifact | Status | Closed-by | +|---|---|---|---|---|---|---|---|---| + +## Open questions + +| # | Question | Raised at | Status | +|---|---|---|---| + +## Assumptions (ASSUMED, unresolved) + +None yet. diff --git a/tests/wave2/fixtures/entry-mode-plan-rule/README.md b/tests/wave2/fixtures/entry-mode-plan-rule/README.md new file mode 100644 index 00000000..34150bc2 --- /dev/null +++ b/tests/wave2/fixtures/entry-mode-plan-rule/README.md @@ -0,0 +1,9 @@ +# entry-mode-plan-rule fixtures + +`PROJECT.md` and `intake.md` are captured verbatim from `bin/init-project.sh` (toolkit commit +`ff4103b`, 2026-11-17) run into an empty git repository with `MXTK_NO_GUIDE=1`; only the project +name in the H1 was changed to `Fixture`. They are the register and intake a project really starts +with, so the position reader is tested against the scaffold's own HTML comments (which name +`--adopt 5` and `Build type`) and the bold `**Stage P — Kickoff**` readout, not against input +written to match the parser. `tests/wave2/test-entry-mode-plan-rule.sh` appends the one line +each case declares. diff --git a/tests/wave2/fixtures/entry-mode-plan-rule/intake.md b/tests/wave2/fixtures/entry-mode-plan-rule/intake.md new file mode 100644 index 00000000..c86bfb23 --- /dev/null +++ b/tests/wave2/fixtures/entry-mode-plan-rule/intake.md @@ -0,0 +1,161 @@ +# intake.md — Stage P Kickoff Interview + +Replace each "_Not yet asked._" line below with a real answer, in one of three forms: + + Answered (CONFIRMED): ... the question was asked and answered + Unverified — how to verify: ... the question WAS asked, the answer is not known yet, + and this line says how it will be established + Assumed (auto-mode): ... Interview mode: auto only — the recommended default; + the full record goes in PROJECT.md + +All three pass gate-check's Stage P (keep the colon right after the parenthesis). +"_Not yet asked._" passes nothing, deliberately: this +file is generated before the interview happens, and a scaffold must never be able to certify +an interview that never took place. Per conversion-runbook.md's interview protocol, every +question is asked in chat and the turn ends to wait for the answer; unknowns the user hands +back ("you decide") are recorded as ASSUMED in PROJECT.md rather than blocking Stage P. + +Question 16 (which kind of build) is asked FIRST, before Q1, at project birth; a project already past kickoff is not asked it. + +**These are the questions only the human can answer.** Anything derivable — where the source +sits, what documents exist, which Mendix version the .mpr targets, whether prior analysis is +present — is the agent's homework, brought back as "I found X, confirm?" rather than asked +here. Do that homework FIRST: it is what turns each question below into a recommendation +with evidence instead of a blank prompt. + +## 1. Entry mode: migration, requirements-driven, greenfield, or change an existing app? + +_Not yet asked._ The agent proposes with evidence and the user confirms — never a silent +inference (conversion-runbook.md "Entry Modes"; classification rules apply in order, first +match wins: a live Mendix `.mpr` you are adding to or altering, not rebuilding → change an +existing app (record it verbatim as `Change an existing app`; existing-app-change.md); else +any legacy source → migration; else any specs/BRDs/wireframes → requirements-driven; else +greenfield). Auditing or regression-testing an app nobody is changing is not a mode at all — +that routes to existing-app-assurance.md and skips the pipeline. Getting this wrong skips +whole stages: real misrouting, 2026-07-14; and until 2026-09-22 this question listed only +three modes, so a session changing a live app had no option to pick. + +## 2. What is this project, and what is driving it? + +_Not yet asked._ Sets stakes, urgency and the default for Q3 in one answer. (a) POC/demo — +prove feasibility, throwaway output, speed over completeness. (b) Production replacement with +a hard date — licence expiry, platform EOL, contract; fidelity and speed win, improvements +deferred. (c) Production replacement, open-ended — modernisation is part of the goal. Only +the user knows; record the date itself if there is one. + +## 3. Fidelity: port as-is, or improve as we go? + +_Not yet asked._ Default inherited from Q2 — (b) implies as-is, (c) licenses redesign — so +put the inherited default to the user and ask what to override. This decides whether every +Stage 3 fit-gap finding is a gap to close or an opportunity to take. + +## 4. What are we working on: the whole application, or a part of it — and what else does that touch? + +_Not yet asked._ Name the topic in plain words — a feature, a flow, a module, a fix, or the +whole app. Say what else it touches, and name what is explicitly OUT — "out" is the half that +gets forgotten and rebuilt anyway. A module-sized source is the common case and is easy to +mistake for a whole app. Also ask whether there are input documents — user stories, tickets, +a spec: they go in `sources/`, and "none, the app plus my description" is a fine answer. For +an existing app this is settled at Stage 0b, after the map, so +`Unverified — how to verify: named when the change request arrives (Stage 0b)` is a legitimate +kickoff answer. + +## 5. Of what we touch, what must stay exactly as it is? + +_Not yet asked._ Integrations, data contracts, external URLs, scheduled jobs, reports other +systems consume. These are the constraints that invalidate an architecture late and cheaply +if found now; they are rarely visible in the source, because they live in its consumers. For +an existing app the default is that nothing beyond the ask changes — this question names the +things the change must not break. + +## 6. Are there licence/security constraints on storing this client's source in this workspace? + +_Not yet asked._ How to verify: ask the human; not inferable from the code. + +## 7. Is an SME available — who, and at what cadence? + +_Not yet asked._ Availability is not the useful half: an SME who exists but answers in two +weeks reshapes the plan as much as no SME at all. Ask who, for which class of decision, and +what the realistic turnaround is. + +## 8. Anything else — scope, priorities, or worries? + +_Not yet asked._ The standing open-floor question the runbook requires at every checkpoint +(§1). Closed questions capture decisions; they never surface what the user wanted to say +unprompted. "Nothing further" is a valid answer — but it has to be the user's, not assumed. + +## 9. Interview mode: attended (default) or unattended? + +_Not yet asked._ How to verify: ask the user; default is `steering`. Record it as +`Interview mode:` in PROJECT.md: `steering` = every gate question is asked in chat and the agent +waits; `assist` = questions batched at gates, low-consequence ones assumed and reported; `auto` +(opt-in only, explicit request required) = nothing blocks, positions recorded as ASSUMED for +reconciliation. `attended` / `unattended` are accepted aliases for `steering` / `auto`. + +## 10. Is any of this already done outside the toolkit — and where does the pipeline pick up? + +_Not yet asked._ Only relevant when the project did not start here: a build already underway, +analysis that lives in Confluence, a design system someone else owns. Name the stage the toolkit +picks up at and record it — `bin/gate-check.sh --adopt --reason "..."` — so the +earlier stages report WAIVED instead of a red row nobody can ever clear. Answer "starting from +scratch here" and nothing is waived, which is the right answer for most projects. Do NOT infer +this from what happens to be on disk: a missing artifact and an artifact produced elsewhere look +identical, and guessing wrong either nags forever or waives a stage that genuinely still matters. + +## 11. Exec approval: `auto` (default) or `ask`? + +_Not yet asked._ How to verify: ask the user; default is `auto`. Full rule text (what it +gates, the resolution order, the STOP-table carve-out): `bin/lib/wiring-item3.sh` — the same +text every agent's Start-here stamp carries. See `bin/exec-approval.sh --explain` for what is +currently resolved and why; the user switches it, never the agent on its own judgement. + +## 12. Claude Code permissions: `project` (default), `wrappers`, or `full`? + +_Not yet asked._ How to verify: ask the user; default is `project`. `wrappers` = only the +toolkit's safe wrappers run without a prompt. `project` = those plus edits inside this folder and +the everyday test/npm/docker/git-commit commands. `full` = everything, on this person's machine +only (`.claude/settings.local.json`); force-push, `git reset --hard`, `git clean` and `sudo` +still prompt. Record it as `Permission profile:` in PROJECT.md, then run +`bin/install-harness-permissions.sh --profile `; `bin/doctor.sh ` +shows what is in effect. + +## 13. Unit tests (`.test.mdl`): project default `no` (default) or `yes`? + +_Not yet asked._ How to verify: ask the user; default is `no`. Every module already gets UI +journeys and data assertions. Unit tests cost a closed Studio Pro and a snapshot per run, and +agents ran them everywhere when no default was set (toolkit issue #274). With `no`, a module +still flips to `yes` in its brief when it has calculation, mapping or date/money logic, calls Java or REST, or had a bug fixed in that flow (`testing-shape.md` §2). Record it as +`Unit tests default:` in PROJECT.md. + +## 14. Will this project use Marketplace modules — and if so, can you create a Mendix Personal Access Token now? + +_Not yet asked._ `mxcli marketplace install` needs a Mendix PAT, and a confirmed Stage 3 "Buy" +that waits for one at build time tends never to get installed (`gate-check.sh` build-ready +and `exec.sh` now check). If yes or maybe, set the token up now: where to create it, which scope, how to hand +it to mxcli — skills/learned-constants-and-secrets.md § "Creating a PAT for Marketplace +installs". If you cannot create one, name the Mendix admin who can. "No Marketplace modules +expected" is a fine answer; it is revisited at the Stage 3 fit-gap. + +## 15. Pipeline mode: `high-speed`, `balanced` (default) or `high-quality`? + +_Not yet asked._ How to verify: ask the user; default is `balanced`. The trade-off, in plain words: +- **high-speed**: fastest; pages are only polished at module close, so mid-module pages are roughest. +- **balanced**: each changed page gets one quick look and one run of the journeys that reach it; + less time per build row than checking every page after every change (1.4 min less on a 5-page + app in PR #700's experiment; estimated ≥8 min on #686's larger app); pages are polished at + module close. +- **high-quality**: checks every page after every change; slowest, maximum polish while building. +Record it as `Pipeline mode:` in PROJECT.md (no line = balanced). The table is +`skills/iterative-build-loop.md` § "Pipeline mode". + +## 16. Which kind of build — full (default) or POC? + +_Not yet asked._ Ask this FIRST, before Q1, at project birth only; the question is "Which kind of build?" +- **Full build (Recommended)**: the staged pipeline with its gates; for anything that will be maintained or go live. +- **POC build**: a demo-quality app fast: design first, one approval stop, a short must-have list; skips the stage + gates and the heavier checks, and hands over what a full build needs next. Proven on small apps only (`skills/poc-build.md`). + +Record it as `Build type: full | poc` in PROJECT.md, `CONFIRMED` (`ASSUMED` = full, only when the user said "you +decide"; `Interview mode: auto` never picks `poc`). On `poc`: open `skills/poc-build.md` and follow it; the other +intake questions are not asked (its Skipped list). A project already past kickoff is not asked: no line = `full`; if +`--repair-intake` appended this question there, answer it `Unverified — how to verify: began before this question; no line = full`. diff --git a/tests/wave2/test-entry-mode-plan-rule.sh b/tests/wave2/test-entry-mode-plan-rule.sh new file mode 100755 index 00000000..62e4594b --- /dev/null +++ b/tests/wave2/test-entry-mode-plan-rule.sh @@ -0,0 +1,165 @@ +#!/usr/bin/env bash +# test-entry-mode-plan-rule.sh — the declared-position banner and the pipeline-mode plan rule. +# +# usage: bash tests/wave2/test-entry-mode-plan-rule.sh [path-to-exec.sh] +# +# Field (two field runs, 2026-11, unattended, requirements-driven, full spec + prototypes): the +# agent built ~78 pages with no BRDs, blueprint, wireframes or plan; PROJECT.md had no entry-mode +# or position line, and nothing in the toolkit said so. project-bin/_position.sh + exec.sh now: +# +# B no Entry mode and no adoption line → the banner on exec.sh, gate-check.sh's summary and +# status.sh, and "no entry mode declared" in the BUILD-LOG row; the write is NOT refused +# R Entry mode: requirements-driven (or migration, also via the intake answer), no plan → +# refused ONCE (nothing written, MXTK-RESULT refused); the re-run goes on, row tagged "no plan" +# C cleared without a refusal by: gate-check.sh --adopt 5 (the real command), a build plan + +# module brief (root, or apps//architecture/), a brief inline in the plan +# N never refused: a-la-carte, greenfield, Build type: poc, Change an existing app, --patch +# +# Both layouts: single tree (/Fixture.mpr) and multi-app (/apps/Orders/Orders.mpr, +# PROJECT.md at the root). Golden register + intake: fixtures/entry-mode-plan-rule/ (captured from +# init-project.sh, see its README). The stub mxcli REFUSES `check`, so "the write got past the plan +# rule" is observable as exactly one check call, and nothing real is ever written. +set -uo pipefail + +TOOLKIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +SUBJECT="${1:-$TOOLKIT/project-bin/exec.sh}" +case "$SUBJECT" in /*) ;; *) SUBJECT="$PWD/$SUBJECT" ;; esac +GOLD="$TOOLKIT/tests/wave2/fixtures/entry-mode-plan-rule" +WORK="$(cd "$(mktemp -d "${TMPDIR:-/tmp}/entry-plan.XXXXXX")" && pwd -P)" || exit 2 +trap 'rm -rf "$WORK"' EXIT +PASS=0; FAIL=0 +ok() { PASS=$((PASS+1)); echo " ok - $1"; } +bad() { FAIL=$((FAIL+1)); echo " FAIL - $1${2:+: $2}"; } +echo "== subject: $SUBJECT" + +# mkproj -> sets P +N=0 +mkproj() { + N=$((N+1)); P="$WORK/p$N"; local m="$P" + mkdir -p "$P/bin" "$P/mdlsource" + [ "$1" = multi ] && m="$P/apps/Orders" + mkdir -p "$m/mprcontents" + printf 'not a real model\n' > "$m/$( [ "$1" = multi ] && echo Orders || echo Fixture ).mpr" + printf 'bson\n' > "$m/mprcontents/a.mxunit" + cp "$GOLD/PROJECT.md" "$GOLD/intake.md" "$P/" + [ -n "$2" ] && printf '%s\n' "$2" >> "$P/PROJECT.md" + printf 'CREATE ENTITY Orders.Thing (Name: String);\n' > "$P/mdlsource/01-thing.mdl" + cp "$TOOLKIT/project-bin/_common.sh" "$TOOLKIT/project-bin/_position.sh" "$TOOLKIT/project-bin/restore-mpr.sh" "$P/bin/" + cp "$SUBJECT" "$P/bin/exec.sh" + printf '#!/usr/bin/env bash\necho "Snapshot saved: none"\n' > "$P/bin/snapshot-mpr.sh" + cat > "$P/mxcli" <<'MXCLI' +#!/usr/bin/env bash +case "${1:-}" in + check) echo check >> "$CALLS"; echo "✗ stub refuses [STUB01]" >&2; exit 1 ;; + exec) echo exec >> "$CALLS"; exit 0 ;; +esac +exit 0 +MXCLI + chmod +x "$P/bin/"*.sh "$P/mxcli" + ( cd "$P" && git init -q . && printf '.mpr-snapshots/\ndocs/\n.claude/\n' > .gitignore && git add -A \ + && git -c user.email=t@t -c user.name=t commit -qm fixture ) >/dev/null 2>&1 +} +# run [exec args...] -> OUT, ROW, CALLS_N (check calls) +run() { + rm -rf "$P/docs" "$WORK/calls" + ( cd "$P" && CALLS="$WORK/calls" SP_RESTART=0 MXTK_NO_INSTALL=1 SKIP_DOCTOR=1 TMPDIR="$WORK" \ + ./bin/exec.sh "${@:-mdlsource/01-thing.mdl}" ) >"$WORK/out" 2>&1 + OUT="$(cat "$WORK/out")" + ROW="$(grep '^| ' "$P/docs/BUILD-LOG.md" 2>/dev/null | tail -1)" + CALLS_N="$(grep -c check "$WORK/calls" 2>/dev/null)"; CALLS_N="${CALLS_N:-0}" +} +refused() { case "$OUT" in *"✗ Plan rule"*) [ "$CALLS_N" = 0 ] && case "$OUT" in *"MXTK-RESULT exec verdict=refused applied=no"*) return 0 ;; esac ;; esac; return 1; } +passed() { case "$OUT" in *"✗ Plan rule"*) return 1 ;; esac; [ "$CALLS_N" = 1 ]; } + +for L in single multi; do + echo "-- layout: $L" + # B — nothing declared + mkproj "$L" "" + run + case "$OUT" in *"No entry mode declared: the toolkit treats this project as Stage P, not started."*) ok "B[$L] exec prints the banner" ;; + *) bad "B[$L] exec prints the banner" "$(head -5 "$WORK/out")" ;; esac + passed && ok "B[$L] undeclared is warned, not refused" || bad "B[$L] undeclared is warned, not refused" "calls=$CALLS_N" + case "$ROW" in *"no entry mode declared"*) ok "B[$L] BUILD-LOG row carries the tag" ;; *) bad "B[$L] BUILD-LOG row carries the tag" "$ROW" ;; esac + + # R — requirements-driven, no plan: refused once, then goes on + mkproj "$L" "Entry mode: requirements-driven" + run + refused && ok "R[$L] first write refused, nothing reached check" || bad "R[$L] first write refused" "calls=$CALLS_N $(grep -m2 'Plan rule\|MXTK-RESULT' "$WORK/out")" + case "$OUT" in *"--adopt 5 --reason"*) ok "R[$L] remedy names --adopt 5" ;; *) bad "R[$L] remedy names --adopt 5" ;; esac + case "$ROW" in *"🚫 blocked"*"plan rule"*) ok "R[$L] refusal logged" ;; *) bad "R[$L] refusal logged" "$ROW" ;; esac + case "$OUT" in *"No entry mode declared"*) bad "R[$L] no banner once the mode is declared" ;; *) ok "R[$L] no banner once the mode is declared" ;; esac + run + passed && ok "R[$L] second write goes on (refused once only)" || bad "R[$L] second write goes on" "calls=$CALLS_N" + case "$ROW" in *"no plan (Entry mode requirements-driven"*) ok "R[$L] re-run row tagged no plan" ;; *) bad "R[$L] re-run row tagged no plan" "$ROW" ;; esac + + # C — the real clearing command, on a project that was refused + mkproj "$L" "Entry mode: requirements-driven" + run + "$TOOLKIT/bin/gate-check.sh" "$P" --adopt 5 --reason "plan kept outside the toolkit" >/dev/null 2>&1 + grep -q '^Adopted at stage: 5' "$P/PROJECT.md" && ok "C[$L] --adopt 5 writes the register line" || bad "C[$L] --adopt 5 writes the register line" + rm -f "$P/.mpr-snapshots/.plan-rule-refused" + run + passed && ok "C[$L] adopted at 5 → no refusal" || bad "C[$L] adopted at 5 → no refusal" "calls=$CALLS_N" + case "$ROW" in *"no plan"*) bad "C[$L] no 'no plan' tag after adoption" "$ROW" ;; *) ok "C[$L] no 'no plan' tag after adoption" ;; esac + + # C — a build plan + a module brief (outside evidence, not the toolkit's stamp) + mkproj "$L" "Entry mode: migration" + if [ "$L" = multi ]; then A="$P/apps/Orders/architecture"; else A="$P/architecture"; fi + mkdir -p "$A/modules/Orders" + printf '# Build plan\n\n| # | Step |\n|---|---|\n| 1 | Orders domain |\n' > "$A/build-plan.md" + printf '# Module brief — Orders\n' > "$A/modules/Orders/module-brief.md" + run + passed && ok "C[$L] build plan + brief → no refusal" || bad "C[$L] build plan + brief → no refusal" "calls=$CALLS_N" +done + +echo "-- single tree only" +# C — brief inline in the plan +mkproj single "Entry mode: requirements-driven" +mkdir -p "$P/architecture"; printf '# Build plan\n\n## Module brief — Orders\n\nScreens: list, detail.\n' > "$P/architecture/build-plan.md" +run; passed && ok "C inline '## Module brief' heading → no refusal" || bad "C inline brief heading" "calls=$CALLS_N" +# a build plan without any brief is not a plan the rule accepts +mkproj single "Entry mode: requirements-driven" +mkdir -p "$P/architecture"; printf '# Build plan\n' > "$P/architecture/build-plan.md" +run; refused && ok "R a plan with no brief is still refused" || bad "R a plan with no brief is still refused" "calls=$CALLS_N" + +# R — migration declared only in the intake answer (no register line) +mkproj single "" +awk '{ print } /^## 1\. Entry mode/ { print ""; print "Answered: migration" }' "$P/intake.md" > "$P/intake.new" && mv "$P/intake.new" "$P/intake.md" +grep -q '^Answered: migration' "$P/intake.md" || bad "setup: intake answer not written" +run; refused && ok "R migration via the intake answer is refused once" || bad "R migration via intake" "calls=$CALLS_N" + +# N — modes that never refuse +for line in "Entry mode: a-la-carte" "Entry mode: greenfield" "Entry mode: Change an existing app"; do + mkproj single "$line" + run + passed && ok "N '$line' → no refusal" || bad "N '$line' → no refusal" "calls=$CALLS_N" + case "$OUT" in *"No entry mode declared"*|*"Plan rule"*) bad "N '$line' → silent" "$(grep -m1 'declared\|Plan rule' "$WORK/out")" ;; *) ok "N '$line' → silent" ;; esac +done +mkproj single "Entry mode: requirements-driven" +sed -i.bak 's/^Build type: full$/Build type: poc/' "$P/PROJECT.md" && rm -f "$P/PROJECT.md.bak" +grep -q '^Build type: poc$' "$P/PROJECT.md" || bad "setup: Build type: poc not written" +run; passed && ok "N Build type: poc → no refusal" || bad "N Build type: poc → no refusal" "calls=$CALLS_N" +# --patch: opaque repair path, never the plan rule (the script itself fails; we only look for the rule) +mkproj single "Entry mode: requirements-driven" +printf '#!/usr/bin/env bash\nexit 3\n' > "$P/patch.sh"; chmod +x "$P/patch.sh" +run --patch patch.sh +case "$OUT" in *"Plan rule"*) bad "N --patch never meets the plan rule" "$(grep -m1 'Plan rule' "$WORK/out")" ;; *) ok "N --patch never meets the plan rule" ;; esac +[ -f "$P/.mpr-snapshots/.plan-rule-refused" ] && bad "N --patch left a refusal stamp" || ok "N --patch left no refusal stamp" + +echo "-- gate-check.sh summary and status.sh" +mkproj single "" +GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 2>&1)" +case "$GC" in *"Summary:"*"No entry mode declared"*) ok "B gate-check summary carries the banner" ;; *) bad "B gate-check summary carries the banner" ;; esac +ST="$("$TOOLKIT/bin/status.sh" "$P" --brief 2>&1)" +case "$ST" in *"No entry mode declared"*) ok "B status --brief carries the banner" ;; *) bad "B status --brief carries the banner" ;; esac +case "$ST" in *"NEXT declare the entry mode"*) ok "B status NEXT says declare the mode" ;; *) bad "B status NEXT says declare the mode" "$(printf '%s\n' "$ST" | grep NEXT)" ;; esac +mkproj single "Entry mode: requirements-driven" +GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 2>&1)" +case "$GC" in *"No entry mode declared"*) bad "gate-check silent once declared" ;; *) ok "gate-check silent once declared" ;; esac +mkproj single "Entry mode: a-la-carte" +GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 3 2>&1)" +case "$GC" in *"a-la-carte entry mode — no pipeline"*) ok "a-la-carte stages read WAIVED with the reason" ;; *) bad "a-la-carte stages read WAIVED with the reason" "$(printf '%s\n' "$GC" | grep -m2 '^Stage [0-3]')" ;; esac + +echo "" +echo "== $PASS passed, $FAIL failed" +[ "$FAIL" -eq 0 ] From 1da1d80db62850ea39524de1d218b31d2f7872c1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:34:25 +0000 Subject: [PATCH 2/9] process(entry modes): mode contract, unattended-first plan rule, register skeleton - artifact-manifest.tsv modes column is the per-mode step list (vocabulary migration, requirements-driven, poc, existing-app, a-la-carte, all); dropped rows read "not owed (mode ...)". Build type: poc mode-waives stages 0-4, 6, 7 in gate-check. - Interview mode: auto: exec.sh refuses every pipeline-mode write until gate-check build-ready has passed (new .build-ready-pass record) or an adoption/stage-4 waiver exists; --adopt 4+ under auto writes an ASSUMED consentBy: auto-mode decision row (Stage 6 FAILs until confirmed). - "Mode changes are decisions": one rule in the runbook; poc-build points. - init/sync append missing register sections to a hand-written PROJECT.md (bin/lib/register-skeleton.sh, one template; fresh scaffold unchanged). - CONVERSION-RUNBOOK.md "Running unattended": the one kick-off brief. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- CHANGELOG.md | 1 + CONVERSION-RUNBOOK.md | 22 ++++ bin/gate-check.sh | 63 +++++++++++- bin/init-project.sh | 114 +++++++-------------- bin/lib/artifact-check.sh | 15 +-- bin/lib/artifact-manifest.tsv | 91 +++++++++-------- bin/lib/closeout.sh | 4 +- bin/lib/register-skeleton.sh | 118 +++++++++++++++++++++ bin/sync-project.sh | 11 ++ project-bin/_position.sh | 13 ++- project-bin/exec.sh | 19 +++- project-bin/progress-report.py | 6 +- skills/conversion-runbook.md | 4 +- skills/poc-build.md | 2 +- tests/wave2/test-closeout.sh | 2 +- tests/wave2/test-entry-mode-plan-rule.sh | 2 +- tests/wave2/test-mode-contract.sh | 124 +++++++++++++++++++++++ 17 files changed, 469 insertions(+), 142 deletions(-) create mode 100755 bin/lib/register-skeleton.sh create mode 100755 tests/wave2/test-mode-contract.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index cf1ecfe6..094d26e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m `docs/RELEASE-PROCESS.md` §8. ## Unreleased +- process(entry modes, unattended): **the mode contract, and unattended as the primary case** (stacked on the plan-rule PR): `bin/lib/artifact-manifest.tsv`'s modes column is now the per-mode step list, vocabulary `migration`, `requirements-driven`, `poc`, `existing-app`, `a-la-carte`, `all` (+ `greenfield` until retired), and a row a mode drops reads "not owed (mode …)", never PASS; `Build type: poc` is its own contract, so gate-check reads Stages 0–4, 6, 7 "not owed (mode: Build type: poc)" instead of PENDING (`poc-build.md` updated). Under `Interview mode: auto`, `exec.sh` refuses EVERY MDL write of a migration/requirements-driven project until `gate-check.sh

build-ready` has passed (its PASS now leaves `.mpr-snapshots/.build-ready-pass`) or the register adopts at 5+ / waives Stage 4 — no refuse-once, and a plan on disk alone does not clear it; interactive runs keep refuse-once. `--adopt` at 4+ under auto on those modes also writes an ASSUMED `consentBy: auto-mode` Stage-3/4 row, so `auto_hand_pending()` lists it and Stage 6 FAILs until a person confirms. "Mode changes are decisions" is stated once, in the runbook's Entry Modes (`poc-build.md` points to it). `init-project.sh` and `sync-project.sh` append the missing register sections (Current stage, Decisions, Open questions, Change log) to a PROJECT.md written by hand before init, loudly, from one template (`bin/lib/register-skeleton.sh`; a fresh scaffold is byte-identical to before), and the generated `CLAUDE.local.md` says init runs before any PROJECT.md or model write. `CONVERSION-RUNBOOK.md` gains "Running unattended", the one kick-off brief a project quotes. Fixture `tests/wave2/test-mode-contract.sh` — owner design input + a research comparison of five field builds that followed the process with the one that did not (Nov 2026) - process(exec, entry modes): **the entry mode is a declared fact every tool reads, and a pipeline-mode project no longer builds without a plan by default**: with no `Entry mode:` and no `Adopted at stage:` line (register or intake), `bin/status.sh` (both views, plus a NEXT rule), `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner, and the BUILD-LOG row is tagged `no entry mode declared`; warn-only. In `Entry mode: migration` or `requirements-driven`, the first MDL write with no plan evidence is refused ONCE (nothing locked, snapshotted or written; `verdict=refused`), remedy in one line: run stages 1–4, or `gate-check.sh --adopt 5 --reason ...`. Cleared by outside evidence (guard rule 6): adoption at 5+, a reasoned `Waived stage 4:`, gate-check's readout at Stage 5+, or `architecture/build-plan.md` plus a module brief (root or `apps//`); a re-run after the one refusal goes on, tagged `no plan`. Never refused: `a-la-carte` (new explicit mode: no pipeline, audit or tooling use; gate-check reads its stages WAIVED by mode), `greenfield`, `Build type: poc`, change an existing app, `--patch`. The one entry-mode tokeniser moves to `project-bin/_position.sh` (pure bash, no process starts; installed beside exec.sh, `bin/lib/entry-mode.sh` is now a shim) — identical output on 44 inputs against the old one. Runbook: greenfield's "stages 1–4 collapse to whatever plan the user already has" becomes a design front end (`poc-build.md` steps 1–4, then a short plan with a few lines per module); `design-artifacts.md` Step 2a adopts a supplied prototype by mapping every screen in `design/wireframes/PAGE-MAP.tsv`, and `ui-preflight-pages.md`'s wireframe STOP accepts a mapped prototype. Fixture `tests/wave2/test-entry-mode-plan-rule.sh` (single tree + `apps//`, register and intake captured from `init-project.sh`) — two field runs, Nov 2026, requirements-driven with a frozen spec and clickable prototypes: ~78 pages built with no plan or target - fix(status, agents): **`bin/status.sh` WATCHes an Agent Editor project whose extension module does not travel with the model (#778)**: Studio Pro reads `agenteditor.agent` from `modules/AgentEditor.mxmodule` beside the `.mpr`, and a sync of only `.mpr` + `mprcontents/` left it out of git, so the builder stayed green while every colleague's clone showed `unknown type 'agenteditor.agent'`. Two WATCH items, warn-only (exit code and every verdict unchanged), local files and `git ls-files` only, root and `app/` layouts: a `modules/*.mxmodule` git does not track, and a project using Agent Editor (`AgentEditorCommons` in `analysis/app-facts/inventory.json`, or a `create agent` statement in `mdlsource/`) with no `modules/AgentEditor*.mxmodule`. `skills/mendix-agents.md` (on demand) gains the rule plus the note that the GenAI key, `Encryption.EncryptionKey` and `GenAICommons.StoreTraces` belong in the Default configuration, not a start script. Empty agent references / missing model version (mendixlabs/mxcli#1867) and unset runtime constants are not checked: they need a captured agent document (option 2). Fixture `tests/wave2/test-status-extension-modules.sh` — field report from an Agent Editor project, Nov 2026 - fix(permissions): **exec approval `auto` no longer prompts on every exec's mode check, and `install-claude-hooks.sh` no longer runs unprompted (#782)**: `install-claude-permissions.sh` now allow-lists `exec-approval.sh`, `interview-mode.sh` and `permission-profile.sh`, so their reads run without a prompt, while their only writers, `--set` and `--clear`, prompt through six `ask` rules (`Bash(*exec-approval.sh*--set*)`, …) in the shared settings under every profile (an ask rule beats an allow rule, `full`'s bare `Bash` included). `install-claude-hooks.sh`, which writes `~/.claude/settings.json` for every repo on the machine, gets no allow rule. A re-install adds the ask rules and removes the hooks-installer rule an earlier install added (sidecar); entries someone else wrote are untouched, and `sync-project.sh`'s permission check names both until then. Field run on claude 2.1.325: the read ran, `--set auto` and `--clear` were refused, and with the ask rules removed `--set` ran — from the two independent reviews of #781 diff --git a/CONVERSION-RUNBOOK.md b/CONVERSION-RUNBOOK.md index 603fb125..33f5a994 100644 --- a/CONVERSION-RUNBOOK.md +++ b/CONVERSION-RUNBOOK.md @@ -24,6 +24,28 @@ Then open your agent (Claude Code or equivalent) in `` and say wha | Just an idea / existing plan | Greenfield | P (light), 5–6 | | A live Mendix app you are changing | Change an existing app | P, 0–6 per change | +## Running unattended — the kick-off brief + +**The single source of the text an unattended run (`Interview mode: auto`) is started with.** A +project brief quotes it, verbatim, instead of writing its own; add the project's own goal and +sources under it, never a different definition of done. + +```text +Follow the toolkit's process: skills/conversion-runbook.md, from Stage P, stage by stage. +1. Run bin/init-project.sh first, before writing PROJECT.md or touching the model. +2. Declare the entry mode and build type at kickoff (intake Q1 and Q16); never switch them later + without a recorded decision (conversion-runbook.md → Entry Modes, "Mode changes are decisions"). +3. Stage 5 only after stages 1-4 pass their gates and bin/gate-check.sh

build-ready passes. +4. Close every stage on a clean gate (bin/gate-check.sh

) and commit its output. +5. Stop at a gate that does not pass; report it, do not route around it. +"Done" is the declared mode's steps done and their gates clean — not only journeys passing. +``` + +*Failure it prevents (two field runs, 2026-11):* the project instructions said "follow the +runbook", but the brief the agent read first defined done as journeys passing under a time +budget and never mentioned stages. The agent built about 78 pages with no plan. Five earlier field +builds, whose briefs said in effect what the lines above say, followed the stages. + ## Where you run this — detected, not asked You do not pick an environment; `bin/doctor.sh` detects it from where the session started, and diff --git a/bin/gate-check.sh b/bin/gate-check.sh index 22db54a3..074a1be8 100755 --- a/bin/gate-check.sh +++ b/bin/gate-check.sh @@ -688,6 +688,8 @@ fi # then excused stages on that label. See bin/lib/entry-mode.sh for why. . "$(cd "$(dirname "${BASH_SOURCE[0]}")/lib" && pwd)/entry-mode.sh" ENTRY_MODE="$(entry_mode_token "$ENTRY_RAW")" +BUILD_TYPE="$(reg_field "build type" 2>/dev/null || true)" +case "$(printf '%s' "$BUILD_TYPE" | tr '[:upper:]' '[:lower:]')" in poc|poc[!a-z]*) BUILD_TYPE=poc ;; *) BUILD_TYPE=full ;; esac # stage_waiver — "|", or nothing. Most specific source of truth first. # @@ -728,24 +730,33 @@ stage_waiver() { "$ADOPTED_AT" "${ADOPTED_REASON:+: $ADOPTED_REASON}" return 0 fi + # The mode contract (conversion-runbook.md → Entry Modes; artifact-manifest.tsv column 6). + # `Build type: poc` is its own contract whatever the entry mode: skills/poc-build.md owes its + # steps and must-haves, not stage gates, so 0-4, 6 and 7 read "not owed (mode)" instead of a + # PENDING row nobody may clear. Stage 5 stays checked (MANUAL), and P (the build-type answer). + if [ "$BUILD_TYPE" = poc ]; then + case "$st" in + [0-4]|6|7) printf 'mode|not owed (mode: Build type: poc) — skills/poc-build.md owes steps 1–9 and its must-haves instead\n'; return 0 ;; + esac + fi # Entry mode. The runbook's Entry Modes table already says these stages do not run; until now # the gate did not know that, so it demanded artifacts the runbook had excused. case "$ENTRY_MODE" in greenfield) case "$st" in - 1|2|3|4) printf 'mode|greenfield entry mode — stages 1–4 collapse into the design front end and short plan (conversion-runbook.md → Entry Modes)\n'; return 0 ;; + 1|2|3|4) printf 'mode|not owed (mode: greenfield) — stages 1–4 collapse into the design front end and short plan (conversion-runbook.md → Entry Modes)\n'; return 0 ;; esac ;; requirements-driven) case "$st" in - 7) printf 'mode|requirements-driven entry mode — no legacy system to cut over from; if legacy data turns up, record a Stage-7 decision and this goes back to being checked (conversion-runbook.md → Entry Modes)\n'; return 0 ;; + 7) printf 'mode|not owed (mode: requirements-driven) — no legacy system to cut over from; if legacy data turns up, record a Stage-7 decision and this goes back to being checked (conversion-runbook.md → Entry Modes)\n'; return 0 ;; esac ;; existing-app-change) case "$st" in - 7) printf 'mode|existing-app entry mode — the app is live and stays live; there is no cutover (existing-app-change.md → Deliverables)\n'; return 0 ;; + 7) printf 'mode|not owed (mode: existing-app) — the app is live and stays live; there is no cutover (existing-app-change.md → Deliverables)\n'; return 0 ;; esac ;; a-la-carte) case "$st" in - [0-7]) printf 'mode|a-la-carte entry mode — no pipeline: audit or tooling use only (existing-app-assurance.md); declare another mode to run the stages\n'; return 0 ;; + [0-7]) printf 'mode|not owed (mode: a-la-carte) — no pipeline: audit or tooling use only (existing-app-assurance.md); declare another mode to run the stages\n'; return 0 ;; esac ;; esac return 1 @@ -3204,6 +3215,25 @@ register_set_line() { # register_set_line

build-ready` has PASSed (it leaves .mpr-snapshots/.build-ready-pass), or + # the register adopts at 5+ / waives Stage 4 — an adoption under auto is recorded as a ✋ + # human-pending decision that keeps Stage 6 FAILing until a person confirms it. A plan on disk + # alone does not clear it: nobody has checked it. Neither remedy runs through exec.sh. + _GC="${MXTK_ROOT:-${_TKR:-}}/bin/gate-check.sh" + result_line refused no skipped 1 + echo "✗ Plan rule (Interview mode: auto): Entry mode $POS_ENTRY, and the pre-build steps are not done — $_GC $PROJECT_ROOT build-ready has not passed. NOTHING was written." + echo " Remedy: run stages 1-4, then $_GC $PROJECT_ROOT build-ready; or $_GC $PROJECT_ROOT --adopt 5 --reason \"...\" — under auto that is a ✋ human-pending decision, and Stage 6 FAILs until a person confirms it." + log_build "🚫 blocked" "plan rule (auto): Entry mode $POS_ENTRY, build-ready not passed and no adoption — nothing written" + exit 1 + elif [ "$PATCH_MODE" != "1" ] && [ "$POS_BUILD" != poc ] && [ "$POS_AUTO" != 1 ] \ && { [ "$POS_ENTRY" = migration ] || [ "$POS_ENTRY" = requirements-driven ]; } \ && ! mxtk_plan_evidence "$PROJECT_ROOT"; then _PLAN_STAMP="$PROJECT_ROOT/.mpr-snapshots/.plan-rule-refused" diff --git a/project-bin/progress-report.py b/project-bin/progress-report.py index 7f64b779..0f529d8a 100755 --- a/project-bin/progress-report.py +++ b/project-bin/progress-report.py @@ -196,7 +196,9 @@ def load_project(proj): "status": st.group(0).lower() if st else "unknown", "status_txt": c[7], "closed": c[8] if len(c) > 8 else ""}) m = re.search(r"Entry mode:\s*\**\s*(\w[\w-]*)", md) em = (m.group(1).lower() if m else "migration") - info["entry_mode"] = "requirements" if em.startswith("requirements") else "existing-app-change" if em.startswith("existing") else em + # The mode-contract vocabulary of artifact-manifest.tsv column 6 (Build type: poc is its own contract). + info["entry_mode"] = "requirements-driven" if em.startswith("requirements") else "existing-app" if em.startswith(("existing", "change")) else em + if re.search(r"(?im)^[\s>*_-]*Build type\s*\**\s*:\s*\**\s*poc\b", md): info["entry_mode"] = "poc" info["waived"] = set(re.findall(r"Waived artifact\s+([\w-]+)\s*:", md)) info["waived_stages"] = set(re.findall(r"(?im)^[\s>*_-]*Waived stage\s+([P0-7])\s*\**\s*:", md)) for agg in re.findall(r"(?im)^[\s>*_-]*Waived stages\s*\**\s*:\s*([^\n]*)", md): @@ -342,7 +344,7 @@ def load_manifest(toolkit, mode): for line in txt.splitlines(): if not line.strip() or line.startswith("#"): continue c = line.split("\t") - if len(c) >= 7 and c[1] in STAGES and mode in c[5].split(",") and c[0] not in WAIVED: + if len(c) >= 7 and c[1] in STAGES and (mode in c[5].split(",") or "all" in c[5].split(",")) and c[0] not in WAIVED: rows.append({"id": c[0], "stage": c[1], "paths": c[2].split("|"), "absence": c[6].strip()}) return rows diff --git a/skills/conversion-runbook.md b/skills/conversion-runbook.md index 5d9ed321..ace29668 100644 --- a/skills/conversion-runbook.md +++ b/skills/conversion-runbook.md @@ -75,7 +75,9 @@ The stages are the same for everyone; what differs is where you enter and which (Failure: a project with full specs + analyzable source was classified greenfield "because there's nothing to migrate" and proposed skipping 0–4 — `process/baseline-incident-history.md` §R1.) -**Declared, or the toolkit says so.** With no `Entry mode:` and no `Adopted at stage:` line, `bin/status.sh`, `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner: *No entry mode declared: the toolkit treats this project as Stage P, not started.* **Plan before build:** in `migration` or `requirements-driven`, the first `exec.sh` model write before Stage 4 has passed or been adopted is refused once — run stages 1–4, or `bin/gate-check.sh

--adopt 5 --reason "..."` (a register line). A build plan plus a module brief, `Waived stage 4:` or adoption at 5+ clears it; never refused: `a-la-carte`, `greenfield`, `Build type: poc`, change an existing app, `--patch`. *Failure (two field runs, 2026-11): a full frozen spec plus clickable prototypes, "requirements-driven" in the brief, and ~78 pages built with no plan or wireframe target, missing whole sections the prototypes showed; nothing spoke, because nothing was declared.* +**Declared, or the toolkit says so.** With no `Entry mode:` and no `Adopted at stage:` line, `bin/status.sh`, `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner: *No entry mode declared: the toolkit treats this project as Stage P, not started.* **Plan before build:** in `migration` or `requirements-driven`, the first `exec.sh` model write before Stage 4 has passed or been adopted is refused once — run stages 1–4, or `bin/gate-check.sh

--adopt 5 --reason "..."` (a register line). A build plan plus a module brief, `Waived stage 4:` or adoption at 5+ clears it; never refused: `a-la-carte`, `greenfield`, `Build type: poc`, change an existing app, `--patch`. Under `Interview mode: auto` there is no refuse-once: every write waits for `build-ready` to pass, and an `--adopt` past Stage 3 or 4 is recorded as a ✋ human-pending decision (Stage 6 FAILs until a person confirms it). Unattended kick-off text: `CONVERSION-RUNBOOK.md` → "Running unattended". + +**Mode changes are decisions — the single source of this rule.** Each mode (Entry mode + Build type) is a contract: its steps are the rows `bin/lib/artifact-manifest.tsv` lists for it; a step the mode drops reads "not owed (mode)", never PASS. Switching mode after kickoff needs the user to say so, is recorded in `PROJECT.md` as a decision (under auto: ✋ human-pending), and never happens because a step was hard. *Failure: a Stage 5 project whose user mentioned a demo dropped its gates.* *Failure (two field runs, 2026-11): a full frozen spec plus clickable prototypes, "requirements-driven" in the brief, and ~78 pages built with no plan or wireframe target, missing whole sections the prototypes showed; nothing spoke, because nothing was declared.* | You're starting from… | Mode | Stages that run | What changes | |---|---|---|---| diff --git a/skills/poc-build.md b/skills/poc-build.md index c7d63c66..4b096ed5 100644 --- a/skills/poc-build.md +++ b/skills/poc-build.md @@ -5,7 +5,7 @@ **Status: EXPERIMENTAL.** Two builds driven by this text, one model, small apps. First (fictional visitor-pass app, ~36 min): "nearly demo-ready", function 26 of 29, design ~4.1 of 5 (not blind), journey 22/22. Second (kickoff question asked first, answered POC; ~64 min): a blind grader compared it with the same requirements built in plain plan mode with no toolkit: function 25 of 25 against 24 of 24 testable; refusals in-page 7 of 7 against 2 of 6; must-haves 10 of 10 against 5 of 10; visual mean 3.8 against 3.6; hand-over 22 of 24 against 12 of 24; time ~64 against ~27 min (both ran in parallel, inflated). The gain is the must-have list and the hand-over, not the look, and it costs time. NOT proven: a real person answering (answers and approval came from a prepared file). The test cadence (steps 7–8) changed after both builds (#770) and is unmeasured. -**Who asks.** The kickoff interview asks the build type first, at project birth (intake Q16; rendering per `skills/interview-protocol.md` §3). On a POC answer `Build type: poc` is recorded `CONFIRMED` in `PROJECT.md`, and this skill is the flow; the other intake questions are not asked. A missing `Build type:` line means `full`; `Interview mode: auto` never picks `poc`. A project past kickoff whose user only says "we need a demo this week" does NOT switch: the lead says in one line that the build type is chosen at the start and offers to continue the normal build (optionally `Pipeline mode: high-speed`). Switching such a project needs the user to say so explicitly, confirmed once, and is recorded in `PROJECT.md` as a decision. *Failure: a Stage 5 project whose user mentioned a demo dropped its gates.* A POC build does **not** run the nine stage gates. Stage P still checks that every `intake.md` question carries an answer marker, so write them: Q16 `Answered (CONFIRMED): POC build`, and under each of Q1–Q15 exactly `Unverified — how to verify: not asked, POC build (Build type: poc, skills/poc-build.md); ask it if the build continues as a full build`. Then `bin/gate-check.sh` shows Stage P `PASS` (markers present; it says nothing about those answers), Stages 0–4, 6, 7 `PENDING`, Stage 5 `MANUAL`. *Failure: unmarked questions kept Stage P at `FAIL` for the whole build.* No answer: end the turn and wait (`skills/interview-protocol.md` §3); `ASSUMED` only when the user said "you decide" (= `full`). +**Who asks.** The kickoff interview asks the build type first, at project birth (intake Q16; rendering per `skills/interview-protocol.md` §3). On a POC answer `Build type: poc` is recorded `CONFIRMED` in `PROJECT.md`, and this skill is the flow; the other intake questions are not asked. A missing `Build type:` line means `full`; `Interview mode: auto` never picks `poc`. A project past kickoff whose user only says "we need a demo this week" does NOT switch: the lead says in one line that the build type is chosen at the start and offers to continue the normal build (optionally `Pipeline mode: high-speed`). Switching follows the runbook's "Mode changes are decisions" (`conversion-runbook.md` → Entry Modes), the one statement of that rule. A POC build does **not** run the nine stage gates. Stage P still checks that every `intake.md` question carries an answer marker, so write them: Q16 `Answered (CONFIRMED): POC build`, and under each of Q1–Q15 exactly `Unverified — how to verify: not asked, POC build (Build type: poc, skills/poc-build.md); ask it if the build continues as a full build`. Then `bin/gate-check.sh` shows Stage P `PASS` (markers present; it says nothing about those answers), Stages 0–4, 6, 7 `WAIVED` — "not owed (mode: Build type: poc)", the mode contract — and Stage 5 `MANUAL`. *Failure: unmarked questions kept Stage P at `FAIL` for the whole build.* No answer: end the turn and wait (`skills/interview-protocol.md` §3); `ASSUMED` only when the user said "you decide" (= `full`). **Size:** more than 3 entities, 5 pages or 2 roles is unmeasured. Say so once, then continue: a warning, not a refusal (*failure: an agent that refuses, or proceeds without a word*). diff --git a/tests/wave2/test-closeout.sh b/tests/wave2/test-closeout.sh index 4d0cc714..3a51f2d2 100755 --- a/tests/wave2/test-closeout.sh +++ b/tests/wave2/test-closeout.sh @@ -122,7 +122,7 @@ echo "== T8: --closeout without a stage refuses ==" echo "== T9: a row the entry mode does not owe is N/A, never 'still missing' (2026-09-25) ==" P="$(mkproj t9)" OUT="$("$GATE" --closeout "$P" 0 2>&1)" -case "$OUT" in *"⏭ \`app-report\` — N/A: entry mode requirements does not owe it"*) ok "app-report N/A on a requirements-driven register" ;; *) bad "app-report not N/A: $(printf '%s' "$OUT" | grep app-report)" ;; esac +case "$OUT" in *"⏭ \`app-report\` — N/A: not owed (mode requirements-driven)"*) ok "app-report N/A on a requirements-driven register" ;; *) bad "app-report not N/A: $(printf '%s' "$OUT" | grep app-report)" ;; esac if printf '%s\n' "$OUT" | grep 'still missing for this stage' | grep -q 'app-report'; then bad "plain words list app-report as missing"; else ok "plain words do not list a row this mode does not owe"; fi rm -rf "$WORK" diff --git a/tests/wave2/test-entry-mode-plan-rule.sh b/tests/wave2/test-entry-mode-plan-rule.sh index 62e4594b..abf05fcf 100755 --- a/tests/wave2/test-entry-mode-plan-rule.sh +++ b/tests/wave2/test-entry-mode-plan-rule.sh @@ -158,7 +158,7 @@ GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 2>&1)" case "$GC" in *"No entry mode declared"*) bad "gate-check silent once declared" ;; *) ok "gate-check silent once declared" ;; esac mkproj single "Entry mode: a-la-carte" GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 3 2>&1)" -case "$GC" in *"a-la-carte entry mode — no pipeline"*) ok "a-la-carte stages read WAIVED with the reason" ;; *) bad "a-la-carte stages read WAIVED with the reason" "$(printf '%s\n' "$GC" | grep -m2 '^Stage [0-3]')" ;; esac +case "$GC" in *"not owed (mode: a-la-carte) — no pipeline"*) ok "a-la-carte stages read WAIVED with the reason" ;; *) bad "a-la-carte stages read WAIVED with the reason" "$(printf '%s\n' "$GC" | grep -m2 '^Stage [0-3]')" ;; esac echo "" echo "== $PASS passed, $FAIL failed" diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh new file mode 100755 index 00000000..c29f47c9 --- /dev/null +++ b/tests/wave2/test-mode-contract.sh @@ -0,0 +1,124 @@ +#!/usr/bin/env bash +# test-mode-contract.sh — the mode contract under Interview mode: auto, the ✋ adoption, POC's +# "not owed (mode)", and init/sync laying down a register over a hand-written PROJECT.md. +# +# usage: bash tests/wave2/test-mode-contract.sh [path-to-exec.sh] +# +# Owner design input (2026-11-17): unattended is the primary case. Field basis: two field runs +# (2026-11, auto, requirements-driven) built ~78 pages with no plan; one had a hand-written +# 10-line PROJECT.md that init-project.sh then skipped in silence. +# +# A auto + requirements-driven, no build-ready: EVERY write refused (no refuse-once), a plan +# on disk does not clear it, the build-ready stamp does, an --adopt 5 does +# H --adopt 5 under auto writes an ASSUMED consentBy: auto-mode Stage-4 row, and gate-check +# lists it as a ✋ decision to confirm; without auto no row is written +# K Build type: poc → gate-check reads Stages 0-4, 6, 7 "not owed (mode: Build type: poc)"; +# artifact rows not listed for poc read "not owed (mode poc" +# G init-project.sh over a hand-written PROJECT.md appends Current stage, Decisions, Open +# questions and Change log, says so, and keeps the hand-written lines +# +# Golden register + intake: fixtures/entry-mode-plan-rule/ (captured from init-project.sh). +set -uo pipefail + +TOOLKIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +SUBJECT="${1:-$TOOLKIT/project-bin/exec.sh}" +case "$SUBJECT" in /*) ;; *) SUBJECT="$PWD/$SUBJECT" ;; esac +GOLD="$TOOLKIT/tests/wave2/fixtures/entry-mode-plan-rule" +WORK="$(cd "$(mktemp -d "${TMPDIR:-/tmp}/mode-contract.XXXXXX")" && pwd -P)" || exit 2 +trap 'rm -rf "$WORK"' EXIT +PASS=0; FAIL=0 +ok() { PASS=$((PASS+1)); echo " ok - $1"; } +bad() { FAIL=$((FAIL+1)); echo " FAIL - $1${2:+: $2}"; } +echo "== subject: $SUBJECT" + +# mkproj -> sets P +N=0 +mkproj() { + N=$((N+1)); P="$WORK/p$N"; local m="$P" + mkdir -p "$P/bin" "$P/mdlsource" + [ "$1" = multi ] && m="$P/apps/Orders" + mkdir -p "$m/mprcontents" + printf 'not a real model\n' > "$m/$( [ "$1" = multi ] && echo Orders || echo Fixture ).mpr" + printf 'bson\n' > "$m/mprcontents/a.mxunit" + cp "$GOLD/PROJECT.md" "$GOLD/intake.md" "$P/" + [ -n "$2" ] && printf '%s\n' "$2" >> "$P/PROJECT.md" + printf 'CREATE ENTITY Orders.Thing (Name: String);\n' > "$P/mdlsource/01-thing.mdl" + cp "$TOOLKIT/project-bin/_common.sh" "$TOOLKIT/project-bin/_position.sh" "$TOOLKIT/project-bin/restore-mpr.sh" "$P/bin/" + cp "$SUBJECT" "$P/bin/exec.sh" + printf '#!/usr/bin/env bash\necho "Snapshot saved: none"\n' > "$P/bin/snapshot-mpr.sh" + cat > "$P/mxcli" <<'MXCLI' +#!/usr/bin/env bash +case "${1:-}" in + check) echo check >> "$CALLS"; echo "✗ stub refuses [STUB01]" >&2; exit 1 ;; + exec) echo exec >> "$CALLS"; exit 0 ;; +esac +exit 0 +MXCLI + chmod +x "$P/bin/"*.sh "$P/mxcli" + ( cd "$P" && git init -q . && printf '.mpr-snapshots/\ndocs/\n.claude/\n' > .gitignore && git add -A \ + && git -c user.email=t@t -c user.name=t commit -qm fixture ) >/dev/null 2>&1 +} +# run [exec args...] -> OUT, ROW, CALLS_N (check calls) +run() { + rm -rf "$P/docs" "$WORK/calls" + ( cd "$P" && CALLS="$WORK/calls" SP_RESTART=0 MXTK_NO_INSTALL=1 SKIP_DOCTOR=1 TMPDIR="$WORK" \ + ./bin/exec.sh "${@:-mdlsource/01-thing.mdl}" ) >"$WORK/out" 2>&1 + OUT="$(cat "$WORK/out")" + ROW="$(grep '^| ' "$P/docs/BUILD-LOG.md" 2>/dev/null | tail -1)" + CALLS_N="$(grep -c check "$WORK/calls" 2>/dev/null)"; CALLS_N="${CALLS_N:-0}" +} +refused() { case "$OUT" in *"✗ Plan rule"*) [ "$CALLS_N" = 0 ] && case "$OUT" in *"MXTK-RESULT exec verdict=refused applied=no"*) return 0 ;; esac ;; esac; return 1; } +passed() { case "$OUT" in *"✗ Plan rule"*) return 1 ;; esac; [ "$CALLS_N" = 1 ]; } + + +autorefused() { case "$OUT" in *"✗ Plan rule (Interview mode: auto)"*) [ "$CALLS_N" = 0 ] ;; *) return 1 ;; esac; } +GC="$TOOLKIT/bin/gate-check.sh" + +echo "-- A: auto mode" +mkproj single "Entry mode: requirements-driven" +printf 'Interview mode: auto\n' >> "$P/PROJECT.md" +run; autorefused && ok "A first write refused" || bad "A first write refused" "calls=$CALLS_N" +case "$OUT" in *"✋ human-pending"*) ok "A remedy says an adoption is ✋ human-pending" ;; *) bad "A remedy says an adoption is ✋ human-pending" ;; esac +run; autorefused && ok "A second write refused too (no refuse-once under auto)" || bad "A second write refused too" "calls=$CALLS_N" +mkdir -p "$P/architecture/modules/Orders"; printf '# Build plan\n' > "$P/architecture/build-plan.md"; printf '# Module brief — Orders\n' > "$P/architecture/modules/Orders/module-brief.md" +run; autorefused && ok "A a plan on disk alone does not clear it under auto" || bad "A plan on disk alone" "calls=$CALLS_N" +mkdir -p "$P/.mpr-snapshots"; printf 'x build-ready PASS\n' > "$P/.mpr-snapshots/.build-ready-pass" +run; passed && ok "A the build-ready record clears it" || bad "A the build-ready record clears it" "calls=$CALLS_N" +mkproj single "Entry mode: migration" +printf 'Interview mode: auto\n' >> "$P/PROJECT.md" +CLAUDE_INTERVIEW_MODE= "$GC" "$P" --adopt 5 --reason "plan kept outside the toolkit" > "$WORK/adopt.out" 2>&1 +run; passed && ok "A --adopt 5 clears it" || bad "A --adopt 5 clears it" "calls=$CALLS_N" + +echo "-- H: the ✋ adoption" +grep -qE '^\| 4 \| Adopted at stage 5 .*\| ASSUMED \| consentBy: auto-mode · consentAt: [0-9]' "$P/PROJECT.md" \ + && ok "H ASSUMED auto-mode Stage-4 row written" || bad "H ASSUMED auto-mode Stage-4 row written" "$(grep -n 'Adopted' "$P/PROJECT.md")" +grep -q "human-pending" "$WORK/adopt.out" && ok "H --adopt says it is human-pending" || bad "H --adopt says it is human-pending" +G="$("$GC" "$P" 2>&1)" +case "$G" in *"✋ decision(s) assumed by auto-mode"*"(Stage 4)"*) ok "H gate-check lists it to confirm" ;; *) bad "H gate-check lists it to confirm" ;; esac +mkproj single "Entry mode: migration" +"$GC" "$P" --adopt 5 --reason "plan kept outside the toolkit" >/dev/null 2>&1 +grep -q "consentBy: auto-mode" "$P/PROJECT.md" && bad "H no ✋ row without auto" || ok "H no ✋ row without auto" + +echo "-- K: Build type: poc" +mkproj single "Entry mode: requirements-driven" +sed -i.bak 's/^Build type: full$/Build type: poc/' "$P/PROJECT.md" && rm -f "$P/PROJECT.md.bak" +G="$("$GC" "$P" 2>&1)" +n="$(printf '%s\n' "$G" | grep -cE '^Stage [0-4] .*not owed \(mode: Build type: poc\)|^Stage [67] .*not owed \(mode: Build type: poc\)')" +[ "$n" = 7 ] && ok "K stages 0-4, 6, 7 not owed (mode) — 7 of 7" || bad "K stages 0-4, 6, 7 not owed (mode)" "$n of 7" +case "$G" in *"not owed (mode poc"*) ok "K artifact rows say not owed (mode poc)" ;; *) bad "K artifact rows say not owed (mode poc)" ;; esac + +echo "-- G: init over a hand-written PROJECT.md" +Q="$WORK/hand"; mkdir -p "$Q"; ( cd "$Q" && git init -q . ) +printf '# My project\n\nEntry mode: requirements-driven\nRequirements live in specs/.\n' > "$Q/PROJECT.md" +MXTK_NO_GUIDE=1 HOME="$WORK/home" "$TOOLKIT/bin/init-project.sh" "$Q" > "$WORK/init.out" 2>&1 +case "$(cat "$WORK/init.out")" in *"PROJECT.md already existed WITHOUT the decision-register structure — appended: Current stage, Decisions, Open questions, Change log"*) ok "G init says what it appended" ;; + *) bad "G init says what it appended" "$(grep -m1 PROJECT.md "$WORK/init.out")" ;; esac +for h in "## Current stage" "## Decisions" "## Open questions" "## Change log"; do + grep -q "^$h" "$Q/PROJECT.md" && ok "G $h present" || bad "G $h present"; done +grep -q '^Requirements live in specs/\.$' "$Q/PROJECT.md" && ok "G hand-written lines kept" || bad "G hand-written lines kept" +MXTK_NO_GUIDE=1 HOME="$WORK/home" "$TOOLKIT/bin/init-project.sh" "$Q" 2>&1 | grep -q "Skip: PROJECT.md already exists" \ + && ok "G a second init appends nothing" || bad "G a second init appends nothing" + +echo "" +echo "== $PASS passed, $FAIL failed" +[ "$FAIL" -eq 0 ] From 86114c5b2fcc07b4ec8a24d28da256e6929725d9 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:44:08 +0000 Subject: [PATCH 3/9] fix(mode contract): keep master's mode-column tokens; poc stays its own axis Per the vocabulary correction: artifact-manifest.tsv column 6 keeps migration,requirements,greenfield,existing-app-change (the tokens entry_mode_token produces, copied by obligations.tsv column 10 in #787). No poc or all token; Build type: poc is read by gate-check.sh only. Only the N/A wording changes ("not owed (mode ...)"). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- CHANGELOG.md | 2 +- bin/lib/artifact-check.sh | 13 ++--- bin/lib/artifact-manifest.tsv | 94 +++++++++++++++---------------- bin/lib/closeout.sh | 2 +- project-bin/progress-report.py | 6 +- tests/wave2/test-closeout.sh | 2 +- tests/wave2/test-mode-contract.sh | 5 +- 7 files changed, 59 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 094d26e5..8f735559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m `docs/RELEASE-PROCESS.md` §8. ## Unreleased -- process(entry modes, unattended): **the mode contract, and unattended as the primary case** (stacked on the plan-rule PR): `bin/lib/artifact-manifest.tsv`'s modes column is now the per-mode step list, vocabulary `migration`, `requirements-driven`, `poc`, `existing-app`, `a-la-carte`, `all` (+ `greenfield` until retired), and a row a mode drops reads "not owed (mode …)", never PASS; `Build type: poc` is its own contract, so gate-check reads Stages 0–4, 6, 7 "not owed (mode: Build type: poc)" instead of PENDING (`poc-build.md` updated). Under `Interview mode: auto`, `exec.sh` refuses EVERY MDL write of a migration/requirements-driven project until `gate-check.sh

build-ready` has passed (its PASS now leaves `.mpr-snapshots/.build-ready-pass`) or the register adopts at 5+ / waives Stage 4 — no refuse-once, and a plan on disk alone does not clear it; interactive runs keep refuse-once. `--adopt` at 4+ under auto on those modes also writes an ASSUMED `consentBy: auto-mode` Stage-3/4 row, so `auto_hand_pending()` lists it and Stage 6 FAILs until a person confirms. "Mode changes are decisions" is stated once, in the runbook's Entry Modes (`poc-build.md` points to it). `init-project.sh` and `sync-project.sh` append the missing register sections (Current stage, Decisions, Open questions, Change log) to a PROJECT.md written by hand before init, loudly, from one template (`bin/lib/register-skeleton.sh`; a fresh scaffold is byte-identical to before), and the generated `CLAUDE.local.md` says init runs before any PROJECT.md or model write. `CONVERSION-RUNBOOK.md` gains "Running unattended", the one kick-off brief a project quotes. Fixture `tests/wave2/test-mode-contract.sh` — owner design input + a research comparison of five field builds that followed the process with the one that did not (Nov 2026) +- process(entry modes, unattended): **the mode contract, and unattended as the primary case** (stacked on the plan-rule PR): `bin/lib/artifact-manifest.tsv`'s existing modes column (tokens unchanged: `migration`, `requirements`, `greenfield`, `existing-app-change`, as `entry_mode_token` produces them; shared with `obligations.tsv`'s column 10) is documented as the per-mode step list, and a row a mode drops reads "not owed (mode …)" instead of "entry mode … does not owe it"; `Build type: poc` is a separate axis, so gate-check reads Stages 0–4, 6, 7 "not owed (mode: Build type: poc)" instead of PENDING (`poc-build.md` updated). Under `Interview mode: auto`, `exec.sh` refuses EVERY MDL write of a migration/requirements-driven project until `gate-check.sh

build-ready` has passed (its PASS now leaves `.mpr-snapshots/.build-ready-pass`) or the register adopts at 5+ / waives Stage 4 — no refuse-once, and a plan on disk alone does not clear it; interactive runs keep refuse-once. `--adopt` at 4+ under auto on those modes also writes an ASSUMED `consentBy: auto-mode` Stage-3/4 row, so `auto_hand_pending()` lists it and Stage 6 FAILs until a person confirms. "Mode changes are decisions" is stated once, in the runbook's Entry Modes (`poc-build.md` points to it). `init-project.sh` and `sync-project.sh` append the missing register sections (Current stage, Decisions, Open questions, Change log) to a PROJECT.md written by hand before init, loudly, from one template (`bin/lib/register-skeleton.sh`; a fresh scaffold is byte-identical to before), and the generated `CLAUDE.local.md` says init runs before any PROJECT.md or model write. `CONVERSION-RUNBOOK.md` gains "Running unattended", the one kick-off brief a project quotes. Fixture `tests/wave2/test-mode-contract.sh` — owner design input + a research comparison of five field builds that followed the process with the one that did not (Nov 2026) - process(exec, entry modes): **the entry mode is a declared fact every tool reads, and a pipeline-mode project no longer builds without a plan by default**: with no `Entry mode:` and no `Adopted at stage:` line (register or intake), `bin/status.sh` (both views, plus a NEXT rule), `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner, and the BUILD-LOG row is tagged `no entry mode declared`; warn-only. In `Entry mode: migration` or `requirements-driven`, the first MDL write with no plan evidence is refused ONCE (nothing locked, snapshotted or written; `verdict=refused`), remedy in one line: run stages 1–4, or `gate-check.sh --adopt 5 --reason ...`. Cleared by outside evidence (guard rule 6): adoption at 5+, a reasoned `Waived stage 4:`, gate-check's readout at Stage 5+, or `architecture/build-plan.md` plus a module brief (root or `apps//`); a re-run after the one refusal goes on, tagged `no plan`. Never refused: `a-la-carte` (new explicit mode: no pipeline, audit or tooling use; gate-check reads its stages WAIVED by mode), `greenfield`, `Build type: poc`, change an existing app, `--patch`. The one entry-mode tokeniser moves to `project-bin/_position.sh` (pure bash, no process starts; installed beside exec.sh, `bin/lib/entry-mode.sh` is now a shim) — identical output on 44 inputs against the old one. Runbook: greenfield's "stages 1–4 collapse to whatever plan the user already has" becomes a design front end (`poc-build.md` steps 1–4, then a short plan with a few lines per module); `design-artifacts.md` Step 2a adopts a supplied prototype by mapping every screen in `design/wireframes/PAGE-MAP.tsv`, and `ui-preflight-pages.md`'s wireframe STOP accepts a mapped prototype. Fixture `tests/wave2/test-entry-mode-plan-rule.sh` (single tree + `apps//`, register and intake captured from `init-project.sh`) — two field runs, Nov 2026, requirements-driven with a frozen spec and clickable prototypes: ~78 pages built with no plan or target - fix(status, agents): **`bin/status.sh` WATCHes an Agent Editor project whose extension module does not travel with the model (#778)**: Studio Pro reads `agenteditor.agent` from `modules/AgentEditor.mxmodule` beside the `.mpr`, and a sync of only `.mpr` + `mprcontents/` left it out of git, so the builder stayed green while every colleague's clone showed `unknown type 'agenteditor.agent'`. Two WATCH items, warn-only (exit code and every verdict unchanged), local files and `git ls-files` only, root and `app/` layouts: a `modules/*.mxmodule` git does not track, and a project using Agent Editor (`AgentEditorCommons` in `analysis/app-facts/inventory.json`, or a `create agent` statement in `mdlsource/`) with no `modules/AgentEditor*.mxmodule`. `skills/mendix-agents.md` (on demand) gains the rule plus the note that the GenAI key, `Encryption.EncryptionKey` and `GenAICommons.StoreTraces` belong in the Default configuration, not a start script. Empty agent references / missing model version (mendixlabs/mxcli#1867) and unset runtime constants are not checked: they need a captured agent document (option 2). Fixture `tests/wave2/test-status-extension-modules.sh` — field report from an Agent Editor project, Nov 2026 - fix(permissions): **exec approval `auto` no longer prompts on every exec's mode check, and `install-claude-hooks.sh` no longer runs unprompted (#782)**: `install-claude-permissions.sh` now allow-lists `exec-approval.sh`, `interview-mode.sh` and `permission-profile.sh`, so their reads run without a prompt, while their only writers, `--set` and `--clear`, prompt through six `ask` rules (`Bash(*exec-approval.sh*--set*)`, …) in the shared settings under every profile (an ask rule beats an allow rule, `full`'s bare `Bash` included). `install-claude-hooks.sh`, which writes `~/.claude/settings.json` for every repo on the machine, gets no allow rule. A re-install adds the ask rules and removes the hooks-installer rule an earlier install added (sidecar); entries someone else wrote are untouched, and `sync-project.sh`'s permission check names both until then. Field run on claude 2.1.325: the read ran, `--set auto` and `--clear` were refused, and with the ask rules removed `--set` ran — from the two independent reviews of #781 diff --git a/bin/lib/artifact-check.sh b/bin/lib/artifact-check.sh index 3c201e16..461cb98a 100755 --- a/bin/lib/artifact-check.sh +++ b/bin/lib/artifact-check.sh @@ -211,15 +211,12 @@ _art_stage_of_rank() { case "$1" in 0) echo P ;; [1-8]) echo $(( $1 - 1 )) ;; *) _art_entry_mode() { local raw raw="$(_art_field "$1" "entry mode" 2>/dev/null || true)" - # Shared tokeniser (see bin/lib/entry-mode.sh), translated at the boundary into the - # manifest's mode-contract vocabulary. - # The mode contract's vocabulary (artifact-manifest.tsv column 6): `Build type: poc` is its own - # contract whatever the entry mode says (skills/poc-build.md owes its steps, not stage gates). - local bt; bt="$(_art_field "$1" "build type" 2>/dev/null || true)" - case "$bt" in [Pp][Oo][Cc]|[Pp][Oo][Cc][!A-Za-z]*) echo "poc"; return 0 ;; esac + # Shared tokeniser (see bin/lib/entry-mode.sh). + # The manifest's modes column says "requirements" where the canonical set says + # "requirements-driven"; translate at the boundary. local tok; tok="$(entry_mode_token "$raw")" case "$tok" in - existing-app-change) echo "existing-app" ;; + requirements-driven) echo "requirements" ;; *) echo "$tok" ;; esac } @@ -417,7 +414,7 @@ mxtk_artifacts_report() { # (young register, no line yet) excuses nothing. if [ -n "$mode" ]; then case ",$modes," in - *",$mode,"*|*",all,"*) ;; + *",$mode,"*) ;; *) printf 'Artifact %-24s N/A — not owed (mode %s; manifest modes: %s)\n' \ "$id" "$mode" "$modes" continue ;; diff --git a/bin/lib/artifact-manifest.tsv b/bin/lib/artifact-manifest.tsv index 1ed206ee..972093ea 100644 --- a/bin/lib/artifact-manifest.tsv +++ b/bin/lib/artifact-manifest.tsv @@ -43,12 +43,12 @@ # 4 producer the skill step or script that emits it — the thing a PENDING row tells you # to run # 5 consumers the citations that earn the row its place (see above) -# 6 modes THE MODE CONTRACT (2026-11-17): comma list of the modes that owe it. Vocabulary, -# shared with obligations.tsv's mode column: migration, requirements-driven, -# poc (`Build type: poc`, whatever the entry mode), existing-app, a-la-carte, -# all — plus greenfield until it is retired. A mode not listed reports -# "not owed (mode)", never PASS; a listed one missing reports PENDING as before. -# (conversion-runbook.md §"Entry Modes", its table; existing-app runs +# 6 modes THE MODE CONTRACT: comma list of the entry modes that owe it, in the tokens +# bin/lib/entry-mode.sh produces (shared with obligations.tsv's modes column): +# migration,requirements,greenfield,existing-app-change. A mode not listed reports +# "not owed (mode …)", never PASS; a listed one missing reports PENDING as before. +# `Build type: poc` is a separate axis, read by gate-check.sh, not a token here. +# (conversion-runbook.md §"Entry Modes", its table; existing-app-change runs # P–6 per slice, so it owes every row but coverage-ledger — that mode's ledger # is `mxcli brain plan`, existing-app-change.md §"Coverage in this mode") — plus # app-report, the one row only it owes: the map of the live app that Stage 0's @@ -76,49 +76,49 @@ # later, not overdue now. # artifact stage paths producer consumers modes absence -intake P intake.md bin/init-project.sh scaffold + the Stage-P kickoff interview (conversion-runbook.md §2 Stage P) bin/gate-check.sh:596 (check_stage_P), bin/gate-check.sh:497 (entry-mode fallback read) migration,requirements-driven,greenfield,existing-app,poc gate -register P PROJECT.md bin/init-project.sh (empty register); every checkpoint writes into it (CLAUDE.md §One decision register) bin/gate-check.sh:285 (register resolution feeding every ✋ gate), bin/lib/obligation-check.sh:151 (waivers/adoption read from it) migration,requirements-driven,greenfield,existing-app,poc gate -triage 0 triage.md bin/init-project.sh scaffold, filled per skills/source-triage.md; N/A rows recorded, never deleted (conversion-runbook.md:130) bin/gate-check.sh:684 (check_stage_0 sign-off test) migration,requirements-driven,greenfield,existing-app gate -app-report 0 analysis/app-report.json|analysis/app-report.html project-bin/app-facts.sh (read-only: full catalog build + mxcli graph-report + loop sweep) then bin/app-report.sh — skills/app-analysis.md Procedure steps 1 and 5 skills/existing-app-change.md §"Map the app first" (the findings interview reads analysis/app-report.json) and §"Blast radius" (reads analysis/app-facts/dependencies.json tangles and edges) existing-app report -extraction-report 1 analysis/*/knowledge-base/extraction-report.html|analysis/knowledge-base/extraction-report.html|knowledge-base/extraction-report.html bin/extraction-report.sh — one renderer for every entry mode bin/gate-check.sh:725 (check_stage_1) migration,requirements-driven,existing-app gate -source-ledger 1 analysis/source-ledger.html bin/source-ledger.sh report — every inventoried source file and what consumed it (Stage 1 owes a disposition per row; gate-check blocks 1–2 on the check) bin/gate-check.sh (LEDGER block — the check; the html is the human-facing table of the same rows) migration,requirements-driven,existing-app report -brds 2 analysis/*/knowledge-base/brd/*.brd.json|analysis/knowledge-base/brd/*.brd.json|knowledge-base/brd/*.brd.json pipeline generators (migration), skills/kb-generation.md (documents), skills/brd-generation.md (by hand) — the reader must not care which bin/lib/discover-brds.sh:43 (the one path authority), bin/gate-check.sh:773 (check_stage_2), bin/brd-report.sh, bin/open-questions.sh migration,requirements-driven,existing-app gate -brd-validation 2 analysis/*/knowledge-base/reports/validation-report.md|analysis/knowledge-base/reports/validation-report.md|knowledge-base/reports/validation-report.md skills/brd-validation.md loop, run to Clean bin/gate-check.sh:777-807 (check_stage_2 Stop-condition test) migration,requirements-driven,existing-app gate -brd-surface 2 analysis/brd-report.html bin/brd-report.sh (default output, bin/brd-report.sh:113); also holds the pass-1 process map and the open questions (replaced docs/open-questions.html, 2026-10-16) conversion-runbook.md §2 Stage-2 Surface row, parsed at bin/gate-check.sh:1284 (stage_surface_cells) migration,requirements-driven,existing-app report -module-design 3 architecture/module-design.html|module-design.html skills/modularize-domain.md:88 (the human-facing sign-off artifact) skills/modularize-domain.md:109 (gate checklist), conversion-runbook.md:478 Stage-3 Surface row (parsed at bin/gate-check.sh:1284) migration,requirements-driven,existing-app report -fit-gap 3 architecture/fit-gap.md skills/architecture-blueprint.md Step 4 bin/gate-check.sh:912 (check_stage_3), bin/gate-check.sh:939 (blueprint.html staleness input) migration,requirements-driven,existing-app gate -blueprint-md 3 architecture/blueprint.md skills/architecture-blueprint.md Steps 2-6 — the markdown is the source of truth bin/gate-check.sh:939 (staleness input), skills/architecture-blueprint.md:54 (render source for blueprint.html) migration,requirements-driven,existing-app report -blueprint-html 3 architecture/blueprint.html skills/architecture-blueprint.md Step 7 (generated render, never hand-edited) bin/gate-check.sh:931-943 (check_stage_3 presence + freshness) migration,requirements-driven,existing-app gate -design-system 3 design/design-system.html skills/design-artifacts.md:79 (annotated showcase linking ds.css) bin/gate-check.sh:913 (check_stage_3), bin/gate-check.sh:1135 (build-ready) migration,requirements-driven,existing-app gate -ds-css 3 design/ds.css skills/design-artifacts.md:75 (the physical token/component source) skills/design-artifacts.md:68 (two-files rule — every wireframe links it), bin/gate-check.sh:1135 (build-ready accepts either file) migration,requirements-driven,existing-app report -wireframes 3 design/wireframes/*.html skills/design-artifacts.md Step 3, one per screen bin/gate-check.sh:923 (check_stage_3), bin/gate-check.sh:1129 (build-ready), skills/ui-preflight-pages.md (mdl-agent pre-flight input) migration,requirements-driven,existing-app gate -interaction-model 3 design/interaction-model.md skills/interaction-model.md (Stage 3, after the role model is CONFIRMED and before the first wireframe — design-artifacts.md Step 2b) skills/design-artifacts.md Step 3 (every wireframe's wf-contract block is copied from its row), skills/brd-to-build-plan.md Step 7 Navigation Wiring (home per role, wire points, page parameters), bin/lib/interaction-model-check.sh (the Stage-3 facts check_stage_3 fails on) migration,requirements-driven,existing-app report -module-definition 3 architecture/modules/*/definition.md skills/architecture-blueprint.md Step 1 (:60 — the directory shape, one doc per module) THIS ROW IS ITS FIRST MECHANICAL CONSUMER — as of 2026-08-22 nothing executable read definition.md (improvement-plan P7 residue, the newest instance of the pattern this table exists to stop); prose consumers: skills/architecture-blueprint.md:43, skills/coverage-ledger.md:27 migration,requirements-driven,existing-app report -build-plan 4 architecture/build-plan.md skills/brd-to-build-plan.md bin/gate-check.sh:955 (check_stage_4), project-bin/build-plan-status.sh (progress board), project-bin/coverage-preflight.sh:238 (the claims join) migration,requirements-driven,existing-app gate -build-plan-html 4 architecture/progress-report.html project-bin/build-plan-status.sh --html (skills/brd-to-build-plan.md:47 — derived view, never hand-edited; refreshed by exec.sh and full gate-check.sh runs via --refresh) conversion-runbook.md §2 Stage-4 Surface row, parsed at bin/gate-check.sh:1284 migration,requirements-driven,existing-app report -build-plan-json 4 architecture/build-plan.json project-bin/build-plan-status.sh --json (derived from build-plan.md's Step-5 Phase headings, row tables and claims: blocks, never hand-edited; not written when the markdown has no Phase headings; --refresh keeps an existing file current but never creates it) MXTK Studio Plan room (a view built from data, not from the HTML); nothing in the toolkit reads it and no verdict may depend on it migration,requirements-driven,existing-app report -module-brief 4 architecture/modules/*/module-brief.md|architecture/modules/*-brief.md skills/module-brief.md — ba-agent writes the first at Stage 4, the rest just-in-time bin/gate-check.sh:1121 (build-ready fails without one), project-bin/build-plan-status.sh:109 migration,requirements-driven,existing-app gate -coverage-ledger 4 architecture/modules/*/coverage-ledger/*.md|architecture/modules/*/coverage-ledger.md|architecture/modules/*-coverage-ledger.md|architecture/coverage-ledger.md skills/coverage-ledger.md procedure at Stage 4 (BRD leaves × build-plan claims); the four shapes are §"Where the ledger lives", the per-BRD split form first project-bin/conformance-check.sh:85-93, project-bin/coverage-preflight.sh:134-137, project-bin/verify-module.sh:299-300, project-bin/review-module.sh:289, conversion-runbook.md:487 (Stage-4 produces row) — the eleven-consumers-no-producer artifact of improvement-plan Finding 12 migration,requirements-driven report -ui-reviews 5 design/ui-reviews/ui-review-*.html skills/module-review.md pass (review-agent), one report per module close-out bin/gate-check.sh:984 (check_stage_6), bin/lib/obligations.tsv:47 (the look row — per-module coverage and denominators live THERE; this row only asks whether the stage produced any report at all) migration,requirements-driven,greenfield,existing-app gate -journeys 5 ${JOURNEY_DIR}/*.journey.json journey authoring per skills/testing-shape.md / skills/journey-proof.md (worked example: project-tests/e2e/example.journey.json) project-bin/verify-module.sh:376,404 (the journeys rung), project-tests/e2e/journey-runner.js:5 migration,requirements-driven,greenfield,existing-app report -page-scope 5 .claude/loop/page-scope.json project-bin/page-scope.sh (the phantom of improvement-plan Finding 15 until 078c7d8 shipped it) project-tests/e2e/design-audit.js:55, project-tests/e2e/page-audit.js:66, project-tests/e2e/report-normalize.js:112 — without it the LOOK instruments degrade to --static-only migration,requirements-driven,greenfield,existing-app report -lint-last 5 .claude/loop/lint-last.json project-bin/lint-gate.sh (written on every run that reaches a verdict, not only --update-baseline), run as part of skills/module-review.md stage 2 GATE ("bin/exec.sh; gate-agent confirms 0 mxbuild errors, lint clean" — same step named in skills/iterative-build-loop.md's "Gate: BUILD") bin/status.sh:75-81,129 (the OVERDUE line's lint readout — without it status.sh reports "lint gate never recorded here") migration,requirements-driven,greenfield,existing-app report -improvement-register 5 docs/improvement-register.md skills/improvement-register.md:39 (append-only, one row per finding, written during build/verify passes) project-bin/build-plan-status.sh:69,148 (the proven-vs-built cross-reference), skills/close-the-loop.md migration,requirements-driven,greenfield,existing-app report -improvement-register-html 5 docs/improvement-register.html project-bin/render-improvement-register.sh (landed 2026-08-22; in MXTK_PROJECT_BIN — bin/lib/install-manifest.sh:81-85) project-bin/render-improvement-register.sh:35 (output contract); human review surface for the register above — report-only by assignment migration,requirements-driven,greenfield,existing-app report -report-json 6 docs/report.json project-bin/verify-module.sh:518 (normalize rung → report-normalize.js), run as part of every module verify bin/gate-check.sh:980 (check_stage_6 requires it alongside the HTML), project-tests/e2e/report-render.js (renders from it) migration,requirements-driven,greenfield,existing-app gate -verification-html 6 docs/verification/report.html|test-report.html|reports/test-report.html project-bin/verify-module.sh:521 (render rung → report-render.js); the two test-report.html shapes are the legacy names check_stage_6 still accepts bin/gate-check.sh:970-995 (check_stage_6 — the gate that was structurally unpassable before b9c90a4/078c7d8, improvement-plan Finding 14) migration,requirements-driven,greenfield,existing-app gate +intake P intake.md bin/init-project.sh scaffold + the Stage-P kickoff interview (conversion-runbook.md §2 Stage P) bin/gate-check.sh:596 (check_stage_P), bin/gate-check.sh:497 (entry-mode fallback read) migration,requirements,greenfield,existing-app-change gate +register P PROJECT.md bin/init-project.sh (empty register); every checkpoint writes into it (CLAUDE.md §One decision register) bin/gate-check.sh:285 (register resolution feeding every ✋ gate), bin/lib/obligation-check.sh:151 (waivers/adoption read from it) migration,requirements,greenfield,existing-app-change gate +triage 0 triage.md bin/init-project.sh scaffold, filled per skills/source-triage.md; N/A rows recorded, never deleted (conversion-runbook.md:130) bin/gate-check.sh:684 (check_stage_0 sign-off test) migration,requirements,greenfield,existing-app-change gate +app-report 0 analysis/app-report.json|analysis/app-report.html project-bin/app-facts.sh (read-only: full catalog build + mxcli graph-report + loop sweep) then bin/app-report.sh — skills/app-analysis.md Procedure steps 1 and 5 skills/existing-app-change.md §"Map the app first" (the findings interview reads analysis/app-report.json) and §"Blast radius" (reads analysis/app-facts/dependencies.json tangles and edges) existing-app-change report +extraction-report 1 analysis/*/knowledge-base/extraction-report.html|analysis/knowledge-base/extraction-report.html|knowledge-base/extraction-report.html bin/extraction-report.sh — one renderer for every entry mode bin/gate-check.sh:725 (check_stage_1) migration,requirements,existing-app-change gate +source-ledger 1 analysis/source-ledger.html bin/source-ledger.sh report — every inventoried source file and what consumed it (Stage 1 owes a disposition per row; gate-check blocks 1–2 on the check) bin/gate-check.sh (LEDGER block — the check; the html is the human-facing table of the same rows) migration,requirements,existing-app-change report +brds 2 analysis/*/knowledge-base/brd/*.brd.json|analysis/knowledge-base/brd/*.brd.json|knowledge-base/brd/*.brd.json pipeline generators (migration), skills/kb-generation.md (documents), skills/brd-generation.md (by hand) — the reader must not care which bin/lib/discover-brds.sh:43 (the one path authority), bin/gate-check.sh:773 (check_stage_2), bin/brd-report.sh, bin/open-questions.sh migration,requirements,existing-app-change gate +brd-validation 2 analysis/*/knowledge-base/reports/validation-report.md|analysis/knowledge-base/reports/validation-report.md|knowledge-base/reports/validation-report.md skills/brd-validation.md loop, run to Clean bin/gate-check.sh:777-807 (check_stage_2 Stop-condition test) migration,requirements,existing-app-change gate +brd-surface 2 analysis/brd-report.html bin/brd-report.sh (default output, bin/brd-report.sh:113); also holds the pass-1 process map and the open questions (replaced docs/open-questions.html, 2026-10-16) conversion-runbook.md §2 Stage-2 Surface row, parsed at bin/gate-check.sh:1284 (stage_surface_cells) migration,requirements,existing-app-change report +module-design 3 architecture/module-design.html|module-design.html skills/modularize-domain.md:88 (the human-facing sign-off artifact) skills/modularize-domain.md:109 (gate checklist), conversion-runbook.md:478 Stage-3 Surface row (parsed at bin/gate-check.sh:1284) migration,requirements,existing-app-change report +fit-gap 3 architecture/fit-gap.md skills/architecture-blueprint.md Step 4 bin/gate-check.sh:912 (check_stage_3), bin/gate-check.sh:939 (blueprint.html staleness input) migration,requirements,existing-app-change gate +blueprint-md 3 architecture/blueprint.md skills/architecture-blueprint.md Steps 2-6 — the markdown is the source of truth bin/gate-check.sh:939 (staleness input), skills/architecture-blueprint.md:54 (render source for blueprint.html) migration,requirements,existing-app-change report +blueprint-html 3 architecture/blueprint.html skills/architecture-blueprint.md Step 7 (generated render, never hand-edited) bin/gate-check.sh:931-943 (check_stage_3 presence + freshness) migration,requirements,existing-app-change gate +design-system 3 design/design-system.html skills/design-artifacts.md:79 (annotated showcase linking ds.css) bin/gate-check.sh:913 (check_stage_3), bin/gate-check.sh:1135 (build-ready) migration,requirements,existing-app-change gate +ds-css 3 design/ds.css skills/design-artifacts.md:75 (the physical token/component source) skills/design-artifacts.md:68 (two-files rule — every wireframe links it), bin/gate-check.sh:1135 (build-ready accepts either file) migration,requirements,existing-app-change report +wireframes 3 design/wireframes/*.html skills/design-artifacts.md Step 3, one per screen bin/gate-check.sh:923 (check_stage_3), bin/gate-check.sh:1129 (build-ready), skills/ui-preflight-pages.md (mdl-agent pre-flight input) migration,requirements,existing-app-change gate +interaction-model 3 design/interaction-model.md skills/interaction-model.md (Stage 3, after the role model is CONFIRMED and before the first wireframe — design-artifacts.md Step 2b) skills/design-artifacts.md Step 3 (every wireframe's wf-contract block is copied from its row), skills/brd-to-build-plan.md Step 7 Navigation Wiring (home per role, wire points, page parameters), bin/lib/interaction-model-check.sh (the Stage-3 facts check_stage_3 fails on) migration,requirements,existing-app-change report +module-definition 3 architecture/modules/*/definition.md skills/architecture-blueprint.md Step 1 (:60 — the directory shape, one doc per module) THIS ROW IS ITS FIRST MECHANICAL CONSUMER — as of 2026-08-22 nothing executable read definition.md (improvement-plan P7 residue, the newest instance of the pattern this table exists to stop); prose consumers: skills/architecture-blueprint.md:43, skills/coverage-ledger.md:27 migration,requirements,existing-app-change report +build-plan 4 architecture/build-plan.md skills/brd-to-build-plan.md bin/gate-check.sh:955 (check_stage_4), project-bin/build-plan-status.sh (progress board), project-bin/coverage-preflight.sh:238 (the claims join) migration,requirements,existing-app-change gate +build-plan-html 4 architecture/progress-report.html project-bin/build-plan-status.sh --html (skills/brd-to-build-plan.md:47 — derived view, never hand-edited; refreshed by exec.sh and full gate-check.sh runs via --refresh) conversion-runbook.md §2 Stage-4 Surface row, parsed at bin/gate-check.sh:1284 migration,requirements,existing-app-change report +build-plan-json 4 architecture/build-plan.json project-bin/build-plan-status.sh --json (derived from build-plan.md's Step-5 Phase headings, row tables and claims: blocks, never hand-edited; not written when the markdown has no Phase headings; --refresh keeps an existing file current but never creates it) MXTK Studio Plan room (a view built from data, not from the HTML); nothing in the toolkit reads it and no verdict may depend on it migration,requirements,existing-app-change report +module-brief 4 architecture/modules/*/module-brief.md|architecture/modules/*-brief.md skills/module-brief.md — ba-agent writes the first at Stage 4, the rest just-in-time bin/gate-check.sh:1121 (build-ready fails without one), project-bin/build-plan-status.sh:109 migration,requirements,existing-app-change gate +coverage-ledger 4 architecture/modules/*/coverage-ledger/*.md|architecture/modules/*/coverage-ledger.md|architecture/modules/*-coverage-ledger.md|architecture/coverage-ledger.md skills/coverage-ledger.md procedure at Stage 4 (BRD leaves × build-plan claims); the four shapes are §"Where the ledger lives", the per-BRD split form first project-bin/conformance-check.sh:85-93, project-bin/coverage-preflight.sh:134-137, project-bin/verify-module.sh:299-300, project-bin/review-module.sh:289, conversion-runbook.md:487 (Stage-4 produces row) — the eleven-consumers-no-producer artifact of improvement-plan Finding 12 migration,requirements report +ui-reviews 5 design/ui-reviews/ui-review-*.html skills/module-review.md pass (review-agent), one report per module close-out bin/gate-check.sh:984 (check_stage_6), bin/lib/obligations.tsv:47 (the look row — per-module coverage and denominators live THERE; this row only asks whether the stage produced any report at all) migration,requirements,greenfield,existing-app-change gate +journeys 5 ${JOURNEY_DIR}/*.journey.json journey authoring per skills/testing-shape.md / skills/journey-proof.md (worked example: project-tests/e2e/example.journey.json) project-bin/verify-module.sh:376,404 (the journeys rung), project-tests/e2e/journey-runner.js:5 migration,requirements,greenfield,existing-app-change report +page-scope 5 .claude/loop/page-scope.json project-bin/page-scope.sh (the phantom of improvement-plan Finding 15 until 078c7d8 shipped it) project-tests/e2e/design-audit.js:55, project-tests/e2e/page-audit.js:66, project-tests/e2e/report-normalize.js:112 — without it the LOOK instruments degrade to --static-only migration,requirements,greenfield,existing-app-change report +lint-last 5 .claude/loop/lint-last.json project-bin/lint-gate.sh (written on every run that reaches a verdict, not only --update-baseline), run as part of skills/module-review.md stage 2 GATE ("bin/exec.sh; gate-agent confirms 0 mxbuild errors, lint clean" — same step named in skills/iterative-build-loop.md's "Gate: BUILD") bin/status.sh:75-81,129 (the OVERDUE line's lint readout — without it status.sh reports "lint gate never recorded here") migration,requirements,greenfield,existing-app-change report +improvement-register 5 docs/improvement-register.md skills/improvement-register.md:39 (append-only, one row per finding, written during build/verify passes) project-bin/build-plan-status.sh:69,148 (the proven-vs-built cross-reference), skills/close-the-loop.md migration,requirements,greenfield,existing-app-change report +improvement-register-html 5 docs/improvement-register.html project-bin/render-improvement-register.sh (landed 2026-08-22; in MXTK_PROJECT_BIN — bin/lib/install-manifest.sh:81-85) project-bin/render-improvement-register.sh:35 (output contract); human review surface for the register above — report-only by assignment migration,requirements,greenfield,existing-app-change report +report-json 6 docs/report.json project-bin/verify-module.sh:518 (normalize rung → report-normalize.js), run as part of every module verify bin/gate-check.sh:980 (check_stage_6 requires it alongside the HTML), project-tests/e2e/report-render.js (renders from it) migration,requirements,greenfield,existing-app-change gate +verification-html 6 docs/verification/report.html|test-report.html|reports/test-report.html project-bin/verify-module.sh:521 (render rung → report-render.js); the two test-report.html shapes are the legacy names check_stage_6 still accepts bin/gate-check.sh:970-995 (check_stage_6 — the gate that was structurally unpassable before b9c90a4/078c7d8, improvement-plan Finding 14) migration,requirements,greenfield,existing-app-change gate # ── Opt-in rows (absence = optin) — added 2026-09-02 with the close-out block. Offered at # the stage open, owed only after opting in. Paths are the first-match convention; the second # alternative is the name a real project already used (workflow-design: a field project's # architecture/workflow-definition.md, written unprompted and never tracked by anything). -workflow-design 3 architecture/workflow-definition.md|architecture/workflow-design.md|architecture/workflows/*.md skills/architecture-blueprint.md Step 3b (state diagram per process: states, transitions, who moves it, SLA) + skills/learned-workflow-patterns.md for the native-Workflow shape skills/checkpoints/checkpoint-architecture.md Q3 (asks whether the process is Workflow or enum-driven — either way this is where it is drawn), skills/learned-workflow-patterns.md (the build-time reader), bin/lib/closeout.sh (offers it at the Stage-3 open, lists it at the close) migration,requirements-driven,greenfield,existing-app optin -swimlanes 3 architecture/swimlanes.md|architecture/swimlane-*.md|architecture/diagrams/swimlane*.md|design/process-model.json Mermaid per business process, one lane per role from the Stage-3 role model, one section per process; the cross-persona journey diagrams of skills/architecture-blueprint.md Step 3d are the multi-persona case of the same picture; or the process map model of skills/process-map.md Step 2, which draws the same lanes and adds the screens and questions skills/checkpoints/checkpoint-architecture.md (the optional-artifacts question), skills/architecture-blueprint.md Step 3d (journey list it feeds), skills/journey-proof.md (the journeys a swimlane names are the ones Stage 5–6 must prove), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -process-map 3 design/process-map.html skills/process-map.md Step 4 (project-bin/process-map.js build; generated from design/process-model.json, never hand-edited) bin/gate-check.sh:1162-1181 (check_stage_3 freshness against design/process-model.json and its anchors), skills/checkpoints/checkpoint-design.md:16 (CAC-4 uses it to walk the questions; pass 2 at the Stage 3 gate close-out) migration,requirements-driven,existing-app optin -sequence-diagrams 3 architecture/sequence-diagrams.md|architecture/sequence-*.md|architecture/diagrams/sequence*.md Mermaid sequenceDiagram per integration or agent call — caller, Mendix microflow, external system, sync/async, timeout, fallback; the agent-wiring diagram of skills/architecture-blueprint.md Step 3c is one instance skills/checkpoints/checkpoint-architecture.md Q3 agent-wiring half, skills/rest-integration-first-time-right.md (build-time reader for the REST ones), skills/mendix-agents.md, bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -erd 3 architecture/erd.md|architecture/domain-model.md|architecture/diagrams/erd*.md Mermaid erDiagram of the TARGET domain across modules — entities, associations, ownership per module; the blueprint's layer diagram shows modules, not entities, and .mx-brd.json shows one module at a time skills/checkpoints/checkpoint-architecture.md Q2 (cross-module data strategy — the picture that question is about), skills/modularize-domain.md, bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -nfr-sheet 3 architecture/nfr.md|architecture/nfrs.md|architecture/non-functional-requirements.md One table: NFR, target, how measured, where in the model it is enforced (XPath, index, batch size, timeout) — the per-NFR expansion of the list CAC-3's open question writes to project-profile.md skills/checkpoints/checkpoint-architecture.md open question (the list), skills/architecture-blueprint.md Step 5 (the register that must not lose them), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -integration-contracts 3 architecture/integration-contracts.md|architecture/integrations.md|architecture/integrations/*.md Per integration: endpoint, auth, payload in/out, error handling, owner, test double — written BEFORE the build plan so the plan can sequence it skills/rest-integration-first-time-right.md (reads it first thing at Stage 5), skills/architecture-blueprint.md Step 5 (the integrations register), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -test-plan 4 architecture/test-plan.md|docs/test-plan.md Per module: the journeys to prove, the fixtures they need, the DB assertions, the edge cases — the plan-side twin of the coverage ledger, written per skills/testing-shape.md before any MDL skills/checkpoints/checkpoint-build.md (the optional-artifacts question), skills/testing-shape.md, skills/journey-proof.md, skills/fixture-seeding.md (Stage-5 readers), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -acceptance-criteria 4 architecture/acceptance-criteria.md|docs/acceptance-criteria.md Per module: what "done" means beyond CE-error-free — the Stage-4 "User defines" row of conversion-runbook.md §2, written down instead of held in chat; each criterion names the journey or check that proves it conversion-runbook.md §2 Stage 4 "User defines" row, skills/module-brief.md (the brief's Done section is where these land per module), skills/module-review.md (the confirm step reads them), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin -demo-script 5 docs/demo-script.md|docs/demo/script.md The narrated walk-through a human will give — beats, pages, fixtures on screen, what the audience must see happen; written at the Stage-5 open so the build front-loads what the demo needs skills/record-demo-video.md (its input), skills/handoff-to-studio-pro.md §8 (demo data the script depends on), bin/lib/closeout.sh migration,requirements-driven,greenfield,existing-app optin +workflow-design 3 architecture/workflow-definition.md|architecture/workflow-design.md|architecture/workflows/*.md skills/architecture-blueprint.md Step 3b (state diagram per process: states, transitions, who moves it, SLA) + skills/learned-workflow-patterns.md for the native-Workflow shape skills/checkpoints/checkpoint-architecture.md Q3 (asks whether the process is Workflow or enum-driven — either way this is where it is drawn), skills/learned-workflow-patterns.md (the build-time reader), bin/lib/closeout.sh (offers it at the Stage-3 open, lists it at the close) migration,requirements,greenfield,existing-app-change optin +swimlanes 3 architecture/swimlanes.md|architecture/swimlane-*.md|architecture/diagrams/swimlane*.md|design/process-model.json Mermaid per business process, one lane per role from the Stage-3 role model, one section per process; the cross-persona journey diagrams of skills/architecture-blueprint.md Step 3d are the multi-persona case of the same picture; or the process map model of skills/process-map.md Step 2, which draws the same lanes and adds the screens and questions skills/checkpoints/checkpoint-architecture.md (the optional-artifacts question), skills/architecture-blueprint.md Step 3d (journey list it feeds), skills/journey-proof.md (the journeys a swimlane names are the ones Stage 5–6 must prove), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +process-map 3 design/process-map.html skills/process-map.md Step 4 (project-bin/process-map.js build; generated from design/process-model.json, never hand-edited) bin/gate-check.sh:1162-1181 (check_stage_3 freshness against design/process-model.json and its anchors), skills/checkpoints/checkpoint-design.md:16 (CAC-4 uses it to walk the questions; pass 2 at the Stage 3 gate close-out) migration,requirements,existing-app-change optin +sequence-diagrams 3 architecture/sequence-diagrams.md|architecture/sequence-*.md|architecture/diagrams/sequence*.md Mermaid sequenceDiagram per integration or agent call — caller, Mendix microflow, external system, sync/async, timeout, fallback; the agent-wiring diagram of skills/architecture-blueprint.md Step 3c is one instance skills/checkpoints/checkpoint-architecture.md Q3 agent-wiring half, skills/rest-integration-first-time-right.md (build-time reader for the REST ones), skills/mendix-agents.md, bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +erd 3 architecture/erd.md|architecture/domain-model.md|architecture/diagrams/erd*.md Mermaid erDiagram of the TARGET domain across modules — entities, associations, ownership per module; the blueprint's layer diagram shows modules, not entities, and .mx-brd.json shows one module at a time skills/checkpoints/checkpoint-architecture.md Q2 (cross-module data strategy — the picture that question is about), skills/modularize-domain.md, bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +nfr-sheet 3 architecture/nfr.md|architecture/nfrs.md|architecture/non-functional-requirements.md One table: NFR, target, how measured, where in the model it is enforced (XPath, index, batch size, timeout) — the per-NFR expansion of the list CAC-3's open question writes to project-profile.md skills/checkpoints/checkpoint-architecture.md open question (the list), skills/architecture-blueprint.md Step 5 (the register that must not lose them), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +integration-contracts 3 architecture/integration-contracts.md|architecture/integrations.md|architecture/integrations/*.md Per integration: endpoint, auth, payload in/out, error handling, owner, test double — written BEFORE the build plan so the plan can sequence it skills/rest-integration-first-time-right.md (reads it first thing at Stage 5), skills/architecture-blueprint.md Step 5 (the integrations register), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +test-plan 4 architecture/test-plan.md|docs/test-plan.md Per module: the journeys to prove, the fixtures they need, the DB assertions, the edge cases — the plan-side twin of the coverage ledger, written per skills/testing-shape.md before any MDL skills/checkpoints/checkpoint-build.md (the optional-artifacts question), skills/testing-shape.md, skills/journey-proof.md, skills/fixture-seeding.md (Stage-5 readers), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +acceptance-criteria 4 architecture/acceptance-criteria.md|docs/acceptance-criteria.md Per module: what "done" means beyond CE-error-free — the Stage-4 "User defines" row of conversion-runbook.md §2, written down instead of held in chat; each criterion names the journey or check that proves it conversion-runbook.md §2 Stage 4 "User defines" row, skills/module-brief.md (the brief's Done section is where these land per module), skills/module-review.md (the confirm step reads them), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin +demo-script 5 docs/demo-script.md|docs/demo/script.md The narrated walk-through a human will give — beats, pages, fixtures on screen, what the audience must see happen; written at the Stage-5 open so the build front-loads what the demo needs skills/record-demo-video.md (its input), skills/handoff-to-studio-pro.md §8 (demo data the script depends on), bin/lib/closeout.sh migration,requirements,greenfield,existing-app-change optin diff --git a/bin/lib/closeout.sh b/bin/lib/closeout.sh index c64ed219..48a15a17 100755 --- a/bin/lib/closeout.sh +++ b/bin/lib/closeout.sh @@ -220,7 +220,7 @@ _co_plain_gate_needs() { # ignored the modes column, so a requirements-driven Stage 0 PASS still said "still missing for # this stage: app-report" — a row only existing-app-change owes, which artifact-check.sh itself # reported as N/A on the same run. -_co_owed() { [ -z "$2" ] && return 0; case ",$1," in *",$2,"*|*",all,"*) return 0 ;; esac; return 1; } +_co_owed() { [ -z "$2" ] && return 0; case ",$1," in *",$2,"*) return 0 ;; esac; return 1; } # mxtk_plain_verdict [register] # The "In plain words" paragraph under a gate line: status first, then every reason the diff --git a/project-bin/progress-report.py b/project-bin/progress-report.py index 0f529d8a..7f64b779 100755 --- a/project-bin/progress-report.py +++ b/project-bin/progress-report.py @@ -196,9 +196,7 @@ def load_project(proj): "status": st.group(0).lower() if st else "unknown", "status_txt": c[7], "closed": c[8] if len(c) > 8 else ""}) m = re.search(r"Entry mode:\s*\**\s*(\w[\w-]*)", md) em = (m.group(1).lower() if m else "migration") - # The mode-contract vocabulary of artifact-manifest.tsv column 6 (Build type: poc is its own contract). - info["entry_mode"] = "requirements-driven" if em.startswith("requirements") else "existing-app" if em.startswith(("existing", "change")) else em - if re.search(r"(?im)^[\s>*_-]*Build type\s*\**\s*:\s*\**\s*poc\b", md): info["entry_mode"] = "poc" + info["entry_mode"] = "requirements" if em.startswith("requirements") else "existing-app-change" if em.startswith("existing") else em info["waived"] = set(re.findall(r"Waived artifact\s+([\w-]+)\s*:", md)) info["waived_stages"] = set(re.findall(r"(?im)^[\s>*_-]*Waived stage\s+([P0-7])\s*\**\s*:", md)) for agg in re.findall(r"(?im)^[\s>*_-]*Waived stages\s*\**\s*:\s*([^\n]*)", md): @@ -344,7 +342,7 @@ def load_manifest(toolkit, mode): for line in txt.splitlines(): if not line.strip() or line.startswith("#"): continue c = line.split("\t") - if len(c) >= 7 and c[1] in STAGES and (mode in c[5].split(",") or "all" in c[5].split(",")) and c[0] not in WAIVED: + if len(c) >= 7 and c[1] in STAGES and mode in c[5].split(",") and c[0] not in WAIVED: rows.append({"id": c[0], "stage": c[1], "paths": c[2].split("|"), "absence": c[6].strip()}) return rows diff --git a/tests/wave2/test-closeout.sh b/tests/wave2/test-closeout.sh index 3a51f2d2..6686b550 100755 --- a/tests/wave2/test-closeout.sh +++ b/tests/wave2/test-closeout.sh @@ -122,7 +122,7 @@ echo "== T8: --closeout without a stage refuses ==" echo "== T9: a row the entry mode does not owe is N/A, never 'still missing' (2026-09-25) ==" P="$(mkproj t9)" OUT="$("$GATE" --closeout "$P" 0 2>&1)" -case "$OUT" in *"⏭ \`app-report\` — N/A: not owed (mode requirements-driven)"*) ok "app-report N/A on a requirements-driven register" ;; *) bad "app-report not N/A: $(printf '%s' "$OUT" | grep app-report)" ;; esac +case "$OUT" in *"⏭ \`app-report\` — N/A: not owed (mode requirements)"*) ok "app-report N/A on a requirements-driven register" ;; *) bad "app-report not N/A: $(printf '%s' "$OUT" | grep app-report)" ;; esac if printf '%s\n' "$OUT" | grep 'still missing for this stage' | grep -q 'app-report'; then bad "plain words list app-report as missing"; else ok "plain words do not list a row this mode does not owe"; fi rm -rf "$WORK" diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index c29f47c9..0bf0efd6 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -12,8 +12,8 @@ # on disk does not clear it, the build-ready stamp does, an --adopt 5 does # H --adopt 5 under auto writes an ASSUMED consentBy: auto-mode Stage-4 row, and gate-check # lists it as a ✋ decision to confirm; without auto no row is written -# K Build type: poc → gate-check reads Stages 0-4, 6, 7 "not owed (mode: Build type: poc)"; -# artifact rows not listed for poc read "not owed (mode poc" +# K Build type: poc (its own axis, not an entry-mode token) → gate-check reads Stages 0-4, +# 6, 7 "not owed (mode: Build type: poc)" # G init-project.sh over a hand-written PROJECT.md appends Current stage, Decisions, Open # questions and Change log, says so, and keeps the hand-written lines # @@ -105,7 +105,6 @@ sed -i.bak 's/^Build type: full$/Build type: poc/' "$P/PROJECT.md" && rm -f "$P/ G="$("$GC" "$P" 2>&1)" n="$(printf '%s\n' "$G" | grep -cE '^Stage [0-4] .*not owed \(mode: Build type: poc\)|^Stage [67] .*not owed \(mode: Build type: poc\)')" [ "$n" = 7 ] && ok "K stages 0-4, 6, 7 not owed (mode) — 7 of 7" || bad "K stages 0-4, 6, 7 not owed (mode)" "$n of 7" -case "$G" in *"not owed (mode poc"*) ok "K artifact rows say not owed (mode poc)" ;; *) bad "K artifact rows say not owed (mode poc)" ;; esac echo "-- G: init over a hand-written PROJECT.md" Q="$WORK/hand"; mkdir -p "$Q"; ( cd "$Q" && git init -q . ) From 038c1cd73d0b1110b72e4562848bd668023a3ba4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:46:17 +0000 Subject: [PATCH 4/9] =?UTF-8?q?test(mode=20contract):=20drift=20guard=20?= =?UTF-8?q?=E2=80=94=20every=20modes-column=20token=20is=20one=20the=20rea?= =?UTF-8?q?der=20emits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- tests/wave2/test-mode-contract.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index 0bf0efd6..e1e471b0 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -14,6 +14,7 @@ # lists it as a ✋ decision to confirm; without auto no row is written # K Build type: poc (its own axis, not an entry-mode token) → gate-check reads Stages 0-4, # 6, 7 "not owed (mode: Build type: poc)" +# V every token in artifact-manifest.tsv col 6 / obligations.tsv col 10 is one the reader emits # G init-project.sh over a hand-written PROJECT.md appends Current stage, Decisions, Open # questions and Change log, says so, and keeps the hand-written lines # @@ -118,6 +119,25 @@ grep -q '^Requirements live in specs/\.$' "$Q/PROJECT.md" && ok "G hand-written MXTK_NO_GUIDE=1 HOME="$WORK/home" "$TOOLKIT/bin/init-project.sh" "$Q" 2>&1 | grep -q "Skip: PROJECT.md already exists" \ && ok "G a second init appends nothing" || bad "G a second init appends nothing" +echo "-- V: one vocabulary across both tables (drift guard)" +# Every token in artifact-manifest.tsv column 6 and obligations.tsv's modes column (column 10, when +# the table has one) must be a value the boundary reader _art_entry_mode can produce from a real +# register line — otherwise a row reads "not owed (mode)" for the very mode that owes it: a silent +# pass. The emitted set is computed, not listed, so a tokeniser change moves it too. +EMIT="$(bash -c '. "$1/bin/lib/entry-mode.sh"; . "$1/bin/lib/artifact-check.sh" + for m in migration requirements-driven greenfield "Change an existing app" a-la-carte; do + d="$(mktemp -d)"; printf "Entry mode: %s\n" "$m" > "$d/PROJECT.md"; _art_kv_load "$d/PROJECT.md" 2>/dev/null + _art_entry_mode "$d/PROJECT.md" 2>/dev/null; rm -rf "$d"; done' _ "$TOOLKIT" | sort -u | tr '\n' ' ')" +[ -n "$EMIT" ] && ok "V emitted set: $EMIT" || bad "V could not compute the emitted token set" +for spec in "bin/lib/artifact-manifest.tsv:6" "bin/lib/obligations.tsv:10"; do + f="$TOOLKIT/${spec%%:*}"; col="${spec##*:}"; [ -f "$f" ] || continue + hdr="$(grep -m1 -v '^#' "$f" | awk -F'\t' -v c="$col" '{print $c}')" + [ "$hdr" = modes ] || { echo " skip ${spec%%:*}: column $col is not 'modes' here"; continue; } + bad_t="$(grep -v '^#' "$f" | awk -F'\t' -v c="$col" 'NR>1 && NF>=c {n=split($c,a,","); for(i=1;i<=n;i++) print a[i]}' \ + | sort -u | while read -r t; do case " $EMIT " in *" $t "*) ;; *) printf '%s ' "$t" ;; esac; done)" + [ -z "$bad_t" ] && ok "V ${spec%%:*} modes tokens all emitted by the tokeniser" || bad "V ${spec%%:*} has tokens nothing emits" "$bad_t" +done + echo "" echo "== $PASS passed, $FAIL failed" [ "$FAIL" -eq 0 ] From cb7c0fa1f545bd1449cf0b75b4ae800a53059007 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 03:55:38 +0000 Subject: [PATCH 5/9] =?UTF-8?q?fix(plan=20rule):=20review=20fixes=20?= =?UTF-8?q?=E2=80=94=20aggregate=20stage-4=20waiver,=20ignore=20the=20stam?= =?UTF-8?q?p=20dir,=20rendered=20rules=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mxtk_pos_read honours "Waived stages: ..., 4 — reason" as gate-check does (was a false refusal on a project gate-check reads WAIVED at stage 4). - .mpr-snapshots/ is git-ignored before the refuse-once stamp is written, so "once per clone" cannot become once per repository; docs say plainly it is one refusal ever per clone. - skills/generated/rules-page.md re-rendered (bin/mdl-rules.sh --render) after the ui-preflight-pages.md STOP-row edit; CI was DRIFTED. - fixture: the status NEXT case accepts the intake-§1 needs-attention line that outranks the banner rule; aggregate-waiver and .gitignore cases. - _position.sh header: the shared tokeniser plus exec.sh's reader, not the only register reader. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- project-bin/_position.sh | 21 +++++++++++++++------ project-bin/exec.sh | 10 +++++++--- skills/conversion-runbook.md | 2 +- skills/generated/rules-page.md | 4 +++- tests/wave2/test-entry-mode-plan-rule.sh | 15 ++++++++++++++- 5 files changed, 40 insertions(+), 12 deletions(-) diff --git a/project-bin/_position.sh b/project-bin/_position.sh index 2f9e9e39..c1e35ff7 100755 --- a/project-bin/_position.sh +++ b/project-bin/_position.sh @@ -1,9 +1,10 @@ #!/usr/bin/env bash -# _position.sh — where a project says it is: the ONE reader of the register's position lines -# (Entry mode, Adopted at stage, Build type, Waived stage 4, the Current-stage readout) and the -# ONE tokeniser for "Entry mode:". Sourced by project-bin/exec.sh (installed as bin/_position.sh) -# and, through the shim bin/lib/entry-mode.sh, by bin/gate-check.sh, bin/status.sh and -# bin/lib/artifact-check.sh. +# _position.sh — the ONE shared tokeniser for "Entry mode:" (entry_mode_token), plus exec.sh's +# in-shell reader of the register's position lines (mxtk_pos_read: Entry mode, Adopted at stage, +# Build type, the Stage-4 waivers, the Current-stage readout). gate-check.sh and status.sh keep +# their own register readers and use only the tokeniser and the banner text from here. Sourced by +# project-bin/exec.sh (installed as bin/_position.sh) and, through the shim bin/lib/entry-mode.sh, +# by bin/gate-check.sh, bin/status.sh and bin/lib/artifact-check.sh. # # PURE BASH, no process starts: exec.sh runs this on every model write and its per-exec budget is # counted (tests/wave2/test-exec-process-budget.sh). Bash 3.2 safe (macOS): no ${v,,}, no @@ -74,7 +75,8 @@ _mxtk_emt() { # POS_ENTRY canonical token, or "" (none declared / not recognised) # POS_ADOPTED the "Adopted at stage:" stage (P|0-7), or "" # POS_BUILD "poc" when "Build type: poc", else "full" -# POS_WAIVED4 1 when a "Waived stage 4:" line carries a reason +# POS_WAIVED4 1 when a "Waived stage 4:" line carries a reason, or a "Waived stages:" line lists 4 +# before its dash with a reason after it (the two spellings gate-check.sh reads) # POS_READOUT the stage in gate-check.sh's "## Current stage" readout ("**Stage 5 — ..."), or "" mxtk_pos_read() { local root="$1" reg line key val in_c=0 in_cur=0 entry_raw="" ad="" bt="" _nc=0 @@ -99,6 +101,13 @@ mxtk_pos_read() { elif [ -z "$ad" ] && [[ "$key" == "adopted at stage" ]]; then ad="$val" elif [ -z "$bt" ] && [[ "$key" == "build type" ]]; then bt="$val" elif [[ "$key" == "waived stage 4" ]]; then POS_WAIVED4=1 + elif [[ "$key" == "waived stages" ]]; then + # The aggregate spelling gate-check.sh also honours ("Waived stages: 1, 2, 3, 4 — reason"): + # 4 must be listed BEFORE the dash, and a reason must follow it (no reason, no waiver). + local _wh="" _wr="" + case "$val" in *—*) _wh="${val%%—*}"; _wr="${val#*—}" ;; *–*) _wh="${val%%–*}"; _wr="${val#*–}" ;; + *" - "*) _wh="${val%% - *}"; _wr="${val#* - }" ;; esac + [[ ",${_wh//[[:blank:]]/}," == *",4,"* && -n "${_wr//[[:blank:]]/}" ]] && POS_WAIVED4=1 fi done < "$reg" fi diff --git a/project-bin/exec.sh b/project-bin/exec.sh index 77b96c2b..6c626021 100755 --- a/project-bin/exec.sh +++ b/project-bin/exec.sh @@ -773,8 +773,9 @@ take_score() { # gate-check's readout at Stage 5+, or architecture/build-plan.md plus a module brief (root # or apps//) — see mxtk_plan_evidence; # - the clearing commands are gate-check.sh --adopt/--waive and writing the plan, none of which -# goes through here (guard rule 7), and the refusal is ONCE per clone (.mpr-snapshots/ -# .plan-rule-refused): a re-run goes on, tagged "no plan" in every BUILD-LOG row; +# goes through here (guard rule 7), and the refusal is ONCE EVER per clone (.mpr-snapshots/ +# .plan-rule-refused, git-ignored before it is written): every later write goes on, tagged +# "no plan" in its BUILD-LOG row, and no second refusal ever comes on that clone; # - never refused: --patch (opaque repair; doctor.sh's recovery path), `Build type: poc`, # greenfield, change-an-existing-app, a-la-carte, and no declared mode at all. POS_NOTE="" @@ -794,12 +795,15 @@ if [ -f "$_XD/_position.sh" ]; then POS_NOTE="no plan (Entry mode $POS_ENTRY, before Stage 4)" else [ -d "$PROJECT_ROOT/.mpr-snapshots" ] || mkdir -p "$PROJECT_ROOT/.mpr-snapshots" + # Ignore the folder BEFORE the stamp lands in it: on a fresh repo snapshot-mpr.sh has not run + # yet, and a committed stamp would make "once per clone" once per repository. + mxtk_gitignore_ensure "$PROJECT_ROOT/.gitignore" ".mpr-snapshots" "/.mpr-snapshots/" || true if [ -n "${EPOCHSECONDS:-}" ]; then printf -v _pw '%(%Y-%m-%dT%H:%M:%S%z)T' -1; else _pw="now"; fi printf '%s %s\n' "$_pw" "$SCRIPT" > "$_PLAN_STAMP" result_line refused no skipped 1 echo "✗ Plan rule: Entry mode $POS_ENTRY, and Stage 4 has not passed or been adopted — no build plan, no module briefs. NOTHING was written." echo " Remedy: run stages 1-4 (conversion-runbook.md), or record why not: $_GC $PROJECT_ROOT --adopt 5 --reason \"...\" (it shows in the register)." - echo " Refused once only: a re-run goes on, and its BUILD-LOG row says \"no plan\"." + echo " This is the one refusal this clone will ever get: every later write goes on, its BUILD-LOG row tagged \"no plan\"." log_build "🚫 blocked" "plan rule: Entry mode $POS_ENTRY, no build plan/briefs and Stage 4 not adopted — refused once, nothing written" exit 1 fi diff --git a/skills/conversion-runbook.md b/skills/conversion-runbook.md index 5d9ed321..e059dcb5 100644 --- a/skills/conversion-runbook.md +++ b/skills/conversion-runbook.md @@ -75,7 +75,7 @@ The stages are the same for everyone; what differs is where you enter and which (Failure: a project with full specs + analyzable source was classified greenfield "because there's nothing to migrate" and proposed skipping 0–4 — `process/baseline-incident-history.md` §R1.) -**Declared, or the toolkit says so.** With no `Entry mode:` and no `Adopted at stage:` line, `bin/status.sh`, `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner: *No entry mode declared: the toolkit treats this project as Stage P, not started.* **Plan before build:** in `migration` or `requirements-driven`, the first `exec.sh` model write before Stage 4 has passed or been adopted is refused once — run stages 1–4, or `bin/gate-check.sh

--adopt 5 --reason "..."` (a register line). A build plan plus a module brief, `Waived stage 4:` or adoption at 5+ clears it; never refused: `a-la-carte`, `greenfield`, `Build type: poc`, change an existing app, `--patch`. *Failure (two field runs, 2026-11): a full frozen spec plus clickable prototypes, "requirements-driven" in the brief, and ~78 pages built with no plan or wireframe target, missing whole sections the prototypes showed; nothing spoke, because nothing was declared.* +**Declared, or the toolkit says so.** With no `Entry mode:` and no `Adopted at stage:` line, `bin/status.sh`, `bin/gate-check.sh`'s summary and every `bin/exec.sh` run print one banner: *No entry mode declared: the toolkit treats this project as Stage P, not started.* **Plan before build:** in `migration` or `requirements-driven`, the first `exec.sh` model write before Stage 4 has passed or been adopted is refused — once ever per clone, every later write goes on tagged "no plan" — run stages 1–4, or `bin/gate-check.sh

--adopt 5 --reason "..."` (a register line). A build plan plus a module brief, `Waived stage 4:` or adoption at 5+ clears it; never refused: `a-la-carte`, `greenfield`, `Build type: poc`, change an existing app, `--patch`. *Failure (two field runs, 2026-11): a full frozen spec plus clickable prototypes, "requirements-driven" in the brief, and ~78 pages built with no plan or wireframe target, missing whole sections the prototypes showed; nothing spoke, because nothing was declared.* | You're starting from… | Mode | Stages that run | What changes | |---|---|---|---| diff --git a/skills/generated/rules-page.md b/skills/generated/rules-page.md index 21401d69..e91217eb 100644 --- a/skills/generated/rules-page.md +++ b/skills/generated/rules-page.md @@ -173,7 +173,9 @@ Read the full wireframe file and extract: | Conditional visibility | Callout notes describing "shown only when…" or "edit mode vs. view mode" states | | Navigation entry point | `.origin` annotation or a nav-link callout stating what opens this page | -**If no wireframe exists:** ⛔ STOP. Report to the main session that the wireframe is missing and that the page script cannot be drafted until one exists. Do not proceed, do not guess layout or bindings, do not ask whether to proceed without one — the wireframe is not optional. See `design-artifacts.md` to produce one first. +**A supplied prototype mapped in `design/wireframes/PAGE-MAP.tsv` IS the wireframe** (`design-artifacts.md` Step 2a): read the mapped file and extract the same table; where it carries no binding annotations, take bindings from the BRD and the module brief. + +**If no wireframe exists** — no `design/wireframes/.html`, and no `PAGE-MAP.tsv` row naming a file or route on disk: ⛔ STOP. Report to the main session that the wireframe is missing and that the page script cannot be drafted until one exists. Do not proceed, do not guess layout or bindings, do not ask whether to proceed without one — the wireframe is not optional. See `design-artifacts.md` to produce one first. **If an annotated `.md` companion exists** (e.g. `item-management.md` alongside `item-management.html`): read it — it often contains the binding table, widget-type decisions, and diff --git a/tests/wave2/test-entry-mode-plan-rule.sh b/tests/wave2/test-entry-mode-plan-rule.sh index 62e4594b..1b30abba 100755 --- a/tests/wave2/test-entry-mode-plan-rule.sh +++ b/tests/wave2/test-entry-mode-plan-rule.sh @@ -117,6 +117,16 @@ echo "-- single tree only" mkproj single "Entry mode: requirements-driven" mkdir -p "$P/architecture"; printf '# Build plan\n\n## Module brief — Orders\n\nScreens: list, detail.\n' > "$P/architecture/build-plan.md" run; passed && ok "C inline '## Module brief' heading → no refusal" || bad "C inline brief heading" "calls=$CALLS_N" +# the aggregate waiver gate-check honours clears it too; one without a reason does not +mkproj single "Entry mode: requirements-driven" +printf 'Waived stages: 1, 2, 3, 4 — analysis and plan were done in the client workshop\n' >> "$P/PROJECT.md" +run; passed && ok "C 'Waived stages: 1, 2, 3, 4 — reason' → no refusal" || bad "C aggregate waiver with a reason" "calls=$CALLS_N" +mkproj single "Entry mode: requirements-driven" +printf 'Waived stages: 1, 2, 3\n' >> "$P/PROJECT.md" +printf 'docs/\n.claude/\n' > "$P/.gitignore" # as a fresh repo has it: .mpr-snapshots/ not yet ignored +run; refused && ok "R 'Waived stages' without 4 or a reason still refuses" || bad "R aggregate waiver without 4" "calls=$CALLS_N" +# the stamp folder is git-ignored before the stamp is written +grep -qx '/.mpr-snapshots/' "$P/.gitignore" && ok "R .mpr-snapshots/ ignored before the stamp" || bad "R .mpr-snapshots/ ignored before the stamp" # a build plan without any brief is not a plan the rule accepts mkproj single "Entry mode: requirements-driven" mkdir -p "$P/architecture"; printf '# Build plan\n' > "$P/architecture/build-plan.md" @@ -152,7 +162,10 @@ GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 2>&1)" case "$GC" in *"Summary:"*"No entry mode declared"*) ok "B gate-check summary carries the banner" ;; *) bad "B gate-check summary carries the banner" ;; esac ST="$("$TOOLKIT/bin/status.sh" "$P" --brief 2>&1)" case "$ST" in *"No entry mode declared"*) ok "B status --brief carries the banner" ;; *) bad "B status --brief carries the banner" ;; esac -case "$ST" in *"NEXT declare the entry mode"*) ok "B status NEXT says declare the mode" ;; *) bad "B status NEXT says declare the mode" "$(printf '%s\n' "$ST" | grep NEXT)" ;; esac +# On a fresh scaffold gate-check already flags intake §1 "Entry mode", and that needs-attention rule +# outranks the banner rule in status.sh's NEXT order; either line names the entry mode. +case "$ST" in *"NEXT declare the entry mode"*|*"NEXT fix what gate-check flags"*"Entry mode"*) ok "B status NEXT names the entry mode" ;; + *) bad "B status NEXT names the entry mode" "$(printf '%s\n' "$ST" | grep NEXT)" ;; esac mkproj single "Entry mode: requirements-driven" GC="$("$TOOLKIT/bin/gate-check.sh" "$P" 2>&1)" case "$GC" in *"No entry mode declared"*) bad "gate-check silent once declared" ;; *) ok "gate-check silent once declared" ;; esac From 1d68ffd32099bfea43ee02e8f149b8c4a1d407d8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 05:02:58 +0000 Subject: [PATCH 6/9] fix(gate-check, status): banner is warn-only even without bin/lib; CWD line stays first CI (wave2, run 44013599260): test-bug06-freshness copies gate-check.sh alone into a scratch toolkit, so the shim's banner text was never defined and `set -u` aborted the summary with exit 1 (reproduced: master 0, cb7c0fa 1, this 0). The banner is now an `if` with a defaulted variable. status.sh guards the reader the same way and prints the banner after the CWD line (test-status-session-cwd A: the CWD line must be first). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- bin/gate-check.sh | 7 ++++++- bin/status.sh | 9 ++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/gate-check.sh b/bin/gate-check.sh index 22db54a3..2a185a6e 100755 --- a/bin/gate-check.sh +++ b/bin/gate-check.sh @@ -4102,7 +4102,12 @@ printf "Summary: %d passed · %d not started · %d waived · %d need attention "$N_PASS" "$N_PENDING" "$N_WAIVED" "$N_FAIL" "$N_MANUAL" # Declared position (project-bin/_position.sh; conversion-runbook.md → Entry Modes). The field runs # that built with no plan (2026-11) had neither line, and this summary read like any other. -[ -z "$ENTRY_MODE" ] && [ -z "$ADOPTED_AT" ] && printf '⚠ %s\n' "$MXTK_POS_BANNER" +# Warn-only, and never the script's last status: an `if`, not an `&&` chain, and the text read with +# a default — a scratch copy of this script without bin/lib/ (tests/wave2/test-bug06-freshness.sh) +# has no banner text, and an unbound variable under `set -u` aborted the run with exit 1. +if [ -z "$ENTRY_MODE" ] && [ -z "$ADOPTED_AT" ] && [ -n "${MXTK_POS_BANNER:-}" ]; then + printf '⚠ %s\n' "$MXTK_POS_BANNER" +fi # The stage counts above are about STAGES. They say nothing about the per-module passes and the # per-stage artifacts checked further up, and for a long time nothing down here did either — so diff --git a/bin/status.sh b/bin/status.sh index 276d79f7..34cf1352 100755 --- a/bin/status.sh +++ b/bin/status.sh @@ -75,7 +75,10 @@ ENTRY="$(entry_mode_token "$ENTRY_RAW" 2>/dev/null)" # Declared position (project-bin/_position.sh, the reader exec.sh and gate-check.sh share): no # Entry mode (register or intake) and no adoption line → the one banner, first line of either view. # Field runs (2026-11) built ~78 pages with neither line, and nothing here said so. -mxtk_pos_read "$PROJECT_DIR"; POS_BANNER=""; mxtk_pos_undeclared && POS_BANNER="$MXTK_POS_BANNER" +POS_ENTRY=""; POS_BANNER="" +if declare -F mxtk_pos_read >/dev/null; then + mxtk_pos_read "$PROJECT_DIR"; mxtk_pos_undeclared && POS_BANNER="${MXTK_POS_BANNER:-}" +fi ADOPTED="$(grep -m1 -oE '^Adopted at stage: *[0-9P]+' "$REG" | sed 's/^Adopted at stage: *//')" SKELETON="$(grep -m1 -oE '^Skeleton proven [0-9-]+' "$REG" | sed 's/^Skeleton proven //')" UNSYNCED="$(grep -c 'UNSYNCED' "$REG" 2>/dev/null)"; UNSYNCED="${UNSYNCED:-0}" @@ -384,8 +387,8 @@ for _w in "$STAGE_STALE" "${APPROVED_OVER:+APPROVED OVER A FAILING GATE: $APPROV [ -n "$_w" ] && WATCH="${WATCH:+$WATCH · }$_w" done if [ "$BRIEF" = 1 ]; then - [ -n "$POS_BANNER" ] && echo "⚠ $POS_BANNER" [ -n "$CWD_NOTE" ] && echo "CWD $CWD_NOTE" + [ -n "$POS_BANNER" ] && echo "⚠ $POS_BANNER" echo "WHERE $NAME · $STAGE_LINE${ENTRY:+ · $ENTRY}${ADOPTED:+ · joined at $ADOPTED}" [ -n "$ROUND_LINE" ] && echo "ROUND $ROUND_LINE" echo "STATE scripts $N_SCRIPTS written / $N_PASS gate-pass / $N_DONE done- · modules opened $MOD_OPENED${SKELETON:+ · skeleton $SKELETON} · UNSYNCED $UNSYNCED · open questions $OPEN_Q${MANUAL:+ · $MANUAL}${APPMAP:+ · $APPMAP}" @@ -396,8 +399,8 @@ if [ "$BRIEF" = 1 ]; then fi printf '\n%s — %s%s%s\n' "$NAME" "$STAGE_LINE" "${ENTRY:+ · $ENTRY}" "${ADOPTED:+ · joined at stage $ADOPTED}" printf '%s\n\n' "$TK" -[ -n "$POS_BANNER" ] && printf '⚠ %s\n\n' "$POS_BANNER" [ -n "$CWD_NOTE" ] && printf 'CWD %s\n' "$CWD_NOTE" +[ -n "$POS_BANNER" ] && printf '⚠ %s\n\n' "$POS_BANNER" [ -n "$ROUND_LINE" ] && printf 'ROUND %s\n' "$ROUND_LINE" printf 'DONE scripts: %s written, %s gate-pass, %s done- · modules opened: %s%s\n' "$N_SCRIPTS" "$N_PASS" "$N_DONE" "$MOD_OPENED" "${SKELETON:+ · skeleton proven $SKELETON}" printf 'OVERDUE %s · %s · %s · UNSYNCED markers: %s · open questions: %s\n' "$DOCTOR" "$LINT" "${COH:-coherence: cadence script not installed}" "$UNSYNCED" "$OPEN_Q" From 9d566a235abe58f383de46083a84c57f19beddca Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 05:44:10 +0000 Subject: [PATCH 7/9] fix(tests): POSIX leading paren on the drift guard's case inside $(...) (check-portability rule 3, bash 3.2) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- tests/wave2/test-mode-contract.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index e1e471b0..9e65e19c 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -134,7 +134,7 @@ for spec in "bin/lib/artifact-manifest.tsv:6" "bin/lib/obligations.tsv:10"; do hdr="$(grep -m1 -v '^#' "$f" | awk -F'\t' -v c="$col" '{print $c}')" [ "$hdr" = modes ] || { echo " skip ${spec%%:*}: column $col is not 'modes' here"; continue; } bad_t="$(grep -v '^#' "$f" | awk -F'\t' -v c="$col" 'NR>1 && NF>=c {n=split($c,a,","); for(i=1;i<=n;i++) print a[i]}' \ - | sort -u | while read -r t; do case " $EMIT " in *" $t "*) ;; *) printf '%s ' "$t" ;; esac; done)" + | sort -u | while read -r t; do case " $EMIT " in (*" $t "*) ;; (*) printf '%s ' "$t" ;; esac; done)" [ -z "$bad_t" ] && ok "V ${spec%%:*} modes tokens all emitted by the tokeniser" || bad "V ${spec%%:*} has tokens nothing emits" "$bad_t" done From b148b8d5830ccead3705c37262aaabc421efafee Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 05:59:59 +0000 Subject: [PATCH 8/9] =?UTF-8?q?fix(mode=20contract):=20review=20fixes=20?= =?UTF-8?q?=E2=80=94=20fit-gap=20wording,=20build-ready=20stamp=20ignored,?= =?UTF-8?q?=20SIGPIPE,=20refusal=20cost?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gate-check fit-gap line: the poc branch runs before stage_waiver(3), and a mode reason "not owed (mode: m) — why" prints as "m entry mode — why" (was "not owed — not owed (mode: ...)"; test-fitgap-review F11a/F15a). - build-ready PASS git-ignores .mpr-snapshots/ before writing its record, as exec.sh does for its stamp. - test-mode-contract G: second init captured to a file, not piped into grep -q (SIGPIPE under pipefail). - auto-mode refusal says the cost for a project past Stage 5: one build-ready pass per clone. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- bin/gate-check.sh | 16 ++++++++++++++-- project-bin/exec.sh | 1 + tests/wave2/test-mode-contract.sh | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/bin/gate-check.sh b/bin/gate-check.sh index d4a2f0d3..278cf576 100755 --- a/bin/gate-check.sh +++ b/bin/gate-check.sh @@ -2606,10 +2606,16 @@ check_build_ready() { echo " ✓ Fit-gap: not owed — project joined the toolkit at stage $ADOPTED_AT" elif fg_w="$(artifact_waived fit-gap)"; then echo " ✓ Fit-gap: WAIVED — $fg_w" - elif [ -z "$fg_path" ] && fg_w="$(stage_waiver 3)" && [ "${fg_w%%|*}" != "noreason" ]; then - echo " ✓ Fit-gap: not owed — ${fg_w#*|}" elif [ -z "$fg_path" ] && case "$(printf '%s' "$bt_raw" | tr '[:upper:]' '[:lower:]')" in poc|poc[!a-z]*) true ;; *) false ;; esac; then + # Before stage_waiver: that now also excuses Stage 3 for poc, in its own words. echo " ✓ Fit-gap: not owed — Build type: poc (skills/poc-build.md) and no fit-gap exists" + elif [ -z "$fg_path" ] && fg_w="$(stage_waiver 3)" && [ "${fg_w%%|*}" != "noreason" ]; then + # A mode reason reads "not owed (mode: ) — "; this line already says "not owed". + fg_r="${fg_w#*|}" + case "$fg_r" in "not owed (mode: "*) + fg_m="${fg_r#not owed (mode: }"; fg_r="${fg_m%%)*} entry mode ${fg_m#*) }" ;; + esac + echo " ✓ Fit-gap: not owed — $fg_r" else if ! type mxtk_fitgap_review >/dev/null 2>&1; then # shellcheck source=lib/marketplace-check.sh @@ -4684,6 +4690,12 @@ if [ -n "$REQUESTED_STAGE" ]; then # "Declared position + plan rule"): exec cannot afford a gate-check per write. Sticky on # purpose — a later FAIL does not remove it, so a wiring repair is never blocked by the # rule it is repairing (guard rule 7). Local, gitignored, like the exec lock beside it. + # Ignored BEFORE the stamp lands, as exec.sh does for its own stamp (a committed stamp would + # clear the auto-mode plan rule in every clone of the repository). + if [ -r "$TOOLKIT_DIR/bin/lib/gitignore-ensure.sh" ]; then + . "$TOOLKIT_DIR/bin/lib/gitignore-ensure.sh" + mxtk_gitignore_ensure "$PROJECT_DIR/.gitignore" ".mpr-snapshots" "/.mpr-snapshots/" || true + fi mkdir -p "$PROJECT_DIR/.mpr-snapshots" 2>/dev/null \ && printf '%s build-ready PASS (bin/gate-check.sh)\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" > "$PROJECT_DIR/.mpr-snapshots/.build-ready-pass" 2>/dev/null || true exit 0 diff --git a/project-bin/exec.sh b/project-bin/exec.sh index e7efcb03..99de67d8 100755 --- a/project-bin/exec.sh +++ b/project-bin/exec.sh @@ -800,6 +800,7 @@ if [ -f "$_XD/_position.sh" ]; then result_line refused no skipped 1 echo "✗ Plan rule (Interview mode: auto): Entry mode $POS_ENTRY, and the pre-build steps are not done — $_GC $PROJECT_ROOT build-ready has not passed. NOTHING was written." echo " Remedy: run stages 1-4, then $_GC $PROJECT_ROOT build-ready; or $_GC $PROJECT_ROOT --adopt 5 --reason \"...\" — under auto that is a ✋ human-pending decision, and Stage 6 FAILs until a person confirms it." + echo " Already building past Stage 5? One build-ready pass clears it: its record is kept per clone (.mpr-snapshots/), so each fresh clone runs it once." log_build "🚫 blocked" "plan rule (auto): Entry mode $POS_ENTRY, build-ready not passed and no adoption — nothing written" exit 1 elif [ "$PATCH_MODE" != "1" ] && [ "$POS_BUILD" != poc ] && [ "$POS_AUTO" != 1 ] \ diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index 9e65e19c..13098c21 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -116,7 +116,10 @@ case "$(cat "$WORK/init.out")" in *"PROJECT.md already existed WITHOUT the decis for h in "## Current stage" "## Decisions" "## Open questions" "## Change log"; do grep -q "^$h" "$Q/PROJECT.md" && ok "G $h present" || bad "G $h present"; done grep -q '^Requirements live in specs/\.$' "$Q/PROJECT.md" && ok "G hand-written lines kept" || bad "G hand-written lines kept" -MXTK_NO_GUIDE=1 HOME="$WORK/home" "$TOOLKIT/bin/init-project.sh" "$Q" 2>&1 | grep -q "Skip: PROJECT.md already exists" \ +# Captured to a file, not piped into grep -q: under pipefail, grep -q closing the pipe early +# SIGPIPEs init-project.sh and the pipeline reads as a failure. +MXTK_NO_GUIDE=1 HOME="$WORK/home" "$TOOLKIT/bin/init-project.sh" "$Q" > "$WORK/init2.out" 2>&1 +grep -q "Skip: PROJECT.md already exists" "$WORK/init2.out" \ && ok "G a second init appends nothing" || bad "G a second init appends nothing" echo "-- V: one vocabulary across both tables (drift guard)" From a918bd2926d88180633feda19049b916c81e7d7b Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 07:06:12 +0000 Subject: [PATCH 9/9] fix(tests): the Bug filing opt-in lives in bin/lib/register-skeleton.sh now (test-file-bugs.sh:472) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01HXpQSifRwo7EWWDP1hPps8 --- tests/wave2/test-file-bugs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/wave2/test-file-bugs.sh b/tests/wave2/test-file-bugs.sh index 3e347284..626c8113 100755 --- a/tests/wave2/test-file-bugs.sh +++ b/tests/wave2/test-file-bugs.sh @@ -469,7 +469,7 @@ sys.exit(not (pats and m("bin/file-bugs.sh --all") and m("bin/file-bugs.sh --fil and m("bin/file-bugs.sh --import b.md") and m("bin/file-bugs.sh --import b.md --dry-run") and m("bin/lib/file-bugs.py --import b.md") and not m("bin/file-bugs.sh --bundle"))) PYX' -chk "init-project ships the opt-in commented out" 'grep -q "