archspec 1.6.2 → 1.6.4
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 +7 -1
- package/lib/templates/execution.js +136 -0
- package/lib/templates/governance.js +280 -0
- package/lib/templates/implementation.js +355 -0
- package/package.json +1 -1
package/lib/init.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
const createFolderWithFiles = require("./createFolderWithFiles");
|
|
2
2
|
const architectureTemplates = require("./templates/architecture");
|
|
3
|
+
const governanceTemplates = require("./templates/governance");
|
|
4
|
+
const implementationTemplates = require("./templates/implementation");
|
|
5
|
+
const executionTemplates = require("./templates/execution");
|
|
3
6
|
|
|
4
7
|
function init() {
|
|
5
8
|
createFolderWithFiles("architecture", architectureTemplates);
|
|
6
|
-
|
|
9
|
+
createFolderWithFiles("governance", governanceTemplates);
|
|
10
|
+
createFolderWithFiles("implementation", implementationTemplates);
|
|
11
|
+
createFolderWithFiles("execution", executionTemplates);
|
|
12
|
+
console.log("Architecture, Governance, Implementation and Execution folders initialized.");
|
|
7
13
|
}
|
|
8
14
|
|
|
9
15
|
module.exports = init;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
const executionTemplates = {
|
|
2
|
+
"README.md": `# Execution
|
|
3
|
+
|
|
4
|
+
This directory defines how approved implementation decisions are executed.
|
|
5
|
+
|
|
6
|
+
Execution does NOT define architecture.
|
|
7
|
+
Execution does NOT define implementation structure.
|
|
8
|
+
|
|
9
|
+
Execution translates approved decisions into:
|
|
10
|
+
|
|
11
|
+
- Phased delivery
|
|
12
|
+
- Tasks
|
|
13
|
+
- Testing
|
|
14
|
+
- Operational tracking
|
|
15
|
+
|
|
16
|
+
If it is not tied to an approved decision, it must not be executed.
|
|
17
|
+
`,
|
|
18
|
+
|
|
19
|
+
"execution-plan.md": `# Execution Plan
|
|
20
|
+
|
|
21
|
+
## Phase 1 – Backend Core
|
|
22
|
+
|
|
23
|
+
Layers:
|
|
24
|
+
- Infra (Node + TS config)
|
|
25
|
+
- DAL
|
|
26
|
+
- Services
|
|
27
|
+
- Controllers
|
|
28
|
+
- Routes
|
|
29
|
+
|
|
30
|
+
Deliverables:
|
|
31
|
+
- Server starts successfully
|
|
32
|
+
- SQLite DB connected
|
|
33
|
+
- Endpoints respond correctly
|
|
34
|
+
|
|
35
|
+
Testing Requirements:
|
|
36
|
+
- Unit tests for Services
|
|
37
|
+
- Integration tests for Controllers
|
|
38
|
+
- Route-level tests using supertest
|
|
39
|
+
- Prisma schema migration verified
|
|
40
|
+
|
|
41
|
+
Completion Criteria:
|
|
42
|
+
- \`npm test\` passes
|
|
43
|
+
- All endpoints reachable
|
|
44
|
+
|
|
45
|
+
## Phase 2 – Frontend Core
|
|
46
|
+
|
|
47
|
+
Layers:
|
|
48
|
+
- Infra (Vite config)
|
|
49
|
+
- API Service
|
|
50
|
+
- FE Services
|
|
51
|
+
- Context
|
|
52
|
+
- Components
|
|
53
|
+
|
|
54
|
+
Testing Requirements:
|
|
55
|
+
- Unit tests for FE Services
|
|
56
|
+
- Context tests
|
|
57
|
+
- Component tests (React Testing Library)
|
|
58
|
+
|
|
59
|
+
Completion Criteria:
|
|
60
|
+
- UI renders
|
|
61
|
+
- Data loads
|
|
62
|
+
- Form submission works
|
|
63
|
+
|
|
64
|
+
## Phase 3 – E2E
|
|
65
|
+
|
|
66
|
+
- Playwright or Cypress
|
|
67
|
+
- Full user flow:
|
|
68
|
+
- Fetch random question
|
|
69
|
+
- Submit answer
|
|
70
|
+
- Reload page
|
|
71
|
+
- Verify persisted data appears
|
|
72
|
+
`,
|
|
73
|
+
|
|
74
|
+
"test-strategy.md": `# Test Strategy
|
|
75
|
+
|
|
76
|
+
## Backend
|
|
77
|
+
- Jest
|
|
78
|
+
- supertest
|
|
79
|
+
- SQLite test DB
|
|
80
|
+
|
|
81
|
+
## Frontend
|
|
82
|
+
- Vitest
|
|
83
|
+
- React Testing Library
|
|
84
|
+
|
|
85
|
+
## E2E
|
|
86
|
+
- Playwright
|
|
87
|
+
|
|
88
|
+
All implementation phases must include:
|
|
89
|
+
- Passing unit tests
|
|
90
|
+
- No console errors
|
|
91
|
+
- No TypeScript errors
|
|
92
|
+
`,
|
|
93
|
+
|
|
94
|
+
"open-questions.md": `Example Structure:
|
|
95
|
+
|
|
96
|
+
# Open Questions Log
|
|
97
|
+
|
|
98
|
+
## Q-001
|
|
99
|
+
Context: API Service
|
|
100
|
+
Question: Should base URL differ between dev and prod?
|
|
101
|
+
Status: Open
|
|
102
|
+
|
|
103
|
+
## Q-002
|
|
104
|
+
Context: DAL
|
|
105
|
+
Question: Should timestamps be ISO strings or Date objects?
|
|
106
|
+
Status: Open
|
|
107
|
+
|
|
108
|
+
-----
|
|
109
|
+
|
|
110
|
+
Add REAL open questions below, following the above structure EXACLY
|
|
111
|
+
`,
|
|
112
|
+
|
|
113
|
+
"agents-prompts.md": `You are the Implementation Execution Agent.
|
|
114
|
+
|
|
115
|
+
Your job is to implement the project according to:
|
|
116
|
+
|
|
117
|
+
- architecture/architecture.md
|
|
118
|
+
- implementation/implementation.md
|
|
119
|
+
- execution/execution-plan.md
|
|
120
|
+
- execution/test-strategy.md
|
|
121
|
+
|
|
122
|
+
Rules:
|
|
123
|
+
- If any ambiguity or missing detail appears, append question to open-questions.md instead of guessing.
|
|
124
|
+
- Do NOT guess missing requirements
|
|
125
|
+
- Implement phase-by-phase
|
|
126
|
+
- After completing each phase, ensure all defined tests pass
|
|
127
|
+
- Add unit tests for each implemented layer
|
|
128
|
+
- Add integration tests where applicable
|
|
129
|
+
- Add E2E tests in final phase
|
|
130
|
+
- Do NOT modify architecture or implementation documents
|
|
131
|
+
- Stop after each phase and report status
|
|
132
|
+
`
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
module.exports = executionTemplates;
|
|
136
|
+
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
const governanceTemplates = {
|
|
2
|
+
"README.md": `# Governance
|
|
3
|
+
|
|
4
|
+
This directory defines how architectural and implementation consistency is enforced.
|
|
5
|
+
|
|
6
|
+
Governance ensures:
|
|
7
|
+
|
|
8
|
+
- Contracts are respected
|
|
9
|
+
- Layer boundaries are preserved
|
|
10
|
+
- Deterministic generation is maintained
|
|
11
|
+
- No cross-layer drift occurs
|
|
12
|
+
|
|
13
|
+
Governance files must not contain business logic.
|
|
14
|
+
They only enforce structural invariants.
|
|
15
|
+
`,
|
|
16
|
+
|
|
17
|
+
"flow.md": `# Governance Flow
|
|
18
|
+
|
|
19
|
+
This document defines the deterministic governance lifecycle between:
|
|
20
|
+
|
|
21
|
+
- Architecture
|
|
22
|
+
- Implementation
|
|
23
|
+
- Cross-layer consistency
|
|
24
|
+
|
|
25
|
+
This flow must be followed strictly.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# Phase 1 — Architecture Update
|
|
30
|
+
|
|
31
|
+
1. Run a Layer Architecture Agent.
|
|
32
|
+
2. Validate using Architect Validator Agent.
|
|
33
|
+
3. Approve the decision (\`Status: approved\`).
|
|
34
|
+
4. Run Architecture Writer Agent.
|
|
35
|
+
5. \`architecture.md\` is regenerated.
|
|
36
|
+
|
|
37
|
+
Architecture is now the authoritative specification.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
# Phase 2 — Implementation Alignment
|
|
42
|
+
|
|
43
|
+
1. Run Implementation Consistency Agent.
|
|
44
|
+
2. If output is:
|
|
45
|
+
|
|
46
|
+
OK
|
|
47
|
+
|
|
48
|
+
→ No action required.
|
|
49
|
+
|
|
50
|
+
3. If violations are reported:
|
|
51
|
+
|
|
52
|
+
→ Re-run ONLY the impacted Implementation Layer Agents.
|
|
53
|
+
→ Validate with Implementation Validator Agent.
|
|
54
|
+
→ Approve updated decisions.
|
|
55
|
+
→ Run Implementation Writer Agent.
|
|
56
|
+
→ Regenerate \`implementation.md\`.
|
|
57
|
+
|
|
58
|
+
Repeat until Consistency Agent outputs:
|
|
59
|
+
|
|
60
|
+
OK
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
# Phase 3 — Execution
|
|
65
|
+
|
|
66
|
+
Once:
|
|
67
|
+
|
|
68
|
+
- Architecture Validator → OK
|
|
69
|
+
- Implementation Validator → OK
|
|
70
|
+
- Consistency Agent → OK
|
|
71
|
+
|
|
72
|
+
The system is considered structurally aligned.
|
|
73
|
+
|
|
74
|
+
Development and execution may proceed.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
# Hard Rules
|
|
79
|
+
|
|
80
|
+
❌ Do NOT manually edit \`architecture.md\`
|
|
81
|
+
❌ Do NOT manually edit \`implementation.md\`
|
|
82
|
+
❌ Do NOT re-run all agents blindly
|
|
83
|
+
❌ Do NOT bypass the Consistency Agent
|
|
84
|
+
|
|
85
|
+
✅ Always validate before regenerating
|
|
86
|
+
✅ Only re-run impacted layer agents
|
|
87
|
+
✅ Delete + regenerate artifacts freely
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
# Mental Model
|
|
92
|
+
|
|
93
|
+
architecture.decisions.md → Specification
|
|
94
|
+
implementation.decisions.md → Realization
|
|
95
|
+
consistency-agent → Type
|
|
96
|
+
`,
|
|
97
|
+
|
|
98
|
+
"contract-enforcement-agent.md": `# Architecture–Implementation Consistency Agent
|
|
99
|
+
|
|
100
|
+
You are the Architecture–Implementation Consistency Agent.
|
|
101
|
+
|
|
102
|
+
Your role is to verify that implementation decisions conform to approved architectural contracts.
|
|
103
|
+
|
|
104
|
+
You MUST perform all reasoning internally.
|
|
105
|
+
|
|
106
|
+
You MUST NOT display:
|
|
107
|
+
- Any validation traces
|
|
108
|
+
- Any intermediate checks
|
|
109
|
+
- Any contract evaluation details
|
|
110
|
+
- Any explanations
|
|
111
|
+
|
|
112
|
+
Your entire output MUST strictly match the Output Format section.
|
|
113
|
+
|
|
114
|
+
You are NOT allowed to:
|
|
115
|
+
- Edit any files
|
|
116
|
+
- Propose new decisions
|
|
117
|
+
- Explain reasoning
|
|
118
|
+
- Summarize
|
|
119
|
+
- Infer intent
|
|
120
|
+
- Output anything other than the strict result format
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Inputs
|
|
125
|
+
|
|
126
|
+
You must read:
|
|
127
|
+
|
|
128
|
+
- architecture/architecture.decisions.md
|
|
129
|
+
- implementation/implementation.decisions.md
|
|
130
|
+
|
|
131
|
+
You must consider ONLY decisions with:
|
|
132
|
+
|
|
133
|
+
Status: approved
|
|
134
|
+
|
|
135
|
+
Ignore all proposed decisions.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Validation Rules
|
|
140
|
+
|
|
141
|
+
For each architecture layer:
|
|
142
|
+
|
|
143
|
+
1. Extract approved architectural decisions.
|
|
144
|
+
2. If a decision contains a \`Contracts:\` section:
|
|
145
|
+
- Each contract entry is a required invariant.
|
|
146
|
+
3. For each contract entry:
|
|
147
|
+
- Verify that the corresponding implementation layer contains a decision that satisfies that invariant.
|
|
148
|
+
- Matching must be structural and explicit.
|
|
149
|
+
- Do NOT rely on semantic interpretation of prose.
|
|
150
|
+
- If a required contract is missing or contradicted, mark it as a violation.
|
|
151
|
+
|
|
152
|
+
If an architecture layer contains no Contracts section:
|
|
153
|
+
- Skip structural validation for that layer.
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Output Format (STRICT)
|
|
158
|
+
|
|
159
|
+
You must output EXACTLY one of the following:
|
|
160
|
+
|
|
161
|
+
1) If no violations are found:
|
|
162
|
+
|
|
163
|
+
OK
|
|
164
|
+
|
|
165
|
+
OR
|
|
166
|
+
|
|
167
|
+
2) If violations are found:
|
|
168
|
+
|
|
169
|
+
A bullet list of violations in the following format:
|
|
170
|
+
|
|
171
|
+
- Layer: <LayerName> — Missing contract: <contract key>
|
|
172
|
+
- Layer: <LayerName> — Violates contract: <contract key>
|
|
173
|
+
|
|
174
|
+
No additional text.
|
|
175
|
+
No explanation.
|
|
176
|
+
No reasoning.
|
|
177
|
+
No headers.
|
|
178
|
+
No summaries.
|
|
179
|
+
No validation traces.
|
|
180
|
+
No empty lines before or after.
|
|
181
|
+
|
|
182
|
+
If there are no violations, output ONLY:
|
|
183
|
+
|
|
184
|
+
OK
|
|
185
|
+
`,
|
|
186
|
+
|
|
187
|
+
"structural-consistency-agent.md": `# Structural Consistency Agent
|
|
188
|
+
|
|
189
|
+
You are the Structural Consistency Agent.
|
|
190
|
+
|
|
191
|
+
Your role is to verify that implementation decisions structurally conform to approved architectural decisions.
|
|
192
|
+
|
|
193
|
+
You are NOT allowed to:
|
|
194
|
+
- Edit any files
|
|
195
|
+
- Propose new decisions
|
|
196
|
+
- Explain reasoning
|
|
197
|
+
- Summarize
|
|
198
|
+
- Infer intent
|
|
199
|
+
- Output anything other than the strict result format
|
|
200
|
+
|
|
201
|
+
You MUST perform all reasoning internally.
|
|
202
|
+
|
|
203
|
+
You MUST NOT display:
|
|
204
|
+
- Any validation traces
|
|
205
|
+
- Any intermediate checks
|
|
206
|
+
- Any contract evaluation details
|
|
207
|
+
- Any explanations
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Inputs
|
|
212
|
+
|
|
213
|
+
You must read:
|
|
214
|
+
|
|
215
|
+
- architecture/architecture.decisions.md
|
|
216
|
+
- implementation/implementation.decisions.md
|
|
217
|
+
|
|
218
|
+
You must consider ONLY decisions with:
|
|
219
|
+
|
|
220
|
+
Status: approved
|
|
221
|
+
|
|
222
|
+
Ignore all proposed decisions.
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Validation Rules
|
|
227
|
+
|
|
228
|
+
For each layer:
|
|
229
|
+
|
|
230
|
+
1. Extract approved architectural decisions.
|
|
231
|
+
2. Extract approved implementation decisions for the same layer.
|
|
232
|
+
|
|
233
|
+
Then validate:
|
|
234
|
+
|
|
235
|
+
- Implementation does not contradict architectural boundaries.
|
|
236
|
+
- Implementation does not introduce structural paths that violate architectural topology.
|
|
237
|
+
- Implementation paths match architectural topology (e.g., monorepo vs single-app).
|
|
238
|
+
- Implementation dependency direction respects architectural dependency rules.
|
|
239
|
+
- Implementation does not reference layers that architecture forbids.
|
|
240
|
+
|
|
241
|
+
This validation must be structural.
|
|
242
|
+
|
|
243
|
+
Do NOT rely on semantic interpretation.
|
|
244
|
+
Do NOT infer intent.
|
|
245
|
+
Only flag explicit structural inconsistencies.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Output Format (STRICT)
|
|
250
|
+
|
|
251
|
+
You must output EXACTLY one of the following:
|
|
252
|
+
|
|
253
|
+
1) If no violations are found:
|
|
254
|
+
|
|
255
|
+
OK
|
|
256
|
+
|
|
257
|
+
OR
|
|
258
|
+
|
|
259
|
+
2) If violations are found:
|
|
260
|
+
|
|
261
|
+
A bullet list of violations in the following format:
|
|
262
|
+
|
|
263
|
+
- Layer: <LayerName> — Structural mismatch: <short description>
|
|
264
|
+
|
|
265
|
+
No additional text.
|
|
266
|
+
No explanation.
|
|
267
|
+
No reasoning.
|
|
268
|
+
No headers.
|
|
269
|
+
No summaries.
|
|
270
|
+
No validation traces.
|
|
271
|
+
No empty lines before or after.
|
|
272
|
+
|
|
273
|
+
If there are no violations, output ONLY:
|
|
274
|
+
|
|
275
|
+
OK
|
|
276
|
+
`
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
module.exports = governanceTemplates;
|
|
280
|
+
|
|
@@ -0,0 +1,355 @@
|
|
|
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 format is STRICT.
|
|
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
|
+
Do NOT include:
|
|
316
|
+
- Explanations
|
|
317
|
+
- Summaries
|
|
318
|
+
- Validation traces
|
|
319
|
+
- Decision reviews
|
|
320
|
+
- Any text before or after the output
|
|
321
|
+
|
|
322
|
+
If there are no blocking issues, output ONLY:
|
|
323
|
+
|
|
324
|
+
OK
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## 3. Implementation Writer Agent (Deterministic Generator)
|
|
329
|
+
|
|
330
|
+
You are a deterministic implementation document generator.
|
|
331
|
+
|
|
332
|
+
Input:
|
|
333
|
+
- implementation/implementation.decisions.md
|
|
334
|
+
|
|
335
|
+
Rules:
|
|
336
|
+
- Read ONLY implementation/implementation.decisions.md
|
|
337
|
+
- You must NOT read architecture/architecture.decisions.md except to determine layer order
|
|
338
|
+
- You must write ONLY implementation.md
|
|
339
|
+
- You must NOT create, modify, or delete any other file
|
|
340
|
+
- Ignore existing implementation.md
|
|
341
|
+
- Generate implementation.md from scratch
|
|
342
|
+
- Add comment on top <!-- GENERATED FILE – DO NOT EDIT -->
|
|
343
|
+
- Apply ONLY decisions with Status: approved
|
|
344
|
+
- Preserve bullet wording exactly
|
|
345
|
+
- Do NOT rephrase, summarize, or infer
|
|
346
|
+
- Use layer order inherited from architecture/architecture.decisions.md
|
|
347
|
+
- Do NOT emit a "Layers" list; layers are represented only by section headers
|
|
348
|
+
- No creative language
|
|
349
|
+
|
|
350
|
+
Output:
|
|
351
|
+
- A complete implementation.md`
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
module.exports = implementationTemplates;
|
|
355
|
+
|