prizmkit 1.1.189 → 1.1.191

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 (49) hide show
  1. package/bin/create-prizmkit.js +4 -4
  2. package/bundled/VERSION.json +3 -3
  3. package/bundled/adapters/antigravity/assets/prizmkit-hook.cjs +150 -0
  4. package/bundled/adapters/antigravity/hooks-adapter.js +195 -0
  5. package/bundled/adapters/antigravity/paths.js +14 -0
  6. package/bundled/adapters/antigravity/rules-adapter.js +54 -0
  7. package/bundled/adapters/antigravity/skill-adapter.js +29 -0
  8. package/bundled/dev-pipeline/README.md +16 -5
  9. package/bundled/dev-pipeline/prizmkit_runtime/config.py +13 -2
  10. package/bundled/dev-pipeline/prizmkit_runtime/gitops.py +12 -12
  11. package/bundled/dev-pipeline/prizmkit_runtime/platform_detection.py +13 -4
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +8 -2
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +186 -24
  14. package/bundled/dev-pipeline/prizmkit_runtime/status.py +2 -0
  15. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +305 -17
  16. package/bundled/dev-pipeline/scripts/utils.py +5 -3
  17. package/bundled/dev-pipeline/tests/live_ai_cli_log_smoke.py +1 -0
  18. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +135 -0
  19. package/bundled/dev-pipeline/tests/test_unified_cli.py +363 -0
  20. package/bundled/rules/USAGE.md +1 -0
  21. package/bundled/skills/_metadata.json +1 -1
  22. package/bundled/skills/bug-planner/SKILL.md +29 -31
  23. package/bundled/skills/bug-planner/references/generated-plan-review.md +19 -23
  24. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +11 -0
  25. package/bundled/skills/feature-planner/SKILL.md +22 -22
  26. package/bundled/skills/feature-planner/references/generated-plan-review.md +19 -23
  27. package/bundled/skills/feature-planner/references/incremental-feature-planning.md +7 -7
  28. package/bundled/skills/feature-planner/references/new-project-planning.md +7 -7
  29. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +11 -0
  30. package/bundled/skills/prizmkit-init/SKILL.md +1 -1
  31. package/bundled/skills/prizmkit-init/references/config-schema.md +2 -2
  32. package/bundled/skills/prizmkit-prizm-docs/assets/prizm-docs-format.md +1 -1
  33. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  34. package/bundled/skills/refactor-planner/SKILL.md +23 -25
  35. package/bundled/skills/refactor-planner/references/fast-path.md +4 -4
  36. package/bundled/skills/refactor-planner/references/generated-plan-review.md +19 -23
  37. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +11 -0
  38. package/package.json +1 -1
  39. package/src/ai-cli-launch.js +1 -1
  40. package/src/clean.js +40 -4
  41. package/src/config.js +64 -4
  42. package/src/detect-platform.js +10 -6
  43. package/src/external-skills.js +2 -2
  44. package/src/index.js +1 -0
  45. package/src/manifest.js +1 -1
  46. package/src/platforms.js +6 -2
  47. package/src/prompts.js +11 -3
  48. package/src/scaffold.js +59 -4
  49. package/src/upgrade.js +9 -3
@@ -1109,6 +1109,62 @@ def test_runtime_config_resolves_and_validates_cursor_agent(tmp_path, monkeypatc
1109
1109
  assert preserved.source == "installed-platform:claude"
1110
1110
 
1111
1111
 
1112
+ def test_runtime_config_resolves_and_validates_antigravity_agy(tmp_path, monkeypatch):
1113
+ import prizmkit_runtime.config as runtime_config
1114
+ from prizmkit_runtime.config import resolve_ai_client, validate_effort
1115
+ from prizmkit_runtime.paths import resolve_runtime_paths
1116
+ from prizmkit_runtime.platform_detection import platform_from_command
1117
+
1118
+ assert platform_from_command("agy") == "antigravity"
1119
+ assert platform_from_command("antigravity") == "antigravity"
1120
+ assert platform_from_command(r"C:\Tools\agy.exe") == "antigravity"
1121
+
1122
+ project = tmp_path / "agy-project"
1123
+ pipeline = project / ".prizmkit" / "dev-pipeline"
1124
+ pipeline.mkdir(parents=True)
1125
+ paths = resolve_runtime_paths(pipeline_root=pipeline)
1126
+
1127
+ (project / ".prizmkit" / "config.json").write_text('{"ai_cli":"agy"}', encoding="utf-8")
1128
+ configured = resolve_ai_client(paths, env={"PATH": ""})
1129
+ assert configured.command == "agy"
1130
+ assert configured.platform == "antigravity"
1131
+ assert configured.launch_profile is None
1132
+
1133
+ for valid_level in ("low", "medium", "high", "xhigh", "max"):
1134
+ assert validate_effort(valid_level, "antigravity").valid is True
1135
+ invalid_effort = validate_effort("off", "antigravity")
1136
+ assert invalid_effort.valid is False
1137
+ assert invalid_effort.supported_values == ("low", "medium", "high", "xhigh", "max")
1138
+ assert "Antigravity" in invalid_effort.message
1139
+
1140
+ (project / ".prizmkit" / "config.json").unlink()
1141
+ (project / ".prizmkit" / "manifest.json").write_text('{"platform":"antigravity"}', encoding="utf-8")
1142
+ monkeypatch.setattr(
1143
+ runtime_config.shutil,
1144
+ "which",
1145
+ lambda name, path=None: "/tools/agy" if name == "agy" else None,
1146
+ )
1147
+ from_manifest = resolve_ai_client(paths, env={"PATH": "/tools"})
1148
+ assert from_manifest.command == "agy"
1149
+ assert from_manifest.platform == "antigravity"
1150
+ assert from_manifest.source == "prizmkit-manifest:platform"
1151
+
1152
+ (project / ".prizmkit" / "manifest.json").unlink()
1153
+ plugin_skill = project / ".agents" / "plugins" / "prizmkit" / "skills" / "prizmkit" / "SKILL.md"
1154
+ plugin_skill.parent.mkdir(parents=True)
1155
+ plugin_skill.write_text("fixture\n", encoding="utf-8")
1156
+ from_marker = resolve_ai_client(paths, env={"PATH": "/tools"})
1157
+ assert from_marker.command == "agy"
1158
+ assert from_marker.platform == "antigravity"
1159
+ assert from_marker.source == "installed-platform:antigravity"
1160
+
1161
+ plugin_skill.unlink()
1162
+ from_path = resolve_ai_client(paths, env={"PATH": "/tools"})
1163
+ assert from_path.command == "agy"
1164
+ assert from_path.platform == "antigravity"
1165
+ assert from_path.source == "PATH:agy"
1166
+
1167
+
1112
1168
  def test_stream_json_support_detection_matches_provider_rules(monkeypatch):
1113
1169
  import prizmkit_runtime.sessions as sessions
1114
1170
  from prizmkit_runtime.sessions import detect_stream_json_support
@@ -1124,6 +1180,8 @@ def test_stream_json_support_detection_matches_provider_rules(monkeypatch):
1124
1180
  return "Cursor Agent 2026.1"
1125
1181
  if tuple(command) == ("agent", "--help"):
1126
1182
  return "Cursor Agent --print --force --trust --output-format stream-json"
1183
+ if tuple(command) == ("agy", "--help"):
1184
+ return "agy --print --dangerously-skip-permissions --input-format --output-format stream-json"
1127
1185
  return ""
1128
1186
 
1129
1187
  codebuddy = detect_stream_json_support("cbc", "codebuddy", help_runner)
@@ -1131,6 +1189,7 @@ def test_stream_json_support_detection_matches_provider_rules(monkeypatch):
1131
1189
  claude = detect_stream_json_support("claude", "claude", help_runner)
1132
1190
  pi = detect_stream_json_support("pi", "pi", help_runner)
1133
1191
  cursor = detect_stream_json_support("agent", "cursor", help_runner)
1192
+ antigravity = detect_stream_json_support("agy", "antigravity", help_runner)
1134
1193
  unsupported = detect_stream_json_support("other", "claude", lambda _cmd: "plain help")
1135
1194
 
1136
1195
  assert codebuddy.enabled and codebuddy.format == "stream-json"
@@ -1138,6 +1197,8 @@ def test_stream_json_support_detection_matches_provider_rules(monkeypatch):
1138
1197
  assert claude.enabled and claude.format == "stream-json"
1139
1198
  assert pi.enabled and pi.format == "pi-json"
1140
1199
  assert cursor.enabled and cursor.format == "cursor-stream-json"
1200
+ assert antigravity.enabled and antigravity.format == "antigravity-stream-json"
1201
+ assert detect_stream_json_support("agy", "antigravity", lambda _cmd: "--print").enabled is False
1141
1202
  assert detect_stream_json_support("agent", "cursor", lambda _cmd: "unrelated --output-format").enabled is False
1142
1203
  monkeypatch.setattr(
1143
1204
  sessions.subprocess,
@@ -1249,6 +1310,39 @@ def test_ai_session_command_builders_match_unix_runtime_snapshot(tmp_path):
1249
1310
  assert "hello" not in cursor.argv
1250
1311
  assert not ({"--effort", "--sandbox", "--worktree", "--disallowedTools", "-y", "--yolo"} & set(cursor.argv))
1251
1312
 
1313
+ agy = build_ai_session_command(
1314
+ AISessionConfig(
1315
+ cli_command="agy",
1316
+ platform="antigravity",
1317
+ model="gemini-3-pro",
1318
+ effort="xhigh",
1319
+ prompt_path=prompt,
1320
+ cwd=project,
1321
+ use_stream_json=True,
1322
+ )
1323
+ )
1324
+ assert agy.argv == (
1325
+ "agy", "--dangerously-skip-permissions", "--input-format", "stream-json",
1326
+ "--output-format", "stream-json", "--model", "gemini-3-pro", "--effort", "xhigh",
1327
+ )
1328
+ assert json.loads(agy.stdin_text) == {"event": "user", "message": {"content": "hello"}}
1329
+ assert agy.prompt_mode == "stdin"
1330
+ assert "hello" not in agy.argv
1331
+
1332
+ agy_text = build_ai_session_command(
1333
+ AISessionConfig(
1334
+ cli_command="agy",
1335
+ platform="antigravity",
1336
+ model=None,
1337
+ prompt_path=prompt,
1338
+ cwd=project,
1339
+ use_stream_json=False,
1340
+ )
1341
+ )
1342
+ assert agy_text.argv == ("agy", "-p", "hello", "--dangerously-skip-permissions")
1343
+ assert agy_text.stdin_text is None
1344
+ assert agy_text.prompt_mode == "argument"
1345
+
1252
1346
 
1253
1347
  def test_custom_ai_session_command_builder_injects_prompt_and_tokenizes_extra_args(tmp_path):
1254
1348
  from prizmkit_runtime.launch_profiles import HeadlessLaunchProfile
@@ -5139,3 +5233,272 @@ def test_cursor_support_is_hidden_but_tracked_project_configuration_is_committab
5139
5233
  assert ".cursor/rules/user-owned.mdc" in safe_status
5140
5234
  assert ".cursor/skills/prizmkit/SKILL.md" not in safe_status
5141
5235
 
5236
+
5237
+ def test_antigravity_stream_json_progress_and_semantic_log_contract(tmp_path):
5238
+ parser = _load_progress_parser_module()
5239
+ tracker = parser.ProgressTracker(tmp_path / "session.log", provider_hint="antigravity")
5240
+ normalizer = parser.SemanticLogNormalizer()
5241
+ events = [
5242
+ {"event": "init", "conversation_id": "agy-conv-1", "model": "gemini-pro"},
5243
+ {
5244
+ "event": "step_update",
5245
+ "conversation_id": "agy-conv-1",
5246
+ "step_update": {
5247
+ "step_index": 1,
5248
+ "step_type": "thinking",
5249
+ "state": "RUNNING",
5250
+ "thinking_delta": "Inspecting module...",
5251
+ },
5252
+ },
5253
+ {
5254
+ "event": "step_update",
5255
+ "conversation_id": "agy-conv-1",
5256
+ "step_update": {"step_index": 1, "step_type": "thinking", "state": "DONE"},
5257
+ },
5258
+ {
5259
+ "event": "step_update",
5260
+ "conversation_id": "agy-conv-1",
5261
+ "step_update": {
5262
+ "step_index": 2,
5263
+ "step_type": "tool",
5264
+ "state": "RUNNING",
5265
+ "tool_info": {
5266
+ "name": "write_to_file",
5267
+ "parameters": {"TargetFile": "app.py", "CodeContent": "print('secret body')\n"},
5268
+ },
5269
+ },
5270
+ },
5271
+ {
5272
+ "event": "step_update",
5273
+ "conversation_id": "agy-conv-1",
5274
+ "step_update": {
5275
+ "step_index": 2,
5276
+ "step_type": "tool",
5277
+ "state": "DONE",
5278
+ "tool_info": {
5279
+ "name": "write_to_file",
5280
+ "parameters": {"TargetFile": "app.py"},
5281
+ "output": {"content": "wrote file successfully"},
5282
+ },
5283
+ },
5284
+ },
5285
+ {
5286
+ "event": "step_update",
5287
+ "conversation_id": "agy-conv-1",
5288
+ "step_update": {
5289
+ "step_index": 3,
5290
+ "step_type": "tool",
5291
+ "state": "DONE",
5292
+ "tool_info": {
5293
+ "name": "invoke_subagent",
5294
+ "parameters": {"prompt": "audit"},
5295
+ "output": "verified",
5296
+ },
5297
+ },
5298
+ },
5299
+ {
5300
+ "event": "step_update",
5301
+ "conversation_id": "agy-conv-1",
5302
+ "step_update": {
5303
+ "step_index": 4,
5304
+ "step_type": "agent_response",
5305
+ "state": "RUNNING",
5306
+ "text_delta": "Implementation ",
5307
+ },
5308
+ },
5309
+ {
5310
+ "event": "step_update",
5311
+ "conversation_id": "agy-conv-1",
5312
+ "step_update": {
5313
+ "step_index": 4,
5314
+ "step_type": "agent_response",
5315
+ "state": "DONE",
5316
+ "text_delta": "complete.",
5317
+ },
5318
+ },
5319
+ {
5320
+ "event": "result",
5321
+ "conversation_id": "agy-conv-1",
5322
+ "result": {"status": "success", "response": "Done", "usage": {"total_tokens": 120}},
5323
+ },
5324
+ ]
5325
+
5326
+ rendered = ""
5327
+ for event in events:
5328
+ tracker.process_event(event)
5329
+ rendered += normalizer.process_event(event)
5330
+ rendered += normalizer.finish()
5331
+ data = tracker.to_dict()
5332
+
5333
+ assert data["event_format"] == "antigravity-stream-json"
5334
+ assert data["antigravity_session_id"] == "agy-conv-1"
5335
+ assert data["claude_session_id"] == ""
5336
+ assert data["cursor_session_id"] == ""
5337
+ assert data["result_subtype"] == "success"
5338
+ assert data["has_usage"] is True
5339
+ assert data["total_tool_calls"] == 2
5340
+ tool_counts = {item["name"]: item["count"] for item in data["tool_calls"]}
5341
+ assert tool_counts["write_to_file"] == 1
5342
+ assert tool_counts["invoke_subagent"] == 1
5343
+ assert data["subagent_statistics"]["spawned"] == 1
5344
+ assert data["terminal_result_text"] == "Done"
5345
+ assert "[THINK] Inspecting module..." in rendered
5346
+ assert "[ACTION] write_to_file" in rendered
5347
+ assert "[OBSERVATION] write_to_file" in rendered
5348
+ assert "<21 chars>" in rendered
5349
+ assert "[FINAL] Implementation complete." in rendered
5350
+ assert "[SESSION_END] status=success" in rendered
5351
+
5352
+
5353
+ def test_antigravity_stream_errors_and_malformed_lines_fail_safely(tmp_path):
5354
+ from prizmkit_runtime.sessions import parse_stream_progress_lines
5355
+
5356
+ parser = _load_progress_parser_module()
5357
+ tracker = parser.ProgressTracker(tmp_path / "session.log", provider_hint="antigravity")
5358
+ tracker.process_event({"event": "init", "conversation_id": "agy-err-1"})
5359
+ tracker.process_event({
5360
+ "event": "step_update",
5361
+ "step_update": {
5362
+ "step_index": 1,
5363
+ "step_type": "tool",
5364
+ "state": "ERROR",
5365
+ "tool_info": {
5366
+ "name": "run_command",
5367
+ "parameters": {"CommandLine": "rm -rf /"},
5368
+ "error": "permission denied by user policy",
5369
+ },
5370
+ },
5371
+ })
5372
+ tracker.process_event({
5373
+ "event": "error",
5374
+ "error": {"code": "rate_limit_exceeded", "message": "API rate limit exceeded"},
5375
+ })
5376
+ data = tracker.to_dict()
5377
+ assert data["event_format"] == "antigravity-stream-json"
5378
+ assert data["antigravity_session_id"] == "agy-err-1"
5379
+ assert data["current_tool"] is None
5380
+ assert data["permission_denial_count"] >= 1
5381
+ assert any("rate limit exceeded" in str(item).lower() for item in data["errors"])
5382
+ assert data["result_subtype"] == ""
5383
+
5384
+ tracker.process_event({
5385
+ "event": "error",
5386
+ "error": {
5387
+ "code": "context_length_exceeded",
5388
+ "message": "Prompt is too long: maximum context length exceeded",
5389
+ },
5390
+ })
5391
+ overflow_data = tracker.to_dict()
5392
+ assert overflow_data["fatal_error_code"] != ""
5393
+ assert overflow_data["last_result_is_error"] is True
5394
+
5395
+ summary = parse_stream_progress_lines((
5396
+ "not-json",
5397
+ json.dumps({"event": "init", "conversation_id": "agy-err-summary"}),
5398
+ json.dumps({
5399
+ "event": "result",
5400
+ "result": {"status": "error", "error": {"message": "permission denied", "code": "denied"}},
5401
+ }),
5402
+ ), provider_hint="antigravity")
5403
+ assert summary.antigravity_session_id == "agy-err-summary"
5404
+ assert summary.claude_session_id == ""
5405
+ assert summary.result_subtype == "error"
5406
+ assert summary.permission_denial_count >= 1
5407
+
5408
+
5409
+ def test_antigravity_session_launcher_uses_ndjson_stdin_and_task_checkout(tmp_path):
5410
+ from prizmkit_runtime.sessions import AISessionConfig, AISessionLauncher
5411
+
5412
+ checkout = tmp_path / "checkout"
5413
+ checkout.mkdir()
5414
+ prompt = tmp_path / "prompt.md"
5415
+ prompt_text = "antigravity coordinator prompt " * 500
5416
+ prompt.write_text(prompt_text, encoding="utf-8")
5417
+ fake_agy = tmp_path / "agy"
5418
+ fake_agy.write_text(
5419
+ "#!/usr/bin/env python3\n"
5420
+ "import json, pathlib, sys\n"
5421
+ "pathlib.Path('agy-argv.json').write_text(json.dumps(sys.argv[1:]))\n"
5422
+ "line = sys.stdin.readline()\n"
5423
+ "pathlib.Path('agy-stdin.txt').write_text(line)\n"
5424
+ "print(json.dumps({'event':'init','conversation_id':'agy-live','model':'fake-model'}), flush=True)\n"
5425
+ "print(json.dumps({'event':'result','conversation_id':'agy-live','result':{'status':'success','response':'ok'}}), flush=True)\n",
5426
+ encoding="utf-8",
5427
+ )
5428
+ fake_agy.chmod(0o755)
5429
+ session_log = tmp_path / "session.log"
5430
+ progress = tmp_path / "progress.json"
5431
+
5432
+ result = AISessionLauncher(
5433
+ AISessionConfig(
5434
+ cli_command=str(fake_agy),
5435
+ platform="antigravity",
5436
+ model="fake-model",
5437
+ effort="xhigh",
5438
+ prompt_path=prompt,
5439
+ cwd=checkout,
5440
+ log_path=session_log,
5441
+ progress_path=progress,
5442
+ use_stream_json=True,
5443
+ )
5444
+ ).run()
5445
+
5446
+ argv = json.loads((checkout / "agy-argv.json").read_text(encoding="utf-8"))
5447
+ assert argv == [
5448
+ "--dangerously-skip-permissions",
5449
+ "--input-format",
5450
+ "stream-json",
5451
+ "--output-format",
5452
+ "stream-json",
5453
+ "--model",
5454
+ "fake-model",
5455
+ "--effort",
5456
+ "xhigh",
5457
+ ]
5458
+ assert prompt_text not in json.dumps(argv)
5459
+ stdin_msg = json.loads((checkout / "agy-stdin.txt").read_text(encoding="utf-8"))
5460
+ assert stdin_msg == {"event": "user", "message": {"content": prompt_text}}
5461
+ assert result.exit_code == 0
5462
+ assert result.progress_summary.result_subtype == "success"
5463
+ assert result.progress_summary.antigravity_session_id == "agy-live"
5464
+ assert result.progress_summary.claude_session_id == ""
5465
+ assert "antigravity coordinator prompt" not in session_log.read_text(encoding="utf-8")
5466
+
5467
+
5468
+ def test_antigravity_support_is_hidden_but_tracked_agents_config_is_committable(tmp_path):
5469
+ from prizmkit_runtime.gitops import (
5470
+ HIDDEN_TOOL_WORKTREE_EXCLUDES,
5471
+ WORKTREE_PLATFORM_SUPPORT_DIRS,
5472
+ git_status_safe,
5473
+ visible_task_paths,
5474
+ )
5475
+
5476
+ assert ".agents" in WORKTREE_PLATFORM_SUPPORT_DIRS
5477
+ assert ":(top,exclude).agents" in HIDDEN_TOOL_WORKTREE_EXCLUDES
5478
+ assert ":(top,exclude,glob).agents/**" in HIDDEN_TOOL_WORKTREE_EXCLUDES
5479
+
5480
+ project = tmp_path / "project"
5481
+ project.mkdir()
5482
+ subprocess.run(["git", "init", "-q"], cwd=project, check=True)
5483
+ subprocess.run(["git", "config", "user.name", "Test User"], cwd=project, check=True)
5484
+ subprocess.run(["git", "config", "user.email", "test@example.invalid"], cwd=project, check=True)
5485
+ tracked_plugin = project / ".agents" / "plugins" / "custom-user" / "plugin.json"
5486
+ tracked_plugin.parent.mkdir(parents=True)
5487
+ tracked_plugin.write_text('{"name":"custom"}\n', encoding="utf-8")
5488
+ subprocess.run(["git", "add", ".agents/plugins/custom-user/plugin.json"], cwd=project, check=True)
5489
+ subprocess.run(["git", "commit", "-qm", "fixture"], cwd=project, check=True)
5490
+
5491
+ tracked_plugin.write_text('{"name":"custom","version":"2"}\n', encoding="utf-8")
5492
+ materialized = project / ".agents" / "plugins" / "prizmkit" / "skills" / "prizmkit" / "SKILL.md"
5493
+ materialized.parent.mkdir(parents=True)
5494
+ materialized.write_text("support\n", encoding="utf-8")
5495
+
5496
+ paths, result = visible_task_paths(project)
5497
+ assert result.return_code == 0
5498
+ assert ".agents/plugins/custom-user/plugin.json" in paths
5499
+ assert ".agents/plugins/prizmkit/skills/prizmkit/SKILL.md" not in paths
5500
+ safe_status = git_status_safe(project)
5501
+ assert ".agents/plugins/custom-user/plugin.json" in safe_status
5502
+ assert ".agents/plugins/prizmkit/skills/prizmkit/SKILL.md" not in safe_status
5503
+
5504
+
@@ -59,6 +59,7 @@ npx prizmkit install . --rules none
59
59
  | Codex | `.agents/rules/<name>.md` | Behavioral Markdown guidance |
60
60
  | Pi | `.pi/rules/<name>.md` | Behavioral Markdown guidance |
61
61
  | Cursor | `.cursor/rules/<name>.mdc` | Always-applied `.mdc` without temporal metadata |
62
+ | Antigravity | `.agents/plugins/prizmkit/rules/<name>.md` | Always-applied Markdown + YAML frontmatter (`trigger: always_on`) |
62
63
 
63
64
  Rule names use `category/filename` path format (e.g., `prizm/prizm-documentation`). During installation, the last segment is used as the filename (`prizm-documentation.md`).
64
65
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.189",
2
+ "version": "1.1.191",
3
3
  "skills": {
4
4
  "prizmkit": {
5
5
  "description": "Framework introduction and navigation for the formal single-requirement lifecycle, project initialization, Prizm docs, and independent deployment.",
@@ -51,7 +51,7 @@ After planning is complete, you MUST:
51
51
 
52
52
  ## Draft Lifecycle (Hard Rule)
53
53
 
54
- In an ordinary successful flow, `.prizmkit/plans/bug-fix-list.draft.json` is internal writer/review input, not a user approval artifact or separate deliverable. Keep it through `generate`/`append`, validation, and the complete Local Generated-Plan Review fix loop. After the Local Generated-Plan Review returns `PASS` and final validation passes, delete the ordinary internal draft before final handoff. Report `Draft cleanup: removed`. Present the final written result only after cleanup succeeds or a retained recovery reason is surfaced. Retain the draft only for explicit draft-save, interruption or blocking before terminal gates, or cleanup failure; report its path and reason. Cleanup failure does not invalidate an already reviewed and validated final list, but makes the file stale recovery state. Never delete explicit recovery state merely because an older valid final exists. For later adjustments, recreate only the minimum source draft from confirmed in-memory entries or exact-ID `show`; ordinary appends must preserve the exact current suffix and use `append --replace-tail` without loading unrelated history.
54
+ In an ordinary successful flow, `.prizmkit/plans/bug-fix-list.draft.json` is a private reasoning workspace: never presented as a deliverable, never given its own approval round, never retained after the batch lands. Build the batch there, validate it there, and run the entire Local Generated-Plan Review against it; the final list is written exactly once, after that review returns `PASS`, by a single `append` (existing list) or `generate` (new list). Then delete the draft immediately and report `Draft cleanup: removed`. A batch lost before it lands is regenerated from the confirmed decisions rather than recovered. Conditions that must keep a draft — explicit draft-save, interruption, a writer-rejected insert, cleanup failure — are defined in `${SKILL_DIR}/references/error-recovery.md`, and any retained path is named in the terminal report. For later adjustments, recreate only the minimum source draft from confirmed in-memory entries or exact-ID `show`; modifying entries this session did not create is the one case that still uses `append --replace-tail` for the exact current suffix.
55
55
 
56
56
  ## Fresh-Session Task Contract (Hard Rule)
57
57
 
@@ -165,8 +165,8 @@ For any content-generating flow that appends to an existing `.prizmkit/plans/bug
165
165
  2. Inspect those pairs only for material continuation, duplication, conflict, a shared public behavior contract, or an execution prerequisite. Add no historical content by default. Chronology, broad module overlap, shared technology, reusable implementation ideas, or similar wording alone do not establish relevance.
166
166
  3. Incorporate only the minimum exact information whose omission would make scope, behavior, compatibility, acceptance criteria, or dependency ordering incorrect. Reject vague `related to B-123` text and whole-description copying; add an old ID to `dependencies` only when it is a real execution prerequisite.
167
167
  4. Only for an explicitly identified old ID or a validation error, run `python3 ${SKILL_DIR}/scripts/validate-bug-list.py show --input .prizmkit/plans/bug-fix-list.json --id B-NNN`.
168
- 5. For append-only planning, write `.prizmkit/plans/bug-fix-list.draft.json` with exactly one root field, `bugs`, containing non-empty unchanged-schema items. This bounded draft is internal transport/recovery state, not a user approval artifact. Required draft fields are `id`, `title`, `description`, `severity`, `error_source`, `verification_type`, and `acceptance_criteria`; `status` may be omitted and defaults to `pending`; existing optional fields remain allowed. Copy no root metadata or historical bugs.
169
- 6. After consequential decisions and the pre-generation gate pass, immediately run `append`: `python3 ${SKILL_DIR}/scripts/validate-bug-list.py append --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json`. Do not ask for separate user approval merely to promote the draft into the final list. The command validates the base, IDs, dependencies, and complete DAG before atomic replacement. Apply review fixes only to the bounded additions and rerun `append --replace-tail` for the exact current suffix, then follow §Draft Lifecycle before presenting the final written result. `generate` remains the new-list/full-rewrite path.
168
+ 5. For append-only planning, write `.prizmkit/plans/bug-fix-list.draft.json` with exactly one root field, `bugs`, containing non-empty unchanged-schema items. This bounded draft is a private reasoning workspace and the review target, not a user approval artifact or a deliverable. Required draft fields are `id`, `title`, `description`, `severity`, `error_source`, `verification_type`, and `acceptance_criteria`; `status` may be omitted and defaults to `pending`; existing optional fields remain allowed. Copy no root metadata or historical bugs.
169
+ 6. After consequential decisions and the pre-generation gate pass, write the batch to the additions-only draft with the `context` IDs and check merge feasibility without writing: `python3 ${SKILL_DIR}/scripts/validate-bug-list.py append --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json --dry-run`. Do not ask for separate user approval merely to promote the draft into the final list. The dry run applies the same base, exact-ID, dependency, and complete-DAG checks the real insert will, so a `PASS` review is a promise the insert keeps. Run the real `append` once, after §Local Generated-Plan Review Gate returns `PASS`, then follow §Draft Lifecycle. `generate` remains the new-list/full-rewrite path.
170
170
  ## Scenario Routing
171
171
 
172
172
  Classify user intent first:
@@ -333,34 +333,31 @@ For every `NEEDS_FIXES` result, ask only for the consequential missing decision,
333
333
 
334
334
  ### Phase 5: Generate & Validate
335
335
 
336
- 1. **Write draft JSON**: For a new list, write the complete `.prizmkit/plans/bug-fix-list.draft.json` conforming to the final schema. For an existing list, follow §Bounded Existing-List Context and write only the additions-only `bugs` object as internal transport/recovery state.
337
- 2. **Generate or append immediately and validate** — once required semantic gates pass, invoke the matching writer without a second draft-approval pause:
338
- - New list or explicit full-list rewrite:
339
- ```bash
340
- python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
341
- ```
336
+ 1. **Write draft JSON**: For a new list, write the complete `.prizmkit/plans/bug-fix-list.draft.json` conforming to the final schema. For an existing list, follow §Bounded Existing-List Context and write only the additions-only `bugs` object. The draft is the review target, so nothing is written to the final list yet.
337
+ 2. **Check merge feasibility without writing** — once required semantic gates pass, run the matching check without a second draft-approval pause:
338
+ - New list or explicit full-list rewrite: the draft is complete and nothing exists to overwrite, so its post-review `generate` is the validator.
342
339
  - Ordinary existing-list append:
343
340
  ```bash
344
- python3 ${SKILL_DIR}/scripts/validate-bug-list.py append --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
341
+ python3 ${SKILL_DIR}/scripts/validate-bug-list.py append --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json --dry-run
345
342
  ```
346
- `generate` fills root defaults for a complete draft. `append` preserves root metadata and historical bugs, defaults missing new statuses, and writes only after the merged full list validates.
343
+ The dry run applies the same base, exact-ID, dependency, and complete-DAG checks the real insert will, including `append`'s preservation of root metadata and historical bugs.
347
344
  3. **If validation fails**: Fix the draft and retry (max 3 attempts). If the script is unavailable, use the checklist in `${SKILL_DIR}/references/schema-validation.md`.
348
- 4. **Run the mandatory Local Generated-Plan Review Gate** (see §Local Generated-Plan Review Gate below): load `${SKILL_DIR}/references/generated-plan-review.md` and review only newly added/changed bug entries after validation passes and before success output.
349
- 5. **Complete cleanup and output**: After local review returns `PASS` and final validation passes, follow §Draft Lifecycle, then report the file path, summary, local review, validation, cleanup result, and next steps.
345
+ 4. **Run the mandatory Local Generated-Plan Review Gate** (see §Local Generated-Plan Review Gate below): load `${SKILL_DIR}/references/generated-plan-review.md` and review only the draft batch before the insert.
346
+ 5. **Insert once and output**: After local review returns `PASS`, run a single `append`/`generate`, confirm its `appended_ids`, follow §Draft Lifecycle, then report the file path, summary, local review, inserted IDs, validation, cleanup result, and next steps.
350
347
 
351
- **Gate → CP-BP-5**: `bug-fix-list.json` passes validation script with zero errors.
348
+ **Gate → CP-BP-5**: The draft batch validates and its merge dry run returns zero errors; the final list is still untouched.
352
349
 
353
- **Gate → CP-BP-6**: Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed bug entries, applied accepted fixes through draft/source data, regenerated, revalidated, and completed terminal draft cleanup or reported why recovery state was retained.
350
+ **Gate → CP-BP-6**: Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only the draft batch, applied accepted fixes through the draft, revalidated, returned `PASS`, then ran exactly one insert whose `appended_ids` match the batch and removed the draft.
354
351
 
355
352
  ## Local Generated-Plan Review Gate
356
353
 
357
- Run this gate after `.prizmkit/plans/bug-fix-list.json` passes generation and validation, and before the final handoff. It applies whenever this session added or changed final bug entries. For validate-only, summary-only, or draft-save flows with no final content change, report that the gate is not applicable.
354
+ Run this gate after the batch is written to the draft and passes draft validation, and before anything is written to `.prizmkit/plans/bug-fix-list.json`. The review target is the batch that is about to be inserted, not a file that already contains it. It applies whenever this session produced or changed a batch. For validate-only, summary-only, or draft-save flows with no batch, report that the gate is not applicable.
358
355
 
359
- Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the single source of truth. Review the actual additions-only draft and use bounded `context` plus explicit-ID `show` for new or changed final entries because `.prizmkit` files may be gitignored; do not load unchanged historical entries. Repeat the Headless Context Completeness Gate for every reviewed new or changed bug. Keep the review planning-only, apply accepted findings to the draft/source representation, update ordinary appended entries through `append --replace-tail`, rerun validation, and repeat local review until it returns `PASS`. Complete §Draft Lifecycle cleanup before reporting the final written result.
356
+ Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the single source of truth. Review the draft directly, reading `.prizmkit` artifacts from disk rather than from `git status` or `git diff`, because those files may be gitignored. Use bounded `context` and explicit-ID `show` only for already-committed entries whose contract or dependency semantics a reviewed item relies on; do not load unchanged historical entries. Repeat the Headless Context Completeness Gate for every reviewed new or changed bug. Keep the review planning-only: apply accepted findings to the draft, re-run draft validation and the merge dry run, and repeat local review until it returns `PASS`. Only then insert once and complete §Draft Lifecycle cleanup before reporting the final written result. If the insert is rejected after `PASS`, nothing landed; fix the draft, re-run validation and the dry run, and re-review only the entries you changed.
360
357
 
361
358
  #### Success Output
362
359
 
363
- Report the final path and bug counts, Local Generated-Plan Review verdict and reviewed IDs, accepted fixes, final validation result, draft cleanup result, and `bugfix-pipeline-launcher` handoff.
360
+ Report the final path and bug counts, Local Generated-Plan Review verdict and reviewed batch IDs, accepted fixes, the single insert's `appended_ids` and validation result, draft cleanup result, and `bugfix-pipeline-launcher` handoff.
364
361
 
365
362
  ### Checkpoints (Mandatory Gates)
366
363
 
@@ -372,8 +369,8 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
372
369
  | **CP-BP-2** | Bugs Collected | All bugs extracted and confirmed by user | 2 |
373
370
  | **CP-BP-3** | Priorities Set | Severity/priority assigned, duplicates resolved | 3 |
374
371
  | **CP-BP-4** | Completeness Passed | All bugs pass headless execution readiness check | 4 |
375
- | **CP-BP-5** | File Generated | `bug-fix-list.json` passes validation script | 5 |
376
- | **CP-BP-6** | Local Plan Review Passed | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only newly added/changed bug entries, applied accepted fixes through draft/source data, regenerated, revalidated, and completed terminal draft cleanup or reported why recovery state was retained | 5 |
372
+ | **CP-BP-5** | Draft Batch Ready | Additions-only or complete draft holds the whole batch with `context` IDs; merge dry run clean; final list still untouched | 5 |
373
+ | **CP-BP-6** | Reviewed, Then Inserted Once | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, reviewed only the draft batch, applied accepted fixes through the draft, revalidated, returned `PASS`, then ran exactly one insert whose `appended_ids` match the batch, and removed the draft | 5 |
377
374
 
378
375
  **Resume Detection**: If existing `.prizmkit/plans/bug-fix-list.json` or draft found, read `${SKILL_DIR}/references/error-recovery.md` §Resume Support for checkpoint-based resumption.
379
376
 
@@ -394,10 +391,10 @@ Batch-parse error logs with minimal interaction: parse automatically, resolve co
394
391
  - error_source: populated from log content
395
392
  - verification_type: default to `automated`
396
393
  - acceptance_criteria: auto-generate "Error no longer occurs in [scenario]"
397
- 4. Write `.prizmkit/plans/bug-fix-list.draft.json` as internal transport/recovery state.
394
+ 4. Write `.prizmkit/plans/bug-fix-list.draft.json` as the private review workspace.
398
395
  5. Run the Phase 4 Headless Context Completeness Gate on every parsed bug. Ask targeted clarification for missing expected behavior, selected scope, severity rationale, or verification decisions; update the draft until all entries pass.
399
- 6. Immediately use the Phase 5 writer: `generate` for a new complete list, or the bounded additions-only `append` command when a final list already exists. Do not add another broad approval after the consequential gaps are resolved.
400
- 7. If validation passes, run the mandatory Local Generated-Plan Review Gate, complete §Draft Lifecycle cleanup, and present the final written result. For later adjustments, recreate the minimum source draft from confirmed in-memory entries or exact-ID `show`, then rerun `generate` for a new-list rewrite or `append --replace-tail` for an ordinary append before recommending `bugfix-pipeline-launcher`.
396
+ 6. Check merge feasibility without writing: the complete draft for a new list, or `append --dry-run` when a final list already exists. Do not add another broad approval after the consequential gaps are resolved.
397
+ 7. Run the mandatory Local Generated-Plan Review Gate on the draft; on `PASS`, insert once with the matching Phase 5 writer, complete §Draft Lifecycle cleanup, and present the final written result. For later adjustments, recreate the minimum source draft from confirmed in-memory entries or exact-ID `show`, then rerun `generate` for a new-list rewrite or `append --replace-tail` for an ordinary append before recommending `bugfix-pipeline-launcher`.
401
398
 
402
399
  ## Operation: From Tests
403
400
 
@@ -409,10 +406,10 @@ Batch-parse failed test output:
409
406
  2. Parse each failed test case as a separate bug entry
410
407
  3. Auto-populate `failed_test_path`, `error_message`
411
408
  4. Set verification_type to `automated` (test already exists)
412
- 5. Write `.prizmkit/plans/bug-fix-list.draft.json` as internal transport/recovery state.
409
+ 5. Write `.prizmkit/plans/bug-fix-list.draft.json` as the private review workspace.
413
410
  6. Run the Phase 4 Headless Context Completeness Gate on every parsed failed-test bug; ask only for consequential missing expected behavior or scope, and allow needed edits, merges, or removals until all entries pass.
414
- 7. Immediately use the Phase 5 writer: `generate` for a new complete list, or the bounded additions-only `append` command when a final list already exists. Do not add another broad approval after the consequential gaps are resolved.
415
- 8. If validation passes, run the mandatory Local Generated-Plan Review Gate, complete §Draft Lifecycle cleanup, and present the final written result. For later adjustments, recreate the minimum source draft from confirmed in-memory entries or exact-ID `show`, then rerun `generate` for a new-list rewrite or `append --replace-tail` for an ordinary append before recommending `bugfix-pipeline-launcher`.
411
+ 7. Check merge feasibility without writing: the complete draft for a new list, or `append --dry-run` when a final list already exists. Do not add another broad approval after the consequential gaps are resolved.
412
+ 8. Run the mandatory Local Generated-Plan Review Gate on the draft; on `PASS`, insert once with the matching Phase 5 writer, complete §Draft Lifecycle cleanup, and present the final written result. For later adjustments, recreate the minimum source draft from confirmed in-memory entries or exact-ID `show`, then rerun `generate` for a new-list rewrite or `append --replace-tail` for an ordinary append before recommending `bugfix-pipeline-launcher`.
416
413
 
417
414
  ## Operation: Validate
418
415
 
@@ -462,12 +459,13 @@ Key points:
462
459
 
463
460
  Recommend invoking `bugfix-pipeline-launcher` to configure and launch the pipeline. Do NOT recommend running shell scripts directly — that is the launcher's responsibility.
464
461
 
465
- After `.prizmkit/plans/bug-fix-list.json` is generated, validated, and reviewed, present:
462
+ After `.prizmkit/plans/bug-fix-list.json` is inserted, present:
466
463
  1. Summary of generated bugs (count, severity breakdown)
467
- 2. Local generated-plan review result: verdict, reviewed bug IDs plus reviewed root prose when applicable, accepted fixes (or "none"), and final validation result
468
- 3. Draft cleanup result: `removed`, or retained path and recovery reason
469
- 4. Recommend: "Say 'start fixing' to launch the bugfix pipeline via `bugfix-pipeline-launcher`"
470
- 5. Alternative: fix a single bug interactively via `bug-fix-workflow`
464
+ 2. Local generated-plan review result: verdict, reviewed batch IDs plus reviewed root prose when applicable, and accepted fixes (or "none")
465
+ 3. Insert result: the single writer run and the `appended_ids` it reported
466
+ 4. Draft cleanup result: `removed`, or retained path and recovery reason
467
+ 5. Recommend: "Say 'start fixing' to launch the bugfix pipeline via `bugfix-pipeline-launcher`"
468
+ 6. Alternative: fix a single bug interactively via `bug-fix-workflow`
471
469
 
472
470
  ## Error Handling
473
471