@v11g/agents-rock 1.0.7 → 1.0.9

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 (215) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/reasoning/.claude-plugin/plugin.json +1 -1
  4. package/plugins/reasoning/evals/format-handoff-folder/graders/folder-named.md +8 -0
  5. package/plugins/reasoning/evals/format-handoff-folder/graders/skill-fired.md +7 -0
  6. package/plugins/reasoning/evals/format-handoff-folder/prompt.md +9 -0
  7. package/plugins/reasoning/evals/format-ids-and-supports/graders/ids-in-chat.md +8 -0
  8. package/plugins/reasoning/evals/format-ids-and-supports/graders/skill-fired.md +7 -0
  9. package/plugins/reasoning/evals/format-ids-and-supports/graders/supports-resolve.md +11 -0
  10. package/plugins/reasoning/evals/format-ids-and-supports/prompt.md +8 -0
  11. package/plugins/reasoning/evals/format-root-candidate-status/graders/candidate-status.md +11 -0
  12. package/plugins/reasoning/evals/format-root-candidate-status/graders/skill-fired.md +7 -0
  13. package/plugins/reasoning/evals/format-root-candidate-status/prompt.md +8 -0
  14. package/plugins/reasoning/evals/format-unsaved-continues/graders/analysis-completes.md +9 -0
  15. package/plugins/reasoning/evals/format-unsaved-continues/graders/not-saved-stated.md +9 -0
  16. package/plugins/reasoning/evals/format-unsaved-continues/graders/skill-fired.md +7 -0
  17. package/plugins/reasoning/evals/format-unsaved-continues/prompt.md +8 -0
  18. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-closest-available.md +5 -6
  19. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/no-improvised-levels.md +4 -6
  20. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/skill-fired.md +1 -1
  21. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/states-unavailable.md +4 -5
  22. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/systemic-design-fired.md +10 -0
  23. package/plugins/reasoning/evals/guardrail-unavailable-framework/prompt.md +2 -2
  24. package/plugins/reasoning/evals/ps-interview-first-question/graders/look-in-present.md +10 -0
  25. package/plugins/reasoning/evals/ps-interview-first-question/graders/no-fixed-exits.md +11 -0
  26. package/plugins/reasoning/evals/ps-interview-first-question/graders/options-from-input.md +15 -0
  27. package/plugins/reasoning/evals/ps-interview-first-question/graders/skill-fired.md +7 -0
  28. package/plugins/reasoning/evals/ps-interview-first-question/graders/source-hint.md +11 -0
  29. package/plugins/reasoning/evals/ps-interview-first-question/graders/targets-gap.md +13 -0
  30. package/plugins/reasoning/evals/ps-interview-first-question/prompt.md +8 -0
  31. package/plugins/reasoning/evals/ps-interview-five-whys/graders/look-in-present.md +10 -0
  32. package/plugins/reasoning/evals/ps-interview-five-whys/graders/no-fixed-exits.md +11 -0
  33. package/plugins/reasoning/evals/ps-interview-five-whys/graders/options-from-input.md +11 -0
  34. package/plugins/reasoning/evals/ps-interview-five-whys/graders/skill-fired.md +7 -0
  35. package/plugins/reasoning/evals/ps-interview-five-whys/graders/source-hint.md +11 -0
  36. package/plugins/reasoning/evals/ps-interview-five-whys/graders/targets-gap.md +15 -0
  37. package/plugins/reasoning/evals/ps-interview-five-whys/prompt.md +8 -0
  38. package/plugins/reasoning/evals/ps-router-handoff/graders/no-reselection.md +11 -0
  39. package/plugins/reasoning/evals/ps-router-handoff/graders/runs-rca.md +8 -0
  40. package/plugins/reasoning/evals/ps-router-handoff/graders/skill-fired.md +7 -0
  41. package/plugins/reasoning/evals/ps-router-handoff/prompt.md +11 -0
  42. package/plugins/reasoning/evals/routing-adaptive-discriminator/graders/confidence-single-word.md +10 -0
  43. package/plugins/reasoning/evals/routing-ambiguous-feature-request/graders/confidence-single-word.md +10 -0
  44. package/plugins/reasoning/evals/routing-classify-only/graders/confidence-single-word.md +10 -0
  45. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/confidence-single-word.md +10 -0
  46. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/no-unavailability-claim.md +10 -0
  47. package/plugins/reasoning/evals/routing-complex-delivery-slowdown/graders/confidence-single-word.md +10 -0
  48. package/plugins/reasoning/evals/routing-simple-null-pointer/graders/confidence-single-word.md +10 -0
  49. package/plugins/reasoning/evals/routing-thin-input-provisional/graders/confidence-single-word.md +10 -0
  50. package/plugins/reasoning/evals/sd-default-selection/graders/dates-traced.md +15 -0
  51. package/plugins/reasoning/evals/sd-default-selection/graders/interventions-cite-entries.md +12 -0
  52. package/plugins/reasoning/evals/sd-default-selection/graders/owners-from-input.md +8 -0
  53. package/plugins/reasoning/evals/sd-default-selection/graders/plan-steps-complete.md +21 -0
  54. package/plugins/reasoning/evals/sd-default-selection/graders/selects-systemic-design.md +12 -0
  55. package/plugins/reasoning/evals/sd-default-selection/graders/skill-fired.md +7 -0
  56. package/plugins/reasoning/evals/sd-default-selection/graders/systemic-design-fired.md +10 -0
  57. package/plugins/reasoning/evals/sd-default-selection/prompt.md +11 -0
  58. package/plugins/reasoning/evals/sd-named-framework-software/graders/names-no-skill.md +11 -0
  59. package/plugins/reasoning/evals/sd-named-framework-software/graders/no-systemic-block.md +10 -0
  60. package/plugins/reasoning/evals/sd-named-framework-software/graders/systemic-design-fired.md +10 -0
  61. package/plugins/reasoning/evals/sd-named-framework-software/prompt.md +8 -0
  62. package/plugins/reasoning/evals/sd-not-software/graders/no-systemic-block.md +10 -0
  63. package/plugins/reasoning/evals/sd-not-software/graders/says-out-of-scope.md +10 -0
  64. package/plugins/reasoning/evals/sd-not-software/prompt.md +8 -0
  65. package/plugins/reasoning/evals/sd-raw-input/graders/first-question-targets-model.md +11 -0
  66. package/plugins/reasoning/evals/sd-raw-input/graders/look-in-present.md +10 -0
  67. package/plugins/reasoning/evals/sd-raw-input/graders/model-gap-blocks-stop.md +14 -0
  68. package/plugins/reasoning/evals/sd-raw-input/graders/model-in-assumptions.md +13 -0
  69. package/plugins/reasoning/evals/sd-raw-input/graders/no-fixed-exits.md +11 -0
  70. package/plugins/reasoning/evals/sd-raw-input/graders/skill-fired.md +7 -0
  71. package/plugins/reasoning/evals/sd-raw-input/graders/systemic-design-fired.md +10 -0
  72. package/plugins/reasoning/evals/sd-raw-input/prompt.md +8 -0
  73. package/plugins/reasoning/evals/sd-theory-of-change/graders/links-carry-assumptions.md +9 -0
  74. package/plugins/reasoning/evals/sd-theory-of-change/graders/no-dates.md +8 -0
  75. package/plugins/reasoning/evals/sd-theory-of-change/graders/skill-fired.md +7 -0
  76. package/plugins/reasoning/evals/sd-theory-of-change/graders/systemic-design-fired.md +10 -0
  77. package/plugins/reasoning/evals/sd-theory-of-change/graders/toc-block.md +10 -0
  78. package/plugins/reasoning/evals/sd-theory-of-change/prompt.md +8 -0
  79. package/plugins/reasoning/evals/sd-three-horizons/graders/dates-are-assumptions.md +11 -0
  80. package/plugins/reasoning/evals/sd-three-horizons/graders/owners-are-roles.md +8 -0
  81. package/plugins/reasoning/evals/sd-three-horizons/graders/skill-fired.md +7 -0
  82. package/plugins/reasoning/evals/sd-three-horizons/graders/systemic-design-fired.md +10 -0
  83. package/plugins/reasoning/evals/sd-three-horizons/graders/three-horizons-block.md +10 -0
  84. package/plugins/reasoning/evals/sd-three-horizons/prompt.md +9 -0
  85. package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/edges-carry-support-labels.md +2 -2
  86. package/plugins/reasoning/evals/st-causal-loop-unclosed/graders/no-invented-delays.md +7 -4
  87. package/plugins/reasoning/evals/st-interview-first-question/graders/look-in-present.md +10 -0
  88. package/plugins/reasoning/evals/st-interview-first-question/graders/no-fixed-exits.md +11 -0
  89. package/plugins/reasoning/evals/st-interview-first-question/graders/options-from-input.md +11 -0
  90. package/plugins/reasoning/evals/st-interview-first-question/graders/skill-fired.md +7 -0
  91. package/plugins/reasoning/evals/st-interview-first-question/graders/source-hint.md +11 -0
  92. package/plugins/reasoning/evals/st-interview-first-question/graders/targets-gap.md +13 -0
  93. package/plugins/reasoning/evals/st-interview-first-question/prompt.md +8 -0
  94. package/plugins/reasoning/evals/st-selection-boundary/graders/one-block-only.md +9 -6
  95. package/plugins/reasoning/skills/problem-router/README.md +6 -0
  96. package/plugins/reasoning/skills/problem-router/SKILL.md +11 -11
  97. package/plugins/reasoning/skills/problem-router/references/contract.md +117 -16
  98. package/plugins/reasoning/skills/problem-solving/README.md +10 -0
  99. package/plugins/reasoning/skills/problem-solving/SKILL.md +15 -3
  100. package/plugins/reasoning/skills/problem-solving/references/contract.md +117 -16
  101. package/plugins/reasoning/skills/problem-solving/references/interview.md +68 -0
  102. package/plugins/reasoning/skills/systemic-design/README.md +45 -0
  103. package/plugins/reasoning/skills/systemic-design/SKILL.md +184 -0
  104. package/plugins/reasoning/skills/systemic-design/frameworks/systemic-design.md +39 -0
  105. package/plugins/reasoning/skills/systemic-design/frameworks/theory-of-change.md +34 -0
  106. package/plugins/reasoning/skills/systemic-design/frameworks/three-horizons.md +28 -0
  107. package/plugins/reasoning/skills/systemic-design/references/contract.md +205 -0
  108. package/plugins/reasoning/skills/systemic-design/references/interview.md +68 -0
  109. package/plugins/reasoning/skills/systems-thinking/README.md +13 -6
  110. package/plugins/reasoning/skills/systems-thinking/SKILL.md +18 -6
  111. package/plugins/reasoning/skills/systems-thinking/frameworks/causal-loop.md +5 -2
  112. package/plugins/reasoning/skills/systems-thinking/frameworks/leverage-points.md +16 -7
  113. package/plugins/reasoning/skills/systems-thinking/frameworks/system-map.md +4 -5
  114. package/plugins/reasoning/skills/systems-thinking/references/contract.md +117 -16
  115. package/plugins/reasoning/skills/systems-thinking/references/interview.md +68 -0
  116. package/plugins/solution-architect/.claude-plugin/plugin.json +1 -1
  117. package/plugins/solution-architect/skills/analyze-requirements/SKILL.md +3 -2
  118. package/plugins/solution-architect/skills/analyze-requirements/references/rewriting.md +108 -0
  119. package/plugins/solution-architect/skills/analyze-requirements/scripts/drift.mjs +64 -0
  120. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/cdp.mjs +4 -1
  121. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/drift.mjs +31 -0
  122. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/git-diff.mjs +27 -0
  123. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/quality-gate.mjs +16 -1
  124. package/plugins/solution-architect/skills/analyze-requirements/scripts/lib/state.mjs +52 -0
  125. package/plugins/solution-architect/skills/analyze-requirements/scripts/record.mjs +87 -0
  126. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift-cli.test.mjs +178 -0
  127. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/drift.test.mjs +76 -0
  128. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/git-diff.test.mjs +62 -0
  129. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/quality-gate.test.mjs +9 -0
  130. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/record-cli.test.mjs +136 -0
  131. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rerun-safety.test.mjs +53 -0
  132. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/rewriting.test.mjs +80 -0
  133. package/plugins/solution-architect/skills/analyze-requirements/scripts/test/state.test.mjs +123 -0
  134. package/plugins/solution-architect/skills/estimate/README.md +20 -15
  135. package/plugins/solution-architect/skills/estimate/SKILL.md +10 -6
  136. package/plugins/solution-architect/skills/estimate/assets/estimate-template-agentic.html +111 -138
  137. package/plugins/solution-architect/skills/estimate/assets/estimate-template.html +361 -247
  138. package/plugins/solution-architect/skills/estimate/assets/scores-review-template.html +5 -4
  139. package/plugins/solution-architect/skills/estimate/evals/evals.json +7 -7
  140. package/plugins/solution-architect/skills/estimate/references/agentic-estimation.md +4 -2
  141. package/plugins/solution-architect/skills/estimate/references/ai-multipliers.md +38 -82
  142. package/plugins/solution-architect/skills/estimate/references/interview.md +56 -35
  143. package/plugins/solution-architect/skills/estimate/references/scoring-guide.md +40 -4
  144. package/plugins/solution-architect/skills/estimate/references/techniques.md +29 -21
  145. package/plugins/solution-architect/skills/estimate/references/writing.md +75 -43
  146. package/plugins/solution-architect/skills/estimate/scripts/lib/checks.mjs +37 -5
  147. package/plugins/solution-architect/skills/estimate/scripts/lib/context-schema.mjs +35 -0
  148. package/plugins/solution-architect/skills/estimate/scripts/lib/estimate-math.mjs +17 -75
  149. package/plugins/solution-architect/skills/estimate/scripts/lib/inline.mjs +5 -5
  150. package/plugins/solution-architect/skills/estimate/scripts/lib/pricing.mjs +78 -0
  151. package/plugins/solution-architect/skills/estimate/scripts/lib/project-price.mjs +96 -0
  152. package/plugins/solution-architect/skills/estimate/scripts/lib/redact.mjs +67 -19
  153. package/plugins/solution-architect/skills/estimate/scripts/lib/roadmap.mjs +4 -5
  154. package/plugins/solution-architect/skills/estimate/scripts/lib/rollup.mjs +48 -73
  155. package/plugins/solution-architect/skills/estimate/scripts/lib/schema.mjs +28 -13
  156. package/plugins/solution-architect/skills/estimate/scripts/lib/score-csv.mjs +2 -2
  157. package/plugins/solution-architect/skills/estimate/scripts/lib/score-html.mjs +1 -1
  158. package/plugins/solution-architect/skills/estimate/scripts/lib/scoring.mjs +2 -2
  159. package/plugins/solution-architect/skills/estimate/scripts/render.mjs +1 -1
  160. package/plugins/solution-architect/skills/estimate/scripts/score-review.mjs +1 -1
  161. package/plugins/solution-architect/skills/estimate/scripts/test/browser-agentic.test.mjs +143 -0
  162. package/plugins/solution-architect/skills/estimate/scripts/test/browser.test.mjs +209 -50
  163. package/plugins/solution-architect/skills/estimate/scripts/test/compute.test.mjs +57 -32
  164. package/plugins/solution-architect/skills/estimate/scripts/test/e2e.test.mjs +52 -0
  165. package/plugins/solution-architect/skills/estimate/scripts/test/estimate-math.test.mjs +25 -112
  166. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-fail.md +0 -10
  167. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-estimation-pass.md +0 -10
  168. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/agentic-inputs.json +1 -7
  169. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/booking-inputs.json +11 -10
  170. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-fail.md +6 -0
  171. package/plugins/solution-architect/skills/estimate/scripts/test/fixtures/estimation-pass.md +17 -21
  172. package/plugins/solution-architect/skills/estimate/scripts/test/pricing.test.mjs +88 -0
  173. package/plugins/solution-architect/skills/estimate/scripts/test/project-price.test.mjs +93 -0
  174. package/plugins/solution-architect/skills/estimate/scripts/test/references.test.mjs +86 -24
  175. package/plugins/solution-architect/skills/estimate/scripts/test/render.test.mjs +185 -31
  176. package/plugins/solution-architect/skills/estimate/scripts/test/schema.test.mjs +114 -61
  177. package/plugins/solution-architect/skills/estimate/scripts/test/score-review.test.mjs +34 -1
  178. package/plugins/solution-architect/skills/estimate/scripts/test/validate.test.mjs +103 -9
  179. package/plugins/solution-architect/skills/estimate/scripts/test/xlsx-export.test.mjs +292 -71
  180. package/plugins/solution-architect/skills/new-lead/SKILL.md +4 -3
  181. package/plugins/solution-architect/skills/proposal/README.md +9 -7
  182. package/plugins/solution-architect/skills/proposal/SKILL.md +10 -7
  183. package/plugins/solution-architect/skills/proposal/evals/evals.json +29 -11
  184. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/ARCHITECTURE.md +65 -0
  185. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/brief.md +21 -0
  186. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation-inputs.json +126 -0
  187. package/plugins/solution-architect/skills/proposal/evals/fixtures/gate-check-unpriced-harborline/estimation.json +215 -0
  188. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation-inputs.json +224 -34
  189. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.json +103 -114
  190. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-harborline-dispatch/estimation.md +48 -22
  191. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation-inputs.json +211 -33
  192. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.json +102 -117
  193. package/plugins/solution-architect/skills/proposal/evals/fixtures/pre-fed-meridian-dental/estimation.md +48 -25
  194. package/plugins/solution-architect/skills/proposal/references/interview.md +3 -6
  195. package/plugins/solution-architect/skills/proposal/references/review.md +5 -4
  196. package/plugins/solution-architect/skills/proposal/references/writing.md +33 -31
  197. package/plugins/solution-architect/skills/proposal/scripts/derive.mjs +1 -1
  198. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-client.mjs +5 -22
  199. package/plugins/solution-architect/skills/proposal/scripts/lib/checks-doc.mjs +18 -8
  200. package/plugins/solution-architect/skills/proposal/scripts/lib/checks.mjs +6 -2
  201. package/plugins/solution-architect/skills/proposal/scripts/lib/figures.mjs +24 -33
  202. package/plugins/solution-architect/skills/proposal/scripts/lib/sections.mjs +1 -1
  203. package/plugins/solution-architect/skills/proposal/scripts/test/checks-client.test.mjs +50 -47
  204. package/plugins/solution-architect/skills/proposal/scripts/test/checks-doc.test.mjs +99 -40
  205. package/plugins/solution-architect/skills/proposal/scripts/test/docs.test.mjs +11 -5
  206. package/plugins/solution-architect/skills/proposal/scripts/test/e2e.test.mjs +1 -1
  207. package/plugins/solution-architect/skills/proposal/scripts/test/evals-fixtures.test.mjs +39 -0
  208. package/plugins/solution-architect/skills/proposal/scripts/test/figures.test.mjs +67 -54
  209. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-fail.md +6 -1
  210. package/plugins/solution-architect/skills/proposal/scripts/test/fixtures/proposal-pass.md +8 -12
  211. package/plugins/solution-architect/skills/proposal/scripts/test/render.test.mjs +1 -1
  212. package/plugins/solution-architect/skills/proposal/scripts/test/validate.test.mjs +3 -2
  213. package/plugins/reasoning/evals/guardrail-unavailable-framework/graders/names-owning-skill.md +0 -9
  214. package/plugins/reasoning/evals/routing-complex-adaptive-org-change/graders/states-systemic-design-unavailable.md +0 -15
  215. package/plugins/solution-architect/skills/estimate/scripts/lib/scenario-schema.mjs +0 -39
@@ -0,0 +1,80 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFileSync } from 'node:fs';
4
+
5
+ const ref = (f) => readFileSync(new URL(`../../references/${f}`, import.meta.url), 'utf8');
6
+ const skill = () => readFileSync(new URL('../../SKILL.md', import.meta.url), 'utf8');
7
+
8
+ // The guarantee is the ordering: the question is asked before the first write,
9
+ // or not at all. A half-written package waiting on an answer is the failure
10
+ // this whole feature exists to prevent.
11
+ test('the discipline puts the question before the first write', () => {
12
+ const doc = ref('rewriting.md');
13
+ assert.match(doc, /before the first write/i);
14
+ assert.match(doc, /drift\.mjs/, 'the reference must name the script that reports drift');
15
+ assert.match(doc, /written last|write it last/i, 'the state file ordering must be stated');
16
+ });
17
+
18
+ // Nothing writes the state file on its own. Without an instruction naming the
19
+ // tool, run 1 records nothing and run 2 has nothing to compare disk against —
20
+ // the gate reports a first run and the hand edit goes.
21
+ test('the discipline tells the run to record what it wrote', () => {
22
+ const doc = ref('rewriting.md');
23
+ assert.match(doc, /record\.mjs/, 'the reference must name the script that writes the state');
24
+ assert.match(doc, /--files/, 'and say which files go into it');
25
+ assert.match(doc, /"revision"/, 'the state file shape belongs in the reference once');
26
+ });
27
+
28
+ test('the skill runs the recorder at the end of step 5', () => {
29
+ assert.match(skill(), /record\.mjs/);
30
+ });
31
+
32
+ // The first run is the one where `untracked` matters — it is what stops a run
33
+ // pointed at a hand-written package from overwriting it. Prose that makes the
34
+ // gate conditional on a state file existing puts that verdict back out of
35
+ // reach, whatever the code does.
36
+ test('the gate is never conditional on a state file existing', () => {
37
+ const doc = ref('rewriting.md');
38
+ assert.match(doc, /gate[^.]*\bevery run\b/i, 'the reference must say the gate runs every run');
39
+ assert.doesNotMatch(doc, /gate[^.]*after\s+the\s+first/i, 'never "the gate runs after the first run"');
40
+ assert.doesNotMatch(skill(), /after\s+the\s+first[^.]*drift\.mjs|drift\.mjs[^.]*after\s+the\s+first/i);
41
+ });
42
+
43
+ // The hard rules are what an agent reads first and leans on hardest, so an
44
+ // unqualified "no entry means not ours" there outranks the verdict table: no
45
+ // ADR or companion could ever be created after run 1. Only a file that is
46
+ // actually on disk is someone else's.
47
+ test('the hard rule does not forbid creating a file that does not exist', () => {
48
+ const rule = skill().split('\n').find((l) => /^5\. /.test(l) && l.includes('architecture-state.json'));
49
+ assert.ok(rule, 'hard rule 5 must still be the one about the state file');
50
+ assert.doesNotMatch(rule, /a file with no entry[^;]*is not ours/i, 'no entry alone does not mean not ours');
51
+ assert.match(rule, /creat/i, 'the rule must leave room to create a file that does not exist yet');
52
+ });
53
+
54
+ // A hash cannot identify an author, and a message that claims it can is a lie
55
+ // the reader will believe.
56
+ test('the discipline never claims to know who edited a file', () => {
57
+ const doc = ref('rewriting.md');
58
+ assert.match(doc, /changed since|not.*who/i);
59
+ assert.doesNotMatch(doc, /you edited|the user edited/i);
60
+ });
61
+
62
+ // Every verdict the gate can print needs a row, or the agent meets one with no
63
+ // instruction. `new` is the one that lets run 2 add a document at all.
64
+ test('the verdict table covers a file that does not exist yet', () => {
65
+ assert.match(ref('rewriting.md'), /\|\s*`new`\s*\|/);
66
+ });
67
+
68
+ test('an accepted ADR is named as exempt', () => {
69
+ const doc = ref('rewriting.md');
70
+ assert.match(doc, /accepted/);
71
+ assert.match(doc, /supersed/i);
72
+ });
73
+
74
+ test('the skill runs the gate before writing', () => {
75
+ assert.match(skill(), /drift\.mjs/, 'SKILL.md must call the gate in its flow');
76
+ });
77
+
78
+ test('the reference stays inside the file-length limit', () => {
79
+ assert.ok(ref('rewriting.md').split('\n').length <= 200);
80
+ });
@@ -0,0 +1,123 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { normalise, hashText, sectionHashes, readState, writeState } from '../lib/state.mjs';
4
+ import { mkdtempSync, writeFileSync, readFileSync, existsSync, readdirSync } from 'node:fs';
5
+ import { tmpdir } from 'node:os';
6
+ import { join } from 'node:path';
7
+
8
+ // Line endings, trailing spaces and how many newlines a file ends with are
9
+ // editor artefacts. If they changed the hash, every run would report drift on
10
+ // files nobody touched, and people would learn to answer "overwrite" without
11
+ // reading — which is worse than having no guard at all.
12
+ test('editor artefacts hash the same', () => {
13
+ const base = '# Title\n\nbody\n';
14
+ for (const variant of ['# Title\r\n\r\nbody\r\n', '# Title\n\nbody \n', '# Title\n\nbody\n\n\n']) {
15
+ assert.equal(hashText(variant), hashText(base), JSON.stringify(variant));
16
+ }
17
+ });
18
+
19
+ // The other half of the same rule: normalisation must not be so eager that a
20
+ // real edit hashes as unchanged. That is the failure that loses data silently.
21
+ test('a real edit hashes differently', () => {
22
+ assert.notEqual(hashText('# Title\n\nbody\n'), hashText('# Title\n\nBody\n'));
23
+ assert.notEqual(hashText('| a | b |\n'), hashText('| a | b |\n'));
24
+ });
25
+
26
+ test('normalise leaves exactly one trailing newline', () => {
27
+ assert.equal(normalise('a'), 'a\n');
28
+ assert.equal(normalise('a\n\n\n'), 'a\n');
29
+ });
30
+
31
+ test('a hash is labelled with its algorithm', () => {
32
+ assert.match(hashText('x'), /^sha256:[0-9a-f]{64}$/);
33
+ });
34
+
35
+ const ARCH = `---
36
+ name: atlas
37
+ ---
38
+
39
+ # Atlas Architecture
40
+
41
+ ## 1 Goals and Scope
42
+
43
+ Assign jobs to drivers.
44
+
45
+ ## 13 Quality Requirements and SLOs
46
+
47
+ | scenario | measure | target | priority | src |
48
+ |---|---|---|---|---|
49
+ | peak checkout | p99 | 200 ms | must | stated |
50
+
51
+ ## 16 Glossary
52
+
53
+ | term | meaning | src |
54
+ |---|---|---|
55
+ | job | one delivery | stated |
56
+ `;
57
+
58
+ test('sections are keyed by their spine number', () => {
59
+ assert.deepEqual(Object.keys(sectionHashes(ARCH)), ['1', '13', '16']);
60
+ });
61
+
62
+ // The point of hashing per section: editing one must not move the others, or
63
+ // the fallback report names every section and tells the reader nothing.
64
+ test('editing one section moves only that section', () => {
65
+ const before = sectionHashes(ARCH);
66
+ const after = sectionHashes(ARCH.replace('200 ms', '150 ms'));
67
+ assert.equal(after['1'], before['1']);
68
+ assert.equal(after['16'], before['16']);
69
+ assert.notEqual(after['13'], before['13']);
70
+ });
71
+
72
+ // Frontmatter and the H1 belong to no section. Folding them into section 1
73
+ // would report a driver change every time the document version is bumped.
74
+ test('content before the first numbered heading is in no section', () => {
75
+ const after = sectionHashes(ARCH.replace('name: atlas', 'name: atlas-2'));
76
+ assert.deepEqual(after, sectionHashes(ARCH));
77
+ });
78
+
79
+ const tmp = () => mkdtempSync(join(tmpdir(), 'rerun-safety-'));
80
+
81
+ test('state survives a round trip', () => {
82
+ const path = join(tmp(), 'architecture-state.json');
83
+ const state = { revision: 2, files: { 'ARCHITECTURE.md': { hash: 'sha256:aa' } } };
84
+ writeState(path, state);
85
+ assert.deepEqual(readState(path).state, state);
86
+ });
87
+
88
+ test('an absent state file is not an error', () => {
89
+ assert.deepEqual(readState(join(tmp(), 'nope.json')), { state: null });
90
+ });
91
+
92
+ // A corrupt state file is the one case where deleting would be convenient and
93
+ // wrong: it is the only record of what the last run wrote.
94
+ test('a corrupt state file reads as absent, is reported, and is left alone', () => {
95
+ const path = join(tmp(), 'architecture-state.json');
96
+ writeFileSync(path, '{ not json');
97
+ const result = readState(path);
98
+ assert.equal(result.state, null);
99
+ assert.match(result.error, /unreadable/);
100
+ assert.equal(readFileSync(path, 'utf8'), '{ not json');
101
+ });
102
+
103
+ // Written last and atomically: a crash must leave the previous revision intact
104
+ // rather than a half-written file that the next run would trust.
105
+ test('writing leaves no temp file behind', () => {
106
+ const dir = tmp();
107
+ const path = join(dir, 'architecture-state.json');
108
+ writeState(path, { revision: 1, files: {} });
109
+ assert.deepEqual(readdirSync(dir), ['architecture-state.json']);
110
+ assert.equal(existsSync(`${path}.tmp`), false);
111
+ });
112
+
113
+ // The crash case itself. A write that dies partway must leave revision 1
114
+ // readable — that is what lets the next run treat the half-written documents
115
+ // as drifted and ask about them, instead of trusting them.
116
+ test('a failed write leaves the previous revision intact', () => {
117
+ const path = join(tmp(), 'architecture-state.json');
118
+ writeState(path, { revision: 1, files: {} });
119
+ const circular = { revision: 2 };
120
+ circular.self = circular;
121
+ assert.throws(() => writeState(path, circular));
122
+ assert.equal(readState(path).state.revision, 1);
123
+ });
@@ -6,18 +6,21 @@ interactive page.
6
6
  ## What it produces
7
7
 
8
8
  **`estimation.md`** — scope split into `stated` vs `proposed` items, a task-level
9
- backlog with confidence and assumptions per row, an AI-aware scenario comparison
10
- (team composition × AI assistance), and the technique used, all backed by
11
- `estimation.json` (the numbers every table cell comes from — nothing in the
12
- doc is hand-totaled).
9
+ backlog with confidence and assumptions per row, the score-driven price model
10
+ (five weighted factor scores per feature rolled up into a project price), and
11
+ the technique used, all backed by `estimation.json` (the numbers every table
12
+ cell comes from — nothing in the doc is hand-totaled).
13
13
 
14
14
  **An interactive page** (`estimate.html`) — the same data rendered as a
15
- self-contained, offline-capable HTML file: a Summary (recommended team, months,
16
- cost, and the committed alternatives), the feature breakdown (the interview's
17
- five factor scores per feature, Σ, tier and hours side by side; a
15
+ self-contained, offline-capable HTML file: a Summary (the presented range, the
16
+ single number, and the milestone shares), the feature breakdown (the
17
+ interview's five factor scores per feature, Σ, tier and hours side by side; a
18
18
  spreadsheet export with a scoring tab, a Score Rationale tab and a task
19
19
  tab), containers, roadmap and risks, served on `localhost:4173` (or the
20
- next free port).
20
+ next free port). Hours are planning detail — they size and order the task
21
+ backlog and roadmap shares — and never set price; only the feature scores do.
22
+ Agentic delivery is not priced under this model: the page shows measured hours
23
+ and states plainly that it is not priced, and a proposal cannot quote it.
21
24
 
22
25
  ## Two run modes
23
26
 
@@ -45,10 +48,11 @@ node scripts/render.mjs --json estimation.json --md estimation.md --out .
45
48
 
46
49
  `validate.mjs` must exit 0 before `render.mjs` will produce a page — an
47
50
  unvalidated estimate cannot ship. Add `--client-only` to `render.mjs` for a
48
- client-safe file with rates and the labor/tooling cost breakdown stripped from
49
- both the embedded data and the task register (totals and months stay) —
50
- unless `exposeRatesToClient: true` is set in `estimation-inputs.json`, which
51
- keeps them.
51
+ client-safe file with the pricing working stripped from both the embedded data
52
+ and the page — the context multiplier, the overhead lines, the adjusted base,
53
+ and each feature's tier and price band. The presented range, the single number
54
+ and the contingency rate always stay. Set `exposeRatesToClient: true` in
55
+ `estimation-inputs.json` to keep the working as well.
52
56
 
53
57
  ## Dependency
54
58
 
@@ -65,6 +69,7 @@ Node ≥ 20, declared in `SKILL.md`, the same as `analyze-requirements`.
65
69
  An estimate that hides its guesses is worse than no estimate — it looks precise
66
70
  right up until a date slips. estimate labels every scope item `stated` or
67
71
  `proposed`, renders anything nobody sized as `not estimated` rather than `0`,
68
- and never applies one blanket AI-speedup multiplier across a whole project —
69
- only per task category, because boilerplate and novel logic don't speed up the
70
- same amount.
72
+ and never applies one blanket price or multiplier to a feature — every feature
73
+ is scored on all five factors and the weighted score and bands set its price,
74
+ with uncertainty weighted heaviest (30%) and size lightest (10%), because
75
+ unclear requirements move the number more than volume of code does.
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: estimate
3
- description: Interview-driven project estimation with AI-aware delivery scenarios. Use when the user asks for an estimate, effort sizing, a quote, a timeline, staffing, or "how long would this take" — with or without existing architecture docs.
3
+ description: Interview-driven project estimation that prices work from weighted factor scores, not hours. Use when the user asks for an estimate, effort sizing, or a quote — with or without existing architecture docs. It produces a price, not a timeline or a staffing plan; asked "how long would this take", it says so and prices the scope instead.
4
4
  ---
5
5
 
6
6
  # estimate
7
7
 
8
8
  Produce an honest, validated estimate: confirmed scope split from assumptions,
9
- a technique that fits the evidence, AI-assisted staffing scenarios, and an
10
- interactive page served on localhost.
9
+ a technique that fits the evidence, a score-driven price band per feature,
10
+ and an interactive page served on localhost.
11
11
 
12
12
  ## Hard rules
13
13
 
@@ -16,8 +16,10 @@ interactive page served on localhost.
16
16
  2. Every scope item is labeled `stated` or `proposed` — no unlabeled scope.
17
17
  3. Agent judges, script computes: every number in a deliverable comes from
18
18
  `scripts/compute.mjs`. Never total, average, or price by hand.
19
- 4. Never apply one blanket AI multiplier to a whole project — per-task
20
- category only (`references/ai-multipliers.md`).
19
+ 4. Never apply one blanket price or multiplier to a feature — score all
20
+ five factors (`references/scoring-guide.md`) and let `pricing.mjs`'s
21
+ weighted score and bands set the price; the weights already encode what
22
+ matters most (uncertainty 30%, size 10% — `references/ai-multipliers.md`).
21
23
  5. `node scripts/validate.mjs` must exit 0 before the page renders.
22
24
  6. Agentic estimates: baselines and confidence come from scripts reading
23
25
  measurements.jsonl — the agent never writes a duration, confidence, or
@@ -36,7 +38,9 @@ interactive page served on localhost.
36
38
  `references/scoring-guide.md` before proposing any score; offer the
37
39
  review channel (terminal cards, csv, or html via
38
40
  `node scripts/score-review.mjs`). Before proposing milestones, read
39
- `references/slicing.md` — slices are judged there, not computed.
41
+ `references/slicing.md` — slices are judged there, not computed. Score
42
+ the five context factors too — four derived, one asked — per
43
+ `references/interview.md` §4.
40
44
  4. **Technique**: TRADITIONAL-only — recommend from `references/techniques.md`,
41
45
  state why, cite the method's sources (its §Sources — attribution + link,
42
46
  never quoted text), confirm. AGENTIC reads