prizmkit 1.1.110 → 1.1.112

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 (113) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/agents/prizm-dev-team-reviewer.md +15 -0
  3. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +1 -0
  4. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +55 -76
  5. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +283 -421
  6. package/bundled/dev-pipeline/scripts/generate-recovery-prompt.py +1 -1
  7. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +259 -481
  8. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +34 -0
  9. package/bundled/dev-pipeline/scripts/init-pipeline.py +12 -0
  10. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +24 -1
  11. package/bundled/dev-pipeline/scripts/prompt_framework.py +312 -0
  12. package/bundled/dev-pipeline/scripts/update-bug-status.py +87 -20
  13. package/bundled/dev-pipeline/scripts/update-feature-status.py +82 -16
  14. package/bundled/dev-pipeline/scripts/update-refactor-status.py +68 -28
  15. package/bundled/dev-pipeline/scripts/utils.py +171 -0
  16. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  17. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +10 -18
  18. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +14 -25
  19. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +9 -1
  20. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +11 -8
  21. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +122 -182
  22. package/bundled/dev-pipeline/templates/sections/bugfix-artifacts.md +16 -0
  23. package/bundled/dev-pipeline/templates/sections/bugfix-critical-paths.md +12 -0
  24. package/bundled/dev-pipeline/templates/sections/bugfix-mission.md +9 -0
  25. package/bundled/dev-pipeline/templates/sections/bugfix-phase-commit-report.md +31 -0
  26. package/bundled/dev-pipeline/templates/sections/bugfix-phase-critic.md +22 -0
  27. package/bundled/dev-pipeline/templates/sections/bugfix-phase-diagnose-plan.md +23 -0
  28. package/bundled/dev-pipeline/templates/sections/bugfix-phase-implement.md +20 -0
  29. package/bundled/dev-pipeline/templates/sections/bugfix-phase-init.md +9 -0
  30. package/bundled/dev-pipeline/templates/sections/bugfix-phase-manual-verification.md +15 -0
  31. package/bundled/dev-pipeline/templates/sections/bugfix-phase-review.md +29 -0
  32. package/bundled/dev-pipeline/templates/sections/bugfix-reminders.md +11 -0
  33. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +7 -0
  34. package/bundled/dev-pipeline/templates/sections/bugfix-session-status.md +31 -0
  35. package/bundled/dev-pipeline/templates/sections/bugfix-task-contract.md +40 -0
  36. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +1 -1
  37. package/bundled/dev-pipeline/templates/sections/failure-capture.md +2 -2
  38. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +1 -1
  39. package/bundled/dev-pipeline/templates/sections/refactor-artifacts.md +17 -0
  40. package/bundled/dev-pipeline/templates/sections/refactor-critical-paths.md +13 -0
  41. package/bundled/dev-pipeline/templates/sections/refactor-mission.md +9 -0
  42. package/bundled/dev-pipeline/templates/sections/refactor-phase-commit-report.md +37 -0
  43. package/bundled/dev-pipeline/templates/sections/refactor-phase-critic.md +22 -0
  44. package/bundled/dev-pipeline/templates/sections/refactor-phase-implement.md +16 -0
  45. package/bundled/dev-pipeline/templates/sections/refactor-phase-init.md +9 -0
  46. package/bundled/dev-pipeline/templates/sections/refactor-phase-plan.md +22 -0
  47. package/bundled/dev-pipeline/templates/sections/refactor-phase-review.md +19 -0
  48. package/bundled/dev-pipeline/templates/sections/refactor-reminders.md +11 -0
  49. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +7 -0
  50. package/bundled/dev-pipeline/templates/sections/refactor-session-status.md +28 -0
  51. package/bundled/dev-pipeline/templates/sections/refactor-task-contract.md +52 -0
  52. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +122 -5
  53. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +122 -0
  54. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +124 -0
  55. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +197 -0
  56. package/bundled/dev-pipeline/tests/test_unified_cli.py +7 -3
  57. package/bundled/dev-pipeline/tests/test_utils.py +66 -1
  58. package/bundled/skills/_metadata.json +1 -1
  59. package/bundled/skills/app-planner/SKILL.md +8 -7
  60. package/bundled/skills/app-planner/references/project-brief-guide.md +2 -2
  61. package/bundled/skills/app-planner/references/rules/backend/derivation-rules.md +1 -1
  62. package/bundled/skills/app-planner/references/rules/frontend/derivation-rules.md +1 -1
  63. package/bundled/skills/app-planner/references/rules-configuration.md +53 -26
  64. package/bundled/skills/bug-fix-workflow/SKILL.md +191 -336
  65. package/bundled/skills/bug-planner/SKILL.md +6 -5
  66. package/bundled/skills/bug-planner/references/critic-and-verification.md +3 -3
  67. package/bundled/skills/bug-planner/references/schema-validation.md +2 -1
  68. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +30 -1
  69. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +16 -16
  70. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +2 -2
  71. package/bundled/skills/feature-pipeline-launcher/SKILL.md +19 -11
  72. package/bundled/skills/feature-planner/SKILL.md +9 -11
  73. package/bundled/skills/feature-planner/assets/planning-guide.md +1 -1
  74. package/bundled/skills/feature-planner/references/decomposition-patterns.md +1 -1
  75. package/bundled/skills/feature-planner/references/error-recovery.md +2 -1
  76. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +2 -2
  77. package/bundled/skills/feature-planner/references/new-project-planning.md +35 -39
  78. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +1 -1
  79. package/bundled/skills/feature-workflow/SKILL.md +169 -298
  80. package/bundled/skills/prizmkit/SKILL.md +103 -57
  81. package/bundled/skills/prizmkit-code-review/SKILL.md +97 -94
  82. package/bundled/skills/prizmkit-code-review/references/review-report-template.md +1 -0
  83. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +13 -1
  84. package/bundled/skills/prizmkit-committer/SKILL.md +59 -47
  85. package/bundled/skills/prizmkit-deploy/SKILL.md +162 -381
  86. package/bundled/skills/prizmkit-deploy/references/ssh-adapter-flow.md +220 -0
  87. package/bundled/skills/prizmkit-implement/SKILL.md +51 -40
  88. package/bundled/skills/prizmkit-init/SKILL.md +4 -3
  89. package/bundled/skills/prizmkit-plan/SKILL.md +85 -70
  90. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +94 -73
  91. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +20 -18
  92. package/bundled/skills/prizmkit-prizm-docs/references/op-update.md +18 -14
  93. package/bundled/skills/prizmkit-retrospective/SKILL.md +56 -48
  94. package/bundled/skills/prizmkit-retrospective/references/structural-sync-steps.md +79 -27
  95. package/bundled/skills/prizmkit-test/SKILL.md +138 -141
  96. package/bundled/skills/prizmkit-test/references/examples.md +10 -8
  97. package/bundled/skills/prizmkit-test/references/test-generation-steps.md +1 -1
  98. package/bundled/skills/prizmkit-test/references/test-report-template.md +2 -2
  99. package/bundled/skills/recovery-workflow/SKILL.md +195 -256
  100. package/bundled/skills/recovery-workflow/evals/evals.json +21 -13
  101. package/bundled/skills/recovery-workflow/references/detection.md +48 -39
  102. package/bundled/skills/recovery-workflow/scripts/detect-recovery-state.py +258 -322
  103. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +29 -11
  104. package/bundled/skills/refactor-planner/SKILL.md +2 -2
  105. package/bundled/skills/refactor-planner/references/behavior-preservation.md +24 -19
  106. package/bundled/skills/refactor-planner/references/fast-path.md +2 -4
  107. package/bundled/skills/refactor-planner/references/planning-phases.md +2 -2
  108. package/bundled/skills/refactor-workflow/SKILL.md +173 -307
  109. package/package.json +1 -1
  110. package/src/scaffold.js +5 -0
  111. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +0 -6
  112. package/bundled/skills/feature-workflow/references/brainstorm-guide.md +0 -137
  113. package/bundled/skills/refactor-workflow/references/brainstorm-guide.md +0 -116
@@ -0,0 +1,9 @@
1
+ ## Your Mission
2
+
3
+ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}".
4
+
5
+ **CRITICAL**: You MUST follow the workflow checkpoint. Do not treat a phase number as recovery truth; continue from the first pending/in-progress checkpoint step.
6
+
7
+ **NON-INTERACTIVE MODE**: There is NO human on the other end. NEVER ask for user confirmation, NEVER wait for user input. Make decisions autonomously from the bug report, existing code, tests, and conservative project patterns.
8
+
9
+ **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. `/prizmkit-code-review` owns its internal Reviewer Agent → filter → orchestrator fix loop.
@@ -0,0 +1,31 @@
1
+ ### Phase 4: Commit & Learn
2
+
3
+ Skip this phase only when the Manual / Hybrid Verification Gate stopped the fresh session before commit.
4
+
5
+ **Bug Fix Documentation Policy**:
6
+ - Default: run `/prizmkit-retrospective` with structural sync only.
7
+ - Full architecture knowledge capture only when the fix changes interfaces, dependencies, observable behavior, or reveals a durable TRAP.
8
+ - TRAPS must use Prizm docs format: `- [LOW|HIGH|CRITICAL] <description> | FIX: <approach>`. Do not add dates.
9
+
10
+ Run `/prizmkit-retrospective` using the current working tree and staged changes as input context. Do not rely only on `git diff --cached`.
11
+
12
+ Stage changed files explicitly; never use `git add -A` or `git add .`.
13
+
14
+ Run `/prizmkit-committer` with commit prefix:
15
+
16
+ ```text
17
+ fix({{FIX_SCOPE}}): {{BUG_TITLE}}
18
+ ```
19
+
20
+ Do not push.
21
+
22
+ Write `.prizmkit/bugfix/{{BUG_ID}}/fix-report.md` with:
23
+ - root cause summary;
24
+ - reproduction evidence;
25
+ - fix summary;
26
+ - files changed;
27
+ - review/test/browser evidence;
28
+ - manual/hybrid substitution evidence when applicable;
29
+ - acceptance criteria checklist.
30
+
31
+ **Checkpoint update**: Set `prizmkit-retrospective`, `prizmkit-committer`, and `bug-report` to `completed` as each finishes.
@@ -0,0 +1,22 @@
1
+ ### Plan Challenge — Critic Agent
2
+
3
+ **Guard**: Verify critic agent file exists before spawning:
4
+
5
+ ```bash
6
+ {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
7
+ ```
8
+
9
+ If `CRITIC:MISSING`, mark `critic-plan-review` as `skipped` and continue.
10
+
11
+ **Focus**: Challenge the bug diagnosis and fix plan before implementation:
12
+ - Is the root cause actually supported by the evidence?
13
+ - Does the reproduction test prove the bug before the fix?
14
+ - Is the fix minimal, or does it mask the symptom?
15
+ - Are adjacent regressions likely?
16
+ - Does manual/hybrid verification policy match `{{VERIFICATION_TYPE}}`?
17
+
18
+ Spawn `prizm-dev-team-critic` with default/no worktree isolation. Do not request AI tool-created worktree isolation.
19
+
20
+ The Critic writes `.prizmkit/bugfix/{{BUG_ID}}/challenge-report.md`. Resolve CRITICAL/HIGH findings before implementation, or document why the plan stands.
21
+
22
+ **Checkpoint update**: Set step `critic-plan-review` to `completed` after challenges are resolved, or `skipped` when critic is unavailable.
@@ -0,0 +1,23 @@
1
+ ### Phase 1: Diagnose & Plan
2
+
3
+ **Goal**: prove or strongly establish the root cause before editing code.
4
+
5
+ 1. Read `.prizmkit/prizm-docs/root.prizm`, then only the relevant L1/L2 docs for affected modules.
6
+ 2. Trace from the error source to the likely root cause:
7
+ - classify error type;
8
+ - inspect relevant TRAPS/RULES;
9
+ - identify affected files and tests;
10
+ - separate symptom from cause.
11
+ 3. Write `.prizmkit/bugfix/{{BUG_ID}}/context-snapshot.md` with concise summaries, not full-file dumps:
12
+ - Bug Brief
13
+ - Root Cause Hypothesis
14
+ - Affected Files and Key Interfaces
15
+ - Existing/Reproduction Tests
16
+ - Relevant TRAPS/RULES
17
+ 4. Run `/prizmkit-plan` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`.
18
+ 5. Ensure `plan.md` starts with a reproduction test task that would fail before the fix.
19
+ 6. Decide `FAST_PATH=true` only when root cause is obvious and plan has no more than 2 tasks.
20
+
21
+ **CP-BF-1**: `spec.md` and `plan.md` exist, and the first plan task is a reproduction test.
22
+
23
+ **Checkpoint update**: Set step `bug-diagnosis-and-plan` to `completed`.
@@ -0,0 +1,20 @@
1
+ ### Phase 2: Implement & Fix
2
+
3
+ **Goal**: execute the fix plan with RED → GREEN evidence.
4
+
5
+ Run `/prizmkit-implement` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`:
6
+
7
+ - Execute plan tasks in order.
8
+ - First task creates or identifies a reproduction test that fails before the fix.
9
+ - Subsequent tasks implement the minimal fix.
10
+ - Mark each task `[x]` immediately after completion.
11
+ - Run the smallest relevant reproduction test first; run broader regression checks only after the targeted test is green.
12
+ - Do not refactor unrelated code.
13
+
14
+ After implementation, verify:
15
+ 1. all plan tasks are `[x]`;
16
+ 2. reproduction test passes;
17
+ 3. no in-scope regression remains unexplained;
18
+ 4. acceptance criteria have evidence.
19
+
20
+ **Checkpoint update**: Set step `prizmkit-implement` to `completed`.
@@ -0,0 +1,9 @@
1
+ ### Phase 0: Initialize
2
+
3
+ Create the bugfix artifact directory:
4
+
5
+ ```bash
6
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/bugfix/{{BUG_ID}}
7
+ ```
8
+
9
+ **Checkpoint update**: Set step `prizmkit-init` to `completed` after the directory exists.
@@ -0,0 +1,15 @@
1
+ ### Manual / Hybrid Verification Gate
2
+
3
+ `verification_type` is `{{VERIFICATION_TYPE}}`.
4
+
5
+ For a fresh bugfix session, manual/hybrid verification is blocking before commit:
6
+
7
+ 1. Write `{{SESSION_STATUS_PATH}}` with:
8
+ - `status`: `partial`
9
+ - `can_resume`: `true`
10
+ - `resume_from_phase`: `4`
11
+ - explanation that manual UAT is required before commit
12
+ 2. Document the UAT checklist in `.prizmkit/bugfix/{{BUG_ID}}/fix-report.md` or `failure-log.md`.
13
+ 3. Stop before `/prizmkit-retrospective` and `/prizmkit-committer`.
14
+
15
+ Recovery-class sessions (retry, resume, continuation, context overflow) may substitute automated verification for manual/hybrid UAT, but must document the substitution evidence before committing.
@@ -0,0 +1,29 @@
1
+ ### Phase 3: Review
2
+
3
+ If `FAST_PATH=true`, skip this phase intentionally:
4
+
5
+ ```bash
6
+ {{CHECKPOINT_PYTHON_CMD}} \
7
+ --checkpoint-path {{CHECKPOINT_PATH}} \
8
+ --step prizmkit-code-review \
9
+ --status skipped \
10
+ --note "FAST_PATH: obvious root cause and <=2 tasks"
11
+ ```
12
+
13
+ Then continue to the next checkpoint step.
14
+
15
+ Otherwise, run `/prizmkit-code-review` with `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`.
16
+
17
+ The skill runs its internal Reviewer Agent → filter → orchestrator fix loop and writes `review-report.md`.
18
+
19
+ **Gate Check — Review Report**:
20
+
21
+ ```bash
22
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/bugfix/{{BUG_ID}}/review-report.md --pattern "## Verdict"
23
+ ```
24
+
25
+ - `PASS` → proceed.
26
+ - `NEEDS_FIXES` → the skill exhausted its internal rounds; log remaining findings and proceed only when they do not block acceptance criteria.
27
+ - Missing report → one bounded retry or safe inline fallback review, then write `failure-log.md` if still blocked.
28
+
29
+ **Checkpoint update**: Set step `prizmkit-code-review` to `completed` when review is complete, or `skipped` for FAST_PATH.
@@ -0,0 +1,11 @@
1
+ ## Reminders
2
+
3
+ - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
4
+ - All bugfix skills use `artifact_dir=.prizmkit/bugfix/{{BUG_ID}}/`.
5
+ - The first plan task must prove the bug with a reproduction test when feasible.
6
+ - Commit with `fix(<scope>):`, not `feat:`.
7
+ - Do not write TRAP dates into `.prizmkit/prizm-docs/`.
8
+ - Do not use top-level Dev subagents; implement directly as the orchestrator.
9
+ - Checkpoint state is the recovery truth; skipped steps must be marked `skipped`.
10
+ - Browser verification is a mandatory attempt by default; it blocks only when explicitly required.
11
+ - If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.
@@ -0,0 +1,7 @@
1
+ ## Session Context
2
+
3
+ - **Bug ID**: {{BUG_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
4
+ - **Bug Title**: {{BUG_TITLE}}
5
+ - **Severity**: {{SEVERITY}}
6
+ - **Mode**: {{PIPELINE_MODE}} | **Critic**: {{CRITIC_ENABLED}}
7
+ - **Verification Type**: {{VERIFICATION_TYPE}}
@@ -0,0 +1,31 @@
1
+ ### Step 3: Report Session Status
2
+
3
+ Before exiting, write the session status file:
4
+
5
+ `{{SESSION_STATUS_PATH}}`
6
+
7
+ ```json
8
+ {
9
+ "session_id": "{{SESSION_ID}}",
10
+ "bug_id": "{{BUG_ID}}",
11
+ "status": "<success|partial|failed>",
12
+ "completed_phases": [1, 2, 3, 4],
13
+ "current_phase": 4,
14
+ "checkpoint_reached": "<current checkpoint step>",
15
+ "fast_path": false,
16
+ "errors": [],
17
+ "can_resume": false,
18
+ "resume_from_phase": null,
19
+ "artifacts": {
20
+ "spec_path": ".prizmkit/bugfix/{{BUG_ID}}/spec.md",
21
+ "plan_path": ".prizmkit/bugfix/{{BUG_ID}}/plan.md",
22
+ "fix_report_path": ".prizmkit/bugfix/{{BUG_ID}}/fix-report.md"
23
+ },
24
+ "git_commit": "<commit hash or null>",
25
+ "traps_updated": false,
26
+ "manual_verification_policy": "{{MANUAL_VERIFICATION_POLICY}}",
27
+ "timestamp": "{{TIMESTAMP}}"
28
+ }
29
+ ```
30
+
31
+ For fresh manual/hybrid partial stops, set `status="partial"`, `can_resume=true`, and `resume_from_phase=4`.
@@ -0,0 +1,40 @@
1
+ ## Bug Fix Task Contract
2
+
3
+ ### Objective
4
+
5
+ Fix {{BUG_ID}}: "{{BUG_TITLE}}".
6
+
7
+ {{BUG_DESCRIPTION}}
8
+
9
+ {{USER_CONTEXT}}
10
+
11
+ ### Error Source
12
+
13
+ - **Type**: {{ERROR_SOURCE_TYPE}}
14
+ {{ERROR_SOURCE_DETAILS}}
15
+
16
+ ### Environment
17
+
18
+ {{ENVIRONMENT}}
19
+
20
+ ### Verification Contract
21
+
22
+ - **Verification Type**: {{VERIFICATION_TYPE}}
23
+ - **Manual/Hybrid Policy**: {{MANUAL_VERIFICATION_POLICY}}
24
+
25
+ ### Acceptance Criteria
26
+
27
+ {{ACCEPTANCE_CRITERIA}}
28
+
29
+ ### Gate Checklist
30
+
31
+ {{AC_CHECKLIST}}
32
+
33
+ Gate rule:
34
+ - `[x]` means verified with reproduction, implementation, test, review, or documented recovery evidence.
35
+ - Any remaining `[ ]` means the bug fix is incomplete.
36
+ - Blocked gates must be documented in `failure-log.md`; blocked is not success.
37
+
38
+ ### App Global Context
39
+
40
+ {{GLOBAL_CONTEXT}}
@@ -8,7 +8,7 @@ A checkpoint file tracks your progress through this workflow:
8
8
 
9
9
  Use this helper to update checkpoint status. Do not hand-edit `workflow-checkpoint.json` directly.
10
10
 
11
- ```bash
11
+ ```text
12
12
  {{CHECKPOINT_PYTHON_CMD}} \
13
13
  --checkpoint-path {{CHECKPOINT_PATH}} \
14
14
  --step <step-id-or-skill-name> \
@@ -2,10 +2,10 @@
2
2
 
3
3
  If you encounter an unrecoverable error, context overflow, or are about to exit without completing all phases:
4
4
 
5
- 1. Write `.prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md` BEFORE exiting:
5
+ 1. Write `{{ARTIFACT_DIR}}/failure-log.md` BEFORE exiting:
6
6
  ```
7
7
  FAILURE_TYPE: timeout | test_failure | review_rejected | context_overflow | unknown
8
- PHASE: <which phase failed>
8
+ PHASE: <failed phase or checkpoint step>
9
9
  ROOT_CAUSE: <1-2 sentence explanation>
10
10
  ATTEMPTED: <approaches already tried>
11
11
  SUGGESTION: <what the next session should try differently>
@@ -4,7 +4,7 @@ You MUST attempt this phase. Mark it as skipped only when no usable browser tool
4
4
 
5
5
  **Step 0 — Tool Selection (BLOCKING — decide before any browser action)**:
6
6
 
7
- 0a. Check which browser tools are available:
7
+ 0a. Check browser tool availability:
8
8
  ```bash
9
9
  {{RUNTIME_HELPER_CMD}} executable version playwright-cli --arg=--version
10
10
  {{RUNTIME_HELPER_CMD}} executable version opencli --arg=--version
@@ -0,0 +1,17 @@
1
+ ## Refactor Artifacts Directory
2
+
3
+ Use only this durable artifact directory for this refactor:
4
+
5
+ ```text
6
+ .prizmkit/refactor/{{REFACTOR_ID}}/
7
+ ├── spec.md
8
+ ├── plan.md
9
+ ├── context-snapshot.md
10
+ ├── review-report.md
11
+ ├── refactor-report.md
12
+ ├── completion-summary.json
13
+ ├── failure-log.md
14
+ └── workflow-checkpoint.json
15
+ ```
16
+
17
+ Do not write refactor artifacts under feature or bugfix artifact directories.
@@ -0,0 +1,13 @@
1
+ ## Critical Paths
2
+
3
+ | Resource | Path |
4
+ |----------|------|
5
+ | Refactor Artifacts Dir | `.prizmkit/refactor/{{REFACTOR_ID}}/` |
6
+ | Spec | `.prizmkit/refactor/{{REFACTOR_ID}}/spec.md` |
7
+ | Plan | `.prizmkit/refactor/{{REFACTOR_ID}}/plan.md` |
8
+ | Review Report | `.prizmkit/refactor/{{REFACTOR_ID}}/review-report.md` |
9
+ | Refactor Report | `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md` |
10
+ | Completion Summary | `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` |
11
+ | Workflow Checkpoint | `{{CHECKPOINT_PATH}}` |
12
+ | Session Status Output | `{{SESSION_STATUS_PATH}}` |
13
+ | Project Root | `{{PROJECT_ROOT}}` |
@@ -0,0 +1,9 @@
1
+ ## Your Mission
2
+
3
+ You are the **refactor session orchestrator**. Execute Refactor {{REFACTOR_ID}}: "{{REFACTOR_TITLE}}".
4
+
5
+ **CRITICAL**: Preserve observable behavior. Do not change product behavior unless the refactor contract explicitly requires it.
6
+
7
+ **Execution model**: You implement directly in the current checkout. Do not spawn a top-level Dev subagent. Do not spawn a top-level Reviewer subagent. `/prizmkit-code-review` owns its internal Reviewer Agent → filter → orchestrator fix loop.
8
+
9
+ **NON-INTERACTIVE MODE**: There is NO human on the other end. Resolve uncertainty from existing code and conservative project patterns.
@@ -0,0 +1,37 @@
1
+ ### Phase 4: Commit, Report & Completion Summary
2
+
3
+ **Refactor Documentation Policy**:
4
+ - Default: run `/prizmkit-retrospective` with full sync because refactoring changes structure and interfaces.
5
+ - Skip architecture knowledge injection only for a pure rename with no interface or dependency changes.
6
+
7
+ Run `/prizmkit-retrospective` using the current working tree and staged changes as input context. Do not rely only on `git diff --cached`.
8
+
9
+ Stage changed files explicitly; never use `git add -A` or `git add .`.
10
+
11
+ Run `/prizmkit-committer` with commit prefix:
12
+
13
+ ```text
14
+ refactor({{REFACTOR_ID}}): {{REFACTOR_TITLE}}
15
+ ```
16
+
17
+ Do not push.
18
+
19
+ Write `.prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md` with:
20
+ - refactor summary;
21
+ - files/modules changed;
22
+ - behavior-preservation evidence before/after;
23
+ - review findings;
24
+ - browser evidence when applicable;
25
+ - acceptance criteria checklist.
26
+
27
+ Write `.prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json` for downstream refactor context:
28
+
29
+ ```json
30
+ {
31
+ "completion_notes": [
32
+ "<key structural change, moved/renamed interface, or new module boundary>"
33
+ ]
34
+ }
35
+ ```
36
+
37
+ **Checkpoint update**: Set `prizmkit-retrospective`, `prizmkit-committer`, `refactor-report`, and `completion-summary` to `completed` as each finishes.
@@ -0,0 +1,22 @@
1
+ ### Plan Challenge — Critic Agent
2
+
3
+ **Guard**: Verify critic agent file exists before spawning:
4
+
5
+ ```bash
6
+ {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
7
+ ```
8
+
9
+ If `CRITIC:MISSING`, mark `critic-plan-review` as `skipped` and continue.
10
+
11
+ **Focus**: Challenge behavior preservation and plan safety before implementation:
12
+ - Is observable behavior clearly defined and protected?
13
+ - Do existing/new tests cover the behavior affected by this refactor?
14
+ - Is the plan too broad for the stated scope?
15
+ - Are file moves/renames safe for imports, public APIs, and integrations?
16
+ - Is rollback realistic?
17
+
18
+ Spawn `prizm-dev-team-critic` with default/no worktree isolation. Do not request AI tool-created worktree isolation.
19
+
20
+ The Critic writes `.prizmkit/refactor/{{REFACTOR_ID}}/challenge-report.md`. Resolve CRITICAL/HIGH findings before implementation, or document why the plan stands.
21
+
22
+ **Checkpoint update**: Set step `critic-plan-review` to `completed` after challenges are resolved, or `skipped` when critic is unavailable.
@@ -0,0 +1,16 @@
1
+ ### Phase 2: Implement — Orchestrator Direct
2
+
3
+ **Goal**: execute the refactor plan while preserving behavior.
4
+
5
+ Run `/prizmkit-implement` directly with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
6
+
7
+ Rules:
8
+ - You are the implementer; do not spawn a top-level Dev subagent.
9
+ - Establish a baseline test result before structural changes when feasible.
10
+ - Execute plan tasks in order and mark each `[x]` immediately.
11
+ - After each behavior-sensitive task, run the smallest relevant behavior-preservation check.
12
+ - Add or update tests only to lock existing behavior, not to change expected behavior.
13
+ - If tests fail unexpectedly, treat it as a behavior-preservation failure and fix before proceeding.
14
+ - Document changed module boundaries and any deviations from the plan in `context-snapshot.md`.
15
+
16
+ **Checkpoint update**: Set step `prizmkit-implement` to `completed` when all tasks are `[x]` and behavior-preservation evidence is recorded.
@@ -0,0 +1,9 @@
1
+ ### Phase 0: Initialize
2
+
3
+ Create the refactor artifact directory:
4
+
5
+ ```bash
6
+ {{RUNTIME_HELPER_CMD}} artifact ensure-dir .prizmkit/refactor/{{REFACTOR_ID}}
7
+ ```
8
+
9
+ **Checkpoint update**: Set step `prizmkit-init` to `completed` after the directory exists.
@@ -0,0 +1,22 @@
1
+ ### Phase 1: Plan — Specification & Plan Generation
2
+
3
+ **Goal**: produce a behavior-preserving refactor plan before editing code.
4
+
5
+ Run `/prizmkit-plan` with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
6
+
7
+ The spec.md must include:
8
+ - refactor goals and acceptance criteria;
9
+ - explicit scope boundaries;
10
+ - behavior preservation contract;
11
+ - existing tests and gaps.
12
+
13
+ The plan.md must include:
14
+ - safe task ordering: baseline checks → safe renames/moves → extractions → structural changes;
15
+ - files/modules to touch;
16
+ - behavior-preservation checks for each task;
17
+ - rollback strategy;
18
+ - Tasks section with `[ ]` checkboxes.
19
+
20
+ Resolve uncertain refactor details from existing code and conservative project patterns. Do not expand scope beyond the task contract.
21
+
22
+ **Checkpoint update**: Set step `prizmkit-plan` to `completed` after `spec.md` and `plan.md` exist.
@@ -0,0 +1,19 @@
1
+ ### Phase 3: Review — Code Review & Behavior Verification
2
+
3
+ Run `/prizmkit-code-review` directly with `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
4
+
5
+ Do not spawn a top-level Reviewer subagent. The code-review skill owns its internal Reviewer Agent → filter → orchestrator fix loop.
6
+
7
+ **Gate Check — Review Report**:
8
+
9
+ ```bash
10
+ {{RUNTIME_HELPER_CMD}} text contains .prizmkit/refactor/{{REFACTOR_ID}}/review-report.md --pattern "## Verdict"
11
+ ```
12
+
13
+ - `PASS` → proceed.
14
+ - `NEEDS_FIXES` → the skill exhausted its internal rounds; log remaining findings and proceed only when they do not block behavior preservation.
15
+ - Missing report → one bounded retry or safe inline fallback review, then write `failure-log.md` if still blocked.
16
+
17
+ Verify the review explicitly checks behavior preservation, public API compatibility, imports, tests, and rollback assumptions.
18
+
19
+ **Checkpoint update**: Set step `prizmkit-code-review` to `completed` when review is complete.
@@ -0,0 +1,11 @@
1
+ ## Reminders
2
+
3
+ - Use L1 skills: `/prizmkit-plan`, `/prizmkit-implement`, `/prizmkit-code-review`, `/prizmkit-retrospective`, `/prizmkit-committer`.
4
+ - All refactor skills use `artifact_dir=.prizmkit/refactor/{{REFACTOR_ID}}/`.
5
+ - Behavior preservation is the first priority.
6
+ - Do not spawn top-level Dev or Reviewer subagents.
7
+ - Main orchestrator runs `/prizmkit-code-review` directly.
8
+ - Commit with `refactor(<scope>):`, not `feat:` or `fix:`.
9
+ - Checkpoint state is the recovery truth; skipped steps must be marked `skipped`.
10
+ - Browser verification is a mandatory attempt by default; it blocks only when explicitly required.
11
+ - If `DEV_PORT` is unknown, discover it from project config; do not guess port 3000.
@@ -0,0 +1,7 @@
1
+ ## Session Context
2
+
3
+ - **Refactor ID**: {{REFACTOR_ID}} | **Session**: {{SESSION_ID}} | **Run**: {{RUN_ID}}
4
+ - **Title**: {{REFACTOR_TITLE}}
5
+ - **Type**: {{REFACTOR_TYPE}}
6
+ - **Priority**: {{PRIORITY}} | **Complexity**: {{COMPLEXITY}}
7
+ - **Mode**: {{PIPELINE_MODE}} | **Critic**: {{CRITIC_ENABLED}}
@@ -0,0 +1,28 @@
1
+ ### Step 3: Report Session Status
2
+
3
+ Before exiting, write the session status file:
4
+
5
+ `{{SESSION_STATUS_PATH}}`
6
+
7
+ ```json
8
+ {
9
+ "session_id": "{{SESSION_ID}}",
10
+ "refactor_id": "{{REFACTOR_ID}}",
11
+ "status": "<success|partial|failed>",
12
+ "completed_phases": [1, 2, 3, 4],
13
+ "current_phase": 4,
14
+ "checkpoint_reached": "<current checkpoint step>",
15
+ "errors": [],
16
+ "can_resume": false,
17
+ "resume_from_phase": null,
18
+ "artifacts": {
19
+ "spec_path": ".prizmkit/refactor/{{REFACTOR_ID}}/spec.md",
20
+ "plan_path": ".prizmkit/refactor/{{REFACTOR_ID}}/plan.md",
21
+ "report_path": ".prizmkit/refactor/{{REFACTOR_ID}}/refactor-report.md",
22
+ "completion_summary_path": ".prizmkit/refactor/{{REFACTOR_ID}}/completion-summary.json"
23
+ },
24
+ "git_commit": "<commit hash>",
25
+ "behavior_preserved": true,
26
+ "timestamp": "{{TIMESTAMP}}"
27
+ }
28
+ ```
@@ -0,0 +1,52 @@
1
+ ## Refactor Task Contract
2
+
3
+ ### Objective
4
+
5
+ Execute {{REFACTOR_ID}}: "{{REFACTOR_TITLE}}".
6
+
7
+ {{REFACTOR_DESCRIPTION}}
8
+
9
+ {{USER_CONTEXT}}
10
+
11
+ ### Scope
12
+
13
+ **Files:**
14
+ {{SCOPE_FILES}}
15
+
16
+ **Modules:**
17
+ {{SCOPE_MODULES}}
18
+
19
+ ### Behavior Preservation
20
+
21
+ - **Strategy**: {{BEHAVIOR_STRATEGY}}
22
+
23
+ {{BEHAVIOR_PRESERVATION}}
24
+
25
+ ### Existing Tests
26
+
27
+ {{EXISTING_TESTS}}
28
+
29
+ ### New Tests Needed
30
+
31
+ {{NEW_TESTS_NEEDED}}
32
+
33
+ ### Acceptance Criteria
34
+
35
+ {{ACCEPTANCE_CRITERIA}}
36
+
37
+ ### Gate Checklist
38
+
39
+ {{AC_CHECKLIST}}
40
+
41
+ Gate rule:
42
+ - `[x]` means verified with behavior-preservation evidence.
43
+ - Any remaining `[ ]` means the refactor is incomplete.
44
+ - Blocked gates must be documented in `failure-log.md`; blocked is not success.
45
+
46
+ ### Dependencies
47
+
48
+ {{DEPENDENCIES}}
49
+
50
+ ### App Global Context
51
+
52
+ {{GLOBAL_CONTEXT}}