prizmkit 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/VERSION.json +3 -3
- package/bundled/dev-pipeline/run-bugfix.sh +35 -0
- package/bundled/dev-pipeline/run-feature.sh +33 -0
- package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +221 -0
- package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +124 -0
- package/bundled/dev-pipeline/templates/agent-prompts/dev-implement.md +2 -1
- package/bundled/dev-pipeline/templates/bootstrap-tier1.md +4 -0
- package/bundled/dev-pipeline/templates/bootstrap-tier2.md +5 -2
- package/bundled/dev-pipeline/templates/bootstrap-tier3.md +5 -2
- package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +20 -1
- package/bundled/dev-pipeline/templates/sections/checkpoint-system.md +36 -0
- package/bundled/dev-pipeline/templates/sections/failure-log-check.md +2 -1
- package/bundled/dev-pipeline/templates/sections/phase-analyze-agent.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-analyze-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-browser-verification.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-commit-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-commit.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-agent-suffix.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-context-snapshot-lite-suffix.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-code.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-deploy-verification.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-implement-lite.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-plan-agent.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-plan-lite.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-review-agent.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-review-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase-specify-plan-full.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase0-init.md +3 -0
- package/bundled/dev-pipeline/templates/sections/phase0-test-baseline.md +3 -0
- package/bundled/dev-pipeline/templates/sections/resume-header.md +4 -1
- package/bundled/rules/prizm/prizm-commit-workflow.md +1 -0
- package/bundled/rules/prizm/prizm-documentation.md +15 -15
- package/bundled/rules/prizm/prizm-progressive-loading.md +2 -1
- package/bundled/skills/_metadata.json +1 -1
- package/bundled/skills/prizm-kit/assets/project-memory-template.md +4 -2
- package/bundled/skills/prizmkit-committer/SKILL.md +28 -0
- package/bundled/skills/prizmkit-implement/SKILL.md +2 -1
- package/bundled/skills/prizmkit-init/SKILL.md +2 -1
- package/bundled/skills/prizmkit-prizm-docs/SKILL.md +7 -4
- package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +31 -1
- package/bundled/skills/recovery-workflow/SKILL.md +4 -2
- package/bundled/team/prizm-dev-team.json +1 -1
- package/package.json +1 -1
package/bundled/VERSION.json
CHANGED
|
@@ -224,6 +224,41 @@ spawn_and_wait_session() {
|
|
|
224
224
|
|
|
225
225
|
log_info "Session result: $session_status"
|
|
226
226
|
|
|
227
|
+
# Validate checkpoint completeness after successful session
|
|
228
|
+
if [[ "$session_status" == "success" ]]; then
|
|
229
|
+
local _ckpt_root
|
|
230
|
+
_ckpt_root="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
231
|
+
local checkpoint_file="$_ckpt_root/.prizmkit/bugfix/${bug_id}/workflow-checkpoint.json"
|
|
232
|
+
if [[ -f "$checkpoint_file" ]]; then
|
|
233
|
+
local checkpoint_result
|
|
234
|
+
checkpoint_result=$(python3 -c "
|
|
235
|
+
import json, sys
|
|
236
|
+
try:
|
|
237
|
+
with open(sys.argv[1]) as f:
|
|
238
|
+
data = json.load(f)
|
|
239
|
+
except json.JSONDecodeError as e:
|
|
240
|
+
print('CORRUPTED: {}'.format(e))
|
|
241
|
+
sys.exit(2)
|
|
242
|
+
incomplete = [s for s in data['steps'] if s['status'] not in ('completed', 'skipped')]
|
|
243
|
+
if incomplete:
|
|
244
|
+
for s in incomplete:
|
|
245
|
+
print('INCOMPLETE: {} {} = {}'.format(s['id'], s['skill'], s['status']))
|
|
246
|
+
sys.exit(1)
|
|
247
|
+
print('ALL_COMPLETE')
|
|
248
|
+
sys.exit(0)
|
|
249
|
+
" "$checkpoint_file" 2>&1)
|
|
250
|
+
local check_exit=$?
|
|
251
|
+
if [[ $check_exit -eq 2 ]]; then
|
|
252
|
+
log_warn "CHECKPOINT_CORRUPTED: workflow-checkpoint.json is not valid JSON"
|
|
253
|
+
elif [[ $check_exit -eq 1 ]]; then
|
|
254
|
+
log_warn "CHECKPOINT_INCOMPLETE: Not all workflow steps completed:"
|
|
255
|
+
echo "$checkpoint_result" | while read -r line; do log_warn " $line"; done
|
|
256
|
+
else
|
|
257
|
+
log_info "CHECKPOINT: All workflow steps completed"
|
|
258
|
+
fi
|
|
259
|
+
fi
|
|
260
|
+
fi
|
|
261
|
+
|
|
227
262
|
# Subagent detection
|
|
228
263
|
prizm_detect_subagents "$session_log"
|
|
229
264
|
|
|
@@ -287,6 +287,39 @@ sys.exit(1)
|
|
|
287
287
|
if [[ ! -f "$plan_file" ]]; then
|
|
288
288
|
log_warn "ARTIFACT_MISSING: plan.md not found at $plan_file"
|
|
289
289
|
fi
|
|
290
|
+
|
|
291
|
+
# Validate checkpoint completeness
|
|
292
|
+
local checkpoint_file="$project_root_for_artifacts/.prizmkit/specs/${feature_slug}/workflow-checkpoint.json"
|
|
293
|
+
if [[ -f "$checkpoint_file" ]]; then
|
|
294
|
+
local checkpoint_result
|
|
295
|
+
checkpoint_result=$(python3 -c "
|
|
296
|
+
import json, sys
|
|
297
|
+
try:
|
|
298
|
+
with open(sys.argv[1]) as f:
|
|
299
|
+
data = json.load(f)
|
|
300
|
+
except json.JSONDecodeError as e:
|
|
301
|
+
print('CORRUPTED: {}'.format(e))
|
|
302
|
+
sys.exit(2)
|
|
303
|
+
incomplete = [s for s in data['steps'] if s['status'] not in ('completed', 'skipped')]
|
|
304
|
+
if incomplete:
|
|
305
|
+
for s in incomplete:
|
|
306
|
+
print('INCOMPLETE: {} {} = {}'.format(s['id'], s['skill'], s['status']))
|
|
307
|
+
sys.exit(1)
|
|
308
|
+
print('ALL_COMPLETE')
|
|
309
|
+
sys.exit(0)
|
|
310
|
+
" "$checkpoint_file" 2>&1)
|
|
311
|
+
local check_exit=$?
|
|
312
|
+
if [[ $check_exit -eq 2 ]]; then
|
|
313
|
+
log_warn "CHECKPOINT_CORRUPTED: workflow-checkpoint.json is not valid JSON"
|
|
314
|
+
elif [[ $check_exit -eq 1 ]]; then
|
|
315
|
+
log_warn "CHECKPOINT_INCOMPLETE: Not all workflow steps completed:"
|
|
316
|
+
echo "$checkpoint_result" | while read -r line; do log_warn " $line"; done
|
|
317
|
+
else
|
|
318
|
+
log_info "CHECKPOINT: All workflow steps completed"
|
|
319
|
+
fi
|
|
320
|
+
else
|
|
321
|
+
log_info "CHECKPOINT: No workflow-checkpoint.json found (checkpoint system not active)"
|
|
322
|
+
fi
|
|
290
323
|
fi
|
|
291
324
|
|
|
292
325
|
# Check if session produced a failure-log for future retries
|
|
@@ -530,6 +530,171 @@ def determine_pipeline_mode(complexity):
|
|
|
530
530
|
return mapping.get(complexity, "lite")
|
|
531
531
|
|
|
532
532
|
|
|
533
|
+
# ============================================================
|
|
534
|
+
# Checkpoint generation
|
|
535
|
+
# ============================================================
|
|
536
|
+
|
|
537
|
+
# Mapping: section name -> (skill_key, display_name, required_artifacts)
|
|
538
|
+
# skill_key is a unique identifier in the checkpoint, not necessarily the
|
|
539
|
+
# prizmkit skill name. This ensures each section has a distinct key so
|
|
540
|
+
# merge_checkpoint_state() never collides.
|
|
541
|
+
SECTION_TO_SKILL = {
|
|
542
|
+
"phase0-init": ("prizmkit-init", "Project Bootstrap",
|
|
543
|
+
[".prizm-docs/root.prizm", ".prizmkit/config.json"]),
|
|
544
|
+
"phase0-test-baseline": ("test-baseline", "Test Baseline", []),
|
|
545
|
+
"phase-context-snapshot": ("context-snapshot", "Build Context Snapshot",
|
|
546
|
+
[".prizmkit/specs/{slug}/context-snapshot.md"]),
|
|
547
|
+
"phase-specify-plan": ("context-snapshot-and-plan", "Specify & Plan",
|
|
548
|
+
[".prizmkit/specs/{slug}/context-snapshot.md",
|
|
549
|
+
".prizmkit/specs/{slug}/plan.md"]),
|
|
550
|
+
"phase-plan": ("prizmkit-plan", "Plan & Tasks",
|
|
551
|
+
[".prizmkit/specs/{slug}/plan.md"]),
|
|
552
|
+
"phase-analyze": ("prizmkit-analyze", "Analyze", []),
|
|
553
|
+
"phase-critic-plan": ("critic-plan-review", "Critic: Plan Review", []),
|
|
554
|
+
"phase-implement": ("prizmkit-implement", "Implement + Test", []),
|
|
555
|
+
"phase-critic-code": ("critic-code-review", "Critic: Code Review", []),
|
|
556
|
+
"phase-review": ("prizmkit-code-review", "Code Review", []),
|
|
557
|
+
"phase-browser": ("browser-verification", "Browser Verification", []),
|
|
558
|
+
"phase-deploy": ("deploy-verification", "Deploy Verification", []),
|
|
559
|
+
"phase-commit": None, # special: split into retrospective + committer
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
# phase-commit is split into two steps
|
|
563
|
+
_COMMIT_STEPS = [
|
|
564
|
+
("prizmkit-retrospective", "Retrospective", []),
|
|
565
|
+
("prizmkit-committer", "Commit", []),
|
|
566
|
+
]
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def _resolve_artifacts(artifact_templates, slug):
|
|
570
|
+
"""Replace {slug} placeholder with the actual feature slug."""
|
|
571
|
+
return [a.replace("{slug}", slug) for a in artifact_templates]
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def generate_checkpoint_definition(sections, pipeline_mode, workflow_type,
|
|
575
|
+
item_id, item_slug, session_id,
|
|
576
|
+
init_done=False):
|
|
577
|
+
"""Derive checkpoint step definitions from the assembled sections list.
|
|
578
|
+
|
|
579
|
+
Args:
|
|
580
|
+
sections: list of (name, content) tuples from assemble_sections()
|
|
581
|
+
pipeline_mode: "lite" | "standard" | "full"
|
|
582
|
+
workflow_type: "feature-pipeline"
|
|
583
|
+
item_id: feature ID (e.g. "F-001")
|
|
584
|
+
item_slug: feature slug (e.g. "001-user-auth")
|
|
585
|
+
session_id: current session ID
|
|
586
|
+
init_done: whether project is already initialized (Phase 0 skip)
|
|
587
|
+
|
|
588
|
+
Returns:
|
|
589
|
+
dict suitable for writing as workflow-checkpoint.json
|
|
590
|
+
"""
|
|
591
|
+
steps = []
|
|
592
|
+
step_counter = 1
|
|
593
|
+
prev_step_id = None
|
|
594
|
+
|
|
595
|
+
for section_name, _content in sections:
|
|
596
|
+
if section_name not in SECTION_TO_SKILL:
|
|
597
|
+
continue
|
|
598
|
+
|
|
599
|
+
mapping = SECTION_TO_SKILL[section_name]
|
|
600
|
+
|
|
601
|
+
if mapping is None:
|
|
602
|
+
# phase-commit -> split into retrospective + committer
|
|
603
|
+
for skill, name, artifacts in _COMMIT_STEPS:
|
|
604
|
+
step_id = "S{:02d}".format(step_counter)
|
|
605
|
+
steps.append({
|
|
606
|
+
"id": step_id,
|
|
607
|
+
"skill": skill,
|
|
608
|
+
"name": name,
|
|
609
|
+
"status": "pending",
|
|
610
|
+
"required_artifacts": _resolve_artifacts(artifacts, item_slug),
|
|
611
|
+
"depends_on": prev_step_id,
|
|
612
|
+
})
|
|
613
|
+
prev_step_id = step_id
|
|
614
|
+
step_counter += 1
|
|
615
|
+
continue
|
|
616
|
+
|
|
617
|
+
skill, name, artifacts = mapping
|
|
618
|
+
step_id = "S{:02d}".format(step_counter)
|
|
619
|
+
|
|
620
|
+
status = "pending"
|
|
621
|
+
if init_done and section_name in ("phase0-init", "phase0-test-baseline"):
|
|
622
|
+
status = "skipped"
|
|
623
|
+
|
|
624
|
+
steps.append({
|
|
625
|
+
"id": step_id,
|
|
626
|
+
"skill": skill,
|
|
627
|
+
"name": name,
|
|
628
|
+
"status": status,
|
|
629
|
+
"required_artifacts": _resolve_artifacts(artifacts, item_slug),
|
|
630
|
+
"depends_on": prev_step_id,
|
|
631
|
+
})
|
|
632
|
+
|
|
633
|
+
prev_step_id = step_id
|
|
634
|
+
step_counter += 1
|
|
635
|
+
|
|
636
|
+
return {
|
|
637
|
+
"version": 1,
|
|
638
|
+
"workflow_type": workflow_type,
|
|
639
|
+
"pipeline_mode": pipeline_mode,
|
|
640
|
+
"item_id": item_id,
|
|
641
|
+
"item_slug": item_slug,
|
|
642
|
+
"session_id": session_id,
|
|
643
|
+
"steps": steps,
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
def merge_checkpoint_state(existing, fresh, project_root):
|
|
648
|
+
"""Merge existing checkpoint state into a freshly generated definition.
|
|
649
|
+
|
|
650
|
+
Matching is by skill_key (not step ID), since tier changes across retries
|
|
651
|
+
may shift step IDs.
|
|
652
|
+
|
|
653
|
+
Merge rules:
|
|
654
|
+
1. Only keep completed steps whose required_artifacts all exist on disk
|
|
655
|
+
2. Keep skipped steps unconditionally
|
|
656
|
+
3. Once a step is NOT completed/skipped, break the dependency chain:
|
|
657
|
+
all subsequent steps reset to pending
|
|
658
|
+
"""
|
|
659
|
+
existing_status = {}
|
|
660
|
+
existing_artifacts = {}
|
|
661
|
+
for step in existing.get("steps", []):
|
|
662
|
+
existing_status[step["skill"]] = step["status"]
|
|
663
|
+
existing_artifacts[step["skill"]] = step.get("required_artifacts", [])
|
|
664
|
+
|
|
665
|
+
# Determine which completed steps have valid artifacts
|
|
666
|
+
valid_completed = set()
|
|
667
|
+
for skill_key, status in existing_status.items():
|
|
668
|
+
if status == "completed":
|
|
669
|
+
artifacts = existing_artifacts.get(skill_key, [])
|
|
670
|
+
if all(os.path.exists(os.path.join(project_root, a))
|
|
671
|
+
for a in artifacts):
|
|
672
|
+
valid_completed.add(skill_key)
|
|
673
|
+
else:
|
|
674
|
+
LOGGER.warning(
|
|
675
|
+
"Step '%s' was completed but artifacts missing — "
|
|
676
|
+
"resetting to pending", skill_key
|
|
677
|
+
)
|
|
678
|
+
elif status == "skipped":
|
|
679
|
+
valid_completed.add(skill_key)
|
|
680
|
+
|
|
681
|
+
# Apply to fresh steps; break chain on first non-valid step
|
|
682
|
+
chain_broken = False
|
|
683
|
+
for step in fresh["steps"]:
|
|
684
|
+
if chain_broken:
|
|
685
|
+
step["status"] = "pending"
|
|
686
|
+
continue
|
|
687
|
+
|
|
688
|
+
prev = existing_status.get(step["skill"])
|
|
689
|
+
if step["skill"] in valid_completed:
|
|
690
|
+
step["status"] = prev # completed or skipped
|
|
691
|
+
else:
|
|
692
|
+
chain_broken = True
|
|
693
|
+
step["status"] = "pending"
|
|
694
|
+
|
|
695
|
+
return fresh
|
|
696
|
+
|
|
697
|
+
|
|
533
698
|
# ============================================================
|
|
534
699
|
# Section Assembly (new modular approach)
|
|
535
700
|
# ============================================================
|
|
@@ -721,6 +886,12 @@ def assemble_sections(pipeline_mode, sections_dir, init_done, is_resume,
|
|
|
721
886
|
load_section(sections_dir,
|
|
722
887
|
"subagent-timeout-recovery.md")))
|
|
723
888
|
|
|
889
|
+
# --- Checkpoint System ---
|
|
890
|
+
checkpoint_section_path = os.path.join(sections_dir, "checkpoint-system.md")
|
|
891
|
+
if os.path.isfile(checkpoint_section_path):
|
|
892
|
+
sections.append(("checkpoint-system",
|
|
893
|
+
load_section(sections_dir, "checkpoint-system.md")))
|
|
894
|
+
|
|
724
895
|
# --- Execution header ---
|
|
725
896
|
sections.append(("execution-header", "---\n\n## Execution\n"))
|
|
726
897
|
|
|
@@ -1143,6 +1314,9 @@ def build_replacements(args, feature, features, global_context, script_dir):
|
|
|
1143
1314
|
"{{SESSION_STATUS_PATH}}": session_status_abs,
|
|
1144
1315
|
"{{PROJECT_ROOT}}": project_root,
|
|
1145
1316
|
"{{FEATURE_SLUG}}": feature_slug,
|
|
1317
|
+
"{{CHECKPOINT_PATH}}": os.path.join(
|
|
1318
|
+
".prizmkit", "specs", feature_slug, "workflow-checkpoint.json",
|
|
1319
|
+
),
|
|
1146
1320
|
"{{PIPELINE_MODE}}": pipeline_mode,
|
|
1147
1321
|
"{{COMPLEXITY}}": complexity,
|
|
1148
1322
|
"{{CRITIC_ENABLED}}": "true" if critic_enabled else "false",
|
|
@@ -1314,6 +1488,52 @@ def main():
|
|
|
1314
1488
|
if err:
|
|
1315
1489
|
emit_failure(err)
|
|
1316
1490
|
|
|
1491
|
+
# ── Generate checkpoint file ──────────────────────────────────────
|
|
1492
|
+
project_root = resolve_project_root(
|
|
1493
|
+
os.path.dirname(os.path.abspath(__file__))
|
|
1494
|
+
)
|
|
1495
|
+
feature_slug = replacements.get("{{FEATURE_SLUG}}", "")
|
|
1496
|
+
checkpoint_path = ""
|
|
1497
|
+
|
|
1498
|
+
if use_sections and feature_slug:
|
|
1499
|
+
checkpoint = generate_checkpoint_definition(
|
|
1500
|
+
sections=sections,
|
|
1501
|
+
pipeline_mode=pipeline_mode,
|
|
1502
|
+
workflow_type="feature-pipeline",
|
|
1503
|
+
item_id=args.feature_id,
|
|
1504
|
+
item_slug=feature_slug,
|
|
1505
|
+
session_id=args.session_id,
|
|
1506
|
+
init_done=init_done,
|
|
1507
|
+
)
|
|
1508
|
+
|
|
1509
|
+
checkpoint_dir = os.path.join(
|
|
1510
|
+
project_root, ".prizmkit", "specs", feature_slug,
|
|
1511
|
+
)
|
|
1512
|
+
os.makedirs(checkpoint_dir, exist_ok=True)
|
|
1513
|
+
checkpoint_path = os.path.join(
|
|
1514
|
+
checkpoint_dir, "workflow-checkpoint.json",
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
# On resume, merge existing completed state (with artifact validation)
|
|
1518
|
+
if is_resume and os.path.exists(checkpoint_path):
|
|
1519
|
+
try:
|
|
1520
|
+
with open(checkpoint_path, "r", encoding="utf-8") as f:
|
|
1521
|
+
existing = json.load(f)
|
|
1522
|
+
checkpoint = merge_checkpoint_state(
|
|
1523
|
+
existing, checkpoint, project_root,
|
|
1524
|
+
)
|
|
1525
|
+
LOGGER.info("Merged existing checkpoint state from %s",
|
|
1526
|
+
checkpoint_path)
|
|
1527
|
+
except (json.JSONDecodeError, KeyError) as exc:
|
|
1528
|
+
LOGGER.warning(
|
|
1529
|
+
"Existing checkpoint corrupted (%s) — generating fresh",
|
|
1530
|
+
exc,
|
|
1531
|
+
)
|
|
1532
|
+
|
|
1533
|
+
with open(checkpoint_path, "w", encoding="utf-8") as f:
|
|
1534
|
+
json.dump(checkpoint, f, indent=2, ensure_ascii=False)
|
|
1535
|
+
LOGGER.info("Wrote checkpoint to %s", checkpoint_path)
|
|
1536
|
+
|
|
1317
1537
|
# ── Success JSON ───────────────────────────────────────────────────
|
|
1318
1538
|
feature_model = feature.get("model", "")
|
|
1319
1539
|
mode_agent_counts = {"lite": 1, "standard": 3, "full": 3}
|
|
@@ -1331,6 +1551,7 @@ def main():
|
|
|
1331
1551
|
"render_mode": "sections" if use_sections else "legacy",
|
|
1332
1552
|
"validation_warnings": len(warnings),
|
|
1333
1553
|
"validation_errors": len(errors),
|
|
1554
|
+
"checkpoint_path": checkpoint_path,
|
|
1334
1555
|
}
|
|
1335
1556
|
print(json.dumps(output, indent=2, ensure_ascii=False))
|
|
1336
1557
|
sys.exit(0)
|
|
@@ -324,6 +324,95 @@ def emit_failure(message):
|
|
|
324
324
|
sys.exit(1)
|
|
325
325
|
|
|
326
326
|
|
|
327
|
+
# ============================================================
|
|
328
|
+
# Checkpoint generation for bugfix pipeline
|
|
329
|
+
# ============================================================
|
|
330
|
+
|
|
331
|
+
BUGFIX_STEPS = [
|
|
332
|
+
("prizmkit-init", "Initialize", []),
|
|
333
|
+
("bug-diagnosis", "Bug Diagnosis & Fix Plan",
|
|
334
|
+
[".prizmkit/bugfix/{slug}/fix-plan.md"]),
|
|
335
|
+
("bug-reproduce", "Write Reproduction Test", []),
|
|
336
|
+
("bug-fix", "Implement Fix", []),
|
|
337
|
+
("prizmkit-code-review", "Code Review", []),
|
|
338
|
+
("prizmkit-committer", "Commit", []),
|
|
339
|
+
("bug-report", "Generate Fix Report & Update TRAPS",
|
|
340
|
+
[".prizmkit/bugfix/{slug}/fix-report.md"]),
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
def generate_bugfix_checkpoint(bug_id, session_id):
|
|
345
|
+
"""Generate a checkpoint definition for bugfix pipeline.
|
|
346
|
+
|
|
347
|
+
Returns a dict suitable for writing as workflow-checkpoint.json.
|
|
348
|
+
"""
|
|
349
|
+
steps = []
|
|
350
|
+
prev_id = None
|
|
351
|
+
for i, (skill, name, artifacts) in enumerate(BUGFIX_STEPS, 1):
|
|
352
|
+
step_id = "S{:02d}".format(i)
|
|
353
|
+
steps.append({
|
|
354
|
+
"id": step_id,
|
|
355
|
+
"skill": skill,
|
|
356
|
+
"name": name,
|
|
357
|
+
"status": "pending",
|
|
358
|
+
"required_artifacts": [a.replace("{slug}", bug_id) for a in artifacts],
|
|
359
|
+
"depends_on": prev_id,
|
|
360
|
+
})
|
|
361
|
+
prev_id = step_id
|
|
362
|
+
|
|
363
|
+
return {
|
|
364
|
+
"version": 1,
|
|
365
|
+
"workflow_type": "bugfix-pipeline",
|
|
366
|
+
"pipeline_mode": "single",
|
|
367
|
+
"item_id": bug_id,
|
|
368
|
+
"item_slug": bug_id,
|
|
369
|
+
"session_id": session_id,
|
|
370
|
+
"steps": steps,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def merge_bugfix_checkpoint_state(existing, fresh, project_root):
|
|
375
|
+
"""Merge existing bugfix checkpoint state into fresh definition.
|
|
376
|
+
|
|
377
|
+
Same logic as feature pipeline: validate artifacts, break chain on
|
|
378
|
+
first invalid step.
|
|
379
|
+
"""
|
|
380
|
+
existing_status = {}
|
|
381
|
+
existing_artifacts = {}
|
|
382
|
+
for step in existing.get("steps", []):
|
|
383
|
+
existing_status[step["skill"]] = step["status"]
|
|
384
|
+
existing_artifacts[step["skill"]] = step.get("required_artifacts", [])
|
|
385
|
+
|
|
386
|
+
valid_completed = set()
|
|
387
|
+
for skill_key, status in existing_status.items():
|
|
388
|
+
if status == "completed":
|
|
389
|
+
artifacts = existing_artifacts.get(skill_key, [])
|
|
390
|
+
if all(os.path.exists(os.path.join(project_root, a))
|
|
391
|
+
for a in artifacts):
|
|
392
|
+
valid_completed.add(skill_key)
|
|
393
|
+
else:
|
|
394
|
+
LOGGER.warning(
|
|
395
|
+
"Step '%s' was completed but artifacts missing — "
|
|
396
|
+
"resetting to pending", skill_key
|
|
397
|
+
)
|
|
398
|
+
elif status == "skipped":
|
|
399
|
+
valid_completed.add(skill_key)
|
|
400
|
+
|
|
401
|
+
chain_broken = False
|
|
402
|
+
for step in fresh["steps"]:
|
|
403
|
+
if chain_broken:
|
|
404
|
+
step["status"] = "pending"
|
|
405
|
+
continue
|
|
406
|
+
prev = existing_status.get(step["skill"])
|
|
407
|
+
if step["skill"] in valid_completed:
|
|
408
|
+
step["status"] = prev
|
|
409
|
+
else:
|
|
410
|
+
chain_broken = True
|
|
411
|
+
step["status"] = "pending"
|
|
412
|
+
|
|
413
|
+
return fresh
|
|
414
|
+
|
|
415
|
+
|
|
327
416
|
def main():
|
|
328
417
|
args = parse_args()
|
|
329
418
|
|
|
@@ -366,6 +455,12 @@ def main():
|
|
|
366
455
|
# Build replacements
|
|
367
456
|
replacements = build_replacements(args, bug, global_context, script_dir)
|
|
368
457
|
|
|
458
|
+
# Add checkpoint path to replacements
|
|
459
|
+
checkpoint_rel = os.path.join(
|
|
460
|
+
".prizmkit", "bugfix", args.bug_id, "workflow-checkpoint.json",
|
|
461
|
+
)
|
|
462
|
+
replacements["{{CHECKPOINT_PATH}}"] = checkpoint_rel
|
|
463
|
+
|
|
369
464
|
# Render the template
|
|
370
465
|
rendered = render_template(template_content, replacements, bug)
|
|
371
466
|
|
|
@@ -374,10 +469,39 @@ def main():
|
|
|
374
469
|
if err:
|
|
375
470
|
emit_failure(err)
|
|
376
471
|
|
|
472
|
+
# Generate checkpoint file
|
|
473
|
+
project_root = resolve_project_root(script_dir)
|
|
474
|
+
checkpoint_path = os.path.join(project_root, checkpoint_rel)
|
|
475
|
+
checkpoint_dir = os.path.dirname(checkpoint_path)
|
|
476
|
+
os.makedirs(checkpoint_dir, exist_ok=True)
|
|
477
|
+
|
|
478
|
+
checkpoint = generate_bugfix_checkpoint(args.bug_id, args.session_id)
|
|
479
|
+
|
|
480
|
+
is_resume = args.resume_phase != "null"
|
|
481
|
+
if is_resume and os.path.exists(checkpoint_path):
|
|
482
|
+
try:
|
|
483
|
+
with open(checkpoint_path, "r", encoding="utf-8") as f:
|
|
484
|
+
existing = json.load(f)
|
|
485
|
+
checkpoint = merge_bugfix_checkpoint_state(
|
|
486
|
+
existing, checkpoint, project_root,
|
|
487
|
+
)
|
|
488
|
+
LOGGER.info("Merged existing bugfix checkpoint from %s",
|
|
489
|
+
checkpoint_path)
|
|
490
|
+
except (json.JSONDecodeError, KeyError) as exc:
|
|
491
|
+
LOGGER.warning(
|
|
492
|
+
"Existing bugfix checkpoint corrupted (%s) — generating fresh",
|
|
493
|
+
exc,
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
with open(checkpoint_path, "w", encoding="utf-8") as f:
|
|
497
|
+
json.dump(checkpoint, f, indent=2, ensure_ascii=False)
|
|
498
|
+
LOGGER.info("Wrote bugfix checkpoint to %s", checkpoint_path)
|
|
499
|
+
|
|
377
500
|
# Success
|
|
378
501
|
output = {
|
|
379
502
|
"success": True,
|
|
380
503
|
"output_path": os.path.abspath(args.output),
|
|
504
|
+
"checkpoint_path": checkpoint_path,
|
|
381
505
|
}
|
|
382
506
|
print(json.dumps(output, indent=2, ensure_ascii=False))
|
|
383
507
|
sys.exit(0)
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
⚠️ DO NOT re-read source files already listed in Section 4 File Manifest unless you need implementation detail beyond the interface summary.
|
|
4
4
|
1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full context.
|
|
5
5
|
2. Run `/prizmkit-implement` to execute the tasks in plan.md. Run tests with: `{{TEST_CMD}}`. Known baseline failures (pre-existing, not your fault): `{{BASELINE_FAILURES}}`.
|
|
6
|
-
3.
|
|
6
|
+
3. If plan.md has more than 5 tasks: run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
|
|
7
|
+
4. After implement completes, verify the '## Implementation Log' section was written to context-snapshot.md.
|
|
7
8
|
|
|
8
9
|
## Acceptance Criteria Verification
|
|
9
10
|
|
|
@@ -152,6 +152,8 @@ $TEST_CMD 2>&1 | tee /tmp/test-baseline.txt | tail -20
|
|
|
152
152
|
- Runs tests using `TEST_CMD` after each task
|
|
153
153
|
- Writes '## Implementation Log' to `context-snapshot.md`
|
|
154
154
|
|
|
155
|
+
**3b-compact.** Context management — if plan.md has more than 5 tasks, run `/compact` after completing every 3 tasks during implementation. This prevents context window exhaustion in long sessions. If `/compact` is not available (non-Claude CLI), skip this step.
|
|
156
|
+
|
|
155
157
|
**3c.** After implement completes, verify:
|
|
156
158
|
1. All tasks in plan.md are `[x]`
|
|
157
159
|
2. Run the full test suite to ensure nothing is broken
|
|
@@ -285,6 +287,8 @@ git status --short
|
|
|
285
287
|
```
|
|
286
288
|
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file> && git commit --amend --no-edit`, do NOT create a separate commit.
|
|
287
289
|
|
|
290
|
+
**Exception**: `session-summary.md` in the artifact directory is a local cross-session artifact generated by `/prizmkit-committer` — it is NOT committed to git. Ignore it in the clean-tree check.
|
|
291
|
+
|
|
288
292
|
## Critical Paths
|
|
289
293
|
|
|
290
294
|
| Resource | Path |
|
|
@@ -215,8 +215,9 @@ Prompt:
|
|
|
215
215
|
> ⚠️ DO NOT re-read source files already listed in Section 4 File Manifest unless you need implementation detail beyond the interface summary.
|
|
216
216
|
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full context.
|
|
217
217
|
> 2. Run `/prizmkit-implement` to execute the tasks in plan.md. Run tests with: `{{TEST_CMD}}`. Known baseline failures (pre-existing, not your fault): `{{BASELINE_FAILURES}}`.
|
|
218
|
-
> 3.
|
|
219
|
-
> 4.
|
|
218
|
+
> 3. If plan.md has more than 5 tasks: run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
|
|
219
|
+
> 4. After implement completes, verify the '## Implementation Log' section was written to context-snapshot.md.
|
|
220
|
+
> 5. Do NOT execute any git commands (no git add/commit/reset/push).
|
|
220
221
|
> Do NOT exit until all tasks are [x] and the '## Implementation Log' section is written in context-snapshot.md."
|
|
221
222
|
|
|
222
223
|
Wait for Dev to return. All tasks must be `[x]`, tests pass.
|
|
@@ -383,6 +384,8 @@ git status --short
|
|
|
383
384
|
```
|
|
384
385
|
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file> && git commit --amend --no-edit`, do NOT create a separate commit.
|
|
385
386
|
|
|
387
|
+
**Exception**: `session-summary.md` in the artifact directory is a local cross-session artifact generated by `/prizmkit-committer` — it is NOT committed to git. Ignore it in the clean-tree check.
|
|
388
|
+
|
|
386
389
|
## Critical Paths
|
|
387
390
|
|
|
388
391
|
| Resource | Path |
|
|
@@ -280,8 +280,9 @@ Prompt:
|
|
|
280
280
|
> ⚠️ DO NOT re-read source files already listed in Section 4 File Manifest unless you need implementation detail beyond the interface summary.
|
|
281
281
|
> 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full context.
|
|
282
282
|
> 2. Run `/prizmkit-implement` to execute the tasks in plan.md. Run tests with: `{{TEST_CMD}}`. Known baseline failures (pre-existing, not your fault): `{{BASELINE_FAILURES}}`.
|
|
283
|
-
> 3.
|
|
284
|
-
> 4.
|
|
283
|
+
> 3. If plan.md has more than 5 tasks: run `/compact` after completing every 3 tasks to manage context budget. If `/compact` is unavailable, continue without it.
|
|
284
|
+
> 4. After implement completes, verify the '## Implementation Log' section was written to context-snapshot.md.
|
|
285
|
+
> 5. Do NOT execute any git commands (no git add/commit/reset/push).
|
|
285
286
|
> Do NOT exit until all tasks are [x] and the '## Implementation Log' section is written in context-snapshot.md."
|
|
286
287
|
|
|
287
288
|
**Gate Check — Implementation Log**:
|
|
@@ -476,6 +477,8 @@ git status --short
|
|
|
476
477
|
```
|
|
477
478
|
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file> && git commit --amend --no-edit`, do NOT create a separate commit.
|
|
478
479
|
|
|
480
|
+
**Exception**: `session-summary.md` in the artifact directory is a local cross-session artifact generated by `/prizmkit-committer` — it is NOT committed to git. Ignore it in the clean-tree check.
|
|
481
|
+
|
|
479
482
|
## Critical Paths
|
|
480
483
|
|
|
481
484
|
| Resource | Path |
|
|
@@ -67,6 +67,19 @@ You are the **bug fix session orchestrator**. Fix Bug {{BUG_ID}}: "{{BUG_TITLE}}
|
|
|
67
67
|
|
|
68
68
|
**IMPORTANT**: Only 2 artifact files per bug, NEVER more. This is a fixed convention.
|
|
69
69
|
|
|
70
|
+
## Workflow Checkpoint System
|
|
71
|
+
|
|
72
|
+
A checkpoint file tracks your progress through this workflow:
|
|
73
|
+
|
|
74
|
+
**Path**: `{{CHECKPOINT_PATH}}`
|
|
75
|
+
|
|
76
|
+
**Rules**:
|
|
77
|
+
1. **Before each step**: Read `workflow-checkpoint.json`, verify the previous step has `status: "completed"` or `status: "skipped"`. If not, complete it first.
|
|
78
|
+
2. **Starting a step**: Update the current step to `status: "in_progress"`.
|
|
79
|
+
3. **After each step completes**: Update the step to `status: "completed"`. Verify JSON is valid after writing.
|
|
80
|
+
4. **On failure**: Set the step to `status: "failed"` and halt.
|
|
81
|
+
5. **On resume**: Steps already `"completed"` are skipped. Start from the first `"pending"` or `"in_progress"` step.
|
|
82
|
+
|
|
70
83
|
## Execution Instructions
|
|
71
84
|
|
|
72
85
|
**YOU are the orchestrator. Execute each phase by spawning the appropriate team agent with run_in_background=false.**
|
|
@@ -109,6 +122,7 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
|
|
|
109
122
|
"
|
|
110
123
|
- **Wait for Dev to return**
|
|
111
124
|
- **CP-BF-1**: `.prizmkit/bugfix/{{BUG_ID}}/fix-plan.md` exists
|
|
125
|
+
- **Checkpoint update**: set step `bug-diagnosis` to `"completed"` in `{{CHECKPOINT_PATH}}`
|
|
112
126
|
|
|
113
127
|
**DECISION GATE — Fast Path Check**:
|
|
114
128
|
- If severity is LOW or MEDIUM, AND root cause is obvious (high confidence), AND fix is < 10 lines:
|
|
@@ -141,6 +155,7 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
|
|
|
141
155
|
- Write session-status.json with status="partial", errors=["reproduction_failed"]
|
|
142
156
|
- Set bug status to `needs_info` and STOP
|
|
143
157
|
- **CP-BF-2**: Reproduction test exists and FAILS
|
|
158
|
+
- **Checkpoint update**: set step `bug-reproduce` to `"completed"` in `{{CHECKPOINT_PATH}}`
|
|
144
159
|
|
|
145
160
|
---
|
|
146
161
|
|
|
@@ -158,11 +173,13 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
|
|
|
158
173
|
- Do NOT refactor — fix the bug only
|
|
159
174
|
4. Run the reproduction test → MUST PASS
|
|
160
175
|
5. Run the module's test suite → MUST PASS (no regression)
|
|
161
|
-
6. If fix
|
|
176
|
+
6. If the fix involves multiple files or steps: run `/compact` after completing the core fix and before running the full test suite, to free context budget. If `/compact` is unavailable, continue without it.
|
|
177
|
+
7. If fix fails after 3 rounds, report detailed analysis
|
|
162
178
|
"
|
|
163
179
|
- **Wait for Dev to return**
|
|
164
180
|
- If fix fails after 3 rounds: escalate to user, write status="failed"
|
|
165
181
|
- **CP-BF-3**: Reproduction test passes, module tests pass
|
|
182
|
+
- **Checkpoint update**: set step `bug-fix` to `"completed"` in `{{CHECKPOINT_PATH}}`
|
|
166
183
|
|
|
167
184
|
---
|
|
168
185
|
|
|
@@ -185,6 +202,7 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
|
|
|
185
202
|
- **Wait for Reviewer to return**
|
|
186
203
|
- If NEEDS_FIXES: return to Phase 3 for refinement following Fix Instructions (max 2 review rounds)
|
|
187
204
|
- **CP-BF-4**: Code review passes, all tests green
|
|
205
|
+
- **Checkpoint update**: set step `prizmkit-code-review` to `"completed"` in `{{CHECKPOINT_PATH}}`
|
|
188
206
|
|
|
189
207
|
{{IF_VERIFICATION_MANUAL_OR_HYBRID}}
|
|
190
208
|
**MANUAL VERIFICATION GATE**:
|
|
@@ -222,6 +240,7 @@ Reference `{{TEAM_CONFIG_PATH}}` for agent definitions:
|
|
|
222
240
|
- Acceptance Criteria Verification (checklist with pass/fail for each criterion)
|
|
223
241
|
|
|
224
242
|
- **CP-BF-5**: Commit recorded, fix-report.md written, TRAPS updated (if applicable)
|
|
243
|
+
- **Checkpoint update**: set steps `prizmkit-committer` and `bug-report` to `"completed"` in `{{CHECKPOINT_PATH}}`
|
|
225
244
|
|
|
226
245
|
### Step 3: Report Session Status
|
|
227
246
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
## Workflow Checkpoint System
|
|
2
|
+
|
|
3
|
+
A checkpoint file tracks your progress through this workflow:
|
|
4
|
+
|
|
5
|
+
**Path**: `{{CHECKPOINT_PATH}}`
|
|
6
|
+
|
|
7
|
+
### Rules
|
|
8
|
+
|
|
9
|
+
1. **Before each skill**: Read `workflow-checkpoint.json`, verify the previous step has `status: "completed"` or `status: "skipped"`. If it is still `"pending"` or `"in_progress"`, you MUST complete it first before moving on.
|
|
10
|
+
|
|
11
|
+
2. **Starting a skill**: Update the current step to `status: "in_progress"`.
|
|
12
|
+
|
|
13
|
+
3. **After each skill completes**: Update the current step to `status: "completed"`. Then immediately re-read the file to verify the JSON is valid. If the read fails, re-write the file with correct JSON.
|
|
14
|
+
|
|
15
|
+
4. **On failure**: Set the step to `status: "failed"` and continue to the next step if possible, or halt and write failure-log.md.
|
|
16
|
+
|
|
17
|
+
5. **On session exit**: The checkpoint file reflects your actual progress. Do NOT manually set future steps to "completed".
|
|
18
|
+
|
|
19
|
+
### Checkpoint Update Pattern
|
|
20
|
+
|
|
21
|
+
After completing each skill:
|
|
22
|
+
|
|
23
|
+
1. Read `{{CHECKPOINT_PATH}}`
|
|
24
|
+
2. Update the current step `"status": "completed"`
|
|
25
|
+
3. Update the next step `"status": "in_progress"`
|
|
26
|
+
4. Write the updated JSON back to `{{CHECKPOINT_PATH}}`
|
|
27
|
+
5. Verify: `python3 -c "import json; json.load(open('{{CHECKPOINT_PATH}}'))"` — if this fails, re-write
|
|
28
|
+
|
|
29
|
+
### Resume Behavior
|
|
30
|
+
|
|
31
|
+
**Checkpoint is the primary source of truth for resume.** On retry sessions:
|
|
32
|
+
|
|
33
|
+
1. Read `workflow-checkpoint.json` — steps already `"completed"` or `"skipped"` are skipped
|
|
34
|
+
2. Start from the first `"pending"` or `"in_progress"` step
|
|
35
|
+
3. If `failure-log.md` exists, read it for diagnostic context (why the previous session failed, what approach to try differently) — but do NOT use it to determine which step to resume from
|
|
36
|
+
4. If `workflow-checkpoint.json` is missing or corrupted, fall back to `failure-log.md` + the resume phase as the legacy mechanism
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
**Check for previous failure log
|
|
1
|
+
**Check for previous failure log** (diagnostic context only — do NOT use to determine resume point):
|
|
2
2
|
```bash
|
|
3
3
|
cat .prizmkit/specs/{{FEATURE_SLUG}}/failure-log.md 2>/dev/null || echo "NO_PREVIOUS_FAILURE"
|
|
4
4
|
```
|
|
@@ -6,3 +6,4 @@ If failure-log.md exists:
|
|
|
6
6
|
- Read ROOT_CAUSE and SUGGESTION — adjust your approach accordingly
|
|
7
7
|
- Read DISCOVERED_TRAPS — if any are genuine, inject into .prizm-docs/ during the commit phase retrospective
|
|
8
8
|
- Do NOT delete failure-log.md until this session completes all phases and commits successfully
|
|
9
|
+
- **Note**: The resume point is determined by `workflow-checkpoint.json`, not by failure-log.md
|
|
@@ -14,3 +14,6 @@ Wait for Reviewer to return.
|
|
|
14
14
|
- If CRITICAL issues found: fix them yourself — read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full project context. Fix ONLY the listed CRITICAL issues in plan.md. Then re-run analyze (max 1 round).
|
|
15
15
|
|
|
16
16
|
**CP-2**: No CRITICAL issues.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-analyze` to `"completed"`.
|
|
@@ -14,3 +14,6 @@ Wait for Reviewer to return.
|
|
|
14
14
|
- If CRITICAL issues found: fix them yourself — read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` for full project context. Fix ONLY the listed CRITICAL issues in spec.md/plan.md. Then re-run analyze (max 1 round).
|
|
15
15
|
|
|
16
16
|
**CP-2**: No CRITICAL issues.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-analyze` to `"completed"`.
|
|
@@ -30,3 +30,6 @@ You MUST execute this phase. Do NOT skip it. Do NOT mark it as completed without
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
If verification fails, log the failure details but continue to commit. Failures do NOT block the commit, but you MUST attempt verification and MUST clean up the dev server.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `browser-verification` to `"completed"`.
|
|
@@ -34,3 +34,6 @@ This single commit includes: feature code + tests + .prizm-docs/ updates. Do NOT
|
|
|
34
34
|
git status --short
|
|
35
35
|
```
|
|
36
36
|
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file> && git commit --amend --no-edit`, do NOT create a separate commit.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
**Checkpoint update**: After `/prizmkit-retrospective` completes, update `workflow-checkpoint.json` — set step `prizmkit-retrospective` to `"completed"`. After `/prizmkit-committer` completes, set step `prizmkit-committer` to `"completed"`.
|
|
@@ -24,3 +24,6 @@ This single commit includes: feature code + tests + .prizm-docs/ updates. Do NOT
|
|
|
24
24
|
git status --short
|
|
25
25
|
```
|
|
26
26
|
Working tree MUST be clean after this step. If any feature-related files remain, stage them into the SAME commit via `git add <file> && git commit --amend --no-edit`, do NOT create a separate commit.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
**Checkpoint update**: After `/prizmkit-retrospective` completes, update `workflow-checkpoint.json` — set step `prizmkit-retrospective` to `"completed"`. After `/prizmkit-committer` completes, set step `prizmkit-committer` to `"completed"`.
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
- **Section 3 — Prizm Context**: content of root.prizm and relevant L1/L2 docs
|
|
2
2
|
- **Section 4 — Existing Source Files**: **full verbatim content** of each related file in fenced code blocks (with `### path/to/file` heading and line count). Include ALL files needed for implementation and review — downstream phases read this section instead of re-reading individual source files
|
|
3
3
|
- **Section 5 — Existing Tests**: full content of related test files as code block
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `context-snapshot` to `"completed"`.
|
|
@@ -20,3 +20,6 @@ Wait for Critic to return.
|
|
|
20
20
|
- Read challenge-report.md. For items marked CRITICAL/HIGH: spawn Dev to fix, then proceed to Review.
|
|
21
21
|
|
|
22
22
|
**CP-3.5**: Code challenges reviewed and resolved.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `critic-code-review` to `"completed"`.
|
|
@@ -34,3 +34,6 @@ Deploy verification does NOT block the commit, but you MUST attempt it.
|
|
|
34
34
|
4. Record smoke test results in `## Deploy Verification` section
|
|
35
35
|
|
|
36
36
|
If the project cannot be started locally (e.g., requires external services, databases, credentials), skip the smoke test and note why.
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `deploy-verification` to `"completed"`.
|
|
@@ -19,3 +19,6 @@ After Dev agent returns, verify the Implementation Log was written:
|
|
|
19
19
|
grep -q "## Implementation Log" .prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md && echo "GATE:PASS" || echo "GATE:MISSING"
|
|
20
20
|
```
|
|
21
21
|
If GATE:MISSING — send message to Dev (re-spawn if needed): "Write the '## Implementation Log' section to context-snapshot.md before I can proceed to review. Include: files changed/created, key decisions, deviations from plan, notable discoveries."
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-implement` to `"completed"`.
|
|
@@ -32,3 +32,6 @@ Wait for Dev to return. **If Dev times out before all tasks are `[x]`**:
|
|
|
32
32
|
3. Max 2 recovery retries. After 2 failures, orchestrator implements remaining tasks directly.
|
|
33
33
|
|
|
34
34
|
All tasks `[x]`, tests pass.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-implement` to `"completed"`.
|
|
@@ -30,3 +30,6 @@ $TEST_CMD 2>&1 | tee /tmp/test-baseline.txt | tail -20
|
|
|
30
30
|
4. If any criterion is not met, fix it now (max 2 fix rounds)
|
|
31
31
|
|
|
32
32
|
**CP-2**: All acceptance criteria met, all tests pass.
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-implement` to `"completed"`.
|
|
@@ -15,3 +15,6 @@ Before proceeding past CP-1, verify:
|
|
|
15
15
|
4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
|
|
16
16
|
|
|
17
17
|
**CP-1**: plan.md exists with Tasks section.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-plan` to `"completed"`.
|
|
@@ -14,3 +14,6 @@ Before proceeding past CP-1:
|
|
|
14
14
|
3. Resolve all uncertain DB design decisions before writing Tasks — document choices in plan.md
|
|
15
15
|
|
|
16
16
|
**CP-1**: plan.md exists with Tasks section.
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-plan` to `"completed"`.
|
|
@@ -21,3 +21,6 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '#
|
|
|
21
21
|
- If NEEDS_FIXES: spawn Dev to fix (Dev reads Fix Instructions in snapshot), re-run Review (max 3 rounds)
|
|
22
22
|
|
|
23
23
|
**CP-3**: Tests pass, verdict is not NEEDS_FIXES.
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-code-review` to `"completed"`.
|
|
@@ -23,3 +23,6 @@ If GATE:MISSING — send message to Reviewer (re-spawn if needed): "Write the '#
|
|
|
23
23
|
Then re-run Review (max 3 rounds).
|
|
24
24
|
|
|
25
25
|
**CP-3**: Integration tests pass, verdict is not NEEDS_FIXES.
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-code-review` to `"completed"`.
|
|
@@ -80,3 +80,6 @@ Before proceeding past CP-1, verify:
|
|
|
80
80
|
4. If a DB design decision genuinely cannot be resolved from existing code alone, document the assumption made and flag it in the Implementation Log for user review.
|
|
81
81
|
|
|
82
82
|
**CP-1**: Both spec.md and plan.md exist.
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `context-snapshot-and-plan` to `"completed"`.
|
|
@@ -2,3 +2,6 @@
|
|
|
2
2
|
- Run `/prizmkit-init` (invoke the prizmkit-init skill)
|
|
3
3
|
- Run `python3 {{INIT_SCRIPT_PATH}} --project-root {{PROJECT_ROOT}} --feature-id {{FEATURE_ID}} --feature-slug {{FEATURE_SLUG}}`
|
|
4
4
|
- **CP-0**: Verify `.prizm-docs/root.prizm`, `.prizmkit/config.json` exist
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `prizmkit-init` to `"completed"`.
|
|
@@ -10,3 +10,6 @@ $TEST_CMD 2>&1 | tee /tmp/test-baseline.txt | tail -20
|
|
|
10
10
|
Save the list of **pre-existing failing tests** (if any) as `BASELINE_FAILURES`. These are known failures that existed before this session — Dev must NOT be blamed for them, but must list them in COMPLETION_SIGNAL.
|
|
11
11
|
|
|
12
12
|
> **Test Output Rule**: Always capture test output to a temp file (`tee /tmp/test-out.txt`). Then grep the file instead of re-running the suite.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
**Checkpoint update**: Update `workflow-checkpoint.json` — set step `test-baseline` to `"completed"`.
|
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
### Resume from Phase {{RESUME_PHASE}}
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
**Primary**: Read `{{CHECKPOINT_PATH}}` — find the first step with `"pending"` or `"in_progress"` status and resume from there. Steps already `"completed"` or `"skipped"` must NOT be re-executed.
|
|
4
|
+
|
|
5
|
+
**Fallback**: If `workflow-checkpoint.json` is missing or corrupted, check `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` — if it exists, skip context building and use it directly.
|
|
@@ -8,3 +8,4 @@ Before any git commit in this project:
|
|
|
8
8
|
3. Bug fixes use `fix()` prefix, not `feat()`
|
|
9
9
|
4. Bug fixes run retrospective with structural sync only (Job 1)
|
|
10
10
|
5. Use `/prizmkit-committer` command for the pure commit workflow
|
|
11
|
+
6. After commit, `/prizmkit-committer` generates `session-summary.md` (lightweight cross-session handoff, not committed to git)
|
|
@@ -18,19 +18,20 @@ WHEN TO UPDATE .prizm-docs/:
|
|
|
18
18
|
- Before modifying any source file, read `.prizm-docs/root.prizm` if it exists to understand project structure.
|
|
19
19
|
|
|
20
20
|
FORMAT RULES (enforced by pre-commit hook — violations block commit):
|
|
21
|
-
- ALL CAPS section headers: MODULE:, FILES:, RESPONSIBILITY:,
|
|
21
|
+
- ALL CAPS section headers: MODULE:, FILES:, RESPONSIBILITY:, etc.
|
|
22
22
|
- KEY: value pairs and dash-prefixed lists only
|
|
23
23
|
- PROHIBITED: prose paragraphs, markdown headers (##/###), code blocks (```), emoji, ASCII art
|
|
24
|
+
- No UPDATED timestamps — git is the authoritative source for temporal information
|
|
24
25
|
- This format is designed for AI token efficiency, not human readability. Do not add human-friendly formatting.
|
|
25
26
|
|
|
26
27
|
SIZE LIMITS (hard — pre-commit hook blocks commits exceeding these):
|
|
27
28
|
- L0 root.prizm: 4KB max
|
|
28
|
-
- L1 module.prizm:
|
|
29
|
+
- L1 module.prizm: 4KB max
|
|
29
30
|
- L2 detail.prizm: 5KB max
|
|
30
31
|
|
|
31
32
|
SIZE OVERFLOW HANDLING:
|
|
32
|
-
- L0 approaching 4KB:
|
|
33
|
-
- L1 approaching
|
|
33
|
+
- L0 approaching 4KB: if MODULE_INDEX has > 15 entries, convert to MODULE_GROUPS format (group by domain). Otherwise consolidate descriptions, keep only top-5 RULES, remove PATTERNS detail.
|
|
34
|
+
- L1 approaching 4KB: trim KEY_FILES descriptions, ensure RULES <= 3 entries, move detail to L2
|
|
34
35
|
- L2 approaching 5KB: archive CHANGELOG entries older than 90 days to changelog-archive.prizm
|
|
35
36
|
- NEVER exceed hard limits — pre-commit hook will block the commit
|
|
36
37
|
|
|
@@ -40,26 +41,24 @@ L0 root.prizm:
|
|
|
40
41
|
- PRIZM_VERSION
|
|
41
42
|
- PROJECT
|
|
42
43
|
- LANG
|
|
43
|
-
- MODULE_INDEX (with -> pointers to L1 files)
|
|
44
|
+
- MODULE_INDEX or MODULE_GROUPS (with -> pointers to L1 files)
|
|
44
45
|
- RULES (top-level project rules)
|
|
45
|
-
- UPDATED
|
|
46
46
|
|
|
47
|
-
L1 module.prizm:
|
|
47
|
+
L1 module.prizm (structural index only):
|
|
48
48
|
- MODULE
|
|
49
49
|
- FILES
|
|
50
50
|
- RESPONSIBILITY
|
|
51
|
-
- INTERFACES (public/exported only)
|
|
52
51
|
- DEPENDENCIES
|
|
53
|
-
-
|
|
52
|
+
- L1 does NOT contain: INTERFACES, DATA_FLOW, TRAPS, DECISIONS (those belong in L2)
|
|
54
53
|
|
|
55
54
|
L2 detail.prizm:
|
|
56
55
|
- MODULE
|
|
57
56
|
- FILES
|
|
58
57
|
- KEY_FILES
|
|
59
58
|
- DEPENDENCIES
|
|
60
|
-
-
|
|
59
|
+
- INTERFACES
|
|
60
|
+
- TRAPS (with severity prefix: [CRITICAL], [HIGH], or [LOW])
|
|
61
61
|
- CHANGELOG
|
|
62
|
-
- UPDATED
|
|
63
62
|
|
|
64
63
|
L2 GENERATION TEMPLATE (use when AI first touches a sub-module with no L2 doc):
|
|
65
64
|
|
|
@@ -71,10 +70,11 @@ KEY_FILES:
|
|
|
71
70
|
DEPENDENCIES:
|
|
72
71
|
- uses: <lib>: <why>
|
|
73
72
|
- imports: <module>: <what>
|
|
73
|
+
INTERFACES:
|
|
74
|
+
- <exported function/class>: <signature and purpose>
|
|
74
75
|
TRAPS:
|
|
75
|
-
- <gotcha, race condition, or non-obvious coupling>
|
|
76
|
+
- [LOW] <gotcha, race condition, or non-obvious coupling> | FIX: <approach>
|
|
76
77
|
CHANGELOG:
|
|
77
|
-
-
|
|
78
|
-
UPDATED: <YYYY-MM-DD>
|
|
78
|
+
- root | add: initial L2 documentation
|
|
79
79
|
|
|
80
|
-
TRAPS is critical — always record gotchas, race conditions, non-obvious behavior, and surprising coupling between modules.
|
|
80
|
+
TRAPS is critical — always record gotchas, race conditions, non-obvious behavior, and surprising coupling between modules. Every TRAP must have a severity prefix ([CRITICAL], [HIGH], or [LOW]).
|
|
@@ -4,7 +4,8 @@ description: "PrizmKit progressive context loading protocol"
|
|
|
4
4
|
|
|
5
5
|
This project uses PrizmKit's progressive loading protocol:
|
|
6
6
|
- ON SESSION START: Read `.prizm-docs/root.prizm` (L0 — project map)
|
|
7
|
-
- ON
|
|
7
|
+
- ON RESUME (feature/bugfix directory has session-summary.md): Read session-summary.md first for prior context, then load only L1/L2 for modules mentioned in it
|
|
8
|
+
- ON TASK: Read L1 (`.prizm-docs/<module>.prizm`) for relevant modules. If MODULE_INDEX entries have keyword tags (e.g., `[login, jwt, oauth]`), match user's task description against tags to prioritize which modules' L1 to load first. If root.prizm uses MODULE_GROUPS, identify the relevant domain first, then load L1 only for modules in that domain.
|
|
8
9
|
- ON FILE EDIT: Read L2 (`.prizm-docs/<module>/<submodule>.prizm`) before modifying
|
|
9
10
|
- NEVER load all .prizm docs at once
|
|
10
11
|
- Arrow notation (->) in .prizm files indicates load pointers
|
|
@@ -5,7 +5,8 @@ This project uses PrizmKit with the Prizm documentation system for AI-optimized
|
|
|
5
5
|
|
|
6
6
|
### Progressive Loading Protocol
|
|
7
7
|
- ON SESSION START: Always read `.prizm-docs/root.prizm` first (L0 — project map)
|
|
8
|
-
- ON
|
|
8
|
+
- ON RESUME (feature/bugfix directory has session-summary.md): Read session-summary.md first for prior context, then load only L1/L2 for modules mentioned in it
|
|
9
|
+
- ON TASK: Read L1 (`.prizm-docs/<module>.prizm`) for relevant modules referenced in MODULE_INDEX or MODULE_GROUPS. If entries have keyword tags (e.g., `[login, jwt, oauth]`), match user's task against tags to prioritize which modules to load.
|
|
9
10
|
- ON FILE EDIT: Read L2 (`.prizm-docs/<module>/<submodule>.prizm`) before modifying files. Pay attention to TRAPS and DECISIONS.
|
|
10
11
|
- NEVER load all .prizm docs at once. Load only what is needed for the current task.
|
|
11
12
|
|
|
@@ -16,9 +17,10 @@ This project uses PrizmKit with the Prizm documentation system for AI-optimized
|
|
|
16
17
|
|
|
17
18
|
### Doc Format Rules
|
|
18
19
|
- All `.prizm` files use KEY: value format, not prose
|
|
19
|
-
- Size limits: L0 = 4KB, L1 =
|
|
20
|
+
- Size limits: L0 = 4KB, L1 = 4KB, L2 = 5KB
|
|
20
21
|
- Arrow notation (->) indicates load pointers to other .prizm docs
|
|
21
22
|
- DECISIONS and CHANGELOG are append-only (never delete entries)
|
|
23
|
+
- No date/time fields — git is the authoritative source for temporal info
|
|
22
24
|
|
|
23
25
|
### Creating New L2 Docs
|
|
24
26
|
- When you first modify files in a sub-module that has no L2 doc:
|
|
@@ -61,6 +61,34 @@ git status
|
|
|
61
61
|
```
|
|
62
62
|
- If "nothing to commit, working tree clean": commit verified successfully, proceed
|
|
63
63
|
|
|
64
|
+
#### Step 5.5: Generate Session Summary (for cross-session recovery)
|
|
65
|
+
|
|
66
|
+
After a successful commit, generate a lightweight handoff file for future sessions. Locate the artifact directory (`.prizmkit/specs/<feature-dir>/` for features, `.prizmkit/refactor/<slug>/` for refactors, `.prizmkit/bugfix/<id>/` for bugfixes) by checking which `plan.md` was used in this workflow.
|
|
67
|
+
|
|
68
|
+
If an artifact directory with `plan.md` is found, write `session-summary.md` in that directory:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
# Session Summary
|
|
72
|
+
## Completed Tasks
|
|
73
|
+
<list task IDs and one-line descriptions from plan.md [x] items>
|
|
74
|
+
|
|
75
|
+
## Files Changed
|
|
76
|
+
<list from `git diff HEAD~1 --name-only` of the commit just made>
|
|
77
|
+
|
|
78
|
+
## Key Decisions
|
|
79
|
+
<1-3 bullet points of non-obvious design choices made this session, referencing DECISIONS in .prizm-docs/ if applicable>
|
|
80
|
+
|
|
81
|
+
## Active TRAPS
|
|
82
|
+
<any CRITICAL or HIGH TRAPS relevant to the changed files, copied from .prizm-docs/ L2>
|
|
83
|
+
|
|
84
|
+
## Remaining Work
|
|
85
|
+
<list unchecked [ ] task IDs from plan.md, or "None — feature complete" if all done>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Keep this file under 1.5KB. If no artifact directory with `plan.md` can be identified (e.g., ad-hoc commit), skip this step.
|
|
89
|
+
|
|
90
|
+
**Lifecycle**: `session-summary.md` is a local cross-session artifact — do NOT commit it to git. It exists only on disk for the next session to read. Overwrite any existing `session-summary.md` from a previous session — this file reflects only the most recent commit's state. In pipeline mode, this file will remain as an untracked file after commit; the pipeline runner should ignore it (it is not a sign of incomplete work).
|
|
91
|
+
|
|
64
92
|
#### Step 6: Optional Push
|
|
65
93
|
Ask user: "Push to remote?"
|
|
66
94
|
- Yes: `git push`
|
|
@@ -29,8 +29,9 @@ description: "Execute plan.md tasks with TDD approach. Respects task ordering an
|
|
|
29
29
|
- **Feature mode**: read `spec.md` in the same directory
|
|
30
30
|
- **Refactor mode**: read `refactor-analysis.md` in the same directory — pay special attention to Scope Boundary (do not implement changes outside scope) and Baseline Tests (all must still pass)
|
|
31
31
|
- **Bugfix mode**: read `fix-plan.md` in the same directory
|
|
32
|
-
2. Load project context — use the most efficient source available:
|
|
32
|
+
2. Load project context — use the most efficient source available (check in this order):
|
|
33
33
|
- If `context-snapshot.md` exists in the feature directory → read it. Section 3 has Prizm docs + TRAPS. Section 4 has File Manifest (Tier-2/3) or full source (Tier-1). Read source files on-demand as directed by the manifest.
|
|
34
|
+
- Else if `session-summary.md` exists in the feature directory → read it for quick context recovery (completed tasks, key decisions, active TRAPS). Then load only the L1/L2 docs for modules listed in "Files Changed" — skip unrelated modules.
|
|
34
35
|
- Otherwise → **self-service context fallback**:
|
|
35
36
|
1. Read **architecture index**: `.prizm-docs/root.prizm` and relevant L1/L2 for affected modules. Pay special attention to TRAPS and DECISIONS.
|
|
36
37
|
2. Scan needed source files
|
|
@@ -71,7 +71,8 @@ BROWNFIELD WORKFLOW (existing project):
|
|
|
71
71
|
**Step 2: Prizm Documentation Generation**
|
|
72
72
|
Invoke prizmkit-prizm-docs (Init operation), passing the two-tier module structure from Step 1:
|
|
73
73
|
- Create `.prizm-docs/` directory structure mirroring the source tree (sub-module dirs become subdirectories under `.prizm-docs/<top-level>/`)
|
|
74
|
-
- Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing only top-level modules
|
|
74
|
+
- Generate `root.prizm` (L0) with project meta and MODULE_INDEX listing only top-level modules. If module count > 15, use MODULE_GROUPS format instead (group by functional domain).
|
|
75
|
+
- For each module entry in MODULE_INDEX/MODULE_GROUPS, include keyword tags extracted from the module's source files — scan for: exported symbols, imported packages, domain terms in file/directory names. Format: `- module-name [tag1, tag2, tag3]: ...`. Tags help AI match user intent to relevant modules.
|
|
75
76
|
- Generate L1 docs for top-level modules at `.prizm-docs/<M>.prizm` and for sub-modules at `.prizm-docs/<M>/<S>.prizm`
|
|
76
77
|
- Create `changelog.prizm`
|
|
77
78
|
- Skip L2 (lazy generation) — L2 is generated on first file modification, saving tokens upfront
|
|
@@ -52,6 +52,8 @@ STEPS:
|
|
|
52
52
|
- Exclude .git/, node_modules/, vendor/, build/, dist/, __pycache__/, target/, bin/, .claude/, .codebuddy/, .prizmkit/, .prizm-docs/, dev-pipeline/. If total module count > 30, ask user for include/exclude patterns.
|
|
53
53
|
3. Create .prizm-docs/ directory structure mirroring the source tree exactly. For each top-level module M that has sub-modules, create the subdirectory .prizm-docs/<M>/.
|
|
54
54
|
4. Generate root.prizm (L0) with PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY, MODULE_INDEX with multi-level entries as needed for efficient navigation (constrained by 4KB limit), RULES extracted from CODEBUDDY.md/CLAUDE.md/README/linter configs, PATTERNS, and CROSS_CUTTING (cross-module concerns spanning 2+ modules). Set PRIZM_VERSION: 4. Max 4KB. No UPDATED timestamp — git tracks modification times.
|
|
55
|
+
- If module count > 15: use MODULE_GROUPS format instead of MODULE_INDEX — group modules by functional domain (3-8 domains, inferred from directory structure and module responsibilities). See PRIZM-SPEC for MODULE_GROUPS format.
|
|
56
|
+
- For each module entry, auto-generate 3-6 keyword tags by scanning the module's key source files for: exported function/class names, imported library names, domain-specific terms in file/directory names. Add tags in square brackets after the module name (e.g., `- auth [login, session, jwt]: ...`). Tags are optional but recommended for projects with 10+ modules.
|
|
55
57
|
5. Generate L1 .prizm files (structural index only) for ALL modules, each at its correct mirrored path:
|
|
56
58
|
- Top-level module M → write .prizm-docs/<M>.prizm (include SUBDIRS section with pointers to sub-module docs)
|
|
57
59
|
- Sub-module S inside M → write .prizm-docs/<M>/<S>.prizm
|
|
@@ -72,9 +74,9 @@ PRECONDITION: .prizm-docs/ exists with root.prizm.
|
|
|
72
74
|
|
|
73
75
|
STEPS:
|
|
74
76
|
1. Get changed files via `git diff --cached --name-status`. If nothing staged, use `git diff --name-status`. If no git changes at all, do full rescan comparing code against existing docs — this includes checking for modules that have source files but no L2 doc.
|
|
75
|
-
2. Map changed files to modules by matching against MODULE_INDEX in root.prizm. Group changes by module.
|
|
77
|
+
2. Map changed files to modules by matching against MODULE_INDEX or MODULE_GROUPS in root.prizm. Group changes by module.
|
|
76
78
|
3. Classify each change: A (added) -> new KEY_FILES entries. D (deleted) -> remove entries, update counts. M (modified) -> check dependency changes. R (renamed) -> update all path references.
|
|
77
|
-
4. Update affected docs: L2 first (KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, TRAPS, CHANGELOG), then L1 (FILES count, KEY_FILES, DEPENDENCIES — L1 does NOT contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS), then L0 (MODULE_INDEX counts, CROSS_CUTTING) only if structural change. No UPDATED timestamps — git tracks modification times.
|
|
79
|
+
4. Update affected docs: L2 first (KEY_FILES, INTERFACES, DATA_FLOW, DEPENDENCIES, TRAPS, CHANGELOG), then L1 (FILES count, KEY_FILES, DEPENDENCIES — L1 does NOT contain INTERFACES/DATA_FLOW/TRAPS/DECISIONS), then L0 (MODULE_INDEX or MODULE_GROUPS counts, CROSS_CUTTING) only if structural change. No UPDATED timestamps — git tracks modification times.
|
|
78
80
|
5. Skip updates if: only internal implementation changed (no interface/dependency change), only comments/whitespace/formatting, only .prizm files changed. DO NOT skip test file changes or bug fixes — they may reveal TRAPS worth capturing in L2.
|
|
79
81
|
6. If new directory qualifies as a module (per MODULE_DISCOVERY_CRITERIA) and matches no existing module: create L1 immediately, add to MODULE_INDEX. If the current diff includes Added or Modified source files in this module → also create L2 immediately using the L2 GENERATION TEMPLATE. Otherwise defer L2.
|
|
80
82
|
6a. **L2 gap check** (runs during full rescan mode only — when no git changes detected): For each existing module in MODULE_INDEX, check if L2 doc exists. If L2 is missing and the module has source files with meaningful logic (not trivial config/wrapper) → create L2 using the L2 GENERATION TEMPLATE. This ensures Update fills documentation gaps left by previous sessions.
|
|
@@ -110,7 +112,7 @@ STEPS:
|
|
|
110
112
|
2. Re-scan the module directory for files, interfaces, dependencies, subdirectories.
|
|
111
113
|
3. Generate fresh L1 doc with full module analysis.
|
|
112
114
|
4. Generate L2 docs for all sub-modules immediately (unlike init, rebuild generates L2 right away to capture current state).
|
|
113
|
-
5. Update MODULE_INDEX in root.prizm with new file counts and pointers.
|
|
115
|
+
5. Update MODULE_INDEX (or MODULE_GROUPS) in root.prizm with new file counts and pointers. Re-evaluate grouping: if total module count > 15 and currently using MODULE_INDEX, convert to MODULE_GROUPS. Regenerate keyword tags for rebuilt modules.
|
|
114
116
|
6. Append rebuild entry to changelog.prizm: `- YYYY-MM-DD | <module-path> | refactor: rebuilt module documentation from scratch`
|
|
115
117
|
7. Validate regenerated docs against size limits and format rules.
|
|
116
118
|
|
|
@@ -127,9 +129,10 @@ STEPS:
|
|
|
127
129
|
2. SIZE CHECK: Verify size limits: L0 <= 4KB, L1 <= 4KB, L2 <= 5KB. Report files exceeding limits with current size.
|
|
128
130
|
3. POINTER CHECK: Verify all arrow (->) references resolve to existing .prizm files. Report broken pointers.
|
|
129
131
|
4. STALENESS CHECK: Compare git modification time of each .prizm file against source directory. Flag docs where source was modified more recently.
|
|
130
|
-
5. COMPLETENESS CHECK: Verify root.prizm has all required fields (PRIZM_VERSION, PROJECT, LANG, MODULE_INDEX). Verify L1 docs have MODULE, FILES, RESPONSIBILITY, DEPENDENCIES (no INTERFACES/TRAPS/DECISIONS). Verify L2 docs have MODULE, FILES, KEY_FILES, DEPENDENCIES, INTERFACES, TRAPS.
|
|
132
|
+
5. COMPLETENESS CHECK: Verify root.prizm has all required fields (PRIZM_VERSION, PROJECT, LANG, MODULE_INDEX or MODULE_GROUPS). Verify L1 docs have MODULE, FILES, RESPONSIBILITY, DEPENDENCIES (no INTERFACES/TRAPS/DECISIONS). Verify L2 docs have MODULE, FILES, KEY_FILES, DEPENDENCIES, INTERFACES, TRAPS.
|
|
131
133
|
6. ANTI-PATTERN CHECK: Flag duplicate information across levels, implementation details in L0/L1, TODO items, session-specific context.
|
|
132
134
|
7. RULES HIERARCHY CHECK: Verify L1/L2 RULES do not contradict root.prizm RULES. L1/L2 may only supplement with module-specific exceptions.
|
|
135
|
+
8. TRAPS STALENESS CHECK: For each L2 doc where TRAPS section has more than 8 entries, verify that TRAPS include staleness metadata (`STALE_IF:` or `REF:` fields). Flag TRAPS without any staleness metadata as `NEEDS_METADATA` — these are not auto-removed, but flagged for the next `/prizmkit-retrospective` to enrich with `STALE_IF:` globs or `REF:` hashes.
|
|
133
136
|
|
|
134
137
|
OUTPUT: Validation report with PASS/FAIL per check, list of issues with file paths and suggested fixes.
|
|
135
138
|
|
|
@@ -182,6 +182,36 @@ CONSTRAINTS:
|
|
|
182
182
|
- No prose paragraphs
|
|
183
183
|
- root.prizm RULES are AUTHORITATIVE: they override any conflicting L1/L2 RULES
|
|
184
184
|
|
|
185
|
+
### MODULE_GROUPS (alternative to MODULE_INDEX for projects with 15+ modules)
|
|
186
|
+
|
|
187
|
+
When MODULE_INDEX would exceed 15 entries, replace it with MODULE_GROUPS to stay within the 4KB limit. Group modules by functional domain:
|
|
188
|
+
|
|
189
|
+
MODULE_GROUPS:
|
|
190
|
+
<domain-name>:
|
|
191
|
+
- <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
|
|
192
|
+
- <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
|
|
193
|
+
<domain-name>:
|
|
194
|
+
- <module>: <file-count> files. <one-line description>. -> .prizm-docs/<module>.prizm
|
|
195
|
+
|
|
196
|
+
CONSTRAINTS for MODULE_GROUPS:
|
|
197
|
+
- Exactly ONE of MODULE_INDEX or MODULE_GROUPS must be present in root.prizm (not both)
|
|
198
|
+
- Domain names: lowercase, descriptive (e.g., api, frontend, infrastructure, shared, data)
|
|
199
|
+
- 3-8 domains is the ideal range
|
|
200
|
+
- Each module appears in exactly one domain
|
|
201
|
+
- Every entry must have an arrow pointer (->), same as MODULE_INDEX
|
|
202
|
+
- AI should load the relevant domain's modules when working on a task, not all domains
|
|
203
|
+
|
|
204
|
+
### Optional Keyword Tags (applies to both MODULE_INDEX and MODULE_GROUPS)
|
|
205
|
+
|
|
206
|
+
Entries may include keyword tags for AI intent matching:
|
|
207
|
+
|
|
208
|
+
MODULE_INDEX:
|
|
209
|
+
- auth [login, session, jwt, oauth]: 12 files. Authentication and authorization. -> .prizm-docs/auth.prizm
|
|
210
|
+
- payments [stripe, billing, subscription]: 8 files. Payment processing. -> .prizm-docs/payments.prizm
|
|
211
|
+
- users: 6 files. User management. -> .prizm-docs/users.prizm
|
|
212
|
+
|
|
213
|
+
Tags are optional, enclosed in square brackets after the module name. They contain lowercase keywords that describe the module's domain concepts. AI matches user requirement descriptions against tags to identify relevant modules before loading L1. Tags are auto-generated during Init from module source content (function names, imports, domain terms) and refined during Rebuild.
|
|
214
|
+
|
|
185
215
|
## 3.2 L1: module.prizm (Structural Index)
|
|
186
216
|
|
|
187
217
|
TEMPLATE:
|
|
@@ -582,7 +612,7 @@ STEPS:
|
|
|
582
612
|
|
|
583
613
|
4. GENERATE_ROOT (L0):
|
|
584
614
|
Fill: PROJECT, LANG, FRAMEWORK, BUILD, TEST, ENTRY from step 1
|
|
585
|
-
Build: MODULE_INDEX — list modules at the depth needed for efficient navigation, with arrow pointers
|
|
615
|
+
Build: MODULE_INDEX (or MODULE_GROUPS if 15+ modules — see Section 3.1) — list modules at the depth needed for efficient navigation, with arrow pointers
|
|
586
616
|
Extract: RULES from existing README, .editorconfig, linter configs
|
|
587
617
|
Extract: PATTERNS from common code patterns observed in step 2
|
|
588
618
|
Extract: CROSS_CUTTING — identify patterns/constraints that span 2+ modules
|
|
@@ -159,8 +159,10 @@ If the user declines, suggest alternatives:
|
|
|
159
159
|
### 2.0 Read Target Workflow
|
|
160
160
|
|
|
161
161
|
1. **Read the workflow's SKILL.md** from `core/skills/orchestration-skill/workflows/{workflow-type}/SKILL.md`
|
|
162
|
-
2. **Read existing artifacts** to restore context
|
|
163
|
-
|
|
162
|
+
2. **Read existing artifacts** to restore context — check in this order for the most efficient recovery:
|
|
163
|
+
- If `session-summary.md` exists in the artifact directory → read it first. It provides a lightweight summary of completed tasks, key decisions, active TRAPS, and remaining work from the interrupted session.
|
|
164
|
+
- Then read remaining artifacts: spec, plan, code diffs, bug descriptions, etc.
|
|
165
|
+
3. **Read relevant `.prizm-docs/`** — load project context (L0 root, relevant L1). If `session-summary.md` was found, use its "Files Changed" section to focus L1/L2 loading on affected modules only.
|
|
164
166
|
|
|
165
167
|
This step replaces the context that was lost when the AI session was interrupted.
|
|
166
168
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"members": [
|
|
12
12
|
{
|
|
13
13
|
"name": "dev",
|
|
14
|
-
"role": "developer",
|
|
14
|
+
"role": "developer",
|
|
15
15
|
"agentDefinition": "prizm-dev-team-dev",
|
|
16
16
|
"prompt": "You are a Dev Agent of the prizm-dev-team. Follow /prizmkit-implement workflow with TDD. Read plan.md/spec.md, implement task-by-task, mark completed tasks [x]. Check .prizm-docs/ TRAPS before implementing.",
|
|
17
17
|
"subscriptions": ["*"]
|