prizmkit 1.1.154 → 1.1.156

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 (164) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/adapters/codex/skill-adapter.js +1 -1
  3. package/bundled/adapters/pi/skill-adapter.js +2 -1
  4. package/bundled/dev-pipeline/.env.example +2 -6
  5. package/bundled/dev-pipeline/README.md +21 -27
  6. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +341 -15
  7. package/bundled/dev-pipeline/prizmkit_runtime/cli.py +0 -3
  8. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +1 -15
  9. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +48 -14
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +50 -2
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -9
  12. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +3 -3
  13. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +120 -22
  14. package/bundled/dev-pipeline/prizmkit_runtime/runtime_commit.py +482 -0
  15. package/bundled/dev-pipeline/prizmkit_runtime/test_result.py +64 -11
  16. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +145 -367
  17. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +91 -62
  18. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +105 -69
  19. package/bundled/dev-pipeline/scripts/prompt_framework.py +36 -41
  20. package/bundled/dev-pipeline/scripts/update-bug-status.py +1 -4
  21. package/bundled/dev-pipeline/scripts/update-checkpoint.py +61 -13
  22. package/bundled/dev-pipeline/scripts/update-feature-status.py +1 -4
  23. package/bundled/dev-pipeline/scripts/update-refactor-status.py +1 -4
  24. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +22 -27
  25. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +71 -104
  26. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +59 -111
  27. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +37 -72
  28. package/bundled/dev-pipeline/templates/sections/artifact-manifest.md +39 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +3 -1
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +8 -25
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +3 -3
  32. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +2 -2
  33. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +3 -3
  34. package/bundled/dev-pipeline/templates/sections/bugfix-phase-test.md +2 -2
  35. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +4 -4
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +0 -1
  37. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +7 -4
  38. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +14 -27
  39. package/bundled/dev-pipeline/templates/sections/feature-completion-summary.md +20 -0
  40. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +8 -71
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +7 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +3 -3
  43. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +4 -4
  44. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +5 -17
  45. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +3 -1
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +10 -23
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +2 -2
  48. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +2 -2
  49. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +3 -3
  50. package/bundled/dev-pipeline/templates/sections/refactor-phase-test.md +2 -2
  51. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +7 -7
  52. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +0 -1
  53. package/bundled/dev-pipeline/templates/sections/retrospective.md +12 -0
  54. package/bundled/dev-pipeline/templates/sections/runtime-commit-handoff.md +35 -0
  55. package/bundled/dev-pipeline/templates/session-status-schema.json +45 -62
  56. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +469 -18
  57. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +262 -175
  58. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +62 -23
  59. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +76 -28
  60. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +168 -18
  61. package/bundled/dev-pipeline/tests/test_recovery_workflow.py +111 -0
  62. package/bundled/dev-pipeline/tests/test_reset_preserve.py +0 -2
  63. package/bundled/dev-pipeline/tests/test_runtime_commit.py +608 -0
  64. package/bundled/dev-pipeline/tests/test_unified_cli.py +167 -25
  65. package/bundled/skills/_metadata.json +9 -9
  66. package/bundled/skills/app-planner/SKILL.md +3 -3
  67. package/bundled/skills/app-planner/references/generated-plan-review.md +2 -1
  68. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +56 -64
  69. package/bundled/skills/app-planner/references/rules/backend/fixed-rules.md +85 -240
  70. package/bundled/skills/app-planner/references/rules/backend/question-bank.md +25 -25
  71. package/bundled/skills/app-planner/references/rules/backend/question-manifest.json +16 -7
  72. package/bundled/skills/app-planner/references/rules/backend/template.md +74 -92
  73. package/bundled/skills/app-planner/references/rules/database/derivation-rules.md +93 -93
  74. package/bundled/skills/app-planner/references/rules/database/fixed-rules.md +66 -173
  75. package/bundled/skills/app-planner/references/rules/database/question-bank.md +31 -26
  76. package/bundled/skills/app-planner/references/rules/database/question-manifest.json +13 -4
  77. package/bundled/skills/app-planner/references/rules/database/template.md +76 -98
  78. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +68 -95
  79. package/bundled/skills/app-planner/references/rules/frontend/fixed-rules.md +93 -166
  80. package/bundled/skills/app-planner/references/rules/frontend/question-bank.md +46 -36
  81. package/bundled/skills/app-planner/references/rules/frontend/question-manifest.json +11 -2
  82. package/bundled/skills/app-planner/references/rules/frontend/template.md +79 -257
  83. package/bundled/skills/app-planner/references/rules/mobile/derivation-rules.md +91 -99
  84. package/bundled/skills/app-planner/references/rules/mobile/fixed-rules.md +73 -246
  85. package/bundled/skills/app-planner/references/rules/mobile/question-bank.md +17 -17
  86. package/bundled/skills/app-planner/references/rules/mobile/question-manifest.json +17 -2
  87. package/bundled/skills/app-planner/references/rules/mobile/template.md +73 -85
  88. package/bundled/skills/app-planner/references/rules-configuration.md +133 -65
  89. package/bundled/skills/app-planner/scripts/validate-rules-configuration.py +291 -0
  90. package/bundled/skills/prizmkit/SKILL.md +17 -18
  91. package/bundled/skills/prizmkit/references/workflow-state-protocol.md +22 -18
  92. package/bundled/skills/prizmkit-code-review/SKILL.md +22 -58
  93. package/bundled/skills/prizmkit-code-review/references/independent-code-review.md +6 -6
  94. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +2 -2
  95. package/bundled/skills/prizmkit-committer/SKILL.md +82 -132
  96. package/bundled/skills/prizmkit-deploy/SKILL.md +27 -11
  97. package/bundled/skills/prizmkit-deploy/assets/deploy-document-template.md +89 -0
  98. package/bundled/skills/prizmkit-deploy/references/ci-cd-workflows.md +44 -14
  99. package/bundled/skills/prizmkit-deploy/references/cloud-platform-deploy.md +19 -3
  100. package/bundled/skills/prizmkit-deploy/references/database-setup.md +22 -12
  101. package/bundled/skills/prizmkit-deploy/references/deploy-config-schema.md +3 -1
  102. package/bundled/skills/prizmkit-deploy/references/deploy-history-schema.md +22 -6
  103. package/bundled/skills/prizmkit-deploy/references/deploy-metadata-schema.json +49 -0
  104. package/bundled/skills/prizmkit-deploy/references/live-validation-notes.md +1 -1
  105. package/bundled/skills/prizmkit-deploy/references/pending-input-schema.json +164 -0
  106. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +9 -8
  107. package/bundled/skills/prizmkit-deploy/references/ssh-execution-flow.md +6 -6
  108. package/bundled/skills/prizmkit-implement/SKILL.md +30 -66
  109. package/bundled/skills/prizmkit-implement/references/implementation-subagent-procedure.md +4 -4
  110. package/bundled/skills/prizmkit-init/SKILL.md +4 -0
  111. package/bundled/skills/prizmkit-plan/SKILL.md +21 -64
  112. package/bundled/skills/prizmkit-plan/references/artifact-identity.md +38 -0
  113. package/bundled/skills/prizmkit-plan/references/independent-plan-review.md +4 -4
  114. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +5 -5
  115. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +75 -11
  116. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +191 -56
  117. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +18 -18
  118. package/bundled/skills/prizmkit-prizm-docs/references/op-rebuild.md +14 -8
  119. package/bundled/skills/prizmkit-prizm-docs/references/op-status.md +12 -5
  120. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +23 -12
  121. package/bundled/skills/prizmkit-prizm-docs/references/op-validate.md +13 -9
  122. package/bundled/skills/prizmkit-retrospective/SKILL.md +94 -97
  123. package/bundled/skills/prizmkit-retrospective/references/knowledge-injection-steps.md +79 -37
  124. package/bundled/skills/prizmkit-retrospective/references/retrospective-result-schema.json +138 -0
  125. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +111 -54
  126. package/bundled/skills/prizmkit-test/SKILL.md +64 -51
  127. package/bundled/skills/prizmkit-test/references/boundary-contract-and-test-double-guidance.md +206 -0
  128. package/bundled/skills/prizmkit-test/references/independent-test-review.md +17 -9
  129. package/bundled/skills/prizmkit-test/references/test-coverage-model.md +45 -21
  130. package/bundled/skills/prizmkit-test/references/test-report-template.md +20 -13
  131. package/bundled/skills/prizmkit-workflow/SKILL.md +35 -37
  132. package/bundled/skills/prizmkit-workflow/references/artifact-identity.md +34 -0
  133. package/bundled/skills/prizmkit-workflow/references/workflow-state-protocol.md +22 -18
  134. package/bundled/skills/recovery-workflow/SKILL.md +2 -1
  135. package/bundled/skills/recovery-workflow/references/detection.md +4 -3
  136. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +15 -5
  137. package/bundled/templates/hooks/validate-prizm-docs.py +124 -12
  138. package/package.json +1 -1
  139. package/src/scaffold.js +33 -22
  140. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +0 -16
  141. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +0 -31
  142. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -7
  143. package/bundled/dev-pipeline/templates/sections/critical-paths-lite.md +0 -7
  144. package/bundled/dev-pipeline/templates/sections/directory-convention-agent.md +0 -9
  145. package/bundled/dev-pipeline/templates/sections/directory-convention-lite.md +0 -6
  146. package/bundled/dev-pipeline/templates/sections/headless-commit-authorization.md +0 -15
  147. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -61
  148. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -24
  149. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -12
  150. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +0 -44
  151. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -25
  152. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +0 -20
  153. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +0 -20
  154. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +0 -20
  155. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +0 -17
  156. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +0 -28
  157. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-agent.md +0 -52
  158. package/bundled/dev-pipeline/templates/sections/test-failure-recovery-lite.md +0 -52
  159. package/bundled/skills/prizmkit-code-review/references/workflow-state-protocol.md +0 -174
  160. package/bundled/skills/prizmkit-committer/references/workflow-state-protocol.md +0 -174
  161. package/bundled/skills/prizmkit-implement/references/workflow-state-protocol.md +0 -174
  162. package/bundled/skills/prizmkit-plan/references/workflow-state-protocol.md +0 -174
  163. package/bundled/skills/prizmkit-retrospective/references/workflow-state-protocol.md +0 -174
  164. package/bundled/skills/prizmkit-test/references/external-contract-mock-guidance.md +0 -119
@@ -479,7 +479,7 @@ def test_operation_first_runtime_arguments_are_validated_then_forwarded_exactly(
479
479
 
480
480
  run_args = [
481
481
  "run", "feature", "F-001", "custom.json", "--features", "F-001:F-005",
482
- "--max-retries", "5", "--max-infra-retries", "4", "--mode", "full",
482
+ "--max-retries", "5", "--max-infra-retries", "4",
483
483
  "--resume-phase", "6", "--dry-run",
484
484
  ]
485
485
  assert runtime_cli.main(run_args) == 0
@@ -488,8 +488,8 @@ def test_operation_first_runtime_arguments_are_validated_then_forwarded_exactly(
488
488
  assert runtime_cli.main(["status", "bugfix", "bugs.json"]) == 0
489
489
  assert captured[-1] == ("status", "status", "bugfix", ("bugs.json",))
490
490
 
491
- assert runtime_cli.main(["daemon", "feature", "start", "--mode", "standard"]) == 0
492
- assert captured[-1] == ("daemon", "start", "feature", ("--mode", "standard"))
491
+ assert runtime_cli.main(["daemon", "feature", "start"]) == 0
492
+ assert captured[-1] == ("daemon", "start", "feature", ())
493
493
 
494
494
  assert runtime_cli.main(["daemon", "feature", "logs", "--follow"]) == 0
495
495
  assert captured[-1] == ("daemon", "logs", "feature", ("--follow",))
@@ -503,21 +503,31 @@ def test_operation_first_runtime_arguments_are_validated_then_forwarded_exactly(
503
503
  "reset", "reset", "feature", ("F-001", "--fresh-checkout", "custom.json")
504
504
  )
505
505
 
506
- interspersed_daemon = ["daemon", "feature", "start", "--mode", "full", "custom.json"]
506
+ interspersed_daemon = ["daemon", "feature", "start", "custom.json"]
507
507
  assert runtime_cli.main(interspersed_daemon) == 0
508
508
  assert captured[-1] == (
509
- "daemon", "start", "feature", ("--mode", "full", "custom.json")
509
+ "daemon", "start", "feature", ("custom.json",)
510
510
  )
511
511
 
512
512
  assert runtime_cli.main(["--project-root", "feature", "run", "feature", "--dry-run"]) == 0
513
513
  assert captured[-1] == ("run", "run", "feature", ("--dry-run",))
514
514
 
515
515
 
516
+ def test_pipeline_mode_option_is_rejected():
517
+ foreground = run_cli("run", "feature", "--mode", "full")
518
+ daemon = run_cli("daemon", "feature", "start", "--mode", "full")
519
+
520
+ assert foreground.returncode == 2
521
+ assert daemon.returncode == 2
522
+ assert "unrecognized arguments" in foreground.stderr
523
+ assert "unrecognized arguments" in daemon.stderr
524
+
525
+
516
526
  @pytest.mark.parametrize(
517
527
  ("family", "task_id", "extra_args"),
518
528
  [
519
529
  ("feature", "F-007", ("--features", "F-007", "--dry-run")),
520
- ("bugfix", "B-007", ("--mode", "full", "--max-retries", "4")),
530
+ ("bugfix", "B-007", ("--max-retries", "4")),
521
531
  ("refactor", "R-007", ("--resume-phase", "6", "--max-infra-retries", "5")),
522
532
  ],
523
533
  )
@@ -625,6 +635,32 @@ def _write_family_status_plan(paths, family, task_id):
625
635
  return plan_path
626
636
 
627
637
 
638
+ def _write_family_runtime_status(paths, family, task_id):
639
+ state_dir = {
640
+ "feature": paths.feature_state_dir,
641
+ "bugfix": paths.bugfix_state_dir,
642
+ "refactor": paths.refactor_state_dir,
643
+ }[family]
644
+ status_path = state_dir / task_id / "status.json"
645
+ status_path.parent.mkdir(parents=True, exist_ok=True)
646
+ status_path.write_text(
647
+ json.dumps(
648
+ {
649
+ {
650
+ "feature": "feature_id",
651
+ "bugfix": "bug_id",
652
+ "refactor": "refactor_id",
653
+ }[family]: task_id,
654
+ "retry_count": 0,
655
+ "sessions": [],
656
+ "resume_from_phase": 9,
657
+ }
658
+ ),
659
+ encoding="utf-8",
660
+ )
661
+ return status_path
662
+
663
+
628
664
  def _file_bytes_under(root):
629
665
  if not root.exists():
630
666
  return {}
@@ -676,29 +712,26 @@ def test_status_all_uses_real_family_status_handlers_without_filesystem_mutation
676
712
  from prizmkit_runtime.paths import resolve_runtime_paths
677
713
 
678
714
  paths = resolve_runtime_paths(pipeline_root=PIPELINE_ROOT, project_root=tmp_path)
679
- feature_plan = _write_family_status_plan(paths, "feature", "F-001")
680
- refactor_plan = _write_family_status_plan(paths, "refactor", "R-001")
681
- before = {
682
- path.relative_to(tmp_path).as_posix(): (path.read_bytes(), path.stat().st_mtime_ns)
683
- for path in (feature_plan, refactor_plan)
715
+ configured = {
716
+ "feature": "F-001",
717
+ "bugfix": "B-001",
718
+ "refactor": "R-001",
684
719
  }
720
+ for family, task_id in configured.items():
721
+ _write_family_status_plan(paths, family, task_id)
722
+ _write_family_runtime_status(paths, family, task_id)
723
+ before = _file_bytes_under(tmp_path)
685
724
 
686
725
  result = run_cli("--project-root", str(tmp_path), "status", "all")
687
726
 
688
- after = {
689
- path.relative_to(tmp_path).as_posix(): (path.read_bytes(), path.stat().st_mtime_ns)
690
- for path in (feature_plan, refactor_plan)
691
- }
692
727
  assert result.returncode == 0, result.stderr
693
728
  assert "FEATURE\n=======" in result.stdout
694
729
  assert "Python feature status" in result.stdout
695
- assert "BUGFIX\n======\nnot configured: plan list not found" in result.stdout
730
+ assert "BUGFIX\n======" in result.stdout
731
+ assert "Python bugfix status" in result.stdout
696
732
  assert "REFACTOR\n========" in result.stdout
697
733
  assert "Python refactor status" in result.stdout
698
- assert after == before
699
- assert not paths.feature_state_dir.exists()
700
- assert not paths.bugfix_state_dir.exists()
701
- assert not paths.refactor_state_dir.exists()
734
+ assert _file_bytes_under(tmp_path) == before
702
735
 
703
736
 
704
737
  def test_status_all_reports_plan_and_handler_errors_but_renders_unaffected_sections(
@@ -1254,7 +1287,7 @@ def test_session_preamble_writes_redacted_start_command_for_all_launch_profiles(
1254
1287
  assert str(prompt) not in "\n".join(lines[:6])
1255
1288
 
1256
1289
 
1257
- def test_headless_review_guidance_defers_to_skill_review_contract():
1290
+ def test_headless_review_guidance_maps_stage_local_skill_result():
1258
1291
  headless_guidance_files = [
1259
1292
  REPO_ROOT / "dev-pipeline" / "templates" / "sections" / "phase-review-full.md",
1260
1293
  REPO_ROOT / "dev-pipeline" / "templates" / "bootstrap-tier3.md",
@@ -1270,9 +1303,10 @@ def test_headless_review_guidance_defers_to_skill_review_contract():
1270
1303
 
1271
1304
  for path in headless_guidance_files:
1272
1305
  text = path.read_text(encoding="utf-8")
1273
- assert "current review contract" in text, path
1274
- assert "second review path outside that contract" in text, path
1306
+ assert "returns only `PASS` or `NEEDS_FIXES`" in text, path
1307
+ assert "this injected session" in text, path
1275
1308
  assert "text final-verdict" in text, path
1309
+ assert "follow the skill's current review contract" not in text, path
1276
1310
  assert "low=0" not in text and "Reviewer 3" not in text, path
1277
1311
  assert "forced-worktree changed-content fallback" not in text, path
1278
1312
  assert "isolation:" not in text, path
@@ -3060,6 +3094,60 @@ def test_branch_merge_preserves_preexisting_stash_when_workspace_is_clean(tmp_pa
3060
3094
  assert (tmp_path / "feature.txt").read_text(encoding="utf-8") == "done\n"
3061
3095
 
3062
3096
 
3097
+ def test_branch_merge_fast_forwards_with_dirty_prizmkit_internal_state(tmp_path):
3098
+ from prizmkit_runtime.gitops import (
3099
+ BranchContext,
3100
+ branch_fast_forward_possible,
3101
+ branch_merge_plan,
3102
+ run_git_plan,
3103
+ )
3104
+
3105
+ _init_merge_repo(tmp_path)
3106
+ context = BranchContext("main", "dev/example", tmp_path)
3107
+ subprocess.run(
3108
+ ["git", "checkout", "-b", context.working_branch],
3109
+ cwd=tmp_path,
3110
+ check=True,
3111
+ stdout=subprocess.DEVNULL,
3112
+ )
3113
+ (tmp_path / "feature.txt").write_text("done\n", encoding="utf-8")
3114
+ subprocess.run(["git", "add", "feature.txt"], cwd=tmp_path, check=True)
3115
+ subprocess.run(
3116
+ ["git", "commit", "-m", "feature"],
3117
+ cwd=tmp_path,
3118
+ check=True,
3119
+ stdout=subprocess.DEVNULL,
3120
+ )
3121
+ manifest = tmp_path / ".prizmkit" / "manifest.json"
3122
+ manifest.write_text('{"version":"session-local"}\n', encoding="utf-8")
3123
+
3124
+ assert branch_fast_forward_possible(tmp_path, context) is True
3125
+ result = run_git_plan(
3126
+ tmp_path,
3127
+ branch_merge_plan(context, rebase=False),
3128
+ )
3129
+
3130
+ assert result.ok is True
3131
+ assert not any(command.args and command.args[0] == "rebase" for command in result.plan.commands)
3132
+ assert subprocess.run(
3133
+ ["git", "branch", "--show-current"],
3134
+ cwd=tmp_path,
3135
+ check=True,
3136
+ stdout=subprocess.PIPE,
3137
+ text=True,
3138
+ ).stdout.strip() == "main"
3139
+ assert (tmp_path / "feature.txt").read_text(encoding="utf-8") == "done\n"
3140
+ assert json.loads(manifest.read_text(encoding="utf-8"))["version"] == "session-local"
3141
+ assert ".prizmkit/manifest.json" in subprocess.run(
3142
+ ["git", "status", "--short"],
3143
+ cwd=tmp_path,
3144
+ check=True,
3145
+ stdout=subprocess.PIPE,
3146
+ text=True,
3147
+ ).stdout
3148
+ assert _stash_oids(tmp_path) == ()
3149
+
3150
+
3063
3151
  def test_branch_merge_rejects_dirty_task_checkout_without_touching_stashes(tmp_path):
3064
3152
  from prizmkit_runtime.gitops import BranchContext, branch_merge_plan, run_git_plan
3065
3153
 
@@ -3794,6 +3882,60 @@ def test_materialize_worktree_support_assets_copies_ignored_assets_without_retir
3794
3882
  assert guarded_worktree_remove(runtime, delete_branch=False).ok
3795
3883
 
3796
3884
 
3885
+ def test_linked_worktree_fast_forwards_with_dirty_prizmkit_internal_state(tmp_path):
3886
+ from prizmkit_runtime.gitops import (
3887
+ BranchContext,
3888
+ WorktreePolicy,
3889
+ branch_fast_forward_possible,
3890
+ ensure_linked_worktree,
3891
+ guarded_worktree_remove,
3892
+ merge_linked_worktree,
3893
+ worktree_runtime_context,
3894
+ )
3895
+
3896
+ repo = tmp_path / "repo"
3897
+ _init_temp_repo(repo)
3898
+ config = repo / ".prizmkit" / "config.json"
3899
+ config.parent.mkdir(parents=True)
3900
+ config.write_text('{"mode":"base"}\n', encoding="utf-8")
3901
+ subprocess.run(["git", "add", ".prizmkit/config.json"], cwd=repo, check=True)
3902
+ subprocess.run(
3903
+ ["git", "commit", "-m", "track internal config"],
3904
+ cwd=repo,
3905
+ check=True,
3906
+ stdout=subprocess.DEVNULL,
3907
+ )
3908
+ runtime = worktree_runtime_context(
3909
+ BranchContext("main", "dev/internal-dirt", repo),
3910
+ WorktreePolicy(
3911
+ True,
3912
+ cleanup_on_success=True,
3913
+ preserve_on_failure=True,
3914
+ worktree_root=tmp_path / "worktrees",
3915
+ ),
3916
+ )
3917
+ assert ensure_linked_worktree(runtime).ok
3918
+ (runtime.worktree_path / "feature.txt").write_text("done\n", encoding="utf-8")
3919
+ subprocess.run(["git", "add", "feature.txt"], cwd=runtime.worktree_path, check=True)
3920
+ subprocess.run(
3921
+ ["git", "commit", "-m", "feature"],
3922
+ cwd=runtime.worktree_path,
3923
+ check=True,
3924
+ stdout=subprocess.DEVNULL,
3925
+ )
3926
+ worktree_config = runtime.worktree_path / ".prizmkit" / "config.json"
3927
+ worktree_config.write_text('{"mode":"session-local"}\n', encoding="utf-8")
3928
+
3929
+ assert branch_fast_forward_possible(repo, runtime.context) is True
3930
+ result = merge_linked_worktree(runtime)
3931
+
3932
+ assert result.ok is True
3933
+ assert not any(item.args and item.args[0] == "rebase" for item in result.results)
3934
+ assert (repo / "feature.txt").read_text(encoding="utf-8") == "done\n"
3935
+ assert json.loads(worktree_config.read_text(encoding="utf-8"))["mode"] == "session-local"
3936
+ assert guarded_worktree_remove(runtime, delete_branch=True).ok
3937
+
3938
+
3797
3939
  def test_worktree_terminal_failure_wip_commit_preserves_dirty_changes_before_cleanup(tmp_path):
3798
3940
  from prizmkit_runtime.gitops import (
3799
3941
  BranchContext,
@@ -3875,9 +4017,9 @@ def test_checkpoint_rewind_preserves_planning_and_resets_implementation_downstre
3875
4017
  "prizmkit-implement",
3876
4018
  "prizmkit-code-review",
3877
4019
  "prizmkit-test",
4020
+ "completion-summary",
3878
4021
  "prizmkit-retrospective",
3879
4022
  "prizmkit-committer",
3880
- "completion-summary",
3881
4023
  ]
3882
4024
  steps = []
3883
4025
  previous = None
@@ -3909,7 +4051,7 @@ def test_checkpoint_rewind_preserves_planning_and_resets_implementation_downstre
3909
4051
  "feature_state": {
3910
4052
  "schema_version": 1,
3911
4053
  "artifact_dir": ".prizmkit/specs/example",
3912
- "orchestrator": "prizmkit-l4",
4054
+ "orchestrator": "pipeline-runtime",
3913
4055
  "stage": "code-review",
3914
4056
  "current_stage": "prizmkit-code-review",
3915
4057
  "status": "failed",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.154",
2
+ "version": "1.1.156",
3
3
  "skills": {
4
4
  "prizmkit": {
5
5
  "description": "Framework introduction and navigation for the formal single-requirement lifecycle, project initialization, Prizm docs, and independent deployment.",
@@ -23,35 +23,35 @@
23
23
  "hasScripts": false
24
24
  },
25
25
  "prizmkit-plan": {
26
- "description": "Formal requirement lifecycle entry: natural language → spec.md and plan.md with mandatory Main-Agent planning review, optional capability-gated independent correctness review, stable artifact identity, and workflow-state handoff.",
26
+ "description": "Create and review spec.md and plan.md for one supplied requirement; return PLAN_READY or PLAN_BLOCKED.",
27
27
  "tier": "1",
28
28
  "category": "prizmkit-skill",
29
29
  "hasAssets": true,
30
30
  "hasScripts": false
31
31
  },
32
32
  "prizmkit-implement": {
33
- "description": "Execute a reviewed formal requirement plan, preserve artifact identity, and route implementation repairs to the correct review or test gate.",
33
+ "description": "Execute one reviewed plan or explicit repair scope, perform focused verification, and return IMPLEMENTED or IMPLEMENT_BLOCKED.",
34
34
  "tier": "1",
35
35
  "category": "prizmkit-skill",
36
36
  "hasAssets": false,
37
37
  "hasScripts": false
38
38
  },
39
39
  "prizmkit-code-review": {
40
- "description": "Mandatory bounded Main-Agent code review plus optional capability-gated independent correctness review, with evidence-based adjudication, direct repairs, verification, and append-only progress reporting.",
40
+ "description": "Review one supplied change with bounded Main-Agent repair, optional capability-gated independent review, verification, and PASS or NEEDS_FIXES output.",
41
41
  "tier": "1",
42
42
  "category": "prizmkit-skill",
43
43
  "hasAssets": false,
44
44
  "hasScripts": true
45
45
  },
46
46
  "prizmkit-committer": {
47
- "description": "Final formal-requirement commit gate: verifies all prior stages, confirms interactive commits or performs authorized headless pipeline commits, and never pushes automatically.",
47
+ "description": "Create an explicitly confirmed interactive commit or prepare an exact Runtime commit request from caller-supplied evidence; never push automatically.",
48
48
  "tier": "1",
49
49
  "category": "prizmkit-skill",
50
50
  "hasAssets": false,
51
51
  "hasScripts": false
52
52
  },
53
53
  "prizmkit-retrospective": {
54
- "description": "Mandatory formal-requirement retrospective: updates durable Prizm docs or records NO_DOC_CHANGE with machine-verifiable result before commit.",
54
+ "description": "Synchronize durable Prizm docs for exact supplied change paths, or record NO_DOC_CHANGE; return RETRO_COMPLETE or RETRO_BLOCKED.",
55
55
  "tier": "1",
56
56
  "category": "prizmkit-skill",
57
57
  "hasAssets": true,
@@ -72,7 +72,7 @@
72
72
  "hasScripts": false
73
73
  },
74
74
  "prizmkit-test": {
75
- "description": "AI-led project-native testing for the affected business module and Regression Ring, with bounded failure repair, mandatory Main-Agent review, optional strict independent Test Reviewer, and TEST_PASS/TEST_NEEDS_FIXES/TEST_BLOCKED results.",
75
+ "description": "AI-led project-native affected-module and Regression Ring testing with contract authority, test-double fidelity, consumer/provider compatibility, browser and Full-stack E2E classification, persistence re-entry, bounded repair, review, and TEST_PASS/TEST_NEEDS_FIXES/TEST_BLOCKED results.",
76
76
  "tier": "1",
77
77
  "category": "prizmkit-skill",
78
78
  "hasAssets": false,
@@ -159,12 +159,12 @@
159
159
  "hasScripts": false
160
160
  },
161
161
  "recovery-workflow": {
162
- "description": "Detect whether interrupted work belongs to a direct requirement or autonomous pipeline, select the authoritative owner, and hand off without merging state machines.",
162
+ "description": "Detect valid active feature, bugfix, or refactor checkout records and return exact operation-first continuation commands without executing or mutating state.",
163
163
  "tier": "companion",
164
164
  "category": "orchestration-skill",
165
165
  "subcategory": "workflows",
166
166
  "hasAssets": false,
167
- "hasScripts": false
167
+ "hasScripts": true
168
168
  }
169
169
  },
170
170
  "suites": {
@@ -157,7 +157,7 @@ After Infrastructure configuration is complete (CP-AP-1.5), check whether the pr
157
157
 
158
158
  Rules are optional. If the user skips, AI uses general best practices freely — no reminders, no blocking.
159
159
 
160
- → Read `${SKILL_DIR}/references/rules-configuration.md` for the full procedure: layer detection, configuration mode selection, interactive Q&A per layer, template rendering, and root.prizm RULES pointer update. Before rendering final rule files or updating the pointer, run the Pre-Generation Headless Context Completeness Gate on every proposed new or changed rule.
160
+ → Read `${SKILL_DIR}/references/rules-configuration.md` for the full contract: layer detection, explicit Quick/Full/Skip authorization, interactive decisions, invariant-only fixed rules, selected-option derivation with semantic fallback, dual-native profiles, conflict detection, deterministic resource validation, template rendering, and the `root.prizm` `RULES:` pointer update. Run `${SKILL_DIR}/scripts/validate-rules-configuration.py` before questioning and again before final rendering. Before writing rule files or updating the pointer, require both a passing decision-conflict gate and the Pre-Generation Headless Context Completeness Gate for every proposed new or changed rule.
161
161
 
162
162
  ### After rules configuration
163
163
 
@@ -289,7 +289,7 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
289
289
  | **CP-AP-0** | Intent Confirmed | User confirmed session goal (produce / explore) | 1 |
290
290
  | **CP-AP-1** | Conventions Checked | Current-host project instruction target resolved; its `### Project Conventions` section is loaded or asked and up to date | 1 |
291
291
  | **CP-AP-1.5** | Infrastructure Checked | Resolved project instruction target `### Infrastructure` section addressed — database, deployment **and cloud services** each configured or explicitly deferred | 1-2 |
292
- | **CP-AP-1.6** | Rules Configured | For each detected layer (from config.json or self-detection), rules file exists in `.prizmkit/rules/` or user explicitly skipped. `root.prizm` `RULES:` pointer up-to-date. | 2 |
292
+ | **CP-AP-1.6** | Rules Configured | Rules resources pass deterministic validation; Quick defaults are explicitly authorized; every detected layer has a conflict-free `.prizmkit/rules/<layer>-rules.md` or an explicit skip; dual-native choices use separate profiles; no residual placeholders remain; `root.prizm` `RULES:` pointer is up to date. | 2 |
293
293
  | **CP-AP-2** | Vision Summary | Goal/users/differentiators confirmed by user. For brownfield: existing purpose confirmed or refined. | 1-2 |
294
294
  | **CP-AP-3** | Frontend Design Evaluated | For frontend projects: checked for existing UI/UX design system; user was asked if missing. **Auto-pass** for backend-only or non-UI projects. | 2 |
295
295
  | **CP-AP-4** | Project Brief Accumulated | The in-memory brief or `.prizmkit/plans/project-brief.draft.md` contains at least 3 ideas. For brownfield: already-implemented items marked `[x]` count toward this total. The final brief is not written before CP-AP-5.5. | 3 |
@@ -304,7 +304,7 @@ Run this gate before any final handoff whenever the current `app-planner` sessio
304
304
  1. **Load the local reference**: read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the source of truth for app-planner generated content review.
305
305
  2. **Read actual planning artifacts directly**: inspect current-session final outputs such as `.prizmkit/plans/project-brief.md`, changed sections in the resolved project instruction target, `.prizmkit/rules/<layer>-rules.md`, and `.prizmkit/prizm-docs/root.prizm` `RULES:` pointer line. Do not rely on `git status`, `git diff`, or `git diff --cached`, because `.prizmkit` planning artifacts are often gitignored or untracked.
306
306
  3. **Scope to new/changed app-planning content**: compare against pre-session snapshots or in-memory drafts when available. Preserve unchanged historical brief items, instruction-file sections, rules files, and Prizm doc content. For explore-only sessions, draft-save exits, or flows with no new final planning content, report: `Local generated-plan review: not applicable — no new final planning content written.`
307
- 4. **Run the local checklist and fresh-session simulation** from the reference: project brief completeness, consistency of conventions/infrastructure/architecture decisions, rules pointer consistency, normalization of selected decisions, purpose-tagged references, app-planner writable-boundary compliance, and downstream `feature-planner` readiness to produce `.prizmkit/plans/feature-list.json` without guessing or seeing the original conversation.
307
+ 4. **Run the local checklist and fresh-session simulation** from the reference: project brief completeness; consistency of conventions, infrastructure, and architecture decisions; Rules Configuration resource-validation and conflict-gate evidence; selected-decision precedence; explicit not-applicable/deferred sections; dual-native profile separation; rules pointer consistency; normalization of selected decisions; purpose-tagged references; app-planner writable-boundary compliance; and downstream `feature-planner` readiness to produce `.prizmkit/plans/feature-list.json` without guessing or seeing the original conversation.
308
308
  5. **Apply accepted fixes through the source/writer path**: project brief fixes go through the draft/checklist source, instruction-file section fixes go through the resolved project instruction target's section source with user confirmation when changing approved wording, rules fixes re-render from rules configuration answers/templates when available, and `root.prizm` fixes are limited to the `RULES:` pointer line.
309
309
  6. **Recheck changed sections directly** after every accepted fix batch.
310
310
  7. **Report CP-AP-6** in the completion summary: include local generated-plan review verdict, reviewed app-planning artifacts/sections, accepted fixes (or "none"), and final writer/validation result.
@@ -33,7 +33,7 @@ Do not rely on `git status`, `git diff`, or `git diff --cached` to decide whethe
33
33
 
34
34
  - `project-brief.md` fixes go through the draft/checklist project brief source representation described in `project-brief-guide.md`, then rewrite the final brief through the existing project brief writer path.
35
35
  - Project conventions, infrastructure, frontend design direction, and architecture decisions are source sections in the exact project instruction target selected for the current session. If a fix changes user-approved wording or meaning, ask for user confirmation before rewriting.
36
- - `.prizmkit/rules/<layer>-rules.md` fixes should re-render from the rules configuration answers and template inputs when available. If no structured source remains, update the source rule section explicitly and report that source path.
36
+ - `.prizmkit/rules/<layer>-rules.md` fixes should re-render from the normalized decision ledger, invariant/derivation sources, and template inputs. Rerun `scripts/validate-rules-configuration.py` and the Rules Configuration conflict gate before rewriting. If no structured source remains, rebuild the decision ledger or ask for clarification; do not hand-patch a contradictory final rule file.
37
37
  - `root.prizm` fixes are limited to correcting or adding the `RULES:` pointer line; do not rewrite unrelated root content.
38
38
 
39
39
  ## Review Checklist
@@ -43,6 +43,7 @@ For every reviewed app-planning artifact or section, check:
43
43
  - Project brief completeness: goal, users, differentiators, constraints, tech stack assumptions, and at least three actionable ideas when producing a final brief
44
44
  - Consistency among conventions, infrastructure, architecture decisions, and project brief content
45
45
  - Infrastructure completeness or explicit deferral for database, deployment, and cloud services topics when those flows ran
46
+ - Rules Configuration integrity: the deterministic resource validator passed; Quick defaults were explicitly authorized; fixed content contains only invariants; selected decisions own their policy domains; no active rule conflicts with the decision ledger; unmatched/not-applicable choices are explicit; dual-native decisions remain in separate iOS/Android profiles; and rendered files contain no residual placeholders
46
47
  - Rules pointer consistency: generated `.prizmkit/rules/<layer>-rules.md` files are referenced by the `root.prizm` `RULES:` line when rules were configured
47
48
  - Substantive user meaning and detail preservation at matching detail after conversational normalization in project brief ideas, conventions, infrastructure notes, architecture decisions, and rules
48
49
  - Artifact-wide readability: every generated natural-language value across all AI-visible fields and sections—including briefs/drafts, instruction sections, generated rules, appendices, comments, brainstorm summaries, quoted evidence, and parentheticals—is a standalone domain statement without dialogue-role labels, question IDs, answer tokens, planning-option recommendation markers, raw answer-map content, or planning provenance