amsd-pipeline-shared 0.5.11 → 0.5.13

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 (135) hide show
  1. package/README.md +13 -0
  2. package/docs/gateway-baseline-2.0.80.md5 +130 -0
  3. package/docs/gateway-files.txt +131 -0
  4. package/orchestrations/prompts/templates/ac-classification.json +32 -0
  5. package/orchestrations/prompts/templates/ac-elaboration.json +22 -0
  6. package/orchestrations/prompts/templates/ac-gate-codeline-assignment.json +27 -0
  7. package/orchestrations/prompts/templates/agent-name-refusal.json +15 -0
  8. package/orchestrations/prompts/templates/agent-plan-mode.json +22 -0
  9. package/orchestrations/prompts/templates/agent-proposal.json +40 -0
  10. package/orchestrations/prompts/templates/agent-retry-prefix.json +47 -0
  11. package/orchestrations/prompts/templates/assign-agent-roles.json +22 -0
  12. package/orchestrations/prompts/templates/bug-fix-story.json +33 -0
  13. package/orchestrations/prompts/templates/change-reviewer.json +30 -0
  14. package/orchestrations/prompts/templates/code-graph-detective.json +41 -0
  15. package/orchestrations/prompts/templates/codeline-bridge.json +20 -0
  16. package/orchestrations/prompts/templates/content-retry-correction.json +28 -0
  17. package/orchestrations/prompts/templates/coordinator-amendment.json +37 -0
  18. package/orchestrations/prompts/templates/corrective-note.json +24 -0
  19. package/orchestrations/prompts/templates/cpa-inference.json +29 -0
  20. package/orchestrations/prompts/templates/cpa-system.json +20 -0
  21. package/orchestrations/prompts/templates/declared-packages.json +14 -0
  22. package/orchestrations/prompts/templates/detective-extract.json +16 -0
  23. package/orchestrations/prompts/templates/detective-overall-plan-given.json +19 -0
  24. package/orchestrations/prompts/templates/detective-overall-plan.json +26 -0
  25. package/orchestrations/prompts/templates/detective-prescription.json +22 -0
  26. package/orchestrations/prompts/templates/detective-retry-note.json +20 -0
  27. package/orchestrations/prompts/templates/detective-shared-package.json +28 -0
  28. package/orchestrations/prompts/templates/discovery-vocabulary.json +23 -0
  29. package/orchestrations/prompts/templates/e2e-route-check.json +22 -0
  30. package/orchestrations/prompts/templates/estate-survey.json +32 -0
  31. package/orchestrations/prompts/templates/estimation-assessment.json +26 -0
  32. package/orchestrations/prompts/templates/fix-plan-shared.json +19 -0
  33. package/orchestrations/prompts/templates/guard-vocabulary-codegraph.json +25 -0
  34. package/orchestrations/prompts/templates/guard-vocabulary-documentation.json +21 -0
  35. package/orchestrations/prompts/templates/guard-vocabulary.json +34 -0
  36. package/orchestrations/prompts/templates/hybrid-prephase-coordinator.json +16 -0
  37. package/orchestrations/prompts/templates/inference-ladder-coordinator.json +27 -0
  38. package/orchestrations/prompts/templates/kb-enforcement-synthesis.json +28 -0
  39. package/orchestrations/prompts/templates/lint-ac-remediator.json +20 -0
  40. package/orchestrations/prompts/templates/lint-fixer.json +19 -0
  41. package/orchestrations/prompts/templates/manifest-analysis.json +13 -0
  42. package/orchestrations/prompts/templates/mint-existing-roster.json +25 -0
  43. package/orchestrations/prompts/templates/new-dependency-directive.json +28 -0
  44. package/orchestrations/prompts/templates/new-dependency-lockfile-note.json +20 -0
  45. package/orchestrations/prompts/templates/phase-assessment-header.json +19 -0
  46. package/orchestrations/prompts/templates/pipeline-tools-command.json +13 -0
  47. package/orchestrations/prompts/templates/pipeline-tools-hosted.json +12 -0
  48. package/orchestrations/prompts/templates/plan-corrective.json +21 -0
  49. package/orchestrations/prompts/templates/plan-producer.json +24 -0
  50. package/orchestrations/prompts/templates/plan-reviewer.json +20 -0
  51. package/orchestrations/prompts/templates/prd-change-reviewer-mode-rules.json +28 -0
  52. package/orchestrations/prompts/templates/prd-change-reviewer-spec.json +33 -0
  53. package/orchestrations/prompts/templates/prd-change-reviewer.json +27 -0
  54. package/orchestrations/prompts/templates/prd-change-summarizer-text.json +19 -0
  55. package/orchestrations/prompts/templates/prd-change-summarizer-tool.json +21 -0
  56. package/orchestrations/prompts/templates/prd-configuration-block.json +24 -0
  57. package/orchestrations/prompts/templates/prd-generation.json +16 -0
  58. package/orchestrations/prompts/templates/prd-model-coordinator.json +24 -0
  59. package/orchestrations/prompts/templates/previous-refusal.json +15 -0
  60. package/orchestrations/prompts/templates/profile-augmentor.json +24 -0
  61. package/orchestrations/prompts/templates/project-prompt-generation.json +54 -0
  62. package/orchestrations/prompts/templates/project-roster-review.json +11 -0
  63. package/orchestrations/prompts/templates/prompt-claim-adjudication.json +21 -0
  64. package/orchestrations/prompts/templates/prompt-review.json +48 -0
  65. package/orchestrations/prompts/templates/qa-brownfield-scope.json +36 -0
  66. package/orchestrations/prompts/templates/qa-evidence-labels.json +28 -0
  67. package/orchestrations/prompts/templates/qa-fuzz-weaver.json +35 -0
  68. package/orchestrations/prompts/templates/qa-mutant-hunter.json +28 -0
  69. package/orchestrations/prompts/templates/qa-oracle-evidence.json +35 -0
  70. package/orchestrations/prompts/templates/qa-perf-sentinel.json +30 -0
  71. package/orchestrations/prompts/templates/qa-review-ranger.json +28 -0
  72. package/orchestrations/prompts/templates/qa-sast-sentinel.json +35 -0
  73. package/orchestrations/prompts/templates/qa-spec-validator.json +30 -0
  74. package/orchestrations/prompts/templates/release-line-port.json +22 -0
  75. package/orchestrations/prompts/templates/repro-feedback.json +31 -0
  76. package/orchestrations/prompts/templates/repro-role.json +32 -0
  77. package/orchestrations/prompts/templates/repro-test-writer.json +55 -0
  78. package/orchestrations/prompts/templates/retry-extension-coordinator.json +22 -0
  79. package/orchestrations/prompts/templates/review-ac-remediator.json +24 -0
  80. package/orchestrations/prompts/templates/review-finding-routing.json +17 -0
  81. package/orchestrations/prompts/templates/review-scope-block.json +18 -0
  82. package/orchestrations/prompts/templates/roster-review.json +46 -0
  83. package/orchestrations/prompts/templates/roster-specialisation-one.json +14 -0
  84. package/orchestrations/prompts/templates/roster-specialisation-plan.json +12 -0
  85. package/orchestrations/prompts/templates/roster-specialisation.json +24 -0
  86. package/orchestrations/prompts/templates/roster-tool-grant.json +20 -0
  87. package/orchestrations/prompts/templates/runtime-boundary-review.json +30 -0
  88. package/orchestrations/prompts/templates/shared-file-ownership.json +24 -0
  89. package/orchestrations/prompts/templates/skill-assessment-postphase.json +22 -0
  90. package/orchestrations/prompts/templates/skill-assessment-prephase.json +35 -0
  91. package/orchestrations/prompts/templates/skills-coordinator.json +19 -0
  92. package/orchestrations/prompts/templates/spec-agent-openspec.brownfield.json +67 -0
  93. package/orchestrations/prompts/templates/spec-agent-openspec.json +63 -0
  94. package/orchestrations/prompts/templates/spec-agent-speckit-refine.json +30 -0
  95. package/orchestrations/prompts/templates/spec-agent-speckit.json +28 -0
  96. package/orchestrations/prompts/templates/spec-authoring-rules.json +25 -0
  97. package/orchestrations/prompts/templates/spec-brownfield-mode.json +33 -0
  98. package/orchestrations/prompts/templates/spec-context-fragments.json +39 -0
  99. package/orchestrations/prompts/templates/spec-coordinator-review.json +29 -0
  100. package/orchestrations/prompts/templates/spec-coordinator.json +26 -0
  101. package/orchestrations/prompts/templates/spec-model-review.json +23 -0
  102. package/orchestrations/prompts/templates/spec-review-criteria.json +23 -0
  103. package/orchestrations/prompts/templates/spec-shared-consumer.json +20 -0
  104. package/orchestrations/prompts/templates/spec-story-block.json +42 -0
  105. package/orchestrations/prompts/templates/speckit-split-rules.json +20 -0
  106. package/orchestrations/prompts/templates/squad-coder.json +19 -0
  107. package/orchestrations/prompts/templates/squad-leader.json +19 -0
  108. package/orchestrations/prompts/templates/squad-security-auditor.json +19 -0
  109. package/orchestrations/prompts/templates/squad-tester.json +19 -0
  110. package/orchestrations/prompts/templates/story-ac-remediator.json +29 -0
  111. package/orchestrations/prompts/templates/story-diff-not-inlined.json +16 -0
  112. package/orchestrations/prompts/templates/story-file-generation.json +28 -0
  113. package/orchestrations/prompts/templates/story-implementation.json +25 -0
  114. package/orchestrations/prompts/templates/story-kind-hint-defect.json +18 -0
  115. package/orchestrations/prompts/templates/story-kind-hint-other.json +20 -0
  116. package/orchestrations/prompts/templates/story-plan-agent.json +31 -0
  117. package/orchestrations/prompts/templates/story-writer-main.json +96 -0
  118. package/orchestrations/prompts/templates/story-writer.json +28 -0
  119. package/orchestrations/prompts/templates/survey-review.json +38 -0
  120. package/orchestrations/prompts/templates/tc-writer.json +36 -0
  121. package/orchestrations/prompts/templates/test-gate-finding.json +27 -0
  122. package/orchestrations/prompts/templates/test-ownership.json +38 -0
  123. package/orchestrations/prompts/templates/tools-coordinator.json +18 -0
  124. package/orchestrations/prompts/templates/topology-router.json +30 -0
  125. package/orchestrations/prompts/templates/update-invalidated-tests.json +33 -0
  126. package/orchestrations/prompts/templates/vc-coverage.json +20 -0
  127. package/orchestrations/prompts/templates/vc-regenerate.json +33 -0
  128. package/orchestrations/prompts/templates/vc-review.json +27 -0
  129. package/orchestrations/prompts/templates/worktree-autocommit-message.json +27 -0
  130. package/orchestrations/prompts/templates/writer-codegraph-block.json +25 -0
  131. package/orchestrations/prompts/templates/writer-plan-section.json +28 -0
  132. package/orchestrations/prompts/templates/writer-string-invariants.json +17 -0
  133. package/orchestrations/scripts/lib/project-prompt-contract.js +414 -0
  134. package/orchestrations/scripts/refresh-project-prompts.js +96 -0
  135. package/package.json +1 -1
@@ -0,0 +1,28 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of claude.sh on 2026-08-16.",
4
+ "",
5
+ "The prompt that asks a writer to generate one file for a story.",
6
+ "",
7
+ "The technical-notes section was rendered by a shell function inside the prompt, so what the writer was shown about the files it must touch came from a command substitution rather than from the prompt. The caller renders it and passes it."
8
+ ],
9
+ "description": "Asks a writer to generate one file for a story.",
10
+ "seams": [
11
+ "story-writer"
12
+ ],
13
+ "id": "story-file-generation",
14
+ "version": 1,
15
+ "body": "Generate file for story __STORY_ID__: __TITLE__\n\n## Story Description\n__DESCRIPTION__\n\n## Acceptance Criteria\n- __ACCEPTANCE_CRITERIA__\n\n## Technical Notes\n__TECHNICAL_NOTES__\n\n## Files to Create\n__FILES__\n\n## Dependencies (already implemented — do NOT read them)\n__DEPENDENCIES__\n\n## GENERATOR CONTRACT — READ THIS FIRST\nYou are a FILE GENERATOR. Your ONLY job is to write the file listed under \"Files to Create\".\n\n**MANDATORY FIRST ACTION: Call WriteFile immediately. Do NOT call any other tool first.**\n\nRules:\n1. Your FIRST tool call MUST be WriteFile to the target path above.\n2. Do NOT call ReadFile, ListFiles, Bash, Search, or any other tool before WriteFile.\n3. Write the COMPLETE file content in a single WriteFile call.\n4. After WriteFile succeeds, you are done. No verification reads, no follow-up patches.\n5. All information you need is in this prompt. The spec is authoritative — do NOT read existing files for context.\n\nGeneration approach: read every acceptance criterion once, hold them all in mind, then write a file that satisfies all of them in one shot.",
16
+ "placeholders": [
17
+ "__TECHNICAL_NOTES__",
18
+ "__DEPENDENCIES__",
19
+ "__ACCEPTANCE_CRITERIA__",
20
+ "__DESCRIPTION__",
21
+ "__STORY_ID__",
22
+ "__TITLE__",
23
+ "__FILES__"
24
+ ],
25
+ "mayBeEmpty": [
26
+ "__ACCEPTANCE_CRITERIA__"
27
+ ]
28
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of codemie-claude.sh on 2026-08-16.",
4
+ "",
5
+ "The CodeMie provider path's implementation prompt. It is the counterpart of the writer prompt claude.sh builds, and it had its own separate copy.",
6
+ "",
7
+ "The technical-notes section was rendered by a jq pipeline inside the prompt -- the claude.sh copy uses a shell function for the same section, which is the drift two copies of one prompt accumulate. The caller renders it and passes it."
8
+ ],
9
+ "description": "Asks a writer to implement one user story.",
10
+ "seams": [
11
+ "story-writer"
12
+ ],
13
+ "id": "story-implementation",
14
+ "version": 1,
15
+ "body": "Implement user story __STORY_ID__: __TITLE__\n\n## Story Description\n__DESCRIPTION__\n\n## Acceptance Criteria\n- __ACCEPTANCE_CRITERIA__\n\n## Technical Notes\n__TECHNICAL_NOTES__\n\n## Files to Create/Modify (EXACT ABSOLUTE PATHS — start here; this list is not exhaustive)\nThese are the files the analysis identified. Use these exact paths for them. The list is a\nSTARTING POINT, not a fence: it is derived from the ticket and may be incomplete or may name\na path this repository spells differently. If your change genuinely requires another file in\nthis repository, write it — the only files closed to you are ones another story OWNS, and\nattempting one of those returns a specific refusal saying so. Do NOT work around a refusal by\nrepeatedly rewriting a file you can already write; that is never the fix. When you write a\nfile that is not listed here, say which file and why in your final message, so the reviewer\nsees the whole change.\n__FILES__\n\n## Dependencies\n__DEPENDENCIES__\n\n## Instructions\n1. Implement all acceptance criteria for this story\n2. Follow the project's existing code patterns and conventions\n3. Create any necessary files in the locations specified\n4. Ensure code compiles/runs without errors\n5. Do NOT create tests unless explicitly required in acceptance criteria\n\nAfter implementation, provide a brief summary of what was created/modified.",
16
+ "placeholders": [
17
+ "__TECHNICAL_NOTES__",
18
+ "__DEPENDENCIES__",
19
+ "__ACCEPTANCE_CRITERIA__",
20
+ "__DESCRIPTION__",
21
+ "__STORY_ID__",
22
+ "__TITLE__",
23
+ "__FILES__"
24
+ ]
25
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$why": [
3
+ "A FRAGMENT of the detective prompt, 2026-08-16.",
4
+ "",
5
+ "The tracker's issue type is a HINT and the prompt says so in both directions. Both texts",
6
+ "exist because the wrong-way error is asymmetric: told it is a defect when it is not, the",
7
+ "agent hunts for a bug that was never there; told it is not when it is, it designs a feature",
8
+ "over a broken behaviour. Two fragments, so neither can be lost by editing the other."
9
+ ],
10
+ "body": "\\nJIRA CLASSIFIES THIS AS A DEFECT (issue type: Bug). This is a HINT, not a certainty — if the ticket's own text below clearly describes a capability that does not exist yet rather than broken existing behavior, trust the ticket over this hint. Assuming defect: there IS an existing bug and an existing symptom. Your job is the CAUSE, not the symptom (see CORE PRINCIPLE below).\\n",
11
+ "description": "Told to the detective when the tracker classifies the story as a defect.",
12
+ "id": "story-kind-hint-defect",
13
+ "placeholders": [],
14
+ "version": 1,
15
+ "seams": [
16
+ "story-writer"
17
+ ]
18
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$why": [
3
+ "A FRAGMENT of the detective prompt, 2026-08-16.",
4
+ "",
5
+ "The tracker's issue type is a HINT and the prompt says so in both directions. Both texts",
6
+ "exist because the wrong-way error is asymmetric: told it is a defect when it is not, the",
7
+ "agent hunts for a bug that was never there; told it is not when it is, it designs a feature",
8
+ "over a broken behaviour. Two fragments, so neither can be lost by editing the other."
9
+ ],
10
+ "body": "\\nJIRA DOES NOT CLASSIFY THIS AS A BUG (issue type: __ISSUE_TYPE__). This is a HINT, not a certainty — if the ticket's own text below clearly describes existing behavior that is wrong, trust the ticket over this hint. Assuming novel: there is likely NO existing bug and no wrong value to trace. Inventing a \"cause\" for a capability that does not exist yet produces a confident wrong answer. Your job is the ATTACHMENT POINT — the existing file/function/provider/hook/route/component this new capability must plug into, and anything already present the implementation should REUSE — not a fix site.\\n",
11
+ "description": "Told to the detective when the tracker does NOT classify the story as a defect.",
12
+ "id": "story-kind-hint-other",
13
+ "placeholders": [
14
+ "__ISSUE_TYPE__"
15
+ ],
16
+ "version": 1,
17
+ "seams": [
18
+ "story-writer"
19
+ ]
20
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of claude.sh and codemie-claude.sh on 2026-08-16.",
4
+ "",
5
+ "It existed as TWO copies, one per provider script. Two copies of a prompt drift, and which",
6
+ "one a run receives depends on which script it took -- so the same story could be planned",
7
+ "against different instructions with nothing to indicate it. Both call sites render this.",
8
+ "",
9
+ "The two copies had ALREADY DRIFTED, which is the defect stated as evidence: claude.sh",
10
+ "parameterised the messages path while codemie-claude.sh hardcoded orchestrations/logs/",
11
+ "agent-messages.jsonl into the prompt text. Converging them removes a hardcoded project path",
12
+ "from a prompt as a side effect -- the parameterised copy is the one kept.",
13
+ "",
14
+ "The $(date ...) calls inside the JSON example were ESCAPED in the heredoc, so they reach the",
15
+ "model as the literal text $(date +%s) -- an instruction to the agent to run them, not a value",
16
+ "the shell substituted. Kept exactly as they were."
17
+ ],
18
+ "description": "Produces an execution-ready plan for one story before implementation begins.",
19
+ "id": "story-plan-agent",
20
+ "seams": [
21
+ "cpa-inference"
22
+ ],
23
+ "placeholders": [
24
+ "__STORY_ID__",
25
+ "__MESSAGES_JSONL__",
26
+ "__AGENT_ROLE__",
27
+ "__CURRENT_PHASE__"
28
+ ],
29
+ "version": 1,
30
+ "body": "You are a planning agent. Produce an execution-ready plan for story __STORY_ID__ BEFORE implementation begins.\n\n## Required Outputs\n1. Implementation steps with target file paths\n2. Dependency validation (each dep: satisfied yes/no, reason)\n3. Risk register (top 3 risks + mitigations)\n4. Test plan (new tests required + regression scope)\n5. Acceptance criteria mapping (each criterion -> implementation step)\n6. Cost/effort forecast (confirm or adjust estimatedHours)\n\n## On Completion\nAppend a single-line JSON record to __MESSAGES_JSONL__:\n{\n \"id\":\"plan___STORY_ID___$(date +%s)\",\n \"timestamp\":\"$(date -Iseconds)\",\n \"from_agent\":\"plan-agent\",\n \"to_agent\":\"__AGENT_ROLE__\",\n \"story_id\":\"__STORY_ID__\",\n \"phase_id\":\"__CURRENT_PHASE__\",\n \"message_type\":\"plan_summary\",\n \"priority\":\"normal\",\n \"subject\":\"Plan ready for __STORY_ID__\",\n \"body\":\"<one-sentence summary of key risks/steps>\",\n \"status\":\"new\"\n}\nWrite it atomically: (flock -w 10 9 >> __MESSAGES_JSONL__; printf '%s\\n' '<json>' >&9) 9>>__MESSAGES_JSONL__\n\n## Story to Plan\nRead orchestrations/prd.json for story __STORY_ID__ full details, then produce the plan above."
31
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of claude.sh on 2026-08-16. THE WRITER PROMPT -- the one the whole pipeline exists",
4
+ "to send, and the last and largest to leave the script.",
5
+ "",
6
+ "Twenty-six of its sections were command substitutions, each carrying its own HEADING inside",
7
+ "the substitution: reviewer feedback, verification criteria, codeline facts, test criteria,",
8
+ "dependency contracts, cross-codeline contracts, the brownfield policy. The words the writer",
9
+ "reads were assembled by shell conditionals spread over sixty lines and could not be read as a",
10
+ "prompt anywhere. The caller composes each section and passes it.",
11
+ "",
12
+ "VERIFIED BY RECONSTRUCTION rather than by execution. Several sections shell out to jq against",
13
+ "the real PRD, so running the original with sample values proves nothing. Substituting every",
14
+ "placeholder back and requiring byte equality with the heredoc proves what is actually at risk:",
15
+ "that nothing was dropped, reordered or reworded. What the substitutions evaluate to is",
16
+ "unchanged, because the caller passes the same expressions."
17
+ ],
18
+ "description": "The implementation prompt sent to the story writer.",
19
+ "id": "story-writer-main",
20
+ "seams": [
21
+ "story-writer"
22
+ ],
23
+ "placeholders": [
24
+ "__ESTIMATION_ASSESSMENT__",
25
+ "__AGENT_INPUTS__",
26
+ "__BROWNFIELD_TEST_POLICY__",
27
+ "__CODEGRAPH_TOOL_BLOCK__",
28
+ "__CODELINE_FACTS_BLOCK__",
29
+ "__CONDITIONAL_SECTION_2__",
30
+ "__CONDITIONAL_SECTION__",
31
+ "__CROSS_CODELINE_CONTRACT__",
32
+ "__DEPENDENCIES__",
33
+ "__DEPENDENCY_CONTRACTS__",
34
+ "__DESCRIPTION__",
35
+ "__EXISTING_FILE_CONTENTS__",
36
+ "__FILES__",
37
+ "__MODULE_RESOLUTION__",
38
+ "__NEW_DEPENDENCY_DIRECTIVE__",
39
+ "__PRD_CONFIGURATION_BLOCK__",
40
+ "__PROJECT_TOOLS_BLOCK__",
41
+ "__REVIEW_FEEDBACK__",
42
+ "__SKILL_NOTE_BLOCK__",
43
+ "__SPEC_REALITY_WARNING__",
44
+ "__STORY_ACS__",
45
+ "__STORY_ID__",
46
+ "__STRING_INVARIANTS_BLOCK__",
47
+ "__TC_BANNED__",
48
+ "__TC_FACTS_2__",
49
+ "__TC_FACTS__",
50
+ "__TC_MOCK_STRATEGY__",
51
+ "__TECHNICAL_NOTES__",
52
+ "__TEST_OWNERSHIP_BLOCK__",
53
+ "__TITLE__",
54
+ "__UNCOVERED_VC_BLOCK__",
55
+ "__VERIFICATION_CRITERIA__",
56
+ "__WRITE_FIRST_DIRECTIVE__",
57
+ "__WRITE_FIRST_LINES_2__",
58
+ "__WRITE_FIRST_LINES__"
59
+ ],
60
+ "version": 2,
61
+ "body": "__SPEC_REALITY_WARNING____WRITE_FIRST_DIRECTIVE__\n\n__WRITE_FIRST_LINES__\n---\n\nImplement user story __STORY_ID__: __TITLE__\n\n## Story Description\n__DESCRIPTION__\n\n## Acceptance Criteria\n__STORY_ACS____STRING_INVARIANTS_BLOCK__\n__AGENT_INPUTS____ESTIMATION_ASSESSMENT__\n__REVIEW_FEEDBACK__\n__SKILL_NOTE_BLOCK__\n__VERIFICATION_CRITERIA__\n__CODELINE_FACTS_BLOCK__\n__PRD_CONFIGURATION_BLOCK__\n__PROJECT_TOOLS_BLOCK__\n__TEST_OWNERSHIP_BLOCK__\n__CODEGRAPH_TOOL_BLOCK__\n__UNCOVERED_VC_BLOCK__\n__BROWNFIELD_TEST_POLICY__\n__NEW_DEPENDENCY_DIRECTIVE__\n__TC_FACTS__\n__TC_MOCK_STRATEGY__\n__TC_BANNED__\n\n## Technical Notes\n__TECHNICAL_NOTES__\n__EXISTING_FILE_CONTENTS__\n\n## Files to Create/Modify (EXACT ABSOLUTE PATHS — start here; this list is not exhaustive)\nThese are the files the analysis identified. Use these exact paths for them. The list is a\nSTARTING POINT, not a fence: it is derived from the ticket and may be incomplete or may name\na path this repository spells differently. If your change genuinely requires another file in\nthis repository, write it — the only files closed to you are ones another story OWNS, and\nattempting one of those returns a specific refusal saying so. Do NOT work around a refusal by\nrepeatedly rewriting a file you can already write; that is never the fix. When you write a\nfile that is not listed here, say which file and why in your final message, so the reviewer\nsees the whole change.\n__FILES__\n\n## Dependencies\n__DEPENDENCIES__\n__DEPENDENCY_CONTRACTS__\n__MODULE_RESOLUTION__\n__CROSS_CODELINE_CONTRACT__\n\n## Instructions\n__WRITE_FIRST_DIRECTIVE__\n__WRITE_FIRST_LINES_2__\n__CONDITIONAL_SECTION__\n\n__CONDITIONAL_SECTION_2__\n2. Implement all acceptance criteria for this story\n__TC_FACTS_2__\n4. Do NOT create tests unless explicitly required in acceptance criteria\n\nAfter implementation, provide a brief summary of what was created/modified.",
62
+ "mayBeEmpty": [
63
+ "__ESTIMATION_ASSESSMENT__",
64
+ "__AGENT_INPUTS__",
65
+ "__BROWNFIELD_TEST_POLICY__",
66
+ "__CODEGRAPH_TOOL_BLOCK__",
67
+ "__CODELINE_FACTS_BLOCK__",
68
+ "__CROSS_CODELINE_CONTRACT__",
69
+ "__DEPENDENCY_CONTRACTS__",
70
+ "__EXISTING_FILE_CONTENTS__",
71
+ "__MODULE_RESOLUTION__",
72
+ "__NEW_DEPENDENCY_DIRECTIVE__",
73
+ "__PRD_CONFIGURATION_BLOCK__",
74
+ "__PROJECT_TOOLS_BLOCK__",
75
+ "__REVIEW_FEEDBACK__",
76
+ "__SKILL_NOTE_BLOCK__",
77
+ "__SPEC_REALITY_WARNING__",
78
+ "__STORY_ACS__",
79
+ "__STRING_INVARIANTS_BLOCK__",
80
+ "__TC_BANNED__",
81
+ "__TC_FACTS__",
82
+ "__TC_MOCK_STRATEGY__",
83
+ "__TEST_OWNERSHIP_BLOCK__",
84
+ "__UNCOVERED_VC_BLOCK__",
85
+ "__VERIFICATION_CRITERIA__",
86
+ "__WRITE_FIRST_LINES_2__",
87
+ "__WRITE_FIRST_LINES__"
88
+ ],
89
+ "$whyEstimationAssessmentMayBeEmpty": "__ESTIMATION_ASSESSMENT__ (2026-09-28): the estimation application's assessment of this story's ticket (EPAM_ESTIMATION_MANIFEST, rendered by lib/handlers/estimation-manifest.js with this agent's framing from the engine template estimation-assessment). Absent is the ordinary state: a run with no manifest, or a ticket the manifest does not cover. It sits directly beside its neighbour with no separator of its own, so an absent assessment renders the prompt byte-for-byte as before.",
90
+ "$mayBeEmptyWhy": "Each is a section build_implementation_prompt initialises empty and fills only on a condition, so absent is a REAL state: no prior review (every first attempt), no persisted skill notes, no codegraph plugin, a greenfield file, a single codeline, a non-brownfield run, all VCs covered. Without this the engine-prompt empty-payload guard (added 5f3995f, 2026-08-23) refused every writer prompt: review_feedback is empty unless review-feedback-<story>.json exists, which it cannot on a first attempt, so build_implementation_prompt returned 1 and claude.sh logged 'REFUSED — not invoking the writer' for EVERY story. The list is derived by executing the real builder against a realistic story and recording what it left empty, not chosen by hand. A second pass against the real MOCK3-1 story added __WRITE_FIRST_LINES__, __VERIFICATION_CRITERIA__, __FILES__ and __WRITE_FIRST_LINES_2__: a story that declares no verification criteria and no files is a real state the PRD produces today, and the write-first lines are conditional on it.",
91
+ "$mayBeEmptyReview": "Two entries deserve a second look when anyone next touches this: __AGENT_INPUTS__ (empty may mean 'this role declares no inputs' OR that the agent-inputs lookup returned nothing) and __TEST_OWNERSHIP_BLOCK__ (empty on non-brownfield runs, and test ownership is a policy the operator has been explicit about). Both are listed because production genuinely emits them empty today; neither should be treated as settled.",
92
+ "$whyFilesIsNotOptional": "__FILES__ was briefly listed here and is deliberately NOT. A live haiku call on 2026-08-26 was given a writer prompt with no files and answered: 'I need clarification on the file paths ... the working directory is empty. Could you provide the actual absolute file paths?' A writer with nowhere to write cannot act, so an empty __FILES__ must REFUSE rather than render. The story that produced it (MOCK3-1) was PRE-SPEC — canonical stories carry no technicalNotes, and the spec pass adds them before the writer runs — so refusing here also catches the real defect of invoking the writer before elaboration.",
93
+ "$whyStoryAcs": "__STORY_ACS__ added 2026-09-13: the numbered acceptance criteria of the story (lib/story-acs-block.sh), directly under the heading that had nothing AC-related beneath it. mayBeEmpty because a brownfield ticket may carry none — its VC block follows.",
94
+ "$whyModuleResolutionMayBeEmpty": "Produced by _module_resolution_context (claude.sh), which returns nothing — `[ -f \"$_cfg\" ] || return 0` — for a project that declares no dependency-check.json. A deliberate empty, like the other blocks declared here. Undeclared, the writer prompt refused to render for every story of such a project and every attempt failed before a model was asked (£0 brownfield harness run 6, 2026-09-14; latent since 2026-08-16).",
95
+ "$whyMayBeEmpty": "__PROJECT_TOOLS_BLOCK__: a codeline that has registered no project tools is the ordinary state — a fresh worktree lane (no untracked .epam/tools), or any project before a tool is minted. Refusing to render on it sent the writer nothing, eight times (regintel £0 rehearsal #18, 2026-09-20)."
96
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "id": "story-writer",
3
+ "layer": "project",
4
+ "version": 1,
5
+ "description": "The story writer prompt. Its INPUT FRAMINGS live here: the authority under which each declared input is read.",
6
+ "$why": [
7
+ "The writer used to receive eleven other agents outputs, each wrapped in prose written inline",
8
+ "in claude.sh alongside thirty conditionals deciding what to include. That made every consumer",
9
+ "an author of its producers meaning, and the two renderings of the detectives answer drifted",
10
+ "apart within an hour of a field being added to one of them.",
11
+ "",
12
+ "The facts now come from the producer. What stays with the READER is the AUTHORITY: the same",
13
+ "finding is a plan of record to the writer and evidence to judge against for the reviewer.",
14
+ "That authority is prompt text, so it lives in a prompt document — not in a shell string, and",
15
+ "not in the invocation registry. The archetypes consumes[].framing names the body to render.",
16
+ "",
17
+ "Extracted verbatim from claude.sh on 2026-08-13; the writer-prompt captures prove the words",
18
+ "did not change in the move."
19
+ ],
20
+ "placeholders": [],
21
+ "bodies": {
22
+ "fix-plan": "## Root Cause Analysis & Prescribed Fix (AUTHORITATIVE — start here, do not re-trace)\nA code investigation already traced this bug to its cause and prescribed the minimal fix below. This is the plan of record. Apply it; do NOT re-read the whole codebase to re-derive it.\n\nThe Acceptance Criteria above describe the desired END BEHAVIOR to VERIFY — they are NOT an implementation blueprint. Do not re-architect, split values, or add new fields/abstractions to satisfy an AC literally when the prescribed minimal fix already makes that AC pass. Implement the fix below; the ACs are how you check you got it right.\n\nHARD RULES:\n- Make the SMALLEST change that fixes the root cause. Fewer lines of code is always better.\n- REUSE existing functions. Before writing any new helper, search the repo for an existing util/parser/formatter that already does what you need (use the CodeGraph tool documented below) and call it. Writing novel code when a helper already exists is a defect to be rejected in review.",
23
+ "attempt-evidence": "## What Your Last Attempt Did\nThis is a diffstat, not a judgement — it is what is on disk, unedited. It is EVIDENCE, not an instruction: it does not tell you the work was right, and it does not tell you to undo it. Read it to see what you already changed, so you extend that work rather than rediscovering it or repeating it."
24
+ },
25
+ "seams": [
26
+ "story-writer"
27
+ ]
28
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "$why": [
3
+ "Created 2026-08-17.",
4
+ "",
5
+ "The estate survey decides which codelines the work reaches and what each investigator should",
6
+ "concentrate on. Its output flows straight into the mint's context and becomes the briefs the",
7
+ "team inherits. NOTHING reviewed it: no seam declared it as an input, so its claims reached",
8
+ "the roster unchallenged.",
9
+ "",
10
+ "Live 2026-08-17: the survey reported a codeline in_scope on a file that codeline does not",
11
+ "have, and an implementer was briefed to apply that codeline's fix in a repository with no",
12
+ "such code. A validator was written to strip false paths, and it SILENTLY REWROTE the survey \u2014",
13
+ "worse than reporting, and removed. A generated prompt already gets an adversarial reviewer",
14
+ "before anything inherits it (prompt-review); the survey needs the same and had none.",
15
+ "",
16
+ "SCOPE IS DELIBERATELY NARROW, for the reason prompt-review's is: it judges CHECKABLE CLAIMS",
17
+ "ABOUT THE REPOSITORIES, never whether the survey looked hard enough or chose well. A reviewer",
18
+ "invited to improve judgement rewrites correct surveys."
19
+ ],
20
+ "id": "survey-review",
21
+ "version": 1,
22
+ "layer": "project",
23
+ "description": "Falsifies what an estate survey claims about the codelines, before a roster is minted from it.",
24
+ "seams": [
25
+ "survey-review"
26
+ ],
27
+ "body": "You are reviewing an ESTATE SURVEY. A roster of agents is about to be minted from it, and every\nclaim below will be inherited as a brief and re-checked by nothing.\n\nTHE SURVEY UNDER REVIEW:\n__SURVEY_BLOCK__\n\nTHE CODELINES IN SCOPE, and where each is checked out:\n__CODELINE_BLOCK__\n\nTHE WORK THE PROJECT WAS ASKED TO DO:\n__TICKET_BLOCK__\n\n__TOOL_LINE__\n\n# What is in scope\n\nONE QUESTION ONLY: does the survey state anything about these repositories that is FALSE?\n\nA claim is in scope when you can check it by opening a repository. Open them and check.\n\n- a file named in `filesRead` that the codeline does not contain\n- a file, module, function or symbol said to exist where it does not\n- a claim attributed to the WRONG codeline \u2014 the commonest and most damaging error, because the\n brief built from it sends an implementer into a repository that has no such code\n- a dependency, script, framework or command the codeline does not declare\n- a codeline reported in_scope on evidence that belongs to a different one\n\nA codeline reported no_work_found or not_investigated is making a WEAK claim, not a false one.\nCheck it only if you can show the work plainly does reach it.\n\n# What is NOT in scope\n\nDo not judge whether the survey looked hard enough, chose the right focus, or recommended the\nright team. Do not propose better wording. Do not supply a FIX SITE of your own \u2014 naming which\nfile to edit is not yours to say here any more than it was the surveyor's, and a fix site you add\nfor a repository you swept from the outside is how one codeline's file ends up in another's work.\n\n# Evidence\n\nFor each finding, say what you CHECKED and what you FOUND, naming the repository and the path you\nopened. A finding without a check is an opinion, and an opinion about a survey is not a defect.\n\nIf every claim checks out, return no findings. An empty finding list from a review that RAN is the\ncorrect answer for a sound survey.\n",
28
+ "placeholders": [
29
+ "__CODELINE_BLOCK__",
30
+ "__SURVEY_BLOCK__",
31
+ "__TICKET_BLOCK__",
32
+ "__TOOL_LINE__"
33
+ ],
34
+ "mayBeEmpty": [
35
+ "__SURVEY_BLOCK__"
36
+ ],
37
+ "$whyMayBeEmpty": "Declared 2026-08-27 by sweeping the CLASS rather than the instance, after three runs died on it one placeholder at a time. Every call site for these writes an explicit empty branch \u2014 the story is not being split, attempt one carries no forced-retry note, no documentation was fetched, the persona prefix is optional \u2014 so absence is a real state, which is the renderer's own test. Placeholders supplied by a lookup that may FAIL (`x || ''`) are deliberately NOT here: for those, empty means broken, and declaring them would hide the blank-brief defect the renderer exists to surface. Unanimity is required \u2014 one deliberate branch among several defensive lookups is not a licence."
38
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of post-impl-tc-writer.sh on 2026-08-15 (17 of 20). It was a heredoc.",
4
+ "",
5
+ "The TC writer turns verification criteria into the tests that check them, so its wording",
6
+ "decides what \"verified\" means for every story that passes through.",
7
+ "",
8
+ "2026-08-19: the body prescribed ONE test framework (vi.mock, vi.hoisted, vi.stubGlobal, clearAllMocks/resetAllMocks, and @jest/globals as a banned import) to every codeline, and illustrated every instruction with the sample travel app's domain — /search, /cheapest, 'from'/'to', adults=0, src/server.ts, table column alignment. The codeline's own answers already existed in lib/ecosystem-registry.js and stack-facts.js and were never passed in.",
9
+ "",
10
+ "It also said 'The testCriteria.facts OVERRIDE any conflicting AC. Write them as ground truth.' The seam consumes `implementation` (required) and reads the BUILT source, so that authorised the tests to canonise whatever the writer produced and overrule the requirement while doing it. On brownfield, a live brownfield run, the requirement was all that stood between the run and a regression its own verification criteria described.",
11
+ "",
12
+ "2026-08-20: this said \"Use WriteFile to write the complete JSON object to that path\" while the seam's grant is read-only — twelve tools, none of which write. The agent said so verbatim: \"I cannot write this to .../logs/tc-core.json because no file-writing tool is available.\" The applier then read a tc-core.json dated 31 JULY containing MOCK-HW-1-test from a mock run, applied 0 stories, and the gate reported PASSED.",
13
+ "",
14
+ "The agent now RETURNS the object and the engine writes it (lib/handlers/tc-extract-output.py) — the pattern the skill-assessment prompt already uses, for the reason it already gives. The agent stays read-only and no write path into orchestrations/logs/ exists.",
15
+ "2026-09-17: the sourceFiles definition said \"a real path you read\" — no scope boundary. Live REGI-004b: the TC writer traced a 'from dial.client import' statement, read the external library, and listed 'dial/client.py' in sourceFiles. The applier accepted it; pre-flight check #18 hard-failed and blocked the resume. Fixed by restricting sourceFiles to IMPL_SOURCE_FILES and explicitly excluding external library files."
16
+ ],
17
+ "body": "__CORRECTIVE_NOTE__\n\n## Your ONLY output is a valid JSON object — nothing else\n\nOutput format (one object, all story IDs as keys):\n{\n \"<story-id>\": {\n \"verifiedAt\": \"<ISO8601 timestamp>\",\n \"sourceFiles\": [\"<only paths from implSourceFiles — never external library files or paths outside the declared implementation scope>\"],\n \"facts\": [\n \"<a concrete, checkable statement of what the change must do, traceable to a verification criterion>\",\n \"<the exact identifiers involved: names copied from the source, never paraphrased>\",\n \"<the exact observable outcome: value, shape or rendered result, copied verbatim>\"\n ],\n \"mockStrategy\": \"<exact setup, written in the idiom this repository's OWN tests already use>\",\n \"bannedPatterns\": [\"<string that must NOT appear in the test file>\"],\n \"conflictsWith\": [{\"storyId\": \"<story whose existing criterion this story's criteria cannot satisfy>\", \"fact\": \"<that criterion, verbatim>\", \"reason\": \"<why this story needs the contract to change>\"}]\n }\n}\nconflictsWith is [] unless this story genuinely needs a contract another story already fixed to change.\n\n## Stories to process\n\n__STORY_CONTEXT__\n\n## This codeline's test conventions\n\nTest file conventions: __TEST_FILE_CONVENTIONS__\nTest command: __TEST_COMMAND__\n\nRead at least one EXISTING test file in this repository before writing mockStrategy. The mocking\nidiom, the import style and the setup/teardown convention are whatever THIS repository already\ndoes — never an idiom carried in from elsewhere. If you cannot find an existing test, say so in\nthe facts rather than inventing a convention.\n\n## Instructions\n\nFor each story above:\n\n1. THE VERIFICATION CRITERIA ARE THE SOURCE. Each criterion in verificationCriteria must become at\n least one fact that a test can assert. They state what the change must be observed to do; the\n implementation states what it currently does. Those are different things.\n\n2. READ every implSourceFiles path listed, using your file reading tool. Read the COMPLETE file.\n You read the implementation to learn the EXACT names, paths, signatures and shapes a test must\n use — not to decide what the change is supposed to do.\n You may follow imports to understand context, but sourceFiles must only contain paths from\n implSourceFiles — do not list external library files even if you read them while tracing.\n\n3. Extract FACTS. Every fact must be checkable, and must carry the exact detail a test needs:\n - Exact function/method signatures and parameter names\n - Exact route paths, keys or identifiers, copied verbatim\n - Exact error message strings (copy verbatim from the throw/return statement)\n - Exact return shapes (copy from the return statement)\n - Which validations exist and which do NOT — an absent check is as much a fact as a present one\n - The correct import path for the module under test, as it appears in this repository\n\n4a. A SHARED FILE'S CONTRACT IS ALREADY IN FORCE. A story's existingCriteriaOnSharedFiles lists,\n per source file, the facts OTHER stories' tests already hold on it, and consumesInterfaces the\n exact signatures this story's implementation was told to call. Those are the contract; they win\n over this story's own reading of its criteria. Write facts CONSISTENT with them — same names,\n same signatures, same sync/async shape. If this story's criteria genuinely cannot be met under\n that contract, do NOT write a fact that contradicts it: put the other story's fact verbatim in\n conflictsWith with the reason, and write this story's facts around the parts that do not\n conflict. A reviewer decides the contract change; a contradicting fact only makes two suites\n fail each other.\n\n4. WHERE THE IMPLEMENTATION CONTRADICTS A VERIFICATION CRITERION, the criterion wins. Write the\n fact the criterion requires, and add a fact naming the contradiction explicitly, e.g.\n \"IMPLEMENTATION CONFLICT: <criterion> requires <X>; <file>:<line> currently does <Y>\". Do not\n quietly write down what the code does — a test that describes the implementation can never fail\n against it, and the defect ships verified.\n\n5. Write MOCK_STRATEGY as a single sentence describing exactly how to mock the dependencies, in\n this repository's existing idiom, naming the real module path as it appears in the code under\n test.\n\n6. Write BANNED_PATTERNS as strings that must not appear in the test file — wrong identifiers,\n wrong paths, wrong imports for this repository's test setup.\n\n7. RETURN the JSON object as your answer. You do NOT write any file, and you have no tool that\n can — the pipeline takes your answer and writes it deterministically. Hand-rolling edits to a\n large JSON file is what made earlier attempts at this task run out of iterations without ever\n finishing.\n\nCRITICAL: your answer must CONTAIN the JSON object. No explanation is needed and none is read; if\nyou include any, the object must still be present and parseable. An answer with no JSON object is\ntreated as no answer at all — the story gets no test criteria and the step fails.\n",
18
+ "description": "Write the test criteria for a story after implementation.",
19
+ "id": "tc-writer",
20
+ "placeholders": [
21
+ "__CORRECTIVE_NOTE__",
22
+ "__STORY_CONTEXT__",
23
+ "__TEST_COMMAND__",
24
+ "__TEST_FILE_CONVENTIONS__"
25
+ ],
26
+ "version": 2,
27
+ "seams": [
28
+ "tc-writer"
29
+ ],
30
+ "mayBeEmpty": [
31
+ "__CORRECTIVE_NOTE__"
32
+ ],
33
+ "$whyMayBeEmpty": {
34
+ "__CORRECTIVE_NOTE__": "Empty on a first attempt; on a retry it carries the self-heal analyst's note or the change reviewer's rejection reason."
35
+ }
36
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$why": [
3
+ "A quality gate can find a change's TEST insufficient while the code is right — a mutation survives because no",
4
+ "assertion can tell the mutant from the original. Such a finding used to go back to the code writer, who may not",
5
+ "touch tests (test-ownership), committed nothing, and the phase looped. The gate-finding-analyst now judges whether",
6
+ "a finding is test work; when it is, the test-writer receives this section after its own prompt and strengthens the",
7
+ "test the change already carries. Its commit is what the gates re-run on.",
8
+ "",
9
+ "A fragment composed into the repro-test-writer's prompt: no seam declares it, so it renders from the engine",
10
+ "layer and takes its project content from the values below."
11
+ ],
12
+ "description": "Tells the test-writer that a QA gate found the change's test insufficient, and what the gate found.",
13
+ "id": "test-gate-finding",
14
+ "version": 2,
15
+ "placeholders": [
16
+ "__GATE_LABEL__",
17
+ "__FINDING__",
18
+ "__GATE_EVIDENCE__",
19
+ "__TARGET_REL__"
20
+ ],
21
+ "bodies": {
22
+ "prompt": "\n\n## THIS TURN: A QUALITY GATE FOUND THE TEST INSUFFICIENT\nThe change above is committed and its test at __TARGET_REL__ already exists and passes. The __GATE_LABEL__ gate then judged that test insufficient, and its analyst judged that the product code is right and only the test must change. This is the finding:\n```json\n__FINDING__\n```\nThe gate's own report:\n```\n__GATE_EVIDENCE__\n```\nStrengthen the test at __TARGET_REL__ so that what the gate found is no longer true: add or sharpen the cases that would fail if the behaviour the finding names were broken. Keep every existing case, and keep them passing — rewrite the file in full with the existing cases and yours. Do not change any source file. Everything above about framework, typechecking and mocks still applies.",
23
+ "unchanged": "\n\n## YOUR PREVIOUS ATTEMPT LEFT THE TEST UNCHANGED\nThe file at __TARGET_REL__ is byte-for-byte what was already committed, so nothing the __GATE_LABEL__ gate found has been addressed. Add the cases the finding requires and write the file again.",
24
+ "commitNoun": "strengthened test for the __GATE_LABEL__ finding",
25
+ "logNoun": "strengthened test (__GATE_LABEL__ finding)"
26
+ }
27
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "id": "test-ownership",
3
+ "layer": "project",
4
+ "version": 1,
5
+ "description": "Who owns the tests. ONE policy per MODE, rendered into the mint (what a brief may claim), the writer and the reviewer, so no agent holds a belief another contradicts.",
6
+ "$why": [
7
+ "This lived as a heredoc in claude.sh — the WRITER's prompt builder — and nowhere else.",
8
+ "team-lead-review.sh had never heard of it and was told 'Check: ... test coverage', so it",
9
+ "raised a blocker for missing tests. Commit 33ee47b then hardened the writer's side of the",
10
+ "same contradiction — 'a BLOCKER is a required deliverable ... the only way to resolve it is",
11
+ "to CREATE it' — leaving the writer ORDERED TO CREATE WHAT IT IS FORBIDDEN TO CREATE. Live in",
12
+ "the 2026-08-12 prompt, twenty lines apart. That is an unwinnable gate, and it is why the",
13
+ "writer 'over-reached' on every run: it was obeying instructions.",
14
+ "",
15
+ "A policy declared in one agent's prompt is not a policy, it is a private belief. Declared",
16
+ "here, both agents render from the same source and change together.",
17
+ "",
18
+ "The file patterns are NOT decoration: without them \"a test file\" is left to the agent to",
19
+ "interpret. An existing test asserts they are present, and caught their loss the moment this",
20
+ "policy was first extracted.",
21
+ "",
22
+ "2026-09-16, skyscanner greenfield: the mint carried its own copy of the brownfield rule as a string in",
23
+ "spec-mode-runner.js ('a dedicated agent of this pipeline writes the tests'), so every greenfield brief",
24
+ "disowned its stories' test files; the roster reviewer then found, correctly, that no stage in a greenfield",
25
+ "run authors feature tests, and blocked the roster on every cycle. In greenfield the implementer owns the",
26
+ "test files its stories declare. The mode picks the body; the mint renders it from here."
27
+ ],
28
+ "placeholders": [],
29
+ "bodies": {
30
+ "writer": "## Tests are NOT your job this turn\nA dedicated test-writer agent runs immediately after your fix commits and owns the bug-reproducing test. Do NOT write, edit, or create any test file (*.test.*, *.spec.*, __tests__/). Write ONLY the fix.\n\nThis is not a suggestion you can trade against a review comment: the reviewer has been given the same rule and will not reject you for absent tests. If a prior review comment appears to demand a test, it is stale — resolve it by making the fix correct, and say in your final message that test authorship belongs to the test-writer.\n\nAdding a test here wastes your turn budget and has caused repeated failures.",
31
+ "reviewer": "## Test authorship is NOT this agent's responsibility\nThe implementer you are reviewing was explicitly forbidden to write, edit or create any test file (*.test.*, *.spec.*, __tests__/). A dedicated test-writer agent runs after the fix commits and owns that work, and its output is reviewed separately.\n\nTherefore: NEVER raise a blocker, or any finding, for absent or insufficient tests on the implementer's change. It could not have satisfied it, so the story cannot progress — that is an unwinnable gate, and it has cost whole runs.\n\nJudge the FIX: does it address the prescribed root cause, is it the smallest change that does so, does it preserve what the existing code guaranteed. Test coverage is checked elsewhere, by the coverage gate and by the test-writer's own review.",
32
+ "mint-brownfield": "WHO WRITES THE TESTS — NOT THESE ROLES.\n\nA dedicated agent of this pipeline writes the tests. It takes its own turn after the fix is committed and owns the reproducing test, and the roles you propose are separately FORBIDDEN from creating or editing any test file.\n\nSo: do not propose a test-writing, QA or test-automation role — that work is already owned. And a brief must not say the role writes, owns, colocates or maintains tests, in any words. A role whose brief claims test authorship is handed two contradictory instructions and spends its turns fighting itself. Describe what the role BUILDS.\n",
33
+ "mint-greenfield": "WHO WRITES THE TESTS — THESE ROLES DO.\n\nThis is a greenfield run: the codeline is built from nothing and no separate stage of this pipeline authors feature tests. The implementer you propose OWNS every test file its stories declare (the *.test.* / *.spec.* files named in the tickets) and writes them alongside the code, so the story's acceptance criteria can be executed.\n\nSo: do not propose a separate test-writing, QA or test-automation role, and a brief must not defer test authorship to another stage — there is none. Say plainly that the role writes the tests its stories declare.\n"
34
+ },
35
+ "seams": [
36
+ "team-lead-review"
37
+ ]
38
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of run-agent-orchestration.sh on 2026-08-16.",
4
+ "",
5
+ "Repairs a dynamically-created tool script. Its retry names bash -n output, because the failure this seam actually hits is a syntax error in a script the pipeline itself wrote."
6
+ ],
7
+ "description": "Repairs a dynamically-created tool script that no longer parses or behaves.",
8
+ "seams": [
9
+ "story-writer"
10
+ ],
11
+ "id": "tools-coordinator",
12
+ "version": 1,
13
+ "body": "You are the tools-coordinator agent. A dynamic tool at __TC_PATH__ is broken (__TC_REASON__). Read the file, fix it so it runs successfully and stays idempotent (safe to run multiple times), and write the corrected script back to the SAME path. Keep the '#!/usr/bin/env bash' shebang and the purpose comment on line 2. Do not touch any other file.",
14
+ "placeholders": [
15
+ "__TC_REASON__",
16
+ "__TC_PATH__"
17
+ ]
18
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of lib/topology-router.js on 2026-08-25.",
4
+ "",
5
+ "The prompt was built by string concatenation in code, so it was invisible to the prompt",
6
+ "layer: it could not be reviewed, versioned or provisioned per project. It also could not",
7
+ "run at all — topology-router was never one of the declared seams, so its model never",
8
+ "resolved and the LLM path threw at module load. Every topology decision in every run has",
9
+ "been the count heuristic.",
10
+ "",
11
+ "NO PROJECT FACT APPEARS HERE. The stories, the phase and the CPA signals arrive as values.",
12
+ "What stays is the decision rule, which is a fact about orchestration, not about a codebase."
13
+ ],
14
+ "id": "topology-router",
15
+ "version": 1,
16
+ "description": "Choose the execution topology for a phase, given each story's effort, role, dependencies and cost signals.",
17
+ "placeholders": [
18
+ "__PHASE__",
19
+ "__STORIES__",
20
+ "__CPA_SIGNALS__"
21
+ ],
22
+ "seams": [
23
+ "topology-router"
24
+ ],
25
+ "body": "You are selecting an execution topology for orchestration phase \"__PHASE__\".\n\nStories to classify:\n__STORIES__\n__CPA_SIGNALS__\n\nRules:\n- single: 0-1 worktree stories, OR one high-effort story that needs focused attention\n- parallel: 2-4 independent stories with no shared file scope\n- sequential: stories with overlapping file scope, tight coupling, or shared state risk\n\nOverlapping file scope outranks story count. Stories that edit the same file must not run in\nparallel worktrees, even when there are only two or three of them: the count alone cannot see\nthat, and parallel worktrees over a shared file produce a merge conflict the run cannot resolve.\n\nRespond with ONLY this JSON object. No prose, no markdown fences:\n{\"topology\":\"single|parallel|sequential\",\"reason\":\"<one sentence naming the deciding factor>\"}",
26
+ "mayBeEmpty": [
27
+ "__CPA_SIGNALS__"
28
+ ],
29
+ "$mayBeEmptyWhy": "A phase can genuinely have no cost signals — CPA runs per story and a phase may hold none yet. Absent is a REAL state here, not a failed lookup, so the section renders blank rather than the render refusing. Every other placeholder must be supplied: an empty story list or phase name would mean the caller asked about nothing."
30
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of update-invalidated-tests.sh on 2026-08-16.",
4
+ "",
5
+ "This is the prompt for the ONLY agent in the pipeline that is granted write access to",
6
+ "PRE-EXISTING tests. Those tests are the codeline's accumulated oracle: if this agent edits one",
7
+ "wrongly, the signal that a fix is broken is destroyed permanently and silently, and every gate",
8
+ "downstream sees green.",
9
+ "",
10
+ "It lived as a heredoc in a shell script, so the most consequential prompt in the run was the",
11
+ "one no prompt review could reach and no diff could show. The instruction that carries the",
12
+ "whole safety property — 'Case (b) matters more than case (a) ... When in doubt, choose (b)' —",
13
+ "could be weakened by anyone editing the script for an unrelated reason, and nothing would",
14
+ "flag it.",
15
+ "",
16
+ "__VERIFICATION_CRITERIA__ is the authority the agent judges against, and it has no default.",
17
+ "The script rendered '(not supplied)' when the story carried none, which asked the agent to",
18
+ "decide whether a failure was 'explained by the intended change' with no statement of what the",
19
+ "intended change was — while holding write access to the tests. The caller now refuses instead."
20
+ ],
21
+ "description": "Decide, per failing test, whether a committed fix legitimately invalidated it or broke something.",
22
+ "seams": ["repro-test-writer"],
23
+ "consumer": "engine",
24
+ "id": "update-invalidated-tests",
25
+ "version": 1,
26
+ "body": "You are updating tests that a COMMITTED bug fix has legitimately invalidated.\n\nThe fix is already committed and is CORRECT — do not change any non-test file.\nThe test suite is now RED. Your ONLY job is to decide, per failure, which case it is:\n\n (a) the test asserted the OLD, BUGGY behaviour that this fix deliberately changes\n -> update JUST that assertion to the new expected behaviour.\n (b) the failure is NOT explained by the intended change — the fix broke something\n -> this is a REGRESSION. Do NOT edit anything. Reply with the single line:\n REGRESSION: <one sentence saying what broke>\n\nCase (b) matters more than case (a): silently rewriting a test so a broken fix goes\ngreen destroys the only signal that the fix is wrong. When in doubt, choose (b).\n\nOnly these PRE-EXISTING test files may be edited (a test authored during this run is\nthe new bug-reproducing test and must NEVER be rewritten here):\n__PREEXISTING_TESTS__\n\n=== INTENDED BEHAVIOUR CHANGE (Verification Criteria — the authority on what SHOULD change) ===\n__VERIFICATION_CRITERIA__\n\n=== THE COMMITTED FIX (diff) ===\n__FIX_DIFF__\n\n=== FAILING TEST OUTPUT ===\n__FAILING_OUTPUT__\n",
27
+ "placeholders": [
28
+ "__PREEXISTING_TESTS__",
29
+ "__VERIFICATION_CRITERIA__",
30
+ "__FIX_DIFF__",
31
+ "__FAILING_OUTPUT__"
32
+ ]
33
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of vc-coverage-check.sh on 2026-08-15 (19 of 20).",
4
+ "",
5
+ "Asked once per criterion, so it is deliberately narrow: one requirement, one suite, one",
6
+ "yes or no with the covering case named. Widening it is how a coverage check turns into an",
7
+ "opinion about the tests in general."
8
+ ],
9
+ "body": "You are checking whether a test suite covers ONE specific requirement.\n\n## The requirement\n__VERIFICATION_CRITERION__\n\n## The test file (complete)\n```\n__TEST_SOURCE__\n```\n\nAnswer ONE question: does this test file contain a case that would FAIL if this\nrequirement were violated?\n\nJudge the ASSERTIONS, not the titles. A test whose name mentions the same words\nis irrelevant if it does not actually exercise the requirement — in particular a\nrequirement stating something must NOT happen is not covered by a test asserting\nthat it DOES happen, however similar the wording.\n\nOutput ONLY this JSON, nothing else:\n{\"covered\": true|false, \"case\": \"<the test case name that covers it, or empty>\", \"why\": \"<one sentence>\"}",
10
+ "description": "Decide whether a test suite covers ONE specific verification criterion.",
11
+ "id": "vc-coverage",
12
+ "placeholders": [
13
+ "__TEST_SOURCE__",
14
+ "__VERIFICATION_CRITERION__"
15
+ ],
16
+ "version": 1,
17
+ "seams": [
18
+ "vc-coverage"
19
+ ]
20
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of spec-mode-runner.js regenerateVcViaOpenspec on 2026-08-16.",
4
+ "",
5
+ "The site block carries the detective's findings \u2014 the file and function the fix must touch.",
6
+ "Withholding it is what makes regenerated criteria vague, so it is handed over whole.",
7
+ "",
8
+ "THE FORM SAMPLES NEARLY DISAPPEARED HERE. The original injected them conditionally; the",
9
+ "capture ran with none configured, so the branch collapsed and the first template baked in",
10
+ "nothing at all \u2014 the worked examples could never have reached the agent again. A golden",
11
+ "capture only proves the branches the fixture exercises, and an existing test caught this",
12
+ "where the byte comparison could not."
13
+ ],
14
+ "body": "Regenerate the VERIFICATION CRITERIA for this brownfield story. Your previous verification criteria were FLAGGED and must be fixed:\n__FLAG_LIST__\n__SITE_BLOCK__\n\nAcceptance criteria (IMMUTABLE \u2014 the intent to verify; do NOT restate as-is, VERIFY them):\n__AC_LIST__\nDescription: __STORY_DESCRIPTION__\n\n__OBSERVABILITY_RULES__\n__FORM_SAMPLES__\nDo NOT restate an acceptance criterion as-is \u2014 express what a tester OBSERVES that confirms it. Address every flag above.\nOutput ONLY a JSON array of verification-criterion strings. No prose, no markdown.",
15
+ "description": "Regenerate verification criteria after a review flagged them.",
16
+ "id": "vc-regenerate",
17
+ "placeholders": [
18
+ "__AC_LIST__",
19
+ "__FLAG_LIST__",
20
+ "__FORM_SAMPLES__",
21
+ "__OBSERVABILITY_RULES__",
22
+ "__SITE_BLOCK__",
23
+ "__STORY_DESCRIPTION__"
24
+ ],
25
+ "version": 1,
26
+ "seams": [
27
+ "vc-coverage"
28
+ ],
29
+ "mayBeEmpty": [
30
+ "__FORM_SAMPLES__"
31
+ ],
32
+ "$whyMayBeEmpty": "Declared 2026-08-27 by sweeping the CLASS rather than the instance, after three runs died on it one placeholder at a time. Every call site for these writes an explicit empty branch \u2014 the story is not being split, attempt one carries no forced-retry note, no documentation was fetched, the persona prefix is optional \u2014 so absence is a real state, which is the renderer's own test. Placeholders supplied by a lookup that may FAIL (`x || ''`) are deliberately NOT here: for those, empty means broken, and declaring them would hide the blank-brief defect the renderer exists to surface. Unanimity is required \u2014 one deliberate branch among several defensive lookups is not a licence."
33
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$why": [
3
+ "Moved out of spec-mode-runner.js reviewVcViaSpeckit on 2026-08-16.",
4
+ "",
5
+ "Verification criteria are what every later stage checks the implementation against, so a",
6
+ "reviewer that lets a MECHANISM through turns \"verify the behaviour\" into \"verify the",
7
+ "implementation we guessed at\" — which is how a fix gets judged against an approach nobody",
8
+ "required.",
9
+ "",
10
+ "VC_OBSERVABILITY_RULES arrives as a VALUE. It was inlined here by the first extraction —",
11
+ "the capture saw its expanded text — which would have left a second copy of a constant the",
12
+ "guard also reads, free to drift from the one the guard enforces."
13
+ ],
14
+ "body": "You are a STRICT verification-criteria reviewer for a brownfield fix. REVIEW ONLY — do NOT rewrite anything.\n\nAcceptance criteria (IMMUTABLE ticket intent):\n__AC_LIST__\nDescription: __STORY_DESCRIPTION__\n\nProposed verification criteria:\n__VC_LIST__\n\nApply these rules EXACTLY (the producer is held to the same text — do not invent stricter or looser criteria):\n__OBSERVABILITY_RULES__\n\nA criterion may declare a PRECONDITION the test establishes (for example a mocked client\nsignalling a change). A declared precondition is NOT implementation prescription — do not flag\nit. Flag what the criterion ASSERTS, not what it sets up.\n\nFLAG any verification criterion that violates ANY rule above, OR that fails to cover the intent of an acceptance criterion.\nOutput ONLY a JSON array of short flag strings, e.g. [\"VC 2 prescribes <an approach> — restate as observable outcome\"]. Output [] if every VC is clean. No prose, no markdown.",
15
+ "description": "Review verification criteria for a brownfield fix and flag any that prescribe a mechanism.",
16
+ "id": "vc-review",
17
+ "placeholders": [
18
+ "__AC_LIST__",
19
+ "__OBSERVABILITY_RULES__",
20
+ "__STORY_DESCRIPTION__",
21
+ "__VC_LIST__"
22
+ ],
23
+ "version": 1,
24
+ "seams": [
25
+ "vc-coverage"
26
+ ]
27
+ }