@haposoft/cafekit 0.16.0-rc.3 → 0.16.0-rc.5
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/bin/__tests__/change-firewall.semantic-firewall.test.js +2134 -0
- package/bin/__tests__/codex-hooks.test.js +531 -29
- package/bin/__tests__/codex-native.test.js +228 -7
- package/bin/__tests__/develop-contract.test.js +653 -185
- package/bin/__tests__/finalizer-pass-gate.semantic-firewall.test.js +342 -0
- package/bin/__tests__/installer-safety.test.js +39 -0
- package/bin/__tests__/opencode-spec-gate.test.js +24 -16
- package/bin/__tests__/package-inventory.test.js +705 -13
- package/bin/__tests__/release-preflight.semantic-firewall.test.js +578 -0
- package/bin/__tests__/review-receipt-c2.semantic-firewall.test.js +378 -0
- package/bin/__tests__/specs-v2-execution-closeout.test.js +468 -0
- package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +665 -0
- package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +1132 -0
- package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
- package/bin/__tests__/validator-grounding.test.js +2013 -221
- package/bin/lib/managed-writer.js +12 -3
- package/bin/phases/codex-runtime.js +17 -1
- package/package.json +5 -2
- package/src/claude/CLAUDE.md +6 -0
- package/src/claude/agents/code-auditor.md +20 -0
- package/src/claude/agents/spec-maker.md +143 -99
- package/src/claude/hooks/__tests__/completion-authority.test.js +321 -58
- package/src/claude/hooks/__tests__/privacy-block.test.js +254 -0
- package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +115 -40
- package/src/claude/hooks/completion-authority-check.cjs +37 -288
- package/src/claude/hooks/completion-authority-state.cjs +10 -8
- package/src/claude/hooks/completion-authority.cjs +13 -7
- package/src/claude/hooks/docs-sync.cjs +5 -2
- package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
- package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
- package/src/claude/hooks/privacy-block.cjs +99 -28
- package/src/claude/hooks/semantic-review-authority.cjs +152 -0
- package/src/claude/hooks/spec-gate.cjs +47 -117
- package/src/claude/hooks/spec-state.cjs +8 -2
- package/src/claude/migration-manifest.json +9 -1
- package/src/claude/rules/state-sync.md +52 -21
- package/src/claude/rules/workflow.md +17 -9
- package/src/claude/scripts/change-firewall.cjs +1748 -0
- package/src/claude/scripts/spec-authoring-digest.cjs +151 -0
- package/src/claude/scripts/spec-authoring-validation.cjs +126 -0
- package/src/claude/scripts/spec-final-state.cjs +290 -0
- package/src/claude/scripts/spec-ground.cjs +571 -173
- package/src/claude/scripts/spec-readiness.cjs +425 -0
- package/src/claude/scripts/spec-receipt.cjs +162 -0
- package/src/claude/scripts/spec-resolver.cjs +67 -16
- package/src/claude/scripts/spec-scaffold.cjs +1594 -139
- package/src/claude/scripts/spec-semantic-model.cjs +396 -0
- package/src/claude/scripts/validate-spec-output.cjs +3110 -218
- package/src/claude/scripts/workflow-policy.cjs +501 -183
- package/src/claude/settings/settings.json +4 -0
- package/src/claude/skills/code-review/SKILL.md +12 -3
- package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
- package/src/claude/skills/code-review/references/verification-gate.md +13 -0
- package/src/claude/skills/develop/SKILL.md +47 -60
- package/src/claude/skills/develop/references/parallel-waves.md +9 -6
- package/src/claude/skills/develop/references/quality-gate.md +19 -12
- package/src/claude/skills/specs/SKILL.md +183 -177
- package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
- package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
- package/src/claude/skills/specs/references/research-strategy.md +4 -1
- package/src/claude/skills/specs/references/review.md +214 -262
- package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
- package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
- package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
- package/src/claude/skills/specs/rules/design-principles.md +136 -180
- package/src/claude/skills/specs/rules/design-review.md +42 -97
- package/src/claude/skills/specs/rules/ears-format.md +42 -50
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +2 -1
- package/src/claude/skills/specs/rules/tasks-generation.md +189 -300
- package/src/claude/skills/specs/templates/design.md +49 -263
- package/src/claude/skills/specs/templates/requirements.md +26 -36
- package/src/claude/skills/specs/templates/research.md +9 -98
- package/src/claude/skills/specs/templates/spec-state.json +35 -85
- package/src/claude/skills/specs/templates/task.md +30 -102
- package/src/claude/skills/sync/SKILL.md +33 -10
- package/src/claude/skills/sync/references/sync-protocols.md +31 -13
- package/src/claude/skills/test/SKILL.md +17 -7
- package/src/codex/AGENTS.md +6 -0
- package/src/codex/hooks/completion-authority-check.cjs +43 -240
- package/src/codex/hooks/completion-authority-state.cjs +10 -8
- package/src/codex/hooks/completion-authority.cjs +13 -7
- package/src/codex/hooks/lib/hook-context.cjs +16 -2
- package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
- package/src/codex/hooks/lib/privacy-state.cjs +61 -38
- package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +72 -134
- package/src/codex/hooks/lib/spec-utils.cjs +56 -5
- package/src/codex/hooks/privacy-approval.cjs +6 -2
- package/src/codex/hooks/privacy-block.cjs +94 -15
- package/src/codex/hooks/semantic-review-authority.cjs +130 -0
- package/src/codex/hooks/spec-gate.cjs +49 -34
- package/src/codex/hooks/spec-state.cjs +10 -3
- package/src/codex/hooks/state.cjs +2 -0
- package/src/codex/hooks.json +6 -1
- package/src/codex/rules/state-sync.md +47 -27
- package/src/common/AGENTS.md +1 -1
|
@@ -1,93 +1,45 @@
|
|
|
1
|
-
# Full
|
|
1
|
+
# Full design discovery
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Load this rule only after the artifact router selects `Full`. Full controls
|
|
4
|
+
design detail; it does not select research, web access, tasks, or ceremony.
|
|
5
5
|
|
|
6
|
-
## Discovery
|
|
6
|
+
## Discovery boundary
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
**Map Requirements to Technical Needs**
|
|
10
|
-
- Extract all functional requirements from EARS format
|
|
11
|
-
- Identify non-functional requirements (performance, security, scalability)
|
|
12
|
-
- Determine technical constraints and dependencies
|
|
13
|
-
- List core technical challenges
|
|
8
|
+
Inspect only facts needed to remove an implementation-significant ambiguity:
|
|
14
9
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- Determine approach: extend vs refactor vs wrap
|
|
10
|
+
1. map scoped requirements to existing entrypoints and behavior owners;
|
|
11
|
+
2. inspect reusable contracts, data flows, dependencies, and recovery paths;
|
|
12
|
+
3. identify decisions whose alternatives would change observable behavior;
|
|
13
|
+
4. ground each chosen decision to repository anchors or, when needed, a
|
|
14
|
+
primary external source; and
|
|
15
|
+
5. stop when the routed design can be implemented without a product decision.
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- Latest architectural patterns for similar problems
|
|
27
|
-
- Industry best practices for the technology stack
|
|
28
|
-
- Recent updates or changes in relevant technologies
|
|
29
|
-
- Common pitfalls and solutions
|
|
17
|
+
Do not inventory unrelated architecture, compare fashionable patterns, or
|
|
18
|
+
collect findings merely because they are available. Repository scouting is
|
|
19
|
+
normal design work and does not by itself create `research.md`.
|
|
30
20
|
|
|
31
|
-
|
|
32
|
-
- Official documentation for frameworks/libraries
|
|
33
|
-
- API references and usage examples
|
|
34
|
-
- Migration guides and breaking changes
|
|
35
|
-
- Performance benchmarks and comparisons
|
|
21
|
+
## Research gate
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
**For Each External Service/Library**:
|
|
39
|
-
- Search for official documentation and GitHub repositories
|
|
40
|
-
- Verify API signatures and authentication methods
|
|
41
|
-
- Check version compatibility with existing stack
|
|
42
|
-
- Investigate rate limits and usage constraints
|
|
43
|
-
- Find community resources and known issues
|
|
44
|
-
- Document security considerations
|
|
45
|
-
- Note any gaps requiring implementation investigation
|
|
23
|
+
Create `research.md` only when the router has found at least one of:
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
-
|
|
50
|
-
- Assess fit with existing architecture and steering principles
|
|
51
|
-
- Identify domain boundaries and ownership seams required to avoid team conflicts
|
|
52
|
-
- Consider scalability implications and operational concerns
|
|
53
|
-
- Evaluate maintainability and team expertise
|
|
54
|
-
- Document preferred pattern and rejected alternatives in `research.md`
|
|
25
|
+
- unresolved material uncertainty that can change requirements or design;
|
|
26
|
+
- an external-current fact that must be grounded; or
|
|
27
|
+
- an explicit user request for durable research.
|
|
55
28
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
- Technical debt creation vs resolution
|
|
62
|
-
- Knowledge gaps and training needs
|
|
29
|
+
If none applies, research is absent: do not load the research template, invoke
|
|
30
|
+
a researcher, search the web, or create a placeholder. When external-current
|
|
31
|
+
facts matter, prefer primary authoritative sources and capture only evidence
|
|
32
|
+
that resolves the named uncertainty. General best-practice browsing is not a
|
|
33
|
+
research trigger.
|
|
63
34
|
|
|
64
|
-
##
|
|
35
|
+
## Projection
|
|
65
36
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- Latest versions and migration paths for dependencies
|
|
37
|
+
Put settled behavior, contracts, invariants, negative paths, and grounded
|
|
38
|
+
anchors in `design.md`. If research was selected, keep `research.md` minimal:
|
|
39
|
+
named uncertainty, relevant evidence, resulting decision, and remaining gaps.
|
|
40
|
+
Synchronize every promoted semantic decision into `spec.json`; research notes
|
|
41
|
+
that do not affect semantics remain supporting evidence, not authority.
|
|
72
42
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- Compliance requirements (GDPR, HIPAA, etc.)
|
|
77
|
-
- Scalability approaches for expected load
|
|
78
|
-
|
|
79
|
-
### Search Strategy
|
|
80
|
-
1. Start with official sources (documentation, GitHub)
|
|
81
|
-
2. Check recent blog posts and articles (last 6 months)
|
|
82
|
-
3. Review Stack Overflow for common issues
|
|
83
|
-
4. Investigate similar open-source implementations
|
|
84
|
-
|
|
85
|
-
## Output Requirements
|
|
86
|
-
Capture all findings that impact design decisions in `research.md` using the shared template:
|
|
87
|
-
- Key insights affecting architecture, technology alignment, and contracts
|
|
88
|
-
- Constraints discovered during research
|
|
89
|
-
- Recommended approaches and selected architecture pattern with rationale
|
|
90
|
-
- Rejected alternatives and trade-offs (documented in the Design Decisions section)
|
|
91
|
-
- Updated domain boundaries that inform Components & Interface Contracts
|
|
92
|
-
- Risks and mitigation strategies
|
|
93
|
-
- Gaps requiring further investigation during implementation
|
|
43
|
+
Full may add flow, data, error/recovery, security/privacy, migration, or proof
|
|
44
|
+
detail only when the scoped topology activates that section. Delete unused
|
|
45
|
+
sections rather than reserving them for implementation.
|
|
@@ -1,49 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Compact design discovery
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Load this rule only after the artifact router selects `Compact`. The goal is a
|
|
4
|
+
bounded durable design, not a reduced version of a default research process.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Focus
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- Check for existing patterns to follow
|
|
13
|
-
- Identify backward compatibility requirements
|
|
8
|
+
1. locate the real entrypoint and existing behavior owner;
|
|
9
|
+
2. inspect the smallest set of contracts and dependencies touched by scope;
|
|
10
|
+
3. record compatibility, negative-path, and verification constraints; and
|
|
11
|
+
4. ground the selected anchors and stop.
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- Check version compatibility of new dependencies
|
|
18
|
-
- Validate API contracts haven't changed
|
|
19
|
-
- Ensure no breaking changes in pipeline
|
|
13
|
+
Keep the result in `design.md`. File lists without behavior ownership, generic
|
|
14
|
+
best practices, and broad architecture inventories are not useful discovery.
|
|
20
15
|
|
|
21
|
-
|
|
22
|
-
**For New Libraries Only**:
|
|
23
|
-
- Use WebSearch for official documentation
|
|
24
|
-
- Verify basic usage patterns
|
|
25
|
-
- Check for known compatibility issues
|
|
26
|
-
- Confirm licensing compatibility
|
|
27
|
-
- Record key findings in `research.md` (technology alignment section)
|
|
16
|
+
## Research gate
|
|
28
17
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
18
|
+
Research remains absent unless there is unresolved material uncertainty, an
|
|
19
|
+
external-current fact that must be grounded, or an explicit user request. A new
|
|
20
|
+
library is not automatically a trigger: inspect repository declarations first;
|
|
21
|
+
consult primary external documentation only when a current fact can change the
|
|
22
|
+
decision. When the gate opens, create the minimal uncertainty-to-evidence-to-
|
|
23
|
+
decision projection and retain any honest remaining gap.
|
|
35
24
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- Security-sensitive implementations
|
|
41
|
-
- Performance-critical components
|
|
42
|
-
- Unknown or poorly documented dependencies
|
|
43
|
-
|
|
44
|
-
## Output Requirements
|
|
45
|
-
- Clear integration approach (note boundary impacts in `research.md`)
|
|
46
|
-
- List of files/components to modify
|
|
47
|
-
- New dependencies with versions
|
|
48
|
-
- Integration risks and mitigations
|
|
49
|
-
- Testing focus areas
|
|
25
|
+
If discovery reveals cross-boundary behavior needing materially more design
|
|
26
|
+
detail, reclassify planning depth before persistence. If the Compact baseline
|
|
27
|
+
is already persisted, expand monotonically to Full; do not silently downgrade
|
|
28
|
+
or create optional artifacts merely to resemble Full.
|
|
@@ -1,182 +1,138 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
-
|
|
119
|
-
- Logical Data Model should articulate structure, indexing, sharding, and storage-specific considerations (event store, KV/wide-column) relevant to the change.
|
|
120
|
-
- Data Contracts & Integration section documents API payloads, event schemas, and cross-service synchronization patterns when the feature crosses boundaries.
|
|
121
|
-
- Lengthy type definitions or vendor-specific option objects should be placed in the Supporting References section within design.md, linked from the relevant section. Investigation notes stay in `research.md`.
|
|
122
|
-
- Supporting References usage is optional; only create it when keeping the content in the main body would reduce readability. All decisions must still appear in the main sections so design.md stands alone.
|
|
123
|
-
|
|
124
|
-
### Error/Testing/Security/Performance Sections
|
|
125
|
-
- Record only feature-specific decisions or deviations. Link or reference organization-wide standards (steering) for baseline practices instead of restating them.
|
|
126
|
-
|
|
127
|
-
### Diagram & Text Deduplication
|
|
128
|
-
- Do not restate diagram content verbatim in prose. Use the text to highlight key decisions, trade-offs, or impacts that are not obvious from the visual.
|
|
129
|
-
- When a decision is fully captured in the diagram annotations, a short “Key Decisions” bullet is sufficient.
|
|
130
|
-
|
|
131
|
-
### General Deduplication
|
|
132
|
-
- Avoid repeating the same information across Overview, Architecture, and Components. Reference earlier sections when context is identical.
|
|
133
|
-
- If a requirement/component relationship is captured in the summary table, do not rewrite it elsewhere unless extra nuance is added.
|
|
134
|
-
|
|
135
|
-
## Diagram Guidelines
|
|
136
|
-
|
|
137
|
-
### When to include a diagram
|
|
138
|
-
- **Architecture**: Use a structural diagram when 3+ components or external systems interact.
|
|
139
|
-
- **Sequence**: Draw a sequence diagram when calls/handshakes span multiple steps.
|
|
140
|
-
- **State / Flow**: Capture complex state machines or business flows in a dedicated diagram.
|
|
141
|
-
- **ER**: Provide an entity-relationship diagram for non-trivial data models.
|
|
142
|
-
- **Skip**: Minor one-component changes generally do not need diagrams.
|
|
143
|
-
|
|
144
|
-
### Mermaid requirements
|
|
145
|
-
```mermaid
|
|
146
|
-
graph TB
|
|
147
|
-
Client --> ApiGateway
|
|
148
|
-
ApiGateway --> ServiceA
|
|
149
|
-
ApiGateway --> ServiceB
|
|
150
|
-
ServiceA --> Database
|
|
1
|
+
# Adaptive design principles
|
|
2
|
+
|
|
3
|
+
The design exists to remove implementation guesses. It defines behavior-owning
|
|
4
|
+
boundaries and stable contracts without prescribing incidental code.
|
|
5
|
+
|
|
6
|
+
## Detail by planning depth
|
|
7
|
+
|
|
8
|
+
### Compact
|
|
9
|
+
|
|
10
|
+
Keep only:
|
|
11
|
+
|
|
12
|
+
1. boundary and responsibilities;
|
|
13
|
+
2. typed source anchors;
|
|
14
|
+
3. decisions, named contracts, and invariants needed for consistency; and
|
|
15
|
+
4. verification, including relevant negative paths.
|
|
16
|
+
|
|
17
|
+
Delete every unused heading. Compact is a complete durable design, not a teaser
|
|
18
|
+
for a later Full document.
|
|
19
|
+
|
|
20
|
+
### Full
|
|
21
|
+
|
|
22
|
+
Start from Compact. Add only relevant sections for:
|
|
23
|
+
|
|
24
|
+
- cross-boundary contracts and flows;
|
|
25
|
+
- data ownership, schema, consistency, and concurrency;
|
|
26
|
+
- error classification and recovery;
|
|
27
|
+
- security/privacy boundaries;
|
|
28
|
+
- migration, compatibility, rollback, or deployment transition; and
|
|
29
|
+
- proof that spans owners or runtime surfaces.
|
|
30
|
+
|
|
31
|
+
Do not add a section because the template contains it. Empty tables, generic
|
|
32
|
+
best practices, and restated requirements form a template cemetery and must be
|
|
33
|
+
deleted.
|
|
34
|
+
|
|
35
|
+
## Boundaries and typed anchors
|
|
36
|
+
|
|
37
|
+
A boundary names what owns, reads, writes, calls, registers, or exposes the
|
|
38
|
+
behavior. “Service”, “module”, or “layer” without a grounded target is invalid.
|
|
39
|
+
|
|
40
|
+
Design and task anchors use the same closed six-column machine model:
|
|
41
|
+
`ID | Type | Target | Role | Access | Action`. Every implementation-facing
|
|
42
|
+
anchor has:
|
|
43
|
+
|
|
44
|
+
| Field | Rule |
|
|
45
|
+
|---|---|
|
|
46
|
+
| ID | Unique across the entire spec. Design-owned anchors use `A-D-NN`; task-owned anchors use `A-R{requirement}-{sequence}-NN`. |
|
|
47
|
+
| Type | `file`, `symbol`, `command`, `route`, `schema`, `contract`, `artifact`, or `external`. |
|
|
48
|
+
| Target | Exact path, identifier, command, route, schema object, contract ID, artifact path, or primary source. |
|
|
49
|
+
| Role | Why the target matters: owner, consumer, entrypoint, proof, constraint, or reference. |
|
|
50
|
+
| Access | `read` or `write`. |
|
|
51
|
+
| Action | `read` for read access; `create`, `modify`, or `delete` for write access. |
|
|
52
|
+
|
|
53
|
+
Files-first is canonical. List `file` anchors before symbols, routes, schemas,
|
|
54
|
+
or contracts they contain. A symbol anchor names its file. A command anchor is
|
|
55
|
+
an exact project command. An external anchor states which decision it grounds.
|
|
56
|
+
Role is descriptive only and never implies Action; words such as create,
|
|
57
|
+
planned, new, producer, or output in prose have zero machine authority. Never
|
|
58
|
+
reuse an anchor ID, even in another task. A task that consumes a canonical
|
|
59
|
+
design anchor references its `A-D-NN` ID and does not redefine the same target in
|
|
60
|
+
its task-scoped namespace.
|
|
61
|
+
|
|
62
|
+
## Named contracts and invariants
|
|
63
|
+
|
|
64
|
+
- Give every implementation-significant contract and invariant a stable ID,
|
|
65
|
+
such as `C1` or `I1`.
|
|
66
|
+
- Define the canonical body once in `design.md`.
|
|
67
|
+
- Task files reference IDs; they do not copy contract bodies.
|
|
68
|
+
- Name one implementation owner before any cross-task consumer. Consumers
|
|
69
|
+
depend directly or transitively on the owner.
|
|
70
|
+
- If implementation needs a different contract, revise and explicitly approve
|
|
71
|
+
the design before changing consumers.
|
|
72
|
+
|
|
73
|
+
Contracts are required when drift could change auth/session, transport, API or
|
|
74
|
+
event shape, persistence/schema, deletion/retention, generated artifacts,
|
|
75
|
+
runtime entrypoints, or recovery behavior. Do not invent contract ceremony for
|
|
76
|
+
local details that cannot drift across a boundary.
|
|
77
|
+
|
|
78
|
+
For any public, replay, or operator surface contract, specify method, route,
|
|
79
|
+
auth, required headers, request schema, success response, error semantics, and
|
|
80
|
+
idempotency/concurrency behavior in one place; a partial contract is not a
|
|
81
|
+
contract.
|
|
82
|
+
|
|
83
|
+
## Decision quality
|
|
84
|
+
|
|
85
|
+
Record a decision only when another reasonable implementation would behave
|
|
86
|
+
differently. For each decision state:
|
|
87
|
+
|
|
88
|
+
- chosen behavior and boundary;
|
|
89
|
+
- relevant alternative or ambiguity rejected;
|
|
90
|
+
- invariant or negative path that constrains implementation; and
|
|
91
|
+
- anchor or evidence that makes it feasible.
|
|
92
|
+
|
|
93
|
+
Use explicit types for public inputs, outputs, states, and errors. Avoid generic
|
|
94
|
+
`any`, `object`, or unbounded maps unless the contract explains why they are
|
|
95
|
+
intentional.
|
|
96
|
+
|
|
97
|
+
## Conditional detail
|
|
98
|
+
|
|
99
|
+
- Flow: include only for branching, asynchronous, or multi-party behavior.
|
|
100
|
+
- Data: include only when shape, ownership, consistency, or lifecycle changes. Any retention/lifecycle policy must state clock anchor, clock source, timezone/precision, cutoff comparator/inclusivity, enforcement boundary, and a wrong-clock/boundary counterexample; domain-generic.
|
|
101
|
+
- Error/recovery: include concrete triggers, responses, retry/rollback, and
|
|
102
|
+
terminal states only when relevant.
|
|
103
|
+
- Security/privacy: include trust boundary, authorization, sensitive data, and
|
|
104
|
+
retention decisions only when touched.
|
|
105
|
+
- Migration: include compatibility window, ordering, rollback trigger, and
|
|
106
|
+
verification only when existing state or public contracts change.
|
|
107
|
+
- Diagrams: use plain Mermaid only when the relationship is materially clearer
|
|
108
|
+
than prose; do not duplicate the diagram in text.
|
|
109
|
+
|
|
110
|
+
## Traceability and verification
|
|
111
|
+
|
|
112
|
+
Every acceptance criterion has exactly one implementation owner and maps to a
|
|
113
|
+
boundary, contract/invariant, or explicit verification definition. Keep exactly
|
|
114
|
+
one visible `## Verification Definitions`
|
|
115
|
+
section. The validator's canonical grammar is a single line per definition:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
- **V1**: Criteria R1.1; Owner A-D-01; Decision refs D1, I1, C1; Method command `npm test`; Expected exit 0 and the persisted state; Negative/failure invalid input returns the named error; Reachability/grounding entrypoint `src/entry.js` via A-D-01.
|
|
151
119
|
```
|
|
152
120
|
|
|
153
|
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
- Performance targets defined
|
|
172
|
-
- Migration path clear (if applicable)
|
|
173
|
-
|
|
174
|
-
### Common Anti-patterns to Avoid
|
|
175
|
-
❌ Mixing design with implementation
|
|
176
|
-
❌ Vague interface definitions
|
|
177
|
-
❌ Missing error scenarios
|
|
178
|
-
❌ Ignored non-functional requirements
|
|
179
|
-
❌ Overcomplicated architectures
|
|
180
|
-
❌ Tight coupling between components
|
|
181
|
-
❌ Missing data consistency strategy
|
|
182
|
-
❌ Incomplete dependency analysis
|
|
121
|
+
Do not use a V table, `### V1` heading, or prose-only “see verification” alias;
|
|
122
|
+
the semantic-review parser recognizes the bold V-ID line above. Each line names
|
|
123
|
+
every exact `RN.M` it covers, all applicable `D`/`I`/`C` refs, a command or anchored
|
|
124
|
+
inspection, observable expected result, concrete negative/failure case, and
|
|
125
|
+
runtime reachability plus grounding expectation.
|
|
126
|
+
|
|
127
|
+
For a typed proof boundary, extend the same line after Owner with `Proof criteria
|
|
128
|
+
R1.2; Proof owner A-D-02; Evidence anchor A-D-02;`. Both criteria remain
|
|
129
|
+
single-owner; without that boundary, omit the extension.
|
|
130
|
+
|
|
131
|
+
Validator success proves structure only. The author and reviewer still test the
|
|
132
|
+
design against concrete counterexamples and check that an implementer can act
|
|
133
|
+
without choosing unspecified product behavior.
|
|
134
|
+
|
|
135
|
+
For task-bearing specs, typed `spec.json.coordination.boundaries` are the only
|
|
136
|
+
authority for ownership, dependencies, transitions, proof separation, and
|
|
137
|
+
parallel eligibility. Design prose explains semantics but cannot replace those
|
|
138
|
+
typed edges.
|