@hxp-tools/godplans 0.0.0-stage → 2.0.0

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 (144) hide show
  1. package/CHANGELOG.md +1176 -0
  2. package/LICENSE +21 -0
  3. package/PROMPT.md +4006 -0
  4. package/README.md +201 -2
  5. package/assets/README.md +11 -0
  6. package/assets/hero.svg +44 -0
  7. package/assets/plan-loop.svg +62 -0
  8. package/assets/quest-map.svg +80 -0
  9. package/bin/godplans.js +93 -0
  10. package/docs/ARCHITECTURE.md +136 -0
  11. package/docs/RELEASING.md +107 -0
  12. package/evals/README.md +295 -0
  13. package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
  14. package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
  15. package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
  16. package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
  17. package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
  18. package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
  19. package/evals/cases/brownfield-cli/REQUEST.md +10 -0
  20. package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
  21. package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
  22. package/evals/cases/compliance-refusal/REQUEST.md +8 -0
  23. package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
  24. package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
  25. package/evals/cases/greenfield-saas/REQUEST.md +11 -0
  26. package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
  27. package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
  28. package/evals/cases/nested-pillars/REQUEST.md +11 -0
  29. package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
  30. package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
  31. package/evals/cases/observability-evidence/REQUEST.md +11 -0
  32. package/evals/cases/product-business/EXPECTATIONS +18 -0
  33. package/evals/cases/product-business/REQUEST.baseline.md +13 -0
  34. package/evals/cases/product-business/REQUEST.md +14 -0
  35. package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
  36. package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
  37. package/evals/cases/product-form-routing/REQUEST.md +11 -0
  38. package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
  39. package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
  40. package/evals/cases/prose-integrity/REQUEST.md +20 -0
  41. package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
  42. package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
  43. package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
  44. package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
  45. package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
  46. package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
  47. package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
  48. package/evals/cases/stale-prepublication/REQUEST.md +13 -0
  49. package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
  50. package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
  51. package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
  52. package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
  53. package/evals/cases/weekend-library/EXPECTATIONS +19 -0
  54. package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
  55. package/evals/cases/weekend-library/REQUEST.md +11 -0
  56. package/evals/cases-roster.txt +19 -0
  57. package/evals/external/GRADE.schema.json +39 -0
  58. package/evals/external/README.md +42 -0
  59. package/evals/external/RUBRIC.md +32 -0
  60. package/evals/metrics/context-cost.json +154 -0
  61. package/evals/outcomes/README.md +65 -0
  62. package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
  63. package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
  64. package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
  65. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
  66. package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
  67. package/evals/runners/claude-baseline.sh +4 -0
  68. package/evals/runners/claude-grade.sh +3 -0
  69. package/evals/runners/claude.sh +4 -0
  70. package/evals/runners/codex-baseline.sh +181 -0
  71. package/evals/runners/codex-builder.sh +96 -0
  72. package/evals/runners/codex-godaudits.sh +84 -0
  73. package/evals/runners/codex.sh +147 -0
  74. package/evals/runners/gemini-baseline.sh +4 -0
  75. package/evals/runners/gemini-grade.sh +3 -0
  76. package/evals/runners/gemini.sh +4 -0
  77. package/evals/runners/vendor-cli.sh +257 -0
  78. package/evals/runners/vendor-grade.sh +82 -0
  79. package/install.sh +323 -0
  80. package/package.json +92 -4
  81. package/requirements/skills-ref.txt +2 -0
  82. package/scripts/build-catalog.js +114 -0
  83. package/scripts/build-prompt.sh +257 -0
  84. package/scripts/context-metrics.js +118 -0
  85. package/scripts/eval-external.js +226 -0
  86. package/scripts/eval-matrix.sh +172 -0
  87. package/scripts/eval-outcome.js +143 -0
  88. package/scripts/eval.sh +321 -0
  89. package/scripts/lint-parity.js +331 -0
  90. package/scripts/lint.sh +743 -0
  91. package/scripts/outcome-summary.js +126 -0
  92. package/scripts/release-check.sh +108 -0
  93. package/scripts/release-prepare.js +41 -0
  94. package/scripts/summarize-eval.js +91 -0
  95. package/scripts/summarize-matrix.js +101 -0
  96. package/scripts/version-sync.js +65 -0
  97. package/skills/godplans/SKILL.md +192 -0
  98. package/skills/godplans/references/agent-memory.md +168 -0
  99. package/skills/godplans/references/architecture.md +189 -0
  100. package/skills/godplans/references/build.md +130 -0
  101. package/skills/godplans/references/business.md +252 -0
  102. package/skills/godplans/references/code-quality.md +165 -0
  103. package/skills/godplans/references/compliance.md +59 -0
  104. package/skills/godplans/references/database.md +157 -0
  105. package/skills/godplans/references/deploy.md +146 -0
  106. package/skills/godplans/references/discovery.md +297 -0
  107. package/skills/godplans/references/doc-set.md +243 -0
  108. package/skills/godplans/references/exemplar.md +228 -0
  109. package/skills/godplans/references/launch.md +162 -0
  110. package/skills/godplans/references/llm.md +132 -0
  111. package/skills/godplans/references/observe.md +178 -0
  112. package/skills/godplans/references/plan-format.md +340 -0
  113. package/skills/godplans/references/product.md +130 -0
  114. package/skills/godplans/references/repo.md +184 -0
  115. package/skills/godplans/references/roadmap.md +158 -0
  116. package/skills/godplans/references/security.md +156 -0
  117. package/skills/godplans/references/seo.md +133 -0
  118. package/skills/godplans/references/stack.md +133 -0
  119. package/skills/godplans/references/style-genome.md +198 -0
  120. package/skills/godplans/references/ui.md +153 -0
  121. package/skills/godplans/references/ux.md +150 -0
  122. package/skills/godplans/schemas/PLAN.schema.json +275 -0
  123. package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
  124. package/skills/godplans/scripts/plan-halflife.sh +76 -0
  125. package/skills/godplans/scripts/style-stats.py +630 -0
  126. package/skills/godplans/scripts/validate-plan.sh +1709 -0
  127. package/skills/godplans/templates/PLAN.template.mdx +269 -0
  128. package/tests/agent-memory-guidance.sh +32 -0
  129. package/tests/build-catalog.sh +81 -0
  130. package/tests/codex-runner.sh +139 -0
  131. package/tests/eval-harness.sh +377 -0
  132. package/tests/evidence-harnesses.sh +243 -0
  133. package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
  134. package/tests/install-regression.sh +246 -0
  135. package/tests/lib/plan-schema-check.js +163 -0
  136. package/tests/lint-selftest.sh +582 -0
  137. package/tests/package-contents.sh +140 -0
  138. package/tests/portable-prompt.test.sh +261 -0
  139. package/tests/release-tooling.sh +204 -0
  140. package/tests/run.sh +14 -0
  141. package/tests/script-usage.sh +37 -0
  142. package/tests/style-stats.sh +170 -0
  143. package/tests/validate-plan.sh +1970 -0
  144. package/tests/vendor-runner.sh +291 -0
@@ -0,0 +1,178 @@
1
+ # Observability planning module
2
+
3
+ Plans the observability sections of PLAN.mdx so the shipped system is monitorable by promise, not by chart count. The orchestrator loads this module for any archetype that runs a deployed service with users depending on it (saas-dashboard, api-service, ml-pipeline, mobile-app backend, cli with a hosted component). Excluded for pure libraries and static marketing sites without uptime promises; the exclusion reason goes in the applicability matrix.
4
+
5
+ ## Lineage
6
+
7
+ Descends from observe-ready, the shipping-tier skill that keeps a deployed app healthy once real users are on it. Its core discipline carries over intact: every charted, alerted, or SLO-ed number is bound to a promise or it is demoted; alerts derive from SLO burn rate, not resource thresholds; every page links a runbook that has actually been executed; and the whole observability surface must survive the incident it describes (the Slack Jan 2021, Roblox 73-hour, Datadog Mar 2023, Facebook 2021 circular-dependency pattern). godplans inverts these end-of-project audit checks into plan-time requirements: the plan names the journeys, SLOs, policies, and independence rows before a single metric is emitted.
8
+
9
+ ## Decisions to force
10
+
11
+ Ordered hardest to reverse first.
12
+
13
+ 1. Metrics backend pricing model and cardinality strategy. Question: per-time-series priced backend (Prometheus-style, Datadog custom metrics) or wide-event backend (Honeycomb-style, ClickHouse)? Hard to reverse because label choices ossify into every dashboard, alert query, and instrumentation call; a high-cardinality label (user_id, tenant_id) on a per-series backend produces a cost blowup that gets the pipeline disabled. Options: per-series backend with an explicit label exclusion list; wide-event backend accepting high cardinality; hybrid (metrics low-cardinality, events wide). Default: per-series backend plus a written cardinality budget listing which dimensions are excluded and where they live instead.
14
+
15
+ 2. Structured log schema and PII scrub point. Question: what is the one JSON log format, and is PII scrubbed at the collector or in each app? Hard to reverse because every service emits the schema and every saved query, alert, and runbook depends on field names; logs already written with PII cannot be retro-scrubbed. Options: app-level scrubbing per service; collector-level scrubbing (one chokepoint). Default: one JSON format with trace_id, service, level, timestamp, event as mandatory fields, PII scrubbed at the collector (GDPR-shaped default), retention aligned to purpose.
16
+
17
+ 3. Trace propagation and sampling strategy. Question: how does trace context cross every boundary in the dependency graph (sync HTTP, gRPC, async queues, serverless cold starts, fan-out), and is sampling head-based or tail-based? Hard to reverse because retrofitting propagation through async boundaries touches every producer and consumer, and trace data not kept at the time is gone forever. Options: OTel with head sampling; OTel with tail-based or error-biased sampling. Default: OTel context propagation across all boundary types named in the dependency graph, tail-based or error-biased sampling for any service backing a production SLO (head 1% is refused for those), trace retention at least as long as the SLO window.
18
+
19
+ 4. User journeys and SLO targets. Question: which named user journeys get promises, and what number does each promise? Hard to reverse because SLOs become external commitments and the entire alert tree derives from them; changing a target invalidates burn-rate math, budgets, and policies downstream. Options are the target tiers themselves (99.0, 99.5, 99.9), each validated against the dependency-chain ceiling: the product of upstream availabilities caps the downstream promise. Default: one SLI, one SLO number, one window, one computed error budget per journey, with feasibility math shown in the plan.
20
+
21
+ 5. Out-of-band hosting for the observability surface. Question: where do dashboards, alert routing, runbooks, status page, trace store, and on-call schedule live relative to the observed system? Hard to reverse because infrastructure sharing (same cluster, same SSO, same region, same Slack workspace tied to the app's identity provider) is baked in at provisioning time and only discovered during the outage. Options: fully separate provider; separate account and region of the same provider; documented exceptions with remediation. Default: each of the six surface rows reachable when the observed service is down, recorded in an independence table.
22
+
23
+ ## Plan requirements
24
+
25
+ R-OBS-1: PLAN.mdx must enumerate every service with its topology type (request-response, worker, batch, edge, scheduled, pipeline), the dependency graph between them, and the named user journeys, before any dashboard, alert, or SLO content.
26
+ Criterion: WHEN the observability section is emitted THE PLAN SHALL contain a service table with topology types, a dependency graph (mermaid), and a named user-journey list that all later SLO content references by name.
27
+
28
+ R-OBS-2: PLAN.mdx must classify every planned metric into exactly one of three lanes: SLI with a documented SLO, supporting diagnostic explicitly marked non-alerting, or removed. No unclassified metric may appear in any dashboard or alert task.
29
+ Criterion: IF a metric appears in a planned chart or alert THE PLAN SHALL show its lane, and WHEN the lane is diagnostic THE PLAN SHALL mark it non-alerting.
30
+
31
+ R-OBS-3: PLAN.mdx must define, for every named user journey, exactly one SLI with its measurement query shape, one SLO number, one window, and one computed error budget.
32
+ Criterion: WHEN a user journey is named THE PLAN SHALL contain a row with SLI, SLO target, window, and computed budget; IF any of the four is missing THE PLAN SHALL NOT mark the journey as promised.
33
+
34
+ R-OBS-4: PLAN.mdx must attach a written error-budget policy to every SLO, naming the trigger, the action, the stakeholder, and the exit criterion. An SLO without a policy is a paper SLO and the plan refuses to emit it.
35
+ Criterion: WHEN an SLO is stated THE PLAN SHALL include a policy with all four named fields; IF the policy is absent THE PLAN SHALL list the SLO on the paper-SLO watchlist instead of the promised table.
36
+
37
+ R-OBS-5: PLAN.mdx must show dependency-chain feasibility math for every SLO: the product of upstream availabilities is the ceiling, and no journey may promise above it.
38
+ Criterion: WHEN an SLO target is set THE PLAN SHALL state the upstream availability product and SHALL NOT set a target exceeding that ceiling without a named mitigation (redundancy, degradation path).
39
+
40
+ R-OBS-6: PLAN.mdx must declare the low-traffic exception for any journey with fewer requests than 10x the error budget per window: extended windows, synthetic traffic, or aggregation, chosen and stated.
41
+ Criterion: IF a journey's traffic is below 10x its error budget per window THE PLAN SHALL name which of the three low-traffic strategies applies.
42
+
43
+ R-OBS-7: PLAN.mdx must derive all pages from SLI burn rate using multi-window multi-burn-rate tiers (fast, medium, slow, drift). Cause-based signals (CPU, memory, disk, raw error count) are planned as diagnostics only and never page.
44
+ Criterion: WHEN an alert is planned at PAGE severity THE PLAN SHALL bind it to an SLI burn rate with at least two windows; IF an alert condition is cause-based THE PLAN SHALL route it to TICKET or LOG-ONLY.
45
+
46
+ R-OBS-8: PLAN.mdx must define the three-tier severity ladder (PAGE, TICKET, LOG-ONLY) and require every PAGE to carry a specific runbook URL (not a directory) and a named owner.
47
+ Criterion: WHEN a PAGE-tier alert is planned THE PLAN SHALL list its runbook URL and owner in the same table row; IF either is missing THE PLAN SHALL demote the alert to TICKET.
48
+
49
+ R-OBS-9: PLAN.mdx must plan deadman switches for every silent or heartbeat path (scheduled jobs, queue consumers, pipelines) and route alerts out-of-band so paging does not depend on the paged service.
50
+ Criterion: WHEN a service has topology type worker, batch, scheduled, or pipeline THE PLAN SHALL include a deadman switch task, and WHEN alert routing is planned THE PLAN SHALL name a delivery path independent of the observed system.
51
+
52
+ R-OBS-10: PLAN.mdx must plan one JSON log format across all services with trace_id, service, level, timestamp, and event fields, correlation-ID propagation across every call type in the dependency graph, PII scrubbing at the collector, and retention aligned to a stated purpose.
53
+ Criterion: WHEN logging tasks are emitted THE PLAN SHALL name the shared schema fields, the scrub point, and the retention period per log class; IF any call type in the graph lacks a propagation mechanism THE PLAN SHALL flag it as an open gap task.
54
+
55
+ R-OBS-11: PLAN.mdx must plan OTel trace propagation across every boundary type present in the dependency graph, including async queues and serverless cold starts, with tail-based or error-biased sampling for SLO-backed services and trace retention covering the SLO window. Span names are planned low-cardinality with no PII.
56
+ Criterion: WHEN a service backs a production SLO THE PLAN SHALL specify tail-based or error-biased sampling and SHALL NOT specify head-only 1% sampling; WHEN retention is stated THE PLAN SHALL set it at or above the longest SLO window.
57
+
58
+ R-OBS-12: PLAN.mdx must plan error tracking per service with release tagging tied to the deploy identifier, a PII scrubber, and a quarterly grouping-tuning pass on the top-20 signatures, so "did this error start with vX.Y.Z" is answerable.
59
+ Criterion: WHEN error-tracking setup is planned THE PLAN SHALL include a release-tag wiring task referencing the deploy release id and a recurring grouping-tuning entry.
60
+
61
+ R-OBS-13: PLAN.mdx must state a cardinality budget: which high-cardinality dimensions (user_id, request_id, tenant_id) are excluded from the metrics backend or moved to a wide-event store, matched to the backend's pricing model.
62
+ Criterion: IF the chosen metrics backend prices per time series THE PLAN SHALL list excluded high-cardinality labels and where each dimension lives instead.
63
+
64
+ R-OBS-14: PLAN.mdx must plan the primary dashboard so its first screen answers "is this service meeting its SLOs": at most 7 charts above the fold, the first chart is the burn-rate gauge, every chart bound to an SLO, SLI, or named diagnostic, golden signals (latency p50/p95/p99, traffic, errors, saturation) per journey are the only metrics above the fold.
65
+ Criterion: WHEN a dashboard is planned THE PLAN SHALL enumerate its above-the-fold charts with their bindings, SHALL cap them at 7, and SHALL place the burn-rate gauge first.
66
+
67
+ R-OBS-15: PLAN.mdx must attach owner and last_reviewed metadata to every planned dashboard and alert, and cap dashboards at 3 per service. Unowned artifacts are pruned from the plan, not muted.
68
+ Criterion: WHEN dashboards or alerts are planned THE PLAN SHALL list owner and review metadata per artifact and SHALL NOT plan more than 3 dashboards for one service without a stated reason.
69
+
70
+ R-OBS-16: PLAN.mdx must plan the observability-surface independence test as a first-class deliverable: a 6-row table (dashboards, alert routing, runbooks, status page, trace store, on-call schedule), each row reachable when the observed service is down, with remediation tasks or a justified exception for any failing row.
71
+ Criterion: WHEN the observability phase is emitted THE PLAN SHALL contain the 6-row independence table and one task per failing row.
72
+
73
+ R-OBS-17: PLAN.mdx must plan one executable runbook per PAGE (real commands with exact flags, not "check the logs"), hosted out-of-band, linked from the alert, with a last_executed field kept within 90 days via a quarterly tabletop cadence on the calendar.
74
+ Criterion: WHEN a runbook task is planned THE PLAN SHALL require executable commands and an out-of-band host in its acceptance criteria, and THE PLAN SHALL schedule a recurring tabletop task.
75
+
76
+ R-OBS-18: PLAN.mdx must plan the incident-response loop: a SEV-1/2/3 ladder with response expectations, a named incident-commander rotation, a status-page update cadence, and templated customer comms.
77
+ Criterion: WHEN the incident section is emitted THE PLAN SHALL define all four elements; IF the team is a solo builder THE PLAN SHALL still name the single responder and the status-page cadence.
78
+
79
+ R-OBS-19: PLAN.mdx must plan the learning loop: a blameless post-mortem template, a rule that every post-mortem emits at least one observability-gap action item with a sprint-bounded due date, and a quarterly alert-pruning cadence covering dead alerts, never-fired alerts, and alerts dismissed more than 3 times without action.
80
+ Criterion: WHEN post-mortem process is planned THE PLAN SHALL bind action items to sprint-bounded due dates and SHALL schedule the pruning cadence as a recurring task.
81
+
82
+ R-OBS-20: PLAN.mdx must scope observability at the bright line against product analytics: "are signups failing more than the SLO allows" is in scope, "did signup conversion go up" is not and lives in the business metric register when R-BIZ-3 lands, and must carry the paper-SLO watchlist forward so any SLO missing its policy or measurement query stays visible until fixed.
83
+ Criterion: IF a planned metric measures business conversion rather than promise compliance THE PLAN SHALL move it from the observability section to the metric register when R-BIZ-3 lands, or exclude it otherwise, and WHEN any SLO lacks a policy or query THE PLAN SHALL list it on the paper-SLO watchlist in the Open Questions section.
84
+
85
+ R-OBS-21: PLAN.mdx must separate `installation-ready` from `operationally-mature`. Installation requires telemetry, SLOs, policies, dashboards, routes, and runbooks plus one controlled production-equivalent signal labeled synthetic. Operational maturity requires evidence from a real recent service event and tuning outcome, or remains `not-yet-evidenced`. A controlled fire is never rewritten as real incident history.
86
+ Criterion: WHEN observability completion evidence is planned THE PLAN SHALL record the two states independently, SHALL allow a synthetic controlled fire to prove installation only, and SHALL require real-event evidence before claiming operational maturity.
87
+
88
+ R-OBS-22: PLAN.mdx never invents an operational number. Availability targets, latency objectives, error budgets, recovery time and recovery point objectives, retention periods, and support windows are commitments a human owns, and none of them is derivable from a plan. Each is taken from a source the plan cites (an existing contract, a stated user answer, a measured baseline with its measurement named), or it goes to `## Open Questions` with an owner, a decide-by moment, and a recommended default that the plan executes on. A number the plan chooses on the user's behalf is legitimate only as a `### D<n>` decision whose falsifier boundary is that same number, so the commitment is visible and falsifiable rather than assumed.
89
+ Criterion: WHEN an SLO, error budget, recovery objective, retention period, or support window appears, THE PLAN SHALL attach a cited source, a user answer, or a Decisions entry with a falsifier; ELSE THE PLAN SHALL move it to Open Questions with an owner, a decide-by moment, and a recommended default, and SHALL NOT state it as a settled target.
90
+
91
+ ## Task seeds
92
+
93
+ - [ ] GP-xxx Define user journeys, service topology, and SLO table
94
+ - Files: observability/SLOS.md, docs/topology.md
95
+ - Acceptance: every journey row has SLI query, target, window, computed budget; service table lists topology type per service; dependency graph present as a mermaid fence
96
+ - Verify: grep -q '| SLI' observability/SLOS.md && grep -q 'graph TD' docs/topology.md
97
+ - Requirements: R-OBS-1, R-OBS-3, R-OBS-5
98
+
99
+ - [ ] GP-xxx Write error-budget policies per SLO
100
+ - Files: observability/SLOS.md
101
+ - Acceptance: each SLO section contains Trigger, Action, Stakeholder, Exit lines; no SLO row without a policy block
102
+ - Verify: test "$(grep -c '^Trigger:' observability/SLOS.md)" -eq "$(grep -c '| SLO' observability/SLOS.md)"
103
+ - Requirements: R-OBS-4, R-OBS-20
104
+
105
+ - [ ] GP-xxx Implement structured logging baseline
106
+ - Files: src/lib/logger.ts, infra/collector/pipeline.yaml
107
+ - Acceptance: logger emits JSON with trace_id, service, level, timestamp, event; collector config contains a PII scrub processor; retention period stated per log class
108
+ - Verify: grep -q 'trace_id' src/lib/logger.ts && grep -q 'scrub' infra/collector/pipeline.yaml
109
+ - Requirements: R-OBS-10
110
+
111
+ - [ ] GP-xxx Wire burn-rate alert rules with runbook links
112
+ - Files: infra/alerts/burn-rates.yaml, observability/ALERTS.md
113
+ - Acceptance: every PAGE rule references an SLI burn rate with at least two windows; every PAGE rule carries runbook_url and owner; cause-based rules routed to TICKET or LOG-ONLY only
114
+ - Verify: test "$(grep -c 'runbook_url' infra/alerts/burn-rates.yaml)" -ge "$(grep -c 'severity: page' infra/alerts/burn-rates.yaml)"
115
+ - Requirements: R-OBS-7, R-OBS-8, R-OBS-9
116
+
117
+ - [ ] GP-xxx Build the primary SLO dashboard spec
118
+ - Files: observability/DASHBOARDS.md, infra/dashboards/primary.json
119
+ - Acceptance: at most 7 above-the-fold charts each bound to an SLO, SLI, or named diagnostic; first chart is the burn-rate gauge; owner and last_reviewed present per dashboard
120
+ - Verify: test $(grep -c 'above_fold: true' observability/DASHBOARDS.md) -le 7 && grep -q 'owner:' observability/DASHBOARDS.md
121
+ - Requirements: R-OBS-2, R-OBS-14, R-OBS-15
122
+
123
+ - [ ] GP-xxx Run the observability-surface independence test
124
+ - Files: observability/INDEPENDENCE.md
125
+ - Acceptance: 6 rows (dashboards, alert routing, runbooks, status page, trace store, on-call schedule) each marked reachable-when-down or linked to a remediation task or justified exception
126
+ - Verify: test $(grep -cE '^\| (dashboards|alert routing|runbooks|status page|trace store|on-call)' observability/INDEPENDENCE.md) -eq 6
127
+ - Requirements: R-OBS-16
128
+
129
+ - [ ] GP-xxx Author executable runbooks and schedule tabletops
130
+ - Files: runbooks/<alert-slug>.md, observability/RUNBOOKS.md
131
+ - Acceptance: one runbook per PAGE alert; each contains fenced command blocks with exact flags; each carries last_executed; quarterly tabletop entry on the calendar file
132
+ - Verify: ls runbooks/*.md >/dev/null && test "$(grep -rL 'last_executed:' runbooks/ | wc -l)" -eq 0
133
+ - Requirements: R-OBS-17
134
+
135
+ - [ ] GP-xxx Establish incident response and learning loop
136
+ - Files: observability/INCIDENTS.md, observability/templates/post-mortem.md
137
+ - Acceptance: SEV-1/2/3 ladder with response expectations; incident-commander rotation named; post-mortem template contains an observability-gap action-item section with a due-date field; quarterly alert-pruning cadence listed
138
+ - Verify: grep -q 'SEV-1' observability/INCIDENTS.md && grep -q 'due_date' observability/templates/post-mortem.md
139
+ - Requirements: R-OBS-18, R-OBS-19
140
+
141
+ - [ ] GP-xxx Prove installation readiness without fabricating maturity
142
+ - Files: observability/STATE.md, observability/CONTROLLED-FIRE.md
143
+ - Acceptance: STATE.md records installation-ready with a controlled production-equivalent signal labeled synthetic; operational maturity is not-yet-evidenced unless a real recent service event and tuning result are cited; controlled-fire evidence is never listed as incident history
144
+ - Verify: grep -q '^installation_status: installation-ready$' observability/STATE.md && grep -q '^signal_type: synthetic$' observability/CONTROLLED-FIRE.md && ! grep -q 'operational_maturity: operationally-mature' observability/STATE.md
145
+ - Requirements: R-OBS-17, R-OBS-21
146
+
147
+ ## Self-audit rubric
148
+
149
+ Derived from observe-ready's 4-tier model (Instrumented, Promised, Traceable, Rehearsed) with its have-nots list applied as deductions. 100 points total.
150
+
151
+ - Promise binding and SLO design (25): full marks when every journey is named with one SLI, one SLO, one window, one computed budget, a four-field error-budget policy, dependency-chain feasibility math, and the low-traffic exception declared where it applies; every planned metric sits in one of the three lanes; and every operational number carries a cited source, a user answer, a falsifiable Decisions entry, or an Open Questions ticket with a recommended default. An invented target caps this dimension at half regardless of the rest.
152
+ - Alert derivation and severity (20): full marks when all PAGE alerts are multi-window burn-rate on SLIs, the three-tier ladder is defined, every PAGE has a runbook URL and owner, deadman switches cover silent paths, routing is out-of-band, and a prune cadence exists.
153
+ - Logging, tracing, and error tracking (20): full marks when one JSON schema with the five mandatory fields spans all services, correlation IDs propagate across every call type in the graph, PII is scrubbed at the collector, SLO services get tail-based or error-biased sampling with retention covering the SLO window, and error tracking carries release tags.
154
+ - Dashboard discipline and independence (15): full marks when the primary dashboard has at most 7 bound charts led by the burn-rate gauge, every artifact carries owner and last_reviewed, the 3-dashboard cap holds, and the 6-row independence table is complete with remediations.
155
+ - Runbook and incident loop (15): full marks when every PAGE has an executable out-of-band runbook, controlled production-equivalent evidence proves installation and stays labeled synthetic, operational maturity is backed only by real-event tuning evidence, and the post-mortem loop is scheduled.
156
+ - Cost and cardinality (5): full marks when the cardinality budget names excluded labels matched to the backend pricing model and states retention and sampling costs.
157
+
158
+ Any gate hit (paper SLO, blind dashboard chart, PAGE without runbook, single-window burn alert, in-band surface row without remediation) caps the domain score at 84 regardless of points, forcing revision.
159
+
160
+ ## Anti-patterns refused
161
+
162
+ - Paper SLO: an SLO with no error-budget policy or no measurement query. The planner moves it to the paper-SLO watchlist and refuses to count the journey as promised.
163
+ - Blind dashboard: 40 charts and a dozen alerts with no statement of which is the SLO for which journey. The planner refuses the dump and plans only lane-classified metrics.
164
+ - Paper runbook: no last_executed within 90 days, or prose like "check the logs" instead of commands. The planner requires executable blocks and schedules the tabletop that keeps the date fresh.
165
+ - Cause-based paging: CPU over 80 percent or error count over zero wired to the pager. The planner routes cause signals to diagnostics and pages only on burn rate.
166
+ - Single-window burn alert: one window, one threshold. The planner emits multi-window multi-burn-rate tiers or nothing.
167
+ - Circular observability surface: dashboards, routing, or runbooks hosted on the system they observe (the Slack, Roblox, Datadog, Facebook pattern). The planner fails the independence row and emits a remediation task.
168
+ - Sprawl at birth: an "add monitoring" pass emitting 20+ monitors or 5+ dashboards with no ownership, SLO mapping, or pruning policy. The planner caps dashboards at 3 per service and requires owner metadata before any artifact enters the plan.
169
+ - Alert fatigue: an alert dismissed more than 3 times without tuning, or never-fired alerts kept alive. The planner schedules the quarterly prune and the post-incident tuning pass.
170
+ - Head-only 1% sampling on an SLO service: cheap sampling that misses the errors the SLO cares about. The planner specifies tail-based or error-biased sampling for any SLO-backed service.
171
+ - Orphan artifacts: dashboards or alerts with no owner or last_reviewed. The planner prunes them from the plan rather than muting them.
172
+ - PII in logs: user.email, phone, authorization headers, card data, or full request bodies emitted without the scrubber. The planner places the scrub at the collector and lists banned fields.
173
+ - Cardinality blowup: user_id or request_id as a metric label on a per-series priced backend. The planner requires the exclusion rule or a wide-event store before the label is planned.
174
+ - Untagged errors: error-tracking config with no release tag, making "did vX.Y.Z cause this" unanswerable. The planner wires release tagging to the deploy identifier.
175
+ - Silent heartbeat: a scheduled job or queue consumer with no deadman switch, failing silently. The planner adds a deadman task for every worker, batch, scheduled, or pipeline service.
176
+ - Analytics scope creep: conversion and engagement metrics smuggled into the observability section. The planner applies the bright line and moves them to the R-BIZ-3 metric register when it lands; only promise compliance stays.
177
+ - Synthetic incident laundering: a controlled fire is presented as real incident history or operational maturity. The planner labels it synthetic, uses it only for installation-ready evidence, and leaves maturity not-yet-evidenced until a real event produces tuning evidence.
178
+ - Invented target: "99.9 percent availability" or "RTO 4 hours" written because the section needed a number. The planner cites the source, records it as a falsifiable decision, or opens a question with a recommended default; an invented threshold gets quoted back later as though somebody had committed to it.
@@ -0,0 +1,340 @@
1
+ # PLAN.mdx format contract
2
+
3
+ The canonical output of godplans is `.godplans/PLAN.mdx`. Every emission also copies the self-contained validator to `.godplans/validate-plan.sh`, so a standalone plan carries its machine gate without requiring godplans to remain installed. A PLAN without that executable, byte-identical companion is an incomplete emission and must not be presented. This module is the binding contract for the plan: structure, task grammar, visual layer, MDX safety, and the executor rules embedded in every plan. Read this whole file before assembling a plan; do not author the plan from memory of it.
4
+
5
+ ## Why MDX, and the GFM-safe rule
6
+
7
+ The plan ships as `.mdx` so it drops straight into MDX pipelines (Docusaurus, Nextra, Fumadocs) and MDX-native plan viewers. But the body is written **GFM-safe**: plain GitHub-flavored markdown that is simultaneously valid MDX. No JSX components, no ESM imports, no expressions. The same bytes parse as `.mdx` and render as `.md`. A user who wants GitHub's rich rendering renames the file to `PLAN.md` and loses nothing.
8
+
9
+ GFM-safe means these MDX hazards are banned in prose:
10
+
11
+ - No bare `<` followed by a letter (MDX reads it as a JSX tag and fails). Write `less than`, or put the expression in backticks.
12
+ - No bare `{` or `}` in prose (MDX reads them as expressions). Put anything with braces in backticks or fenced code.
13
+ - No capitalized tag-like tokens such as writing a generic type without backticks. All code fragments, generics, paths, and shell snippets go in backticks or fences, where MDX leaves them alone.
14
+ - HTML comments do not survive MDX. Do not use them; the plan has no hidden content.
15
+
16
+ Also banned everywhere in the plan, matching godplans house style: em dashes, en dashes, Unicode arrows (ASCII `->` only), box-drawing characters, emojis, smart quotes, and the ellipsis character.
17
+
18
+ ## Claims and evidence
19
+
20
+ A plan makes two kinds of statement, and they are held to different bars.
21
+
22
+ **A decision** is the plan's own choice. It needs a rationale, rejected alternatives, and a falsifier. Nothing outside the plan has to support it, because the plan is where it becomes true.
23
+
24
+ **A claim about the world** is a statement about the existing codebase, the user's constraints, the platform, or a regime. It carries its source in the sentence: a repository-relative path with a symbol name or a verbatim anchor (never a bare line number, which does not survive a reformat), a command with its output, an external reference, or an explicit attribution to what the user said. A claim about the world with no source is a guess wearing a plan's clothes, and brownfield plans are made almost entirely of them.
25
+
26
+ Two rules follow, and both are violated more often than the ban on vague acceptance criteria:
27
+
28
+ - **An exhaustive or negative claim needs a command, not a file.** "Every handler validates its input", "no route bypasses the session middleware", "there are no other callers": a path citation resolves one symbol in one file and cannot carry any of those. Run the search and cite the command, narrow the claim to the set actually inspected, or mark it as an assumption with a validation task. This is the one class of claim that reads most confident and is checked least.
29
+ - **No number is invented.** Availability targets, recovery objectives, retention periods, error budgets, review cadences, latency thresholds quoted as existing behavior, and user counts are decisions somebody owns. A number is cited to a source, taken from the user's answer, or it belongs in `## Open Questions` with a recommended default. A threshold invented at plan time is quoted back six months later as though somebody had committed to it. A number the plan *chooses* is different and legitimate: it lands in `## Decisions` as a decision with a falsifier whose failure boundary is that same number.
30
+
31
+ ## Frontmatter (machine state)
32
+
33
+ ```yaml
34
+ ---
35
+ name: <project-slug>
36
+ plan_version: 1
37
+ status: planning
38
+ created: YYYY-MM-DD
39
+ updated: YYYY-MM-DD
40
+ mode: greenfield
41
+ product_form: web-application
42
+ archetype: saas-dashboard
43
+ archetype_confidence: high
44
+ overlays: [public-ui, regulated-data]
45
+ public_release: true
46
+ source_revision: 0123456789abcdef0123456789abcdef01234567
47
+ input_digest: sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
48
+ validated_at: 2026-07-13T12:00:00Z
49
+ domains_applicable: [product, architecture, stack, database, security, ...]
50
+ domains_deferred: [observe, seo]
51
+ domains_excluded: [llm]
52
+ progress:
53
+ phases_total: 0
54
+ phases_done: 0
55
+ tasks_total: 0
56
+ tasks_done: 0
57
+ ---
58
+ ```
59
+
60
+ Allowed modes are `greenfield`, `brownfield`, and `replan`. Frontmatter is the digest, not the truth. The truth is the checkboxes; `progress` counters are derived from them and updated in the same edit that flips a box. `tasks_total` and `tasks_done` count active task definition header lines. `phases_total` counts numbered phase headings, and a phase contributes to `phases_done` only when every active task in it is checked. If counters disagree, recount from the task definitions. The three domain lists are an index into the applicability matrix, so each carries bare domain names in a single inline list and nothing else: the trigger and the reversibility reason live in the matrix row, which is the one place a domain's disposition is decided. The validator recomputes all three lists from the matrix and fails on any disagreement.
61
+
62
+ Allowed product forms are `web-application`, `api-or-service`, `cli-or-sdk`, `mobile-or-desktop`, `data-or-ml`, and `infrastructure-or-iac`. `public_release` is `true` only when execution can activate a public site, service, package, store artifact, model, or infrastructure surface. Internal and local-only projects set it to `false`; they do not inherit a public-activation gate.
63
+
64
+ `archetype` is one of the nine archetypes `discovery.md` scores (`cli-tool`, `library`, `api-service`, `saas-dashboard`, `marketing-site`, `mobile-app`, `ml-pipeline`, `extension`, `game`) or `unknown`; the block's `Primary` and any `Runner-up` name one of the nine, and the validator refuses anything else. `archetype_confidence` is `high`, `medium`, or `low`, and it is derived, not asserted: the validator recomputes it from the scores in the `### Archetype confidence` block and fails any disagreement. `overlays` is an inline list from the fixed set in `discovery.md` (`ai-system`, `public-ui`, `shipped-artifact`, `operated-by-others`, `regulated-data`, `agent-skill-package`, `monetized`), or `[]`. Overlays raise and never lower: a domain any listed overlay covers is never `excluded`; it is `applicable`, or `deferred` where the deferrable set allows, and the validator enforces that against the matrix.
65
+
66
+ `source_revision` is the full Git commit used for planning, or `none` when no revision exists. `validated_at` is a UTC ISO-8601 timestamp. The `## Plan provenance` values repeat those frontmatter values exactly, with no trailing punctuation. Its machine-readable inventory contains one or more lines shaped ``- `<label>` = `sha256:<64-lowercase-hex>` ``. Prefix a stable file artifact with `[recheck]` when phase-boundary drift checks must recompute it: ``- [recheck] `path/to/artifact` = `sha256:<64-lowercase-hex>` ``. A recheck label is a repository-relative file path, not an alias. Labels use only ASCII letters, digits, `.`, `_`, `/`, and `-`, may start with `.` or `_` (a dotfile path such as `.godaudits/EVIDENCE.json` is a valid recheck label), and never contain a `..` segment; labels are unique; and exactly one label is `intake`. Hash normalized intake text for `intake`, and hash raw file bytes for file entries. To derive `input_digest`, sort entries lexicographically by label, concatenate each as `<label><TAB><64-lowercase-hex><LF>`, hash the UTF-8 bytes with SHA-256, and prefix the result with `sha256:`. The `[recheck]` marker does not enter the digest. Inventory display order does not affect the aggregate. These values bind the plan to its inputs; they are not claims that later execution leaves the repository unchanged.
67
+
68
+ The status lifecycle is `planning -> approved -> executing -> done`:
69
+
70
+ 1. A new or materially replanned document has `status: planning`. Validate it with `--allow-planning`, present it, and wait.
71
+ 2. Only explicit user sign-off changes `planning` to `approved`. Update the date in the same edit.
72
+ 3. The first executor runs `.godplans/validate-plan.sh` without `--allow-planning`, then changes `approved` to `executing` before starting GP work. An already `executing` plan may resume.
73
+ 4. Change `executing` to `done` only after every task is checked and the final Verification phase passes. Use `--allow-planning` for the final structural validation because default mode is an execution gate.
74
+
75
+ A material replan restarts this lifecycle at `planning`, increments `plan_version`, and requires fresh sign-off. No executor may work from a `planning` or `done` plan.
76
+
77
+ ## Document skeleton, in order
78
+
79
+ 1. `# <Project> master plan` and a one-paragraph objective ending with an observable definition of done.
80
+ 2. `## Scope and non-goals`. Non-goals are named, not implied. State the scale calibration, available capacity, phase and task ceiling, and the sum of task appetites. A weekend plan has at most 3 phases and 8 tasks.
81
+ 3. `## Plan provenance`. Record the source revision, stable evidence inventory, SHA-256 input digest, validation timestamp, and the completed or imported evidence that must be rechecked on resume.
82
+ 4. `## Product form`. Name the primary form, its vertical-slice definition, form-specific completion evidence, and any secondary form that passes the independent-deliverable rule. The section closes with exactly one `### Archetype confidence` block, because the archetype is what licenses the matrix defaults that follow it:
83
+
84
+ ```markdown
85
+ ### Archetype confidence
86
+
87
+ - Primary: saas-dashboard (score 0.88)
88
+ - Runner-up: api-service (score 0.57)
89
+ - Margin: 31 points
90
+ - Confidence: high
91
+ - Vetoes applied: none
92
+ - Overlays: public-ui, regulated-data
93
+ - If the runner-up is right: -3 tasks and +0 phases; the public-ui overlay no longer fires, the ui and seo rows flip to excluded, and GP-210 through GP-212 drop
94
+ ```
95
+
96
+ Scores are two decimals from `0.00` to `1.00`. `Primary` names the top scorer and repeats the frontmatter `archetype`, except below the 0.45 floor, where the frontmatter reads `unknown`. `Runner-up` is another archetype with its score, or `none` when nothing else scored above zero. `Margin` is `(primary - runner-up) * 100` rounded to an integer, and the validator recomputes it. `Confidence` is `high` at a margin of 15 or more and a primary score of 0.70 or more, `medium` with exactly one of those, `low` with neither, and the validator recomputes that too, so a confidence that does not follow from the plan's own arithmetic fails. `Overlays` repeats the frontmatter list or reads `none`. `If the runner-up is right:` is priced in tasks and phases on the same bar as a blast radius; adjectives are refused. A `low` confidence or below-floor archetype additionally appears in `## Open Questions`, and no `assure`-stage documentation-set row may be `not-applicable` while it stands.
97
+ 5. `## Compliance gate`. One short section: pass, or the mitigations injected (with task IDs).
98
+ 6. `## Applicability matrix`. The full table: every domain marked applicable, deferred, or excluded. Deferred is reserved for the deferrable set named in `discovery.md` (seo, launch, observe, ui, deploy): the row names the trigger, an observable event that forces the domain pass, and argues why the decision is reversible until the trigger fires. Excluded rows carry three things in one cell, in this order: an evidence state (`absent:` for something checked, `by-design:` for something the plan settles; `unknown:` and `hint:` are refused because neither licenses an exclusion), a project-specific reason, and a `revisit when:` predicate that is observable on the same bar as a deferral trigger. An exclusion without a tripwire is permanent by accident. After the table, add the compact module disposition described below.
99
+
100
+ ```markdown
101
+ | llm | excluded | by-design: expense splitting is arithmetic, so no model call is planned; revisit when: any task adds a model SDK dependency, an inference endpoint, or a prompt template |
102
+ ```
103
+
104
+ Two constraints ride on the exclusion cell. A domain covered by any declared overlay may not be excluded at all, because overlays raise and never lower. And in `brownfield` or `replan` mode an `absent:` reason carries a backticked command or evidence artifact, since `absent:` is a negative claim about existing code and the claims-and-evidence rule above already refuses those without a search:
105
+
106
+ ```markdown
107
+ | seo | excluded | absent: no HTML template, route table, or static site config under src/ (`rg -l -e "<html" -e "<!DOCTYPE" src/` returns nothing); revisit when: any task adds a server-rendered route or a static site config |
108
+ ```
109
+
110
+ `by-design:` needs no command in any mode. It records a decision rather than an observation, and there is nothing yet to have looked at.
111
+
112
+ The module disposition follows the table, one line per applicable module, naming which layer dropped anything it dropped:
113
+
114
+ ```markdown
115
+ ### Module disposition
116
+ - security: landed R-SEC-1, R-SEC-4, R-SEC-12; dropped-by archetype R-SEC-22 (no containers, Kubernetes, or IaC planned)
117
+ - ui: landed R-UI-2, R-UI-9; dropped-by archetype R-UI-14 (stock primitives, no design system to publish)
118
+ ```
119
+
120
+ `dropped-by` takes exactly one of `scale`, `archetype`, or `form`, and carries a parenthetical reason. A requirement listed as dropped may not appear on any task's `Requirements:` line, and the two lists in one module line may not overlap.
121
+ 7. `## Decisions`. Hard-to-reverse bets first: wire formats, public identifiers, data-model shape, auth and ownership boundaries. Each entry is a decision with rationale, a hypothesis with a validation plan, or a pointer to Open Questions. The only `###` headings under `## Decisions` are `### D<n>: <title>` entries and `### Assumptions ledger`; hypotheses live in the ledger and pointers to Open Questions sit in a D<n> body. Where options were weighed, show the comparison in a small table. Every `### D<n>` decision entry carries this structured falsifier:
122
+
123
+ ```markdown
124
+ Falsifier:
125
+ - Signal: p99 read latency for the largest tenant from the production query span
126
+ - Failure boundary: p99 exceeds 250 ms for seven consecutive days
127
+ - Replan action: return to planning and evaluate schema-per-tenant against the rejected shared-table design
128
+ ```
129
+
130
+ `Signal` names observable evidence, `Failure boundary` states the event or numeric threshold that kills the decision, and `Replan action` names what is reconsidered after returning to planning. A falsifier that can never fire is decoration. Hypotheses in the assumptions ledger need no falsifier block; their validation task already is one. Each ledger entry does carry its price:
131
+
132
+ ```markdown
133
+ ### Assumptions ledger
134
+ - A1: a workspace's data is never visible across workspaces (assumed; no cross-org reporting was described)
135
+ - Blast radius: wrong costs +6 tasks and +1 phase; per-object ACLs replace workspace-scoped RLS, rewriting GP-201 and every Phase 4 query
136
+ - Validated by: GP-108
137
+ ```
138
+
139
+ `Blast radius` is counted in tasks and phases the plan would gain or lose, never in adjectives. "Significant rework" is refused. `+0 tasks` is a legitimate and useful answer: it tells the user which assumptions to stop worrying about.
140
+ 8. `## Requirements`. Numbered user stories with EARS acceptance criteria: `R-1.1: WHEN <trigger> THE SYSTEM SHALL <observable behavior>`. A compact table is also valid when the requirement ID is the first cell of each row. Task `Requirements:` lines point here and at module IDs (R-SEC-4 style).
141
+ 9. `## Architecture`. The mermaid visuals (see Visual layer) plus the prose that the diagrams support.
142
+
143
+ Each other applicable domain whose pass writes prose gets one `## <Domain>` section between `## Requirements` and `## Documentation set`, named and ordered as in the Phase 4 table. Product prose lives in the objective, `## Scope and non-goals`, and `## Requirements`, roadmap prose in `## Phases`; they and deferred or excluded domains get none.
144
+
145
+ 10. `## Style genome`. Naming, idioms, structure conventions the first commit must already follow.
146
+ 11. `## Agent memory`. The AGENTS.md and pillar files the scaffold phase will emit.
147
+ 12. `## Documentation set`. Exactly one such section. The manifest of documents this project owes, what it does not owe, and what would reverse each of those answers. See Documentation set grammar below and `doc-set.md` for the catalog and the selection rules.
148
+ 13. `## Phases`. The task body; see Task grammar.
149
+ 14. `## Open Questions`. Exactly one such section, at the bottom, the only enumeration of open decisions. Committed decisions never appear here. A complex plan with zero open questions is acceptable only when every meaningful decision has been explicitly made above; the legal empty form is a body of exactly `None.`. Otherwise every entry is a decision ticket in the grammar below. When every listed option is a variant of one framing, the question also names the option from outside that framing, or states that none survived and which constraint eliminated it; options that only vary a dial are a menu, not a set of alternatives.
150
+ 15. `## Rules for executing agents`. Copied verbatim from this module (below).
151
+ 16. `## Session log`. Append-only, one line per session.
152
+
153
+ ## Documentation set grammar
154
+
155
+ One table, one boundary statement, and nothing else. Read `doc-set.md` before authoring it; that file carries the catalog, the ten lifecycle stages, the durability contract, and the selection rules this grammar renders.
156
+
157
+ ```markdown
158
+ ## Documentation set
159
+
160
+ This manifest covers documentation committed to this repository. Documents that live in a wiki, an intranet, or a compliance platform are marked present-elsewhere and are not planned here.
161
+
162
+ | Document | Stage | Verdict | Owner | Selected by, or reason and revisit when |
163
+ |---|---|---|---|---|
164
+ | decide.adr | decide | required | architecture | always; ADR-001 through ADR-003 land in GP-104 |
165
+ | build.config-reference | build | required | stack | the service reads 11 environment variables; written by GP-207 |
166
+ | assure.threat-model | assure | required | security | session auth plus stored personal data; written by GP-306 |
167
+ | operate.recovery | operate | recommended | deploy | durable user data exists; offered as GP-402 |
168
+ | serve.support-policy | serve | not-applicable | launch | by-design: no paying users at side-project scale; revisit when: the plan adds a billing route or a paid tier |
169
+ | verify.traceability | verify | not-applicable | roadmap | absent: no external authorizer was named in discovery; revisit when: a customer contract or a regulator requires an audit trail |
170
+ ```
171
+
172
+ Grammar rules:
173
+
174
+ - **Document**: a catalog id from `doc-set.md` section 5. An id outside that catalog is refused; extend the catalog instead of inventing a row, because an id nobody else uses cannot be cross-referenced.
175
+ - **Stage**: one of the ten in `doc-set.md` section 2.
176
+ - **Verdict**: `required`, `recommended`, `optional`, or `not-applicable`.
177
+ - **Owner**: the module that plans the artifact, from the catalog. Exactly one module owns a document, so two passes never both plan the same file. A repo-pass task that writes an architecture-owned document is a boundary violation, not a convenience.
178
+ - **Last cell**: for a selected row, what selected it plus the GP task that writes it, so the manifest is checkable against the phases. For a `not-applicable` row, an evidence state (`absent:`, `by-design:`, or `present-elsewhere:`), a reason, and a `revisit when:` predicate, on the same bar as an excluded applicability row. `unknown:` and `hint:` are refused here for the same reason they are refused there.
179
+ - **Every required or recommended row names a task**, except the `adopt` and `confirm` rows below. A required document with no GP number is a promise the plan does not keep.
180
+ - **Brownfield and replan** additionally record state by opening the last cell with it, so the action is a lookup rather than a judgment: `present-current:` is `adopt` (frontmatter only, no task), `present-drifted:` or `present-stub:` names its refresh or completion task, `present-elsewhere:` is `confirm` (no task, in any mode), and a not-applicable row whose document exists is an `orphan` that cites its `### Q<n>` instead of a tripwire, never a deletion task. The full lattice is `doc-set.md` section 6.
181
+ - **No invented numbers.** Review cadence, retention, recovery objectives, availability targets, and support windows are cited or they are open questions. A number invented at plan time becomes a commitment nobody made.
182
+
183
+ ## Task grammar
184
+
185
+ Tasks live under phase headings, grouped into waves. The format is fixed; executors parse it.
186
+
187
+ ```markdown
188
+ ## Phase 2: Auth and accounts
189
+
190
+ Goal: a user can sign up, log in, and own their data. Blocks Phase 3.
191
+
192
+ ### Wave 2.1
193
+
194
+ - [ ] GP-201 [W2.1] Create user model and migration
195
+ - Files: src/db/schema/users.ts, migrations/0002_users.sql
196
+ - Depends on: GP-104
197
+ - Reuses: drizzle client from src/db/client.ts
198
+ - Acceptance: schema exports `users` table; migration applies cleanly on empty db; email column has unique index
199
+ - Verify: `npm run db:migrate && npm run db:check`
200
+ - Requirements: R-2.1, R-DB-3, R-SEC-12
201
+
202
+ - [ ] GP-202 [P] [W2.1] Add password hashing helper
203
+ - Files: src/auth/hash.ts, src/auth/hash.test.ts
204
+ - Depends on: none
205
+ - Reuses: shared error types from src/errors.ts
206
+ - Acceptance: uses argon2id; test vector passes; no plaintext ever logged
207
+ - Verify: `npm test -- hash.test.ts`
208
+ - Requirements: R-SEC-6
209
+
210
+ Checkpoint: signup flow works end to end against a local db.
211
+ Checkpoint verify: `npm run test:e2e -- signup`
212
+
213
+ Must-haves:
214
+ - Truth: a new user row appears after signup (manual: `curl -X POST /api/signup`)
215
+ - Artifact: src/auth/hash.ts exports `hashPassword` and `verifyPassword`
216
+ - Link: signup route imports from src/auth/hash.ts, not an inline hash
217
+ ```
218
+
219
+ Grammar rules:
220
+
221
+ - **IDs**: `GP-<phase><two digits>`, zero-padded, unique, stable forever. Never renumber. Uniqueness applies to checkbox task definition headers; dependency references do not create duplicate definitions.
222
+ - **`[P]`**: parallel-safe. Only when the task touches files disjoint from every other unchecked task in the same wave. The validator enforces this: a `[P]` task sharing a path with another unchecked task in its wave fails, because the marker is a promise an executor acts on by running the two at once.
223
+ - **`[W<phase>.<wave>]`**: the wave tag. Waves within a phase run in order; tasks within a wave marked `[P]` may run concurrently.
224
+ - **Files**: exact paths. Brownfield plans name real existing files.
225
+ - **Depends on**: task IDs or `none`. No reflexive chains; a dependency exists because the work cannot start without it, not because the tasks are neighbors.
226
+ - **Acceptance**: 2 to 4 grep-verifiable or observable conditions. "Works correctly" is banned; "returns 401 without a session cookie" ships.
227
+ - **Verify**: one exact executable command whose exit code proves the task, in backticks. It must be safe and idempotent when rerun at a phase boundary; deployment, publication, destructive migration, or activation actions are task work, not verification. Manual-only Verify values are refused; wrap browser or device evidence in an executable harness.
228
+ - **Requirements**: comma-separated IDs from the Requirements section and domain modules. Every task traces to at least one requirement; a task tracing to nothing is scope creep.
229
+ - **Wrapping**: a field may continue on lines indented four spaces that do not start a list item; the validator and PLAN.json join them with single spaces, so a wrapped `Files` or `Requirements` list is checked whole. A `- Note` line is indented two spaces, like the fields.
230
+ - **Checkpoint**: every phase ends with one independently observable outcome and one `Checkpoint verify:` command whose exit status reproves it at the next phase boundary.
231
+ - **Must-haves**: goal-backward proof: observable truths, required artifacts, and key links showing the pieces are wired, because a checked box alone cannot distinguish a real implementation from a placeholder.
232
+ - The final phase of every plan is **Verification**: run the full test suite, lint, build, and at least one end-to-end smoke that names the real command or the exact manual path.
233
+
234
+ ## Question grammar
235
+
236
+ R-PRD-10 requires every open question to carry an owner, a due date, a blocking
237
+ flag, and a recommended default. This is the shape those four fields take in the
238
+ document, so a reader can tell at a glance who has to answer, what stalls until
239
+ they do, and what happens if nobody does.
240
+
241
+ ```markdown
242
+ ## Open Questions
243
+
244
+ ### Q1: Can a board be shared outside its workspace?
245
+ - Owner: product lead (the answer is theirs to give; the plan must not invent it)
246
+ - Blocks: nothing, because the default (b) is additive; it would block build from the start of Phase 4 if the default were structural
247
+ - Decide by: 2026-08-14, the Phase 4 wave boundary
248
+ - Why it matters: a yes replaces workspace-scoped RLS with per-object ACLs, rewriting GP-201 and every Phase 4 query.
249
+ - Options: (a) no sharing outside the workspace; (b) read-only links with unguessable tokens; (c) full cross-workspace membership; (d) export a read-only snapshot, which moves sharing out of the permission model entirely.
250
+ - Recommended default: (b), which satisfies R-1.6 without per-object ACLs; the token table is additive, not structural, so taking it early costs nothing if the answer lands later.
251
+ ```
252
+
253
+ Grammar rules:
254
+
255
+ - **IDs**: `### Q<n>: <the question>`, numbered from 1, unique, ascending. The heading is the question itself, phrased so its answer is a decision. The legal empty form for the whole section is a body of exactly `None.`.
256
+ - **Owner**: the role that answers. When the answer is not the agent's to give, say so on this line; an agent that answers a question owned by the user has not resolved it, it has guessed and hidden the guess.
257
+ - **Blocks**: `build`, `ship`, or `nothing`, with the boundary it blocks at. A question that blocks nothing still ships its default.
258
+ - **Decide by**: the exact moment the default fires: a date, a phase start, or a wave boundary. "Later" is refused.
259
+ - **Why it matters**: one line naming what changes on each answer.
260
+ - **Options**: at least two named alternatives. Where all options vary one dial, name the option from outside that framing or state which constraint eliminated it.
261
+ - **Recommended default**: the option the plan executes on if nobody answers, plus why taking it early is safe. This is what makes the plan executable without the answer.
262
+ - An unknown that **must** be settled before dependent work is not an open question. It is a flagged hypothesis in `## Decisions` whose R-ROAD-7 validation task is scheduled ahead of every task that assumes it, so the ordering is a real `Depends on` edge the validator checks. `## Open Questions` holds the residual: unknowns the plan can proceed past on a stated default.
263
+ - Resolving a question **deletes it from this section** and lands it in `## Decisions` as a `### D<n>` entry with a falsifier. A decision lives in exactly one place; a question that survives its own answer is duplication.
264
+
265
+ ## Conditional public-release gate
266
+
267
+ When `public_release: true`, mark the latest hardening evidence task with `R-SEC-26`, exactly one prepublication gate task with `R-ROAD-21`, and exactly one first public activation task with `R-LAUNCH-22`. Keep those role markers on distinct tasks. The gate follows and depends on the latest hardening task. The activation task follows the gate immediately and depends on it. The gate records `checked_at`, `hardening_revision` (a content hash or immutable revision), `finding_counts`, `policy`, and `verdict`. `checked_at` must be later than the latest hardening evidence. Its acceptance states that a later hardening change `invalidates` the pass and forces the task to run again. That `Acceptance:` line names all ten tokens literally, these six and the four below, even when no Critical risk is accepted.
268
+
269
+ Every permitted Critical risk acceptance names `owner`, `justification`, `accepted_at`, and `expires_at`. Missing or expired fields block public activation. Projects with `public_release: false` state why no public surface exists and do not receive this task.
270
+
271
+ ## Visual layer
272
+
273
+ Diagrams are mermaid in fenced blocks, GitHub-native. Use them where they carry decisions, next to the prose they support:
274
+
275
+ - `graph TD` for components and trust boundaries (annotate the boundary edges).
276
+ - `erDiagram` for the data model.
277
+ - `sequenceDiagram` for the one or two load-bearing flows.
278
+ - `gantt` for phase and wave sequencing when the plan has calendar pressure; otherwise skip it.
279
+
280
+ The visual-surface gate, inherited from visual-plan: backend-only and library plans get no decorative top diagram; visuals appear inline, local to the claims they support. UI-bearing plans may lead with a screen-flow diagram. Never render a default left-to-right box chain to look busy; a diagram that decides nothing is deleted prose.
281
+
282
+ Chat surfaces often show mermaid as a code block, so the surrounding text must stand alone; tables and dependency lists carry the same facts.
283
+
284
+ ## Rules for executing agents
285
+
286
+ This block is copied verbatim into every emitted plan, under `## Rules for executing agents`, wrapped in a GFM alert:
287
+
288
+ ```markdown
289
+ > [!IMPORTANT]
290
+ > This plan is the source of truth. The chat is not.
291
+ >
292
+ > 1. Before any work: read the frontmatter and `## Plan provenance`, then re-derive state from disk. Recheck recorded completed or imported evidence; if material evidence drifted, change status to `planning`, record the stale evidence, and stop for replan. Otherwise refuse unless `status` is `approved` or `executing`. `planning` awaits sign-off; `done` is closed. Run `bash .godplans/validate-plan.sh .godplans/PLAN.mdx`. If status is `approved`, change it to `executing` and update the date before the first task.
293
+ > 2. Find the first unchecked task in wave order. Re-derive state from checkboxes; trust nothing remembered.
294
+ > 3. One task at a time. Respect Depends on. Tasks marked [P] may run concurrently; the validator has already proved their Files lists are disjoint from every other unchecked task in the wave, so treat [P] as the schedulable set and never widen it by hand.
295
+ > 4. Run the task's Verify command. Only after it passes, flip [ ] to [x] and update the frontmatter counters and `updated:` date in the same edit. Never batch check-offs. Regenerate the sidecar in the same batch: `bash .godplans/validate-plan.sh --allow-planning --emit-json .godplans/PLAN.json .godplans/PLAN.mdx`.
296
+ > 5. If Verify fails: the box stays unchecked. Append a `- Note (YYYY-MM-DD):` line under the task, indented two spaces like its fields, saying what happened.
297
+ > 6. Phase-boundary gate: before the first task of a new phase, run `bash .godplans/validate-plan.sh --drift-check N .godplans/PLAN.mdx`, replacing N with the completed phase. The command recomputes `[recheck]` provenance files, reruns a deterministic sample of up to three completed task Verify commands, and reruns the phase's Checkpoint verify command. Any failure returns status to `planning` and stops execution for replan.
298
+ > 7. If a deferred domain's trigger fires, or the `revisit when:` predicate of an excluded domain or a not-applicable document row comes true (a task would add what it names), return status to `planning` and run that domain's pass or reselect that document before continuing.
299
+ > 8. Scope changes are not improvised. Return status to `planning`, patch the plan (new task IDs, struck-through superseded tasks with a reason), increment `plan_version`, and obtain fresh approval before more execution.
300
+ > 9. Never renumber, reword, or uncheck a completed task.
301
+ > 10. At session end: append one line to `## Session log`: date, tasks completed, where you stopped, what is next.
302
+ > 11. Re-read the current phase before starting it; re-read Decisions before touching anything they govern.
303
+ > 12. After every task is checked and the final Verification phase passes, change status from `executing` to `done`, update the date, and run `bash .godplans/validate-plan.sh --allow-planning .godplans/PLAN.mdx` for a final structural check.
304
+ ```
305
+
306
+ ## Machine checks
307
+
308
+ The emitted companion is the only machine-check entry point. Copy it byte-for-byte from the skill before the first validation, then run:
309
+
310
+ ```bash
311
+ bash .godplans/validate-plan.sh --allow-planning .godplans/PLAN.mdx
312
+ ```
313
+
314
+ The companion embeds the domain requirement catalog and reads no skill files at runtime. Before this command, verify `test -x .godplans/validate-plan.sh` and compare the companion byte-for-byte with the installed source. `--allow-planning` performs structural validation for a draft or closed plan; without it, the validator is also an execution gate and accepts only `approved` or `executing`, and `done` requires every task and phase checked. It checks frontmatter (lifecycle, product form, overlays, and domain lists that match the matrix), provenance and its aggregate input digest, the archetype-confidence arithmetic, and the conditional public-release gate structure; task grammar (sequential phases, wave tags that match their phase and never go backwards, unique GP IDs, every required field including wrapped continuation lines, dependencies that come earlier and in no later wave, catalog-resolved requirements that cite no excluded or deferred module, and `[P]` tasks that share no file and no dependency with a wave sibling); the applicability-matrix and module-disposition rules above, with every landed requirement appearing in the plan body; a `Falsifier:` block on every `### D<n>` decision; documentation-set rows, including which states each mode may claim; phase checkpoints and a final Verification phase; exactly one of each numbered `##` skeleton section (Architecture and Agent memory only when that domain is applicable), with the executor rules keeping their `> [!IMPORTANT]` alert; real calendar dates, strict UTF-8, and banned Unicode. Fenced code is not structure. `--drift-check N` adds the explicit execution-time recheck for a completed phase. Its Bash 3.2 and portable Perl implementation runs on stock macOS and Linux. Any failure blocks emission. Do not replace this command with ad hoc grep pipelines.
315
+
316
+ ## Machine-readable sidecar
317
+
318
+ `--emit-json PATH` writes a generated JSON view of the plan after a successful validation:
319
+
320
+ ```bash
321
+ bash .godplans/validate-plan.sh --allow-planning --emit-json .godplans/PLAN.json .godplans/PLAN.mdx
322
+ ```
323
+
324
+ PLAN.json carries the frontmatter, applicability rows, decision falsifiers, progress counters, phases, active tasks, superseded tasks, and cumulative supersession metrics (with `depends_on` and `requirements` as arrays, and `parallel` carrying the validated `[P]` marker so a runner can schedule a wave without re-deriving which tasks are safe to run at once) so executing agents and tooling never parse MDX checkboxes. It is generated atomically and never hand-edited: any plan edit regenerates it with the same command. Its `plan_digest` field is the SHA-256 of the PLAN.mdx bytes at generation time; a consumer recomputes the digest before trusting the sidecar and regenerates on mismatch. The plan remains the only source of truth; the sidecar is a derived view, and the validator regenerates it only from a plan that passes every structural check.
325
+
326
+ The published schema is `schemas/PLAN.schema.json` for `format: godplans/plan-json@2`; sidecars from godplans 1.13.0 and earlier carry `@1` and validate against `schemas/PLAN.v1.schema.json`. Consumers pick the schema by the `format` tag and validate the sidecar before scheduling work, then verify `plan_digest` against the PLAN.mdx bytes.
327
+
328
+ ## Size discipline
329
+
330
+ The plan is re-read every session; bloat is a tax on every future turn. Budgets: objective under 150 words; no phase over 12 tasks (split it); no more than 7 phases before considering a second milestone plan; Open Questions under 10 entries (more means discovery is not done); Session log lines under 140 characters. When a plan outgrows these budgets, open a second milestone plan instead of growing this one. Completed phases stay in the live plan, archived in place and never overwritten, as R-ROAD-18 requires; what goes to `.godplans/archive/PLAN-v<n>.mdx` is a whole superseded plan version, snapshotted on replan and never edited down. Cutting finished phases out of the live plan would delete the execution history the drift check and the supersession metric read.
331
+
332
+ ## Replan protocol
333
+
334
+ When PLAN.mdx already exists: read it fully, copy it unedited to `.godplans/archive/PLAN-v<n>.mdx`, `<n>` being its `plan_version`; recount progress from checkboxes, read the session log, and recompute the source evidence recorded under `## Plan provenance`. Recheck every artifact recorded as completed or imported. If its content, revision, or existence changed materially, mark the plan stale by returning `status` to `planning` before applying the delta; do not trust the chat or old validation timestamp. Completed work is history and never altered. New work gets fresh IDs continuing the sequence. Superseded unstarted tasks are not deleted. Strike only the heading (`~~- [ ] GP-310 [W3.1] Old work~~`), then retain ` - Superseded: <one-line reason>` and ` - Requirements: <original ids>` so the audit trail and domain metric survive. A plan written by an older godplans may fail the re-copied validator on rules added since; each message names its fix. Add a domain the skill gained (its matrix row, frontmatter entry, and disposition line when applicable), re-point a documentation row whose catalog owner moved (a required `frame.business-case` row makes business applicable), retitle Decisions headings, and move a task block, completed or not, to restore wave order: none of these rewords completed work. Refresh the evidence inventory, `input_digest`, and `validated_at`; bump `plan_version`; log the delta in the session log; and re-run the Phase 6 audit on any section that changed.
335
+
336
+ Measure the outgoing plan first, in Phase 0, before the compliance gate re-copies the companion: run `scripts/plan-halflife.sh .godplans/PLAN.mdx .godplans/PLAN.metrics.json`. It uses `GODPLANS_VALIDATOR` when set, else the plan's own `.godplans/validate-plan.sh`; a newer validator may reject the outgoing plan. If none can measure it (no companion, or one that predates `--emit-json`), record `half-life: not measured (<reason>)` in the session log and continue; the measurement never blocks a replan. The report records active, superseded, and historical tasks, plus cumulative supersession and survival rates overall and the supersession rate per requirement domain. A domain whose tasks are struck repeatedly was over-planned at that scale; shrink its appetite on the next pass instead of reseeding the same tasks.
337
+
338
+ Re-evaluate every tripwire on the way in, before anything else. An excluded domain whose `revisit when` predicate has become true, and a not-applicable documentation row whose predicate has become true, are the reason to replan at all, so they lead the delta rather than trailing it. A predicate that is true now is reported; one that is merely being watched is not.
339
+
340
+ Report drift as leads, not as findings. `--drift-check` recomputes digests and reruns sampled commands, which establishes that something changed and never why. A recorded artifact whose hash moved may be a real regression, a reformat, or a rename, and presenting the three as one verdict trains the reader to skip the section. Name what changed, name what it might mean, and leave the judgment where the evidence is.