prizmkit 1.1.106 → 1.1.108

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 (85) hide show
  1. package/bin/create-prizmkit.js +4 -0
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/dev-pipeline/prizmkit_runtime/config.py +81 -14
  4. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +19 -8
  5. package/bundled/dev-pipeline/prizmkit_runtime/interoperability.py +0 -1
  6. package/bundled/dev-pipeline/prizmkit_runtime/launch_profiles.py +18 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/runner_bookkeeping.py +22 -2
  8. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +56 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -8
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_recovery.py +11 -1
  11. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +298 -63
  12. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +243 -37
  13. package/bundled/dev-pipeline/scripts/continuation.py +0 -5
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +10 -82
  15. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +7 -64
  16. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +40 -63
  17. package/bundled/dev-pipeline/scripts/utils.py +123 -0
  18. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +4 -3
  19. package/bundled/dev-pipeline/templates/agent-prompts/reviewer-review.md +5 -6
  20. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  21. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +36 -35
  22. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +53 -80
  23. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +43 -78
  24. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +5 -17
  25. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +6 -18
  26. package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +14 -48
  27. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +7 -14
  28. package/bundled/dev-pipeline/templates/sections/feature-context.md +0 -4
  29. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-auto.md +0 -7
  30. package/bundled/dev-pipeline/templates/sections/phase-browser-verification-opencli.md +0 -7
  31. package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +0 -7
  32. package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +0 -14
  33. package/bundled/dev-pipeline/templates/sections/phase-commit.md +0 -14
  34. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +0 -7
  35. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-base.md +0 -2
  36. package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +0 -7
  37. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +6 -8
  38. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +3 -7
  39. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +4 -16
  40. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +4 -17
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +0 -7
  42. package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +2 -9
  43. package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +1 -8
  44. package/bundled/dev-pipeline/templates/sections/phase-prizmkit-test.md +15 -16
  45. package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -10
  46. package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -10
  47. package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +2 -9
  48. package/bundled/dev-pipeline/templates/sections/phase0-init.md +0 -7
  49. package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +2 -15
  50. package/bundled/dev-pipeline/tests/conftest.py +0 -1
  51. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +395 -21
  52. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +50 -14
  53. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +154 -2
  54. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +431 -3
  55. package/bundled/dev-pipeline/tests/test_unified_cli.py +857 -5
  56. package/bundled/skills/_metadata.json +4 -4
  57. package/bundled/skills/app-planner/SKILL.md +1 -1
  58. package/bundled/skills/app-planner/references/architecture-decisions.md +1 -1
  59. package/bundled/skills/bug-fix-workflow/SKILL.md +174 -128
  60. package/bundled/skills/bug-planner/SKILL.md +101 -15
  61. package/bundled/skills/bug-planner/references/severity-rules.md +20 -8
  62. package/bundled/skills/feature-planner/SKILL.md +87 -8
  63. package/bundled/skills/feature-planner/assets/planning-guide.md +34 -10
  64. package/bundled/skills/feature-workflow/SKILL.md +100 -81
  65. package/bundled/skills/{prizm-kit → prizmkit}/SKILL.md +1 -1
  66. package/bundled/skills/prizmkit-code-review/SKILL.md +12 -13
  67. package/bundled/skills/prizmkit-code-review/references/reviewer-agent-prompt.md +10 -10
  68. package/bundled/skills/refactor-planner/SKILL.md +88 -7
  69. package/bundled/skills/refactor-planner/references/fast-path.md +2 -1
  70. package/bundled/skills/refactor-planner/references/planning-phases.md +29 -11
  71. package/bundled/skills/refactor-workflow/SKILL.md +116 -57
  72. package/bundled/templates/project-memory-template.md +1 -1
  73. package/package.json +1 -1
  74. package/src/ai-cli-launch.js +194 -0
  75. package/src/config.js +26 -14
  76. package/src/index.js +11 -44
  77. package/src/platforms.js +10 -3
  78. package/src/prompts.js +60 -2
  79. package/src/scaffold.js +26 -14
  80. package/bundled/dev-pipeline/scripts/prizmkit-test-gate.py +0 -446
  81. package/bundled/dev-pipeline/templates/agent-prompts/dev-fix.md +0 -7
  82. package/bundled/dev-pipeline/templates/agent-prompts/dev-resume.md +0 -5
  83. package/bundled/dev-pipeline/templates/sections/log-size-awareness.md +0 -20
  84. package/bundled/dev-pipeline/tests/test_prizmkit_test_gate.py +0 -107
  85. package/bundled/skills/prizmkit-code-review/references/dev-agent-prompt.md +0 -30
@@ -1,446 +0,0 @@
1
- #!/usr/bin/env python3
2
- """Scoped PrizmKit test gate for feature pipeline prompts.
3
-
4
- The feature bootstrap prompt calls this script instead of embedding the full
5
- Bash/PowerShell report validation logic inline. It intentionally prints compact
6
- `GATE:*` lines so the AI session can decide whether to continue, retry, or stop.
7
- """
8
-
9
- import argparse
10
- import os
11
- import subprocess
12
- import sys
13
- from pathlib import Path
14
-
15
- REQUIRED_BOUNDARY_COLUMNS = [
16
- "Module",
17
- "Interface",
18
- "Service Type",
19
- "Happy Path",
20
- "Request Validation",
21
- "Auth / Permission / Ownership",
22
- "Domain Invariants",
23
- "Collection / Pagination",
24
- "Date / Time",
25
- "State Transitions",
26
- "Dependency Failure",
27
- "Response Contract",
28
- "N/A Reasons",
29
- "Final Status",
30
- ]
31
-
32
- BOUNDARY_VALIDATOR_CANDIDATES = [
33
- ".claude/command-assets/prizmkit-test/scripts/validate_boundary_report.py",
34
- ".codebuddy/skills/prizmkit-test/scripts/validate_boundary_report.py",
35
- ".agents/skills/prizmkit-test/scripts/validate_boundary_report.py",
36
- ]
37
-
38
- OPENAPI_CANDIDATES = [
39
- "openapi.yaml",
40
- "openapi.yml",
41
- "swagger.yaml",
42
- "swagger.yml",
43
- "docs/openapi.yaml",
44
- "docs/openapi.yml",
45
- "docs/swagger.yaml",
46
- "docs/swagger.yml",
47
- "api/openapi.yaml",
48
- "api/openapi.yml",
49
- "api/swagger.yaml",
50
- "api/swagger.yml",
51
- ]
52
-
53
- IGNORED_SCOPE_VALUES = {"none", "n/a", "not applicable", "(none)", "{...}", "..."}
54
-
55
-
56
- def default_artifact_dir(feature_slug):
57
- return ".prizmkit/specs/{}/".format(feature_slug)
58
-
59
-
60
- def marker_path(feature_slug):
61
- return os.path.join(default_artifact_dir(feature_slug), ".prizmkit-test-started")
62
-
63
-
64
- def pointer_path(feature_slug):
65
- return os.path.join(default_artifact_dir(feature_slug), "test-report-path.txt")
66
-
67
-
68
- def normalize_artifact_dir(path):
69
- return str(path or "").strip().replace("\\", "/").rstrip("/")
70
-
71
-
72
- def read_text(path):
73
- with open(path, "r", encoding="utf-8") as fh:
74
- return fh.read()
75
-
76
-
77
- def start_gate(feature_slug):
78
- marker = marker_path(feature_slug)
79
- os.makedirs(os.path.dirname(marker), exist_ok=True)
80
- Path(marker).touch()
81
- return {"gate": "GATE:START", "marker": marker}
82
-
83
-
84
- def newest_report_after_marker(marker):
85
- if not os.path.isfile(marker):
86
- return ""
87
- try:
88
- marker_mtime = os.path.getmtime(marker)
89
- except OSError:
90
- return ""
91
-
92
- matches = []
93
- for root, _dirs, files in os.walk(os.path.join(".prizmkit", "test")):
94
- if "test-report.md" not in files:
95
- continue
96
- path = os.path.join(root, "test-report.md")
97
- try:
98
- report_mtime = os.path.getmtime(path)
99
- except OSError:
100
- continue
101
- if report_mtime >= marker_mtime:
102
- matches.append((report_mtime, path))
103
-
104
- if not matches:
105
- return ""
106
- return sorted(matches)[-1][1]
107
-
108
-
109
- def extract_section(report_text, heading):
110
- in_section = False
111
- lines = []
112
- for raw_line in report_text.splitlines():
113
- line = raw_line.strip()
114
- if line == heading:
115
- in_section = True
116
- continue
117
- if in_section and line.startswith("## "):
118
- break
119
- if in_section:
120
- lines.append(raw_line)
121
- return lines
122
-
123
-
124
- def extract_scope_field(report_text, field_name):
125
- prefix = "- {}:".format(field_name)
126
- for raw_line in extract_section(report_text, "## Scope"):
127
- line = raw_line.strip()
128
- if line.startswith(prefix):
129
- return line[len(prefix):].strip()
130
- return ""
131
-
132
-
133
- def extract_verdict(report_text):
134
- for raw_line in extract_section(report_text, "## Verdict"):
135
- line = raw_line.strip()
136
- if line:
137
- return line
138
- return ""
139
-
140
-
141
- def extract_key_value(section_lines, field_name):
142
- prefix = "{}:".format(field_name).lower()
143
- for raw_line in section_lines:
144
- line = raw_line.strip()
145
- if line.startswith("-"):
146
- line = line[1:].strip()
147
- if line.lower().startswith(prefix):
148
- return line[len(prefix):].strip()
149
- return ""
150
-
151
-
152
- def parse_markdown_cells(line):
153
- stripped = line.strip()
154
- if not stripped.startswith("|"):
155
- return []
156
- return [cell.strip() for cell in stripped.strip("|").split("|")]
157
-
158
-
159
- def boundary_columns_ok(matrix_lines):
160
- for line in matrix_lines:
161
- cells = parse_markdown_cells(line)
162
- if cells and all(column in cells for column in REQUIRED_BOUNDARY_COLUMNS):
163
- return True
164
- return False
165
-
166
-
167
- def boundary_incomplete(matrix_lines):
168
- text = "\n".join(matrix_lines).lower()
169
- return any(token in text for token in ["boundary-missing", "happy-path-only", "unresolved"])
170
-
171
-
172
- def discover_openapi_file():
173
- for candidate in OPENAPI_CANDIDATES:
174
- if os.path.isfile(candidate):
175
- return candidate
176
- return ""
177
-
178
-
179
- def boundary_validator_passed(report_path, openapi_file):
180
- for validator in BOUNDARY_VALIDATOR_CANDIDATES:
181
- if not os.path.isfile(validator):
182
- continue
183
- args = [sys.executable, validator, "--report", report_path]
184
- if openapi_file:
185
- args.extend(["--openapi", openapi_file])
186
- result = subprocess.run(
187
- args,
188
- stdout=subprocess.DEVNULL,
189
- stderr=subprocess.DEVNULL,
190
- check=False,
191
- )
192
- if result.returncode == 0:
193
- return True
194
- return False
195
-
196
-
197
- def scope_list(report_text, name):
198
- values = []
199
- in_list = False
200
- marker = "- {}:".format(name)
201
- for raw_line in extract_section(report_text, "## Scope"):
202
- line = raw_line.strip()
203
- if line == marker:
204
- in_list = True
205
- continue
206
- if not in_list:
207
- continue
208
- if raw_line.startswith(" -") or raw_line.startswith("\t-"):
209
- value = line[2:].strip().strip("`")
210
- if value and value not in {"{...}", "..."}:
211
- values.append(value)
212
- continue
213
- if line.startswith("- "):
214
- break
215
- return values
216
-
217
-
218
- def path_is_inside_project(project_root, candidate):
219
- try:
220
- return os.path.commonpath([project_root, candidate]) == project_root
221
- except ValueError:
222
- return False
223
-
224
-
225
- def scope_fresh_ok(report_path, marker, report_text):
226
- try:
227
- report_mtime = os.path.getmtime(report_path)
228
- marker_mtime = os.path.getmtime(marker)
229
- except OSError:
230
- return False
231
- if report_mtime < marker_mtime:
232
- return False
233
-
234
- source_files = scope_list(report_text, "In-Scope Source Files")
235
- test_files = scope_list(report_text, "In-Scope Test Files")
236
- if not source_files or not test_files:
237
- return False
238
-
239
- project_root = os.path.realpath(os.getcwd())
240
- for listed_file in source_files + test_files:
241
- normalized = listed_file.strip().strip("`")
242
- if not normalized or normalized.lower() in IGNORED_SCOPE_VALUES:
243
- return False
244
- candidate = normalized if os.path.isabs(normalized) else os.path.join(os.getcwd(), normalized)
245
- candidate_real = os.path.realpath(candidate)
246
- if not path_is_inside_project(project_root, candidate_real):
247
- return False
248
- if not os.path.isfile(candidate_real):
249
- return False
250
- if os.path.getmtime(candidate_real) > report_mtime:
251
- return False
252
- return True
253
-
254
-
255
- def write_report_pointer(feature_slug, report_path):
256
- path = pointer_path(feature_slug)
257
- os.makedirs(os.path.dirname(path), exist_ok=True)
258
- with open(path, "w", encoding="utf-8") as fh:
259
- fh.write(report_path + "\n")
260
- return path
261
-
262
-
263
- def update_checkpoint(checkpoint_path):
264
- script_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "update-checkpoint.py")
265
- if not checkpoint_path:
266
- return True, ""
267
- result = subprocess.run(
268
- [
269
- sys.executable,
270
- script_path,
271
- "--checkpoint-path",
272
- checkpoint_path,
273
- "--step",
274
- "prizmkit-test",
275
- "--status",
276
- "completed",
277
- ],
278
- stdout=subprocess.PIPE,
279
- stderr=subprocess.STDOUT,
280
- text=True,
281
- check=False,
282
- )
283
- if result.returncode == 0:
284
- return True, ""
285
- output = " ".join((result.stdout or "").split())
286
- return False, output[:500]
287
-
288
-
289
- def validate_report(report_path, marker, feature_slug, expected_artifact_dir):
290
- try:
291
- report_text = read_text(report_path)
292
- except OSError as exc:
293
- return {
294
- "status": "FAIL",
295
- "reason": "unreadable_report",
296
- "error": str(exc),
297
- "report": report_path,
298
- }
299
-
300
- report_mode = extract_scope_field(report_text, "Mode")
301
- report_artifact_dir = extract_scope_field(report_text, "Artifact Dir")
302
- report_verdict = extract_verdict(report_text)
303
-
304
- boundary_gate = extract_section(report_text, "## Boundary Completion Gate")
305
- boundary_matrix = extract_section(report_text, "## Boundary Matrix")
306
- boundary_validation = extract_section(report_text, "## Boundary Validation")
307
-
308
- gate_passed = extract_key_value(boundary_gate, "Completion gate passed")
309
- boundary_missing = extract_key_value(boundary_gate, "Boundary-missing")
310
- happy_path_only = extract_key_value(boundary_gate, "Happy-path-only")
311
- validation_result = extract_key_value(boundary_validation, "Validator result").lower()
312
-
313
- columns_ok = boundary_columns_ok(boundary_matrix)
314
- incomplete = boundary_incomplete(boundary_matrix)
315
- openapi_file = discover_openapi_file()
316
- validator_ok = boundary_validator_passed(report_path, openapi_file)
317
- fresh_ok = scope_fresh_ok(report_path, marker, report_text)
318
-
319
- artifact_ok = normalize_artifact_dir(report_artifact_dir) == normalize_artifact_dir(expected_artifact_dir)
320
- boundary_ok = (
321
- columns_ok
322
- and not incomplete
323
- and gate_passed == "yes"
324
- and boundary_missing == "0"
325
- and happy_path_only == "0"
326
- and validation_result == "passed"
327
- and validator_ok
328
- and fresh_ok
329
- )
330
-
331
- result = {
332
- "status": "PASS" if report_mode == "this-change" and artifact_ok and report_verdict == "PASS" and boundary_ok else "FAIL",
333
- "verdict": report_verdict,
334
- "mode": report_mode,
335
- "artifact_dir": report_artifact_dir,
336
- "boundary_gate": gate_passed,
337
- "boundary_missing": boundary_missing,
338
- "happy_path_only": happy_path_only,
339
- "boundary_validation": validation_result,
340
- "validator_passed": "1" if validator_ok else "0",
341
- "scope_fresh": "1" if fresh_ok else "0",
342
- "openapi": openapi_file,
343
- "report": report_path,
344
- "feature_slug": feature_slug,
345
- }
346
- if not columns_ok:
347
- result["reason"] = "boundary_columns_missing"
348
- elif incomplete:
349
- result["reason"] = "boundary_incomplete"
350
- elif not fresh_ok:
351
- result["reason"] = "scope_not_fresh"
352
- elif not artifact_ok:
353
- result["reason"] = "wrong_artifact_dir"
354
- elif report_mode != "this-change":
355
- result["reason"] = "wrong_mode"
356
- elif report_verdict != "PASS":
357
- result["reason"] = "verdict_not_pass"
358
- elif not validator_ok:
359
- result["reason"] = "validator_failed"
360
- elif not boundary_ok:
361
- result["reason"] = "boundary_gate_failed"
362
- return result
363
-
364
-
365
- def check_gate(feature_slug, artifact_dir=None, checkpoint_path=None):
366
- expected_artifact_dir = artifact_dir or default_artifact_dir(feature_slug)
367
- marker = marker_path(feature_slug)
368
- report_path = newest_report_after_marker(marker)
369
- if not report_path:
370
- return {"status": "MISSING", "marker": marker}
371
-
372
- result = validate_report(report_path, marker, feature_slug, expected_artifact_dir)
373
- if result["status"] != "PASS":
374
- return result
375
-
376
- write_report_pointer(feature_slug, report_path)
377
- checkpoint_ok, checkpoint_error = update_checkpoint(checkpoint_path)
378
- if not checkpoint_ok:
379
- result["status"] = "FAIL"
380
- result["reason"] = "checkpoint_update_failed"
381
- result["checkpoint_error"] = checkpoint_error
382
- return result
383
-
384
-
385
- def format_result(result):
386
- status = result.get("status") or result.get("gate", "")
387
- if status == "GATE:START":
388
- return "GATE:START marker={}".format(result.get("marker", ""))
389
- if status == "MISSING":
390
- return "GATE:MISSING marker={}".format(result.get("marker", ""))
391
- if status == "PASS":
392
- return "GATE:PASS {}".format(result.get("report", ""))
393
-
394
- ordered = [
395
- "reason",
396
- "verdict",
397
- "mode",
398
- "artifact_dir",
399
- "boundary_gate",
400
- "boundary_missing",
401
- "happy_path_only",
402
- "boundary_validation",
403
- "validator_passed",
404
- "scope_fresh",
405
- "openapi",
406
- "report",
407
- "checkpoint_error",
408
- "error",
409
- ]
410
- parts = []
411
- for key in ordered:
412
- value = result.get(key)
413
- if value is not None and value != "":
414
- parts.append("{}={}".format(key, value))
415
- return "GATE:FAIL {}".format(" ".join(parts)).rstrip()
416
-
417
-
418
- def build_parser():
419
- parser = argparse.ArgumentParser(
420
- description="Run the scoped PrizmKit feature test gate.",
421
- )
422
- subparsers = parser.add_subparsers(dest="command", required=True)
423
-
424
- start = subparsers.add_parser("start", help="Create the test gate marker")
425
- start.add_argument("--feature-slug", required=True)
426
-
427
- check = subparsers.add_parser("check", help="Validate the latest scoped test report")
428
- check.add_argument("--feature-slug", required=True)
429
- check.add_argument("--artifact-dir", default="")
430
- check.add_argument("--checkpoint-path", default="")
431
- return parser
432
-
433
-
434
- def main(argv=None):
435
- parser = build_parser()
436
- args = parser.parse_args(argv)
437
- if args.command == "start":
438
- result = start_gate(args.feature_slug)
439
- else:
440
- result = check_gate(args.feature_slug, args.artifact_dir, args.checkpoint_path)
441
- print(format_result(result))
442
- return 0
443
-
444
-
445
- if __name__ == "__main__":
446
- sys.exit(main())
@@ -1,7 +0,0 @@
1
- "Read {{DEV_SUBAGENT_PATH}}. Fix NEEDS_FIXES issues for feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
2
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/review-report.md` — contains structured Fix Instructions with exact steps.
3
- 2. Follow Fix Instructions in order (respect Depends On / Blocks dependencies). Each FIX-N has: Root Cause, Fix Strategy, Code Guidance, and Verification criteria.
4
- 3. After each fix, run the Verification command listed in that FIX-N to confirm it works.
5
- 4. Run `{{TEST_CMD}}` to verify no regressions.
6
- 5. Append fix summary to '## Implementation Log' in context-snapshot.md.
7
- 6. Do NOT execute any git commands."
@@ -1,5 +0,0 @@
1
- "Read {{DEV_SUBAGENT_PATH}}. You are resuming implementation of feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}).
2
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — Section 4 has File Manifest, 'Implementation Log' (if present) shows what was already done.
3
- 2. Run `git diff HEAD` to see actual code changes already made.
4
- 3. Run `/prizmkit-implement` to complete the remaining `[ ]` tasks. Run tests with: `{{TEST_CMD}}`.
5
- 4. Do NOT execute any git commands."
@@ -1,20 +0,0 @@
1
- ## Session Log Budget Awareness (CHECKPOINT GUIDANCE)
2
-
3
- This section provides passive checkpoint guidance for checkpoint/continuation only. Context-saving rules (anti re-read, output filtering) live in Context Budget Rules above — do not duplicate.
4
-
5
- ### Checkpoint Before Large Work Batches
6
-
7
- - `MAX_LOG_SIZE` controls whether this advisory section is included.
8
- - Before major phases or large task batches, update durable artifacts: plan/task checkboxes, context snapshots, implementation/review notes, workflow checkpoints, session status, test reports.
9
- - Checkpoint often so automatic continuation can resume from durable state.
10
-
11
- ### Headless Recovery Source of Truth
12
-
13
- - Headless recovery must rely on durable checkpoints and artifacts, not interactive slash commands.
14
- - If context overflow occurs, the runner detects it and starts a fresh continuation session from checkpoint files and durable artifacts.
15
- - Durable checkpoint files are the source of truth for what was completed, what remains, and which gates were already run.
16
-
17
- ### Interactive Claude Code Note
18
-
19
- - `/compact` may help when a human is manually operating an interactive Claude Code session.
20
- - `/compact` is optional interactive convenience only — not required for headless recovery.
@@ -1,107 +0,0 @@
1
- """Tests for prizmkit-test-gate.py."""
2
-
3
- import json
4
- import os
5
- import time
6
- from pathlib import Path
7
-
8
- from prizmkit_test_gate import check_gate, start_gate
9
-
10
-
11
- def scoped_report_text():
12
- return "\n".join([
13
- "# Test Report",
14
- "",
15
- "## Scope",
16
- "- Mode: this-change",
17
- "- Artifact Dir: .prizmkit/specs/123-scope-test/",
18
- "- In-Scope Source Files:",
19
- " - src/feature.js",
20
- "- In-Scope Test Files:",
21
- " - tests/feature.test.js",
22
- "",
23
- "## Boundary Matrix",
24
- "| Module | Interface | Service Type | Happy Path | Request Validation | Auth / Permission / Ownership | Domain Invariants | Collection / Pagination | Date / Time | State Transitions | Dependency Failure | Response Contract | N/A Reasons | Final Status |",
25
- "|--------|-----------|--------------|------------|--------------------|-------------------------------|-------------------|-------------------------|-------------|-------------------|-------------------|-------------------|-------------|--------------|",
26
- "| feature | POST /feature | API | covered | covered | covered | covered | covered | covered | covered | covered | covered | none | boundary-covered |",
27
- "",
28
- "## Boundary Completion Gate",
29
- "- Interfaces total: 1",
30
- "- Boundary-covered: 1",
31
- "- Boundary-missing: 0",
32
- "- Happy-path-only: 0",
33
- "- Completion gate passed: yes",
34
- "",
35
- "## Boundary Validation",
36
- "- Validator command: `python3 validate_boundary_report.py`",
37
- "- Validator result: passed",
38
- "- Validator output: Boundary report validation: PASS",
39
- "",
40
- "## Verdict",
41
- "PASS",
42
- "",
43
- ])
44
-
45
-
46
- def prepare_project(tmp_path):
47
- (tmp_path / "src").mkdir()
48
- (tmp_path / "tests").mkdir()
49
- (tmp_path / "src" / "feature.js").write_text("export const feature = true;\n", encoding="utf-8")
50
- (tmp_path / "tests" / "feature.test.js").write_text("test('feature', () => {});\n", encoding="utf-8")
51
-
52
- validator = tmp_path / ".claude" / "command-assets" / "prizmkit-test" / "scripts" / "validate_boundary_report.py"
53
- validator.parent.mkdir(parents=True, exist_ok=True)
54
- validator.write_text("import sys\nsys.exit(0)\n", encoding="utf-8")
55
-
56
- checkpoint = tmp_path / ".prizmkit" / "specs" / "123-scope-test" / "workflow-checkpoint.json"
57
- checkpoint.parent.mkdir(parents=True, exist_ok=True)
58
- checkpoint.write_text(
59
- json.dumps({"steps": [{"id": "S01", "skill": "prizmkit-test", "status": "pending"}]}),
60
- encoding="utf-8",
61
- )
62
- return checkpoint
63
-
64
-
65
- def write_report(tmp_path):
66
- report = tmp_path / ".prizmkit" / "test" / "run" / "test-report.md"
67
- report.parent.mkdir(parents=True, exist_ok=True)
68
- time.sleep(0.01)
69
- report.write_text(scoped_report_text(), encoding="utf-8")
70
- return report
71
-
72
-
73
- def test_gate_pass_writes_pointer_and_updates_checkpoint(tmp_path, monkeypatch):
74
- monkeypatch.chdir(tmp_path)
75
- checkpoint = prepare_project(tmp_path)
76
- start = start_gate("123-scope-test")
77
- report = write_report(tmp_path)
78
-
79
- result = check_gate(
80
- "123-scope-test",
81
- ".prizmkit/specs/123-scope-test/",
82
- str(checkpoint),
83
- )
84
-
85
- assert start["gate"] == "GATE:START"
86
- assert result["status"] == "PASS"
87
- assert result["report"] == os.path.join(".prizmkit", "test", "run", "test-report.md")
88
- pointer = tmp_path / ".prizmkit" / "specs" / "123-scope-test" / "test-report-path.txt"
89
- assert pointer.read_text(encoding="utf-8").strip() == str(report.relative_to(tmp_path))
90
- checkpoint_data = json.loads(checkpoint.read_text(encoding="utf-8"))
91
- assert checkpoint_data["steps"][0]["status"] == "completed"
92
-
93
-
94
- def test_gate_fails_when_in_scope_file_is_newer_than_report(tmp_path, monkeypatch):
95
- monkeypatch.chdir(tmp_path)
96
- prepare_project(tmp_path)
97
- start_gate("123-scope-test")
98
- report = write_report(tmp_path)
99
- now = time.time()
100
- os.utime(report, (now, now))
101
- os.utime(tmp_path / "src" / "feature.js", (now + 10, now + 10))
102
-
103
- result = check_gate("123-scope-test", ".prizmkit/specs/123-scope-test/", "")
104
-
105
- assert result["status"] == "FAIL"
106
- assert result["reason"] == "scope_not_fresh"
107
- assert result["scope_fresh"] == "0"
@@ -1,30 +0,0 @@
1
- # Dev Agent Prompt Template
2
-
3
- Used in Phase 1 Step 4 of `/prizmkit-code-review`. The orchestrator fills `{spec context}` and `{accepted findings}` before spawning the Dev Agent.
4
-
5
- ```
6
- You are a developer fixing code review findings. Apply each fix carefully without breaking existing functionality.
7
-
8
- ## Spec Context
9
- {goals from spec.md for reference}
10
-
11
- ## Findings to Fix
12
- {accepted findings list — each with Severity, Location, Problem, Suggestion, Verification}
13
-
14
- ## Instructions
15
- 1. Read each finding carefully.
16
- 2. For each finding:
17
- a. Read the relevant code and understand the context.
18
- b. Implement the fix based on the suggestion.
19
- c. If a suggestion is not feasible (would break other functionality, technically impossible), explain why.
20
- 3. After all fixes, report what you did.
21
-
22
- ## Output Format
23
- For each finding, report:
24
- - **Finding N**: [fixed | unable-to-fix]
25
- - **What was done**: Brief description
26
- - **Files modified**: List of changed files
27
- (If unable-to-fix, explain why)
28
- ```
29
-
30
- After the Dev Agent returns, record results and return to Step 1 for the next round.