@cratis/pi 7.40.0 → 7.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/package/corpus/harnesses/copilot/instructions/local-work-artifacts.instructions.md +12 -6
  2. package/package/corpus/harnesses/pi/extensions/cratis-hooks/index.ts +35 -2
  3. package/package/corpus/hooks/README.md +24 -0
  4. package/package/corpus/hooks/scripts/cratis-cleanup-worktrees.sh +184 -0
  5. package/package/corpus/hooks/settings.template.json +21 -0
  6. package/package/corpus/product-sync.json +10 -10
  7. package/package/corpus/prompts/ship-changes.prompt.md +15 -0
  8. package/package/corpus/rules/local-work-artifacts.md +12 -6
  9. package/package/corpus/skills/cratis-arc-command/references/generated-values.md +3 -2
  10. package/package/corpus/skills/cratis-chronicle-reactor/SKILL.md +1 -1
  11. package/package/corpus/skills/cratis-screenplay-automations-and-translations/SKILL.md +3 -3
  12. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/audit-format.md +2 -2
  13. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/automation-patterns.md +1 -1
  14. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/provenance.md +2 -2
  15. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/public-events-and-direction.md +1 -1
  16. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/realization-and-gap-fill.md +5 -4
  17. package/package/corpus/skills/cratis-screenplay-automations-and-translations/references/todo-list-example.md +1 -1
  18. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/SKILL.md +5 -5
  19. package/package/corpus/skills/cratis-screenplay-captures-and-reactions/references/invocation-identity.md +4 -2
  20. package/package/corpus/skills/cratis-screenplay-command-surface/SKILL.md +10 -8
  21. package/package/corpus/skills/cratis-screenplay-command-surface/references/compliance.md +7 -6
  22. package/package/corpus/skills/cratis-screenplay-command-surface/references/enum-numbers.md +4 -4
  23. package/package/corpus/skills/cratis-screenplay-command-surface/references/generated-values-and-responses.md +137 -50
  24. package/package/corpus/skills/cratis-screenplay-command-surface/verification.json +12 -7
  25. package/package/corpus/skills/cratis-screenplay-event-modeling/SKILL.md +7 -7
  26. package/package/corpus/skills/cratis-screenplay-event-modeling/references/nine-steps.md +1 -1
  27. package/package/corpus/skills/cratis-screenplay-event-modeling/references/parsed-not-runnable.md +4 -4
  28. package/package/corpus/skills/cratis-screenplay-model-authoring/SKILL.md +1 -1
  29. package/package/corpus/skills/cratis-screenplay-model-authoring/references/language-reference.md +6 -4
  30. package/package/corpus/skills/cratis-screenplay-model-authoring/references/mcp-tools.md +3 -1
  31. package/package/corpus/skills/cratis-screenplay-model-review/references/anti-patterns.md +1 -1
  32. package/package/corpus/skills/cratis-screenplay-model-review/references/checklist.md +1 -1
  33. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/SKILL.md +2 -2
  34. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/phases.md +1 -1
  35. package/package/corpus/skills/cratis-screenplay-modeling-lifecycle/references/vocabulary-map.md +1 -1
  36. package/package/corpus/skills/cratis-screenplay-read-surface/SKILL.md +1 -1
  37. package/package/corpus/skills/cratis-screenplay-read-surface/references/equality-filters.md +15 -10
  38. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/SKILL.md +11 -11
  39. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/delivery-protocol.md +1 -1
  40. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/gap-fill-handoff.md +4 -4
  41. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/references/renderability-gate.md +5 -5
  42. package/package/corpus/skills/cratis-screenplay-render-and-gap-fill/verification.json +1 -1
  43. package/package/corpus/skills/cratis-screenplay-scenario-coverage/references/spec-forms-by-mode.md +6 -5
  44. package/package/corpus/skills/cratis-screenplay-slice-design/references/field-lineage.md +1 -1
  45. package/package/corpus/skills/cratis-screenplay-specifications/references/generated-fixtures.md +10 -3
  46. package/package/corpus/skills/cratis-screenplay-specifications/references/reactions-and-cascades.md +5 -5
  47. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/SKILL.md +4 -4
  48. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/boundaries.md +1 -1
  49. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/references/evolution.md +2 -2
  50. package/package/corpus/skills/cratis-screenplay-streams-and-consistency/verification.json +1 -1
  51. package/package/corpus/skills/cratis-screenplay-toolchain/SKILL.md +17 -13
  52. package/package/corpus/skills/cratis-screenplay-toolchain/references/cheat-sheet-example.md +2 -2
  53. package/package/corpus/skills/cratis-screenplay-toolchain/references/diagnostics.md +6 -3
  54. package/package/corpus/skills/cratis-screenplay-toolchain/references/doc-contradictions.md +2 -2
  55. package/package/corpus/skills/cratis-screenplay-toolchain/references/executable-subset.md +26 -21
  56. package/package/corpus/skills/cratis-screenplay-toolchain/references/generation-strategies-example.md +43 -0
  57. package/package/corpus/skills/cratis-screenplay-toolchain/references/production-routes-and-filters.md +5 -2
  58. package/package/corpus/skills/cratis-screenplay-toolchain/references/renderable-subset.md +32 -32
  59. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.json +1499 -46
  60. package/package/corpus/skills/cratis-screenplay-toolchain/references/screenplay-contract.version +1 -1
  61. package/package/corpus/skills/cratis-screenplay-toolchain/references/sources-and-streams.md +2 -2
  62. package/package/corpus/skills/cratis-screenplay-toolchain/references/traps.md +3 -3
  63. package/package/corpus/skills/cratis-screenplay-toolchain/references/verdicts.md +2 -2
  64. package/package/corpus/skills/cratis-screenplay-toolchain/references/versions.md +50 -38
  65. package/package/corpus/skills/cratis-screenplay-toolchain/verification.json +8 -6
  66. package/package/corpus/skills/cratis-screenplay-ui-composition/SKILL.md +5 -4
  67. package/package/corpus/skills/cratis-screenplay-ui-composition/references/response-continuations.md +109 -0
  68. package/package/corpus/skills/cratis-screenplay-ui-composition/references/worked-flow.md +1 -1
  69. package/package/corpus/skills/cratis-screenplay-ui-composition/verification.json +5 -0
  70. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/SKILL.md +17 -18
  71. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/admission.md +47 -35
  72. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/rendered-application.md +7 -7
  73. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/sandbox-and-specrunner.md +20 -8
  74. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/references/scene-runtime.md +1 -1
  75. package/package/corpus/skills/cratis-stage-rendering-and-sandbox/verification.json +4 -1
  76. package/package.json +1 -1
@@ -38,12 +38,18 @@ dumps, and similar coordination files. These are **work records, not documentati
38
38
  - **A worktree is a work record too.** Create it outside the repository tree, for
39
39
  example in a sibling `../.worktrees/` directory. A nested worktree inherits the
40
40
  parent's `.globalconfig` alongside its own, causing .NET's `MultipleGlobalAnalyzerKeys`
41
- errors or silently changing analyzer severities. Remove the worktree you created for
42
- a task once its branch is merged to the default branch — pushed is not merged. Do it
43
- from the parent checkout, after `git status --ignored` in the worktree, because a
44
- nested `.ai-work/`, `.env` files and local databases are ignored and are deleted with it.
45
- If the branch must outlive the task unmerged, leave the worktree and say so in the
46
- handoff. Never `--force` a removal; a refusal means look, not push harder.
41
+ errors or silently changing analyzer severities. **Delivered work is cleaned up by
42
+ `.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`, not by memory:** run it from the
43
+ main checkout when a pull request merges or you finish a task (hooks also run it after
44
+ `gh pr merge` and at session start where the harness supports them, and **ship-changes**
45
+ ends with it). It removes a worktree and its branch only on evidence the work reached the
46
+ default branch — pushed is not merged — and never forces; ignored files such as a nested
47
+ `.ai-work/`, `.env` files and local databases are deleted with it, so move anything you
48
+ still need out first. Do not hand-remove worktrees or `git branch -D` a delivered branch
49
+ when the script can; and `gh pr merge --delete-branch` from inside a worktree leaves the
50
+ worktree and branch behind, which is why the script exists. If the branch must outlive the
51
+ task unmerged, leave the worktree and say so in the handoff. Never `--force` a removal; a
52
+ refusal means look, not push harder.
47
53
  - **A decision log is not a work record.** A decision — a durable choice with a
48
54
  decider and a date — is documentation: it lives in **`decisions/`** (or the
49
55
  repository's documented decisions folder) and is reviewed like any other
@@ -10,6 +10,8 @@
10
10
  * Claude PreToolUse (Bash) → Pi `tool_call` → cratis-guard-store-mutations.sh (exit 2 = block)
11
11
  * Claude PreToolUse (Bash) → Pi `tool_call` → cratis-guard-pr-body.sh (exit 2 = block)
12
12
  * Claude PostToolUse (Write|Edit) → Pi `tool_result` → cratis-pattern-scan.sh (advisory context)
13
+ * Claude PostToolUse (Bash) → Pi `tool_result` → cratis-cleanup-worktrees.sh --hook (removes delivered worktrees/branches)
14
+ * Claude SessionStart → Pi `session_start` → cratis-cleanup-worktrees.sh --hook (sweeps orphans left by any earlier session)
13
15
  * Explicit Pi `cratis_quality_gate` tool → cratis-quality-gate.sh (exit 2 = failed)
14
16
  *
15
17
  * The quality gate is the one deliberate difference from Claude. It builds and tests the repository, which can
@@ -80,11 +82,11 @@ interface ScriptRun {
80
82
  * writes it exists to refuse. Callers decide what to do with `failed`; this function only reports
81
83
  * it honestly.
82
84
  */
83
- function runScript(script: string, stdinJson: string, cwd: string, signal?: AbortSignal): Promise<ScriptRun> {
85
+ function runScript(script: string, stdinJson: string, cwd: string, signal?: AbortSignal, args: string[] = []): Promise<ScriptRun> {
84
86
  return new Promise<ScriptRun>((resolve) => {
85
87
  let proc: ReturnType<typeof spawn>;
86
88
  try {
87
- proc = spawn("bash", [script], { cwd, stdio: ["pipe", "pipe", "pipe"] });
89
+ proc = spawn("bash", [script, ...args], { cwd, stdio: ["pipe", "pipe", "pipe"] });
88
90
  } catch (error) {
89
91
  resolve({ code: 127, stdout: "", stderr: String(error), failed: true });
90
92
  return;
@@ -187,6 +189,7 @@ export default function (pi: ExtensionAPI) {
187
189
  const guardPrBody = path.join(scriptsDir, "cratis-guard-pr-body.sh");
188
190
  const patternScan = path.join(scriptsDir, "cratis-pattern-scan.sh");
189
191
  const qualityGate = path.join(scriptsDir, "cratis-quality-gate.sh");
192
+ const cleanupWorktrees = path.join(scriptsDir, "cratis-cleanup-worktrees.sh");
190
193
 
191
194
  // The explicit gate owns its subprocesses; shutdown also cancels a still-running tool.
192
195
  const activeGateRuns = new Map<AbortController, Promise<void>>();
@@ -230,8 +233,38 @@ export default function (pi: ExtensionAPI) {
230
233
  return runBlockingGuard(guardWrites, "cratis-guard-writes", "write", payload, ctx, "write guards");
231
234
  });
232
235
 
236
+ // ── Cleanup of delivered worktrees and branches ──
237
+ // The script decides on evidence that the work reached the default branch and only then removes anything; this
238
+ // bridge just fires it at the same moments Claude does: after a delivering command, and when a session starts.
239
+ // A failure here must never fail the tool call that already succeeded, so it is reported, not thrown.
240
+ async function sweepDelivered(hookEvent: "PostToolUse" | "SessionStart", command: string | undefined, cwd: string, signal?: AbortSignal): Promise<string> {
241
+ if (!isInstalled(cleanupWorktrees)) return "";
242
+ const payload = JSON.stringify({ hook_event_name: hookEvent, cwd, tool_input: command ? { command } : undefined });
243
+ const run = await runScript(cleanupWorktrees, payload, cwd, signal, ["--hook"]);
244
+ if (run.failed) return "cratis-cleanup-worktrees is installed but could not be run, so delivered worktrees were not cleaned up.";
245
+ try {
246
+ return JSON.parse(run.stdout)?.hookSpecificOutput?.additionalContext?.trim() ?? run.stderr.trim();
247
+ } catch {
248
+ return run.stderr.trim();
249
+ }
250
+ }
251
+ pi.on("session_start", async (_event, ctx) => {
252
+ const message = await sweepDelivered("SessionStart", undefined, ctx.cwd);
253
+ if (message) pi.sendMessage({ customType: "cratis-cleanup-worktrees", content: message, display: true });
254
+ });
255
+ async function sweepAfterBash(event: any, ctx: ExtensionContext) {
256
+ if (event.isError) return;
257
+ const command = event.input?.command;
258
+ if (typeof command !== "string") return;
259
+ const message = await sweepDelivered("PostToolUse", command, ctx.cwd, ctx.signal);
260
+ if (!message) return;
261
+ const existing = Array.isArray(event.content) ? event.content : [];
262
+ return { content: [...existing, { type: "text", text: `\n\n[cratis-hooks]\n${message}` }] };
263
+ }
264
+
233
265
  // ── PostToolUse → deterministic pattern scan (advisory; injects reminders the model sees) ──
234
266
  pi.on("tool_result", async (event, ctx) => {
267
+ if (event.toolName === "bash") return sweepAfterBash(event, ctx);
235
268
  if (event.toolName !== "write" && event.toolName !== "edit") return;
236
269
  if (event.isError) return;
237
270
  const { filePath } = writeTarget(event.toolName, (event as any).input);
@@ -12,6 +12,7 @@ Three layers:
12
12
  | Hard block | `PreToolUse` on a write | `scripts/cratis-guard-writes.sh` | zero | exits **2** — the write does not happen |
13
13
  | Hard block | `PreToolUse` on `Bash` | `scripts/cratis-guard-store-mutations.sh` | zero; parses only commands that mention `cratis` | exits **2** — the store-changing `cratis chronicle` command does not run |
14
14
  | Hard block | `PreToolUse` on `Bash` | `scripts/cratis-guard-pr-body.sh` | fetches shared rules only for `gh pr create/edit` | exits **2** for inline bodies, invalid notes or conflicting release labels; warns and allows when offline with no cache |
15
+ | Cleanup of delivered work | `PostToolUse` on `Bash` (`gh pr merge`, `git pull/merge/worktree`) and `SessionStart` (Pi: `tool_result` and `session_start`) | `scripts/cratis-cleanup-worktrees.sh --hook` | zero when the command is unrelated | never blocks; removes delivered worktrees and branches, reports what it kept |
15
16
  | Quality gate (Claude) | `Stop` | `scripts/cratis-quality-gate.sh` | one build/test run, only when relevant files changed | exits **2** — the turn does not end |
16
17
  | Quality gate (Pi) | explicit `cratis_quality_gate` tool | same script | only at a requested verification checkpoint | error on failure; no turn-end hook |
17
18
 
@@ -60,6 +61,29 @@ conversion and Git's assume-unchanged or skip-worktree settings can hide raw dis
60
61
  use those settings, independently verify raw file contents or remove the hiding settings before
61
62
  relying on this check.
62
63
 
64
+ ## Cleanup of delivered work
65
+
66
+ `scripts/cratis-cleanup-worktrees.sh` is the one place that removes linked worktrees and local
67
+ branches after their work shipped; worktrees pile up otherwise (`gh pr merge --delete-branch`
68
+ cannot delete a branch that a worktree still has checked out, so the pair is left behind) and eat disk.
69
+ It removes only on **evidence of delivery**, never on a guess: the tip is merged into `origin/<default>`
70
+ and was integrated rather than merely sitting on the default branch's first-parent history (where a
71
+ brand-new empty branch sits), or it is merged and its upstream is gone, or GitHub reports a merged pull
72
+ request whose head is exactly that tip. It never forces: a dirty, locked or current worktree is kept, as
73
+ is anything undelivered, and every kept item is reported with its reason. Ignored files (`node_modules`,
74
+ build output, `.ai-work/`) go with a delivered worktree; they are the disk being reclaimed.
75
+
76
+ - **When it runs.** After a Bash command that delivers or integrates work, and at the start of every
77
+ session, so orphans left by any earlier session, crash or harness are collected too.
78
+ Claude Code and Pi are wired (`settings.template.json`, the `cratis-hooks` Pi extension).
79
+ Harnesses with no hook wiring (Copilot, Cursor, OpenCode) rely on the **ship-changes** prompt, whose
80
+ final step runs the same script, and on running it by hand.
81
+ - **By hand.** `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh [--dry-run]` from any worktree;
82
+ run from the main checkout to also collect the worktree you are standing in.
83
+ - **Self-test.** `--self-test` plants delivered, dirty, unmerged and brand-new cases and fails if any is
84
+ handled wrongly.
85
+ - **Opt out.** `CRATIS_HOOKS_SKIP_CLEANUP=1`.
86
+
63
87
  ## What is enforced
64
88
 
65
89
  Rule numbers refer to the numbered list in [`../rules/general.md`](../rules/general.md).
@@ -0,0 +1,184 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) Cratis. All rights reserved.
3
+ # Licensed under the MIT license. See LICENSE file in the project root for full license information.
4
+ #
5
+ # Deterministic cleanup of delivered work: linked worktrees and local branches whose work has
6
+ # reached the default branch. One script, every harness: Claude Code and Pi run it from hooks, and
7
+ # the ship-changes prompt runs it as a mandatory last step for harnesses without hooks.
8
+ #
9
+ # A worktree or branch is removed only on EVIDENCE that its work was delivered, never on a guess:
10
+ # 1. its tip is merged into origin/<default> AND was integrated (it is not simply sitting on the
11
+ # default branch's first-parent history, which is where a brand-new, empty branch sits), or
12
+ # 2. its tip is merged into origin/<default> and its upstream is gone (the PR branch was deleted), or
13
+ # 3. GitHub reports a merged pull request whose head commit is exactly this tip.
14
+ # Anything else is KEPT and reported with the reason. Nothing is ever forced: a dirty, locked or
15
+ # current worktree is kept, and `git worktree remove` is never given --force.
16
+ #
17
+ # Usage:
18
+ # cratis-cleanup-worktrees.sh [--dry-run] [--quiet] [--no-fetch] run in the repository (any worktree)
19
+ # cratis-cleanup-worktrees.sh --hook Claude hook mode: reads the hook JSON
20
+ # on stdin, acts only when relevant
21
+ # cratis-cleanup-worktrees.sh --self-test plants cases and fails if any is wrong
22
+ #
23
+ # Exit: 0 ran (kept items are not failures), 2 could not run. Opt out: CRATIS_HOOKS_SKIP_CLEANUP=1.
24
+ # Portable: bash 3.2, BSD + GNU userland.
25
+ # shellcheck disable=SC2016 # the self-test checks are single-quoted on purpose: they are eval-ed later
26
+ set -uo pipefail
27
+
28
+ DRY=0; QUIET=0; FETCH=1; HOOK=0; SELFTEST=0
29
+ for a in "$@"; do
30
+ case "$a" in
31
+ --dry-run) DRY=1 ;; --quiet) QUIET=1 ;; --no-fetch) FETCH=0 ;;
32
+ --hook) HOOK=1; QUIET=1 ;; --self-test) SELFTEST=1 ;;
33
+ *) echo "cratis-cleanup-worktrees: unknown argument '$a'" >&2; exit 2 ;;
34
+ esac
35
+ done
36
+
37
+ # ── Hook mode: decide whether this event is worth a sweep ─────────────────────
38
+ EVENT="PostToolUse"
39
+ if [ "$HOOK" = 1 ]; then
40
+ payload=''; IFS= read -r -d '' payload || true
41
+ [ "${CRATIS_HOOKS_SKIP_CLEANUP:-}" = 1 ] && exit 0
42
+ case "$payload" in *'"SessionStart"'*) EVENT="SessionStart" ;; esac
43
+ if [ "$EVENT" = "PostToolUse" ]; then
44
+ flat=${payload//\\n/ }; flat=${flat//\\\"/\"}
45
+ # Only commands that deliver or integrate work; everything else costs nothing.
46
+ if [[ ! "$flat" =~ (gh[[:space:]]+pr[[:space:]]+merge|git[[:space:]]+(-C[[:space:]]+[^[:space:]]+[[:space:]]+)?(pull|merge|worktree[[:space:]]+(add|remove|prune))|git[[:space:]]+push[[:space:]].*--delete) ]]; then
47
+ exit 0
48
+ fi
49
+ fi
50
+ cwd=""
51
+ command -v jq >/dev/null 2>&1 && cwd=$(printf '%s' "$payload" | jq -r '.cwd // empty' 2>/dev/null)
52
+ if [ -n "$cwd" ] && [ -d "$cwd" ]; then cd "$cwd" || exit 0; fi
53
+ fi
54
+ [ "${CRATIS_HOOKS_SKIP_CLEANUP:-}" = 1 ] && [ "$SELFTEST" = 0 ] && exit 0
55
+
56
+ # ── Self-test ─────────────────────────────────────────────────────────────────
57
+ if [ "$SELFTEST" = 1 ]; then
58
+ self=$(cd "$(dirname "$0")" && pwd)/$(basename "$0")
59
+ t=$(mktemp -d "${TMPDIR:-/tmp}/cleanup-selftest.XXXXXX"); trap 'rm -rf "$t"' EXIT
60
+ export GIT_AUTHOR_NAME=t GIT_AUTHOR_EMAIL=t@t GIT_COMMITTER_NAME=t GIT_COMMITTER_EMAIL=t@t CRATIS_CLEANUP_NO_GH=1
61
+ git init -q --bare -b main "$t/origin.git"
62
+ git clone -q "$t/origin.git" "$t/repo" 2>/dev/null; cd "$t/repo" || exit 2
63
+ git checkout -q -b main 2>/dev/null; echo a > a; git add a; git commit -qm base; git push -q origin main
64
+ mk() { git worktree add -q -b "$1" "$t/wt-$1" main; }
65
+ mk delivered; (cd "$t/wt-delivered" && echo d > d && git add d && git commit -qm d)
66
+ mk dirty; (cd "$t/wt-dirty" && echo x > x && git add x && git commit -qm x)
67
+ mk unmerged; (cd "$t/wt-unmerged" && echo u > u && git add u && git commit -qm u)
68
+ mk fresh # brand new, no commits: must survive
69
+ git branch loose-delivered main; (git checkout -q loose-delivered && echo l > l && git add l && git commit -qm l && git checkout -q main)
70
+ git merge -q --no-ff delivered -m "merge delivered" && git merge -q --no-ff dirty -m "merge dirty" && git merge -q --no-ff loose-delivered -m "merge loose"
71
+ git push -q origin main
72
+ echo junk > "$t/wt-dirty/untracked" # makes the merged worktree dirty
73
+ out=$("$self" --no-fetch 2>&1) || { echo "FAIL: exit $?"; echo "$out"; exit 1; }
74
+ fail=0; chk() { if ! eval "$2"; then echo "FAIL: $1"; fail=1; fi; }
75
+ chk "delivered worktree removed" '[ ! -d "$t/wt-delivered" ]'
76
+ chk "delivered branch removed" '! git rev-parse -q --verify refs/heads/delivered >/dev/null'
77
+ chk "loose merged branch removed" '! git rev-parse -q --verify refs/heads/loose-delivered >/dev/null'
78
+ chk "dirty worktree kept" '[ -d "$t/wt-dirty" ]'
79
+ chk "unmerged worktree kept" '[ -d "$t/wt-unmerged" ]'
80
+ chk "unmerged branch kept" 'git rev-parse -q --verify refs/heads/unmerged >/dev/null'
81
+ chk "fresh worktree kept" '[ -d "$t/wt-fresh" ]'
82
+ chk "fresh branch kept" 'git rev-parse -q --verify refs/heads/fresh >/dev/null'
83
+ chk "main kept" 'git rev-parse -q --verify refs/heads/main >/dev/null'
84
+ chk "report names the removal" 'printf "%s" "$out" | grep -q "removed worktree"'
85
+ [ "$fail" = 0 ] && echo "cratis-cleanup-worktrees self-test: 10 checks passed" && exit 0
86
+ echo "$out"; exit 1
87
+ fi
88
+
89
+ # ── Locate the repository ─────────────────────────────────────────────────────
90
+ git rev-parse --git-dir >/dev/null 2>&1 || { [ "$QUIET" = 1 ] || echo "cratis-cleanup-worktrees: not in a git repository" >&2; exit "$([ "$HOOK" = 1 ] && echo 0 || echo 2)"; }
91
+ here=$(pwd -P)
92
+ main_wt=$(git worktree list --porcelain | awk 'NR==1 && $1=="worktree"{sub(/^worktree /,""); print; exit}')
93
+ if [ ! -d "$main_wt" ]; then echo "cratis-cleanup-worktrees: cannot find the main worktree" >&2; exit 2; fi
94
+ cd "$main_wt" || exit 2
95
+
96
+ if [ "$FETCH" = 1 ]; then git fetch --prune --quiet origin >/dev/null 2>&1 || LOG_NOFETCH=1; fi
97
+ default=$(git symbolic-ref --quiet --short refs/remotes/origin/HEAD 2>/dev/null || true)
98
+ [ -n "$default" ] || { for c in origin/main origin/master; do git rev-parse -q --verify "refs/remotes/$c" >/dev/null && default=$c && break; done; }
99
+ [ -n "$default" ] || { [ "$QUIET" = 1 ] || echo "cratis-cleanup-worktrees: no origin default branch; nothing to compare against" >&2; exit "$([ "$HOOK" = 1 ] && echo 0 || echo 2)"; }
100
+ default_local=${default#origin/}
101
+
102
+ firstparent=$(mktemp "${TMPDIR:-/tmp}/cleanup-fp.XXXXXX"); trap 'rm -f "$firstparent"' EXIT
103
+ git rev-list --first-parent "$default" > "$firstparent" 2>/dev/null
104
+
105
+ REMOVED=(); KEPT=(); FREED_KB=0
106
+ note_removed() { REMOVED+=("$1"); }
107
+ note_kept() { KEPT+=("$1"); }
108
+
109
+ # delivered <sha> <branch|""> <upstream-track> → prints the evidence, returns 0 when delivered
110
+ delivered() {
111
+ local sha="$1" br="$2" track="$3"
112
+ if git merge-base --is-ancestor "$sha" "$default" 2>/dev/null; then
113
+ if ! grep -qx "$sha" "$firstparent"; then echo "merged into $default"; return 0; fi
114
+ if [ "$track" = "[gone]" ]; then echo "merged into $default, upstream gone"; return 0; fi
115
+ fi
116
+ if [ -n "$br" ] && [ "${CRATIS_CLEANUP_NO_GH:-}" != 1 ] && command -v gh >/dev/null 2>&1; then
117
+ if gh pr list --head "$br" --state merged --json headRefOid -q '.[].headRefOid' 2>/dev/null | grep -qx "$sha"; then
118
+ echo "pull request merged at this commit"; return 0
119
+ fi
120
+ fi
121
+ return 1
122
+ }
123
+ track_of() { git for-each-ref --format='%(upstream:track)' "refs/heads/$1" 2>/dev/null; }
124
+
125
+ # ── Worktrees ─────────────────────────────────────────────────────────────────
126
+ git worktree prune >/dev/null 2>&1
127
+ wt=""; sha=""; br=""; locked=0; first=1
128
+ process_worktree() {
129
+ [ -n "$wt" ] || return 0
130
+ if [ "$first" = 1 ]; then first=0; return 0; fi # the main worktree is never removed
131
+ local name="${br:-detached}" ev
132
+ if [ "$locked" = 1 ]; then note_kept "worktree $wt ($name): locked"; return 0; fi
133
+ case "$here/" in "$wt"/*) note_kept "worktree $wt ($name): it is the current directory - run the sweep from the main checkout"; return 0 ;; esac
134
+ if ! ev=$(delivered "$sha" "$br" "$([ -n "$br" ] && track_of "$br")"); then
135
+ note_kept "worktree $wt ($name): work not delivered to $default"; return 0
136
+ fi
137
+ if [ -n "$(git -C "$wt" status --porcelain 2>/dev/null)" ]; then note_kept "worktree $wt ($name): delivered but has uncommitted changes"; return 0; fi
138
+ local kb; kb=$(du -sk "$wt" 2>/dev/null | awk '{print $1}')
139
+ if [ "$DRY" = 1 ]; then note_removed "worktree $wt ($name): would remove, $ev"; return 0; fi
140
+ if git worktree remove "$wt" >/dev/null 2>&1; then
141
+ FREED_KB=$((FREED_KB + ${kb:-0})); note_removed "worktree $wt ($name): $ev"
142
+ else note_kept "worktree $wt ($name): git refused to remove it"; fi
143
+ }
144
+ while IFS= read -r line; do
145
+ case "$line" in
146
+ "worktree "*) process_worktree; wt=${line#worktree }; sha=""; br=""; locked=0 ;;
147
+ "HEAD "*) sha=${line#HEAD } ;;
148
+ "branch "*) br=${line#branch refs/heads/} ;;
149
+ "locked"*) locked=1 ;;
150
+ esac
151
+ done < <(git worktree list --porcelain; echo)
152
+ process_worktree
153
+
154
+ # ── Local branches ────────────────────────────────────────────────────────────
155
+ in_use=$(git worktree list --porcelain | sed -n 's#^branch refs/heads/##p')
156
+ while IFS='|' read -r b bsha; do
157
+ if [ -z "$b" ] || [ "$b" = "$default_local" ]; then continue; fi
158
+ printf '%s\n' "$in_use" | grep -qx "$b" && continue
159
+ if ev=$(delivered "$bsha" "$b" "$(track_of "$b")"); then
160
+ if [ "$DRY" = 1 ]; then note_removed "branch $b: would delete, $ev"
161
+ elif git branch -D "$b" >/dev/null 2>&1; then note_removed "branch $b: $ev"
162
+ else note_kept "branch $b: git refused to delete it"; fi
163
+ else
164
+ note_kept "branch $b: work not delivered to $default"
165
+ fi
166
+ done < <(git for-each-ref --format='%(refname:short)|%(objectname)' refs/heads)
167
+
168
+ # ── Report ────────────────────────────────────────────────────────────────────
169
+ summary="cratis-cleanup-worktrees: ${#REMOVED[@]} removed, ${#KEPT[@]} kept"
170
+ [ "$FREED_KB" -gt 0 ] && summary="$summary, $((FREED_KB / 1024)) MB freed"
171
+ [ "${LOG_NOFETCH:-0}" = 1 ] && summary="$summary (fetch failed: compared against the last fetched $default)"
172
+ if [ "$HOOK" = 1 ]; then
173
+ [ "${#REMOVED[@]}" -gt 0 ] || { [ "$EVENT" = "SessionStart" ] && [ "${#KEPT[@]}" -gt 0 ]; } || exit 0
174
+ msg="$summary."
175
+ [ "${#KEPT[@]}" -gt 0 ] && msg="$msg Kept (not delivered or not safe to remove): $(printf '%s; ' "${KEPT[@]}")"
176
+ command -v jq >/dev/null 2>&1 && jq -nc --arg m "$msg" --arg e "$EVENT" '{systemMessage:$m,hookSpecificOutput:{hookEventName:$e,additionalContext:$m}}' || printf '%s\n' "$msg" >&2
177
+ exit 0
178
+ fi
179
+ if [ "$QUIET" = 0 ]; then
180
+ echo "$summary"
181
+ for r in "${REMOVED[@]+"${REMOVED[@]}"}"; do echo " removed $r"; done
182
+ for k in "${KEPT[@]+"${KEPT[@]}"}"; do echo " kept $k"; done
183
+ fi
184
+ exit 0
@@ -25,7 +25,28 @@
25
25
  ]
26
26
  }
27
27
  ],
28
+ "SessionStart": [
29
+ {
30
+ "hooks": [
31
+ {
32
+ "type": "command",
33
+ "command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh --hook",
34
+ "timeout": 90
35
+ }
36
+ ]
37
+ }
38
+ ],
28
39
  "PostToolUse": [
40
+ {
41
+ "matcher": "Bash",
42
+ "hooks": [
43
+ {
44
+ "type": "command",
45
+ "command": "bash \"$CLAUDE_PROJECT_DIR\"/.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh --hook",
46
+ "timeout": 90
47
+ }
48
+ ]
49
+ },
29
50
  {
30
51
  "matcher": "Write|Edit|MultiEdit|NotebookEdit",
31
52
  "hooks": [
@@ -27,9 +27,9 @@
27
27
  "repository": "Cratis/Stage",
28
28
  "packages": [],
29
29
  "synced": {
30
- "version": "4.83.0",
30
+ "version": "4.89.1",
31
31
  "date": "2026-10-13",
32
- "by": "Cratis/AI#623"
32
+ "by": "Cratis/AI#643"
33
33
  },
34
34
  "covers": {
35
35
  "skills": [
@@ -46,7 +46,7 @@
46
46
  ],
47
47
  "rules": []
48
48
  },
49
- "notes": "Source-checked Stage v4.83.0 bundled by CLI v3.56.0: ESM v1-v13, UUID-concept generated values/responses, enum numbers, concept compliance, validated scalar query keys and supported event-triggered Automation rendering; scaffold pins re-read. ESM v14 filters, mixed reaction effects and other typed refusals retained. Historical probes keep original versions; standalone Stage beyond 4.83.0 not taken."
49
+ "notes": "Source-checked Stage v4.89.1 bundled by CLI v3.57.0: ESM v1-v15, collection equality filters, UUID/String strategies and freshness, role/authenticated reaction identity, reaction observer filters and single-hop append specifications. Scaffold pins and docker docs re-read, including Host compliance and non-text secret refusal 041. Mixed effects, claim/opaque system gates, deeper cascades and other typed refusals retained. Historical probes retain original versions; no new render/browser/Docker probe."
50
50
  },
51
51
  {
52
52
  "id": "arc",
@@ -122,9 +122,9 @@
122
122
  }
123
123
  ],
124
124
  "synced": {
125
- "version": "3.56.0",
125
+ "version": "3.57.0",
126
126
  "date": "2026-10-13",
127
- "by": "Cratis/AI#623"
127
+ "by": "Cratis/AI#643"
128
128
  },
129
129
  "covers": {
130
130
  "skills": [
@@ -153,7 +153,7 @@
153
153
  ],
154
154
  "rules": []
155
155
  },
156
- "notes": "Render bundle source-checked at v3.56.0: Screenplay 4.145.1 and Stage 4.83.0; CLI rendering admits ESM v1-v13 and refuses v14 filters before planning. Other CLI surfaces retain their v3.53.1 evidence from Cratis/AI#620 unless separately re-verified. No new render/browser probe; standalone Screenplay pin remains 4.145.0 because the 4.148.0 delta needs a separate language sync."
156
+ "notes": "Render bundle source-checked at v3.57.0: Screenplay 4.147.1 and Stage 4.89.1; CLI rendering admits ESM v1-v15. Other CLI surfaces retain their v3.53.1 evidence from Cratis/AI#620 unless separately re-verified. No new render/browser probe. Standalone 4.148.0 response-name resolution is not in this bundle."
157
157
  },
158
158
  {
159
159
  "id": "screenplay",
@@ -166,9 +166,9 @@
166
166
  }
167
167
  ],
168
168
  "synced": {
169
- "version": "4.145.0",
170
- "date": "2026-10-12",
171
- "by": "Cratis/AI#636"
169
+ "version": "4.148.0",
170
+ "date": "2026-10-13",
171
+ "by": "Cratis/AI#643"
172
172
  },
173
173
  "covers": {
174
174
  "skills": [
@@ -196,7 +196,7 @@
196
196
  ],
197
197
  "rules": []
198
198
  },
199
- "notes": "Standalone tool and byte-identical v4.145.0 Golden contract pinned for Cratis/AI#636 and #633. Preferred syntax and read-only proposal specification execution checked at v4.145.0; historical parser/binder evidence begins at 4.31.0 and remains separately qualified. The CLI's older bundle is not upgraded by this pin."
199
+ "notes": "Standalone 4.148.0 tool and byte-identical published/Golden contract pinned for Cratis/AI#643 and #642. Teaches ESM v15 strategies, strict fixtures and whole-source freshness, plus returned-name continuation scope and PLAY0685; golden vectors shipped in 4.146.0. Historical parser/binder evidence remains separately qualified. This pin does not upgrade CLI's compiler or Scene response continuation runtime."
200
200
  },
201
201
  {
202
202
  "id": "scene",
@@ -52,3 +52,18 @@ The description is published verbatim as the release notes, so it follows the co
52
52
  deploy order) right after creating the PR with `gh pr comment <n> --body-file .ai-work/pr-notes.md`.
53
53
  Never put them in the description, even for `no-release`.
54
54
  - After pushing, if `verify-release-notes` fails, fix it by editing the description; it re-runs on edit.
55
+
56
+ ## Cleanup — the last step, never skipped
57
+
58
+ Shipping is not finished until the delivered work is cleaned up. Worktrees and branches left behind
59
+ cost real disk and accumulate across sessions. After the merge succeeds:
60
+
61
+ 1. Leave the worktree you worked in: `cd` to the main checkout (`git worktree list` shows it first).
62
+ 2. Run `bash .cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh` and report its summary line.
63
+ It fetches, checks out nothing, and removes only worktrees and local branches whose work is
64
+ verifiably on the default branch (this one included); it never forces and reports what it kept and why.
65
+ 3. `git switch main && git pull --ff-only` in the main checkout so it matches the merged result.
66
+
67
+ Claude Code and Pi also run the script from a hook after `gh pr merge` and at session start; running it
68
+ here as well is deliberate, because Copilot, Cursor and OpenCode have no hook and this step is their only
69
+ trigger. If the script reports the shipped worktree as kept, say why in the final message.
@@ -37,12 +37,18 @@ dumps, and similar coordination files. These are **work records, not documentati
37
37
  - **A worktree is a work record too.** Create it outside the repository tree, for
38
38
  example in a sibling `../.worktrees/` directory. A nested worktree inherits the
39
39
  parent's `.globalconfig` alongside its own, causing .NET's `MultipleGlobalAnalyzerKeys`
40
- errors or silently changing analyzer severities. Remove the worktree you created for
41
- a task once its branch is merged to the default branch — pushed is not merged. Do it
42
- from the parent checkout, after `git status --ignored` in the worktree, because a
43
- nested `.ai-work/`, `.env` files and local databases are ignored and are deleted with it.
44
- If the branch must outlive the task unmerged, leave the worktree and say so in the
45
- handoff. Never `--force` a removal; a refusal means look, not push harder.
40
+ errors or silently changing analyzer severities. **Delivered work is cleaned up by
41
+ `.cratis/ai/hooks/scripts/cratis-cleanup-worktrees.sh`, not by memory:** run it from the
42
+ main checkout when a pull request merges or you finish a task (hooks also run it after
43
+ `gh pr merge` and at session start where the harness supports them, and **ship-changes**
44
+ ends with it). It removes a worktree and its branch only on evidence the work reached the
45
+ default branch — pushed is not merged — and never forces; ignored files such as a nested
46
+ `.ai-work/`, `.env` files and local databases are deleted with it, so move anything you
47
+ still need out first. Do not hand-remove worktrees or `git branch -D` a delivered branch
48
+ when the script can; and `gh pr merge --delete-branch` from inside a worktree leaves the
49
+ worktree and branch behind, which is why the script exists. If the branch must outlive the
50
+ task unmerged, leave the worktree and say so in the handoff. Never `--force` a removal; a
51
+ refusal means look, not push harder.
46
52
  - **A decision log is not a work record.** A decision — a durable choice with a
47
53
  decider and a date — is documentation: it lives in **`decisions/`** (or the
48
54
  repository's documented decisions folder) and is reviewed like any other
@@ -163,5 +163,6 @@ the prior verification): `Source/DotNET/Arc.Core/Commands/ModelBound/GeneratedVa
163
163
 
164
164
  This release has no freshness/collision guard, contextual clock/tenant/pattern
165
165
  generation, or additional built-in strategies beyond Fundamentals' UUID/UUIDv7
166
- helpers. Do not teach proposals as available APIs or invent Screenplay `generate`
167
- syntax for this feature.
166
+ helpers at this Arc tag. Screenplay 4.147.0+ separately admits concept `generate`
167
+ strategies and freshness; see `cratis-screenplay-command-surface/references/generated-values-and-responses.md`
168
+ for that language contract and Stage's explicit scopes, not native Arc freshness support.
@@ -25,7 +25,7 @@ effects. If the answer is "populate a queryable model", it is not a reactor.
25
25
  > `.cratis/ai.json`; master definition in `cratis-screenplay-modeling-lifecycle`), the automation is
26
26
  > a modeled slice: find it (`Automation` or `Translate`), treat its `produces` /
27
27
  > `invokes`, conditions and fields as the contract, and write the reactor only as
28
- > gap-fill for what the model leaves to code (Stage 4.83.0 renders supported event-triggered Automation;
28
+ > gap-fill for what the model leaves to code (Stage 4.89.1 renders supported event-triggered Automation;
29
29
  > Translate/captures and refused reactions remain gap-fill; Stage skill `references/admission.md`). Use `cratis-screenplay-automations-and-translations` to
30
30
  > change the model; never change the model to fit the reactor, and never leave a
31
31
  > modeled rule living only in the reactor. If the repository is not opted in
@@ -41,7 +41,7 @@ identity, effect and pending-work contract at that point; do not postpone it to
41
41
  Without it the invoke has no caller. Historical CLI 3.41.0's 4.114.0 compiler
42
42
  rejected the syntax (PLAY0137); previous CLI 3.46.1 refused ESM v10
43
43
  at render admission (CLI-RENDER-004). The pinned CLI/Stage pair (toolchain
44
- `references/versions.md`) reaches construct admission, which still refuses reaction identity (STAGE-ESM-034). Checked model/diagnostics: captures-and-reactions
44
+ `references/versions.md`) renders role/authenticated reaction identity; claim-reading/opaque gates retain STAGE-ESM-034. Checked model/diagnostics: captures-and-reactions
45
45
  `references/invocation-identity.md`.
46
46
 
47
47
  ## Effect guarantees and recovery traps
@@ -73,8 +73,8 @@ even when it blocks binding. Never record bearer tokens, magic links or signed U
73
73
 
74
74
  ## Verified product sources
75
75
  Current pins: toolchain `references/versions.md`. Language claims were re-read at Screenplay v4.139.0,
76
- renderer claims at Stage v4.83.0 (`Documentation/reference/reaction-rendering.md:6-88`,
77
- `Source/Rendering.Cratis/Semantics/SemanticVersionFeatureAdmission.cs:25-45`): supported
76
+ renderer claims at Stage v4.89.1 (`Documentation/reference/reaction-rendering.md:6-98`,
77
+ `Source/Rendering.Cratis/Semantics/SemanticVersionFeatureAdmission.cs:25-46`): supported
78
78
  event-triggered Automation renders; Translate/captures and refused reactions stay gap-fill. The
79
79
  runtime facts at Arc v22.72.0 and Chronicle v19.50.1. Older reads kept as history:
80
80
 
@@ -12,8 +12,8 @@ technique: partial work stays visible and nothing is skipped because it looked r
12
12
  Result is `complete` only when every column is filled or says why it does not apply (for example
13
13
  "direct effect: immediate, internal, cannot fail"). `open` names the unresolved decision and who
14
14
  answers. `blocked` names the actual capability gap with intended behavior. For example,
15
- the pinned CLI/Stage pair (toolchain `references/versions.md`) admits through ESM v13 to construct checks, where reaction identity
16
- is refused with STAGE-ESM-034. Previous CLI 3.46.1 refused v10 at the version gate
15
+ the pinned CLI/Stage pair (toolchain `references/versions.md`) admits through ESM v15 to construct checks; role/authenticated reaction identity
16
+ renders, while claim-reading/opaque system gates still refuse STAGE-ESM-034. Previous CLI 3.46.1 refused v10 at the version gate
17
17
  with CLI-RENDER-004; do not report that historical refusal as the current gap.
18
18
 
19
19
  ## Per translation (capture or translator reaction)
@@ -73,7 +73,7 @@ Screenplay 4.125.0 declares the actor with reaction-level `runs as system role
73
73
  `given caller` is not an invocation actor. Role requirements remain enforced;
74
74
  claim conditions for this system principal remain unknown. Historical CLI 3.41.0's
75
75
  older compiler rejected the syntax (PLAY0137). The pinned CLI/Stage pair (toolchain
76
- `references/versions.md`) reaches v10 construct admission, but reaction identity still refuses STAGE-ESM-034.
76
+ `references/versions.md`) renders role/authenticated reaction identity; claim-reading/opaque gates retain STAGE-ESM-034.
77
77
  Previous CLI 3.46.1 refused v10 at its version gate; see toolchain `references/versions.md`.
78
78
  Use the checked model in captures-and-reactions `references/invocation-identity.md`.
79
79
  Arc gap-fill uses `[ExecuteCommandsAsSystem("<role>")]` for returned commands,
@@ -44,7 +44,7 @@ binds); tool-qualified verdict text; the trusted-actor text now names `[ExecuteC
44
44
  binder's v10 selection; the checked scenario passed reference execution. CLI
45
45
  3.41.0's older parser and Stage 4.51.3's v7 planner were historical target limits.
46
46
  Previous CLI 3.46.1 refused v10 at its version gate. The pinned CLI/Stage pair
47
- (toolchain `references/versions.md`) reaches v10 construct checks and still
48
- refuses reaction identity with STAGE-ESM-034.
47
+ (toolchain `references/versions.md`) renders role/authenticated reaction identity; claim-reading/opaque gates retain
48
+ STAGE-ESM-034 (Stage `v4.89.1:Documentation/reference/reaction-rendering.md:57-59`).
49
49
  Public/direction forms and routes/filters follow Screenplay v4.135.0 decisions
50
50
  0049–0051 and 0060–0066, not the older inbound-only translation scope.
@@ -121,7 +121,7 @@ ESM v9 shipped in Screenplay 4.117.0 and is selected only by use of public event
121
121
  origins, direction, event-target builders or events-source captures. At 4.135.0,
122
122
  publication reference scenarios execute; imported shapes still refuse binding.
123
123
  Stage 4.52.0 (previous CLI 3.46.1, history) audited only through v7. The pinned CLI/Stage pair (toolchain `references/versions.md`)
124
- reaches construct admission through v13 but still refuses publication (STAGE-ESM-032), foreign
124
+ reaches construct admission through v15 but still refuses publication (STAGE-ESM-032), foreign
125
125
  events/events-source captures (STAGE-ESM-033); source admission is not rendering.
126
126
 
127
127
  Source: Screenplay `v4.135.0:Documentation/screenplay/fixtures/public-events.play`,
@@ -5,12 +5,13 @@ the automation-and-translation addendum to `cratis-screenplay-render-and-gap-fil
5
5
  skill for the admission, publication and ownership rules.
6
6
 
7
7
  ## Stage rendering versus gap-fill
8
- CLI 3.56.0 / Stage 4.83.0 render supported event-triggered Automation slices as Chronicle
8
+ CLI 3.57.0 / Stage 4.89.1 render supported event-triggered Automation slices as Chronicle
9
9
  reactors. Translate/captures, non-event triggers and opaque bodies remain `STAGE-ESM-024`;
10
- `runs as` (`-034`), `from` (`-035`), mixed effects (`-037`), unsupported mappings (`-039`)
10
+ Claim-reading/opaque `runs as` gates (`-034`), legacy `from` (`-035`), mixed effects (`-037`), unsupported mappings (`-039`)
11
11
  and protected destinations (`-040`) also remain refused. Command specs that cascade into
12
- reactions remain `-011`. Only refused scope is hand-written delivery with the model as
13
- its contract. Source: Stage `v4.83.0:Documentation/reference/reaction-rendering.md:6-88`;
12
+ reactions remain `-011`; supported single-hop append specs now render, as do semantic
13
+ reaction `from` and role/authenticated system identities. Only refused scope is hand-written delivery with the model as
14
+ its contract. Source: Stage `v4.89.1:Documentation/reference/reaction-rendering.md:6-98`;
14
15
  full admission: `cratis-stage-rendering-and-sandbox` `references/admission.md`. (History: cratis
15
16
  3.28.2 and 3.28.3 refused such a model whole with `STAGE-ESM-016`, and 3.27.1 stopped earlier with PLAY0268.)
16
17
 
@@ -7,7 +7,7 @@
7
7
  A complete model: a result opens a work item, a reaction invokes a command, the command's fact
8
8
  closes the item. It binds on Screenplay 4.66.0 (`executableReady: true`), standalone and through `cratis screenplay mcp`
9
9
  3.28.2. Historical rendering: 3.28.2 refused the whole model (`STAGE-ESM-016`),
10
- Stage 4.73.1 the reaction (`-024`). Stage 4.83.0 renders supported event reactions,
10
+ Stage 4.73.1 the reaction (`-024`). Stage 4.89.1 renders supported event reactions,
11
11
  but this model's clock/cascade specs remain refused (`-024`/`-011`); keep them intact. The cratis 3.27.1 bundle (4.60.1)
12
12
  rejected the Automation slice at binding with PLAY0268. Versions: `cratis-screenplay-toolchain` `references/versions.md`.
13
13
 
@@ -34,9 +34,9 @@ decides, not the slice type:
34
34
  `executableReady` over `screenplay mcp`.
35
35
  - **History:** the CLI 3.28.2 bundle (Screenplay 4.66.0) bound v6; the earlier 4.60.1 bundles
36
36
  refused it and falsely reported PLAY0285 (`references/versions.md`).
37
- - **CLI 3.56.0 / Stage 4.83.0** render supported event-triggered Automation, not
38
- Translate/captures, non-event triggers or opaque bodies (`-024`). `runs as`, `from`,
39
- mixed effects, unsupported mappings and protected identities remain refused;
37
+ - **CLI 3.57.0 / Stage 4.89.1** render supported event-triggered Automation, not
38
+ Translate/captures, non-event triggers or opaque bodies (`-024`). Role/authenticated `runs as`
39
+ and semantic `from` render; claim/opaque gates, mixed effects and unsupported mappings remain refused;
40
40
  cascade specs remain `-011`. Keep refused scope as gap-fill. Full boundary and source
41
41
  citations: `cratis-stage-rendering-and-sandbox` `references/admission.md`.
42
42
 
@@ -72,8 +72,8 @@ scenario, claim/unknown semantics and PLAY0647–0652/0557 diagnostics.
72
72
 
73
73
  Historical CLI 3.41.0's 4.114.0 compiler rejected this source with PLAY0137.
74
74
  Previous CLI 3.46.1 refused v10 (CLI-RENDER-004); the pinned CLI/Stage pair (toolchain
75
- `references/versions.md`) reaches construct admission, still refusing identity (STAGE-ESM-034).
76
- Target realization is gap-fill, using Arc `[ExecuteCommandsAsSystem]` for returned commands. Without that attribute
75
+ `references/versions.md`) renders supported identity, refusing claim-reading/opaque gates (STAGE-ESM-034).
76
+ Stage emits Arc `[ExecuteCommandsAsSystem]`; refused scope uses authorized gap-fill. The attribute is for returned commands. Without that attribute
77
77
  Arc supplies no principal and `[Authorize]`/`[Roles]` deny. Each invoked command
78
78
  is atomic, not the whole cascade; earlier accepted facts remain after a later refusal.
79
79