its-magic 0.1.2-21 → 0.1.2-23

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.
package/README.md CHANGED
@@ -199,6 +199,18 @@ Setup:
199
199
  2. Set personal values there (`TEAM_MEMBER`, `ACTIVE_TASK_IDS`, automation style)
200
200
  3. Hook merges shared + local (local wins)
201
201
 
202
+ Upgrade behavior (US-0057):
203
+ - `.cursor/scratchpad.local.example.md` is framework-owned and refreshed on `--mode upgrade`.
204
+ - `.cursor/scratchpad.local.md` is user-owned and preserved on `--mode upgrade`.
205
+ - Installer output includes scratchpad example refresh status and local-preserved signal.
206
+
207
+ Deterministic ordering behavior (US-0058):
208
+ - Mutable artifacts follow `docs/engineering/artifact-ordering-policy.md`.
209
+ - `state.md` checkpoints are append-bottom; `backlog.md` and `acceptance.md`
210
+ remain sorted-canonical by story ID.
211
+ - Commands fail closed on ambiguous placement anchors using
212
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
213
+
202
214
  ## Workflow
203
215
 
204
216
  ### Core commands
@@ -303,6 +315,41 @@ Compaction behavior:
303
315
  - bounded expansion only when unresolved
304
316
  - explicit "not found in artifacts" when still unresolved
305
317
 
318
+ ### Configurable multi-target publish + confirmation gate (US-0054)
319
+
320
+ Post-release publish behavior is configurable per repository:
321
+
322
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto` (default `confirm`)
323
+ - `RELEASE_TARGETS_FILE=docs/engineering/release-targets.json`
324
+ - `RELEASE_TARGETS_DEFAULT=` optional comma-separated default targets
325
+
326
+ Supported target types include:
327
+
328
+ - `npm`, `choco`, `brew`, `git`, `docker`, `cloud`
329
+ - `custom` (generic command target)
330
+ - `ssh` (generic server deployment over SSH)
331
+
332
+ Safety defaults:
333
+
334
+ - Mandatory `/release` gates are unchanged and must pass first.
335
+ - `confirm` mode enforces explicit operator approval before publish execution.
336
+ - Sensitive values are env-referenced (for example `tokenEnv`, `authEnv`), not
337
+ inline literals.
338
+
339
+ ### Deterministic status reconciliation command (US-0055)
340
+
341
+ Use `/status-reconcile` to normalize status drift between canonical and derived
342
+ workflow artifacts before continuation:
343
+
344
+ - canonical source: `docs/product/backlog.md` story status
345
+ - derived targets: `docs/product/acceptance.md`, `docs/engineering/state.md`,
346
+ `handoffs/resume_brief.md`
347
+ - deterministic outcomes: apply/no-op/fail-safe reason codes with audit evidence
348
+ in `docs/engineering/status-normalization-report.md`
349
+
350
+ This command is the bounded repair counterpart to `/memory-audit`
351
+ (read-only detection).
352
+
306
353
  ### Optional cross-repo observability (US-0034)
307
354
 
308
355
  Use optional compatibility visibility with default-safe off behavior:
@@ -454,6 +501,21 @@ Missing/invalid/stale evidence fails closed with reason codes:
454
501
  `PHASE_CONTEXT_ISOLATION_MISSING`, `PHASE_CONTEXT_ISOLATION_VIOLATION`,
455
502
  `ISOLATION_EVIDENCE_STALE`, `ISOLATION_EVIDENCE_INVALID`.
456
503
 
504
+ #### Strict runtime proof (US-0056 / DEC-0038)
505
+
506
+ Per-phase isolation also requires strict runtime attestation tuples at
507
+ boundaries (not artifact fields alone):
508
+
509
+ - `orchestrator_run_id`, `runtime_proof_id`, `phase_id`, `role`
510
+ - `proof_issued_at`, `proof_ttl_seconds`, `proof_hash`
511
+
512
+ Fail-closed reason codes:
513
+ `RUNTIME_PROOF_MISSING`, `RUNTIME_PROOF_INVALID`, `RUNTIME_PROOF_REUSED`,
514
+ `RUNTIME_PROOF_STALE`, `RUNTIME_PROOF_AMBIGUOUS_LINK`.
515
+
516
+ `/auto`, `/verify-work`, and `/release` must validate these tuples before
517
+ continuation/finalization.
518
+
457
519
  ### Lightweight interaction
458
520
 
459
521
  Use `/ask` when you want to query the project without triggering the workflow:
package/installer.ps1 CHANGED
@@ -372,6 +372,8 @@ if ($mode -eq "upgrade") {
372
372
  $unchanged = 0
373
373
  $preserved = 0
374
374
  $review = New-Object System.Collections.Generic.List[string]
375
+ $scratchpadExampleRel = '.cursor/scratchpad.local.example.md'
376
+ $scratchpadExampleStatus = 'not-seen'
375
377
 
376
378
  foreach ($rel in $files) {
377
379
  $src = Join-Path $sourceRoot $rel
@@ -383,16 +385,19 @@ if ($mode -eq "upgrade") {
383
385
  Ensure-Parent $dst
384
386
  Copy-Item -Path $src -Destination $dst -Force
385
387
  $added.Add($rel)
388
+ if ($rel -eq $scratchpadExampleRel) { $scratchpadExampleStatus = 'added' }
386
389
  continue
387
390
  }
388
391
 
389
392
  if ($cat -eq 'framework') {
390
393
  if (Files-ContentEqual $src $dst) {
391
394
  $unchanged++
395
+ if ($rel -eq $scratchpadExampleRel) { $scratchpadExampleStatus = 'unchanged' }
392
396
  } else {
393
397
  Ensure-Parent $dst
394
398
  Copy-Item -Path $src -Destination $dst -Force
395
399
  $updated.Add($rel)
400
+ if ($rel -eq $scratchpadExampleRel) { $scratchpadExampleStatus = 'updated' }
396
401
  }
397
402
  continue
398
403
  }
@@ -426,6 +431,11 @@ if ($mode -eq "upgrade") {
426
431
  }
427
432
  Write-Host " Unchanged: $unchanged files"
428
433
  Write-Host " Preserved (user): $preserved files"
434
+ if ($scratchpadExampleStatus -eq 'not-seen') { $scratchpadExampleStatus = 'not-in-manifest' }
435
+ Write-Host " Scratchpad example: $scratchpadExampleStatus (.cursor/scratchpad.local.example.md)"
436
+ if (Test-Path (Join-Path $targetRoot '.cursor/scratchpad.local.md') -PathType Leaf) {
437
+ Write-Host " User local file: preserved (.cursor/scratchpad.local.md)"
438
+ }
429
439
  if ($review.Count -gt 0) {
430
440
  Write-Host ""
431
441
  Write-Host " Review recommended: $($review.Count) files" -ForegroundColor Magenta
package/installer.py CHANGED
@@ -333,6 +333,8 @@ def main():
333
333
 
334
334
  added, updated, review = [], [], []
335
335
  unchanged = preserved = 0
336
+ scratchpad_example_rel = ".cursor/scratchpad.local.example.md"
337
+ scratchpad_example_status = "not-seen"
336
338
 
337
339
  for rel in files:
338
340
  src = os.path.join(source_root, rel)
@@ -344,15 +346,21 @@ def main():
344
346
  ensure_parent(dst)
345
347
  shutil.copy2(src, dst)
346
348
  added.append(rel)
349
+ if rel == scratchpad_example_rel:
350
+ scratchpad_example_status = "added"
347
351
  continue
348
352
 
349
353
  if cat == "framework":
350
354
  if filecmp.cmp(src, dst, shallow=False):
351
355
  unchanged += 1
356
+ if rel == scratchpad_example_rel:
357
+ scratchpad_example_status = "unchanged"
352
358
  else:
353
359
  ensure_parent(dst)
354
360
  shutil.copy2(src, dst)
355
361
  updated.append(rel)
362
+ if rel == scratchpad_example_rel:
363
+ scratchpad_example_status = "updated"
356
364
  continue
357
365
 
358
366
  if cat == "user-data":
@@ -384,6 +392,11 @@ def main():
384
392
  print(f" {f}")
385
393
  print(f" Unchanged: {unchanged} files")
386
394
  print(f" Preserved (user): {preserved} files")
395
+ if scratchpad_example_status == "not-seen":
396
+ scratchpad_example_status = "not-in-manifest"
397
+ print(f" Scratchpad example: {scratchpad_example_status} (.cursor/scratchpad.local.example.md)")
398
+ if os.path.isfile(os.path.join(target_root, ".cursor", "scratchpad.local.md")):
399
+ print(" User local file: preserved (.cursor/scratchpad.local.md)")
387
400
  if review:
388
401
  print(f"\n {p}Review recommended: {len(review)} files{r}")
389
402
  for f in review:
package/installer.sh CHANGED
@@ -322,6 +322,8 @@ if [ "$MODE" = "upgrade" ]; then
322
322
  count_unchanged=0
323
323
  count_preserved=0
324
324
  count_review=0; list_review=""
325
+ scratchpad_example_rel=".cursor/scratchpad.local.example.md"
326
+ scratchpad_example_status="not-seen"
325
327
 
326
328
  for rel in $FILES; do
327
329
  src="$SOURCE_ROOT/$rel"
@@ -333,17 +335,20 @@ if [ "$MODE" = "upgrade" ]; then
333
335
  cp -p "$src" "$dst"
334
336
  count_added=$((count_added + 1))
335
337
  list_added="$list_added $rel"
338
+ [ "$rel" = "$scratchpad_example_rel" ] && scratchpad_example_status="added"
336
339
  continue
337
340
  fi
338
341
 
339
342
  if [ "$cat" = "framework" ]; then
340
343
  if cmp -s "$src" "$dst"; then
341
344
  count_unchanged=$((count_unchanged + 1))
345
+ [ "$rel" = "$scratchpad_example_rel" ] && scratchpad_example_status="unchanged"
342
346
  else
343
347
  ensure_parent "$dst"
344
348
  cp -p "$src" "$dst"
345
349
  count_updated=$((count_updated + 1))
346
350
  list_updated="$list_updated $rel"
351
+ [ "$rel" = "$scratchpad_example_rel" ] && scratchpad_example_status="updated"
347
352
  fi
348
353
  continue
349
354
  fi
@@ -377,6 +382,9 @@ if [ "$MODE" = "upgrade" ]; then
377
382
  fi
378
383
  printf " Unchanged: %s files\n" "$count_unchanged"
379
384
  printf " Preserved (user): %s files\n" "$count_preserved"
385
+ [ "$scratchpad_example_status" = "not-seen" ] && scratchpad_example_status="not-in-manifest"
386
+ printf " Scratchpad example: %s (.cursor/scratchpad.local.example.md)\n" "$scratchpad_example_status"
387
+ [ -f "$TARGET_ROOT/.cursor/scratchpad.local.md" ] && printf " User local file: preserved (.cursor/scratchpad.local.md)\n"
380
388
  if [ "$count_review" -gt 0 ]; then
381
389
  printf "\n \033[1;35mReview recommended: %s files\033[0m\n" "$count_review"
382
390
  for f in $list_review; do printf " %s\n" "$f"; done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its-magic",
3
- "version": "0.1.2-21",
3
+ "version": "0.1.2-23",
4
4
  "description": "its-magic - AI dev team workflow for Cursor.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -35,6 +35,32 @@ Reason codes (deterministic):
35
35
  - `ISOLATION_EVIDENCE_STALE`
36
36
  - `ISOLATION_EVIDENCE_INVALID`
37
37
 
38
+ ## Strict runtime proof enforcement (US-0056 / DEC-0038)
39
+
40
+ `/auto` must enforce strict runtime attestation in addition to artifact-level
41
+ isolation evidence:
42
+
43
+ - Each completed phase must provide a runtime attestation tuple linked to the
44
+ phase checkpoint evidence:
45
+ - `orchestrator_run_id`
46
+ - `runtime_proof_id`
47
+ - `phase_id`
48
+ - `role`
49
+ - `proof_issued_at` (ISO UTC / RFC3339)
50
+ - `proof_ttl_seconds`
51
+ - `proof_hash`
52
+ - `runtime_proof_id` must be unique per phase run; reused proof IDs are invalid.
53
+ - Proof freshness must be validated against `proof_issued_at` + TTL policy.
54
+ - Proof linkage must be deterministic and auditable to checkpoint evidence refs.
55
+ - Fail closed on any strict-proof violation; no silent continuation.
56
+
57
+ Strict-proof reason codes:
58
+ - `RUNTIME_PROOF_MISSING`
59
+ - `RUNTIME_PROOF_INVALID`
60
+ - `RUNTIME_PROOF_REUSED`
61
+ - `RUNTIME_PROOF_STALE`
62
+ - `RUNTIME_PROOF_AMBIGUOUS_LINK`
63
+
38
64
  ## Inputs
39
65
  - `AUTO_FLOW_MODE` and `PHASE_MODE` from `.cursor/scratchpad.md`
40
66
  - `AUTO_IMPLEMENTATION_LOOP`, `AUTO_LOOP_MAX_CYCLES` from `.cursor/scratchpad.md`
@@ -194,6 +220,11 @@ Reason-code baseline:
194
220
  - `EXEC_BULK_NO_ELIGIBLE_ITEMS`
195
221
  - `EXEC_TEAM_SCOPE_BLOCKED`
196
222
  - `EXEC_TEAM_SCOPE_SKIPPED`
223
+ - `RUNTIME_PROOF_MISSING`
224
+ - `RUNTIME_PROOF_INVALID`
225
+ - `RUNTIME_PROOF_REUSED`
226
+ - `RUNTIME_PROOF_STALE`
227
+ - `RUNTIME_PROOF_AMBIGUOUS_LINK`
197
228
 
198
229
  ## Canonical `start-from` contract
199
230
 
@@ -308,6 +339,17 @@ Required codes:
308
339
  missing/invalid/stale, stop with the appropriate reason code and remediation
309
340
  guidance (run the phase again in a fresh subagent context and write new
310
341
  evidence).
342
+ 11b. At each phase boundary, verify strict runtime attestation tuple exists and
343
+ is valid for the completed phase (`orchestrator_run_id`,
344
+ `runtime_proof_id`, `phase_id`, `role`, `proof_issued_at`,
345
+ `proof_ttl_seconds`, `proof_hash`).
346
+ - Missing tuple: `RUNTIME_PROOF_MISSING`
347
+ - Invalid schema/hash/linkage: `RUNTIME_PROOF_INVALID`
348
+ - Reused `runtime_proof_id`: `RUNTIME_PROOF_REUSED`
349
+ - Expired proof TTL / stale proof: `RUNTIME_PROOF_STALE`
350
+ - Ambiguous proof-to-checkpoint linkage: `RUNTIME_PROOF_AMBIGUOUS_LINK`
351
+ - Remediation: rerun affected phase in fresh subagent context, write new
352
+ strict-proof tuple + checkpoint evidence, then continue.
311
353
  12. At each phase boundary, evaluate sync policy only when mode requires it and
312
354
  record a deterministic sync verdict entry with:
313
355
  - `phase_boundary`
@@ -338,3 +380,14 @@ Required codes:
338
380
  - `/resume` remains valid for context loading and guided continuation.
339
381
  - Deterministic precedence and fail-fast behavior apply when `/auto` continuation
340
382
  is invoked.
383
+
384
+ ## Deterministic artifact ordering guard (US-0058 / DEC-0040)
385
+
386
+ - When `/auto` coordinates phases that write mutable artifacts, each phase must
387
+ follow `docs/engineering/artifact-ordering-policy.md`.
388
+ - Ordering policies are mandatory:
389
+ - `state.md`: append-bottom
390
+ - `backlog.md` / `acceptance.md`: sorted-canonical
391
+ - release/handoff surfaces: policy-specific (prepend/append) as documented.
392
+ - If a required placement anchor is missing or ambiguous, fail closed with
393
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and do not continue.
@@ -118,3 +118,15 @@ description: "its-magic intake: clarify idea and capture story + acceptance."
118
118
  - If `USER_GUIDE_MODE=1`, ensure handoff references canonical user-guide path
119
119
  `docs/user-guides/US-xxxx.md` for the new story when applicable; see runbook.
120
120
 
121
+ ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
122
+
123
+ - Writes to mutable artifacts must follow
124
+ `docs/engineering/artifact-ordering-policy.md`.
125
+ - For intake outputs:
126
+ - `docs/product/backlog.md` story blocks must remain sorted-canonical by
127
+ numeric `US-xxxx` ID.
128
+ - `docs/product/acceptance.md` rows must align to canonical backlog order.
129
+ - `handoffs/po_to_tl.md` may prepend the latest handoff section only.
130
+ - If the insertion anchor for any target section is missing/ambiguous, fail with
131
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and avoid partial writes.
132
+
@@ -28,3 +28,14 @@ description: "its-magic refresh context: compact state and decisions."
28
28
  2. Update sprint summary with current status.
29
29
  3. Ensure handoffs and state are consistent.
30
30
 
31
+ ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
32
+
33
+ - Writes must follow `docs/engineering/artifact-ordering-policy.md`.
34
+ - `docs/engineering/state.md` refresh checkpoints are append-bottom only.
35
+ - `docs/engineering/decisions.md` compact index remains newest-first in bounded
36
+ section while preserving canonical header structure.
37
+ - `sprints/S0001/summary.md` context-pack pointer is prepend-top within its
38
+ context section; historical details remain intact.
39
+ - Missing/ambiguous anchors fail with `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`
40
+ (no partial write).
41
+
@@ -89,6 +89,7 @@ Mandatory gate order (strict, deterministic). No step may be skipped or reordere
89
89
  2. **QA completion gate** — Require no unresolved blocking findings in current sprint context before proceeding.
90
90
  3. **UAT completion gate** — Require UAT artifacts populated and verified; block on placeholder, incomplete, or unresolved-fail state.
91
91
  4. **Isolation compliance gate** — Require valid per-phase isolation evidence (US-0048 / DEC-0029); block on missing/invalid/stale evidence or violation.
92
+ 4b. **Strict runtime proof gate** — Require valid strict runtime attestation tuples (US-0056 / DEC-0038); block on missing/invalid/reused/stale/ambiguous proof linkage.
92
93
  5. **Release finalization** — Only after gates 1–4 pass: write release notes, update queue, reconcile backlog/runbook/state.
93
94
 
94
95
  Optional runbook keys (`LINT_COMMAND`, `TYPECHECK_COMMAND`) are not mandatory release gates. When blank, they must not cause release to fail; report as `skipped`. Mandatory gates remain check-in test + QA + UAT + isolation only (US-0039 AC-10, US-0048).
@@ -234,6 +235,17 @@ Guardrails:
234
235
  `PHASE_CONTEXT_ISOLATION_VIOLATION`
235
236
  - Remediation: re-run the affected phase(s) in fresh subagent contexts,
236
237
  write new isolation evidence, then rerun `/release`.
238
+ 4b. Strict runtime proof gate (US-0056 / DEC-0038): verify strict runtime-proof
239
+ tuples are present and valid for target lifecycle phases (`execute`, `qa`,
240
+ `verify-work`) and deterministically linked to checkpoint evidence.
241
+ - Missing tuple: block with `RUNTIME_PROOF_MISSING`
242
+ - Invalid tuple/hash/linkage: block with `RUNTIME_PROOF_INVALID`
243
+ - Reused `runtime_proof_id`: block with `RUNTIME_PROOF_REUSED`
244
+ - Expired/stale proof: block with `RUNTIME_PROOF_STALE`
245
+ - Ambiguous proof-to-checkpoint linkage: block with
246
+ `RUNTIME_PROOF_AMBIGUOUS_LINK`
247
+ - Remediation: rerun affected phase(s), write fresh runtime proof tuples,
248
+ then rerun `/release`.
237
249
  5. Ensure target queue row exists; set status to `unreleased` before finalization.
238
250
  - Create row if missing.
239
251
  - Set `release_notes_ref` to target sprint notes path.
@@ -284,6 +296,30 @@ Guardrails:
284
296
  (`PASS`) and references final evidence artifacts.
285
297
  15. If `AUTO_RELEASE_NOTES=1` in `.cursor/scratchpad.md`, generation logic must
286
298
  still target sprint-scoped notes first and update legacy pointer second.
299
+ 16. Optional configurable publish targets (US-0054 / DEC-0036):
300
+ - Read `.cursor/scratchpad.md`:
301
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto`
302
+ - `RELEASE_TARGETS_FILE`
303
+ - `RELEASE_TARGETS_DEFAULT`
304
+ - If `RELEASE_PUBLISH_MODE=disabled`, skip publish target execution with
305
+ deterministic no-op evidence.
306
+ - Validate target schema in `RELEASE_TARGETS_FILE` before execution:
307
+ - stable `id`, `type`, `enabled`, `order`,
308
+ - supported `type`: `npm|choco|brew|git|docker|cloud|custom|ssh`,
309
+ - env-reference-only secret fields (`*Env`) for sensitive values.
310
+ - fail fast on invalid/missing required fields with
311
+ `PUBLISH_TARGET_CONFIG_INVALID`.
312
+ - Resolve selected targets (explicit request, else
313
+ `RELEASE_TARGETS_DEFAULT`), filter `enabled=true`, and execute in
314
+ deterministic order (`order`, then `id`).
315
+ - If `RELEASE_PUBLISH_MODE=confirm`, require explicit operator confirmation
316
+ before execution; if confirmation is denied/absent, stop with
317
+ `PUBLISH_CONFIRMATION_REQUIRED`.
318
+ - For `ssh` targets, require `hostEnv`, `userEnv`, `authEnv`, and
319
+ `remoteCommand`. Missing required fields fail with
320
+ `PUBLISH_TARGET_CONFIG_INVALID`.
321
+ - If target execution fails, emit `PUBLISH_TARGET_EXECUTION_FAILED` with
322
+ target ID and remediation; do not mutate unrelated release artifacts.
287
323
 
288
324
  ## Fail-safe reason codes and remediation guidance
289
325
 
@@ -298,6 +334,11 @@ Required deterministic reason codes:
298
334
  - `PHASE_CONTEXT_ISOLATION_VIOLATION`
299
335
  - `ISOLATION_EVIDENCE_STALE`
300
336
  - `ISOLATION_EVIDENCE_INVALID`
337
+ - `RUNTIME_PROOF_MISSING`
338
+ - `RUNTIME_PROOF_INVALID`
339
+ - `RUNTIME_PROOF_REUSED`
340
+ - `RUNTIME_PROOF_STALE`
341
+ - `RUNTIME_PROOF_AMBIGUOUS_LINK`
301
342
  - `RELEASE_GATE_OVERRIDE_APPROVED`
302
343
  - `LEGACY_NOTES_SPRINT_UNRESOLVED`
303
344
  - `QUEUE_ENTRY_MISSING`
@@ -312,9 +353,27 @@ Required deterministic reason codes:
312
353
  - `BACKLOG_DONE_ACCEPTANCE_UNCHECKED`
313
354
  - `BACKLOG_DONE_TRACEABILITY_MISSING`
314
355
  - `BACKLOG_DONE_RELEASE_ARTIFACT_MISSING`
356
+ - `PUBLISH_TARGET_CONFIG_INVALID`
357
+ - `PUBLISH_CONFIRMATION_REQUIRED`
358
+ - `PUBLISH_TARGET_EXECUTION_FAILED`
315
359
 
316
360
  When any reason code is emitted:
317
361
  - Preserve existing release note artifacts (non-destructive default).
318
362
  - Do not auto-reconcile by deleting/rebuilding unrelated sprint history.
319
363
  - Provide actionable remediation steps and require rerun after correction.
320
364
 
365
+ ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
366
+
367
+ - Mutations in `/release` must comply with
368
+ `docs/engineering/artifact-ordering-policy.md`.
369
+ - Ordering expectations:
370
+ - `docs/engineering/state.md`: append-bottom checkpoint entries only.
371
+ - `docs/product/backlog.md` + `docs/product/acceptance.md`: target story
372
+ normalization while preserving sorted-canonical order.
373
+ - `handoffs/release_queue.md`: append one target sprint row/update in-place for
374
+ that row only.
375
+ - `handoffs/release_notes.md`: update latest pointer section first; keep
376
+ historical list stable.
377
+ - Missing/ambiguous placement anchors must fail with
378
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and no partial mutation.
379
+
@@ -0,0 +1,90 @@
1
+ ---
2
+ description: "its-magic status-reconcile: deterministic status normalization and resume readiness."
3
+ ---
4
+
5
+ # /status-reconcile
6
+
7
+ ## Subagents
8
+ - curator
9
+ - tech-lead
10
+
11
+ ## Execution model
12
+ - Run `/status-reconcile` in a fresh subagent context.
13
+ - This command performs bounded deterministic reconciliation writes.
14
+ - Reconciliation scope is workflow artifacts only (status surfaces + resume metadata).
15
+ - After writing outputs, stop and recommend next phase.
16
+
17
+ ## Inputs
18
+ - `docs/product/backlog.md` (canonical status source)
19
+ - `docs/product/acceptance.md` (derived checklist surface)
20
+ - `docs/engineering/state.md` (traceability + checkpoints)
21
+ - `handoffs/resume_brief.md` (continuation intent)
22
+ - `handoffs/release_queue.md` (release evidence context)
23
+ - `handoffs/releases/Sxxxx-release-notes.md` (target evidence when needed)
24
+ - `docs/engineering/status-normalization-report.md` (normalization audit log)
25
+
26
+ ## Outputs (artifacts)
27
+ - `docs/product/backlog.md` (target-scoped AC/status normalization when needed)
28
+ - `docs/product/acceptance.md` (derived checklist reconciliation)
29
+ - `handoffs/resume_brief.md` (next OPEN story + intended phase)
30
+ - `docs/engineering/status-normalization-report.md` (audit rows)
31
+ - `docs/engineering/state.md` (reconciliation checkpoint and evidence refs)
32
+
33
+ ## Stop conditions
34
+ - Canonical conflict requires decision gate
35
+ - Missing critical artifacts
36
+ - Ambiguous next OPEN story / phase resolution
37
+
38
+ ## Canonical precedence (US-0045 / DEC-0025)
39
+ - Story status authority is `docs/product/backlog.md` only.
40
+ - `docs/product/acceptance.md` and `docs/engineering/state.md` are derived views.
41
+ - Reconciliation must not infer canonical story status from derived artifacts.
42
+
43
+ ## Deterministic detection matrix
44
+ 1. Backlog story `Status: DONE` with unchecked AC checkboxes.
45
+ 2. Acceptance row state mismatched vs canonical backlog status.
46
+ 3. Resume intent (`next story`, `intended phase`) mismatched vs canonical OPEN backlog.
47
+ 4. Canonical/release evidence contradiction for target story (fail-closed path).
48
+
49
+ ## Reason codes (deterministic)
50
+ - `STATUS_RECONCILE_APPLIED`
51
+ - `STATUS_RECONCILE_NOOP`
52
+ - `STATUS_RECONCILE_MISSING_INPUT`
53
+ - `STATUS_RECONCILE_CANONICAL_CONFLICT`
54
+ - `STATUS_RECONCILE_PHASE_AMBIGUOUS`
55
+ - `STATUS_RECONCILE_EVIDENCE_MISSING`
56
+
57
+ ## Steps
58
+ 1. Read canonical and derived status artifacts.
59
+ 2. Build mismatch set using deterministic detection matrix.
60
+ 3. If no mismatches: write no-op report row + state checkpoint (`STATUS_RECONCILE_NOOP`) and stop.
61
+ 4. For each mismatched story (target-scoped only):
62
+ - If canonical status is `DONE`, normalize backlog AC checkboxes to checked state.
63
+ - Reconcile matching `docs/product/acceptance.md` row to checked state.
64
+ 5. Recompute next OPEN story by backlog priority/order:
65
+ - if exists, update `handoffs/resume_brief.md` to that story and intended phase `discovery`,
66
+ - if none exist, set intended phase `intake`.
67
+ 6. Write normalization evidence row(s) to `docs/engineering/status-normalization-report.md`:
68
+ - story id, prior values, resolved values, reason code, evidence refs, timestamp.
69
+ 7. Append reconciliation checkpoint to `docs/engineering/state.md` with:
70
+ - `phase_id=status-reconcile`
71
+ - `role=curator`
72
+ - `fresh_context_marker`
73
+ - `timestamp`
74
+ - `evidence_ref`
75
+ 8. On conflict paths (canonical/release contradiction, ambiguous phase, missing evidence):
76
+ - fail closed with deterministic reason code,
77
+ - write remediation guidance,
78
+ - avoid partial mutation.
79
+
80
+ ## Deterministic artifact ordering contract (US-0058 / DEC-0040)
81
+
82
+ - Reconciliation writes must follow
83
+ `docs/engineering/artifact-ordering-policy.md`.
84
+ - `docs/product/backlog.md` and `docs/product/acceptance.md` updates are
85
+ target-scoped and preserve sorted-canonical story order.
86
+ - `docs/engineering/state.md` reconciliation checkpoints are append-bottom only.
87
+ - `handoffs/resume_brief.md` updates are prepend-top in current-status section
88
+ without rewriting unrelated blocks.
89
+ - Missing or ambiguous anchors must fail with
90
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS` and no partial mutation.
@@ -66,6 +66,22 @@ Remediation: re-run the missing/invalid phase(s) in fresh subagent contexts and
66
66
  write new isolation evidence, then rerun `/verify-work` before proceeding to
67
67
  `/release`.
68
68
 
69
+ ## Strict runtime proof gate (US-0056 / DEC-0038)
70
+
71
+ Before handing off to `/release`, verify strict runtime proof tuples are present
72
+ and valid for the target lifecycle phases (`execute`, `qa`, `verify-work`).
73
+
74
+ Fail-closed behavior (no continuation):
75
+
76
+ - Missing runtime proof tuple: `RUNTIME_PROOF_MISSING`
77
+ - Invalid tuple shape/hash/linkage: `RUNTIME_PROOF_INVALID`
78
+ - Reused `runtime_proof_id`: `RUNTIME_PROOF_REUSED`
79
+ - Expired proof TTL/stale proof: `RUNTIME_PROOF_STALE`
80
+ - Ambiguous proof-to-checkpoint mapping: `RUNTIME_PROOF_AMBIGUOUS_LINK`
81
+
82
+ Remediation: rerun affected phase(s) in fresh subagent contexts and write new
83
+ strict-proof tuples linked to checkpoint evidence.
84
+
69
85
  ## Steps
70
86
  1. Convert acceptance criteria into testable UAT steps. Derive steps directly from the story's acceptance criteria in `docs/product/acceptance.md`. Each AC should map to at least one UAT step.
71
87
  2. Populate UAT artifacts: write derived steps into `uat.json` (with description and result per step, accurate pass/fail counts) and `uat.md` (step list with results, summary section). Ensure UAT artifacts are in **populated** state per DEC-0009 — not placeholder.
@@ -1,42 +1,152 @@
1
1
  # its-magic scratchpad (local overrides example)
2
2
  #
3
- # Copy this file to `.cursor/scratchpad.local.md` and set your personal values.
4
- # This file is intended to stay local and is gitignored.
3
+ # Copy this file to `.cursor/scratchpad.local.md` and set personal overrides.
4
+ # Local values override `.cursor/scratchpad.md` and should stay gitignored.
5
5
  #
6
- # Team identity / ownership
7
- # - TEAM_MODE: 0|1
8
- # - TEAM_MEMBER: short id for current developer
9
- # - ACTIVE_TASK_IDS: comma-separated task ids (for example T-12,T-13)
10
- TEAM_MODE=0
11
- TEAM_MEMBER=
12
- ACTIVE_TASK_IDS=
6
+ # Core behavior
7
+ # - MAGIC_CONTEXT_STRICT: 0|1 (require context refresh after code changes)
8
+ # - LOOP_UNTIL_GREEN: 0|1 (optional test loop)
9
+ # - RUN_TESTS_ON_EDIT: 0|1 (run tests after edits)
10
+ # - AUTO_IMPLEMENTATION_LOOP: 0|1 (auto cycle execute->qa->execute)
11
+ # - AUTO_LOOP_MAX_CYCLES: integer >= 1 (safety guard)
12
+ # - AUTO_PAUSE_REQUEST: 0|1 (request graceful stop at next safe boundary)
13
+ # - AUTO_PAUSE_POLICY: after_task|after_phase (safe stop boundary)
14
+ # - DONE: 0|1 (stop hook loops)
15
+ MAGIC_CONTEXT_STRICT=1
16
+ LOOP_UNTIL_GREEN=0
17
+ RUN_TESTS_ON_EDIT=0
18
+ AUTO_IMPLEMENTATION_LOOP=0
19
+ AUTO_LOOP_MAX_CYCLES=5
20
+ AUTO_PAUSE_REQUEST=0
21
+ AUTO_PAUSE_POLICY=after_phase
22
+ DONE=0
23
+ #
24
+ # Benchmarking
25
+ # - MAGIC_BENCH_SESSION: free-form id for live benchmark logging
26
+ MAGIC_BENCH_SESSION=
13
27
  #
14
- # Personal automation style
28
+ # Automation
29
+ # - AUTO_FLOW_MODE: manual|auto_until_decision
15
30
  # - PHASE_MODE: interactive|auto
16
31
  # - PERMISSION_MODE: interactive|auto
17
- # - RUN_TESTS_ON_EDIT: 0|1
18
- # - LOOP_UNTIL_GREEN: 0|1
19
- # - AUTO_IMPLEMENTATION_LOOP: 0|1
20
- # - AUTO_LOOP_MAX_CYCLES: integer >= 1
21
- # - AUTO_PAUSE_POLICY: after_task|after_phase
32
+ # - AUTO_INSTALL_DEPS: 0|1
33
+ # - AUTO_RELEASE_NOTES: 0|1
34
+ # - AUTO_BACKLOG_DRAIN: 0|1 (continue across multiple stories when enabled)
35
+ # - AUTO_BACKLOG_MAX_STORIES: integer >= 1 (max stories per auto run when drain enabled)
36
+ # - AUTO_BACKLOG_ON_BLOCK: stop|skip (behavior when a story blocks)
37
+ # - AUTO_STORY_SELECTION: priority_then_backlog_order
38
+ # - AUTO_EXECUTE_BULK: 0|1 (explicit bulk execute orchestration mode)
39
+ # - AUTO_EXECUTE_MAX_ITEMS: integer >= 1 (max planned items per bulk execute run)
40
+ # - AUTO_EXECUTE_ON_BLOCK: stop|skip (behavior when a planned item blocks)
41
+ # - AUTO_EXECUTE_SELECTION: planned_then_priority
42
+ # - AUTO_TEAM_SCOPE_ENFORCE: 0|1 (when TEAM_MODE=1, enforce TEAM_MEMBER + ACTIVE_TASK_IDS)
43
+ AUTO_FLOW_MODE=auto_until_decision
22
44
  PHASE_MODE=interactive
23
45
  PERMISSION_MODE=interactive
24
- RUN_TESTS_ON_EDIT=0
25
- LOOP_UNTIL_GREEN=0
26
- AUTO_IMPLEMENTATION_LOOP=0
27
- AUTO_LOOP_MAX_CYCLES=5
28
- AUTO_PAUSE_POLICY=after_phase
46
+ AUTO_INSTALL_DEPS=0
47
+ AUTO_RELEASE_NOTES=1
48
+ AUTO_BACKLOG_DRAIN=0
49
+ AUTO_BACKLOG_MAX_STORIES=1
50
+ AUTO_BACKLOG_ON_BLOCK=stop
51
+ AUTO_STORY_SELECTION=priority_then_backlog_order
52
+ AUTO_EXECUTE_BULK=0
53
+ AUTO_EXECUTE_MAX_ITEMS=1
54
+ AUTO_EXECUTE_ON_BLOCK=stop
55
+ AUTO_EXECUTE_SELECTION=planned_then_priority
56
+ AUTO_TEAM_SCOPE_ENFORCE=1
57
+ #
58
+ # Team mode
59
+ # - TEAM_MODE: 0|1 (enable task/member scoped team workflow)
60
+ # - TEAM_MEMBER: short id for current developer
61
+ # - ACTIVE_TASK_IDS: comma-separated task ids (for example T-12,T-13)
62
+ TEAM_MODE=0
63
+ TEAM_MEMBER=
64
+ ACTIVE_TASK_IDS=
29
65
  #
30
- # Sprint planning (override team defaults)
31
- # - SPRINT_MAX_TASKS: integer >= 1 (max atomic tasks per sprint)
66
+ # Sprint planning
67
+ # - SPRINT_MAX_TASKS: integer >= 1 (max atomic tasks per sprint, default 12)
32
68
  # - SPRINT_AUTO_SPLIT: 0|1 (propose splitting when over threshold)
69
+ # - SPRINT_BULK_MAX_STORIES: integer >= 1 (candidate stories when /sprint-plan --bulk)
70
+ # - SPRINT_BULK_MAX_SPRINTS: integer >= 1 (generated sprints per /sprint-plan --bulk run)
71
+ # - SPRINT_BULK_SELECTION: priority_then_backlog_order
33
72
  SPRINT_MAX_TASKS=12
34
73
  SPRINT_AUTO_SPLIT=1
74
+ SPRINT_BULK_MAX_STORIES=5
75
+ SPRINT_BULK_MAX_SPRINTS=3
76
+ SPRINT_BULK_SELECTION=priority_then_backlog_order
35
77
  #
36
- # Personal environment preferences
37
- # - AUTO_INSTALL_DEPS: 0|1
78
+ # Remote execution
38
79
  # - REMOTE_EXECUTION: 0|1
39
- # - REMOTE_CONFIG: path to your local remote config
40
- AUTO_INSTALL_DEPS=0
80
+ # - REMOTE_CONFIG: path to remote config
41
81
  REMOTE_EXECUTION=0
42
82
  REMOTE_CONFIG=.cursor/remote.json
83
+ #
84
+ # Sync policy
85
+ # - SYNC_POLICY_MODE: disabled|manual|by_phase|by_milestone|custom_phase_list
86
+ # - SYNC_CUSTOM_PHASES: comma-separated canonical phase IDs; only used when
87
+ # SYNC_POLICY_MODE=custom_phase_list
88
+ # - ALLOW_AUTO_PUSH: 0|1 (default off; explicit opt-in required)
89
+ # - AUTO_PUSH_BRANCH_ALLOWLIST: comma-separated branches/patterns eligible for
90
+ # auto-push. Protected/default branches are denied unless allowlisted.
91
+ SYNC_POLICY_MODE=manual
92
+ SYNC_CUSTOM_PHASES=
93
+ ALLOW_AUTO_PUSH=0
94
+ AUTO_PUSH_BRANCH_ALLOWLIST=
95
+ #
96
+ # Knowledge curation / intake
97
+ # - EARLY_RESEARCH: 0|1 (PO/TL search web during intake/architecture)
98
+ # - INTAKE_GUIDED_MODE: 0|1 (guided intake follow-up/options/research behavior)
99
+ # - ID_NAMESPACE_BOOTSTRAP: 0|1 (optional fresh-project ID bootstrap mode; when 1, allow first IDs to start at 0001 only if deterministic freshness checks pass)
100
+ # - TOKEN_PROFILE: lean|balanced|full (tiered token-cost profile defaults)
101
+ # - lean: lowest-token default profile; reduce non-critical automation/research intensity
102
+ # - balanced: default profile; preserves current behavior with moderate overhead
103
+ # - full: highest-context profile; maximize context breadth/autonomy
104
+ # - Manual-override precedence: explicit flag values in this file remain authoritative
105
+ # for that flag and override profile defaults.
106
+ EARLY_RESEARCH=1
107
+ INTAKE_GUIDED_MODE=1
108
+ ID_NAMESPACE_BOOTSTRAP=0
109
+ TOKEN_PROFILE=balanced
110
+ #
111
+ # Publish targets
112
+ # - RELEASE_PUBLISH_MODE: disabled|confirm|auto
113
+ # - disabled: skip post-release publish target execution
114
+ # - confirm: require explicit operator confirmation before publish (default)
115
+ # - auto: allow publish without confirmation (explicit opt-in)
116
+ # - RELEASE_TARGETS_FILE: canonical target config path
117
+ # - RELEASE_TARGETS_DEFAULT: comma-separated default target IDs (optional)
118
+ RELEASE_PUBLISH_MODE=confirm
119
+ RELEASE_TARGETS_FILE=docs/engineering/release-targets.json
120
+ RELEASE_TARGETS_DEFAULT=
121
+ #
122
+ # Security review
123
+ # - SECURITY_REVIEW: 0|1 (enable optional security/compliance review; default off)
124
+ # - COMPLIANCE_PROFILES: comma-separated values (GDPR,SOC2,HIPAA,PCI-DSS,ISO27001)
125
+ # Empty value means general security best practices only.
126
+ # When SECURITY_REVIEW=0, the workflow adds zero security-review overhead.
127
+ SECURITY_REVIEW=0
128
+ COMPLIANCE_PROFILES=GDPR
129
+ #
130
+ # Compatibility observability
131
+ # - CROSS_REPO_OBSERVABILITY: 0|1 (enable compatibility visibility and checks)
132
+ # - COMPATIBILITY_GATE_ON_CRITICAL: 0|1 (when enabled, critical unresolved
133
+ # compatibility findings trigger decision gate before release)
134
+ # - COMPATIBILITY_SOURCES: semicolon-separated sources
135
+ # (repo=<path|url>,module=<id>,contract=<path|url>,docs=<path|url>)
136
+ CROSS_REPO_OBSERVABILITY=0
137
+ COMPATIBILITY_GATE_ON_CRITICAL=1
138
+ COMPATIBILITY_SOURCES=
139
+ #
140
+ # Component scope
141
+ # - COMPONENT_SCOPE_MODE: 0|1 (enable scoped planning/execution guardrails)
142
+ # - TARGET_COMPONENTS: comma-separated component IDs intended in scope
143
+ COMPONENT_SCOPE_MODE=0
144
+ TARGET_COMPONENTS=
145
+ #
146
+ # Optional docs packs
147
+ # - SPEC_PACK_MODE: 0|1 (enable Design Concept, CRS, Technical Spec generation/validation; default 0)
148
+ # When 0, intake/architecture/release add no required spec-pack steps.
149
+ # - USER_GUIDE_MODE: 0|1 (enable per-feature user guides at docs/user-guides/US-xxxx.md; default 0)
150
+ # When 0, intake/architecture/sprint-plan/execute/qa/release add no required user-guide steps or blocking checks.
151
+ SPEC_PACK_MODE=0
152
+ USER_GUIDE_MODE=0
@@ -101,6 +101,17 @@ INTAKE_GUIDED_MODE=1
101
101
  ID_NAMESPACE_BOOTSTRAP=0
102
102
  TOKEN_PROFILE=balanced
103
103
 
104
+ # Publish targets (US-0054)
105
+ # - RELEASE_PUBLISH_MODE: disabled|confirm|auto
106
+ # - disabled: skip post-release publish target execution
107
+ # - confirm: require explicit operator confirmation before publish (default)
108
+ # - auto: allow publish without confirmation (explicit opt-in)
109
+ # - RELEASE_TARGETS_FILE: canonical target config path
110
+ # - RELEASE_TARGETS_DEFAULT: comma-separated default target IDs (optional)
111
+ RELEASE_PUBLISH_MODE=confirm
112
+ RELEASE_TARGETS_FILE=docs/engineering/release-targets.json
113
+ RELEASE_TARGETS_DEFAULT=
114
+
104
115
  #
105
116
  # Security review
106
117
  # - SECURITY_REVIEW: 0|1 (enable optional security/compliance review; default off)
@@ -199,6 +199,18 @@ Setup:
199
199
  2. Set personal values there (`TEAM_MEMBER`, `ACTIVE_TASK_IDS`, automation style)
200
200
  3. Hook merges shared + local (local wins)
201
201
 
202
+ Upgrade behavior (US-0057):
203
+ - `.cursor/scratchpad.local.example.md` is framework-owned and refreshed on `--mode upgrade`.
204
+ - `.cursor/scratchpad.local.md` is user-owned and preserved on `--mode upgrade`.
205
+ - Installer output includes scratchpad example refresh status and local-preserved signal.
206
+
207
+ Deterministic ordering behavior (US-0058):
208
+ - Mutable artifacts follow `docs/engineering/artifact-ordering-policy.md`.
209
+ - `state.md` checkpoints are append-bottom; `backlog.md` and `acceptance.md`
210
+ remain sorted-canonical by story ID.
211
+ - Commands fail closed on ambiguous placement anchors using
212
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
213
+
202
214
  ## Workflow
203
215
 
204
216
  ### Core commands
@@ -303,6 +315,41 @@ Compaction behavior:
303
315
  - bounded expansion only when unresolved
304
316
  - explicit "not found in artifacts" when still unresolved
305
317
 
318
+ ### Configurable multi-target publish + confirmation gate (US-0054)
319
+
320
+ Post-release publish behavior is configurable per repository:
321
+
322
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto` (default `confirm`)
323
+ - `RELEASE_TARGETS_FILE=docs/engineering/release-targets.json`
324
+ - `RELEASE_TARGETS_DEFAULT=` optional comma-separated default targets
325
+
326
+ Supported target types include:
327
+
328
+ - `npm`, `choco`, `brew`, `git`, `docker`, `cloud`
329
+ - `custom` (generic command target)
330
+ - `ssh` (generic server deployment over SSH)
331
+
332
+ Safety defaults:
333
+
334
+ - Mandatory `/release` gates are unchanged and must pass first.
335
+ - `confirm` mode enforces explicit operator approval before publish execution.
336
+ - Sensitive values are env-referenced (for example `tokenEnv`, `authEnv`), not
337
+ inline literals.
338
+
339
+ ### Deterministic status reconciliation command (US-0055)
340
+
341
+ Use `/status-reconcile` to normalize status drift between canonical and derived
342
+ workflow artifacts before continuation:
343
+
344
+ - canonical source: `docs/product/backlog.md` story status
345
+ - derived targets: `docs/product/acceptance.md`, `docs/engineering/state.md`,
346
+ `handoffs/resume_brief.md`
347
+ - deterministic outcomes: apply/no-op/fail-safe reason codes with audit evidence
348
+ in `docs/engineering/status-normalization-report.md`
349
+
350
+ This command is the bounded repair counterpart to `/memory-audit`
351
+ (read-only detection).
352
+
306
353
  ### Optional cross-repo observability (US-0034)
307
354
 
308
355
  Use optional compatibility visibility with default-safe off behavior:
@@ -456,6 +503,21 @@ Missing/invalid/stale evidence fails closed with reason codes:
456
503
  `PHASE_CONTEXT_ISOLATION_MISSING`, `PHASE_CONTEXT_ISOLATION_VIOLATION`,
457
504
  `ISOLATION_EVIDENCE_STALE`, `ISOLATION_EVIDENCE_INVALID`.
458
505
 
506
+ #### Strict runtime proof (US-0056 / DEC-0038)
507
+
508
+ Per-phase isolation also requires strict runtime attestation tuples at
509
+ boundaries (not artifact fields alone):
510
+
511
+ - `orchestrator_run_id`, `runtime_proof_id`, `phase_id`, `role`
512
+ - `proof_issued_at`, `proof_ttl_seconds`, `proof_hash`
513
+
514
+ Fail-closed reason codes:
515
+ `RUNTIME_PROOF_MISSING`, `RUNTIME_PROOF_INVALID`, `RUNTIME_PROOF_REUSED`,
516
+ `RUNTIME_PROOF_STALE`, `RUNTIME_PROOF_AMBIGUOUS_LINK`.
517
+
518
+ `/auto`, `/verify-work`, and `/release` must validate these tuples before
519
+ continuation/finalization.
520
+
459
521
  ### Lightweight interaction
460
522
 
461
523
  Use `/ask` when you want to query the project without triggering the workflow:
@@ -0,0 +1,29 @@
1
+ # Artifact Ordering Policy (US-0058 / DEC-0040)
2
+
3
+ This policy defines deterministic write order for mutable workflow artifacts.
4
+ Commands that mutate these artifacts must use this matrix and fail safe when
5
+ anchors are missing or ambiguous.
6
+
7
+ ## Canonical matrix
8
+
9
+ | Artifact | Policy | Deterministic rule |
10
+ |---|---|---|
11
+ | `docs/engineering/state.md` | `append-bottom` | Add new checkpoints only at end of file, in chronological order. |
12
+ | `docs/product/backlog.md` | `sorted-canonical` | Keep stories sorted by numeric `US-xxxx` ID; mutate only target story block. |
13
+ | `docs/product/acceptance.md` | `sorted-canonical` | Keep `US-xxxx` rows ordered by numeric ID aligned to backlog order. |
14
+ | `handoffs/release_queue.md` | `append-bottom` | Append only one row per new sprint in release order. |
15
+ | `handoffs/release_notes.md` | `prepend-top` | Update latest pointer section first; preserve historical references list. |
16
+ | `handoffs/resume_brief.md` | `prepend-top` | Update current status/next-actions sections without rewriting unrelated history. |
17
+
18
+ ## Idempotence contract
19
+
20
+ - Re-running a command without semantic changes must not reorder rows/blocks.
21
+ - No oscillation between top and bottom insertion paths.
22
+ - No broad rewrites of unrelated story/sprint entries.
23
+
24
+ ## Fail-safe behavior
25
+
26
+ If required placement anchors are missing or ambiguous:
27
+ - stop with reason code `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`,
28
+ - emit remediation guidance with expected anchor and file path,
29
+ - perform no partial mutation.
@@ -0,0 +1,64 @@
1
+ {
2
+ "version": 1,
3
+ "selectionPolicy": "explicit_or_default",
4
+ "targets": [
5
+ {
6
+ "id": "npm-public",
7
+ "type": "npm",
8
+ "enabled": false,
9
+ "order": 10,
10
+ "command": "npm publish",
11
+ "workingDirectory": "."
12
+ },
13
+ {
14
+ "id": "choco",
15
+ "type": "choco",
16
+ "enabled": false,
17
+ "order": 20,
18
+ "command": "choco push packaging/chocolatey/its-magic.*.nupkg --source %CHOCO_SOURCE%",
19
+ "tokenEnv": "CHOCO_API_KEY"
20
+ },
21
+ {
22
+ "id": "brew-tap",
23
+ "type": "brew",
24
+ "enabled": false,
25
+ "order": 30,
26
+ "command": "git push origin HEAD",
27
+ "tokenEnv": "GITHUB_TOKEN"
28
+ },
29
+ {
30
+ "id": "dockerhub",
31
+ "type": "docker",
32
+ "enabled": false,
33
+ "order": 40,
34
+ "command": "docker push %DOCKER_IMAGE%",
35
+ "tokenEnv": "DOCKER_TOKEN"
36
+ },
37
+ {
38
+ "id": "aws-deploy",
39
+ "type": "cloud",
40
+ "enabled": false,
41
+ "order": 50,
42
+ "command": "aws deploy create-deployment --application-name %APP_NAME% --deployment-group-name %DEPLOY_GROUP% --s3-location bucket=%S3_BUCKET%,bundleType=zip,key=%BUNDLE_KEY%",
43
+ "credentialEnv": "AWS_PROFILE"
44
+ },
45
+ {
46
+ "id": "custom-release-hook",
47
+ "type": "custom",
48
+ "enabled": false,
49
+ "order": 60,
50
+ "command": "powershell -ExecutionPolicy Bypass -File scripts/publish-custom.ps1"
51
+ },
52
+ {
53
+ "id": "ssh-server",
54
+ "type": "ssh",
55
+ "enabled": false,
56
+ "order": 70,
57
+ "hostEnv": "SSH_HOST",
58
+ "port": 22,
59
+ "userEnv": "SSH_USER",
60
+ "authEnv": "SSH_PRIVATE_KEY",
61
+ "remoteCommand": "cd /opt/its-magic && ./deploy.sh"
62
+ }
63
+ ]
64
+ }
@@ -139,6 +139,65 @@ Context compaction policy:
139
139
  - If unresolved after bounded expansion, answer with explicit "not found in
140
140
  current artifacts" rather than broad speculative reads.
141
141
 
142
+ ## Configurable multi-target publish mode (US-0054 / DEC-0036)
143
+
144
+ Post-release publish orchestration is configurable and default-safe:
145
+
146
+ - `RELEASE_PUBLISH_MODE=disabled|confirm|auto` (default `confirm`)
147
+ - `RELEASE_TARGETS_FILE=docs/engineering/release-targets.json`
148
+ - `RELEASE_TARGETS_DEFAULT=` optional comma-separated default target IDs
149
+
150
+ Target schema contract:
151
+
152
+ - Canonical target config file: `docs/engineering/release-targets.json`
153
+ - Supported target types:
154
+ - `npm`, `choco`, `brew`, `git`, `docker`, `cloud`
155
+ - `custom` (generic command target)
156
+ - `ssh` (host/user/port/auth reference + remote command)
157
+ - Each target entry must define deterministic fields:
158
+ - `id` (stable unique target ID)
159
+ - `type`
160
+ - `enabled` (`true|false`)
161
+ - `order` (deterministic execution ordering)
162
+ - execution details (`command` for non-ssh, `remoteCommand` + host/user/auth refs for `ssh`)
163
+
164
+ Safety contract:
165
+
166
+ - Mandatory release gates remain unchanged and must pass before any publish
167
+ target execution.
168
+ - `confirm` mode requires explicit operator approval before publish execution.
169
+ - Sensitive fields must be env-referenced (`*Env` keys); inline secret literals
170
+ are not allowed.
171
+ - Invalid target config must fail fast with deterministic diagnostics and no
172
+ partial side effects.
173
+
174
+ ## Deterministic status reconciliation mode (US-0055 / DEC-0037)
175
+
176
+ Use the dedicated reconciliation command to normalize status drift across
177
+ canonical and derived artifacts:
178
+
179
+ - Command: `/status-reconcile`
180
+ - Canonical source: `docs/product/backlog.md` (story `Status`)
181
+ - Derived surfaces: `docs/product/acceptance.md`, `docs/engineering/state.md`,
182
+ `handoffs/resume_brief.md`
183
+
184
+ Deterministic behavior:
185
+
186
+ - Detects mismatches (for example DONE + unchecked ACs, acceptance drift, resume drift).
187
+ - Applies target-scoped reconciliation only to mismatched story blocks/rows.
188
+ - Preserves canonical ownership; derived artifacts reconcile to backlog status.
189
+ - Updates `handoffs/resume_brief.md` to next OPEN story and intended phase.
190
+ - Writes auditable rows to `docs/engineering/status-normalization-report.md`.
191
+
192
+ Reason-code baseline:
193
+
194
+ - `STATUS_RECONCILE_APPLIED`
195
+ - `STATUS_RECONCILE_NOOP`
196
+ - `STATUS_RECONCILE_MISSING_INPUT`
197
+ - `STATUS_RECONCILE_CANONICAL_CONFLICT`
198
+ - `STATUS_RECONCILE_PHASE_AMBIGUOUS`
199
+ - `STATUS_RECONCILE_EVIDENCE_MISSING`
200
+
142
201
  ## Optional cross-repo observability mode (US-0034)
143
202
 
144
203
  Compatibility visibility is optional and default-off in `.cursor/scratchpad.md`:
@@ -463,6 +522,37 @@ and write new isolation evidence before proceeding.
463
522
  revert unsafe artifacts if needed, rerun the phase correctly, and ensure
464
523
  orchestration-only behavior.
465
524
 
525
+ ## Strict runtime proof contract (US-0056 / DEC-0038)
526
+
527
+ Strict runtime proof augments artifact-level isolation evidence. `/auto`,
528
+ `/verify-work`, and `/release` must validate runtime attestation tuples at phase
529
+ boundaries before continuation/finalization.
530
+
531
+ Required runtime attestation tuple fields:
532
+
533
+ - `orchestrator_run_id`
534
+ - `runtime_proof_id` (unique per phase run)
535
+ - `phase_id`
536
+ - `role`
537
+ - `proof_issued_at` (ISO UTC / RFC3339)
538
+ - `proof_ttl_seconds`
539
+ - `proof_hash`
540
+
541
+ Deterministic fail-closed reason codes:
542
+
543
+ - `RUNTIME_PROOF_MISSING`
544
+ - `RUNTIME_PROOF_INVALID`
545
+ - `RUNTIME_PROOF_REUSED`
546
+ - `RUNTIME_PROOF_STALE`
547
+ - `RUNTIME_PROOF_AMBIGUOUS_LINK`
548
+
549
+ Boundary behavior:
550
+
551
+ - Missing/invalid/reused/stale/ambiguous runtime proof blocks progression.
552
+ - Release finalization must consume strict runtime proof in addition to existing
553
+ isolation evidence checks.
554
+ - Pause/resume provenance must reference latest valid strict-proof boundary.
555
+
466
556
  ## Optional backlog-drain auto mode (US-0044)
467
557
 
468
558
  `/auto` can optionally continue across multiple planned stories when explicitly
@@ -713,11 +803,40 @@ Use this matrix to validate end-to-end installer/CLI lifecycle behavior:
713
803
  |---|---|---|---|
714
804
  | Fresh install (`missing`) | `its-magic --mode missing --create` and direct installer | `tests/run-tests.ps1`, `tests/run-tests.sh` | Required files exist + `.its-magic-version` exists |
715
805
  | Overwrite + backup | `its-magic --mode overwrite --backup` and direct installer | `tests/run-tests.ps1`, `tests/run-tests.sh` | Backup snapshot contains overwritten framework file |
716
- | Upgrade lifecycle | `its-magic --mode upgrade` and direct installer | `tests/run-tests.ps1`, `tests/run-tests.sh`, npm local tests | Framework file restored, user-data file preserved |
806
+ | Upgrade lifecycle | `its-magic --mode upgrade` and direct installer | `tests/run-tests.ps1`, `tests/run-tests.sh`, npm local tests | Framework file restored, scratchpad example refreshed, user local scratchpad preserved |
717
807
  | Clean-repo safety | `its-magic --clean-repo --yes` and direct installer clean path | `tests/run-tests.ps1`, `tests/run-tests.sh`, CI lifecycle subset | Framework artifacts removed, non-framework marker preserved |
718
808
  | Negative path | invalid mode/args | `tests/run-tests.ps1`, `tests/run-tests.sh` | Deterministic non-zero fail-fast behavior |
719
809
  | Platform parity subset | npm/brew/choco CI jobs | `.github/workflows/ci.yml` | Lifecycle subset passes on all three runners |
720
810
 
811
+ ## Scratchpad example upgrade contract (US-0057 / DEC-0039)
812
+
813
+ `its-magic --mode upgrade` treats `.cursor/scratchpad.local.example.md` as
814
+ framework-owned and `.cursor/scratchpad.local.md` as user-owned.
815
+
816
+ Expected deterministic outcome:
817
+ - Framework-owned example is refreshed to latest release contract.
818
+ - User local scratchpad remains preserved without overwrite.
819
+ - Installer output reports scratchpad example refresh status
820
+ (`added|updated|unchanged`) and preservation signal for user local file.
821
+
822
+ ## Deterministic artifact ordering and write discipline (US-0058 / DEC-0040)
823
+
824
+ Canonical policy source:
825
+ - `docs/engineering/artifact-ordering-policy.md`
826
+
827
+ Required write discipline:
828
+ - `docs/engineering/state.md`: append-bottom checkpoint writes only.
829
+ - `docs/product/backlog.md`: sorted-canonical story ordering by numeric `US-xxxx`.
830
+ - `docs/product/acceptance.md`: sorted-canonical row ordering aligned to backlog.
831
+ - Handoff surfaces use explicit policy (`prepend-top` or `append-bottom`) per
832
+ matrix and command contract.
833
+
834
+ Fail-safe contract:
835
+ - Missing/ambiguous placement anchors fail closed with
836
+ `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`.
837
+ - No partial mutation on fail-safe path.
838
+ - Re-run without semantic changes must be ordering-idempotent.
839
+
721
840
  Execution guidance:
722
841
  - Local baseline: run `sh tests/run-tests.sh` (or `powershell -ExecutionPolicy Bypass -File tests/run-tests.ps1`).
723
842
  - Packaging smoke: run npm local tests in `packaging/npm/`.