@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.
- package/CHANGELOG.md +1202 -0
- package/LICENSE +21 -0
- package/PROMPT.md +4006 -0
- package/README.md +245 -2
- package/bin/godplans.js +93 -0
- package/docs/ARCHITECTURE.md +136 -0
- package/docs/RELEASING.md +107 -0
- package/docs/assets/badge-approved.svg +12 -0
- package/docs/assets/badge-done.svg +11 -0
- package/docs/assets/badge-graded.svg +12 -0
- package/docs/assets/badge-validated.svg +10 -0
- package/docs/assets/hero.svg +37 -0
- package/docs/assets/quest-map.svg +53 -0
- package/evals/README.md +295 -0
- package/evals/cases/brownfield-cli/EXPECTATIONS +15 -0
- package/evals/cases/brownfield-cli/INPUT/package.json +9 -0
- package/evals/cases/brownfield-cli/INPUT/src/cli.js +4 -0
- package/evals/cases/brownfield-cli/INPUT/src/format.js +3 -0
- package/evals/cases/brownfield-cli/INPUT/test/cli.test.js +7 -0
- package/evals/cases/brownfield-cli/REQUEST.baseline.md +10 -0
- package/evals/cases/brownfield-cli/REQUEST.md +10 -0
- package/evals/cases/compliance-refusal/EXPECTATIONS +4 -0
- package/evals/cases/compliance-refusal/REQUEST.baseline.md +9 -0
- package/evals/cases/compliance-refusal/REQUEST.md +8 -0
- package/evals/cases/greenfield-saas/EXPECTATIONS +21 -0
- package/evals/cases/greenfield-saas/REQUEST.baseline.md +11 -0
- package/evals/cases/greenfield-saas/REQUEST.md +11 -0
- package/evals/cases/nested-pillars/EXPECTATIONS +12 -0
- package/evals/cases/nested-pillars/REQUEST.baseline.md +10 -0
- package/evals/cases/nested-pillars/REQUEST.md +11 -0
- package/evals/cases/observability-evidence/EXPECTATIONS +10 -0
- package/evals/cases/observability-evidence/REQUEST.baseline.md +10 -0
- package/evals/cases/observability-evidence/REQUEST.md +11 -0
- package/evals/cases/product-business/EXPECTATIONS +18 -0
- package/evals/cases/product-business/REQUEST.baseline.md +13 -0
- package/evals/cases/product-business/REQUEST.md +14 -0
- package/evals/cases/product-form-routing/EXPECTATIONS +13 -0
- package/evals/cases/product-form-routing/REQUEST.baseline.md +11 -0
- package/evals/cases/product-form-routing/REQUEST.md +11 -0
- package/evals/cases/prose-integrity/EXPECTATIONS +19 -0
- package/evals/cases/prose-integrity/REQUEST.baseline.md +19 -0
- package/evals/cases/prose-integrity/REQUEST.md +20 -0
- package/evals/cases/replan-preserves-history/EXPECTATIONS +9 -0
- package/evals/cases/replan-preserves-history/INPUT/.godplans/PLAN.mdx +115 -0
- package/evals/cases/replan-preserves-history/INPUT/package.json +5 -0
- package/evals/cases/replan-preserves-history/REQUEST.baseline.md +10 -0
- package/evals/cases/replan-preserves-history/REQUEST.md +10 -0
- package/evals/cases/stale-prepublication/EXPECTATIONS +10 -0
- package/evals/cases/stale-prepublication/REQUEST.baseline.md +12 -0
- package/evals/cases/stale-prepublication/REQUEST.md +13 -0
- package/evals/cases/stale-source-evidence/EXPECTATIONS +10 -0
- package/evals/cases/stale-source-evidence/INPUT/package.json +8 -0
- package/evals/cases/stale-source-evidence/REQUEST.baseline.md +11 -0
- package/evals/cases/stale-source-evidence/REQUEST.md +12 -0
- package/evals/cases/weekend-library/EXPECTATIONS +19 -0
- package/evals/cases/weekend-library/REQUEST.baseline.md +10 -0
- package/evals/cases/weekend-library/REQUEST.md +11 -0
- package/evals/cases-roster.txt +19 -0
- package/evals/external/GRADE.schema.json +39 -0
- package/evals/external/README.md +42 -0
- package/evals/external/RUBRIC.md +32 -0
- package/evals/metrics/context-cost.json +154 -0
- package/evals/outcomes/README.md +65 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.baseline.md +14 -0
- package/evals/outcomes/cases/tenant-notes-api/REQUEST.md +13 -0
- package/evals/outcomes/cases/tenant-notes-api/VERIFY.sh +13 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/README.md +93 -0
- package/evals/outcomes/results/2026-07-23-tenant-notes-api-codex/treatment/plan/PLAN.json +547 -0
- package/evals/runners/claude-baseline.sh +4 -0
- package/evals/runners/claude-grade.sh +3 -0
- package/evals/runners/claude.sh +4 -0
- package/evals/runners/codex-baseline.sh +181 -0
- package/evals/runners/codex-builder.sh +96 -0
- package/evals/runners/codex-godaudits.sh +84 -0
- package/evals/runners/codex.sh +147 -0
- package/evals/runners/gemini-baseline.sh +4 -0
- package/evals/runners/gemini-grade.sh +3 -0
- package/evals/runners/gemini.sh +4 -0
- package/evals/runners/vendor-cli.sh +257 -0
- package/evals/runners/vendor-grade.sh +82 -0
- package/install.sh +323 -0
- package/package.json +91 -4
- package/requirements/skills-ref.txt +2 -0
- package/scripts/build-catalog.js +114 -0
- package/scripts/build-prompt.sh +257 -0
- package/scripts/context-metrics.js +118 -0
- package/scripts/eval-external.js +226 -0
- package/scripts/eval-matrix.sh +172 -0
- package/scripts/eval-outcome.js +143 -0
- package/scripts/eval.sh +321 -0
- package/scripts/lint-parity.js +331 -0
- package/scripts/lint.sh +743 -0
- package/scripts/outcome-summary.js +126 -0
- package/scripts/release-check.sh +108 -0
- package/scripts/release-prepare.js +41 -0
- package/scripts/summarize-eval.js +91 -0
- package/scripts/summarize-matrix.js +101 -0
- package/scripts/version-sync.js +65 -0
- package/skills/godplans/SKILL.md +192 -0
- package/skills/godplans/references/agent-memory.md +168 -0
- package/skills/godplans/references/architecture.md +189 -0
- package/skills/godplans/references/build.md +130 -0
- package/skills/godplans/references/business.md +252 -0
- package/skills/godplans/references/code-quality.md +165 -0
- package/skills/godplans/references/compliance.md +59 -0
- package/skills/godplans/references/database.md +157 -0
- package/skills/godplans/references/deploy.md +146 -0
- package/skills/godplans/references/discovery.md +297 -0
- package/skills/godplans/references/doc-set.md +243 -0
- package/skills/godplans/references/exemplar.md +228 -0
- package/skills/godplans/references/launch.md +162 -0
- package/skills/godplans/references/llm.md +132 -0
- package/skills/godplans/references/observe.md +178 -0
- package/skills/godplans/references/plan-format.md +340 -0
- package/skills/godplans/references/product.md +130 -0
- package/skills/godplans/references/repo.md +184 -0
- package/skills/godplans/references/roadmap.md +158 -0
- package/skills/godplans/references/security.md +156 -0
- package/skills/godplans/references/seo.md +133 -0
- package/skills/godplans/references/stack.md +133 -0
- package/skills/godplans/references/style-genome.md +198 -0
- package/skills/godplans/references/ui.md +153 -0
- package/skills/godplans/references/ux.md +150 -0
- package/skills/godplans/schemas/PLAN.schema.json +275 -0
- package/skills/godplans/schemas/PLAN.v1.schema.json +258 -0
- package/skills/godplans/scripts/plan-halflife.sh +76 -0
- package/skills/godplans/scripts/style-stats.py +630 -0
- package/skills/godplans/scripts/validate-plan.sh +1709 -0
- package/skills/godplans/templates/PLAN.template.mdx +269 -0
- package/tests/agent-memory-guidance.sh +32 -0
- package/tests/build-catalog.sh +81 -0
- package/tests/codex-runner.sh +139 -0
- package/tests/eval-harness.sh +377 -0
- package/tests/evidence-harnesses.sh +243 -0
- package/tests/fixtures/plan-json-v1-1.13.0.json +472 -0
- package/tests/install-regression.sh +246 -0
- package/tests/lib/plan-schema-check.js +163 -0
- package/tests/lint-selftest.sh +582 -0
- package/tests/package-contents.sh +143 -0
- package/tests/portable-prompt.test.sh +261 -0
- package/tests/release-tooling.sh +204 -0
- package/tests/run.sh +14 -0
- package/tests/script-usage.sh +37 -0
- package/tests/style-stats.sh +170 -0
- package/tests/validate-plan.sh +1970 -0
- package/tests/vendor-runner.sh +291 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Architecture planning module
|
|
2
|
+
|
|
3
|
+
Turns audit-time architecture discipline into plan-time obligations: the orchestrator loads this module during the architecture domain pass for every archetype; a plan that fails the load-bearing check below still gets R-ARCH-2's one-page shape statement and ADR-001, because `decide.adr` is an always-owed documentation row this module owns.
|
|
4
|
+
|
|
5
|
+
## Lineage
|
|
6
|
+
|
|
7
|
+
Descends from architecture-ready (hannsxpeter/ready-suite, consolidated in hannsxpeter/arc-ready), the planning-tier skill that produces system shape and why before any code or tool choice. What carries over: every box, arrow, and decision must have a named flip point and blast radius or it is decoration and gets deleted; storage shape precedes database name; NFR claims are arithmetic, not adjectives; trust boundaries are written to be copied verbatim into the threat model; and the skill refuses itself when architecture is not load-bearing. godplans inverts the audit: instead of scoring an ARCH.md after the fact, PLAN.mdx must satisfy every check before a line of code exists.
|
|
8
|
+
|
|
9
|
+
## Decisions to force
|
|
10
|
+
|
|
11
|
+
Ordered hardest-to-reverse first. Each must land in the plan's Decisions section as a grounded decision, a flagged hypothesis with a validation plan, or a named open question with a recommended default. "It depends" is not an answer.
|
|
12
|
+
|
|
13
|
+
1. System shape. Which of the seven: single-service monolith, modular monolith, service-oriented (3-7 services), microservices (20+), serverless/FaaS, event-driven, edge-native. Hard to reverse because every component boundary, deploy pipeline, and data-ownership rule downstream assumes it; consolidating a premature microservices split rewrites the whole repo (the Prime Video and Segment lesson). Default: modular monolith unless a specific constraint rules it out. Microservices require one named forcing function: independent deploy cadence at team scale, genuinely different scale or availability curves per part, or regulatory/security separation.
|
|
14
|
+
2. Data ownership and tenancy. Per entity: one writer, tenancy model (shared-schema, per-tenant-schema, per-tenant-DB), lifecycle (immutable, append-only, mutable, soft-delete), retention. Hard to reverse because tenancy migration means live data migration under uptime pressure. Default: shared-schema with a tenant_id column and single-writer components, unless compliance demands isolation.
|
|
15
|
+
3. Storage shape per entity group. Relational, document, key-value, time-series, event log, search, graph, object store; chosen before any product name. Hard to reverse because access patterns calcify around the shape. Naming Postgres at this stage is stackitecture; the pick belongs to the stack pass. Default: relational for entities with cross-entity invariants, object store for blobs.
|
|
16
|
+
4. Read-consistency stance and partition key per entity group. Which reads need strong consistency, read-your-writes, bounded staleness with a stated number, or eventual; and whether any group outgrows one node at the 12-month ceiling, which fixes the partition key. Hard to reverse because the stance leaks into every read call site, and a key chosen late means re-keying live data while every query that assumed one node is rewritten. Default: read-your-writes for the writer's own session, bounded staleness elsewhere with the number written down, one node until the arithmetic says otherwise.
|
|
17
|
+
5. Trust boundary placement. Where network edge, authentication, authorization, and tenant isolation sit, and how each is enforced. Hard to reverse because retrofitting a boundary means auditing every existing call path. Default: authn at the edge, authz in the domain layer, tenant isolation enforced in two independent layers: the query layer and the database, in R-DB-19's form.
|
|
18
|
+
6. Integration posture per external dependency. Sync vs async, transport, idempotency key and retry policy, failure blast radius. Hard to reverse because callers grow to depend on the timing and delivery semantics. Default: sync for request-path reads, async with at-least-once delivery plus idempotent receivers for mutations; exactly-once is never assumed.
|
|
19
|
+
7. Distributed-transaction stance. Adopt cross-service transactions (almost never) or plan the outbox pattern with reconciliation. Hard to reverse because invariant enforcement points spread through the codebase. Default: single-writer boundaries plus outbox; reject two-phase commit.
|
|
20
|
+
8. Wire formats and public interface style. What crosses component boundaries and how it versions. Hard to reverse because external consumers freeze it on first use. Default: JSON over HTTP for sync, versioned event payloads for async, with an explicit compatibility rule.
|
|
21
|
+
9. Runtime topology and redundancy per critical-path component. Instance count, what routes traffic to them, and the failover story behind each availability number. Moderately reversible, since instances and a routing tier can be added later, except for stateless versus sticky: sticky handling puts session state in process memory, and every feature written afterward assumes it is there. Default: stateless handling behind a health-checked routing tier, state in the shared store, every single point of failure named with an accepted downtime number.
|
|
22
|
+
10. Cache tiering and staleness budget per cached read path. Which tier holds it, how stale it may be in seconds, what invalidates it, what stops a stampede. Reversible in mechanism, not in contract: once a path serves stale data, downstream code depends on that tolerance, and tightening it later means finding every consumer. Default: no cache until the arithmetic fails without one, then the narrowest tier that closes the gap.
|
|
23
|
+
11. Overload posture per entry surface. What happens when load passes the throughput ceiling: shed, queue, or degrade. The most reversible of the set, forced anyway because the untaken decision defaults to unbounded queueing, which turns a spike into a timeout cascade with no signal. Default: shed at the edge with a retryable status and a Retry-After, bounded queues behind it, one named degraded path for the critical journey.
|
|
24
|
+
|
|
25
|
+
## Plan requirements
|
|
26
|
+
|
|
27
|
+
Consumed by the orchestrator's inversion pass; each becomes acceptance criteria on concrete tasks.
|
|
28
|
+
|
|
29
|
+
R-ARCH-1 PLAN.mdx grounds architecture in the product section: the architecture pass runs after product, and every architecture claim traces to a stated entity, NFR, or appetite. If no PRD-equivalent exists, the plan states entities, NFRs, and appetite as explicit assumptions before any shape talk.
|
|
30
|
+
Criterion: WHEN the architecture section makes a claim, THE PLAN SHALL trace it to a product requirement or a labeled assumption, and SHALL NOT contain architecture invented without either.
|
|
31
|
+
|
|
32
|
+
R-ARCH-2 PLAN.mdx records the load-bearing check verbatim: more than one persistence layer, more than one deployable, a load-bearing third-party integration, an NFR that constrains shape, team over 2 and growing, or lifespan over 12 months maintained by others. If none hold, the architecture section is a one-page shape statement (one service, one database, sync calls, one trust boundary) and stops.
|
|
33
|
+
Criterion: IF no load-bearing trigger holds, THE PLAN SHALL cap the architecture section at one page with ADR-001 as its only ADR, and SHALL record each skipped requirement as dropped-by scale.
|
|
34
|
+
|
|
35
|
+
R-ARCH-3 PLAN.mdx answers the 8 pre-flight questions in writing: purpose, appetite, honest 12-month scale ceiling, binding NFRs, team shape, incumbent stack, external integrations with their failure modes, and the product section's explicit deferrals to architecture.
|
|
36
|
+
Criterion: WHEN the architecture section opens, THE PLAN SHALL contain all 8 answers, including a numeric 12-month scale ceiling and at least one named failure mode per external integration.
|
|
37
|
+
|
|
38
|
+
R-ARCH-4 PLAN.mdx picks exactly one system shape with ADR-001 semantics: alternatives rejected with reasons, the flip point that would reverse the choice, and the blast radius if wrong. The seven listed shapes are the presumptive set; an eighth shape is permitted only when the plan names the constraint that no listed shape satisfies and carries the same flip point and blast radius under the same rigor. Modular monolith is the default; any microservices choice names one of the three forcing functions.
|
|
39
|
+
Criterion: WHEN a system shape is stated, THE PLAN SHALL name at least two rejected alternatives, one flip point, and one blast radius; IF the shape is microservices, THE PLAN SHALL name the forcing function or change the shape.
|
|
40
|
+
|
|
41
|
+
R-ARCH-5 PLAN.mdx enumerates components as domain bounded contexts (Ordering, Billing; never UserService or CoreAPI), each with six fields: bounded context, one-sentence responsibility without compounds, interface (sync/async, wire format, idempotency posture), data ownership with one writer per entity, dependencies, failure posture. No anemic services (thin wrapper over one table) and no god services (owns half the domain).
|
|
42
|
+
Criterion: WHEN a component is listed, THE PLAN SHALL populate all six fields; IF a component's responsibility sentence contains "and", THE PLAN SHALL split or rename it.
|
|
43
|
+
|
|
44
|
+
R-ARCH-6 The component dependency lists in PLAN.mdx form a cycle-free DAG, because the roadmap pass topologically sorts it into waves.
|
|
45
|
+
Criterion: WHEN component dependencies are declared, THE PLAN SHALL contain no dependency cycle, and the phase ordering SHALL place load-bearing components before their dependents.
|
|
46
|
+
|
|
47
|
+
R-ARCH-7 PLAN.mdx specifies data architecture per entity before any tool name: key attributes, cardinality, tenancy model, lifecycle, retention, and a storage shape per entity group. Database product names are banned from the architecture section; they belong to the stack section.
|
|
48
|
+
Criterion: WHEN an entity is defined, THE PLAN SHALL state tenancy, lifecycle, retention, and storage shape; IF the architecture section names a database product, THE PLAN SHALL move the name to the stack section and keep only the shape.
|
|
49
|
+
|
|
50
|
+
R-ARCH-8 PLAN.mdx names cross-entity invariants with their enforcement points and takes an explicit distributed-transaction stance (adopt with justification or reject in favor of the outbox pattern), recorded with ADR-002 semantics for non-obvious storage shapes.
|
|
51
|
+
Criterion: WHEN two entities share an invariant, THE PLAN SHALL name the component that enforces it; IF an invariant spans components, THE PLAN SHALL specify outbox or an equivalent pattern rather than a cross-service transaction.
|
|
52
|
+
|
|
53
|
+
R-ARCH-9 For every integration, PLAN.mdx records four decisions: sync vs async; transport shape and its failure mode; idempotency posture (key, retry policy, dedup window; exactly-once treated as at-least-once plus idempotent receivers); failure blast radius handling (circuit breaker, backoff with jitter, DLQ, or degradation path).
|
|
54
|
+
Criterion: WHEN a network mutation appears in any task, THE PLAN SHALL give it an idempotency key and retry policy; WHEN an integration is listed, THE PLAN SHALL state what users experience while it is down.
|
|
55
|
+
|
|
56
|
+
R-ARCH-10 PLAN.mdx justifies or rejects each heavy pattern by name: event sourcing, CQRS, service mesh, API gateway, Kubernetes, Kafka. Adoption requires a product-grounded ADR; rejection requires one stated reason.
|
|
57
|
+
Criterion: IF any heavy pattern appears in the plan, THE PLAN SHALL cite the product constraint that forces it; IF none exists, THE PLAN SHALL record the rejection with a reason.
|
|
58
|
+
|
|
59
|
+
R-ARCH-11 PLAN.mdx does the NFR math: latency budget decomposed across the request path with p50/p95/p99; throughput per component at the scale ceiling with the bottleneck named; availability chain arithmetic (a 99.9 percent end-to-end target over 3 critical-path components requires roughly 99.97 percent each); per-component scale ceilings; monthly cost envelope at launch and at 12 months. Infeasible math forces a shape or target change, and the plan names which.
|
|
60
|
+
Criterion: WHEN an NFR target is stated, THE PLAN SHALL show the decomposition arithmetic; IF the arithmetic fails the target, THE PLAN SHALL change the shape or the target and say so.
|
|
61
|
+
|
|
62
|
+
R-ARCH-12 PLAN.mdx contains no bare quality adjectives: scalable, resilient, performant, reliable, observable, cloud-native, future-proof. Each instance is replaced with a number or moved to Open Questions with an owner and a recommended default.
|
|
63
|
+
Criterion: WHEN the plan is emitted, a grep for the banned adjective list in the architecture section SHALL return only lines that also contain a number or an Open Questions reference.
|
|
64
|
+
|
|
65
|
+
R-ARCH-13 PLAN.mdx names the four trust boundaries (network edge, authentication, authorization, tenant/data isolation), each with location, what it protects, what an attacker gains if it falls, and enforcement (two independent layers for load-bearing boundaries, or an acknowledged single-layer risk). It also lists the highest-blast-radius mutations: cross-tenant delete, admin impersonation, billing modification, password reset, API key rotation, export-all endpoints. This section is written to be consumed verbatim by the security module's threat model.
|
|
66
|
+
Criterion: WHEN trust boundaries are declared, THE PLAN SHALL cover all four with all four attributes each, and the security section SHALL reference this list rather than restate it.
|
|
67
|
+
|
|
68
|
+
R-ARCH-14 PLAN.mdx commits to ADR discipline as tasks: at minimum ADR-001 (shape), and when R-ARCH-2's check holds ADR-002 (storage), ADR-003 (trust boundaries), and one per non-obvious decision; every ADR includes flip point and blast radius fields; ADRs live in-repo at a stated path. This module owns `decide.adr` in the documentation set, so no other pass plans an ADR-writing task; the repo module records the row and defers here (repo.md R-REPO-14 and R-REPO-23). ADRs are immutable: a superseded ADR is never deleted and never edited, a new number supersedes it with `supersedes` on the new file and `superseded_by` plus a superseded status on the old, and numbers are never reused, because a citation written last year has to keep resolving to the same decision.
|
|
69
|
+
Criterion: WHEN the plan lists decisions, THE PLAN SHALL contain tasks that write ADR files with flip point and blast radius fields, the task Acceptance lines SHALL be grep-verifiable against those fields, no task outside this module SHALL write a file under the ADR path, and any task that replaces an accepted ADR SHALL mint a new number carrying supersedes and superseded_by rather than editing the original.
|
|
70
|
+
|
|
71
|
+
R-ARCH-15 PLAN.mdx plans version-controlled text diagrams: a mermaid component diagram with trust boundaries (C4 Level 1 equivalent) in the plan itself, and a Level 2 container diagram task with every arrow labeled with protocol and purpose before build starts; maximum 15 boxes per diagram; every element backed by a decision; no image exports, no cloud-vendor icon diagrams.
|
|
72
|
+
Criterion: WHEN a diagram appears, every arrow SHALL carry a protocol and purpose label, and every box SHALL correspond to a component or decision in the plan; IF an element has no backing decision, THE PLAN SHALL delete it.
|
|
73
|
+
|
|
74
|
+
R-ARCH-16 PLAN.mdx names at least three architecture fitness functions with tooling and CI enforcement points: dependency conformance (dependency-cruiser, ArchUnit, or equivalent), data-ownership conformance, and an NFR probe; at least one is wired as a build-phase task, not an aspiration.
|
|
75
|
+
Criterion: WHEN fitness functions are named, THE PLAN SHALL bind each to a tool and a CI step, and at least one SHALL appear as a task with a Verify command.
|
|
76
|
+
|
|
77
|
+
R-ARCH-17 PLAN.mdx makes the architecture section self-sufficient for downstream passes: the stack section can pick tools from the stated storage, compute, cache, and routing shapes plus NFR constraints; the roadmap section can order phases from the component DAG; the database section can implement replication, partitioning, and read routing from stances already set; the build tasks can copy trust boundaries, idempotency postures, and overload behavior without re-deriving them.
|
|
78
|
+
Criterion: WHEN the stack, roadmap, database, or build pass runs, THE PLAN SHALL already contain the shapes, constraints, and DAG it needs, without a new user interview.
|
|
79
|
+
|
|
80
|
+
R-ARCH-18 PLAN.mdx schedules architecture lifecycle work: a sign-off checkpoint where presenting the plan is the attestation request, and a post-build drift audit task in the final Verification phase comparing built system to planned shape (the ghost-architecture catch), scheduled within 30-90 days of build completion.
|
|
81
|
+
Criterion: WHEN the final phase is written, THE PLAN SHALL contain a drift-audit task whose Acceptance compares running components, data owners, and boundaries against the plan's declarations.
|
|
82
|
+
|
|
83
|
+
R-ARCH-19 The architecture section of PLAN.mdx stays under three pages of prose (tables, diagrams, and ADR tasks excluded, the capacity tables among them) and survives the substitution test: swap the domain nouns (orders for tickets) or the storage shape and the text must become false, or it is decoration and gets cut.
|
|
84
|
+
Criterion: WHEN the architecture section is drafted, THE PLAN SHALL contain no paragraph that reads equally true for an unrelated product; any such paragraph SHALL be deleted or made specific.
|
|
85
|
+
|
|
86
|
+
R-ARCH-20 When the system exposes an API or service surface, PLAN.mdx settles the API contract: the API style (REST, GraphQL, or RPC) and why; a versioning strategy that does not break existing consumers; a machine-readable contract (an OpenAPI document or a GraphQL schema) as a planned artifact, whose generated reference is the `build.api-reference` row; consistent resource and URI modeling for REST; a single error envelope (RFC 7807 Problem Details or a documented equivalent); and the interaction-safety postures, an idempotency key on retryable unsafe operations and connection authentication plus resource bounds on any real-time (WebSocket or SSE) surface.
|
|
87
|
+
Criterion: WHEN an API surface is planned THE PLAN SHALL name the API style, the versioning strategy, the contract artifact, and the error envelope, and SHALL require an idempotency key on retryable create-or-charge endpoints and authenticated, bounded real-time connections, each with a Verify line.
|
|
88
|
+
|
|
89
|
+
R-ARCH-21 PLAN.mdx settles reads per entity group, where R-ARCH-8 settled only writes: the consistency stance (strong, read-your-writes, bounded staleness with a number in seconds, or eventual), the read paths pinned to the primary (post-write confirmations, money, auth, inventory), and whether the group outgrows one node at the R-ARCH-3 ceiling. Where that arithmetic fails, the partition key and its skew risk are named here; where it holds, the plan records the number and the threshold that reverses it. Product names stay banned per R-ARCH-7; the database section owns the mechanics.
|
|
90
|
+
Criterion: WHEN an entity group is defined, THE PLAN SHALL state its consistency stance, name its primary-pinned reads, and show its single-node ceiling arithmetic; IF a group exceeds one node, THE PLAN SHALL name the partition key and skew risk here, not in the database section.
|
|
91
|
+
|
|
92
|
+
R-ARCH-22 PLAN.mdx turns each R-ARCH-11 availability number into a topology. Per critical-path component: the redundancy posture (single instance with an annual downtime budget, N instances behind a health-checked routing tier, active-passive with a failover time, or multi-zone with the zone-loss behavior named); stateless or sticky handling, and if sticky, where session state lives and what a user sees when an instance dies; and the routing tier's health-check and removal rule. Remaining single points of failure are listed by name, each accepted with a downtime number or removed.
|
|
93
|
+
Criterion: WHEN a critical-path component carries an availability target, THE PLAN SHALL state its redundancy posture and, where replicated, the health-check removal rule; IF a single point of failure remains, THE PLAN SHALL name it with an accepted downtime number; IF handling is sticky, THE PLAN SHALL state where session state lives.
|
|
94
|
+
|
|
95
|
+
R-ARCH-23 PLAN.mdx treats a cache as a consistency change, not a performance afterthought. Every cached read path carries four fields: tier (client, edge, application, or query result), a numeric staleness budget, an invalidation trigger (TTL expiry, write-through, or an event from the owning component), and stampede protection (single-flight, jittered TTL, or stale-while-revalidate). A cache is planned only where the R-ARCH-11 arithmetic fails without it, naming the budget it closes. Cache product names belong to the stack section.
|
|
96
|
+
Criterion: WHEN a read path is cached, THE PLAN SHALL state its tier, staleness budget, invalidation trigger, stampede protection, and the budget it closes; IF its R-ARCH-21 stance is strong or read-your-writes, THE PLAN SHALL uncache it or route it to the primary and record which.
|
|
97
|
+
|
|
98
|
+
R-ARCH-24 PLAN.mdx states the overload posture per entry surface, where R-ARCH-9 covered only a failing dependency: the behavior at and above the throughput ceiling (shed with a retryable status and a Retry-After header, queue with a bounded depth and maximum wait, or degrade to a named reduced-function path); a concurrency limit per component; a full policy on every queue (drop oldest, drop newest, or dead-letter); and a timeout budget in which no hop waits past its caller's remaining deadline. Capacity limits are labeled apart from the abuse limits the security module owns.
|
|
99
|
+
Criterion: WHEN a throughput ceiling is stated, THE PLAN SHALL give every entry surface a behavior at and above it, naming the status code or user-visible result; WHEN a queue appears, THE PLAN SHALL give it a bounded depth and a full policy; THE PLAN SHALL label each limiter capacity or abuse and SHALL NOT cite one as satisfying both.
|
|
100
|
+
|
|
101
|
+
## Task seeds
|
|
102
|
+
|
|
103
|
+
- [ ] GP-xxx Write ADR corpus for shape, storage, and trust boundaries
|
|
104
|
+
- Files: docs/adr/001-system-shape.md, docs/adr/002-storage-shapes.md, docs/adr/003-trust-boundaries.md
|
|
105
|
+
- Acceptance: each file contains the strings "Flip point:" and "Blast radius:" and an "Alternatives rejected" section with at least two entries
|
|
106
|
+
- Verify: test "$(grep -l "Flip point:" docs/adr/00*.md | wc -l)" -ge 3
|
|
107
|
+
- Requirements: R-ARCH-4, R-ARCH-8, R-ARCH-14
|
|
108
|
+
|
|
109
|
+
- [ ] GP-xxx Author C4 Level 2 container diagram with labeled arrows
|
|
110
|
+
- Files: docs/architecture/containers.mmd
|
|
111
|
+
- Acceptance: mermaid source; every edge label contains a protocol token (HTTP, gRPC, queue, or event); box count 15 or fewer
|
|
112
|
+
- Verify: grep -q -- "-->" docs/architecture/containers.mmd && test "$(grep -c -- "-->" docs/architecture/containers.mmd)" -eq "$(grep -cE -- "-->\|[^|]*(HTTP|gRPC|queue|event)" docs/architecture/containers.mmd)"
|
|
113
|
+
- Requirements: R-ARCH-15
|
|
114
|
+
|
|
115
|
+
- [ ] GP-xxx Wire dependency-conformance fitness function into CI
|
|
116
|
+
- Files: .dependency-cruiser.cjs, .github/workflows/ci.yml
|
|
117
|
+
- Acceptance: rule set forbids imports that cross bounded-context directories except through each context's public index; CI workflow runs the check on every push
|
|
118
|
+
- Verify: npx dependency-cruiser --config .dependency-cruiser.cjs src && grep -q "dependency-cruiser" .github/workflows/ci.yml
|
|
119
|
+
- Requirements: R-ARCH-16
|
|
120
|
+
|
|
121
|
+
- [ ] GP-xxx Implement outbox pattern for cross-context mutations
|
|
122
|
+
- Files: src/shared/outbox/outbox.ts, migrations/NNN_create_outbox.sql, src/shared/outbox/dispatcher.ts
|
|
123
|
+
- Acceptance: outbox table written in the same transaction as the domain mutation; dispatcher retries with backoff and jitter; consumer handlers deduplicate on an idempotency key column
|
|
124
|
+
- Verify: grep -q "idempotency_key" migrations/*outbox*.sql && grep -rq "outbox" src/shared/outbox/dispatcher.ts
|
|
125
|
+
- Requirements: R-ARCH-8, R-ARCH-9
|
|
126
|
+
|
|
127
|
+
- [ ] GP-xxx Enforce tenant isolation in the query layer
|
|
128
|
+
- Files: src/shared/db/scoped-client.ts
|
|
129
|
+
- Acceptance: query layer requires a tenant id on every accessor (no raw-client export); the database layer comes from the R-DB-19 roles and RLS task, never a second migration here
|
|
130
|
+
- Verify: grep -q "tenant_id" src/shared/db/scoped-client.ts
|
|
131
|
+
- Requirements: R-ARCH-13
|
|
132
|
+
|
|
133
|
+
- [ ] GP-xxx Run NFR probe against the latency and availability budget
|
|
134
|
+
- Files: tests/nfr/latency-probe.test.ts, docs/architecture/nfr-budget.md
|
|
135
|
+
- Acceptance: probe asserts the planned p95 budget per request-path hop; budget doc contains the availability chain arithmetic with per-component targets
|
|
136
|
+
- Verify: npx vitest run tests/nfr/latency-probe.test.ts && grep -q "p95" docs/architecture/nfr-budget.md
|
|
137
|
+
- Requirements: R-ARCH-11, R-ARCH-16
|
|
138
|
+
|
|
139
|
+
- [ ] GP-xxx Publish the capacity model and enforce it at every entry surface
|
|
140
|
+
- Files: docs/architecture/capacity-model.md, src/shared/http/admission.ts, src/shared/queue/bounded.ts
|
|
141
|
+
- Acceptance: one row per critical-path component with redundancy posture and failover time; one per entry surface with its shed, queue, or degrade behavior; every single point of failure named with an accepted annual downtime number; the limiter rejects past the planned ceiling with a retryable status and Retry-After; the queue constructor requires an explicit depth and full policy
|
|
142
|
+
- Verify: grep -qi "single point of failure" docs/architecture/capacity-model.md && grep -q "Retry-After" src/shared/http/admission.ts && grep -qE "maxDepth|max_depth" src/shared/queue/bounded.ts
|
|
143
|
+
- Requirements: R-ARCH-22, R-ARCH-24
|
|
144
|
+
|
|
145
|
+
- [ ] GP-xxx Pin primary reads and cache only what the staleness budget allows
|
|
146
|
+
- Files: docs/architecture/cache-policy.md, src/shared/cache/index.ts, src/shared/db/read-routing.ts, tests/consistency/read-your-writes.test.ts
|
|
147
|
+
- Acceptance: the policy doc lists each cached path with its tier, staleness budget, and the budget it closes; every accessor requires an explicit TTL and invalidation trigger, with no default reachable; concurrent misses on one key collapse to one upstream read; the test proves a write is visible to the immediately following primary-pinned read
|
|
148
|
+
- Verify: grep -q "Staleness budget:" docs/architecture/cache-policy.md && grep -qE "singleFlight|single_flight|dedupe" src/shared/cache/index.ts && npx vitest run tests/consistency/read-your-writes.test.ts
|
|
149
|
+
- Requirements: R-ARCH-21, R-ARCH-23
|
|
150
|
+
|
|
151
|
+
- [ ] GP-xxx Post-build architecture drift audit
|
|
152
|
+
- Files: docs/architecture/drift-audit.md
|
|
153
|
+
- Acceptance: audit compares deployed components, single-writer ownership, trust-boundary enforcement, redundancy posture, cache staleness, and overload behavior against PLAN.mdx declarations; every mismatch gets a superseding ADR or a fix task, never a silent edit
|
|
154
|
+
- Verify: grep -q "drift" docs/architecture/drift-audit.md && grep -qc "PLAN.mdx" docs/architecture/drift-audit.md
|
|
155
|
+
- Requirements: R-ARCH-18
|
|
156
|
+
|
|
157
|
+
## Self-audit rubric
|
|
158
|
+
|
|
159
|
+
100 points total. Score the drafted architecture section before emission; below 85 forces a revision pass.
|
|
160
|
+
|
|
161
|
+
- Grounding and load-bearing check (8): product-traced claims or labeled assumptions; load-bearing check recorded; all 8 pre-flight answers present with a numeric scale ceiling. Full marks require zero ungrounded claims.
|
|
162
|
+
- System shape decision (12): exactly one shape, ADR-001 semantics complete, default honored or overridden with a named constraint, microservices forcing function named if applicable.
|
|
163
|
+
- Components and data architecture (18): all six fields per component, cycle-free DAG, single writer per entity, tenancy/lifecycle/retention per entity, storage shapes with zero database product names in the section, plus a read-consistency stance and ceiling arithmetic per entity group, with a partition key wherever that arithmetic fails.
|
|
164
|
+
- Integrations and idempotency (9): four decisions per integration, idempotency key and retry policy on every network mutation, heavy patterns each justified or rejected.
|
|
165
|
+
- NFR arithmetic (12): latency decomposition, throughput at ceiling, availability chain math, cost envelope at launch and 12 months, zero unresolved banned adjectives.
|
|
166
|
+
- Trust boundaries (13): four boundaries with four attributes each, dual-layer enforcement or acknowledged risk, highest-blast-radius mutation list present and referenced by the security section.
|
|
167
|
+
- Runtime topology, caching, and overload (15): redundancy posture and health-check rule per critical-path component, single points of failure named with downtime numbers, four fields on every cached read path, and a shed/queue/degrade posture with bounded queues on every entry surface. Full marks require zero caches without a staleness number.
|
|
168
|
+
- ADR, diagram, and fitness discipline (9): three or more ADR tasks with flip point and blast radius (one when R-ARCH-2's check fails), labeled-arrow diagrams within the box cap, three named fitness functions with one wired as a task.
|
|
169
|
+
- Handoff and lifecycle (4): stack/roadmap/database/build passes need no re-interview; drift audit scheduled in the final phase.
|
|
170
|
+
|
|
171
|
+
## Anti-patterns refused
|
|
172
|
+
|
|
173
|
+
- Architecture theater: boxes and arrows no one can name a flip point for. The planner deletes any element without a reversing condition.
|
|
174
|
+
- Paper-tiger architecture: shape claims with no latency, throughput, or availability arithmetic. The planner refuses to emit NFR targets without the decomposition math.
|
|
175
|
+
- Cargo-cult cloud-native: Kubernetes, Kafka, mesh, event sourcing, CQRS, or a gateway without a product-grounded constraint. The planner records a rejection with a reason instead.
|
|
176
|
+
- Stackitecture: a tool list posing as architecture, or a data section that jumps to a database name. The planner strips product names from the architecture section and keeps only shapes; the pick moves to the stack pass.
|
|
177
|
+
- Resume-driven architecture: novelty chosen for the builder, not the product. The planner applies the default (modular monolith, relational, sync-first) unless a constraint overrides it.
|
|
178
|
+
- Invisible/horoscope architecture: prose that reads the same for any product. The planner runs the substitution test and cuts every paragraph that survives a noun swap.
|
|
179
|
+
- Ghost architecture: the plan describes one system and the build produces another. The planner schedules the drift audit task in the final phase so the mismatch is caught, not assumed away.
|
|
180
|
+
- Availability theater: chain arithmetic assigning 99.97 percent to a component that runs as one instance. The planner requires a topology row per critical-path component and names every single point of failure with a downtime number.
|
|
181
|
+
- Silent staleness: a cache added for speed, quietly changing the consistency contract because nobody wrote down how stale is acceptable. The planner refuses a cached path lacking a staleness number, an invalidation trigger, and the budget it closes.
|
|
182
|
+
- Infinite-capacity assumption: no stated behavior above the ceiling, so the untaken decision becomes unbounded queueing and the first spike arrives as a timeout cascade. The planner gives every entry surface a shed, queue, or degrade posture and caps every queue.
|
|
183
|
+
- Deferred partition key: sharding postponed to "when we need it", by which time every query has calcified around one node and the key changes only under live-migration pressure. The planner runs the ceiling arithmetic here and either names the key or records the number showing one node holds.
|
|
184
|
+
- Distributed monolith: multiple services writing one table, or sync chains across services on every request. The planner enforces single-writer ownership and flags request-path sync fan-out as a shape error.
|
|
185
|
+
- Anemic and god services: a component wrapping one table, or one owning half the domain. The planner merges or splits at bounded-context lines before tasks are cut.
|
|
186
|
+
- Silent NFR numbers and silent trust boundaries: targets or boundaries implied but never written. The planner blocks emission until both sections carry explicit values.
|
|
187
|
+
- Unlabeled diagram arrows: an edge with no protocol and purpose. The planner labels or deletes it.
|
|
188
|
+
- Prose bloat: architecture narrative past three pages. The planner moves detail into ADR tasks and tables and caps the prose.
|
|
189
|
+
- Bare-adjective claims: scalable, resilient, future-proof as assertions. The planner replaces each with a number or an owned open question with a recommended default.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Application build planning module
|
|
2
|
+
|
|
3
|
+
Plans the build sections of PLAN.mdx: slices, wiring contracts, auth, states, tests, and hardening for any multi-page connected app. The orchestrator loads it for archetypes saas-dashboard, api-service, mobile-app, and any project with auth, navigation, and CRUD over domain data; it is excluded for marketing-site, library, and single-component work with a stated reason.
|
|
4
|
+
|
|
5
|
+
## Lineage
|
|
6
|
+
|
|
7
|
+
Descends from production-ready, the building-tier core of hannsxpeter/ready-suite. Its target failure mode is the hollow dashboard: an app that looks finished but where buttons do not save, filters do not filter, charts render hardcoded JSON, sidebar links 404, and login accepts anything. The discipline that carries over is vertical-slice construction (one feature end-to-end before the next), the no-scaffold-no-placeholder rule (every visible element wired to a real backend), the CTA-completeness contract, the 30-second hollow-check grep protocol, and the deferred-CTA and open-questions lifecycles with hard closure gates. godplans inverts these from build-time enforcement into plan-time requirements: the plan is written so an executing agent cannot produce a hollow app without visibly failing a Verify line.
|
|
8
|
+
|
|
9
|
+
## Decisions to force
|
|
10
|
+
|
|
11
|
+
Ordered hardest-to-reverse first. Each must land in the plan's Decisions section as a grounded decision, a flagged hypothesis with a validation plan, or a named open question with a recommended default.
|
|
12
|
+
|
|
13
|
+
Cited, not restated. Domain data representation (money, soft delete) is database decisions 4 and 6 (R-DB-4); tenancy is architecture decision 2 and database decision 3; the persistence engine and ORM are stack decisions 1 and 8; auth, session strategy, and the password KDF are security decision 2 and stack decision 3 (R-SEC-6 names the KDF, argon2id by default). This module records how each slice applies them (R-BUILD-2, R-BUILD-3, R-BUILD-8) and forces only the build-shaped decisions below.
|
|
14
|
+
|
|
15
|
+
1. Route map. Question: the complete URL tree, every page, parent to child. Hard to reverse because URLs leak into bookmarks, nav components, tests, and (post-launch) search indexes. Default: enumerate the full map in the plan before any UI task exists; no task may add a nav link ahead of its registered route.
|
|
16
|
+
2. RBAC shape. Question: which roles (minimum 2) and the full resource-x-action permission matrix. Hard to reverse because permission checks thread through every mutation; adding a role later means re-auditing all of them. Default: write the matrix as a table in the plan; every mutation task cites the matrix cell it enforces.
|
|
17
|
+
3. Visual identity. Question: consume a project-root DESIGN.md (lint-clean, tokens wired) or derive an archetype plus 5 decisions (palette, typography, radius, density, signature element)? Hard to reverse because retheming after 30 components is a full sweep. Default: derive and record the 5 decisions if no DESIGN.md exists; no component task ships on an unmodified shadcn, Radix, or MUI default theme.
|
|
18
|
+
4. Slice order. Question: which feature is built first, second, third? Ordered most-used first, riskiest second, nice-to-haves last. Hard to reverse in effect: a mid-build stop leaves whatever was ordered first as the only complete feature. Default: order by user job frequency, then technical risk.
|
|
19
|
+
5. Target tier. Question: which completion tier does this plan aim for (1 Foundation, 2 Functional, 3 Polished, 4 Hardened)? Sets the scope of the final phases. Default: Tier 3 for anything user-facing; Tier 4 when the plan includes launch or hardening domains.
|
|
20
|
+
|
|
21
|
+
## Plan requirements
|
|
22
|
+
|
|
23
|
+
- R-BUILD-1: PLAN.mdx answers the 12 pre-flight questions in writing (who uses it and for what job, entities with attributes and relationships, the full stack as a set, where data lives, auth model, permission matrix, route map, definition of done for v1, exists-vs-to-build inventory, performance budgets, deploy target, responsive scope) as decisions or stated assumptions, never as gaps; the stack, where-data-lives, and auth answers cite the stack, database, and security decisions that own them and are never re-decided here.
|
|
24
|
+
Criterion: WHEN the build sections are drafted, THE PLAN SHALL contain an answer or stated assumption for all 12 pre-flight questions, with unanswered ones appearing only in Open Questions with a recommended default.
|
|
25
|
+
- R-BUILD-2: PLAN.mdx names the domain and encodes its traps in the schema tasks (money per R-DB-4, double-entry where accounting applies, audit logging where regulation applies).
|
|
26
|
+
Criterion: WHEN the project domain involves money, health, or regulated data, THE PLAN SHALL state the trap and place its mitigation in a schema task's Acceptance lines, not in prose.
|
|
27
|
+
- R-BUILD-3: PLAN.mdx commits to a real persistence layer whose data survives reload and is consistent across two browsers.
|
|
28
|
+
Criterion: IF any task, note, or acceptance line proposes in-memory state, hardcoded JSON, or mock-now-wire-later persistence for user data, THE PLAN SHALL be revised before emission.
|
|
29
|
+
- R-BUILD-4: PLAN.mdx structures build phases as ordered vertical slices, each covering schema, seed, server CRUD with permission checks, client hooks, pages with all states, audit entry, and tests, ending at "an actual person can do an actual job with it".
|
|
30
|
+
Criterion: WHEN build phases are laid out, THE PLAN SHALL define each slice end-to-end with a checkpoint stating the user job it completes.
|
|
31
|
+
- R-BUILD-5: PLAN.mdx never sequences tasks layer-by-layer (all schemas, then all APIs, then all UI), which yields 80 percent on every layer and zero working features.
|
|
32
|
+
Criterion: IF a draft phase groups tasks by technical layer across features, THE PLAN SHALL be restructured into vertical slices before emission.
|
|
33
|
+
- R-BUILD-6: PLAN.mdx carries a CTA-completeness contract: every interactive element's full chain completes to a real user-visible outcome (page renders, record persists, toast confirms, list refreshes); a non-empty leaf onClick is not the gate. Blocked CTAs get exactly one of removed, disabled-with-visible-reason, or a deferred-cta.md entry with all five fields (Location, Intended chain, Blocker, Target slice, Status).
|
|
34
|
+
Criterion: WHEN a slice's tasks are written, THE PLAN SHALL include a CTA-completeness audit task per slice whose Acceptance rejects half-wired chains and vague blockers such as "later".
|
|
35
|
+
- R-BUILD-7: PLAN.mdx contains the complete route map before any UI task, and no task introduces a nav link to an unregistered route.
|
|
36
|
+
Criterion: WHEN UI tasks are enumerated, THE PLAN SHALL list every route in a route map and each nav task SHALL reference only routes registered by the same or an earlier task.
|
|
37
|
+
- R-BUILD-8: PLAN.mdx plans real auth: login rejects bad credentials, stores a session, gates every protected route server-side, and hashes passwords with the KDF R-SEC-6 names (argon2id by default).
|
|
38
|
+
Criterion: WHEN the auth slice is planned, THE PLAN SHALL include acceptance lines for bad-credential rejection and server-side route gating, and SHALL make the slice depend on the R-SEC-6 task for the KDF rather than plan a second hashing task.
|
|
39
|
+
- R-BUILD-9: PLAN.mdx contains the RBAC resource-x-action matrix with at least 2 roles, and every mutation task cites its server-side permission check; UI hiding is courtesy, not security.
|
|
40
|
+
Criterion: WHEN any mutation task is written, THE PLAN SHALL trace it to a cell in the permission matrix and require the check server-side.
|
|
41
|
+
- R-BUILD-10: PLAN.mdx traces each slice to the threat model instead of writing its own: every mutation task names the trust boundary it crosses (R-ARCH-13 when landed, otherwise the R-SEC-1 list) and any R-SEC-1 entry point it adds, and multi-tenant plans scope every query server-side by tenant.
|
|
42
|
+
Criterion: WHEN a slice adds an entry point or a mutation, THE PLAN SHALL cite the trust boundary (R-ARCH-13 when landed, otherwise R-SEC-1) and the R-SEC-1 entry it touches and, IF multi-tenant, SHALL require tenant scoping in every query task's Acceptance.
|
|
43
|
+
- R-BUILD-11: PLAN.mdx commits the visual identity before any component task: a consumed DESIGN.md or a recorded archetype plus 5 token decisions; at least one rendered component visibly inherits from --color-primary; icons come from a real icon library, never emojis.
|
|
44
|
+
Criterion: WHEN component tasks exist, THE PLAN SHALL place the visual-identity decision in a task that precedes them all and SHALL forbid unmodified library default themes.
|
|
45
|
+
- R-BUILD-12: PLAN.mdx requires loading, empty, and error states for every async surface (specific, not generic spinners), client plus server validation with inline field errors, a success or error toast after every mutation, and URL-preserved pagination, sorting, and filtering on any table over 25 rows.
|
|
46
|
+
Criterion: WHEN a page task touches an async surface, table, or form, THE PLAN SHALL name the required states and feedback in that task's Acceptance lines.
|
|
47
|
+
- R-BUILD-13: PLAN.mdx plans tests inside each slice, not as a trailing phase: integration CRUD, permission-denial, axe accessibility, and a contract test for any cross-slice public signature (graduated rule: leaf features skip; mandatory the moment a second slice depends on the signature).
|
|
48
|
+
Criterion: WHEN a slice is planned, THE PLAN SHALL include its test tasks in the same slice, and a slice without them SHALL NOT be marked complete by its checkpoint.
|
|
49
|
+
- R-BUILD-14: PLAN.mdx plans the supply-chain check into the bootstrap task: every unfamiliar dependency is verified to exist on the registry with a real publisher and non-trivial downloads before install (defense against the roughly 20 percent AI ghost-package rate).
|
|
50
|
+
Criterion: WHEN the bootstrap task is written, THE PLAN SHALL include registry verification in its Acceptance for every dependency not already in a lockfile.
|
|
51
|
+
- R-BUILD-15: PLAN.mdx schedules a hardening pass before the verification phase that runs the security module's controls instead of restating them (the R-SEC-15 header set, the R-SEC-16 rate limits, the R-SEC-17 SCA gate) and adds the two build-owned checks: no secrets in the client bundle, and a bundle budget with code-splitting for heavy libraries.
|
|
52
|
+
Criterion: WHEN phases are sequenced, THE PLAN SHALL place every landed R-SEC-15, R-SEC-16, and R-SEC-17 task before final verification, SHALL contain a build task whose acceptance lines check the client bundle for secrets and enforce the bundle budget, and SHALL NOT plan a second header, rate-limit, or audit task.
|
|
53
|
+
- R-BUILD-16: PLAN.mdx schedules the hollow-check grep after every slice and at every tier boundary, with the have-nots as acceptance criteria: no TODO or implement-later markers, no raw console.log in prod paths (one exclusion: logger calls in catch blocks), no hardcoded fake-data arrays in components, no Math.random() driving charts or KPIs, no alert() or prompt() for UI, no components named ExampleX, DemoY, or TestZ.
|
|
54
|
+
Criterion: WHEN slice and tier boundaries are defined, THE PLAN SHALL attach a hollow-check task whose Verify is a grep command that must return zero hits.
|
|
55
|
+
- R-BUILD-17: PLAN.mdx plans session-state discipline: .godplans/STATE.md, scoped to build-tier facts not already tracked by PLAN.mdx (current tier, active build decisions, next slice; slice completion lives in the plan's checkboxes and open decisions live in its Open Questions section), updated at every tier boundary and session end. A non-obvious architectural choice made during build becomes a new ADR in the architecture module's ADR task (R-ARCH-14 owns `decide.adr` and its path), or a `### D<n>` entry in `## Decisions` while R-ARCH-2's load-bearing check fails; this module plans no ADR-writing task. On any conflict between STATE.md and PLAN.mdx, PLAN.mdx wins.
|
|
56
|
+
Criterion: WHEN the build sections are drafted, THE PLAN SHALL include tasks that create and maintain STATE.md, SHALL route every build-time ADR to the R-ARCH-14 task (to `## Decisions` while R-ARCH-2's check fails), and open questions above 5 or deferred CTAs above 10 SHALL be flagged as drift.
|
|
57
|
+
- R-BUILD-18: PLAN.mdx declares the target tier (1 Foundation, 2 Functional, 3 Polished, 4 Hardened) and, when targeting Tier 4, encodes the closure gates as final-phase must-haves: zero TODOs, zero live deferred-cta entries, zero build-tier entries left in PLAN.mdx's Open Questions section, zero unshipped rewrite items.
|
|
58
|
+
Criterion: WHEN the plan targets Tier 4, THE PLAN SHALL list each closure gate as a grep-verifiable must-have in the final build phase.
|
|
59
|
+
- R-BUILD-19: PLAN.mdx schedules the cross-cutting layer (search, exports, notifications, theme toggle, audit-log viewer, profile) as a Tier-3 pass after 2 to 3 slices are complete, never before the first slice works.
|
|
60
|
+
Criterion: WHEN cross-cutting features appear, THE PLAN SHALL place them in a phase that depends on at least two completed slices.
|
|
61
|
+
- R-BUILD-20: In brownfield or replan mode, PLAN.mdx contains a keep-rewrite-discard inventory of existing code before any build task touches it, and consumed upstream artifacts (PRD, ARCH, ROADMAP) are treated as historical records, with current code winning on conflict.
|
|
62
|
+
Criterion: IF mode is brownfield or replan, THE PLAN SHALL include the inventory as a table and every rewrite task SHALL reference its inventory row.
|
|
63
|
+
|
|
64
|
+
## Task seeds
|
|
65
|
+
|
|
66
|
+
Templates ready to instantiate. Replace path placeholders and the entity token with the project's real stack (paths below assume a TypeScript app; adapt Files and Verify to the committed stack). GP-xxx is the repeating slice template: instantiate it once per slice in the decided order.
|
|
67
|
+
|
|
68
|
+
- [ ] GP-xxx Bootstrap project with verified dependencies
|
|
69
|
+
- Files: package.json, package-lock.json, .godplans/STATE.md
|
|
70
|
+
- Acceptance: every dependency in package.json resolves on the registry with a real publisher; STATE.md exists with tier, stack, and next-slice fields; no dependency was installed without the registry check
|
|
71
|
+
- Verify: npm ls --depth=0 && grep -q "Current tier" .godplans/STATE.md
|
|
72
|
+
- Requirements: R-BUILD-14, R-BUILD-17
|
|
73
|
+
- [ ] GP-xxx Login slice: bad-credential rejection, session persistence, server-side route gating
|
|
74
|
+
- Files: src/server/auth.ts, src/middleware.ts, src/app/login/page.tsx, tests/auth.test.ts
|
|
75
|
+
- Depends on: GP-xxx security auth foundation (R-SEC-6, R-SEC-7)
|
|
76
|
+
- Acceptance: login with bad credentials returns 401; session persists across reload; every route under /app redirects unauthenticated server-side
|
|
77
|
+
- Verify: npm test -- tests/auth.test.ts
|
|
78
|
+
- Requirements: R-BUILD-8, R-BUILD-9
|
|
79
|
+
- [ ] GP-xxx Vertical slice: <entity> end-to-end
|
|
80
|
+
- Files: prisma/schema.prisma, src/server/<entity>.ts, src/hooks/use-<entity>.ts, src/app/<entity>/page.tsx, tests/<entity>.test.ts
|
|
81
|
+
- Acceptance: list, detail, create, edit, delete all persist and survive reload; each mutation enforces its permission matrix cell server-side; loading, empty, and error states exist on every async surface; integration CRUD, permission-denial, and axe tests pass
|
|
82
|
+
- Verify: npm test -- tests/<entity>.test.ts
|
|
83
|
+
- Requirements: R-BUILD-3, R-BUILD-4, R-BUILD-9, R-BUILD-12, R-BUILD-13
|
|
84
|
+
- [ ] GP-xxx CTA-completeness audit for slice <n>
|
|
85
|
+
- Files: .godplans/deferred-cta.md
|
|
86
|
+
- Acceptance: every button, link, form, menu, and drawer on touched pages completes its chain to a user-visible outcome; blocked CTAs are removed, disabled-with-visible-reason, or logged with all five fields; no entry has a vague blocker
|
|
87
|
+
- Verify: test -f .godplans/deferred-cta.md && ! grep -riE "blocker: *(later|soon|tbd)" .godplans/deferred-cta.md
|
|
88
|
+
- Requirements: R-BUILD-6, R-BUILD-7
|
|
89
|
+
- [ ] GP-xxx Hollow-check gate at tier boundary
|
|
90
|
+
- Files: src/
|
|
91
|
+
- Acceptance: zero TODO or implement-later markers in prod paths; zero hardcoded fake-data arrays in components; zero Math.random() driving charts or KPIs; zero alert() or prompt() for UI
|
|
92
|
+
- Verify: test -d src && ! grep -rnE "TODO|implement later|hook up to API|Math.random\(\)" src/ --include="*.tsx" --include="*.ts"
|
|
93
|
+
- Requirements: R-BUILD-16, R-BUILD-18
|
|
94
|
+
- [ ] GP-xxx Cross-cutting Tier-3 pass
|
|
95
|
+
- Files: src/app/search/, src/components/export-button.tsx, src/components/theme-toggle.tsx, src/app/audit-log/page.tsx
|
|
96
|
+
- Acceptance: search queries the real persistence layer; exports produce a downloadable file from live data; audit-log viewer reads the audit table written by prior slices; all new CTAs pass the completeness contract
|
|
97
|
+
- Verify: npm test -- tests/cross-cutting.test.ts
|
|
98
|
+
- Requirements: R-BUILD-19, R-BUILD-6
|
|
99
|
+
- [ ] GP-xxx Client bundle hardening before verification
|
|
100
|
+
- Files: next.config.js, .size-limit.json
|
|
101
|
+
- Depends on: GP-xxx every landed R-SEC-15, R-SEC-16, and R-SEC-17 task
|
|
102
|
+
- Acceptance: no secret matches (server-only env names, live key prefixes, private-key headers) in the client bundle output; a per-route bundle budget is set and enforced; heavy libraries load through dynamic import
|
|
103
|
+
- Verify: npm run build && test -d .next/static && ! grep -rqE "sk_live_|PRIVATE KEY|DATABASE_URL" .next/static && npx size-limit
|
|
104
|
+
- Requirements: R-BUILD-15
|
|
105
|
+
|
|
106
|
+
## Self-audit rubric
|
|
107
|
+
|
|
108
|
+
Score the drafted build sections 0-100. Below 85 total, revise before emission.
|
|
109
|
+
|
|
110
|
+
- Vertical-slice structure (20): every build phase is a vertical slice with the full per-slice recipe, ordered most-used then riskiest then nice-to-have; no layer-by-layer grouping anywhere; each slice checkpoint names the user job it completes.
|
|
111
|
+
- Real wiring and CTA completeness (20): persistence decision is real-and-persistent; per-slice CTA audit tasks exist; deferred-cta.md lifecycle with the five-field schema is planned; hollow-check grep tasks sit at every slice and tier boundary with exact Verify commands.
|
|
112
|
+
- Auth, RBAC, and threat model (15): auth slice has bad-credential, session, and server-gating acceptance lines citing the R-SEC-6 KDF; permission matrix present with at least 2 roles; every mutation traced to a trust boundary (R-ARCH-13 when landed, otherwise R-SEC-1); tenant scoping required per query if multi-tenant.
|
|
113
|
+
- States, feedback, and tests (15): loading, empty, and error states named per async surface; validation and toast requirements on every form and mutation task; per-slice test tasks cover integration CRUD, permission-denial, axe, and graduated contract tests.
|
|
114
|
+
- Visual identity (10): identity decision precedes all component tasks; DESIGN.md consumed or archetype plus 5 decisions recorded; default-theme prohibition and icon-library requirement stated.
|
|
115
|
+
- Supply chain and hardening (10): registry verification in the bootstrap task; landed R-SEC-15/16/17 tasks scheduled before verification plus the client-bundle secrets and bundle-budget task.
|
|
116
|
+
- Session state and closure (10): STATE.md task present and build-time ADRs routed to the R-ARCH-14 task (or `## Decisions` while R-ARCH-2's check fails); target tier declared; Tier-4 closure gates encoded as must-haves when applicable; drift thresholds (5 open questions, 10 deferred CTAs) stated.
|
|
117
|
+
|
|
118
|
+
## Anti-patterns refused
|
|
119
|
+
|
|
120
|
+
- Horizontal layering: phases grouped as all schemas, then all APIs, then all UI; 80 percent done on every layer, zero features work. The planner restructures into vertical slices before emission.
|
|
121
|
+
- The half-wired CTA: a button whose chain stalls before a user-visible outcome; a non-empty onClick passed as done. The planner requires per-slice CTA audit tasks whose acceptance is chain completion, not handler existence.
|
|
122
|
+
- Hollow scaffold: TODO markers, hardcoded fake-data arrays, Math.random() charts, alert() dialogs shipped as features. The planner encodes the have-nots as zero-hit grep Verify lines at every boundary.
|
|
123
|
+
- Coming-soon navigation: sidebar links to unregistered routes, disabled nav items, placeholder pages. The planner writes the full route map first and forbids nav tasks ahead of their routes.
|
|
124
|
+
- Login theater: a login page that accepts any credentials, or permission checks that live only in the client. The planner puts bad-credential rejection and server-side enforcement into acceptance lines, with UI hiding named as courtesy.
|
|
125
|
+
- Default-theme shipping: unmodified shadcn, Radix, or MUI theme visible to users. The planner forces the visual-identity decision into a task that precedes all component work.
|
|
126
|
+
- Slopsquatting: installing a hallucinated package that does not exist on the registry. The planner puts registry verification into the bootstrap task's acceptance.
|
|
127
|
+
- Mock-now-wire-later: in-memory or hardcoded persistence with a promise to wire it up later; there is no later. The planner refuses to emit any task whose data source is not the committed persistence layer.
|
|
128
|
+
- ADR-less decisions: a non-obvious architectural choice with no record. The planner adds the choice to the architecture module's ADR task (R-ARCH-14) instead of planning a second ADR writer (a `### D<n>` decision while R-ARCH-2's check fails).
|
|
129
|
+
- Vague deferral: a deferred CTA or open question whose blocker reads "later" or "soon". The planner requires the five-field entry schema and flags drift past the thresholds.
|
|
130
|
+
- Unconfirmed destruction: a task that runs rm -rf, DROP TABLE, git push --force, or a migrate reset without explicit confirmation and a known backup. The planner writes the confirmation requirement into the task itself.
|