@hxp-tools/godplans 0.0.0-stage → 2.0.1

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 (146) hide show
  1. package/CHANGELOG.md +1202 -0
  2. package/LICENSE +21 -0
  3. package/PROMPT.md +4006 -0
  4. package/README.md +245 -2
  5. package/bin/godplans.js +93 -0
  6. package/docs/ARCHITECTURE.md +136 -0
  7. package/docs/RELEASING.md +107 -0
  8. package/docs/assets/badge-approved.svg +12 -0
  9. package/docs/assets/badge-done.svg +11 -0
  10. package/docs/assets/badge-graded.svg +12 -0
  11. package/docs/assets/badge-validated.svg +10 -0
  12. package/docs/assets/hero.svg +37 -0
  13. package/docs/assets/quest-map.svg +53 -0
  14. package/evals/README.md +295 -0
  15. package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
  16. package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
  17. package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
  18. package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
  19. package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
  20. package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
  21. package/evals/cases/brownfield-cli/REQUEST.md +10 -0
  22. package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
  23. package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
  24. package/evals/cases/compliance-refusal/REQUEST.md +8 -0
  25. package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
  26. package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
  27. package/evals/cases/greenfield-saas/REQUEST.md +11 -0
  28. package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
  29. package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
  30. package/evals/cases/nested-pillars/REQUEST.md +11 -0
  31. package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
  32. package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
  33. package/evals/cases/observability-evidence/REQUEST.md +11 -0
  34. package/evals/cases/product-business/EXPECTATIONS +18 -0
  35. package/evals/cases/product-business/REQUEST.baseline.md +13 -0
  36. package/evals/cases/product-business/REQUEST.md +14 -0
  37. package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
  38. package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
  39. package/evals/cases/product-form-routing/REQUEST.md +11 -0
  40. package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
  41. package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
  42. package/evals/cases/prose-integrity/REQUEST.md +20 -0
  43. package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
  44. package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
  45. package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
  46. package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
  47. package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
  48. package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
  49. package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
  50. package/evals/cases/stale-prepublication/REQUEST.md +13 -0
  51. package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
  52. package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
  53. package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
  54. package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
  55. package/evals/cases/weekend-library/EXPECTATIONS +19 -0
  56. package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
  57. package/evals/cases/weekend-library/REQUEST.md +11 -0
  58. package/evals/cases-roster.txt +19 -0
  59. package/evals/external/GRADE.schema.json +39 -0
  60. package/evals/external/README.md +42 -0
  61. package/evals/external/RUBRIC.md +32 -0
  62. package/evals/metrics/context-cost.json +154 -0
  63. package/evals/outcomes/README.md +65 -0
  64. package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
  65. package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
  66. package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
  67. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
  68. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
  69. package/evals/runners/claude-baseline.sh +4 -0
  70. package/evals/runners/claude-grade.sh +3 -0
  71. package/evals/runners/claude.sh +4 -0
  72. package/evals/runners/codex-baseline.sh +181 -0
  73. package/evals/runners/codex-builder.sh +96 -0
  74. package/evals/runners/codex-godaudits.sh +84 -0
  75. package/evals/runners/codex.sh +147 -0
  76. package/evals/runners/gemini-baseline.sh +4 -0
  77. package/evals/runners/gemini-grade.sh +3 -0
  78. package/evals/runners/gemini.sh +4 -0
  79. package/evals/runners/vendor-cli.sh +257 -0
  80. package/evals/runners/vendor-grade.sh +82 -0
  81. package/install.sh +323 -0
  82. package/package.json +91 -4
  83. package/requirements/skills-ref.txt +2 -0
  84. package/scripts/build-catalog.js +114 -0
  85. package/scripts/build-prompt.sh +257 -0
  86. package/scripts/context-metrics.js +118 -0
  87. package/scripts/eval-external.js +226 -0
  88. package/scripts/eval-matrix.sh +172 -0
  89. package/scripts/eval-outcome.js +143 -0
  90. package/scripts/eval.sh +321 -0
  91. package/scripts/lint-parity.js +331 -0
  92. package/scripts/lint.sh +743 -0
  93. package/scripts/outcome-summary.js +126 -0
  94. package/scripts/release-check.sh +108 -0
  95. package/scripts/release-prepare.js +41 -0
  96. package/scripts/summarize-eval.js +91 -0
  97. package/scripts/summarize-matrix.js +101 -0
  98. package/scripts/version-sync.js +65 -0
  99. package/skills/godplans/SKILL.md +192 -0
  100. package/skills/godplans/references/agent-memory.md +168 -0
  101. package/skills/godplans/references/architecture.md +189 -0
  102. package/skills/godplans/references/build.md +130 -0
  103. package/skills/godplans/references/business.md +252 -0
  104. package/skills/godplans/references/code-quality.md +165 -0
  105. package/skills/godplans/references/compliance.md +59 -0
  106. package/skills/godplans/references/database.md +157 -0
  107. package/skills/godplans/references/deploy.md +146 -0
  108. package/skills/godplans/references/discovery.md +297 -0
  109. package/skills/godplans/references/doc-set.md +243 -0
  110. package/skills/godplans/references/exemplar.md +228 -0
  111. package/skills/godplans/references/launch.md +162 -0
  112. package/skills/godplans/references/llm.md +132 -0
  113. package/skills/godplans/references/observe.md +178 -0
  114. package/skills/godplans/references/plan-format.md +340 -0
  115. package/skills/godplans/references/product.md +130 -0
  116. package/skills/godplans/references/repo.md +184 -0
  117. package/skills/godplans/references/roadmap.md +158 -0
  118. package/skills/godplans/references/security.md +156 -0
  119. package/skills/godplans/references/seo.md +133 -0
  120. package/skills/godplans/references/stack.md +133 -0
  121. package/skills/godplans/references/style-genome.md +198 -0
  122. package/skills/godplans/references/ui.md +153 -0
  123. package/skills/godplans/references/ux.md +150 -0
  124. package/skills/godplans/schemas/PLAN.schema.json +275 -0
  125. package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
  126. package/skills/godplans/scripts/plan-halflife.sh +76 -0
  127. package/skills/godplans/scripts/style-stats.py +630 -0
  128. package/skills/godplans/scripts/validate-plan.sh +1709 -0
  129. package/skills/godplans/templates/PLAN.template.mdx +269 -0
  130. package/tests/agent-memory-guidance.sh +32 -0
  131. package/tests/build-catalog.sh +81 -0
  132. package/tests/codex-runner.sh +139 -0
  133. package/tests/eval-harness.sh +377 -0
  134. package/tests/evidence-harnesses.sh +243 -0
  135. package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
  136. package/tests/install-regression.sh +246 -0
  137. package/tests/lib/plan-schema-check.js +163 -0
  138. package/tests/lint-selftest.sh +582 -0
  139. package/tests/package-contents.sh +143 -0
  140. package/tests/portable-prompt.test.sh +261 -0
  141. package/tests/release-tooling.sh +204 -0
  142. package/tests/run.sh +14 -0
  143. package/tests/script-usage.sh +37 -0
  144. package/tests/style-stats.sh +170 -0
  145. package/tests/validate-plan.sh +1970 -0
  146. package/tests/vendor-runner.sh +291 -0
@@ -0,0 +1,275 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "godplans generated plan sidecar, format godplans/plan-json@2 (godplans 1.14.0 and later: 19 applicability rows)",
4
+ "type": "object",
5
+ "required": [
6
+ "format",
7
+ "plan_digest",
8
+ "name",
9
+ "plan_version",
10
+ "status",
11
+ "created",
12
+ "updated",
13
+ "mode",
14
+ "product_form",
15
+ "archetype",
16
+ "archetype_confidence",
17
+ "overlays",
18
+ "public_release",
19
+ "source_revision",
20
+ "input_digest",
21
+ "validated_at",
22
+ "progress",
23
+ "applicability",
24
+ "module_disposition",
25
+ "documentation",
26
+ "decisions",
27
+ "phases",
28
+ "tasks",
29
+ "superseded_tasks",
30
+ "metrics"
31
+ ],
32
+ "properties": {
33
+ "format": { "const": "godplans/plan-json@2" },
34
+ "plan_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
35
+ "name": { "type": "string", "minLength": 1 },
36
+ "plan_version": { "type": "integer", "minimum": 1 },
37
+ "status": { "enum": ["planning", "approved", "executing", "done"] },
38
+ "created": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", "format": "date" },
39
+ "updated": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$", "format": "date" },
40
+ "mode": { "enum": ["greenfield", "brownfield", "replan"] },
41
+ "product_form": {
42
+ "enum": [
43
+ "web-application",
44
+ "api-or-service",
45
+ "cli-or-sdk",
46
+ "mobile-or-desktop",
47
+ "data-or-ml",
48
+ "infrastructure-or-iac"
49
+ ]
50
+ },
51
+ "archetype": {
52
+ "enum": [
53
+ "cli-tool",
54
+ "library",
55
+ "api-service",
56
+ "saas-dashboard",
57
+ "marketing-site",
58
+ "mobile-app",
59
+ "ml-pipeline",
60
+ "extension",
61
+ "game",
62
+ "unknown"
63
+ ]
64
+ },
65
+ "archetype_confidence": { "enum": ["high", "medium", "low"] },
66
+ "overlays": {
67
+ "type": "array",
68
+ "uniqueItems": true,
69
+ "items": {
70
+ "enum": [
71
+ "ai-system",
72
+ "public-ui",
73
+ "shipped-artifact",
74
+ "operated-by-others",
75
+ "regulated-data",
76
+ "agent-skill-package",
77
+ "monetized"
78
+ ]
79
+ }
80
+ },
81
+ "public_release": { "type": "boolean" },
82
+ "source_revision": { "type": "string", "pattern": "^(?:none|[0-9a-f]{40,64})$" },
83
+ "input_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
84
+ "validated_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$" },
85
+ "progress": {
86
+ "type": "object",
87
+ "required": ["phases_total", "phases_done", "tasks_total", "tasks_done"],
88
+ "properties": {
89
+ "phases_total": { "type": "integer", "minimum": 1 },
90
+ "phases_done": { "type": "integer", "minimum": 0 },
91
+ "tasks_total": { "type": "integer", "minimum": 1 },
92
+ "tasks_done": { "type": "integer", "minimum": 0 }
93
+ },
94
+ "additionalProperties": false
95
+ },
96
+ "applicability": {
97
+ "type": "array",
98
+ "minItems": 19,
99
+ "maxItems": 19,
100
+ "items": {
101
+ "type": "object",
102
+ "required": ["domain", "status", "reason", "evidence_state", "revisit_when"],
103
+ "properties": {
104
+ "domain": { "type": "string", "minLength": 1 },
105
+ "status": { "enum": ["applicable", "deferred", "excluded"] },
106
+ "reason": { "type": "string" },
107
+ "evidence_state": { "type": ["string", "null"], "enum": ["absent", "by-design", null] },
108
+ "revisit_when": { "type": ["string", "null"] }
109
+ },
110
+ "additionalProperties": false
111
+ }
112
+ },
113
+ "module_disposition": {
114
+ "type": "array",
115
+ "items": {
116
+ "type": "object",
117
+ "required": ["module", "landed", "dropped"],
118
+ "properties": {
119
+ "module": { "type": "string", "minLength": 1 },
120
+ "landed": {
121
+ "type": "array",
122
+ "items": { "type": "string", "pattern": "^R-[A-Z][A-Z0-9-]*-[0-9]+$" }
123
+ },
124
+ "dropped": {
125
+ "type": "array",
126
+ "items": {
127
+ "type": "object",
128
+ "required": ["layer", "reason", "requirements"],
129
+ "properties": {
130
+ "layer": { "enum": ["scale", "archetype", "form"] },
131
+ "reason": { "type": "string", "minLength": 1 },
132
+ "requirements": {
133
+ "type": "array",
134
+ "items": { "type": "string", "pattern": "^R-[A-Z][A-Z0-9-]*-[0-9]+$" }
135
+ }
136
+ },
137
+ "additionalProperties": false
138
+ }
139
+ }
140
+ },
141
+ "additionalProperties": false
142
+ }
143
+ },
144
+ "documentation": {
145
+ "type": "array",
146
+ "minItems": 1,
147
+ "items": {
148
+ "type": "object",
149
+ "required": ["id", "stage", "verdict", "owner", "durability", "detail"],
150
+ "properties": {
151
+ "id": { "type": "string", "pattern": "^[a-z]+[.][a-z0-9-]+$" },
152
+ "stage": {
153
+ "enum": ["frame", "decide", "design", "build", "verify", "assure", "operate", "serve", "govern", "retire"]
154
+ },
155
+ "verdict": { "enum": ["required", "recommended", "optional", "not-applicable"] },
156
+ "owner": { "type": "string", "minLength": 1 },
157
+ "durability": { "enum": ["durable", "evidence", "transient"] },
158
+ "detail": { "type": "string" }
159
+ },
160
+ "additionalProperties": false
161
+ }
162
+ },
163
+ "decisions": {
164
+ "type": "array",
165
+ "minItems": 1,
166
+ "items": {
167
+ "type": "object",
168
+ "required": ["id", "title", "falsifier"],
169
+ "properties": {
170
+ "id": { "type": "string", "pattern": "^D[1-9][0-9]*$" },
171
+ "title": { "type": "string", "minLength": 1 },
172
+ "falsifier": {
173
+ "type": "object",
174
+ "required": ["signal", "failure_boundary", "replan_action"],
175
+ "properties": {
176
+ "signal": { "type": "string", "minLength": 1 },
177
+ "failure_boundary": { "type": "string", "minLength": 1 },
178
+ "replan_action": { "type": "string", "minLength": 1 }
179
+ },
180
+ "additionalProperties": false
181
+ }
182
+ },
183
+ "additionalProperties": false
184
+ }
185
+ },
186
+ "phases": {
187
+ "type": "array",
188
+ "minItems": 1,
189
+ "items": {
190
+ "type": "object",
191
+ "required": ["number", "name", "tasks"],
192
+ "properties": {
193
+ "number": { "type": "integer", "minimum": 1 },
194
+ "name": { "type": "string", "minLength": 1 },
195
+ "tasks": {
196
+ "type": "array",
197
+ "items": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" }
198
+ }
199
+ },
200
+ "additionalProperties": false
201
+ }
202
+ },
203
+ "tasks": {
204
+ "type": "array",
205
+ "minItems": 1,
206
+ "items": {
207
+ "type": "object",
208
+ "required": ["id", "phase", "wave", "done", "parallel", "files", "depends_on", "reuses", "acceptance", "verify", "requirements"],
209
+ "properties": {
210
+ "id": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" },
211
+ "phase": { "type": "integer", "minimum": 1 },
212
+ "wave": { "type": "string", "pattern": "^W[1-9][0-9]*[.][1-9][0-9]*$" },
213
+ "done": { "type": "boolean" },
214
+ "parallel": { "type": "boolean" },
215
+ "files": { "type": "string", "minLength": 1 },
216
+ "depends_on": { "type": "array", "items": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" } },
217
+ "reuses": { "type": "string", "minLength": 1 },
218
+ "acceptance": { "type": "string", "minLength": 1 },
219
+ "verify": { "type": "string", "minLength": 1 },
220
+ "requirements": { "type": "array", "minItems": 1, "items": { "type": "string", "pattern": "^R-(?:[0-9]+[.][0-9]+|[A-Z][A-Z0-9-]*-[0-9]+)$" } }
221
+ },
222
+ "additionalProperties": false
223
+ }
224
+ },
225
+ "superseded_tasks": {
226
+ "type": "array",
227
+ "items": {
228
+ "type": "object",
229
+ "required": ["id", "phase", "reason", "requirements"],
230
+ "properties": {
231
+ "id": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" },
232
+ "phase": { "type": ["integer", "null"] },
233
+ "reason": { "type": "string", "minLength": 1 },
234
+ "requirements": { "type": "array", "items": { "type": "string", "pattern": "^R-(?:[0-9]+[.][0-9]+|[A-Z][A-Z0-9-]*-[0-9]+)$" } }
235
+ },
236
+ "additionalProperties": false
237
+ }
238
+ },
239
+ "metrics": {
240
+ "type": "object",
241
+ "required": ["task_history", "domains"],
242
+ "properties": {
243
+ "task_history": {
244
+ "type": "object",
245
+ "required": ["active", "superseded", "historical", "supersession_rate", "survival_rate"],
246
+ "properties": {
247
+ "active": { "type": "integer", "minimum": 0 },
248
+ "superseded": { "type": "integer", "minimum": 0 },
249
+ "historical": { "type": "integer", "minimum": 0 },
250
+ "supersession_rate": { "type": "number", "minimum": 0, "maximum": 1 },
251
+ "survival_rate": { "type": "number", "minimum": 0, "maximum": 1 }
252
+ },
253
+ "additionalProperties": false
254
+ },
255
+ "domains": {
256
+ "type": "array",
257
+ "items": {
258
+ "type": "object",
259
+ "required": ["domain", "active", "superseded", "historical", "supersession_rate"],
260
+ "properties": {
261
+ "domain": { "type": "string", "minLength": 1 },
262
+ "active": { "type": "integer", "minimum": 0 },
263
+ "superseded": { "type": "integer", "minimum": 0 },
264
+ "historical": { "type": "integer", "minimum": 0 },
265
+ "supersession_rate": { "type": "number", "minimum": 0, "maximum": 1 }
266
+ },
267
+ "additionalProperties": false
268
+ }
269
+ }
270
+ },
271
+ "additionalProperties": false
272
+ }
273
+ },
274
+ "additionalProperties": false
275
+ }
@@ -0,0 +1,258 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "title": "godplans generated plan sidecar, format godplans/plan-json@1 (emitted by godplans 1.9.0 through 1.13.0: 18 applicability rows; parallel was added in 1.10.0 and archetype_confidence, overlays, module_disposition, documentation, evidence_state, and revisit_when in 1.11.0, so all of them are optional here)",
4
+ "type": "object",
5
+ "required": [
6
+ "format",
7
+ "plan_digest",
8
+ "name",
9
+ "plan_version",
10
+ "status",
11
+ "created",
12
+ "updated",
13
+ "mode",
14
+ "product_form",
15
+ "archetype",
16
+ "public_release",
17
+ "source_revision",
18
+ "input_digest",
19
+ "validated_at",
20
+ "progress",
21
+ "applicability",
22
+ "decisions",
23
+ "phases",
24
+ "tasks",
25
+ "superseded_tasks",
26
+ "metrics"
27
+ ],
28
+ "properties": {
29
+ "format": { "const": "godplans/plan-json@1" },
30
+ "plan_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
31
+ "name": { "type": "string", "minLength": 1 },
32
+ "plan_version": { "type": "integer", "minimum": 1 },
33
+ "status": { "enum": ["planning", "approved", "executing", "done"] },
34
+ "created": { "type": "string", "format": "date" },
35
+ "updated": { "type": "string", "format": "date" },
36
+ "mode": { "enum": ["greenfield", "brownfield", "replan"] },
37
+ "product_form": {
38
+ "enum": [
39
+ "web-application",
40
+ "api-or-service",
41
+ "cli-or-sdk",
42
+ "mobile-or-desktop",
43
+ "data-or-ml",
44
+ "infrastructure-or-iac"
45
+ ]
46
+ },
47
+ "archetype": { "type": "string", "minLength": 1 },
48
+ "archetype_confidence": { "enum": ["high", "medium", "low"] },
49
+ "overlays": {
50
+ "type": "array",
51
+ "uniqueItems": true,
52
+ "items": {
53
+ "enum": [
54
+ "ai-system",
55
+ "public-ui",
56
+ "shipped-artifact",
57
+ "operated-by-others",
58
+ "regulated-data",
59
+ "agent-skill-package"
60
+ ]
61
+ }
62
+ },
63
+ "public_release": { "type": "boolean" },
64
+ "source_revision": { "type": "string", "minLength": 1 },
65
+ "input_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
66
+ "validated_at": { "type": "string", "minLength": 1 },
67
+ "progress": {
68
+ "type": "object",
69
+ "required": ["phases_total", "phases_done", "tasks_total", "tasks_done"],
70
+ "properties": {
71
+ "phases_total": { "type": "integer", "minimum": 1 },
72
+ "phases_done": { "type": "integer", "minimum": 0 },
73
+ "tasks_total": { "type": "integer", "minimum": 1 },
74
+ "tasks_done": { "type": "integer", "minimum": 0 }
75
+ },
76
+ "additionalProperties": false
77
+ },
78
+ "applicability": {
79
+ "type": "array",
80
+ "minItems": 18,
81
+ "maxItems": 18,
82
+ "items": {
83
+ "type": "object",
84
+ "required": ["domain", "status", "reason"],
85
+ "properties": {
86
+ "domain": { "type": "string", "minLength": 1 },
87
+ "status": { "enum": ["applicable", "deferred", "excluded"] },
88
+ "reason": { "type": "string" },
89
+ "evidence_state": { "type": ["string", "null"], "enum": ["absent", "by-design", null] },
90
+ "revisit_when": { "type": ["string", "null"] }
91
+ },
92
+ "additionalProperties": false
93
+ }
94
+ },
95
+ "module_disposition": {
96
+ "type": "array",
97
+ "items": {
98
+ "type": "object",
99
+ "required": ["module", "landed", "dropped"],
100
+ "properties": {
101
+ "module": { "type": "string", "minLength": 1 },
102
+ "landed": {
103
+ "type": "array",
104
+ "items": { "type": "string", "pattern": "^R-[A-Z][A-Z0-9-]*-[0-9]+$" }
105
+ },
106
+ "dropped": {
107
+ "type": "array",
108
+ "items": {
109
+ "type": "object",
110
+ "required": ["layer", "reason", "requirements"],
111
+ "properties": {
112
+ "layer": { "enum": ["scale", "archetype", "form"] },
113
+ "reason": { "type": "string", "minLength": 1 },
114
+ "requirements": {
115
+ "type": "array",
116
+ "items": { "type": "string", "pattern": "^R-[A-Z][A-Z0-9-]*-[0-9]+$" }
117
+ }
118
+ },
119
+ "additionalProperties": false
120
+ }
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ }
125
+ },
126
+ "documentation": {
127
+ "type": "array",
128
+ "minItems": 1,
129
+ "items": {
130
+ "type": "object",
131
+ "required": ["id", "stage", "verdict", "owner", "durability", "detail"],
132
+ "properties": {
133
+ "id": { "type": "string", "pattern": "^[a-z]+[.][a-z0-9-]+$" },
134
+ "stage": {
135
+ "enum": ["frame", "decide", "design", "build", "verify", "assure", "operate", "serve", "govern", "retire"]
136
+ },
137
+ "verdict": { "enum": ["required", "recommended", "optional", "not-applicable"] },
138
+ "owner": { "type": "string", "minLength": 1 },
139
+ "durability": { "enum": ["durable", "evidence", "transient"] },
140
+ "detail": { "type": "string" }
141
+ },
142
+ "additionalProperties": false
143
+ }
144
+ },
145
+ "decisions": {
146
+ "type": "array",
147
+ "minItems": 1,
148
+ "items": {
149
+ "type": "object",
150
+ "required": ["id", "title", "falsifier"],
151
+ "properties": {
152
+ "id": { "type": "string", "pattern": "^D[1-9][0-9]*$" },
153
+ "title": { "type": "string", "minLength": 1 },
154
+ "falsifier": {
155
+ "type": "object",
156
+ "required": ["signal", "failure_boundary", "replan_action"],
157
+ "properties": {
158
+ "signal": { "type": "string", "minLength": 1 },
159
+ "failure_boundary": { "type": "string", "minLength": 1 },
160
+ "replan_action": { "type": "string", "minLength": 1 }
161
+ },
162
+ "additionalProperties": false
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ }
167
+ },
168
+ "phases": {
169
+ "type": "array",
170
+ "minItems": 1,
171
+ "items": {
172
+ "type": "object",
173
+ "required": ["number", "name", "tasks"],
174
+ "properties": {
175
+ "number": { "type": "integer", "minimum": 1 },
176
+ "name": { "type": "string", "minLength": 1 },
177
+ "tasks": {
178
+ "type": "array",
179
+ "minItems": 1,
180
+ "items": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" }
181
+ }
182
+ },
183
+ "additionalProperties": false
184
+ }
185
+ },
186
+ "tasks": {
187
+ "type": "array",
188
+ "minItems": 1,
189
+ "items": {
190
+ "type": "object",
191
+ "required": ["id", "phase", "wave", "done", "files", "depends_on", "reuses", "acceptance", "verify", "requirements"],
192
+ "properties": {
193
+ "id": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" },
194
+ "phase": { "type": "integer", "minimum": 1 },
195
+ "wave": { "type": "string", "pattern": "^W[1-9][0-9]*[.][1-9][0-9]*$" },
196
+ "done": { "type": "boolean" },
197
+ "parallel": { "type": "boolean" },
198
+ "files": { "type": "string", "minLength": 1 },
199
+ "depends_on": { "type": "array", "items": { "type": "string" } },
200
+ "reuses": { "type": "string", "minLength": 1 },
201
+ "acceptance": { "type": "string", "minLength": 1 },
202
+ "verify": { "type": "string", "minLength": 1 },
203
+ "requirements": { "type": "array", "minItems": 1, "items": { "type": "string" } }
204
+ },
205
+ "additionalProperties": false
206
+ }
207
+ },
208
+ "superseded_tasks": {
209
+ "type": "array",
210
+ "items": {
211
+ "type": "object",
212
+ "required": ["id", "phase", "reason", "requirements"],
213
+ "properties": {
214
+ "id": { "type": "string", "pattern": "^GP-[1-9][0-9]{2,}$" },
215
+ "phase": { "type": ["integer", "null"] },
216
+ "reason": { "type": "string" },
217
+ "requirements": { "type": "array", "items": { "type": "string" } }
218
+ },
219
+ "additionalProperties": false
220
+ }
221
+ },
222
+ "metrics": {
223
+ "type": "object",
224
+ "required": ["task_history", "domains"],
225
+ "properties": {
226
+ "task_history": {
227
+ "type": "object",
228
+ "required": ["active", "superseded", "historical", "supersession_rate", "survival_rate"],
229
+ "properties": {
230
+ "active": { "type": "integer", "minimum": 0 },
231
+ "superseded": { "type": "integer", "minimum": 0 },
232
+ "historical": { "type": "integer", "minimum": 0 },
233
+ "supersession_rate": { "type": "number", "minimum": 0, "maximum": 1 },
234
+ "survival_rate": { "type": "number", "minimum": 0, "maximum": 1 }
235
+ },
236
+ "additionalProperties": false
237
+ },
238
+ "domains": {
239
+ "type": "array",
240
+ "items": {
241
+ "type": "object",
242
+ "required": ["domain", "active", "superseded", "historical", "supersession_rate"],
243
+ "properties": {
244
+ "domain": { "type": "string", "minLength": 1 },
245
+ "active": { "type": "integer", "minimum": 0 },
246
+ "superseded": { "type": "integer", "minimum": 0 },
247
+ "historical": { "type": "integer", "minimum": 0 },
248
+ "supersession_rate": { "type": "number", "minimum": 0, "maximum": 1 }
249
+ },
250
+ "additionalProperties": false
251
+ }
252
+ }
253
+ },
254
+ "additionalProperties": false
255
+ }
256
+ },
257
+ "additionalProperties": false
258
+ }
@@ -0,0 +1,76 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Emit cumulative task-survival metrics from a validated PLAN.mdx.
4
+ # Bash 3.2, Perl, and a copy of validate-plan.sh are sufficient.
5
+
6
+ set -eu
7
+
8
+ usage() {
9
+ echo "Usage: $0 [PLAN.mdx] [OUTPUT.json]" >&2
10
+ }
11
+
12
+ for arg in "$@"; do
13
+ case "$arg" in
14
+ -h|--help) usage; exit 0 ;;
15
+ -*) usage; echo "Unknown option: $arg" >&2; exit 2 ;;
16
+ esac
17
+ done
18
+ if [ "$#" -gt 2 ]; then
19
+ usage
20
+ exit 2
21
+ fi
22
+
23
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
24
+ PLAN_FILE="${1:-.godplans/PLAN.mdx}"
25
+ OUTPUT_FILE="${2:-${PLAN_FILE%.mdx}.metrics.json}"
26
+ TMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/godplans-halflife.XXXXXX")"
27
+ SIDE_CAR="$TMP_DIR/PLAN.json"
28
+
29
+ trap 'rm -rf "$TMP_DIR"' EXIT HUP INT TERM
30
+
31
+ # Measure with the plan's own validator: override, then companion, then sibling.
32
+ VALIDATOR="${GODPLANS_VALIDATOR:-}"
33
+ if [ -z "$VALIDATOR" ]; then
34
+ VALIDATOR="$(dirname "$PLAN_FILE")/validate-plan.sh"
35
+ [ -f "$VALIDATOR" ] || VALIDATOR="$SCRIPT_DIR/validate-plan.sh"
36
+ fi
37
+
38
+ [ -f "$VALIDATOR" ] || {
39
+ echo "FAIL $PLAN_FILE: validator $VALIDATOR is missing" >&2
40
+ exit 1
41
+ }
42
+
43
+ bash "$VALIDATOR" --allow-planning --emit-json "$SIDE_CAR" "$PLAN_FILE" >/dev/null || {
44
+ echo "FAIL $PLAN_FILE: $VALIDATOR rejects it; set GODPLANS_VALIDATOR to the validator it was written against" >&2
45
+ exit 1
46
+ }
47
+
48
+ perl -MJSON::PP - "$SIDE_CAR" "$OUTPUT_FILE" <<'PERL'
49
+ use strict;
50
+ use warnings;
51
+
52
+ my ($sidecar, $output) = @ARGV;
53
+ open my $input_fh, '<:raw', $sidecar
54
+ or die "FAIL $sidecar: cannot read: $!\n";
55
+ local $/;
56
+ my $document = JSON::PP->new->decode(<$input_fh>);
57
+ close $input_fh;
58
+
59
+ my $result = {
60
+ format => 'godplans/plan-half-life@1',
61
+ plan_digest => $document->{plan_digest},
62
+ plan_version => $document->{plan_version},
63
+ metrics => $document->{metrics},
64
+ };
65
+
66
+ my $json = JSON::PP->new->canonical(1)->pretty->encode($result);
67
+ my $tmp = "$output.tmp.$$";
68
+ open my $output_fh, '>:raw', $tmp
69
+ or die "FAIL $tmp: cannot write: $!\n";
70
+ print {$output_fh} $json;
71
+ close $output_fh;
72
+ rename $tmp, $output
73
+ or die "FAIL $output: cannot replace atomically: $!\n";
74
+ PERL
75
+
76
+ echo "ok $OUTPUT_FILE"