prizmkit 1.1.113 → 1.1.115

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 (91) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/dev-pipeline/.env.example +0 -1
  3. package/bundled/dev-pipeline/README.md +4 -6
  4. package/bundled/dev-pipeline/SCHEMA_ANALYSIS.md +40 -518
  5. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +27 -99
  6. package/bundled/dev-pipeline/prizmkit_runtime/checkpoint_state.py +283 -0
  7. package/bundled/dev-pipeline/prizmkit_runtime/daemon.py +3 -13
  8. package/bundled/dev-pipeline/prizmkit_runtime/heartbeat.py +0 -1
  9. package/bundled/dev-pipeline/prizmkit_runtime/runner_classification.py +25 -31
  10. package/bundled/dev-pipeline/prizmkit_runtime/runner_models.py +0 -8
  11. package/bundled/dev-pipeline/prizmkit_runtime/runner_prompts.py +0 -3
  12. package/bundled/dev-pipeline/prizmkit_runtime/runners.py +13 -7
  13. package/bundled/dev-pipeline/prizmkit_runtime/sessions.py +13 -1
  14. package/bundled/dev-pipeline/scripts/continuation.py +8 -40
  15. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +76 -261
  16. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +16 -35
  17. package/bundled/dev-pipeline/scripts/generate-refactor-prompt.py +15 -34
  18. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +6 -0
  19. package/bundled/dev-pipeline/scripts/init-pipeline.py +6 -0
  20. package/bundled/dev-pipeline/scripts/init-refactor-pipeline.py +6 -0
  21. package/bundled/dev-pipeline/scripts/parse-stream-progress.py +1 -1
  22. package/bundled/dev-pipeline/scripts/prompt_framework.py +114 -63
  23. package/bundled/dev-pipeline/scripts/update-bug-status.py +3 -7
  24. package/bundled/dev-pipeline/scripts/update-checkpoint.py +54 -22
  25. package/bundled/dev-pipeline/scripts/update-feature-status.py +3 -7
  26. package/bundled/dev-pipeline/scripts/update-refactor-status.py +3 -7
  27. package/bundled/dev-pipeline/scripts/utils.py +14 -40
  28. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +1 -1
  29. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +1 -1
  30. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +9 -91
  31. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +9 -66
  32. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +10 -16
  33. package/bundled/dev-pipeline/templates/feature-list-schema.json +32 -17
  34. package/bundled/dev-pipeline/templates/refactor-bootstrap-prompt.md +0 -16
  35. package/bundled/dev-pipeline/templates/refactor-list-schema.json +10 -16
  36. package/bundled/dev-pipeline/templates/sections/bugfix-session-context.md +1 -1
  37. package/bundled/dev-pipeline/templates/sections/context-budget-rules.md +1 -1
  38. package/bundled/dev-pipeline/templates/sections/critical-paths-agent.md +0 -1
  39. package/bundled/dev-pipeline/templates/sections/critical-paths-full.md +0 -1
  40. package/bundled/dev-pipeline/templates/sections/phase-implement-agent.md +1 -1
  41. package/bundled/dev-pipeline/templates/sections/phase-implement-full.md +1 -1
  42. package/bundled/dev-pipeline/templates/sections/refactor-session-context.md +1 -1
  43. package/bundled/dev-pipeline/tests/conftest.py +1 -0
  44. package/bundled/dev-pipeline/tests/test_checkpoint_state.py +164 -0
  45. package/bundled/dev-pipeline/tests/test_generate_bootstrap_prompt.py +48 -76
  46. package/bundled/dev-pipeline/tests/test_generate_bugfix_prompt.py +25 -3
  47. package/bundled/dev-pipeline/tests/test_generate_refactor_prompt.py +25 -5
  48. package/bundled/dev-pipeline/tests/test_python_runner_parity.py +128 -10
  49. package/bundled/dev-pipeline/tests/test_runtime_helper.py +23 -0
  50. package/bundled/dev-pipeline/tests/test_unified_cli.py +40 -9
  51. package/bundled/skills/_metadata.json +1 -1
  52. package/bundled/skills/app-planner/SKILL.md +18 -2
  53. package/bundled/skills/app-planner/references/generated-plan-review.md +67 -0
  54. package/bundled/skills/bug-planner/SKILL.md +24 -28
  55. package/bundled/skills/bug-planner/references/generated-plan-review.md +63 -0
  56. package/bundled/skills/bug-planner/references/verification.md +29 -0
  57. package/bundled/skills/bug-planner/scripts/validate-bug-list.py +8 -0
  58. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +2 -2
  59. package/bundled/skills/bugfix-pipeline-launcher/references/configuration.md +1 -6
  60. package/bundled/skills/feature-pipeline-launcher/SKILL.md +6 -12
  61. package/bundled/skills/feature-pipeline-launcher/references/configuration.md +0 -1
  62. package/bundled/skills/feature-planner/SKILL.md +30 -34
  63. package/bundled/skills/feature-planner/assets/planning-guide.md +2 -2
  64. package/bundled/skills/feature-planner/references/generated-plan-review.md +63 -0
  65. package/bundled/skills/feature-planner/scripts/validate-and-generate.py +8 -11
  66. package/bundled/skills/prizmkit-init/SKILL.md +2 -2
  67. package/bundled/skills/prizmkit-plan/SKILL.md +15 -1
  68. package/bundled/skills/prizmkit-plan/references/review-plan-spec-loop.md +101 -0
  69. package/bundled/skills/prizmkit-prizm-docs/references/op-init.md +1 -1
  70. package/bundled/skills/refactor-pipeline-launcher/SKILL.md +5 -5
  71. package/bundled/skills/refactor-pipeline-launcher/references/configuration.md +2 -7
  72. package/bundled/skills/refactor-planner/SKILL.md +30 -34
  73. package/bundled/skills/refactor-planner/references/fast-path.md +2 -2
  74. package/bundled/skills/refactor-planner/references/generated-plan-review.md +63 -0
  75. package/bundled/skills/refactor-planner/scripts/validate-and-generate-refactor.py +9 -0
  76. package/bundled/team/prizm-dev-team.json +2 -9
  77. package/package.json +1 -1
  78. package/src/clean.js +60 -7
  79. package/src/config.js +61 -20
  80. package/src/gitignore-template.js +6 -3
  81. package/src/manifest.js +6 -2
  82. package/src/platforms.js +14 -0
  83. package/src/scaffold.js +198 -34
  84. package/src/upgrade.js +5 -2
  85. package/bundled/agents/prizm-dev-team-critic.md +0 -179
  86. package/bundled/dev-pipeline/templates/agent-prompts/critic-plan-challenge.md +0 -8
  87. package/bundled/dev-pipeline/templates/sections/bugfix-phase-critic.md +0 -22
  88. package/bundled/dev-pipeline/templates/sections/phase-critic-plan-full.md +0 -61
  89. package/bundled/dev-pipeline/templates/sections/phase-critic-plan.md +0 -38
  90. package/bundled/dev-pipeline/templates/sections/refactor-phase-critic.md +0 -22
  91. package/bundled/skills/bug-planner/references/critic-and-verification.md +0 -44
package/src/scaffold.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  } from './metadata.js';
28
28
  import { generateGitignore } from './gitignore-template.js';
29
29
  import { buildManifest, writeManifest } from './manifest.js';
30
- import { defaultCliForPlatform, expandPlatforms, isKnownPlatform, platformLabel, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
30
+ import { defaultCliForPlatform, expandPlatforms, isKnownPlatform, platformLabel, privateProjectMemoryFile, privateProjectMemoryFiles, projectMemoryFile, resolvePayloadPlatforms } from './platforms.js';
31
31
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
32
32
  import { applyAiCliLaunchToConfig, resolveAiCliLaunchSelection } from './ai-cli-launch.js';
33
33
 
@@ -869,20 +869,175 @@ export async function installPrizmkitScripts(projectRoot, dryRun, runtime = 'pyt
869
869
  const PRIZMKIT_MARKER_START = '<!-- PRIZMKIT:START';
870
870
  const PRIZMKIT_MARKER_END = '<!-- PRIZMKIT:END -->';
871
871
 
872
+ function extendManagedBlockEnd(content, endIdx) {
873
+ if (content.slice(endIdx, endIdx + 2) === '\r\n') return endIdx + 2;
874
+ if (content[endIdx] === '\n' || content[endIdx] === '\r') return endIdx + 1;
875
+ return endIdx;
876
+ }
877
+
878
+ function markerPositions(content, marker) {
879
+ const positions = [];
880
+ let cursor = 0;
881
+ while (cursor < content.length) {
882
+ const idx = content.indexOf(marker, cursor);
883
+ if (idx === -1) break;
884
+ positions.push(idx);
885
+ cursor = idx + marker.length;
886
+ }
887
+ return positions;
888
+ }
889
+
890
+ function positionInBlocks(position, blocks) {
891
+ return blocks.some(block => position >= block.start && position < block.end);
892
+ }
893
+
894
+ export function analyzeManagedProjectMemoryBlocks(content) {
895
+ const blocks = [];
896
+ const warnings = new Set();
897
+ let cursor = 0;
898
+
899
+ while (cursor < content.length) {
900
+ const startIdx = content.indexOf(PRIZMKIT_MARKER_START, cursor);
901
+ if (startIdx === -1) break;
902
+
903
+ const nextStartIdx = content.indexOf(PRIZMKIT_MARKER_START, startIdx + PRIZMKIT_MARKER_START.length);
904
+ const endMarkerIdx = content.indexOf(PRIZMKIT_MARKER_END, startIdx + PRIZMKIT_MARKER_START.length);
905
+
906
+ if (endMarkerIdx === -1) {
907
+ warnings.add('PRIZMKIT:START without PRIZMKIT:END');
908
+ cursor = startIdx + PRIZMKIT_MARKER_START.length;
909
+ continue;
910
+ }
911
+
912
+ if (nextStartIdx !== -1 && nextStartIdx < endMarkerIdx) {
913
+ warnings.add('nested PRIZMKIT:START before PRIZMKIT:END');
914
+ cursor = endMarkerIdx + PRIZMKIT_MARKER_END.length;
915
+ continue;
916
+ }
917
+
918
+ const rawEnd = endMarkerIdx + PRIZMKIT_MARKER_END.length;
919
+ const blockEnd = extendManagedBlockEnd(content, rawEnd);
920
+ blocks.push({
921
+ start: startIdx,
922
+ end: blockEnd,
923
+ text: content.slice(startIdx, blockEnd),
924
+ });
925
+ cursor = blockEnd;
926
+ }
927
+
928
+ for (const endIdx of markerPositions(content, PRIZMKIT_MARKER_END)) {
929
+ if (!positionInBlocks(endIdx, blocks)) {
930
+ warnings.add('PRIZMKIT:END without matching PRIZMKIT:START');
931
+ }
932
+ }
933
+
934
+ return { blocks, warnings: [...warnings] };
935
+ }
936
+
937
+ export function removeManagedProjectMemoryBlocks(content) {
938
+ const analysis = analyzeManagedProjectMemoryBlocks(content);
939
+ if (!analysis.blocks.length) {
940
+ return { content, removedBlocks: [], warnings: analysis.warnings };
941
+ }
942
+
943
+ let cursor = 0;
944
+ let nextContent = '';
945
+ for (const block of analysis.blocks) {
946
+ nextContent += content.slice(cursor, block.start);
947
+ cursor = block.end;
948
+ }
949
+ nextContent += content.slice(cursor);
950
+
951
+ return {
952
+ content: nextContent.replace(/\n{3,}/g, '\n\n'),
953
+ removedBlocks: analysis.blocks.map(block => block.text),
954
+ warnings: analysis.warnings,
955
+ };
956
+ }
957
+
958
+ export function normalizeMainProjectMemoryContent(content, privateFile) {
959
+ const removal = removeManagedProjectMemoryBlocks(content);
960
+ const importPointer = privateFile ? `@./${privateFile}` : null;
961
+ const nextContent = removal.content
962
+ .split(/\r?\n/)
963
+ .filter(line => !importPointer || line.trim() !== importPointer)
964
+ .join('\n')
965
+ .replace(/\n{3,}/g, '\n\n')
966
+ .trimEnd();
967
+
968
+ return {
969
+ content: nextContent,
970
+ removedBlocks: removal.removedBlocks,
971
+ warnings: removal.warnings,
972
+ };
973
+ }
974
+
975
+ function mergeManagedProjectMemoryBlock(existing, templateContent) {
976
+ const analysis = analyzeManagedProjectMemoryBlocks(existing);
977
+
978
+ if (analysis.blocks.length) {
979
+ let cursor = 0;
980
+ let merged = '';
981
+ let inserted = false;
982
+ for (const block of analysis.blocks) {
983
+ merged += existing.slice(cursor, block.start);
984
+ if (!inserted) {
985
+ merged += `${templateContent}\n`;
986
+ inserted = true;
987
+ }
988
+ cursor = block.end;
989
+ }
990
+ merged += existing.slice(cursor);
991
+ logManagedProjectMemoryWarnings('private memory', analysis.warnings);
992
+ return merged.replace(/\n{3,}/g, '\n\n').trimEnd() + '\n';
993
+ }
994
+
995
+ const trimmed = existing.trimEnd();
996
+ if (analysis.warnings.length) {
997
+ logManagedProjectMemoryWarnings('private memory', analysis.warnings);
998
+ if (trimmed.includes(templateContent)) return `${trimmed}\n`;
999
+ }
1000
+ if (!trimmed) return `${templateContent}\n`;
1001
+
1002
+ return `${trimmed}\n\n${templateContent}\n`;
1003
+ }
1004
+
1005
+ function ensureSingleImportPointer(existing, importPointer) {
1006
+ const cleaned = removeManagedProjectMemoryBlocks(existing);
1007
+ const lines = cleaned.content.split(/\r?\n/).filter(line => line.trim() !== importPointer);
1008
+ const base = lines.join('\n').replace(/\n{3,}/g, '\n\n').trimEnd();
1009
+ const content = base ? `${base}\n\n${importPointer}\n` : `${importPointer}\n`;
1010
+ return {
1011
+ content,
1012
+ removedBlocks: cleaned.removedBlocks,
1013
+ warnings: cleaned.warnings,
1014
+ };
1015
+ }
1016
+
1017
+ function logManagedProjectMemoryWarnings(memoryFile, warnings) {
1018
+ for (const warning of warnings) {
1019
+ console.log(chalk.yellow(` ⚠ ${memoryFile}: ${warning}; preserving unmatched marker content`));
1020
+ }
1021
+ }
1022
+
872
1023
  /**
873
- * Merge PrizmKit template content into a project memory file.
874
- * - File missing → create with template content
875
- * - File exists with markers → replace content between markers
876
- * - File exists without markers → append template content
1024
+ * Install PrizmKit framework memory as a private imported file.
1025
+ * - Private file missing → create with managed template content
1026
+ * - Private file exists with markers → replace content between markers
1027
+ * - Private file exists without markers → append managed template content
1028
+ * - Main memory file stays user-owned and contains exactly one import pointer
877
1029
  */
878
1030
  export async function installProjectMemory(platform, projectRoot, dryRun) {
879
1031
  const templatesDir = getTemplatesDir();
880
1032
  const templateName = 'project-memory-template.md';
881
- const targetName = projectMemoryFile(platform);
882
- if (!targetName) return;
883
- const targetPath = path.join(projectRoot, targetName);
1033
+ const mainName = projectMemoryFile(platform);
1034
+ const privateName = privateProjectMemoryFile(platform);
1035
+ if (!mainName || !privateName) return;
1036
+
1037
+ const mainPath = path.join(projectRoot, mainName);
1038
+ const privatePath = path.join(projectRoot, privateName);
1039
+ const importPointer = `@./${privateName}`;
884
1040
 
885
- // Template lives in core/templates/ (bundled as templates/).
886
1041
  const templateCandidates = [
887
1042
  path.join(templatesDir, templateName),
888
1043
  ];
@@ -908,34 +1063,37 @@ Codex discovers repository skills from \`.agents/skills/\`. When a user or promp
908
1063
  }
909
1064
 
910
1065
  if (dryRun) {
911
- console.log(chalk.gray(` [dry-run] ${targetName}`));
1066
+ console.log(chalk.gray(` [dry-run] ${privateName}`));
1067
+ console.log(chalk.gray(` [dry-run] ${mainName} import ${importPointer}`));
912
1068
  return;
913
1069
  }
914
1070
 
915
- if (!await fs.pathExists(targetPath)) {
916
- // File doesn't exist — create with template content
917
- await fs.writeFile(targetPath, templateContent + '\n', 'utf-8');
918
- console.log(chalk.green(` ✓ ${targetName} (created)`));
919
- return;
1071
+ if (!await fs.pathExists(privatePath)) {
1072
+ await fs.writeFile(privatePath, `${templateContent}\n`, 'utf-8');
1073
+ console.log(chalk.green(` ✓ ${privateName} (created PrizmKit section)`));
1074
+ } else {
1075
+ const existingPrivate = await fs.readFile(privatePath, 'utf-8');
1076
+ const mergedPrivate = mergeManagedProjectMemoryBlock(existingPrivate, templateContent);
1077
+ if (mergedPrivate !== existingPrivate) {
1078
+ await fs.writeFile(privatePath, mergedPrivate, 'utf-8');
1079
+ console.log(chalk.green(` ✓ ${privateName} (updated PrizmKit section)`));
1080
+ } else {
1081
+ console.log(chalk.green(` ✓ ${privateName} (up-to-date)`));
1082
+ }
920
1083
  }
921
1084
 
922
- // File exists merge via markers
923
- const existing = await fs.readFile(targetPath, 'utf-8');
924
- const startIdx = existing.indexOf(PRIZMKIT_MARKER_START);
925
- const endIdx = existing.indexOf(PRIZMKIT_MARKER_END);
926
-
927
- if (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {
928
- // Replace content between markers (inclusive)
929
- const before = existing.substring(0, startIdx);
930
- const after = existing.substring(endIdx + PRIZMKIT_MARKER_END.length);
931
- const merged = before + templateContent + after;
932
- await fs.writeFile(targetPath, merged, 'utf-8');
933
- console.log(chalk.green(` ✓ ${targetName} (updated PrizmKit section)`));
1085
+ const existingMain = await fs.pathExists(mainPath)
1086
+ ? await fs.readFile(mainPath, 'utf-8')
1087
+ : '';
1088
+ const mainMerge = ensureSingleImportPointer(existingMain, importPointer);
1089
+ logManagedProjectMemoryWarnings(mainName, mainMerge.warnings);
1090
+ const nextMain = mainMerge.content;
1091
+ if (nextMain !== existingMain) {
1092
+ await fs.writeFile(mainPath, nextMain, 'utf-8');
1093
+ const migrationSuffix = mainMerge.removedBlocks.length ? ' and migrated managed block' : '';
1094
+ console.log(chalk.green(` ✓ ${mainName} (imports ${privateName}${migrationSuffix})`));
934
1095
  } else {
935
- // No markers found — append template content
936
- const separator = existing.endsWith('\n') ? '\n' : '\n\n';
937
- await fs.writeFile(targetPath, existing + separator + templateContent + '\n', 'utf-8');
938
- console.log(chalk.green(` ✓ ${targetName} (appended PrizmKit section)`));
1096
+ console.log(chalk.green(` ✓ ${mainName} (import up-to-date)`));
939
1097
  }
940
1098
  }
941
1099
 
@@ -1166,9 +1324,12 @@ export async function installPipeline(projectRoot, dryRun, options = {}) {
1166
1324
  /**
1167
1325
  * 生成 .gitignore
1168
1326
  */
1169
- export async function installGitignore(projectRoot, options, dryRun) {
1327
+ export async function installGitignore(projectRoot, options = {}, dryRun) {
1170
1328
  const targetPath = path.join(projectRoot, '.gitignore');
1171
- const templateContent = generateGitignore({ pipeline: options.pipeline });
1329
+ const templateContent = generateGitignore({
1330
+ pipeline: options.pipeline,
1331
+ privateMemoryFiles: options.privateMemoryFiles || [],
1332
+ });
1172
1333
 
1173
1334
  if (dryRun) {
1174
1335
  console.log(chalk.gray(` [dry-run] .gitignore`));
@@ -1496,7 +1657,10 @@ export async function scaffold(config) {
1496
1657
 
1497
1658
  // 7. .gitignore
1498
1659
  console.log(chalk.blue(' 项目配置:'));
1499
- await installGitignore(projectRoot, { pipeline }, dryRun);
1660
+ await installGitignore(projectRoot, {
1661
+ pipeline,
1662
+ privateMemoryFiles: privateProjectMemoryFiles(payloadPlatforms),
1663
+ }, dryRun);
1500
1664
 
1501
1665
  // 8. 写入 .prizmkit/config.json(如果指定了 aiCli)
1502
1666
  if (resolvedAiCli) {
package/src/upgrade.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  resolveSkillList,
36
36
  EXTRAS_REGISTRY,
37
37
  } from './scaffold.js';
38
- import { platformLabel, resolvePayloadPlatforms } from './platforms.js';
38
+ import { platformLabel, privateProjectMemoryFiles, resolvePayloadPlatforms } from './platforms.js';
39
39
  import { normalizeRuntime, runtimeLabel } from './runtimes.js';
40
40
 
41
41
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -432,7 +432,10 @@ export async function runUpgrade(directory, options = {}) {
432
432
 
433
433
  // .gitignore
434
434
  console.log(chalk.blue(' Gitignore:'));
435
- await installGitignore(projectRoot, { pipeline }, dryRun);
435
+ await installGitignore(projectRoot, {
436
+ pipeline,
437
+ privateMemoryFiles: privateProjectMemoryFiles(payloadPlatforms),
438
+ }, dryRun);
436
439
 
437
440
  // PrizmKit scripts
438
441
  console.log(chalk.blue(' PrizmKit Scripts:'));
@@ -1,179 +0,0 @@
1
- ---
2
- name: prizm-dev-team-critic
3
- description: Adversarial challenger that questions plan fitness against the project's existing architecture, style, and patterns. Supports parallel 3-critic voting with distinct focus lenses (Architecture, Data/Edge Cases, Security/Performance). Use when performing adversarial plan challenge or implementation challenge.
4
- tools: Read, Glob, Grep, Bash
5
- disallowedTools: Agent, Write, Edit
6
- model: inherit
7
- context_level: minimal
8
- ---
9
-
10
- You are the **Critic Agent**, the adversarial challenger of the PrizmKit-integrated Multi-Agent software development collaboration team.
11
-
12
- ### Core Identity
13
-
14
- You are the team's "devil's advocate" — you challenge decisions, question assumptions, and find hidden risks that others miss. You do NOT verify correctness (that is Reviewer's job). Your unique value is asking: **"Does this BELONG in this project? Is this the RIGHT approach? What are you NOT seeing?"**
15
-
16
- You operate in two modes:
17
- - **Plan Challenge** (Phase 3.5): before implementation, challenge the plan's fitness for the project
18
- - **Implementation Challenge** (Phase 5.5): after review, challenge the implementation for architecture drift and missed edge cases (optional, tier3+)
19
-
20
- ### Project Context
21
-
22
- Before any challenge, you MUST understand the project:
23
- 1. Read `.prizmkit/prizm-docs/root.prizm` — understand architecture, patterns, conventions
24
- 2. Read relevant L1/L2 `.prizmkit/prizm-docs/` files for affected modules — understand RULES, PATTERNS, TRAPS, DECISIONS
25
- 3. Read `context-snapshot.md` if it exists — Section 3 has Prizm Context, Section 4 has File Manifest
26
-
27
- **File Reading Rule**: Read actual project source files to compare against. Your challenges must be grounded in evidence from existing code, not theoretical concerns. If you cannot find evidence in the codebase, downgrade the severity.
28
-
29
- ### Must Do (MUST)
30
-
31
- 1. Read `.prizmkit/prizm-docs/root.prizm` and relevant module docs BEFORE writing any challenge
32
- 2. Read existing source files in affected modules for comparison
33
- 3. Ground every challenge in specific evidence (file paths, code patterns, existing conventions)
34
- 4. Write challenge report with structured findings
35
- 5. Keep the report ≤50 lines — focus on HIGH and CRITICAL only, skip LOW
36
- 6. Clearly state which mode you are operating in (Plan Challenge or Implementation Challenge)
37
-
38
- ### Never Do (NEVER)
39
-
40
- - Do not write implementation code (that is Dev's responsibility)
41
- - Do not verify correctness or test coverage (test coverage is verified by the Orchestrator via prizmkit-test; correctness is the Reviewer's responsibility)
42
- - **Do not execute any git operations** (git commit / git add / git reset / git push are all prohibited)
43
- - Do not modify source files — write only challenge reports
44
- - Do not raise theoretical concerns without evidence from the codebase
45
-
46
- ### Behavioral Rules
47
-
48
- ```
49
- CRIT-01: Always read .prizmkit/prizm-docs/ and existing source before challenging
50
- CRIT-02: Every challenge must reference a specific file path or code pattern as evidence
51
- CRIT-03: Maximum 10 challenges per report (focus on highest impact)
52
- CRIT-04: Severity levels: CRITICAL (architecture mismatch), HIGH (style/robustness gap), MEDIUM (minor inconsistency)
53
- CRIT-05: If no significant challenges found, write "No significant challenges — plan fits the project well" and exit
54
- CRIT-06: Read comparable existing code in the same module for style baseline before flagging style issues
55
- CRIT-07: When challenging a decision, always suggest a concrete alternative
56
- CRIT-08: Do not use the timeout command (incompatible with macOS). Run commands directly without a timeout prefix
57
- CRIT-09: In voting mode, write to your assigned report file — do NOT read other critics' reports
58
- ```
59
-
60
- ---
61
-
62
- ## Mode 1: Plan Challenge
63
-
64
- **Precondition**: Orchestrator has completed plan.md (with Tasks section). Phase 3 Analyze has passed (CP-2).
65
-
66
- **Goal**: Challenge whether the plan fits the project — not whether the plan is internally consistent.
67
-
68
- ### Challenge Dimensions
69
-
70
- | Dimension | What to Challenge | Evidence Source |
71
- |-----------|------------------|----------------|
72
- | **Architecture Fit** | Does the plan's approach match the project's existing architectural patterns? Would it feel foreign to someone familiar with the codebase? | `.prizmkit/prizm-docs/` PATTERNS, existing module structure |
73
- | **Integration Planning** | Do proposed interfaces match existing conventions? Are naming patterns consistent with existing code? | Existing source files in the same module/layer |
74
- | **Alternative Approaches** | Given the project's tech stack and existing patterns, is there a more natural approach that leverages what's already built? | `.prizmkit/prizm-docs/` KEY_FILES, existing utilities/helpers |
75
- | **Coupling Risk** | Does the task breakdown hide cross-module dependencies? Will changes bleed into areas the plan doesn't mention? | `.prizmkit/prizm-docs/` DEPENDENCIES, import graphs |
76
-
77
- ### Workflow
78
-
79
- 1. Read `context-snapshot.md` — understand the feature and file manifest
80
- 2. Read `.prizmkit/prizm-docs/root.prizm` and affected L1/L2 docs
81
- 3. Read existing source files in modules the plan touches
82
- 4. For each dimension, compare plan decisions against evidence from existing code
83
- 5. Write challenge report
84
-
85
- ---
86
-
87
- ## Mode 2: Implementation Challenge
88
-
89
- **Precondition**: Dev has completed implementation, Reviewer has completed code review (CP-3). Optional, tier3+ only.
90
-
91
- **Goal**: Challenge whether the implementation drifted from the plan, introduced architectural regressions, or missed edge cases the plan didn't anticipate.
92
-
93
- ### Challenge Dimensions
94
-
95
- | Dimension | What to Challenge | Evidence Source |
96
- |-----------|------------------|----------------|
97
- | **Architecture Drift** | Did the implementation deviate from plan.md's architecture? Are new patterns introduced that don't match existing conventions? | plan.md vs git diff, existing source |
98
- | **Edge Case Coverage** | What edge cases did the plan not anticipate that the implementation now needs to handle? | Acceptance criteria, existing TRAPS in `.prizmkit/prizm-docs/` |
99
- | **Security Surface** | Did the implementation introduce new attack surface not covered in the plan? | New endpoints, new user inputs, new data flows |
100
- | **Performance Impact** | Did the implementation introduce unnecessary complexity or performance bottlenecks? | New loops, queries, allocations in changed files |
101
-
102
- ### Workflow
103
-
104
- 1. Read `context-snapshot.md` — especially `## Implementation Log` and `## Review Notes`
105
- 2. Read `review-report.md` — understand what Reviewer already found
106
- 3. **Review the implementation diff provided by the Orchestrator in your task assignment.** The Orchestrator runs `git diff HEAD` and provides the relevant diff context in the spawn prompt — you do NOT run git commands yourself.
107
- 4. For each dimension, challenge the implementation against the plan and existing code
108
- 5. Write `challenge-report-impl.md`
109
-
110
- ---
111
-
112
- ## Output Format
113
-
114
- Write challenge report (in Plan mode) or `challenge-report-impl.md` (in Implementation mode):
115
-
116
- ```markdown
117
- ## Challenge Report — [Plan Challenge|Implementation Challenge]
118
- Feature: <FEATURE_ID> — <FEATURE_TITLE>
119
- Mode: <mode>
120
- Challenges Found: N (X critical, Y high, Z medium)
121
-
122
- ### CHALLENGE-1: [CRITICAL] Title
123
- - **Observation**: What was found (with file:line or pattern reference)
124
- - **Risk**: What could go wrong if this is not addressed
125
- - **Suggestion**: Concrete alternative or fix approach
126
-
127
- ### CHALLENGE-2: [HIGH] Title
128
- - **Observation**: ...
129
- - **Risk**: ...
130
- - **Suggestion**: ...
131
-
132
- ### Summary
133
- [1-2 sentence overall assessment]
134
- ```
135
-
136
- **Severity Criteria**:
137
- - **CRITICAL**: Architecture mismatch — the approach conflicts with established project patterns and would require significant rework later
138
- - **HIGH**: Style/robustness gap — the code works but doesn't fit the project's conventions or misses important edge cases
139
- - **MEDIUM**: Minor inconsistency — small deviations that could be improved but aren't urgent
140
-
141
- ---
142
-
143
- ## Voting Protocol (3-Critic Parallel Mode)
144
-
145
- When spawned as one of 3 parallel critics (Critic-A, Critic-B, Critic-C):
146
-
147
- 1. Each critic is assigned a **focus lens**:
148
- - **Critic-A**: Architecture & Scalability — architectural pattern fit, scalability implications, over-engineering risks, component boundary design
149
- - **Critic-B**: Data Model & Edge Cases — data model design fit, entity relationships, edge cases in business logic, missing boundary conditions
150
- - **Critic-C**: Security & Performance — security attack surface, authentication/authorization gaps, performance bottlenecks, resource leaks
151
-
152
- 2. **All 3 critics run in PARALLEL** — don't wait for each other. Write to your assigned file.
153
-
154
- 3. **In Plan Challenge mode**: write to `challenge-report-A.md`, `challenge-report-B.md`, or `challenge-report-C.md`
155
- **In Implementation Challenge mode**: write to `challenge-report-impl-A.md`, `challenge-report-impl-B.md`, or `challenge-report-impl-C.md`
156
- **Note for Implementation Challenge**: The Orchestrator should consider passing the diff context in the spawn prompt (Critics do NOT run git commands) and may override `context_level` to `full` if the feature scope is large.
157
-
158
- 4. Do NOT read other critics' reports — independence is the point
159
-
160
- 5. The Orchestrator will read all 3 reports and apply consensus rules:
161
- - Challenge raised by **2/3 or more** critics → **must respond** (fix or justify)
162
- - Challenge raised by **1/3 only** → **logged but not blocking**
163
-
164
- ---
165
-
166
- ## Exception Handling
167
-
168
- | Scenario | Strategy |
169
- |----------|----------|
170
- | No `.prizmkit/prizm-docs/` exists (new project) | Skip architecture comparison, focus on internal consistency and robustness only |
171
- | Module has no existing code to compare | Note in report: "No baseline for style comparison — challenges are based on general best practices" |
172
- | All challenges are MEDIUM or lower | Write report with "No significant challenges" summary. Do NOT inflate severity |
173
- | Cannot determine project conventions | Downgrade all style challenges to MEDIUM. Note the limitation in the report |
174
-
175
- ### Communication Rules
176
-
177
- Critic does not communicate directly with Dev or Reviewer. All findings go to the Orchestrator via the challenge-report file.
178
- - Send COMPLETION_SIGNAL (with challenge count summary) to indicate completion
179
- - Receive TASK_ASSIGNMENT to get assigned work
@@ -1,8 +0,0 @@
1
- "Read {{CRITIC_SUBAGENT_PATH}}. For feature {{FEATURE_ID}} (slug: {{FEATURE_SLUG}}):
2
- **MODE: Plan Challenge**
3
- 1. Read `.prizmkit/specs/{{FEATURE_SLUG}}/context-snapshot.md` FIRST — Section 3 has project context, Section 4 has file manifest.
4
- 2. Use context-snapshot.md as the shared source of truth. Do not create or enter AI tool-created `.claude/worktrees/...` subagent worktrees; use default/no worktree isolation and do not request worktree isolation.
5
- 3. PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...` are a separate runner feature controlled by `USE_WORKTREE`; do not confuse them with AI tool-created `.claude/worktrees/...`.
6
- 4. Read additional `.prizmkit/prizm-docs/` or source excerpts only when needed to verify a specific challenge.
7
- 5. Challenge plan.md against the project's existing architecture, patterns, and style.
8
- Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report.md` with findings (or 'No significant challenges')."
@@ -1,22 +0,0 @@
1
- ### Plan Challenge — Critic Agent
2
-
3
- **Guard**: Verify critic agent file exists before spawning:
4
-
5
- ```bash
6
- {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
7
- ```
8
-
9
- If `CRITIC:MISSING`, mark `critic-plan-review` as `skipped` and continue.
10
-
11
- **Focus**: Challenge the bug diagnosis and fix plan before implementation:
12
- - Is the root cause actually supported by the evidence?
13
- - Does the reproduction test prove the bug before the fix?
14
- - Is the fix minimal, or does it mask the symptom?
15
- - Are adjacent regressions likely?
16
- - Does manual/hybrid verification policy match `{{VERIFICATION_TYPE}}`?
17
-
18
- Spawn `prizm-dev-team-critic` with default/no worktree isolation. Do not request AI tool-created worktree isolation.
19
-
20
- The Critic writes `.prizmkit/bugfix/{{BUG_ID}}/challenge-report.md`. Resolve CRITICAL/HIGH findings before implementation, or document why the plan stands.
21
-
22
- **Checkpoint update**: Set step `critic-plan-review` to `completed` after challenges are resolved, or `skipped` when critic is unavailable.
@@ -1,61 +0,0 @@
1
- ### Plan Challenge — Critic Agent(s)
2
-
3
- **Guard**: Verify critic agent file exists before spawning:
4
- ```bash
5
- {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
6
- ```
7
- If CRITIC:MISSING — skip this phase entirely and proceed. Log: "Critic agent not installed — skipping Plan Challenge."
8
-
9
- **Choose ONE path based on `{{CRITIC_COUNT}}`:**
10
-
11
- **Agent spawn failure policy**:
12
- - If spawning Critic fails with team/config/lock errors, retry at most once.
13
- - If the second attempt fails, do not keep spawning variants. Either create the required team once (when team tooling is available) or perform the plan challenge inline and write the required challenge report yourself.
14
- - Record the fallback in the report; do not burn multiple minutes on repeated identical spawn failures.
15
-
16
- **No silent report polling**:
17
- - Do NOT run a long no-output loop waiting for `challenge-report*.md`.
18
- - If you need to wait for a report file, use a short bounded check (≤120s) that prints elapsed time and reports present on every iteration.
19
- - If reports are still missing after the bounded check, request one status update; if still missing, perform the missing challenge lens inline and continue.
20
-
21
- **If {{CRITIC_COUNT}} = 1 → Single Critic** (skip to CP-2.5 after this):
22
-
23
- **Spawn Agent**:
24
- | Parameter | Value |
25
- |-----------|-------|
26
- | subagent_type | prizm-dev-team-critic |
27
- | mode | plan |
28
- | run_in_background | false |
29
- | isolation | default/no worktree; do not request worktree isolation |
30
-
31
- No-worktree boundary: this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. It does not disable PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...`, which are controlled separately by `USE_WORKTREE`.
32
-
33
- **Prompt**:
34
- > {{AGENT_PROMPT_CRITIC_PLAN_CHALLENGE}}
35
-
36
- **If {{CRITIC_COUNT}} = 3 → Multi-Critic Voting** (skip Single Critic above):
37
-
38
- Spawn 3 Critic agents in PARALLEL (issue all 3 Agent tool calls in the SAME message turn). Do NOT wait for one before spawning the next. Each with mode="plan", run_in_background=false, and default/no worktree isolation; do not request worktree isolation.
39
-
40
- No-worktree boundary: default/no worktree isolation prevents AI tool-created `.claude/worktrees/...` subagent worktrees. It does not disable PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...`, which are controlled separately by `USE_WORKTREE`.
41
-
42
- Critic-A prompt (append to base prompt above):
43
- > "**Focus Lens: Architecture & Scalability.** Prioritize: architectural pattern fit, scalability implications, over-engineering risks, component boundary design.
44
- > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-A.md`."
45
-
46
- Critic-B prompt (append to base prompt above):
47
- > "**Focus Lens: Data Model & Edge Cases.** Prioritize: data model design fit, entity relationships, edge cases in business logic, missing boundary conditions.
48
- > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-B.md`."
49
-
50
- Critic-C prompt (append to base prompt above):
51
- > "**Focus Lens: Security & Performance.** Prioritize: security attack surface, authentication/authorization gaps, performance bottlenecks, resource leaks.
52
- > Write `.prizmkit/specs/{{FEATURE_SLUG}}/challenge-report-C.md`."
53
-
54
- After all critics return, read all 3 reports:
55
- - Challenge raised by **2/3 or more** critics → **must respond** (adjust plan or justify why not)
56
- - Challenge raised by **1/3 only** → logged in context-snapshot but not blocking
57
- - Max 1 plan revision round.
58
-
59
- **CP-2.5**: Plan challenges reviewed and resolved.
60
-
61
-
@@ -1,38 +0,0 @@
1
- ### Plan Challenge — Critic Agent
2
-
3
- **Guard**: Verify critic agent file exists before spawning:
4
- ```bash
5
- {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
6
- ```
7
- If CRITIC:MISSING — skip this phase entirely and proceed. Log: "Critic agent not installed — skipping Plan Challenge."
8
-
9
- **Spawn Agent**:
10
- | Parameter | Value |
11
- |-----------|-------|
12
- | subagent_type | prizm-dev-team-critic |
13
- | mode | plan |
14
- | run_in_background | false |
15
- | isolation | default/no worktree; do not request worktree isolation |
16
-
17
- No-worktree boundary: this prevents AI tool-created `.claude/worktrees/...` subagent worktrees. It does not disable PrizmKit pipeline-managed linked git worktrees under `.prizmkit/state/worktrees/...`, which are controlled separately by `USE_WORKTREE`.
18
-
19
- **Prompt**:
20
- > {{AGENT_PROMPT_CRITIC_PLAN_CHALLENGE}}
21
-
22
- **Agent spawn failure policy**:
23
- - If spawning Critic fails with team/config/lock errors, retry at most once.
24
- - If the second attempt fails, do not keep spawning variants. Either create the required team once (when team tooling is available) or perform the plan challenge inline and write `challenge-report.md` yourself.
25
- - Record the fallback in the report; do not burn multiple minutes on repeated identical spawn failures.
26
-
27
- **No silent report polling**:
28
- - Do NOT run a long no-output loop waiting for `challenge-report.md`.
29
- - If you need to wait for the report file, use a short bounded check (≤120s) that prints elapsed time and whether the report exists on every iteration.
30
- - If the report is still missing after the bounded check, request one status update; if still missing, perform the challenge inline and continue.
31
-
32
- Wait for Critic to return.
33
- - Read challenge-report.md. For items marked CRITICAL/HIGH: decide whether to adjust plan.md or document why the plan stands.
34
- - Max 1 plan revision round.
35
-
36
- **CP-2.5**: Plan challenges reviewed and resolved.
37
-
38
-
@@ -1,22 +0,0 @@
1
- ### Plan Challenge — Critic Agent
2
-
3
- **Guard**: Verify critic agent file exists before spawning:
4
-
5
- ```bash
6
- {{RUNTIME_HELPER_CMD}} artifact exists {{CRITIC_SUBAGENT_PATH}} --exists-marker CRITIC:READY --missing-marker CRITIC:MISSING
7
- ```
8
-
9
- If `CRITIC:MISSING`, mark `critic-plan-review` as `skipped` and continue.
10
-
11
- **Focus**: Challenge behavior preservation and plan safety before implementation:
12
- - Is observable behavior clearly defined and protected?
13
- - Do existing/new tests cover the behavior affected by this refactor?
14
- - Is the plan too broad for the stated scope?
15
- - Are file moves/renames safe for imports, public APIs, and integrations?
16
- - Is rollback realistic?
17
-
18
- Spawn `prizm-dev-team-critic` with default/no worktree isolation. Do not request AI tool-created worktree isolation.
19
-
20
- The Critic writes `.prizmkit/refactor/{{REFACTOR_ID}}/challenge-report.md`. Resolve CRITICAL/HIGH findings before implementation, or document why the plan stands.
21
-
22
- **Checkpoint update**: Set step `critic-plan-review` to `completed` after challenges are resolved, or `skipped` when critic is unavailable.