archspec 1.6.3 → 1.7.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.
- package/lib/init.js +5 -2
- package/lib/templates/execution.js +1010 -0
- package/lib/templates/implementation.js +359 -0
- package/package.json +1 -1
package/lib/init.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
const createFolderWithFiles = require("./createFolderWithFiles");
|
|
2
2
|
const architectureTemplates = require("./templates/architecture");
|
|
3
3
|
const governanceTemplates = require("./templates/governance");
|
|
4
|
-
|
|
4
|
+
const implementationTemplates = require("./templates/implementation");
|
|
5
|
+
const executionTemplates = require("./templates/execution");
|
|
5
6
|
|
|
6
7
|
function init() {
|
|
7
8
|
createFolderWithFiles("architecture", architectureTemplates);
|
|
8
9
|
createFolderWithFiles("governance", governanceTemplates);
|
|
9
|
-
|
|
10
|
+
createFolderWithFiles("implementation", implementationTemplates);
|
|
11
|
+
createFolderWithFiles("execution", executionTemplates);
|
|
12
|
+
console.log("Architecture, Governance, Implementation and Execution folders initialized.");
|
|
10
13
|
}
|
|
11
14
|
|
|
12
15
|
module.exports = init;
|
|
@@ -0,0 +1,1010 @@
|
|
|
1
|
+
const executionTemplates = {
|
|
2
|
+
"README.md": `# Execution
|
|
3
|
+
|
|
4
|
+
This directory defines how **approved implementation decisions** are executed.
|
|
5
|
+
|
|
6
|
+
Execution is a downstream system.
|
|
7
|
+
|
|
8
|
+
It does NOT define architecture.
|
|
9
|
+
It does NOT define implementation structure.
|
|
10
|
+
It does NOT introduce new requirements.
|
|
11
|
+
|
|
12
|
+
Execution translates approved state into:
|
|
13
|
+
|
|
14
|
+
* Phased delivery
|
|
15
|
+
* Layer sequencing
|
|
16
|
+
* Test enforcement
|
|
17
|
+
* Operational tracking
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Source of Truth
|
|
22
|
+
|
|
23
|
+
Execution is derived from:
|
|
24
|
+
|
|
25
|
+
* architecture/architecture.md
|
|
26
|
+
* implementation/implementation.md
|
|
27
|
+
* execution/execution.config.md
|
|
28
|
+
|
|
29
|
+
The following files are GENERATED:
|
|
30
|
+
|
|
31
|
+
* execution-plan.md
|
|
32
|
+
* test-strategy.md
|
|
33
|
+
|
|
34
|
+
They must never be edited manually.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Governance Rules
|
|
39
|
+
|
|
40
|
+
* Execution may only act on layers defined in architecture.
|
|
41
|
+
* Execution may only act on approved implementation decisions.
|
|
42
|
+
* No phase may introduce new structural rules.
|
|
43
|
+
* No task may exist without a corresponding approved decision.
|
|
44
|
+
* No domain logic may appear in execution artifacts.
|
|
45
|
+
* If ambiguity exists, it must be recorded in open-questions.md.
|
|
46
|
+
|
|
47
|
+
Execution is operational, not architectural.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Phase Discipline
|
|
52
|
+
|
|
53
|
+
* Phases are declarative and defined in execution.config.md.
|
|
54
|
+
* Layers must match architecture layer names exactly.
|
|
55
|
+
* Phases are executed sequentially.
|
|
56
|
+
* No future-phase work may be implemented early.
|
|
57
|
+
* Each phase must pass defined tests before completion.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Testing Discipline
|
|
62
|
+
|
|
63
|
+
All execution phases must enforce:
|
|
64
|
+
|
|
65
|
+
* Passing unit tests
|
|
66
|
+
* Passing integration tests (where applicable)
|
|
67
|
+
* Passing E2E tests (if defined)
|
|
68
|
+
* No TypeScript errors
|
|
69
|
+
* No console errors
|
|
70
|
+
|
|
71
|
+
Testing requirements are generated in test-strategy.md.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## System Philosophy
|
|
76
|
+
|
|
77
|
+
Architecture defines structure.
|
|
78
|
+
Implementation defines stack.
|
|
79
|
+
Execution defines sequencing.
|
|
80
|
+
|
|
81
|
+
Execution is the operational layer of governance.
|
|
82
|
+
|
|
83
|
+
It compiles declared structure into deterministic delivery.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
`,
|
|
87
|
+
"init.md": `# Deterministic Execution Planning
|
|
88
|
+
|
|
89
|
+
## 1. Create the files (once)
|
|
90
|
+
|
|
91
|
+
In your repo root:
|
|
92
|
+
|
|
93
|
+
/execution
|
|
94
|
+
├─ execution.config.md ← ONLY editable execution truth
|
|
95
|
+
├─ execution-plan.md ← GENERATED, read-only
|
|
96
|
+
├─ test-strategy.md ← GENERATED, read-only
|
|
97
|
+
└─ README.md ← rules
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 2. Initialize execution.config.md
|
|
102
|
+
|
|
103
|
+
Paste this exactly, until the line \`-- END OF PASTING --\`:
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# Execution Configuration
|
|
107
|
+
|
|
108
|
+
## Rules
|
|
109
|
+
- execution.config.md is the ONLY source of truth for execution phases
|
|
110
|
+
- execution-plan.md is GENERATED and must never be edited manually
|
|
111
|
+
- test-strategy.md is GENERATED and must never be edited manually
|
|
112
|
+
- Phases are declarative
|
|
113
|
+
- Layers must match Architecture Layers exactly
|
|
114
|
+
- No layer may exist in execution without existing in architecture
|
|
115
|
+
|
|
116
|
+
## Phase Definition Format
|
|
117
|
+
|
|
118
|
+
Each phase must:
|
|
119
|
+
- Have a unique ID
|
|
120
|
+
- Have a Name
|
|
121
|
+
- Either define Layers OR Type: e2e
|
|
122
|
+
- Have a Status (active | planned | deprecated)
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Phases
|
|
127
|
+
|
|
128
|
+
[PH-001]
|
|
129
|
+
Name: Phase 1 – Backend Core
|
|
130
|
+
Layers:
|
|
131
|
+
- Infra
|
|
132
|
+
- DAL
|
|
133
|
+
- Services
|
|
134
|
+
- Controllers
|
|
135
|
+
- Routes
|
|
136
|
+
Status: active
|
|
137
|
+
|
|
138
|
+
[PH-002]
|
|
139
|
+
Name: Phase 2 – Frontend Core
|
|
140
|
+
Layers:
|
|
141
|
+
- Infra
|
|
142
|
+
- API Service
|
|
143
|
+
- FE Services
|
|
144
|
+
- Context
|
|
145
|
+
- Components
|
|
146
|
+
Status: planned
|
|
147
|
+
|
|
148
|
+
[PH-003]
|
|
149
|
+
Name: Phase 3 – E2E
|
|
150
|
+
Type: e2e
|
|
151
|
+
Status: planned
|
|
152
|
+
|
|
153
|
+
-- END OF PASTING --
|
|
154
|
+
|
|
155
|
+
This file represents the execution state.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 3. Make generated files read-only (discipline rule)
|
|
160
|
+
|
|
161
|
+
For both:
|
|
162
|
+
|
|
163
|
+
execution-plan.md
|
|
164
|
+
test-strategy.md
|
|
165
|
+
|
|
166
|
+
Enforce:
|
|
167
|
+
|
|
168
|
+
* Never manually edit
|
|
169
|
+
* Treat like \`/dist\`
|
|
170
|
+
* Add this header at the top of each file:
|
|
171
|
+
|
|
172
|
+
<!-- GENERATED FILE – DO NOT EDIT -->
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## 4. Create Cursor Agents
|
|
177
|
+
|
|
178
|
+
Create the following agents:
|
|
179
|
+
|
|
180
|
+
### 1) Execution Plan Generator Agent
|
|
181
|
+
|
|
182
|
+
Responsible for:
|
|
183
|
+
|
|
184
|
+
* Reading architecture/architecture.decisions.md
|
|
185
|
+
* Reading execution/execution.config.md
|
|
186
|
+
* Validating that all referenced layers exist
|
|
187
|
+
* Generating execution-plan.md
|
|
188
|
+
|
|
189
|
+
### 2) Test Strategy Generator Agent
|
|
190
|
+
|
|
191
|
+
Responsible for:
|
|
192
|
+
|
|
193
|
+
* Reading architecture layers
|
|
194
|
+
* Reading execution phases
|
|
195
|
+
* Generating test-strategy.md dynamically based on layer categories
|
|
196
|
+
|
|
197
|
+
### 3) Execution Validator Agent (optional but recommended)
|
|
198
|
+
|
|
199
|
+
Responsible for:
|
|
200
|
+
|
|
201
|
+
* Ensuring phase layers exist in architecture
|
|
202
|
+
* Preventing orphan layers
|
|
203
|
+
* Preventing drift between execution and architecture
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 5. Governance Rules
|
|
208
|
+
|
|
209
|
+
* execution-plan.md and test-strategy.md must never contain handwritten content
|
|
210
|
+
* Any manual edits must be overwritten on next generation
|
|
211
|
+
* Execution phases must remain aligned with architecture layers
|
|
212
|
+
* E2E phases must not introduce business-specific logic
|
|
213
|
+
* No domain-specific flows (e.g. “submit answer”) are allowed in generated files
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Execution Philosophy
|
|
218
|
+
|
|
219
|
+
Architecture defines structure.
|
|
220
|
+
Implementation defines stack.
|
|
221
|
+
Execution defines phase grouping.
|
|
222
|
+
|
|
223
|
+
All three are declarative state files.
|
|
224
|
+
Everything else is generated.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
`,
|
|
230
|
+
"execution-plan.md": `## Placeholder
|
|
231
|
+
|
|
232
|
+
Execution plan not yet generated.
|
|
233
|
+
|
|
234
|
+
Run execution plan generator to populate this file.
|
|
235
|
+
`,
|
|
236
|
+
|
|
237
|
+
"test-strategy.md": `## Placeholder
|
|
238
|
+
|
|
239
|
+
Test strategy not yet generated.
|
|
240
|
+
|
|
241
|
+
Run test strategy generator to populate this file.
|
|
242
|
+
`,
|
|
243
|
+
|
|
244
|
+
"open-questions.md": `# Open Questions Log
|
|
245
|
+
|
|
246
|
+
This file records ambiguities encountered during deterministic execution.
|
|
247
|
+
|
|
248
|
+
Rules:
|
|
249
|
+
|
|
250
|
+
* Questions must follow the exact structure below.
|
|
251
|
+
* No prose outside the defined structure.
|
|
252
|
+
* Questions must reference an existing layer.
|
|
253
|
+
* Questions must be execution-blocking ambiguities only.
|
|
254
|
+
* This file may only be appended to.
|
|
255
|
+
* Resolved questions must have Status updated to: Resolved.
|
|
256
|
+
* Execution agents must NOT guess answers.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Structure Example
|
|
261
|
+
|
|
262
|
+
## Q-001
|
|
263
|
+
|
|
264
|
+
Context: API Service
|
|
265
|
+
Question: Should base URL differ between dev and prod?
|
|
266
|
+
Status: Open
|
|
267
|
+
|
|
268
|
+
## Q-002
|
|
269
|
+
|
|
270
|
+
Context: DAL
|
|
271
|
+
Question: Should timestamps be ISO strings or Date objects?
|
|
272
|
+
Status: Open
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Q-003
|
|
277
|
+
|
|
278
|
+
Context: Execution
|
|
279
|
+
Question: execution-plan.md defines Phase 1 as active. Should execution stop automatically after Phase 1 completion, or continue into next planned phase?
|
|
280
|
+
Status: Open
|
|
281
|
+
|
|
282
|
+
## Q-004
|
|
283
|
+
|
|
284
|
+
Context: Services
|
|
285
|
+
Question: execution-plan.md requires unit tests for Services layer. Should mocking of external dependencies (OpenAI, Neo4j, Chroma) be mandatory for deterministic tests?
|
|
286
|
+
Status: Open
|
|
287
|
+
|
|
288
|
+
## Q-005
|
|
289
|
+
|
|
290
|
+
Context: Controllers
|
|
291
|
+
Question: If execution-plan.md requires integration tests, should controller tests include real database connections or use in-memory substitutes?
|
|
292
|
+
Status: Open
|
|
293
|
+
|
|
294
|
+
## Q-006
|
|
295
|
+
|
|
296
|
+
Context: Routes
|
|
297
|
+
Question: test-strategy.md requires route-level tests. Should supertest run against a live server instance or an injected Express app?
|
|
298
|
+
Status: Open
|
|
299
|
+
|
|
300
|
+
## Q-007
|
|
301
|
+
|
|
302
|
+
Context: Infra
|
|
303
|
+
Question: execution requires SQLite DB connected. Should the database file be created automatically during test setup if missing?
|
|
304
|
+
Status: Open
|
|
305
|
+
|
|
306
|
+
## Q-008
|
|
307
|
+
|
|
308
|
+
Context: Execution
|
|
309
|
+
Question: If test-strategy.md defines E2E tests but no E2E phase is active, should E2E tests be skipped or fail execution?
|
|
310
|
+
Status: Open
|
|
311
|
+
|
|
312
|
+
## Q-009
|
|
313
|
+
|
|
314
|
+
Context: Components
|
|
315
|
+
Question: execution-plan.md requires no console errors. Should console warnings be treated as execution failures?
|
|
316
|
+
Status: Open
|
|
317
|
+
|
|
318
|
+
## Q-010
|
|
319
|
+
|
|
320
|
+
Context: FE Services
|
|
321
|
+
Question: If an API route returns unexpected shape but no explicit schema contract exists in implementation.md, should execution fail or log ambiguity?
|
|
322
|
+
Status: Open
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
`,
|
|
328
|
+
|
|
329
|
+
"agents-prompts.md": `
|
|
330
|
+
|
|
331
|
+
# Execution Agent Prompts
|
|
332
|
+
|
|
333
|
+
This document defines the **exact prompts** used to operate the execution planning system in this repository.
|
|
334
|
+
|
|
335
|
+
These prompts are part of execution governance.
|
|
336
|
+
They must remain stable and should not be casually modified.
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## 1. Execution Plan Generator Agent (Decision-Driven Deterministic Planner)
|
|
341
|
+
|
|
342
|
+
<!-- ⚠️ This agent MUST be run in Agent mode, never in plan or explanation mode. -->
|
|
343
|
+
|
|
344
|
+
You are the **Execution Plan Generator Agent**.
|
|
345
|
+
|
|
346
|
+
You produce a **decision-driven execution plan**.
|
|
347
|
+
Your output must be richer than \`execution.config.md\` and must be derived deterministically from **approved decisions**.
|
|
348
|
+
|
|
349
|
+
### Input (read only)
|
|
350
|
+
|
|
351
|
+
* \`architecture/architecture.decisions.md\`
|
|
352
|
+
* \`implementation/implementation.decisions.md\`
|
|
353
|
+
* \`execution/execution.config.md\`
|
|
354
|
+
|
|
355
|
+
### Output (write only)
|
|
356
|
+
|
|
357
|
+
* \`execution/execution-plan.md\`
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
### Rules
|
|
362
|
+
|
|
363
|
+
#### Hard constraints
|
|
364
|
+
|
|
365
|
+
* Read **ONLY** the three input files listed above.
|
|
366
|
+
* Do **NOT** read source code files.
|
|
367
|
+
* Do **NOT** read generated files (\`architecture.md\`, \`implementation.md\`, existing \`execution-plan.md\`).
|
|
368
|
+
* Do **NOT** invent business flows, user journeys, or domain-specific behavior.
|
|
369
|
+
* Do **NOT** guess missing requirements.
|
|
370
|
+
* If required info is missing to generate a correct plan, output a blocking issues bullet list instead of generating the file.
|
|
371
|
+
|
|
372
|
+
#### Determinism constraints
|
|
373
|
+
|
|
374
|
+
* Generate \`execution/execution-plan.md\` **from scratch**.
|
|
375
|
+
* Ignore any existing \`execution-plan.md\`.
|
|
376
|
+
* Use **stable, minimal wording**.
|
|
377
|
+
* Preserve **phase names** exactly as in \`execution.config.md\`.
|
|
378
|
+
* Preserve **layer names** exactly as in \`execution.config.md\`.
|
|
379
|
+
* Preserve **decision IDs** exactly as in \`implementation.decisions.md\`.
|
|
380
|
+
* Only use decisions with \`Status: approved\`.
|
|
381
|
+
|
|
382
|
+
### Scope constraints
|
|
383
|
+
|
|
384
|
+
* Execution content may only be derived from:
|
|
385
|
+
|
|
386
|
+
* Phase structure in \`execution.config.md\`
|
|
387
|
+
* Architecture layer existence in \`architecture.decisions.md\`
|
|
388
|
+
* Tooling/stack selections in \`implementation.decisions.md\`
|
|
389
|
+
* Never introduce tasks unrelated to an approved implementation decision.
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
### Validation (must run before generation)
|
|
394
|
+
|
|
395
|
+
You must validate ALL of the following:
|
|
396
|
+
|
|
397
|
+
1. Every layer referenced in \`execution.config.md\` exists in \`architecture/architecture.decisions.md\` layer list.
|
|
398
|
+
2. Phase IDs are unique.
|
|
399
|
+
3. Each phase defines **either** \`Layers:\` **or** \`Type: e2e\` (not both).
|
|
400
|
+
4. For each non-e2e phase layer:
|
|
401
|
+
|
|
402
|
+
* There exists **at least one** approved implementation decision in that layer **OR**
|
|
403
|
+
* If none exist, mark the layer as \`No approved implementation decisions found\` (do NOT invent tasks).
|
|
404
|
+
5. If any referenced layer does not exist in architecture, STOP and output blocking issues.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
### Planning Model
|
|
409
|
+
|
|
410
|
+
You must build the plan **layer by layer**.
|
|
411
|
+
|
|
412
|
+
For each phase:
|
|
413
|
+
|
|
414
|
+
* List the phase name and status.
|
|
415
|
+
* List layers in order.
|
|
416
|
+
* For each layer, include:
|
|
417
|
+
|
|
418
|
+
* Approved decision IDs found in that layer
|
|
419
|
+
* Tooling summary derived from those decisions (no inference beyond explicit tools)
|
|
420
|
+
* Execution tasks derived from deterministic mapping rules below
|
|
421
|
+
* Verification checklist (deterministic)
|
|
422
|
+
* Test requirements (deterministic)
|
|
423
|
+
|
|
424
|
+
Then include phase-level:
|
|
425
|
+
|
|
426
|
+
* Deliverables (aggregate of layer verifications; no domain logic)
|
|
427
|
+
* Completion criteria (deterministic checks; no domain logic)
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
### Deterministic Mapping Rules (Tool → Tasks/Tests)
|
|
432
|
+
|
|
433
|
+
Apply only when the tool is explicitly present in an approved decision.
|
|
434
|
+
|
|
435
|
+
#### Infra mappings
|
|
436
|
+
|
|
437
|
+
* If **SQLite** appears:
|
|
438
|
+
|
|
439
|
+
* Tasks: configure DATABASE_URL; ensure DB file path exists
|
|
440
|
+
* Verification: DB connection succeeds
|
|
441
|
+
* If **PostgreSQL** appears:
|
|
442
|
+
|
|
443
|
+
* Tasks: configure connection URL; verify connectivity
|
|
444
|
+
* Verification: DB connection succeeds
|
|
445
|
+
* If **Prisma** appears:
|
|
446
|
+
|
|
447
|
+
* Tasks: generate client; run migrations
|
|
448
|
+
* Verification: migration applied successfully; prisma client generation succeeds
|
|
449
|
+
* Tests: schema/migration verification step included
|
|
450
|
+
* If **Neo4j** appears:
|
|
451
|
+
|
|
452
|
+
* Tasks: configure NEO4J_URI/USER/PASSWORD; ensure driver connects
|
|
453
|
+
* Verification: Neo4j connectivity check passes
|
|
454
|
+
* If **Chroma** appears:
|
|
455
|
+
|
|
456
|
+
* Tasks: configure host/port; ensure client connects
|
|
457
|
+
* Verification: Chroma connectivity check passes
|
|
458
|
+
* If **OpenAI Embeddings** appears:
|
|
459
|
+
|
|
460
|
+
* Tasks: configure API key; define embedding model in env/config
|
|
461
|
+
* Verification: embeddings call can be mocked in tests (no live calls required)
|
|
462
|
+
* Tests: unit tests MUST mock embedding calls
|
|
463
|
+
* If **OpenAI GPT** appears:
|
|
464
|
+
|
|
465
|
+
* Tasks: configure API key; define model in env/config
|
|
466
|
+
* Verification: LLM call can be mocked in tests (no live calls required)
|
|
467
|
+
* Tests: unit tests MUST mock LLM calls
|
|
468
|
+
|
|
469
|
+
### Backend layer mappings
|
|
470
|
+
|
|
471
|
+
* If **Express** or HTTP routes exist (in approved Routes decisions):
|
|
472
|
+
|
|
473
|
+
* Tasks: wire routes; add error middleware
|
|
474
|
+
* Verification: health endpoint (if declared) responds; main routes respond
|
|
475
|
+
* Tests: route-level tests using **supertest**
|
|
476
|
+
|
|
477
|
+
### Frontend layer mappings
|
|
478
|
+
|
|
479
|
+
* If **Vite** appears (Infra in Phase 2 context):
|
|
480
|
+
|
|
481
|
+
* Tasks: configure dev server/build
|
|
482
|
+
* Verification: app builds
|
|
483
|
+
* If **React** appears (Context/Components):
|
|
484
|
+
|
|
485
|
+
* Tests: **React Testing Library**
|
|
486
|
+
* If **Vitest** appears (or frontend test tool declared):
|
|
487
|
+
|
|
488
|
+
* Tests: FE unit tests run
|
|
489
|
+
|
|
490
|
+
#### E2E mappings
|
|
491
|
+
|
|
492
|
+
* If a phase \`Type: e2e\` exists:
|
|
493
|
+
|
|
494
|
+
* Tools: Playwright (default)
|
|
495
|
+
* Verification: full-stack boot + basic smoke flow
|
|
496
|
+
* Do NOT describe domain-specific flows; only “core user flow” placeholder.
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
### Output Format (execution/execution-plan.md)
|
|
501
|
+
|
|
502
|
+
You must output a complete file with this exact structure:
|
|
503
|
+
|
|
504
|
+
1. Header:
|
|
505
|
+
|
|
506
|
+
* \`<!-- GENERATED FILE – DO NOT EDIT -->\`
|
|
507
|
+
* \`# Execution Plan\`
|
|
508
|
+
* \`Generated from …\` line listing the three inputs
|
|
509
|
+
|
|
510
|
+
2. For each phase (in config order):
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
### <Phase Name>
|
|
514
|
+
|
|
515
|
+
Status: <status>
|
|
516
|
+
|
|
517
|
+
Layers (in order):
|
|
518
|
+
- <Layer>
|
|
519
|
+
- <Layer>
|
|
520
|
+
|
|
521
|
+
#### Layer: <Layer>
|
|
522
|
+
|
|
523
|
+
Approved Decisions:
|
|
524
|
+
- <I-XXX-001>
|
|
525
|
+
- <I-XXX-002>
|
|
526
|
+
(or) - None
|
|
527
|
+
|
|
528
|
+
Tooling (from approved decisions):
|
|
529
|
+
- <tool>
|
|
530
|
+
- <tool>
|
|
531
|
+
(or) - None
|
|
532
|
+
|
|
533
|
+
Tasks (derived, deterministic):
|
|
534
|
+
- bullet
|
|
535
|
+
- bullet
|
|
536
|
+
(or) - None (no approved decisions)
|
|
537
|
+
|
|
538
|
+
Verification:
|
|
539
|
+
- bullet
|
|
540
|
+
- bullet
|
|
541
|
+
(or) - None
|
|
542
|
+
|
|
543
|
+
Tests Required:
|
|
544
|
+
- bullet
|
|
545
|
+
- bullet
|
|
546
|
+
(or) - None
|
|
547
|
+
|
|
548
|
+
---
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
3. Phase-level summary at the end of each phase:
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
Deliverables:
|
|
555
|
+
- bullet
|
|
556
|
+
- bullet
|
|
557
|
+
|
|
558
|
+
Completion Criteria:
|
|
559
|
+
- \`npm test\` passes
|
|
560
|
+
- No TypeScript errors
|
|
561
|
+
- No console errors
|
|
562
|
+
- All verifications above pass
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
4. Do NOT add anything else.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
### Failure Mode (blocking issues)
|
|
570
|
+
|
|
571
|
+
If you cannot generate safely, output EXACTLY:
|
|
572
|
+
|
|
573
|
+
* A bullet list of blocking issues
|
|
574
|
+
|
|
575
|
+
No header. No explanations. No extra text.
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
Generate \`execution/execution-plan.md\` now.
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
---
|
|
583
|
+
|
|
584
|
+
## 2. Test Strategy Generator Agent (Decision-Driven Deterministic Compiler)
|
|
585
|
+
|
|
586
|
+
<!-- ⚠️ This agent MUST be run in Agent mode, never in plan or explanation mode. -->
|
|
587
|
+
|
|
588
|
+
You are the **Test Strategy Generator Agent**.
|
|
589
|
+
|
|
590
|
+
You generate a **decision-driven test strategy** derived strictly from approved architectural and implementation decisions.
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
### Input (read only)
|
|
595
|
+
|
|
596
|
+
* \`architecture/architecture.decisions.md\`
|
|
597
|
+
* \`implementation/implementation.decisions.md\`
|
|
598
|
+
* \`execution/execution.config.md\`
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
### Output (write only)
|
|
603
|
+
|
|
604
|
+
* \`execution/test-strategy.md\`
|
|
605
|
+
|
|
606
|
+
---
|
|
607
|
+
|
|
608
|
+
### Rules
|
|
609
|
+
|
|
610
|
+
#### Hard Constraints
|
|
611
|
+
|
|
612
|
+
* Read ONLY the three input files listed above.
|
|
613
|
+
* Do NOT read source code.
|
|
614
|
+
* Do NOT read generated files.
|
|
615
|
+
* Do NOT infer domain logic.
|
|
616
|
+
* Do NOT invent business-specific tests.
|
|
617
|
+
* Do NOT describe user journeys.
|
|
618
|
+
* Do NOT reference example APIs or domain behavior.
|
|
619
|
+
* If required information is missing, output blocking issues instead of generating.
|
|
620
|
+
|
|
621
|
+
---
|
|
622
|
+
|
|
623
|
+
#### Determinism Constraints
|
|
624
|
+
|
|
625
|
+
* Generate \`execution/test-strategy.md\` from scratch.
|
|
626
|
+
* Ignore any existing test-strategy.md.
|
|
627
|
+
* Only use decisions with \`Status: approved\`.
|
|
628
|
+
* Preserve phase names exactly.
|
|
629
|
+
* Preserve layer names exactly.
|
|
630
|
+
* Use stable minimal wording.
|
|
631
|
+
* Do not rephrase tool names.
|
|
632
|
+
* Do not introduce creative language.
|
|
633
|
+
|
|
634
|
+
---
|
|
635
|
+
|
|
636
|
+
### Validation Phase (Must Run First)
|
|
637
|
+
|
|
638
|
+
You must validate:
|
|
639
|
+
|
|
640
|
+
1. All layers referenced in \`execution.config.md\` exist in architecture layers.
|
|
641
|
+
2. Phase IDs are unique.
|
|
642
|
+
3. Each phase defines either \`Layers:\` or \`Type: e2e\`.
|
|
643
|
+
4. No unknown layers appear.
|
|
644
|
+
5. At least one approved implementation decision exists in the project.
|
|
645
|
+
|
|
646
|
+
If validation fails, output EXACTLY:
|
|
647
|
+
|
|
648
|
+
* bullet list of blocking issues
|
|
649
|
+
|
|
650
|
+
No header.
|
|
651
|
+
No commentary.
|
|
652
|
+
|
|
653
|
+
---
|
|
654
|
+
|
|
655
|
+
### Test Strategy Derivation Model
|
|
656
|
+
|
|
657
|
+
Test strategy must be derived from **approved implementation decisions**, not from generic assumptions.
|
|
658
|
+
|
|
659
|
+
You must:
|
|
660
|
+
|
|
661
|
+
1. Inspect approved implementation decisions per layer.
|
|
662
|
+
2. Extract explicitly declared tools.
|
|
663
|
+
3. Map tools to deterministic test requirements using mapping rules below.
|
|
664
|
+
4. Aggregate test tools per phase.
|
|
665
|
+
5. Output tool-based strategy, not layer-descriptive prose.
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
### Deterministic Tool → Test Mapping Rules
|
|
670
|
+
|
|
671
|
+
Apply only when the tool appears explicitly in approved implementation decisions.
|
|
672
|
+
|
|
673
|
+
#### Backend Tool Mappings
|
|
674
|
+
|
|
675
|
+
* If **Jest** appears → include:
|
|
676
|
+
|
|
677
|
+
* Jest as backend test runner
|
|
678
|
+
* If **Express** appears → include:
|
|
679
|
+
|
|
680
|
+
* supertest for HTTP route testing
|
|
681
|
+
* If **Prisma** appears:
|
|
682
|
+
|
|
683
|
+
* Include database migration verification
|
|
684
|
+
* Include isolated test DB requirement
|
|
685
|
+
* If **SQLite** appears:
|
|
686
|
+
|
|
687
|
+
* Include SQLite test database
|
|
688
|
+
* If **Neo4j** appears:
|
|
689
|
+
|
|
690
|
+
* Include Neo4j test instance or mock driver
|
|
691
|
+
* If **Chroma** appears:
|
|
692
|
+
|
|
693
|
+
* Include vector store mock or isolated test collection
|
|
694
|
+
* If **OpenAI Embeddings** appears:
|
|
695
|
+
|
|
696
|
+
* Include mocking for embedding calls
|
|
697
|
+
* If **OpenAI GPT** appears:
|
|
698
|
+
|
|
699
|
+
* Include mocking for LLM calls
|
|
700
|
+
|
|
701
|
+
If no backend test runner is explicitly declared:
|
|
702
|
+
|
|
703
|
+
* Default to Jest for backend layers.
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
#### Frontend Tool Mappings
|
|
708
|
+
|
|
709
|
+
* If **Vitest** appears → include Vitest
|
|
710
|
+
* If **React** appears → include React Testing Library
|
|
711
|
+
* If **Vite** appears → include frontend build verification
|
|
712
|
+
* If **fetch** API service layer exists → include HTTP mocking (no library name unless declared)
|
|
713
|
+
|
|
714
|
+
If no frontend test runner explicitly declared:
|
|
715
|
+
|
|
716
|
+
* Default to Vitest.
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
### E2E Mapping
|
|
721
|
+
|
|
722
|
+
If a phase defines \`Type: e2e\`:
|
|
723
|
+
|
|
724
|
+
* Default E2E tool: Playwright
|
|
725
|
+
* Include:
|
|
726
|
+
|
|
727
|
+
* Full application boot verification
|
|
728
|
+
* Cross-layer integration smoke test
|
|
729
|
+
* Do NOT describe business flows.
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
### Output Format (execution/test-strategy.md)
|
|
734
|
+
|
|
735
|
+
You must generate EXACTLY this structure:
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
<!-- GENERATED FILE – DO NOT EDIT -->
|
|
739
|
+
|
|
740
|
+
# Test Strategy
|
|
741
|
+
|
|
742
|
+
Generated from:
|
|
743
|
+
- architecture/architecture.decisions.md
|
|
744
|
+
- implementation/implementation.decisions.md
|
|
745
|
+
- execution/execution.config.md
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
## Backend
|
|
750
|
+
|
|
751
|
+
Test Runner:
|
|
752
|
+
- <tool>
|
|
753
|
+
|
|
754
|
+
Tools:
|
|
755
|
+
- <tool>
|
|
756
|
+
- <tool>
|
|
757
|
+
|
|
758
|
+
Requirements:
|
|
759
|
+
- bullet
|
|
760
|
+
- bullet
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
## Frontend
|
|
765
|
+
|
|
766
|
+
Test Runner:
|
|
767
|
+
- <tool>
|
|
768
|
+
|
|
769
|
+
Tools:
|
|
770
|
+
- <tool>
|
|
771
|
+
- <tool>
|
|
772
|
+
|
|
773
|
+
Requirements:
|
|
774
|
+
- bullet
|
|
775
|
+
- bullet
|
|
776
|
+
|
|
777
|
+
---
|
|
778
|
+
|
|
779
|
+
## E2E (if defined)
|
|
780
|
+
|
|
781
|
+
Tool:
|
|
782
|
+
- <tool>
|
|
783
|
+
|
|
784
|
+
Requirements:
|
|
785
|
+
- bullet
|
|
786
|
+
- bullet
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## Global Quality Gates
|
|
791
|
+
|
|
792
|
+
All phases must ensure:
|
|
793
|
+
- All unit tests pass
|
|
794
|
+
- No TypeScript errors
|
|
795
|
+
- No console errors
|
|
796
|
+
- All mocks replace external service calls
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
---
|
|
800
|
+
|
|
801
|
+
### Restrictions
|
|
802
|
+
|
|
803
|
+
* Do NOT generate layer-by-layer prose.
|
|
804
|
+
* Do NOT output generic “unit tests for X layer”.
|
|
805
|
+
* Do NOT describe behavioral tests.
|
|
806
|
+
* Do NOT invent domain test cases.
|
|
807
|
+
* Do NOT output implementation examples.
|
|
808
|
+
* Only output tool-level and structural testing requirements.
|
|
809
|
+
|
|
810
|
+
---
|
|
811
|
+
|
|
812
|
+
### Failure Mode
|
|
813
|
+
|
|
814
|
+
If generation cannot be completed safely, output EXACTLY:
|
|
815
|
+
|
|
816
|
+
* bullet list of blocking issues
|
|
817
|
+
|
|
818
|
+
No header.
|
|
819
|
+
No commentary.
|
|
820
|
+
|
|
821
|
+
---
|
|
822
|
+
|
|
823
|
+
Generate \`execution/test-strategy.md\` now.
|
|
824
|
+
|
|
825
|
+
---
|
|
826
|
+
|
|
827
|
+
## 3. Execution Validator Agent (Review Only)
|
|
828
|
+
|
|
829
|
+
<!-- This agent validates execution configuration correctness. It never writes state. -->
|
|
830
|
+
|
|
831
|
+
You are the Execution Validator Agent.
|
|
832
|
+
|
|
833
|
+
Rules:
|
|
834
|
+
|
|
835
|
+
* Read execution/execution.config.md
|
|
836
|
+
* Read architecture/architecture.decisions.md
|
|
837
|
+
* Do NOT edit any files
|
|
838
|
+
* Do NOT propose new phases
|
|
839
|
+
* Validate:
|
|
840
|
+
|
|
841
|
+
* All referenced layers exist in architecture.decisions.md
|
|
842
|
+
* No duplicate phase IDs
|
|
843
|
+
* Phase IDs follow format: PH-XXX
|
|
844
|
+
* Each phase defines either Layers OR Type: e2e (not both)
|
|
845
|
+
* Layer names match architecture layer names exactly
|
|
846
|
+
* No unknown layer names
|
|
847
|
+
* Do NOT validate business logic
|
|
848
|
+
* Do NOT validate implementation
|
|
849
|
+
|
|
850
|
+
Output format is STRICT.
|
|
851
|
+
|
|
852
|
+
You must output EXACTLY ONE of the following:
|
|
853
|
+
|
|
854
|
+
1. OK
|
|
855
|
+
|
|
856
|
+
OR
|
|
857
|
+
|
|
858
|
+
2. A bullet list of blocking issues.
|
|
859
|
+
|
|
860
|
+
Do NOT include:
|
|
861
|
+
|
|
862
|
+
* Explanations
|
|
863
|
+
* Summaries
|
|
864
|
+
* Validation traces
|
|
865
|
+
* Commentary
|
|
866
|
+
* Any text before or after the output
|
|
867
|
+
|
|
868
|
+
If there are no blocking issues, output ONLY:
|
|
869
|
+
|
|
870
|
+
OK
|
|
871
|
+
|
|
872
|
+
---
|
|
873
|
+
|
|
874
|
+
## 4. Phase Execution Writer Agent (Optional Aggregator)
|
|
875
|
+
|
|
876
|
+
<!-- ⚠️ This agent MUST be run in Agent mode. -->
|
|
877
|
+
|
|
878
|
+
You are a deterministic document aggregator.
|
|
879
|
+
|
|
880
|
+
Input:
|
|
881
|
+
|
|
882
|
+
* execution/execution-plan.md
|
|
883
|
+
* execution/test-strategy.md
|
|
884
|
+
|
|
885
|
+
Rules:
|
|
886
|
+
|
|
887
|
+
* Read ONLY the two files listed above
|
|
888
|
+
* Do NOT read architecture files
|
|
889
|
+
* Do NOT read implementation files
|
|
890
|
+
* Combine content into a single consolidated execution document if required
|
|
891
|
+
* Do NOT modify original generated files
|
|
892
|
+
* No creative language
|
|
893
|
+
* No summarization
|
|
894
|
+
* Preserve wording exactly
|
|
895
|
+
|
|
896
|
+
Output:
|
|
897
|
+
|
|
898
|
+
* A consolidated execution document (if invoked)
|
|
899
|
+
|
|
900
|
+
---
|
|
901
|
+
|
|
902
|
+
## Governance Notes
|
|
903
|
+
|
|
904
|
+
* execution.config.md is the ONLY editable execution state.
|
|
905
|
+
* execution-plan.md and test-strategy.md are generated artifacts.
|
|
906
|
+
* Generator agents are pure compilation.
|
|
907
|
+
* Validator agent is pure enforcement.
|
|
908
|
+
* No agent may invent domain logic.
|
|
909
|
+
* Execution system must remain architecture-driven only.
|
|
910
|
+
|
|
911
|
+
---
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
## 5. Implementation Execution Agent (Deterministic Phase Executor)
|
|
915
|
+
<!-- ⚠️ This agent MUST be run in Agent mode, never in plan or explanation mode. -->
|
|
916
|
+
|
|
917
|
+
You are the Implementation Execution Agent.
|
|
918
|
+
|
|
919
|
+
Your responsibility is deterministic phase execution.
|
|
920
|
+
|
|
921
|
+
Input:
|
|
922
|
+
|
|
923
|
+
architecture/architecture.md
|
|
924
|
+
|
|
925
|
+
implementation/implementation.md
|
|
926
|
+
|
|
927
|
+
execution/execution-plan.md
|
|
928
|
+
|
|
929
|
+
execution/test-strategy.md
|
|
930
|
+
|
|
931
|
+
Rules:
|
|
932
|
+
|
|
933
|
+
Read ONLY the files listed above
|
|
934
|
+
|
|
935
|
+
Do NOT read architecture.decisions.md
|
|
936
|
+
|
|
937
|
+
Do NOT read implementation.decisions.md
|
|
938
|
+
|
|
939
|
+
Do NOT modify architecture or implementation documents
|
|
940
|
+
|
|
941
|
+
Do NOT modify execution configuration files
|
|
942
|
+
|
|
943
|
+
Do NOT guess missing requirements
|
|
944
|
+
|
|
945
|
+
If ambiguity or missing detail appears, append a question to open-questions.md
|
|
946
|
+
|
|
947
|
+
Never resolve ambiguity autonomously
|
|
948
|
+
|
|
949
|
+
Execute phases strictly in the order defined in execution-plan.md
|
|
950
|
+
|
|
951
|
+
Implement only layers included in the active phase
|
|
952
|
+
|
|
953
|
+
Do NOT implement layers from future phases
|
|
954
|
+
|
|
955
|
+
After completing each phase:
|
|
956
|
+
|
|
957
|
+
Ensure all required tests defined in test-strategy.md exist
|
|
958
|
+
|
|
959
|
+
Ensure all tests pass
|
|
960
|
+
|
|
961
|
+
Ensure no TypeScript errors
|
|
962
|
+
|
|
963
|
+
Ensure no console errors
|
|
964
|
+
|
|
965
|
+
Add unit tests for each implemented layer
|
|
966
|
+
|
|
967
|
+
Add integration tests where applicable
|
|
968
|
+
|
|
969
|
+
Add E2E tests only in the E2E phase
|
|
970
|
+
|
|
971
|
+
Stop execution after each phase
|
|
972
|
+
|
|
973
|
+
Report phase completion status only
|
|
974
|
+
|
|
975
|
+
No creative language
|
|
976
|
+
|
|
977
|
+
No architectural redesign
|
|
978
|
+
|
|
979
|
+
No scope expansion
|
|
980
|
+
|
|
981
|
+
Output format is STRICT.
|
|
982
|
+
|
|
983
|
+
After completing a phase, output EXACTLY:
|
|
984
|
+
|
|
985
|
+
PHASE COMPLETE: <Phase Name>
|
|
986
|
+
|
|
987
|
+
If blocked by ambiguity, output EXACTLY:
|
|
988
|
+
|
|
989
|
+
BLOCKED:
|
|
990
|
+
|
|
991
|
+
bullet describing missing requirement
|
|
992
|
+
|
|
993
|
+
Do NOT include:
|
|
994
|
+
|
|
995
|
+
Explanations
|
|
996
|
+
|
|
997
|
+
Summaries
|
|
998
|
+
|
|
999
|
+
Commentary
|
|
1000
|
+
|
|
1001
|
+
Design reasoning
|
|
1002
|
+
|
|
1003
|
+
Any text before or after the output
|
|
1004
|
+
|
|
1005
|
+
This agent performs deterministic phase execution only.
|
|
1006
|
+
`
|
|
1007
|
+
};
|
|
1008
|
+
|
|
1009
|
+
module.exports = executionTemplates;
|
|
1010
|
+
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
const implementationTemplates = {
|
|
2
|
+
"current-project-desc.md": `# Current Project Description`,
|
|
3
|
+
"README.md": `# Implementation Governance
|
|
4
|
+
|
|
5
|
+
This directory defines how stack-specific implementation decisions are created and maintained.
|
|
6
|
+
|
|
7
|
+
## Relationship to Architecture
|
|
8
|
+
- Layer structure and responsibilities are inherited from \`/architecture\`.
|
|
9
|
+
- Implementation decisions may not redefine, rename, reorder, or remove architectural layers.
|
|
10
|
+
- Implementation must respect all approved architectural boundaries.
|
|
11
|
+
|
|
12
|
+
## Source of Truth
|
|
13
|
+
- \`implementation.decisions.md\` is the ONLY source of truth for stack-specific realization.
|
|
14
|
+
- \`implementation.md\` is a GENERATED artifact and must never be edited manually.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
1. All implementation changes are expressed as Decisions.
|
|
18
|
+
2. Each Decision belongs to exactly ONE layer (as defined in \`/architecture\`).
|
|
19
|
+
3. Only Decisions with \`Status: approved\` are applied.
|
|
20
|
+
4. Agents may NOT edit \`implementation.md\`.
|
|
21
|
+
5. \`implementation.md\` can be deleted and regenerated at any time.
|
|
22
|
+
|
|
23
|
+
## Scope of Implementation Decisions
|
|
24
|
+
Implementation decisions define how architectural layers are realized in this project and may specify:
|
|
25
|
+
- Frameworks and libraries
|
|
26
|
+
- Folder structure and file organization
|
|
27
|
+
- Dependency injection patterns
|
|
28
|
+
- Validation libraries
|
|
29
|
+
- Transport clients
|
|
30
|
+
- Testing frameworks
|
|
31
|
+
- Tooling and build configuration
|
|
32
|
+
|
|
33
|
+
Implementation decisions may NOT:
|
|
34
|
+
- Change layer responsibilities
|
|
35
|
+
- Introduce, remove, or rename architectural layers
|
|
36
|
+
- Modify dependency direction between layers
|
|
37
|
+
- Override approved architectural decisions
|
|
38
|
+
|
|
39
|
+
## Workflow
|
|
40
|
+
1. Layer implementation agent proposes a Decision (\`Status: proposed\`)
|
|
41
|
+
2. Human reviews and approves the Decision
|
|
42
|
+
3. Implementation writer agent regenerates \`implementation.md\`
|
|
43
|
+
|
|
44
|
+
If it is not a Decision, it is not implementation.
|
|
45
|
+
|
|
46
|
+
## Operation
|
|
47
|
+
|
|
48
|
+
For daily usage and workflow, see:
|
|
49
|
+
|
|
50
|
+
- \`flow.md\` – Implementation decision lifecycle
|
|
51
|
+
- \`agent-prompts.md\` – Agent definitions
|
|
52
|
+
- \`init.md\` – Initial setup instructions
|
|
53
|
+
|
|
54
|
+
## Project Context
|
|
55
|
+
|
|
56
|
+
This implementation system operates within the context of the current project description.
|
|
57
|
+
|
|
58
|
+
See:
|
|
59
|
+
|
|
60
|
+
- \`current-project-desc.md\` – Functional description and goals of this project
|
|
61
|
+
|
|
62
|
+
All implementation decisions must align with this document while respecting architectural boundaries.
|
|
63
|
+
`,
|
|
64
|
+
|
|
65
|
+
"flow.md": `
|
|
66
|
+
## The daily workflow (this is the loop)
|
|
67
|
+
|
|
68
|
+
### Step A – Propose
|
|
69
|
+
|
|
70
|
+
* Run a **layer agent**
|
|
71
|
+
* It appends a \`Status: proposed\` decision to \`implementation.decisions.md\`
|
|
72
|
+
|
|
73
|
+
### Step B – Validate
|
|
74
|
+
|
|
75
|
+
* Run **Implementation Validator Agent**
|
|
76
|
+
* Fix or clarify decision if blocked
|
|
77
|
+
|
|
78
|
+
### Step C – Approve (YOU)
|
|
79
|
+
|
|
80
|
+
* Change **one word**:
|
|
81
|
+
|
|
82
|
+
\`Status: approved\`
|
|
83
|
+
|
|
84
|
+
### Step D – Generate
|
|
85
|
+
|
|
86
|
+
* Run **Writer Agent**
|
|
87
|
+
* \`implementation.md\` is regenerated fully
|
|
88
|
+
|
|
89
|
+
That’s it.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Hard rules (do not break these)
|
|
94
|
+
|
|
95
|
+
* ❌ No agent edits \`implementation.md\`
|
|
96
|
+
* ❌ No decision spans multiple layers
|
|
97
|
+
* ❌ No prose inside decisions
|
|
98
|
+
* ❌ No incremental edits to implementation.md
|
|
99
|
+
* ✅ Delete + regenerate is always safe
|
|
100
|
+
|
|
101
|
+
If these rules hold → system is deterministic.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Mental model (for Cursor usage)
|
|
106
|
+
|
|
107
|
+
* \`implementation.decisions.md\` = **config**
|
|
108
|
+
* Writer agent = **compiler**
|
|
109
|
+
* \`implementation.md\` = **build artifact**
|
|
110
|
+
* You = **approver of intent**
|
|
111
|
+
* Cursor = **execution environment**
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
<!-- ## Optional (but powerful, later)
|
|
116
|
+
|
|
117
|
+
* Add Decision IDs enforcement
|
|
118
|
+
* Add a script that deletes + regenerates implementation.md
|
|
119
|
+
* Add a CI check that fails if implementation.md is edited manually -->
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### Final checkpoint
|
|
124
|
+
|
|
125
|
+
If you can:
|
|
126
|
+
|
|
127
|
+
* delete \`implementation.md\`
|
|
128
|
+
* regenerate it
|
|
129
|
+
* get the same result
|
|
130
|
+
|
|
131
|
+
✅ You’ve set it up correctly.
|
|
132
|
+
`,
|
|
133
|
+
|
|
134
|
+
"init.md": `# Cursor Setup: Deterministic Bottom-Up Architecture
|
|
135
|
+
|
|
136
|
+
## 1. Create the files (once)
|
|
137
|
+
|
|
138
|
+
In your repo root:
|
|
139
|
+
|
|
140
|
+
/implementation
|
|
141
|
+
├─ implementation.decisions.md ← ONLY editable implementation truth
|
|
142
|
+
├─ implementation.md ← GENERATED, read-only
|
|
143
|
+
├─ README.md ← governance
|
|
144
|
+
└─ agent-prompts.md ← implementation agents
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 2. Initialize \`implementation.decisions.md\`
|
|
149
|
+
|
|
150
|
+
Paste this exactly:
|
|
151
|
+
|
|
152
|
+
Paste this exactly, until the line \`-- END OF PASTING --\`:
|
|
153
|
+
|
|
154
|
+
# Implementation Decisions
|
|
155
|
+
|
|
156
|
+
## Rules
|
|
157
|
+
- Decisions are the ONLY source of truth
|
|
158
|
+
- implementation.md is generated, never edited
|
|
159
|
+
- Every decision belongs to exactly ONE layer
|
|
160
|
+
- Only decisions with Status: approved are applied
|
|
161
|
+
|
|
162
|
+
## Layers (fixed)
|
|
163
|
+
{
|
|
164
|
+
TAKE LAYERS FROM architecture/README.md > Layers (Fixed)
|
|
165
|
+
write each layer in a new line by order with ## before the name
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
-- END OF PASTING --
|
|
169
|
+
|
|
170
|
+
This file is **the system state**.
|
|
171
|
+
|
|
172
|
+
### Mapping for creating identical prompts from agents-prompts.md:
|
|
173
|
+
same as Mapping for creating identical prompts from architecture/agents-prompts.md, just replace the 'D-' with 'I-',
|
|
174
|
+
example:
|
|
175
|
+
- DAL → \`I-DAL-XXX\`
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 3. Create Cursor Agents Prompts (THIS IS KEY)
|
|
180
|
+
|
|
181
|
+
- Create prompt for **one agent per layer**
|
|
182
|
+
- follow instructions in implementation/agents-prompts.md
|
|
183
|
+
`,
|
|
184
|
+
|
|
185
|
+
"implementation.md": `<!-- GENERATED FILE – DO NOT EDIT -->
|
|
186
|
+
|
|
187
|
+
# Implementation
|
|
188
|
+
|
|
189
|
+
This file is generated from implementation.decisions.md
|
|
190
|
+
`,
|
|
191
|
+
|
|
192
|
+
"implementation.decisions.md": `# Implementation Decisions
|
|
193
|
+
|
|
194
|
+
## Rules
|
|
195
|
+
- Decisions are the ONLY source of truth
|
|
196
|
+
- implementation.md is generated, never edited
|
|
197
|
+
- Every decision belongs to exactly ONE layer
|
|
198
|
+
- Only decisions with Status: approved are applied
|
|
199
|
+
|
|
200
|
+
## Layers (fixed)
|
|
201
|
+
- Infra
|
|
202
|
+
- DAL
|
|
203
|
+
- Services
|
|
204
|
+
- Controllers
|
|
205
|
+
- Routes
|
|
206
|
+
- API Service
|
|
207
|
+
- FE Services
|
|
208
|
+
- Context
|
|
209
|
+
- Components
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Infra
|
|
214
|
+
|
|
215
|
+
## DAL
|
|
216
|
+
|
|
217
|
+
## Services
|
|
218
|
+
|
|
219
|
+
## Controllers
|
|
220
|
+
|
|
221
|
+
## Routes
|
|
222
|
+
|
|
223
|
+
## API Service
|
|
224
|
+
|
|
225
|
+
## FE Services
|
|
226
|
+
|
|
227
|
+
## Context
|
|
228
|
+
|
|
229
|
+
## Components
|
|
230
|
+
`,
|
|
231
|
+
"agents-prompts.md": `# Implementation Agent Prompts
|
|
232
|
+
|
|
233
|
+
This document defines the exact prompts used to operate the implementation system in this repository.
|
|
234
|
+
|
|
235
|
+
These prompts are part of implementation governance and must remain stable.
|
|
236
|
+
|
|
237
|
+
Layer structure is inherited from \`/architecture\`.
|
|
238
|
+
Implementation may not redefine or modify architectural layers.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 1. Layer Implementation Agent (Template)
|
|
243
|
+
|
|
244
|
+
Use **one instance per layer**.
|
|
245
|
+
Duplicate this prompt and hard-code the layer name.
|
|
246
|
+
|
|
247
|
+
### Example: DAL Implementation Agent
|
|
248
|
+
|
|
249
|
+
You are the DAL Implementation Agent.
|
|
250
|
+
|
|
251
|
+
Rules:
|
|
252
|
+
- Read implementation/implementation.decisions.md
|
|
253
|
+
- Respect boundaries and Contracts defined in architecture/architecture.decisions.md
|
|
254
|
+
- If the architecture layer defines Contracts, your proposal must satisfy them
|
|
255
|
+
- Compare existing approved decisions in your layer with current architecture contracts
|
|
256
|
+
- If structural paths or dependencies violate architecture, propose a minimal corrective Decision
|
|
257
|
+
- If an existing approved decision already satisfies architecture and Contracts, do NOT propose a replacement
|
|
258
|
+
- Prefer additive or corrective decisions over rewriting existing ones
|
|
259
|
+
- Propose NEW stack-specific decisions for the DAL layer ONLY
|
|
260
|
+
- Do NOT redefine architectural responsibilities
|
|
261
|
+
- Do NOT edit implementation.md
|
|
262
|
+
- Do NOT modify or replace decisions outside your layer
|
|
263
|
+
- Do NOT ask exploratory questions
|
|
264
|
+
- Output ONLY a Decision block
|
|
265
|
+
- If escalation is required, include the escalation bullet inside the Decision block as the final bullet
|
|
266
|
+
- Decisions may reference technologies, libraries, file structure, or patterns
|
|
267
|
+
- Only propose minimal corrective or additive decisions
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
Output format (exact):
|
|
272
|
+
|
|
273
|
+
[I-DAL-XXX]
|
|
274
|
+
Layer: DAL
|
|
275
|
+
Decision:
|
|
276
|
+
- bullet
|
|
277
|
+
- bullet
|
|
278
|
+
Rationale:
|
|
279
|
+
- short
|
|
280
|
+
Confidence: High | Medium | Low
|
|
281
|
+
Status: proposed
|
|
282
|
+
|
|
283
|
+
### Layer name substitutions
|
|
284
|
+
|
|
285
|
+
Create identical prompts with only the layer name changed according to mapping in init.md
|
|
286
|
+
|
|
287
|
+
No other changes are allowed.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 2. Implementation Validator Agent
|
|
292
|
+
|
|
293
|
+
You are the Implementation Validator Agent.
|
|
294
|
+
|
|
295
|
+
Rules:
|
|
296
|
+
- Read implementation/implementation.decisions.md
|
|
297
|
+
- Do NOT edit files
|
|
298
|
+
- Do NOT propose new decisions
|
|
299
|
+
- Validate proposed decisions by checking:
|
|
300
|
+
- Do not violate architectural boundaries
|
|
301
|
+
- Do not redefine layers
|
|
302
|
+
- Do not contradict approved architecture decisions
|
|
303
|
+
- Are stack-specific (not architectural)
|
|
304
|
+
|
|
305
|
+
OUTPUT CONTRACT (MANDATORY):
|
|
306
|
+
|
|
307
|
+
You must output EXACTLY ONE of the following:
|
|
308
|
+
|
|
309
|
+
1) OK
|
|
310
|
+
|
|
311
|
+
OR
|
|
312
|
+
|
|
313
|
+
2) A bullet list of blocking issues.
|
|
314
|
+
|
|
315
|
+
STRICT FORMAT RULES:
|
|
316
|
+
- If there are NO blocking issues, output EXACTLY:
|
|
317
|
+
OK
|
|
318
|
+
|
|
319
|
+
- If there ARE blocking issues, output ONLY a bullet list.
|
|
320
|
+
- Do NOT include explanations.
|
|
321
|
+
- Do NOT include validation traces.
|
|
322
|
+
- Do NOT include summaries.
|
|
323
|
+
- Do NOT include reasoning.
|
|
324
|
+
- Do NOT include any text before or after the output.
|
|
325
|
+
- Any deviation from this format is considered FAILURE.
|
|
326
|
+
|
|
327
|
+
This is a compliance task, not an explanatory task.
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## 3. Implementation Writer Agent (Deterministic Generator)
|
|
333
|
+
|
|
334
|
+
You are a deterministic implementation document generator.
|
|
335
|
+
|
|
336
|
+
Input:
|
|
337
|
+
- implementation/implementation.decisions.md
|
|
338
|
+
|
|
339
|
+
Rules:
|
|
340
|
+
- Read ONLY implementation/implementation.decisions.md
|
|
341
|
+
- You must NOT read architecture/architecture.decisions.md except to determine layer order
|
|
342
|
+
- You must write ONLY implementation.md
|
|
343
|
+
- You must NOT create, modify, or delete any other file
|
|
344
|
+
- Ignore existing implementation.md
|
|
345
|
+
- Generate implementation.md from scratch
|
|
346
|
+
- Add comment on top <!-- GENERATED FILE – DO NOT EDIT -->
|
|
347
|
+
- Apply ONLY decisions with Status: approved
|
|
348
|
+
- Preserve bullet wording exactly
|
|
349
|
+
- Do NOT rephrase, summarize, or infer
|
|
350
|
+
- Use layer order inherited from architecture/architecture.decisions.md
|
|
351
|
+
- Do NOT emit a "Layers" list; layers are represented only by section headers
|
|
352
|
+
- No creative language
|
|
353
|
+
|
|
354
|
+
Output:
|
|
355
|
+
- A complete implementation.md`
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
module.exports = implementationTemplates;
|
|
359
|
+
|