@tgoodington/intuition 7.1.0 → 8.0.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.
@@ -1,371 +0,0 @@
1
- # Parallel Task Delegation
2
-
3
- ## Overview
4
-
5
- One of the most powerful capabilities in execution is delegating multiple independent tasks in parallel. When tasks don't depend on each other, running them simultaneously dramatically improves execution speed and efficiency.
6
-
7
- ## When to Parallelize
8
-
9
- **ALWAYS evaluate if tasks can run in parallel.** Delegate multiple tasks in a single message when:
10
-
11
- - **File Independence**: Tasks modify different files with no overlap
12
- - **Data Independence**: Tasks don't depend on each other's outputs
13
- - **Resource Independence**: Tasks don't compete for the same resources
14
- - **Order Irrelevance**: Execution order doesn't affect outcomes
15
-
16
- ## Benefits of Parallel Execution
17
-
18
- - **Speed**: Multiple agents work simultaneously instead of waiting in queue
19
- - **Efficiency**: Maximize throughput on multi-step plans
20
- - **User Experience**: Faster results mean happier users
21
- - **Resource Utilization**: Better use of available compute
22
-
23
- ## Requirements for Parallelization
24
-
25
- Before parallelizing, verify:
26
-
27
- 1. **No Data Dependencies**: Task B doesn't need Task A's output
28
- 2. **No File Conflicts**: Tasks won't edit the same files
29
- 3. **Clear Boundaries**: Each task has well-defined scope
30
- 4. **Independent Verification**: Each task can be verified separately
31
-
32
- ## Parallel Patterns (When to Use)
33
-
34
- ### Pattern 1: Multiple Code Writers (Different Files)
35
-
36
- When implementing features across different files:
37
-
38
- ```markdown
39
- Task 1: Code Writer - Implement User model (models/user.ts)
40
- Task 2: Code Writer - Implement Order model (models/order.ts)
41
- Task 3: Code Writer - Implement Product model (models/product.ts)
42
- ```
43
-
44
- **Why parallel?** Different files, no dependencies, all create models.
45
-
46
- **Verification:**
47
- - Each model can be tested independently
48
- - No file conflicts
49
- - All follow same patterns
50
-
51
- **When to Use:**
52
- - Creating multiple similar components
53
- - Adding models across different domains
54
- - Creating API endpoints that don't interact
55
-
56
- ### Pattern 2: Code + Documentation
57
-
58
- After a code change is complete, run testing and documentation in parallel:
59
-
60
- ```markdown
61
- Task 1: Test Runner - Run test suite and report results
62
- Task 2: Documentation - Update README with new API endpoints
63
- ```
64
-
65
- **Why parallel?** Documentation doesn't need test results; both reference same code.
66
-
67
- **Verification:**
68
- - Tests verify code correctness
69
- - Documentation can be updated from code
70
- - No ordering dependency
71
-
72
- **When to Use:**
73
- - Code is complete and stable
74
- - Tests can verify independently
75
- - Documentation doesn't depend on test results
76
-
77
- ### Pattern 3: Multiple Research Tasks
78
-
79
- Exploring different areas of unknown codebase:
80
-
81
- ```markdown
82
- Task 1: Research - Investigate authentication implementation
83
- Task 2: Research - Investigate database schema design
84
- Task 3: Research - Investigate API routing structure
85
- ```
86
-
87
- **Why parallel?** Each explores independent area; results combine for full picture.
88
-
89
- **Verification:**
90
- - Each research task is independent
91
- - Results combine to form complete picture
92
- - No dependencies between explorations
93
-
94
- **When to Use:**
95
- - Understanding multiple independent modules
96
- - Gathering information on different topics
97
- - Investigating unrelated architectural concerns
98
-
99
- ### Pattern 4: Multi-Component Feature
100
-
101
- Implementing a feature with clear component boundaries:
102
-
103
- ```markdown
104
- Task 1: Code Writer - Add frontend form component (components/UserForm.tsx)
105
- Task 2: Code Writer - Add backend API endpoint (routes/users.ts)
106
- Task 3: Code Writer - Add database migration (migrations/001_add_users.sql)
107
- ```
108
-
109
- **Why parallel?** If the interface is pre-defined, each can be implemented independently.
110
-
111
- **Key Requirement:** Interface/contract must be pre-defined (from plan)
112
-
113
- **Verification:**
114
- - Frontend and backend contract is clear
115
- - Database schema is specified
116
- - Integration testing verifies they work together
117
-
118
- **When to Use:**
119
- - Feature architecture is well-defined
120
- - Contracts/interfaces are clear
121
- - Components can be implemented independently
122
-
123
- ### Pattern 5: Code Review + Security Scan
124
-
125
- After code implementation completes, run multiple verification tasks:
126
-
127
- ```markdown
128
- Task 1: Code Reviewer - Review code quality and style
129
- Task 2: Security Expert - Scan for vulnerabilities
130
- ```
131
-
132
- **Why parallel?** Code review and security scan are independent evaluations.
133
-
134
- **Verification:**
135
- - Code review checks style and quality
136
- - Security scan checks for vulnerabilities
137
- - Both evaluate same code, no conflicts
138
-
139
- **When to Use:**
140
- - Code implementation is complete
141
- - Both reviews use same source
142
- - Results don't affect each other
143
-
144
- ## Anti-Patterns (When NOT to Parallelize)
145
-
146
- ### Anti-Pattern 1: Sequential Dependencies
147
-
148
- ```markdown
149
- DON'T:
150
- Task 1: Code Writer - Implement feature X
151
- Task 2: Test Runner - Test feature X // Needs Task 1 to complete!
152
- ```
153
-
154
- **Why not?** Task 2 requires Task 1's output. Run sequentially.
155
-
156
- **Correct approach:**
157
- ```markdown
158
- Task 1: Code Writer - Implement feature X
159
- [Wait for completion]
160
- Task 2: Test Runner - Test feature X
161
- ```
162
-
163
- ### Anti-Pattern 2: File Conflicts
164
-
165
- ```markdown
166
- DON'T:
167
- Task 1: Code Writer - Add function to utils.ts
168
- Task 2: Code Writer - Refactor utils.ts // Same file!
169
- ```
170
-
171
- **Why not?** Both modify the same file. Merge conflicts likely.
172
-
173
- **Correct approach:** Combine into single task or do sequentially with file-level locking
174
-
175
- ### Anti-Pattern 3: Verification Before Implementation
176
-
177
- ```markdown
178
- DON'T:
179
- Task 1: Security Expert - Scan for vulnerabilities
180
- Task 2: Code Writer - Implement authentication // Should scan AFTER
181
- ```
182
-
183
- **Why not?** Security should verify code that exists, not future code.
184
-
185
- **Correct approach:**
186
- ```markdown
187
- Task 1: Code Writer - Implement authentication
188
- [Wait for completion]
189
- Task 2: Security Expert - Scan for vulnerabilities
190
- ```
191
-
192
- ### Anti-Pattern 4: Dependent Research
193
-
194
- ```markdown
195
- DON'T:
196
- Task 1: Research - Find all authentication files
197
- Task 2: Code Writer - Update authentication // Needs findings first
198
- ```
199
-
200
- **Why not?** Code Writer needs research results to know what to update.
201
-
202
- **Correct approach:**
203
- ```markdown
204
- Task 1: Research - Find all authentication files
205
- [Wait for findings]
206
- Task 2: Code Writer - Update authentication (based on findings)
207
- ```
208
-
209
- ### Anti-Pattern 5: Overloading with Parallel Tasks
210
-
211
- ```markdown
212
- DON'T:
213
- Task 1: Code Writer - Implement X
214
- Task 2: Code Writer - Implement Y
215
- Task 3: Code Writer - Implement Z
216
- Task 4: Code Writer - Implement W
217
- Task 5: Test Runner - Test all of above
218
- Task 6: Code Reviewer - Review all of above
219
- Task 7: Security Expert - Scan all of above
220
- // 7 tasks in parallel = context overload
221
- ```
222
-
223
- **Why not?** Too many parallel tasks strain context and coordination.
224
-
225
- **Better approach:** Limit to 3-4 parallel implementation tasks, then verify in parallel batch
226
-
227
- ## How to Delegate in Parallel
228
-
229
- **CRITICAL:** Use a **single message** with multiple Task tool calls. Do NOT send tasks one at a time.
230
-
231
- ### Correct Approach
232
-
233
- ```
234
- I'll delegate these three model implementations in parallel:
235
-
236
- [Task tool call 1: Code Writer for User model]
237
- [Task tool call 2: Code Writer for Product model]
238
- [Task tool call 3: Code Writer for Order model]
239
- ```
240
-
241
- All three Code Writer agents work simultaneously on different files.
242
-
243
- ### Incorrect Approach
244
-
245
- ```
246
- First task: Code Writer for User model
247
- [Wait for completion]
248
-
249
- Next task: Code Writer for Product model
250
- [Wait for completion]
251
-
252
- Final task: Code Writer for Order model
253
- ```
254
-
255
- This is sequential, defeats parallelization benefits.
256
-
257
- ## Monitoring Parallel Tasks
258
-
259
- After delegating parallel tasks:
260
-
261
- 1. **Wait for all to complete** - You'll receive results from each task
262
- 2. **Review each output** - Verify acceptance criteria for all tasks
263
- 3. **Check for conflicts** - Ensure no unexpected file overlaps occurred
264
- 4. **Aggregate results** - Combine outputs into coherent execution report
265
-
266
- ### Handling Partial Failures
267
-
268
- If one task fails while others succeed:
269
-
270
- 1. **Accept successful tasks** - Keep passing work
271
- 2. **Retry failed task** - With additional context
272
- 3. **Don't re-run successful tasks** - Unless they depend on the failed one
273
-
274
- **Example:**
275
- ```markdown
276
- Results from parallel execution:
277
-
278
- Task 1 (User model): SUCCESS
279
- Task 2 (Product model): SUCCESS
280
- Task 3 (Order model): FAILED - Name conflict with existing model
281
-
282
- Action: Retry Task 3 with different name or investigation of existing Order model
283
- ```
284
-
285
- ## Decision Framework
286
-
287
- Before delegating, ask yourself:
288
-
289
- ```
290
- Can these tasks run in parallel?
291
- ├─ Do they modify different files?
292
- │ ├─ Yes → Check next question
293
- │ └─ No → Run sequentially
294
- ├─ Does Task B need Task A's output?
295
- │ ├─ Yes → Run sequentially
296
- │ └─ No → Check next question
297
- ├─ Can they be verified independently?
298
- │ ├─ Yes → PARALLELIZE!
299
- │ └─ No → Run sequentially
300
- ```
301
-
302
- **Default mindset:** Look for parallelization opportunities. Sequential execution should be the exception, not the rule.
303
-
304
- ## Parallel Execution Examples
305
-
306
- ### Example 1: Create Multiple Models (3 in Parallel)
307
-
308
- ```markdown
309
- I'll implement the three core models in parallel - User, Product, and Order.
310
- Each is independent, follows the same pattern, and doesn't depend on others.
311
-
312
- [Task 1: Code Writer - User model]
313
- [Task 2: Code Writer - Product model]
314
- [Task 3: Code Writer - Order model]
315
-
316
- After all three complete, I'll run tests in parallel:
317
-
318
- [Task 4: Test Runner - Test User model]
319
- [Task 5: Test Runner - Test Product model]
320
- [Task 6: Test Runner - Test Order model]
321
- ```
322
-
323
- ### Example 2: Investigation + Implementation
324
-
325
- ```markdown
326
- First, I'll research the current authentication and database structure in parallel:
327
-
328
- [Task 1: Research - Current authentication implementation]
329
- [Task 2: Research - Database user schema]
330
-
331
- After gathering information, I'll implement in parallel:
332
-
333
- [Task 3: Code Writer - Add OAuth provider integration]
334
- [Task 4: Code Writer - Add user profile fields]
335
- ```
336
-
337
- ### Example 3: Implementation + Verification
338
-
339
- ```markdown
340
- Code Writer completes User model implementation.
341
-
342
- Now I'll verify in parallel:
343
-
344
- [Task 1: Code Reviewer - Review User model code quality]
345
- [Task 2: Test Runner - Run User model tests]
346
- [Task 3: Security Expert - Scan User model for vulnerabilities]
347
-
348
- All three verification tasks happen simultaneously.
349
- ```
350
-
351
- ## Scalability Considerations
352
-
353
- ### Small Parallel Batch (1-3 tasks)
354
- - Very safe, low coordination overhead
355
- - Fast execution
356
- - Easy to verify
357
- - Recommended default
358
-
359
- ### Medium Parallel Batch (4-5 tasks)
360
- - Good parallelization benefit
361
- - Manageable coordination
362
- - Requires clear task boundaries
363
- - Monitor for file conflicts
364
-
365
- ### Large Parallel Batch (6+ tasks)
366
- - Significant speedup
367
- - Higher coordination complexity
368
- - Risk of conflicts or confusion
369
- - Reserve for well-understood work
370
-
371
- **Recommendation:** Start with 2-3 parallel tasks. Increase if proven safe.
@@ -1,327 +0,0 @@
1
- # Task Delegation Format
2
-
3
- ## Overview
4
-
5
- When delegating work to sub-agents, use this format to ensure complete context and clear expectations.
6
-
7
- ## Complete Task Delegation Format
8
-
9
- ```markdown
10
- ## Task Assignment
11
-
12
- **Agent:** [agent-name]
13
- **Priority:** High/Medium/Low
14
-
15
- **Objective:**
16
- [Clear description of what to accomplish]
17
-
18
- **Context:**
19
- [Relevant information from the plan]
20
-
21
- **Acceptance Criteria:**
22
- - [ ] Criterion 1
23
- - [ ] Criterion 2
24
-
25
- **Files:** [Specific files to work with, if known]
26
-
27
- **Constraints:**
28
- - [Any limitations or requirements]
29
-
30
- **On Failure:**
31
- - Retry: [yes/no, conditions]
32
- - Fallback: [alternative approach]
33
- ```
34
-
35
- ## Section Guidelines
36
-
37
- ### Agent
38
- - Name of the sub-agent receiving the task
39
- - Options: Code Writer, Test Runner, Documentation, Research, Code Reviewer, Security Expert
40
-
41
- ### Priority
42
- - **High**: Critical path, blocks other work, must complete before proceeding
43
- - **Medium**: Important but some flexibility on timing
44
- - **Low**: Nice to have, can defer if needed
45
-
46
- ### Objective
47
- - **What:** Clear description of what to accomplish
48
- - **Why:** Why this task matters to the overall plan
49
- - **Success:** What does success look like?
50
-
51
- **Example:**
52
- ```
53
- Implement user authentication module
54
-
55
- This module is the foundation for access control. Users must be able to:
56
- 1. Register with email and password
57
- 2. Log in with credentials
58
- 3. Receive JWT token for authenticated requests
59
- 4. Access protected resources with token
60
-
61
- Success = Users can complete registration/login flow and access protected endpoints
62
- ```
63
-
64
- ### Context
65
- - **From the Plan:** Relevant background information
66
- - **Dependencies:** What other work relates to this?
67
- - **Constraints:** What limitations apply?
68
- - **Background:** What should the agent know about this feature?
69
-
70
- **Example:**
71
- ```
72
- This authentication module supports the user management system. We're using:
73
- - Node.js/Express for the backend
74
- - PostgreSQL for user storage
75
- - JWT for session management
76
-
77
- The user registration API endpoint should be at POST /api/auth/register
78
- Login endpoint at POST /api/auth/login
79
-
80
- This task is Task 1 in the plan; other tasks depend on completion.
81
- ```
82
-
83
- ### Acceptance Criteria
84
- - Specific, measurable outcomes
85
- - Each criterion should be verifiable
86
- - Include both functional and quality criteria
87
- - Use checkbox format for tracking
88
-
89
- **Example:**
90
- ```
91
- - [ ] User model created with email and password fields
92
- - [ ] Email validation implemented
93
- - [ ] Password hashed using bcrypt
94
- - [ ] Login endpoint accepts email/password, returns JWT
95
- - [ ] Registration endpoint creates new user and returns JWT
96
- - [ ] Invalid credentials rejected with appropriate error
97
- - [ ] Code follows project style guide
98
- - [ ] Unit tests written and passing
99
- ```
100
-
101
- ### Files
102
- - Specific files to create or modify
103
- - Include relative paths from project root
104
- - Be explicit about new files vs. modifications
105
-
106
- **Example:**
107
- ```
108
- Files to create:
109
- - src/auth/auth.service.ts (new)
110
- - src/auth/auth.controller.ts (new)
111
- - src/auth/jwt.strategy.ts (new)
112
- - src/auth/auth.module.ts (new)
113
-
114
- Files to modify:
115
- - src/app.module.ts (import AuthModule)
116
- - src/main.ts (if middleware configuration needed)
117
- ```
118
-
119
- ### Constraints
120
- - **Limitations:** What can't be done?
121
- - **Requirements:** Must-follow rules?
122
- - **Standards:** Code style, patterns to follow?
123
- - **Integrations:** What systems must this work with?
124
-
125
- **Example:**
126
- ```
127
- - Must use bcrypt for password hashing (security requirement)
128
- - Must follow existing project code style and conventions
129
- - Must use TypeScript, no JavaScript
130
- - Must be compatible with existing Express middleware
131
- - Password must be at least 8 characters
132
- - Must support both email/password and OAuth in future
133
- ```
134
-
135
- ### On Failure
136
-
137
- #### Retry Strategy
138
- - **Yes**: Retry with what conditions/changes?
139
- - **No**: Don't retry, escalate immediately
140
-
141
- **When to retry:**
142
- - Transient failures (network issues, temporary service outage)
143
- - Ambiguous requirements (request clarification and retry)
144
- - Minor issues (syntax errors, easy fixes)
145
-
146
- **When not to retry:**
147
- - Architectural issues (design doesn't fit)
148
- - Scope creep (task has become unclear)
149
- - Security concerns (something feels unsafe)
150
-
151
- **Example:**
152
- ```
153
- - Retry: Yes, if tests fail due to environment issues. Provide more detailed instructions and retry.
154
- - Retry: No, if architecture doesn't support the approach. Escalate for design review.
155
- ```
156
-
157
- #### Fallback Options
158
- - **Decompose:** Break task into smaller pieces
159
- - **Research:** Gather more information first
160
- - **Escalate:** Ask Architect for guidance
161
- - **Alternative Approach:** Different way to accomplish goal
162
-
163
- **Example:**
164
- ```
165
- Fallback strategy:
166
- 1. If JWT approach has issues: Use session-based authentication instead
167
- 2. If performance is inadequate: Optimize queries and caching
168
- 3. If complexity exceeds expectations: Break into smaller tasks
169
- ```
170
-
171
- ## Delegation Examples
172
-
173
- ### Example 1: Code Writer - Feature Implementation
174
-
175
- ```markdown
176
- ## Task Assignment
177
-
178
- **Agent:** Code Writer
179
- **Priority:** High
180
-
181
- **Objective:**
182
- Implement the authentication module providing user registration and login functionality.
183
- This is the foundation for user access control and enables all subsequent user-related features.
184
-
185
- **Context:**
186
- Plan: User Authentication System
187
- Task: Create authentication service with JWT support
188
-
189
- Current project uses:
190
- - Node.js/Express
191
- - PostgreSQL
192
- - TypeScript
193
- - JWT for sessions
194
-
195
- **Acceptance Criteria:**
196
- - [ ] User model with email and password fields
197
- - [ ] Email validation (valid format, not already registered)
198
- - [ ] Password hashing with bcrypt (salt rounds: 10)
199
- - [ ] POST /api/auth/register - creates user, returns JWT
200
- - [ ] POST /api/auth/login - validates credentials, returns JWT
201
- - [ ] Invalid credentials return 401 with descriptive message
202
- - [ ] Password constraints enforced (min 8 chars, complexity rules)
203
- - [ ] Unit tests covering happy path and error cases
204
- - [ ] Code follows project TypeScript conventions
205
- - [ ] Error handling is comprehensive
206
-
207
- **Files:**
208
- Create:
209
- - src/auth/auth.service.ts
210
- - src/auth/auth.controller.ts
211
- - src/auth/jwt.strategy.ts
212
- - src/auth/auth.module.ts
213
- - src/auth/__tests__/auth.service.spec.ts
214
-
215
- Modify:
216
- - src/app.module.ts (import AuthModule)
217
-
218
- **Constraints:**
219
- - Must use bcrypt for password hashing
220
- - Must follow NestJS patterns (already in project)
221
- - Must be compatible with PostgreSQL
222
- - Must work with existing Express middleware
223
-
224
- **On Failure:**
225
- - Retry: Yes, if tests fail due to database setup. Provide database initialization details and retry.
226
- - Retry: No, if architecture conflicts with project design. Escalate to Architect.
227
- - Fallback: If complexity exceeds timeline, use simpler session-based auth instead
228
- ```
229
-
230
- ### Example 2: Test Runner - Verification
231
-
232
- ```markdown
233
- ## Task Assignment
234
-
235
- **Agent:** Test Runner
236
- **Priority:** High
237
-
238
- **Objective:**
239
- Run complete test suite to verify authentication implementation and ensure no regressions.
240
- All tests must pass before code review.
241
-
242
- **Context:**
243
- Authentication module has been implemented in latest commit.
244
- Need to verify all unit tests pass and integration tests work.
245
-
246
- **Acceptance Criteria:**
247
- - [ ] All unit tests pass (auth.service.spec.ts)
248
- - [ ] All integration tests pass (auth.controller.spec.ts)
249
- - [ ] Test coverage reported
250
- - [ ] No failing tests in full project test suite (regression check)
251
- - [ ] Performance acceptable (tests complete in <30 seconds)
252
-
253
- **Files:**
254
- Test files:
255
- - src/auth/__tests__/auth.service.spec.ts
256
- - src/auth/__tests__/auth.controller.spec.ts
257
- - Full suite: npm test
258
-
259
- **Constraints:**
260
- - Must use existing test framework (Jest)
261
- - Database must be seeded for integration tests
262
- - Use test database, not production
263
-
264
- **On Failure:**
265
- - Retry: Yes, with additional debugging output if tests fail intermittently
266
- - Fallback: If environment issue, run tests individually to identify failure
267
- ```
268
-
269
- ### Example 3: Security Expert - Vulnerability Scan
270
-
271
- ```markdown
272
- ## Task Assignment
273
-
274
- **Agent:** Security Expert
275
- **Priority:** High
276
-
277
- **Objective:**
278
- Scan authentication module for security vulnerabilities and best practice violations.
279
- MANDATORY before any code is merged. Must identify and report any issues.
280
-
281
- **Context:**
282
- Authentication module implementation complete at /src/auth/
283
- Must verify no security vulnerabilities before accepting code.
284
-
285
- **Acceptance Criteria:**
286
- - [ ] No hardcoded secrets or credentials in code
287
- - [ ] No sensitive data (passwords, tokens) in logs
288
- - [ ] Password hashing uses secure algorithm (bcrypt verified)
289
- - [ ] JWT implementation follows security best practices
290
- - [ ] Input validation prevents injection attacks
291
- - [ ] No exposure of internal system information in errors
292
- - [ ] Database queries use parameterized statements
293
- - [ ] Security headers properly configured
294
- - [ ] Rate limiting suitable for auth endpoints
295
- - [ ] Full report provided with findings and recommendations
296
-
297
- **Files:**
298
- Scan:
299
- - src/auth/ (entire authentication module)
300
- - src/config/ (configuration files)
301
- - .env (environment configuration - verify no hardcoded secrets)
302
-
303
- **Constraints:**
304
- - Must follow OWASP security guidelines
305
- - Must check for common auth vulnerabilities (brute force, timing attacks, etc.)
306
- - Must verify JWT secret is sufficiently random
307
-
308
- **On Failure:**
309
- - Retry: Yes, after addressing identified issues. Re-run scan to verify fixes.
310
- - Escalate: If critical vulnerabilities found, escalate to Architect before proceeding
311
- ```
312
-
313
- ## Key Principles for Effective Delegation
314
-
315
- 1. **Be Specific**: Avoid vague objectives. State exactly what should be done.
316
-
317
- 2. **Provide Context**: Agent needs to understand why this task matters.
318
-
319
- 3. **Clear Success Criteria**: Agent knows exactly when task is complete.
320
-
321
- 4. **Realistic Constraints**: State limitations so agent can plan accordingly.
322
-
323
- 5. **Failure Handling**: Agent knows what to do if problems arise.
324
-
325
- 6. **File Specificity**: Exact paths prevent confusion and errors.
326
-
327
- 7. **One Task at a Time**: Each delegation has clear, singular focus.