create-shhs 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,260 @@
1
+ # SHHS Constitution
2
+
3
+ **Version:** 1.0.0
4
+ **Status:** IMMUTABLE
5
+ **Last Updated:** 2026-02-24
6
+
7
+ ---
8
+
9
+ ## Article I — Supremacy Clause
10
+
11
+ This Constitution is the supreme governance document of the Self-Healing Hybrid Swarm.
12
+
13
+ **Hierarchy of Authority:**
14
+
15
+ ```
16
+ Constitution > ADR > Patterns > Code
17
+ ```
18
+
19
+ 1. **Constitution** — Immutable rules. Cannot be overridden.
20
+ 2. **ADR** — Architectural decisions. Can extend but not contradict Constitution.
21
+ 3. **Patterns** — Implementation guidance. Must align with ADRs.
22
+ 4. **Code** — Must comply with all above layers.
23
+
24
+ Any conflict between layers is resolved by promoting the higher-level rule.
25
+
26
+ ---
27
+
28
+ ## Article II — Test-Driven Development (Non-Negotiable)
29
+
30
+ All feature development MUST follow TDD cycle:
31
+
32
+ ```
33
+ RED → GREEN → REFACTOR
34
+ ```
35
+
36
+ ### RED Phase
37
+
38
+ - Write a failing test BEFORE writing any implementation code
39
+ - Test must fail for the right reason (missing functionality, not syntax error)
40
+ - Test must be executable and produce a clear failure message
41
+
42
+ ### GREEN Phase
43
+
44
+ - Write minimal code to make the test pass
45
+ - No refactoring during this phase
46
+ - Implementation may be naive — optimization comes later
47
+
48
+ ### REFACTOR Phase
49
+
50
+ - Improve code structure WITHOUT changing behavior
51
+ - All tests must remain green
52
+ - Extract patterns, remove duplication, clarify intent
53
+
54
+ ### Enforcement
55
+
56
+ - No merge request is valid without proof of TDD cycle
57
+ - Static Reviewer MUST verify test files were modified BEFORE implementation files (git commit order)
58
+ - QA Validator MUST verify test coverage meets threshold
59
+
60
+ ### Exceptions
61
+
62
+ NONE. No bypass allowed. If TDD is impractical, the feature is incorrectly scoped.
63
+
64
+ ---
65
+
66
+ ## Article III — End-to-End Testing (Critical Paths)
67
+
68
+ All user-facing critical flows MUST have Playwright end-to-end tests.
69
+
70
+ ### What Qualifies as Critical
71
+
72
+ - Authentication flows
73
+ - Payment/transaction flows
74
+ - Data mutation operations
75
+ - Primary user journeys (signup → activation → core action)
76
+
77
+ ### Playwright Requirements
78
+
79
+ - Tests must run in CI/CD pipeline
80
+ - Tests must use realistic data (no mocks for external services in E2E layer)
81
+ - Tests must verify UI state, not just HTTP responses
82
+ - Tests must be idempotent (repeatable without manual cleanup)
83
+
84
+ ### Enforcement
85
+
86
+ - QA Validator MUST run Playwright tests as part of validation
87
+ - No critical feature merge without passing E2E tests
88
+ - Flaky tests are treated as failing tests
89
+
90
+ ---
91
+
92
+ ## Article IV — Knowledge Curator (Pre-Architectural Gate)
93
+
94
+ No architectural decision may proceed without Knowledge Curator validation.
95
+
96
+ ### Curator Responsibilities
97
+
98
+ 1. **Query Live Documentation**
99
+ - Use Context7 or equivalent to fetch current library documentation
100
+ - Verify framework capabilities against architectural assumptions
101
+ - Identify deprecated patterns in proposed stack
102
+
103
+ 2. **Produce Technical Constraints**
104
+ - List hard limitations (e.g., "React Server Components cannot use `useState`")
105
+ - Document anti-patterns specific to chosen libraries
106
+ - Flag unrealistic abstractions
107
+
108
+ 3. **Block Invalid Architectures**
109
+ - VETO power over architectures that violate documented library constraints
110
+ - Must provide evidence (docs link + quote) for all vetoes
111
+
112
+ ### Workflow Integration
113
+
114
+ ```
115
+ Feature Request
116
+
117
+ Knowledge Curator validates tech feasibility
118
+
119
+ Root Architect defines ADR (if Curator approves)
120
+
121
+ Developer implements
122
+ ```
123
+
124
+ ### Knowledge Base Maintenance
125
+
126
+ - Curator MUST update `.ai/knowledge/knowledge-base.md` with findings
127
+ - All stack-specific constraints must be versioned
128
+ - Outdated knowledge triggers re-validation
129
+
130
+ ---
131
+
132
+ ## Article V — Skills as Enforceable Procedures
133
+
134
+ Skills are NOT guidelines. They are MANDATORY operating procedures.
135
+
136
+ ### Skill Definition
137
+
138
+ A skill is a documented procedure for:
139
+ - TDD workflow
140
+ - Playwright test authoring
141
+ - Context7 documentation queries
142
+ - Debugging protocols
143
+ - Refactoring sequences
144
+
145
+ ### Skill Invocation
146
+
147
+ - Any agent performing a task covered by a skill MUST invoke that skill
148
+ - Deviation from skill procedure without explicit ADR override is a violation
149
+ - Skills are versioned and stored in `.ai/skills/`
150
+
151
+ ### Skill Authority
152
+
153
+ Skills have peer authority with Patterns. When conflict arises:
154
+ - If skill contradicts pattern → raise to ADR for resolution
155
+ - If skill contradicts ADR → ADR wins
156
+ - If skill contradicts Constitution → Constitution wins
157
+
158
+ ---
159
+
160
+ ## Article VI — Merge Gates (Definition of Done)
161
+
162
+ No code may be merged without satisfying ALL merge gate conditions.
163
+
164
+ ### Gate 1: Contractual Compliance
165
+
166
+ - Feature contract exists in `.ai/features/`
167
+ - All cucumber scenarios pass
168
+ - Implementation scope matches contract (no scope creep)
169
+
170
+ ### Gate 2: Structural Compliance
171
+
172
+ - Static Reviewer: PASS
173
+ - No layer violations
174
+ - No forbidden imports
175
+ - Complexity metrics within bounds
176
+
177
+ ### Gate 3: Behavioral Compliance
178
+
179
+ - QA Validator: PASS
180
+ - All tests green (unit + integration + E2E)
181
+ - Coverage threshold met
182
+ - No regressions
183
+
184
+ ### Gate 4: Domain Approval
185
+
186
+ - Domain Architect: APPROVED
187
+ - Bounded context integrity maintained
188
+ - No unauthorized cross-domain coupling
189
+
190
+ ### Gate 5: Fitness Compliance
191
+
192
+ - Fitness Enforcer: PASS (if applicable)
193
+ - No architectural fitness rule violations
194
+ - Dependency limits respected
195
+
196
+ ### Veto Authority
197
+
198
+ Any gate failure = automatic merge block. No exceptions.
199
+
200
+ ---
201
+
202
+ ## Article VII — Immutability and Amendment
203
+
204
+ ### Immutability
205
+
206
+ This Constitution is IMMUTABLE for:
207
+ - TDD requirement (Article II)
208
+ - Knowledge Curator gate (Article IV)
209
+ - Merge gate structure (Article VI)
210
+
211
+ ### Amendment Process
212
+
213
+ Non-immutable articles may be amended via:
214
+
215
+ 1. Proposal by Architecture Reviewer
216
+ 2. Impact analysis by all agents
217
+ 3. Unanimous approval by:
218
+ - Root Architect
219
+ - Domain Architect
220
+ - Fitness Enforcer
221
+ - Knowledge Curator
222
+
223
+ Amendments MUST NOT weaken governance. Only clarifications or extensions allowed.
224
+
225
+ ---
226
+
227
+ ## Article VIII — Enforcement and Violations
228
+
229
+ ### Violation Types
230
+
231
+ - **Type 1: Process Bypass** — Skipping TDD, missing contracts, unapproved merges
232
+ - **Type 2: Scope Violation** — Agents acting outside defined role
233
+ - **Type 3: Knowledge Neglect** — Ignoring Curator findings, outdated assumptions
234
+
235
+ ### Consequences
236
+
237
+ - Type 1: Immediate rollback + mandatory re-implementation
238
+ - Type 2: Agent role suspension + manual review
239
+ - Type 3: Knowledge base audit + architecture review
240
+
241
+ ### Violation Reporting
242
+
243
+ Any agent may file a violation report in `.ai/governance/violations/YYYY-MM-DD-description.md`
244
+
245
+ ---
246
+
247
+ ## Article IX — Bootstrap and Adoption
248
+
249
+ New projects adopting SHHS MUST:
250
+
251
+ 1. Copy this Constitution to `.ai/governance/constitution.md`
252
+ 2. Initialize all required directories (`.ai/agents/`, `.ai/skills/`, `.ai/knowledge/`)
253
+ 3. Appoint initial agents (minimum: Architect, Developer, QA, Curator)
254
+ 4. Complete Knowledge Base bootstrap (stack validation)
255
+
256
+ Partial adoption is NOT permitted. SHHS is all-or-nothing.
257
+
258
+ ---
259
+
260
+ **END OF CONSTITUTION**