interaqt 0.7.4 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,11 +14,23 @@ You are a honest software expert with the following capabilities:
14
14
 
15
15
  # Task 3: Code Generation and Progressive Testing
16
16
 
17
- **📖 START: Read `docs/STATUS.json` to check current progress before proceeding.**
17
+ **📖 START: Determine current module and check progress before proceeding.**
18
18
 
19
- **🔄 Update `docs/STATUS.json`:**
19
+ **🔴 STEP 0: Determine Current Module**
20
+ 1. Read module name from `.currentmodule` file in project root
21
+ 2. If file doesn't exist, STOP and ask user which module to work on
22
+ 3. Use this module name for all subsequent file operations
23
+
24
+ **🔴 CRITICAL: Module-Based File Naming**
25
+ - All output files MUST be prefixed with current module name from `.currentmodule`
26
+ - Format: `{module}.{filename}` (e.g., if module is "user", output `docs/user.computation-implementation-plan.json`)
27
+ - All input file references MUST also use module prefix when reading previous outputs
28
+ - Module status file location: `docs/{module}.status.json`
29
+
30
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
20
31
  ```json
21
32
  {
33
+ "module": "<keep existing value>",
22
34
  "currentTask": "Task 3",
23
35
  "completed": false
24
36
  }
@@ -37,56 +49,42 @@ This approach prevents the accumulation of errors and makes debugging much easie
37
49
 
38
50
  ## Task 3.1: Code Generation and Implementation
39
51
 
40
- **🔄 Update `docs/STATUS.json`:**
52
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
41
53
  ```json
42
54
  {
55
+ "module": "<keep existing value>",
43
56
  "currentTask": "Task 3.1",
44
57
  "completed": false
45
58
  }
46
59
  ```
47
- - Clear next steps
48
60
 
49
61
  **Based on the analysis documents created in Tasks 2.1-2.3, now implement the actual code.**
50
62
 
51
- ### Task 3.1.1: 🔴 CRITICAL: Read Complete API Reference First
63
+ ### Task 3.1.1: 🔴 CRITICAL: Setup and API Reference
52
64
 
53
- **🔄 Update `docs/STATUS.json`:**
65
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
54
66
  ```json
55
67
  {
68
+ "module": "<keep existing value>",
56
69
  "currentTask": "Task 3.1.1",
57
70
  "completed": false
58
71
  }
59
72
  ```
60
- **Before generating ANY code, you MUST thoroughly read `./agentspace/knowledge/generator/api-reference.md`**
61
-
62
- This document contains:
63
- - Complete and accurate API syntax and parameters
64
- - Common mistakes and correct usage patterns
65
- - Type definitions and constraints
66
- - Real working examples
67
73
 
68
- **Important Guidelines:**
69
- - ✅ Always refer to the API reference for correct syntax
70
- - ✅ When tests fail, FIRST check the API reference for correct usage
71
- - ✅ Follow the exact parameter names and types shown in the API reference
72
- - ❌ Do NOT rely on memory or assumptions about API usage
73
- - ❌ Do NOT guess parameter names or syntax
74
+ #### Step 1: Read API Reference
75
+ **Read `./agentspace/knowledge/generator/api-reference.md`** for correct syntax and common mistakes.
74
76
 
75
- Common issues that can be avoided by reading the API reference:
76
- - Missing required parameters (e.g., `attributeQuery` in storage operations)
77
- - Wrong property usage (e.g., `symmetric` doesn't exist in Relation.create)
78
- - Incorrect computation placement (e.g., Transform cannot be used in Property computation)
79
- - Hardcoded relation names (always use `RelationInstance.name` when querying relations)
77
+ #### Step 2: Create Module File
78
+ - [ ] Copy `backend/business.template.ts` to `backend/{module}.ts` (replace `{module}` with actual name from `.currentmodule`)
80
79
 
81
- ## 🔴 Recommended: Single File Approach
82
- **To avoid complex circular references between files, it's recommended to generate all backend code in a single file:**
80
+ #### Step 3: Register in backend/index.ts
81
+ - [ ] Add import: `import {entities as {module}Entities, relations as {module}Relations, interactions as {module}Interactions, activities as {module}Activities, dicts as {module}Dicts} from './{module}'`
82
+ - [ ] Update exports to merge: `export const entities = [...basicEntities, ...{module}Entities]` (repeat for relations, activities, interactions, dicts)
83
83
 
84
- - Define all entities, relations, interactions, and computations in one file
85
- - ✅ Example structure: `backend/index.ts` containing all definitions
86
-
87
- **✅ END Task 3.1.1: Update `docs/STATUS.json`:**
84
+ **✅ END Task 3.1.1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
88
85
  ```json
89
86
  {
87
+ "module": "<keep existing value>",
90
88
  "currentTask": "Task 3.1.1",
91
89
  "completed": true
92
90
  }
@@ -95,21 +93,23 @@ Common issues that can be avoided by reading the API reference:
95
93
  **📝 Commit changes:**
96
94
  ```bash
97
95
  git add .
98
- git commit -m "feat: Task 3.1.1 - Complete API reference study"
96
+ git commit -m "feat: Task 3.1.1 - Setup module file and register in index"
99
97
  ```
100
98
 
101
99
  ### Task 3.1.2: Entity and Relation Implementation
102
100
 
103
- **🔄 Update `docs/STATUS.json`:**
101
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
104
102
  ```json
105
103
  {
104
+ "module": "<keep existing value>",
106
105
  "currentTask": "Task 3.1.2",
107
106
  "completed": false
108
107
  }
109
108
  ```
110
- - Clear next steps
111
109
 
112
- - [ ] Generate all entities based on `docs/data-design.json`. **DO NOT define any computations yet**. No `computed` or `computation` on properties
110
+ **🔴 All code in Task 3.1.2-3.1.3 goes in `backend/{module}.ts`**
111
+
112
+ - [ ] Generate all entities based on `docs/{module}.data-design.json`. **DO NOT define any computations yet**. No `computed` or `computation` on properties
113
113
  - [ ] Define entity properties with correct types
114
114
  - **🔴 CRITICAL: NO reference ID fields in entities!**
115
115
  - ❌ NEVER: `userId`, `postId`, `requestId`, `dormitoryId` as properties
@@ -122,13 +122,19 @@ git commit -m "feat: Task 3.1.1 - Complete API reference study"
122
122
  - Relations define how entities connect
123
123
  - Relations create the property names for accessing related entities
124
124
  - [ ] Define relation properties
125
+ - [ ] Update exports in `backend/{module}.ts`:
126
+ ```typescript
127
+ export const entities = [Entity1, Entity2, ...]
128
+ export const relations = [Relation1, Relation2, ...]
129
+ ```
125
130
  - [ ] **Type Check**: Run `npm run check` to ensure TypeScript compilation passes
126
131
  - Fix any type errors before proceeding
127
132
  - Do NOT continue until all type errors are resolved
128
133
 
129
- **✅ END Task 3.1.2: Update `docs/STATUS.json`:**
134
+ **✅ END Task 3.1.2: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
130
135
  ```json
131
136
  {
137
+ "module": "<keep existing value>",
132
138
  "currentTask": "Task 3.1.2",
133
139
  "completed": true
134
140
  }
@@ -142,26 +148,56 @@ git commit -m "feat: Task 3.1.2 - Complete entity and relation implementation"
142
148
 
143
149
  ### Task 3.1.3: Interaction Implementation
144
150
 
145
- **🔄 Update `docs/STATUS.json`:**
151
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
146
152
  ```json
147
153
  {
154
+ "module": "<keep existing value>",
148
155
  "currentTask": "Task 3.1.3",
149
156
  "completed": false
150
157
  }
151
158
  ```
152
- - Clear next step
153
-
154
159
 
155
- - [ ] Generate all interactions based on `requirements/interaction-designs.json`. **DO NOT define any conditions yet** - we will add permissions and business rules later in Task 3.2. No `condition` parameter in Interaction.create()
160
+ - [ ] Generate all interactions based on `requirements/{module}.interactions-design.json`. **DO NOT define any conditions yet** - we will add permissions and business rules later in Task 3.2. No `condition` parameter in Interaction.create()
156
161
  - [ ] Start with simple payload-only interactions (no conditions initially)
157
162
  - [ ] Ensure all payloads match the documented fields
163
+ - [ ] **🔴 CRITICAL: For query interactions (action: GetAction):**
164
+ - **MUST declare `data` field** - specify the Entity or Relation to query
165
+ - **SHOULD declare `query` field** if there are predefined filters/fields (use Query.create with QueryItem)
166
+ - Example:
167
+ ```typescript
168
+ const ViewMyFollowers = Interaction.create({
169
+ name: 'ViewUsers',
170
+ action: GetAction,
171
+ data: User, // REQUIRED: specify what to query
172
+ query: Query.create({ // OPTIONAL: predefined query config
173
+ items: [
174
+ QueryItem.create({
175
+ name: 'attributeQuery',
176
+ value: ['id', 'name', 'email']
177
+ }),
178
+ // Use function-based value to add conditional restrictions based on current context user
179
+ QueryItem.create({
180
+ name: 'match',
181
+ value: function(this:Controller, event:any) {
182
+ return MatchExp.atom({key: 'follow.id', value:['=', event.user.id]})
183
+ }
184
+ })
185
+ ]
186
+ })
187
+ })
188
+ ```
189
+ - [ ] Update exports in `backend/{module}.ts`:
190
+ ```typescript
191
+ export const interactions = [Interaction1, Interaction2, ...]
192
+ ```
158
193
  - [ ] **Type Check**: Run `npm run check` to ensure TypeScript compilation passes
159
194
  - Fix any type errors before proceeding
160
195
  - Do NOT continue until all type errors are resolved
161
196
 
162
- **✅ END Task 3.1.3: Update `docs/STATUS.json`:**
197
+ **✅ END Task 3.1.3: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
163
198
  ```json
164
199
  {
200
+ "module": "<keep existing value>",
165
201
  "currentTask": "Task 3.1.3",
166
202
  "completed": true
167
203
  }
@@ -175,9 +211,10 @@ git commit -m "feat: Task 3.1.3 - Complete interaction implementation"
175
211
 
176
212
  ### Task 3.1.4: Progressive Computation Implementation with Testing
177
213
 
178
- **🔄 Update `docs/STATUS.json`:**
214
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
179
215
  ```json
180
216
  {
217
+ "module": "<keep existing value>",
181
218
  "currentTask": "Task 3.1.4",
182
219
  "completed": false
183
220
  }
@@ -193,20 +230,115 @@ This section follows a **test-driven progressive approach** where each computati
193
230
 
194
231
  #### Task 3.1.4.1: Create Test File
195
232
 
196
- **🔄 Update `docs/STATUS.json`:**
233
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
197
234
  ```json
198
235
  {
236
+ "module": "<keep existing value>",
199
237
  "currentTask": "Task 3.1.4.1",
200
238
  "completed": false
201
239
  }
202
240
  ```
203
- - [ ] Copy contents from `tests/basic.template.test.ts` to create `tests/basic.test.ts`. **DO NOT add any test cases yet** - we will add them progressively as we implement each computation
241
+ - [ ] Copy contents from `tests/business.template.test.ts` to create `tests/{module}.business.test.ts`. **DO NOT add any test cases yet** - we will add them progressively as we implement each computation
204
242
  - [ ] This will be your main test file for progressive implementation
205
- - [ ] Import your backend definitions: `import { entities, relations, interactions } from '../backend'`
206
-
207
- **✅ END Task 3.1.4.1: Update `docs/STATUS.json`:**
243
+ - [ ] Import your backend definitions: `import { entities, relations, interactions } from '../backend/{module}.js'`
244
+
245
+ **⚠️ CRITICAL: Testing Integration-Related Logic**
246
+
247
+ When testing business logic that depends on external integrations, you do NOT need to wait for real integration implementation. Instead, simulate the external system's behavior by creating the appropriate event entities:
248
+
249
+ **Testing Pattern for Integration Event Entities:**
250
+
251
+ 1. **Use `storage.create()` to simulate external events**, NOT `callInteraction()`:
252
+ ```typescript
253
+ // ✅ CORRECT: Simulating external webhook creating an event
254
+ const ttsEvent = await controller.system.storage.create(
255
+ 'VolcTTSEvent',
256
+ {
257
+ voiceUrl: 'https://example.com/voice.mp3',
258
+ status: 'completed',
259
+ timestamp: Date.now(),
260
+ // ... other event properties
261
+ }
262
+ )
263
+ ```
264
+
265
+ ```typescript
266
+ // ❌ WRONG: Trying to create integration event via interaction
267
+ const result = await controller.callInteraction('CreateTTSEvent', {
268
+ user: testUser,
269
+ payload: { voiceUrl: 'test.mp3' }
270
+ })
271
+ // Integration events are NOT created by user interactions!
272
+ ```
273
+
274
+ 2. **Test business logic reactivity**:
275
+ - Create APICall entity first (via user interaction if applicable)
276
+ - Create integration event entity using `storage.create()`
277
+ - Verify that APICall entity properties update reactively
278
+ - Verify that business entity properties update based on APICall
279
+
280
+ 3. **Example test flow for Type 1 integration (api-call-with-return)**:
281
+ ```typescript
282
+ // Step 1: User creates a business entity that needs external API result
283
+ const greetingResult = await controller.callInteraction('CreateGreeting', {
284
+ user: testUser,
285
+ payload: { text: 'Hello world' }
286
+ })
287
+ const greeting = greetingResult.data
288
+
289
+ // Step 2: System would create APICall entity (this might be part of CreateGreeting)
290
+ // Find the created APICall
291
+ const apiCall = await controller.system.storage.findOne(
292
+ 'VolcTTSCall',
293
+ MatchExp.atom({ key: 'greeting.id', value: ['=', greeting.id] }),
294
+ undefined,
295
+ ['status']
296
+ )
297
+ expect(apiCall.status).toBe('pending')
298
+
299
+ // Step 3: Simulate external system completing the API call
300
+ const event = await controller.system.storage.create(
301
+ 'VolcTTSEvent',
302
+ {
303
+ apiCallId: apiCall.id, // Link to the APICall
304
+ voiceUrl: 'https://example.com/voice.mp3',
305
+ status: 'completed',
306
+ timestamp: Date.now()
307
+ }
308
+ )
309
+
310
+ // Step 4: Verify reactive updates
311
+ const updatedApiCall = await controller.system.storage.findOne(
312
+ 'VolcTTSCall',
313
+ MatchExp.atom({ key: 'id', value: ['=', apiCall.id] }),
314
+ undefined,
315
+ ['status', 'responseData']
316
+ )
317
+
318
+ expect(updatedApiCall.status).toBe('completed')
319
+ expect(updatedApiCall.responseData).toContain('voice.mp3')
320
+
321
+ // Step 5: Verify business entity property computed correctly
322
+ const updatedGreeting = await controller.system.storage.findOne(
323
+ 'Greeting',
324
+ MatchExp.atom({ key: 'id', value: ['=', greeting.id] }),
325
+ undefined,
326
+ ['voiceUrl']
327
+ )
328
+ expect(updatedGreeting.voiceUrl).toBe('https://example.com/voice.mp3')
329
+ ```
330
+
331
+ **Benefits of this testing approach:**
332
+ - ✅ Tests the complete internal business logic without external dependencies
333
+ - ✅ Verifies the reactive computation chain works correctly
334
+ - ✅ Can be run without any integration implementation
335
+ - ✅ Fast, reliable, and deterministic tests
336
+ - ✅ Clearly separates internal logic from external integration concerns
337
+
338
+ **✅ END Task 3.1.4.1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
208
339
  ```json
209
340
  {
341
+ "module": "<keep existing value>",
210
342
  "currentTask": "Task 3.1.4.1",
211
343
  "completed": true
212
344
  }
@@ -220,9 +352,10 @@ git commit -m "feat: Task 3.1.4.1 - Create test file structure"
220
352
 
221
353
  #### Task 3.1.4.2: Create Implementation Plan
222
354
 
223
- **🔄 Update `docs/STATUS.json`:**
355
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
224
356
  ```json
225
357
  {
358
+ "module": "<keep existing value>",
226
359
  "currentTask": "Task 3.1.4.2",
227
360
  "completed": false
228
361
  }
@@ -231,26 +364,27 @@ git commit -m "feat: Task 3.1.4.1 - Create test file structure"
231
364
  **📋 Generate the Computation Implementation Plan:**
232
365
 
233
366
  - [ ] Run the command: `npm run plan`
234
- - This command analyzes `docs/computation-analysis.json` and automatically generates the implementation plan
235
- - The plan will be created at `docs/computation-implementation-plan.json`
367
+ - This command analyzes `docs/{module}.computation-analysis.json` and automatically generates the implementation plan
368
+ - The plan will be created at `docs/{module}.computation-implementation-plan.json`
236
369
  - Computations are automatically ordered by dependencies (least to most dependent)
237
370
 
238
371
  - [ ] **Verify the generated file:**
239
- - Check that `docs/computation-implementation-plan.json` exists
372
+ - Check that `docs/{module}.computation-implementation-plan.json` exists
240
373
  - Open the file and confirm it contains:
241
374
  - Multiple phases organized by dependency complexity
242
375
  - Each computation with its decision, method, and dependencies
243
376
  - A logical progression from simple to complex computations
244
377
 
245
378
  **🔴 CRITICAL: If the command fails or the file is not generated:**
246
- 1. Check that `docs/computation-analysis.json` exists and is valid JSON
379
+ 1. Check that `docs/{module}.computation-analysis.json` exists and is valid JSON
247
380
  2. If issues persist, stop and wait for user commands
248
381
 
249
- **🛑 STOP: Computation implementation plan generated. Review `docs/computation-implementation-plan.json` and wait for user instructions before proceeding to Task 3.1.4.3.**
382
+ **🛑 STOP: Computation implementation plan generated. Review `docs/{module}.computation-implementation-plan.json` and wait for user instructions before proceeding to Task 3.1.4.3.**
250
383
 
251
- **✅ END Task 3.1.4.2: Update `docs/STATUS.json`:**
384
+ **✅ END Task 3.1.4.2: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
252
385
  ```json
253
386
  {
387
+ "module": "<keep existing value>",
254
388
  "currentTask": "Task 3.1.4.2",
255
389
  "completed": true
256
390
  }
@@ -264,12 +398,13 @@ git commit -m "feat: Task 3.1.4.2 - Generate computation implementation plan"
264
398
 
265
399
  #### Task 3.1.4.3: Progressive Implementation Loop
266
400
 
267
- **🔄 Update `docs/STATUS.json`:**
401
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
268
402
  ```json
269
403
  {
404
+ "module": "<keep existing value>",
270
405
  "currentTask": "Task 3.1.4.3",
271
406
  "completed": false,
272
- "completionCriteria": "All items in `docs/computation-implementation-plan.json` have `completed: true`"
407
+ "completionCriteria": "All items in `docs/{module}.computation-implementation-plan.json` have `completed: true`"
273
408
  }
274
409
  ```
275
410
 
@@ -277,13 +412,14 @@ git commit -m "feat: Task 3.1.4.2 - Generate computation implementation plan"
277
412
 
278
413
  This task has its own dedicated sub-agent that handles the progressive implementation of computations one by one.
279
414
 
280
- **🛑 STOP GATE: DO NOT proceed to Task 3.1.4.4 until ALL computations in `docs/computation-implementation-plan.json` are marked as complete with passing tests.**
415
+ **🛑 STOP GATE: DO NOT proceed to Task 3.1.4.4 until ALL computations in `docs/{module}.computation-implementation-plan.json` are marked as complete with passing tests.**
281
416
 
282
- ** CRETICA:L use the specialized sub-agent `computation-generation-handler` until ALL computations in `docs/computation-implementation-plan.json` are marked as complete with passing tests.**
417
+ ** CRITICAL: use the specialized sub-agent `computation-generation-handler` until ALL computations in `docs/{module}.computation-implementation-plan.json` are marked as complete with passing tests.**
283
418
 
284
- **✅ END Task 3.1.4.3: Update `docs/STATUS.json`:**
419
+ **✅ END Task 3.1.4.3: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
285
420
  ```json
286
421
  {
422
+ "module": "<keep existing value>",
287
423
  "currentTask": "Task 3.1.4.3",
288
424
  "completed": true
289
425
  }
@@ -297,22 +433,24 @@ git commit -m "feat: Task 3.1.4.3 - Complete progressive computation implementat
297
433
 
298
434
  #### Task 3.1.4.4: Completion Checklist
299
435
 
300
- **🔄 Update `docs/STATUS.json`:**
436
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
301
437
  ```json
302
438
  {
439
+ "module": "<keep existing value>",
303
440
  "currentTask": "Task 3.1.4.4",
304
441
  "completed": false
305
442
  }
306
443
  ```
307
- - [ ] All computations from `docs/computation-analysis.json` are implemented
444
+ - [ ] All computations from `docs/{module}.computation-analysis.json` are implemented
308
445
  - [ ] Each computation has at least one passing test
309
446
  - [ ] All type checks pass (`npm run check`)
310
- - [ ] All tests pass (`npm run test tests/basic.test.ts`)
447
+ - [ ] All tests pass (`npm run test tests/{module}.business.test.ts`)
311
448
 
312
449
 
313
- **✅ END Task 3.1: Update `docs/STATUS.json`:**
450
+ **✅ END Task 3.1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
314
451
  ```json
315
452
  {
453
+ "module": "<keep existing value>",
316
454
  "currentTask": "Task 3.1",
317
455
  "completed": true
318
456
  }
@@ -326,9 +464,10 @@ git commit -m "feat: Task 3.1 - Complete code generation and implementation"
326
464
 
327
465
  ## Task 3.2: Progressive Permission and Business Rules Implementation with Testing
328
466
 
329
- **🔄 Update `docs/STATUS.json`:**
467
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
330
468
  ```json
331
469
  {
470
+ "module": "<keep existing value>",
332
471
  "currentTask": "Task 3.2",
333
472
  "completed": false
334
473
  }
@@ -336,9 +475,10 @@ git commit -m "feat: Task 3.1 - Complete code generation and implementation"
336
475
 
337
476
  ### Task 3.2.0: Create Permission Test File
338
477
 
339
- **🔄 Update `docs/STATUS.json`:**
478
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
340
479
  ```json
341
480
  {
481
+ "module": "<keep existing value>",
342
482
  "currentTask": "Task 3.2.0",
343
483
  "completed": false
344
484
  }
@@ -346,16 +486,17 @@ git commit -m "feat: Task 3.1 - Complete code generation and implementation"
346
486
 
347
487
  **📋 Set up dedicated test file for permissions and business rules:**
348
488
 
349
- - [ ] Copy contents from `tests/permission.template.test.ts` to create `tests/permission.test.ts`
489
+ - [ ] Copy contents from `tests/permission.template.test.ts` to create `tests/{module}.permission.test.ts`
350
490
  - This template is specifically designed for permission and business rule testing
351
491
  - **DO NOT add any test cases yet** - we will add them progressively as we implement each rule
352
492
  - [ ] This will be your dedicated test file for all permission and business rule tests
353
- - [ ] Import your backend definitions: `import { entities, relations, interactions } from '../backend'`
493
+ - [ ] Import your backend definitions: `import { entities, relations, interactions } from '../backend/{module}'`
354
494
  - [ ] Verify the file structure includes the 'Permission and Business Rules' describe group
355
495
 
356
- **✅ END Task 3.2.0: Update `docs/STATUS.json`:**
496
+ **✅ END Task 3.2.0: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
357
497
  ```json
358
498
  {
499
+ "module": "<keep existing value>",
359
500
  "currentTask": "Task 3.2.0",
360
501
  "completed": true
361
502
  }
@@ -369,9 +510,10 @@ git commit -m "feat: Task 3.2.0 - Create permission test file"
369
510
 
370
511
  ### Task 3.2.1: Create Implementation Plan
371
512
 
372
- **🔄 Update `docs/STATUS.json`:**
513
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
373
514
  ```json
374
515
  {
516
+ "module": "<keep existing value>",
375
517
  "currentTask": "Task 3.2.1",
376
518
  "completed": false
377
519
  }
@@ -379,10 +521,9 @@ git commit -m "feat: Task 3.2.0 - Create permission test file"
379
521
 
380
522
  **📋 Create the Permission and Business Rules Implementation Plan:**
381
523
 
382
- - [ ] Create `docs/business-rules-and-permission-control-implementation-plan.json` based on:
383
- - `requirements/interactions-design.json`
384
- - `requirements/interaction-matrix.md` (permission requirements)
385
- - `requirements/test-cases.md` (business rule scenarios)
524
+ - [ ] Create `docs/{module}.business-rules-and-permission-control-implementation-plan.json` based on:
525
+ - `requirements/{module}.interactions-design.json`
526
+ - `requirements/{module}.test-cases.md` (business rule scenarios)
386
527
 
387
528
  - [ ] **Structure the plan with progressive phases:**
388
529
  ```json
@@ -456,9 +597,10 @@ git commit -m "feat: Task 3.2.0 - Create permission test file"
456
597
  - Phase 2: Simple payload validations
457
598
  - Phase 3: Complex rules
458
599
 
459
- **✅ END Task 3.2.1: Update `docs/STATUS.json`:**
600
+ **✅ END Task 3.2.1: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
460
601
  ```json
461
602
  {
603
+ "module": "<keep existing value>",
462
604
  "currentTask": "Task 3.2.1",
463
605
  "completed": true
464
606
  }
@@ -472,12 +614,13 @@ git commit -m "feat: Task 3.2.1 - Create permission and business rules implement
472
614
 
473
615
  ### Task 3.2.2: Progressive Implementation Loop
474
616
 
475
- **🔄 Update `docs/STATUS.json`:**
617
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
476
618
  ```json
477
619
  {
620
+ "module": "<keep existing value>",
478
621
  "currentTask": "Task 3.2.2",
479
622
  "completed": false,
480
- "completionCriteria": "All items in `docs/business-rules-and-permission-control-implementation-plan.json` have `completed: true`"
623
+ "completionCriteria": "All items in `docs/{module}.business-rules-and-permission-control-implementation-plan.json` have `completed: true`"
481
624
  }
482
625
  ```
483
626
 
@@ -485,11 +628,12 @@ git commit -m "feat: Task 3.2.1 - Create permission and business rules implement
485
628
 
486
629
  This task has its own dedicated sub-agent that handles the progressive implementation of permissions and business rules one by one.
487
630
 
488
- **🛑 STOP GATE: DO NOT proceed to Task 3.2.3 until ALL rules in `docs/business-rules-and-permission-control-implementation-plan.json` are marked as complete with passing tests.**
631
+ **🛑 STOP GATE: DO NOT proceed to Task 3.2.3 until ALL rules in `docs/{module}.business-rules-and-permission-control-implementation-plan.json` are marked as complete with passing tests.**
489
632
 
490
- **✅ END Task 3.2.2: Update `docs/STATUS.json`:**
633
+ **✅ END Task 3.2.2: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
491
634
  ```json
492
635
  {
636
+ "module": "<keep existing value>",
493
637
  "currentTask": "Task 3.2.2",
494
638
  "completed": true
495
639
  }
@@ -503,19 +647,20 @@ git commit -m "feat: Task 3.2.2 - Complete progressive permission and business r
503
647
 
504
648
  ### Task 3.2.3: Completion Checklist
505
649
 
506
- **🔄 Update `docs/STATUS.json`:**
650
+ **🔄 Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
507
651
  ```json
508
652
  {
653
+ "module": "<keep existing value>",
509
654
  "currentTask": "Task 3.2.3",
510
655
  "completed": false
511
656
  }
512
657
  ```
513
658
 
514
- - [ ] All permissions from `requirements/interactions-design.json` are implemented
659
+ - [ ] All permissions from `requirements/{module}.interactions-design.json` are implemented
515
660
  - [ ] All business rules from requirements are implemented
516
661
  - [ ] Each rule has comprehensive test coverage (success and failure cases)
517
662
  - [ ] All type checks pass (`npm run check`)
518
- - [ ] All permission tests pass (`npm run test tests/permission.test.ts`)
663
+ - [ ] All permission tests pass (`npm run test tests/{module}.permission.test.ts`)
519
664
  - [ ] Error scenarios are properly documented
520
665
 
521
666
  **Note on Error Messages:**
@@ -528,9 +673,10 @@ Since permissions and business rules are unified in the `conditions` API, the fr
528
673
  - Test both permission failures and business rule violations separately
529
674
  - Consider logging more detailed information within the condition's content function for debugging
530
675
 
531
- **✅ END Task 3.2.3: Update `docs/STATUS.json`:**
676
+ **✅ END Task 3.2.3: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
532
677
  ```json
533
678
  {
679
+ "module": "<keep existing value>",
534
680
  "currentTask": "Task 3.2.3",
535
681
  "completed": true
536
682
  }
@@ -542,17 +688,18 @@ git add .
542
688
  git commit -m "feat: Task 3.2.3 - Complete permission and business rules checklist"
543
689
  ```
544
690
 
545
- **✅ END Task 3.2: Update `docs/STATUS.json`:**
691
+ **✅ END Task 3.2: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
546
692
  ```json
547
693
  {
694
+ "module": "<keep existing value>",
548
695
  "currentTask": "Task 3.2",
549
696
  "completed": true,
550
697
  "completedItems": [
551
698
  "Permission test file created from template",
552
699
  "All permissions implemented with tests in permission.test.ts",
553
700
  "All business rules implemented with tests in permission.test.ts",
554
- "business-rules-and-permission-control-implementation-plan.json completed",
555
- "Both test suites passing (basic.test.ts and permission.test.ts)"
701
+ "{module}.business-rules-and-permission-control-implementation-plan.json completed",
702
+ "Both test suites passing (business.test.ts and permission.test.ts)"
556
703
  ]
557
704
  }
558
705
  ```
@@ -564,9 +711,10 @@ git commit -m "feat: Task 3.2 - Complete permission and business rules implement
564
711
  ```
565
712
 
566
713
 
567
- **✅ END Task 3: Update `docs/STATUS.json`:**
714
+ **✅ END Task 3: Update `docs/{module}.status.json` (keep existing `module` field unchanged):**
568
715
  ```json
569
716
  {
717
+ "module": "<keep existing value>",
570
718
  "currentTask": "Task 3",
571
719
  "completed": true,
572
720
  "completedItems": [
@@ -584,9 +732,10 @@ git add .
584
732
  git commit -m "feat: Task 3 - Complete code generation and progressive testing"
585
733
  ```
586
734
 
587
- **✅ PROJECT COMPLETE: Final update to `docs/STATUS.json`:**
735
+ **✅ PROJECT COMPLETE: Final update to `docs/{module}.status.json` (keep existing `module` field unchanged):**
588
736
  ```json
589
737
  {
738
+ "module": "<keep existing value>",
590
739
  "currentTask": "COMPLETE",
591
740
  "completed": true,
592
741
  "completedItems": [