its-magic 0.1.2-9 → 0.1.2

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 (232) hide show
  1. package/README.md +1602 -755
  2. package/bin/its-magic.js +121 -11
  3. package/bin/postinstall.js +21 -0
  4. package/installer.ps1 +759 -0
  5. package/installer.py +981 -0
  6. package/installer.sh +649 -0
  7. package/package.json +18 -14
  8. package/scripts/check_intake_template_parity.py +284 -0
  9. package/scripts/doc_profile_lib.py +415 -0
  10. package/scripts/guard_installer_publish.py +88 -0
  11. package/scripts/intake_bug_routing_guard.py +67 -0
  12. package/scripts/intake_evidence_lib.py +802 -0
  13. package/scripts/intake_evidence_validate.py +73 -0
  14. package/scripts/materialize_codebase_map.py +184 -0
  15. package/scripts/remote_config_summary.py +243 -0
  16. package/template/.cursor/agents/curator.mdc +35 -0
  17. package/template/.cursor/agents/dev.mdc +29 -0
  18. package/template/.cursor/agents/po.mdc +141 -0
  19. package/template/.cursor/agents/qa.mdc +28 -0
  20. package/template/.cursor/agents/release.mdc +28 -0
  21. package/template/.cursor/agents/security.mdc +98 -0
  22. package/template/.cursor/agents/tech-lead.mdc +57 -0
  23. package/template/.cursor/commands/architecture.md +127 -0
  24. package/template/.cursor/commands/ask.md +55 -0
  25. package/template/.cursor/commands/auto.md +533 -0
  26. package/template/.cursor/commands/discovery.md +47 -0
  27. package/template/.cursor/commands/execute.md +343 -0
  28. package/template/.cursor/commands/intake.md +323 -0
  29. package/template/.cursor/commands/map-codebase.md +46 -0
  30. package/template/.cursor/commands/memory-audit.md +175 -0
  31. package/template/.cursor/commands/milestone-complete.md +51 -0
  32. package/template/.cursor/commands/milestone-start.md +59 -0
  33. package/template/.cursor/commands/pause.md +64 -0
  34. package/{.cursor/commands/gsd-phase-context.md → template/.cursor/commands/phase-context.md} +6 -2
  35. package/template/.cursor/commands/plan-verify.md +34 -0
  36. package/template/.cursor/commands/qa.md +226 -0
  37. package/template/.cursor/commands/quick.md +41 -0
  38. package/template/.cursor/commands/refresh-context.md +82 -0
  39. package/template/.cursor/commands/release.md +505 -0
  40. package/template/.cursor/commands/research.md +49 -0
  41. package/template/.cursor/commands/resume.md +67 -0
  42. package/template/.cursor/commands/security-review.md +81 -0
  43. package/template/.cursor/commands/sprint-plan.md +103 -0
  44. package/template/.cursor/commands/status-reconcile.md +95 -0
  45. package/template/.cursor/commands/verify-work.md +152 -0
  46. package/template/.cursor/dev-environment.json.example +22 -0
  47. package/{.cursor → template/.cursor}/hooks/README.md +3 -2
  48. package/{.cursor/hooks/gsd-hook.py → template/.cursor/hooks/hook.py} +15 -6
  49. package/template/.cursor/hooks.json +26 -0
  50. package/template/.cursor/remote.json +31 -0
  51. package/template/.cursor/rules/caveman.mdc +184 -0
  52. package/template/.cursor/rules/coding-standards.mdc +39 -0
  53. package/template/.cursor/rules/core.mdc +111 -0
  54. package/template/.cursor/rules/handoffs.mdc +27 -0
  55. package/template/.cursor/rules/quality.mdc +49 -0
  56. package/template/.cursor/scratchpad.local.example.md +323 -0
  57. package/template/.cursor/scratchpad.md +324 -0
  58. package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/SKILL.md +2 -2
  59. package/template/.cursorignore +6 -0
  60. package/template/.env.example +28 -0
  61. package/template/.github/workflows/ci.yml +194 -0
  62. package/{.github → template/.github}/workflows/deploy.yml +5 -2
  63. package/template/.its-magic-version +1 -0
  64. package/template/README.md +1602 -0
  65. package/template/decisions/DEC-0001.md +11 -0
  66. package/template/decisions/DEC-0002.md +11 -0
  67. package/template/docs/developer/README.md +44 -0
  68. package/template/docs/engineering/architecture.md +9 -0
  69. package/template/docs/engineering/artifact-ordering-policy.md +48 -0
  70. package/template/docs/engineering/artifact-ownership-policy.md +57 -0
  71. package/template/docs/engineering/auto-orchestration-reference.md +1211 -0
  72. package/{docs → template/docs}/engineering/codebase-map.md +0 -5
  73. package/template/docs/engineering/compatibility-report.md +20 -0
  74. package/template/docs/engineering/compatibility-signals.md +7 -0
  75. package/template/docs/engineering/component-scope-report.md +16 -0
  76. package/template/docs/engineering/component-scope.md +19 -0
  77. package/template/docs/engineering/context/installer-owned-paths.manifest +96 -0
  78. package/template/docs/engineering/context/readme-section-affinity.json +30 -0
  79. package/template/docs/engineering/decisions.md +16 -0
  80. package/template/docs/engineering/legacy-drift-audit.md +21 -0
  81. package/template/docs/engineering/manifests/components/api-gateway.manifest.yaml +12 -0
  82. package/template/docs/engineering/manifests/registry.manifest.yaml +20 -0
  83. package/template/docs/engineering/manifests/repo.manifest.yaml +11 -0
  84. package/template/docs/engineering/phase-context.md +16 -0
  85. package/template/docs/engineering/release-targets.json +123 -0
  86. package/template/docs/engineering/research.md +29 -0
  87. package/template/docs/engineering/runbook.md +2320 -0
  88. package/template/docs/engineering/runtime-connectivity.md +81 -0
  89. package/template/docs/engineering/security-review.md +33 -0
  90. package/template/docs/engineering/spec-pack/README.md +20 -0
  91. package/template/docs/engineering/state-archive/README.md +15 -0
  92. package/template/docs/engineering/state.md +20 -0
  93. package/template/docs/engineering/status-normalization-report.md +19 -0
  94. package/template/docs/engineering/token-cost-parity-manifest.md +16 -0
  95. package/template/docs/engineering/us-0084-remote-e2e.md +44 -0
  96. package/template/docs/product/acceptance.md +1 -0
  97. package/template/docs/product/backlog.md +5 -0
  98. package/template/docs/product/vision.md +11 -0
  99. package/template/docs/user-guides/README.md +40 -0
  100. package/{handoffs → template/handoffs}/dev_to_qa.md +0 -3
  101. package/{handoffs → template/handoffs}/po_to_tl.md +0 -3
  102. package/{handoffs → template/handoffs}/qa_to_dev.md +1 -2
  103. package/template/handoffs/release_notes.md +51 -0
  104. package/template/handoffs/release_queue.md +47 -0
  105. package/template/handoffs/release_to_dev.md +31 -0
  106. package/template/handoffs/releases/Sxxxx-release-notes.md +62 -0
  107. package/template/handoffs/resume_brief.md +14 -0
  108. package/{handoffs → template/handoffs}/tl_to_dev.md +0 -2
  109. package/template/handoffs/token_cost_runs/README.md +26 -0
  110. package/template/its_magic/.its-magic-version +1 -0
  111. package/template/its_magic/README.md +9 -0
  112. package/template/scripts/auto_outer_driver.py +521 -0
  113. package/template/scripts/caveman_compress_input.py +903 -0
  114. package/template/scripts/check_downstream_ci_guard.py +67 -0
  115. package/template/scripts/check_intake_template_parity.py +284 -0
  116. package/template/scripts/check_token_cost_parity.py +69 -0
  117. package/template/scripts/dev_environment_lib.py +463 -0
  118. package/template/scripts/doc_profile_lib.py +415 -0
  119. package/template/scripts/downstream_ci_guard_lib.py +222 -0
  120. package/template/scripts/enforce-triad-hot-surface.py +753 -0
  121. package/template/scripts/guard_installer_publish.py +88 -0
  122. package/template/scripts/intake_bug_resume_brief_refresh.py +303 -0
  123. package/template/scripts/intake_bug_routing_guard.py +67 -0
  124. package/template/scripts/intake_evidence_lib.py +802 -0
  125. package/template/scripts/intake_evidence_validate.py +73 -0
  126. package/template/scripts/materialize_codebase_map.py +184 -0
  127. package/template/scripts/pack_json_validate.py +130 -0
  128. package/template/scripts/project_readme_coverage_lib.py +417 -0
  129. package/template/scripts/readme_feature_coverage_lib.py +608 -0
  130. package/template/scripts/remote_config_summary.py +243 -0
  131. package/template/scripts/sync_push_gates.py +198 -0
  132. package/template/scripts/token_cost_compare.py +40 -0
  133. package/template/scripts/token_cost_lib.py +108 -0
  134. package/template/scripts/uat_probe_lib.py +868 -0
  135. package/template/scripts/validate-and-push.ps1 +280 -0
  136. package/template/scripts/validate-and-push.sh +243 -0
  137. package/template/scripts/validate_doc_profile.py +103 -0
  138. package/template/scripts/validate_project_readme_coverage.py +151 -0
  139. package/template/scripts/validate_readme_feature_coverage.py +140 -0
  140. package/template/sprints/S0001/progress.md +1 -0
  141. package/template/sprints/S0001/qa-findings.md +9 -0
  142. package/template/sprints/S0001/release-findings.md +24 -0
  143. package/template/sprints/S0001/sprint.md +9 -0
  144. package/template/sprints/S0001/summary.md +7 -0
  145. package/template/sprints/S0001/tasks.md +1 -0
  146. package/template/sprints/S0001/uat.json +6 -0
  147. package/template/sprints/S0001/uat.md +5 -0
  148. package/template/sprints/quick/Q0001/summary.md +1 -0
  149. package/{sprints → template/sprints}/quick/Q0001/task.json +0 -1
  150. package/.cursor/agents/curator.mdc +0 -21
  151. package/.cursor/agents/dev.mdc +0 -20
  152. package/.cursor/agents/po.mdc +0 -19
  153. package/.cursor/agents/qa.mdc +0 -19
  154. package/.cursor/agents/release.mdc +0 -19
  155. package/.cursor/agents/tech-lead.mdc +0 -21
  156. package/.cursor/commands/gsd-architecture.md +0 -29
  157. package/.cursor/commands/gsd-auto.md +0 -27
  158. package/.cursor/commands/gsd-discovery.md +0 -27
  159. package/.cursor/commands/gsd-execute.md +0 -32
  160. package/.cursor/commands/gsd-intake.md +0 -28
  161. package/.cursor/commands/gsd-map-codebase.md +0 -25
  162. package/.cursor/commands/gsd-milestone-complete.md +0 -24
  163. package/.cursor/commands/gsd-milestone-start.md +0 -26
  164. package/.cursor/commands/gsd-pause.md +0 -25
  165. package/.cursor/commands/gsd-plan-verify.md +0 -26
  166. package/.cursor/commands/gsd-qa.md +0 -28
  167. package/.cursor/commands/gsd-quick.md +0 -24
  168. package/.cursor/commands/gsd-refresh-context.md +0 -26
  169. package/.cursor/commands/gsd-release.md +0 -29
  170. package/.cursor/commands/gsd-research.md +0 -28
  171. package/.cursor/commands/gsd-resume.md +0 -26
  172. package/.cursor/commands/gsd-sprint-plan.md +0 -30
  173. package/.cursor/commands/gsd-verify-work.md +0 -25
  174. package/.cursor/hooks.json +0 -26
  175. package/.cursor/plans/cursor-gsd-team-kit_8cfee9b8.plan.md +0 -57
  176. package/.cursor/remote.json +0 -18
  177. package/.cursor/rules/gsd-core.mdc +0 -18
  178. package/.cursor/rules/gsd-handoffs.mdc +0 -10
  179. package/.cursor/rules/gsd-quality.mdc +0 -15
  180. package/.cursor/scratchpad.md +0 -34
  181. package/.github/workflows/ci.yml +0 -47
  182. package/decisions/DEC-0001.md +0 -21
  183. package/decisions/DEC-0002.md +0 -21
  184. package/docs/engineering/architecture.md +0 -354
  185. package/docs/engineering/decisions.md +0 -6
  186. package/docs/engineering/research.md +0 -11
  187. package/docs/engineering/runbook.md +0 -32
  188. package/docs/engineering/state.md +0 -33
  189. package/docs/product/acceptance.md +0 -6
  190. package/docs/product/backlog.md +0 -7
  191. package/docs/product/vision.md +0 -46
  192. package/gsd-installer.ps1 +0 -189
  193. package/gsd-installer.py +0 -195
  194. package/gsd-installer.sh +0 -201
  195. package/handoffs/release_notes.md +0 -14
  196. package/handoffs/resume_brief.md +0 -8
  197. package/milestones/M0001/milestone.json +0 -7
  198. package/milestones/M0001/phases.json +0 -9
  199. package/milestones/M0001/progress.md +0 -3
  200. package/milestones/M0001/summary.md +0 -3
  201. package/scripts/generate-release-notes.ps1 +0 -74
  202. package/scripts/generate-release-notes.sh +0 -63
  203. package/scripts/release-all.ps1 +0 -423
  204. package/scripts/release-all.sh +0 -226
  205. package/sprints/S0001/progress.md +0 -4
  206. package/sprints/S0001/qa-findings.md +0 -113
  207. package/sprints/S0001/sprint.md +0 -70
  208. package/sprints/S0001/summary.md +0 -46
  209. package/sprints/S0001/tasks.md +0 -35
  210. package/sprints/S0001/uat.json +0 -8
  211. package/sprints/S0001/uat.md +0 -8
  212. package/sprints/quick/Q0001/summary.md +0 -3
  213. /package/{.cursor/rules/gsd-escalation.mdc → template/.cursor/rules/escalation.mdc} +0 -0
  214. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.json +0 -0
  215. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/acceptance.md +0 -0
  216. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.json +0 -0
  217. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/architecture.md +0 -0
  218. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.json +0 -0
  219. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/decision.md +0 -0
  220. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.json +0 -0
  221. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/handoff.md +0 -0
  222. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/milestone.json +0 -0
  223. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/phase-context.json +0 -0
  224. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/plan-verify.json +0 -0
  225. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.json +0 -0
  226. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/sprint.md +0 -0
  227. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.json +0 -0
  228. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/story.md +0 -0
  229. /package/{.cursor/skills/gsd-team → template/.cursor/skills/its-magic}/templates/uat.json +0 -0
  230. /package/{docs → template/docs}/engineering/context/phase-template.json +0 -0
  231. /package/{docs → template/docs}/engineering/dependencies.json +0 -0
  232. /package/{sprints → template/sprints}/S0001/plan-verify.json +0 -0
@@ -0,0 +1,11 @@
1
+ # Decision DEC-0001
2
+
3
+ Status: Pending
4
+
5
+ ## Context
6
+
7
+ ## Options
8
+
9
+ ## Recommendation
10
+
11
+ ## Impact
@@ -0,0 +1,11 @@
1
+ # Decision DEC-0002
2
+
3
+ Status: Pending
4
+
5
+ ## Context
6
+
7
+ ## Options
8
+
9
+ ## Recommendation
10
+
11
+ ## Impact
@@ -0,0 +1,44 @@
1
+ # Developer documentation
2
+
3
+ This shard holds contributor-facing material for the **its-magic** framework. End-user
4
+ setup stays in the root `README.md` (user channel).
5
+
6
+ ## Prerequisites
7
+
8
+ - **Cursor** (or compatible editor) with the workflow files installed.
9
+ - **Python 3** on PATH for scratchpad merge validation and several repo scripts.
10
+ - **Node.js** if you use npm-packaged `its-magic` or npm-driven `TEST_COMMAND` defaults.
11
+
12
+ ## Workflow
13
+
14
+ - Follow phased commands under `.cursor/commands/` (`intake`, `discovery`, `architecture`,
15
+ `sprint-plan`, `execute`, `qa`, `release`, etc.).
16
+ - Keep handoffs and `docs/engineering/state.md` updated at phase boundaries.
17
+ - Use `.cursor/scratchpad.local.md` for personal overrides; never commit secrets.
18
+
19
+ ## Quality gates
20
+
21
+ - Run `TEST_COMMAND` from `docs/engineering/runbook.md` before push; CI should mirror the same.
22
+ - Run `python scripts/validate_doc_profile.py` when changing documentation profile flags or
23
+ README surfaces.
24
+ - Observe `US-0071` hygiene for user-visible script output (see runbook).
25
+
26
+ ## Architecture notes
27
+
28
+ - High-level contracts live in `docs/engineering/architecture.md` (search for story ids).
29
+ - Installer ownership is driven by `docs/engineering/context/installer-owned-paths.manifest`.
30
+ - Template parity: changes in repo root often require the same edit under `template/`.
31
+
32
+ ## Contracts and interfaces
33
+
34
+ - Scratchpad merge precedence: local → materialized `.cursor/scratchpad.md` →
35
+ `.cursor/scratchpad.local.example.md` (Model B / **DEC-0055**).
36
+ - Documentation profile keys: `DOC_AUDIENCE_PROFILE`, `DOC_DETAIL_LEVEL` (**DEC-0059**).
37
+ - Optional modes: `SPEC_PACK_MODE`, `USER_GUIDE_MODE` remain orthogonal; when `0`, validators
38
+ must not require those artifacts.
39
+
40
+ ## Engineering decisions
41
+
42
+ - Decision records: `decisions/DEC-xxxx.md` and the compact index in
43
+ `docs/engineering/decisions.md`.
44
+ - Profile semantics for this shard: **DEC-0059** and `# US-0077` in `architecture.md`.
@@ -0,0 +1,9 @@
1
+ # Architecture
2
+
3
+ ## Overview
4
+
5
+ ## Components
6
+
7
+ ## Risks
8
+
9
+ ## Decisions
@@ -0,0 +1,48 @@
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; enforce hot-surface rollover when configured thresholds are exceeded. |
12
+ | `docs/engineering/architecture.md` | `append-bottom` | Add new `US-xxxx` architecture sections at end of file; non-target section rewrites/deletions are forbidden. |
13
+ | `docs/product/backlog.md` | `sorted-canonical` | Keep stories sorted by numeric `US-xxxx` ID; mutate only target story block. |
14
+ | `docs/product/acceptance.md` | `sorted-canonical` | Keep `US-xxxx` rows ordered by numeric ID aligned to backlog order. |
15
+ | `handoffs/release_queue.md` | `append-bottom` | Append only one row per new sprint in release order. |
16
+ | `handoffs/release_notes.md` | `prepend-top` | Update latest pointer section first; preserve historical references list. |
17
+ | `handoffs/resume_brief.md` | `prepend-top` | Update current status/next-actions sections without rewriting unrelated history. |
18
+
19
+ ## Idempotence contract
20
+
21
+ - Re-running a command without semantic changes must not reorder rows/blocks.
22
+ - No oscillation between top and bottom insertion paths.
23
+ - No broad rewrites of unrelated story/sprint entries.
24
+ - For `docs/engineering/state.md`, each newly appended checkpoint timestamp must
25
+ be monotonic (`new_timestamp >= last_checkpoint_timestamp`) in UTC.
26
+ - For rollover reruns, archive partition boundaries and pack naming must be
27
+ deterministic (no duplicate or oscillating pack generation).
28
+
29
+ ## Fail-safe behavior
30
+
31
+ If required placement anchors are missing or ambiguous:
32
+ - stop with reason code `ARTIFACT_ORDERING_ANCHOR_AMBIGUOUS`,
33
+ - emit remediation guidance with expected anchor and file path,
34
+ - perform no partial mutation.
35
+
36
+ If a new `state.md` checkpoint timestamp is older than the current last
37
+ checkpoint timestamp:
38
+ - stop with reason code `STATE_TIMESTAMP_NON_MONOTONIC`,
39
+ - emit remediation guidance with the expected minimum timestamp,
40
+ - perform no partial mutation.
41
+
42
+ If configured state hot-surface rollover cannot determine a safe archive
43
+ boundary or cannot persist archive pack writes:
44
+ - stop with reason code `STATE_ARCHIVE_BOUNDARY_AMBIGUOUS` or
45
+ `STATE_ARCHIVE_WRITE_FAILED` (or verification mismatch
46
+ `STATE_ARCHIVE_VERIFICATION_FAILED`),
47
+ - emit remediation guidance with threshold/boundary details and target path,
48
+ - perform no partial mutation.
@@ -0,0 +1,57 @@
1
+ # Artifact Ownership Policy (US-0061 / DEC-0043)
2
+
3
+ This policy defines phase-level mutation ownership for mutable workflow
4
+ artifacts. Ordering policy and ownership policy are complementary:
5
+
6
+ - ordering determines where mutations may be placed,
7
+ - ownership determines who may mutate specific scopes.
8
+
9
+ ## Ownership matrix
10
+
11
+ | Artifact | Owned scope | Allowed phases | Override-authorized phases |
12
+ |---|---|---|---|
13
+ | `docs/product/vision.md` | Intake/discovery notes for current story | `intake`, `discovery` | none |
14
+ | `docs/product/backlog.md` | target story block only | `intake`, `release`, `status-reconcile` | none |
15
+ | `docs/product/acceptance.md` | target story row only | `intake`, `release`, `status-reconcile` | none |
16
+ | `handoffs/po_to_tl.md` | newest handoff/addendum section | `intake`, `discovery` | none |
17
+ | `docs/engineering/research.md` | new `R-xxxx` entries | `intake`, `research`, `architecture` | none |
18
+ | `docs/engineering/architecture.md` | append new `US-xxxx` architecture section or target section update | `architecture` | none |
19
+ | `docs/engineering/decisions.md` | compact index/context pack section | `architecture`, `refresh-context` | none |
20
+ | `decisions/DEC-xxxx.md` | decision file for current story | `architecture` | none |
21
+ | `sprints/Sxxxx/*` | current sprint artifacts only | `sprint-plan`, `plan-verify`, `execute`, `qa`, `verify-work`, `release` | none |
22
+ | `handoffs/tl_to_dev.md` | newest handoff section | `sprint-plan` | none |
23
+ | `handoffs/release_queue.md` | target sprint row only | `release` | none |
24
+ | `handoffs/release_notes.md` | latest pointer section | `release`, `refresh-context` | none |
25
+ | `docs/engineering/state.md` | append-bottom checkpoints only | all delivery phases | none |
26
+ | `handoffs/resume_brief.md` | current status/next-actions sections; latest-pointer upsert on **`/intake bug`** completion (**DEC-0069**) | `intake` (bug persistence path only), `pause`, `resume`, `refresh-context`, `release` | none |
27
+
28
+ ## Non-destructive mutation rules
29
+
30
+ - Non-authorized phases must not delete or rewrite sections owned by other
31
+ phases.
32
+ - Mutations must be target-scoped; broad file rewrites are forbidden.
33
+ - `docs/engineering/architecture.md` history preservation is mandatory:
34
+ unrelated `US-xxxx` sections must remain intact.
35
+
36
+ ## Override contract
37
+
38
+ - Override-authorized mutation is allowed only when the matrix explicitly lists
39
+ an override-authorized phase for that artifact.
40
+ - Required evidence fields:
41
+ - `override_phase_id`
42
+ - `override_reason`
43
+ - `override_scope`
44
+ - `evidence_ref`
45
+ - Missing/invalid override evidence is fail-closed.
46
+
47
+ ## Fail-safe reason codes
48
+
49
+ - `PHASE_OWNERSHIP_VIOLATION`
50
+ - `PHASE_OVERRIDE_EVIDENCE_MISSING`
51
+ - `ARCH_HISTORY_DELETION_DETECTED`
52
+
53
+ When any reason code is emitted:
54
+
55
+ - perform no partial write,
56
+ - preserve current file contents,
57
+ - emit remediation guidance with expected owner phase and target scope.