autodev-cli 1.4.93 → 1.4.94
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/media/profile/00-identity.md +35 -0
- package/media/profile/01-learning.md +23 -0
- package/media/profile/02-memory-mcp.md +49 -0
- package/media/profile/03-living-docs.md +18 -0
- package/media/profile/04-skill-files.md +9 -0
- package/media/profile/05-skill-creation.md +18 -0
- package/media/profile/06-core-rules.md +58 -0
- package/media/profile/07-core-loop.md +31 -0
- package/media/profile/08-thinking.md +30 -0
- package/media/profile/09-parallel-panel.md +29 -0
- package/media/profile/10-codebase-verification.md +19 -0
- package/media/profile/11-git-debug-security.md +16 -0
- package/media/profile/12-todo-format.md +20 -0
- package/media/profile/13-workflow-principles.md +17 -0
- package/media/profile/14-contracts.md +16 -0
- package/media/profile/15-soul.md +12 -0
- package/media/profile/16-journal.md +38 -0
- package/media/profile/17-issue-tracking.md +19 -0
- package/media/profile/18-knowledgebase.md +13 -0
- package/media/profile/19-subagent-context-management.md +510 -0
- package/media/profile/20-project-graph.md +56 -0
- package/out/commands/mcpOperate.js +177 -1
- package/out/commands/mcpOperate.js.map +1 -1
- package/out/core/settingsLoader.d.ts +4 -1
- package/out/core/settingsLoader.js.map +1 -1
- package/out/graphStore.d.ts +153 -0
- package/out/graphStore.js +412 -0
- package/out/graphStore.js.map +1 -0
- package/out/mcpInstallCheck.d.ts +2 -1
- package/out/mcpInstallCheck.js.map +1 -1
- package/out/profileBuilder.js +26 -1
- package/out/profileBuilder.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Subagent Context Management"
|
|
3
|
+
description: "When and how to spawn subagents; how to maintain context during deep tasks; ensuring subagents get proper briefs"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subagent Context Management
|
|
7
|
+
|
|
8
|
+
## Critical Principle: You Own Context
|
|
9
|
+
|
|
10
|
+
**YOU (the Orchestrator) manage your own context.** Subagents are NOT for:
|
|
11
|
+
- Compacting your context (they compact theirs, not yours = infinite loop)
|
|
12
|
+
- Figuring out what to do next (you decide, then hand off)
|
|
13
|
+
- Running commands (tests, lints, builds)
|
|
14
|
+
- Reading files or parsing output
|
|
15
|
+
|
|
16
|
+
**Subagents ARE for:**
|
|
17
|
+
- Scoped implementation work with clean context
|
|
18
|
+
- Complex creative tasks that benefit from fresh context
|
|
19
|
+
- Parallel specialist work (Code, QA, Reviewer)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## When to Spawn a Subagent: Decision Tree
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
27
|
+
│ IS THE TASK... │
|
|
28
|
+
└─────────────────────────────────────────────────────────────┘
|
|
29
|
+
│
|
|
30
|
+
▼
|
|
31
|
+
┌────────────────────────────────────┐
|
|
32
|
+
│ A shell command that returns text? │ → YES → YOU RUN IT (no subagent)
|
|
33
|
+
└────────────────────────────────────┘
|
|
34
|
+
│ NO
|
|
35
|
+
▼
|
|
36
|
+
┌────────────────────────────────────┐
|
|
37
|
+
│ Reading/parsing files or output? │ → YES → YOU DO IT (no subagent)
|
|
38
|
+
└────────────────────────────────────┘
|
|
39
|
+
│ NO
|
|
40
|
+
▼
|
|
41
|
+
┌────────────────────────────────────┐
|
|
42
|
+
│ A judgment call or decision? │ → YES → YOU DECIDE (no subagent)
|
|
43
|
+
└────────────────────────────────────┘
|
|
44
|
+
│ NO
|
|
45
|
+
▼
|
|
46
|
+
┌────────────────────────────────────┐
|
|
47
|
+
│ "Manage my context" or "compact"? │ → YES → YOU HANDLE (never subagent!)
|
|
48
|
+
└────────────────────────────────────┘
|
|
49
|
+
│ NO
|
|
50
|
+
▼
|
|
51
|
+
┌────────────────────────────────────┐
|
|
52
|
+
│ Implementation (editing files)? │ → YES → Spawn Code Agent
|
|
53
|
+
└────────────────────────────────────┘
|
|
54
|
+
│ NO
|
|
55
|
+
▼
|
|
56
|
+
┌────────────────────────────────────┐
|
|
57
|
+
│ Writing new test files? │ → YES → Spawn QA Agent
|
|
58
|
+
└────────────────────────────────────┘
|
|
59
|
+
│ NO
|
|
60
|
+
▼
|
|
61
|
+
┌────────────────────────────────────┐
|
|
62
|
+
│ Reviewing code/diff? │ → YES → Spawn Reviewer Agent
|
|
63
|
+
└────────────────────────────────────┘
|
|
64
|
+
│ NO
|
|
65
|
+
▼
|
|
66
|
+
┌────────────────────────────────────┐
|
|
67
|
+
│ Architectural design? │ → YES → Spawn Architect Agent
|
|
68
|
+
└────────────────────────────────────┘
|
|
69
|
+
│ NO
|
|
70
|
+
▼
|
|
71
|
+
┌──────────────────────────────────────────────────────────┐
|
|
72
|
+
│ Deep multi-step implementation requiring fresh context? │
|
|
73
|
+
│ (your context is unwieldy/circular) │ → YES → See "Context Handoff" below
|
|
74
|
+
└──────────────────────────────────────────────────────────┘
|
|
75
|
+
│ NO
|
|
76
|
+
▼
|
|
77
|
+
[YOU DO IT DIRECTLY]
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Context Handoff: When Your Context Is Unwieldy
|
|
83
|
+
|
|
84
|
+
### Signs You Need a Context Handoff
|
|
85
|
+
|
|
86
|
+
- ✅ You've been working on the same task for 20+ exchanges
|
|
87
|
+
- ✅ You're going in circles (repeating same analysis)
|
|
88
|
+
- ✅ Your context is full of irrelevant exploration from earlier
|
|
89
|
+
- ✅ You need to implement a complex multi-file change
|
|
90
|
+
- ✅ You've made the key decisions and need clean context to execute
|
|
91
|
+
|
|
92
|
+
### Signs You DON'T Need a Context Handoff
|
|
93
|
+
|
|
94
|
+
- ❌ You just need to run a test (`npm test` → run it yourself)
|
|
95
|
+
- ❌ You need to decide what to do next (you decide, don't delegate)
|
|
96
|
+
- ❌ You want to "compact" your context (manage it yourself)
|
|
97
|
+
- ❌ The task is 1-3 simple file edits (do it yourself or use Code Agent)
|
|
98
|
+
- ❌ You haven't decided on the approach yet (decide first, then hand off)
|
|
99
|
+
|
|
100
|
+
### How to Do a Context Handoff
|
|
101
|
+
|
|
102
|
+
**BEFORE spawning subagent:**
|
|
103
|
+
|
|
104
|
+
1. **Update CONTEXT.md** (see template below) with:
|
|
105
|
+
- Main task goal
|
|
106
|
+
- Key decisions made
|
|
107
|
+
- Files/modules involved
|
|
108
|
+
- Current status
|
|
109
|
+
- What remains
|
|
110
|
+
|
|
111
|
+
2. **Decide the EXACT next action** — never hand off "figure out what to do"
|
|
112
|
+
|
|
113
|
+
3. **Write a detailed subagent brief** (see "Briefing Template" below)
|
|
114
|
+
|
|
115
|
+
4. **Spawn subagent with scoped task** — not "do everything" but "implement X using Y"
|
|
116
|
+
|
|
117
|
+
**AFTER subagent returns:**
|
|
118
|
+
|
|
119
|
+
1. **Update CONTEXT.md** with what was completed
|
|
120
|
+
2. **Verify the result yourself** (run tests, check diffs)
|
|
121
|
+
3. **Continue to next step** or mark task [x]
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## CONTEXT.md Template
|
|
126
|
+
|
|
127
|
+
Create `CONTEXT.md` in your workspace root when starting complex multi-step tasks:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
# CONTEXT.md — Main Task Tracking
|
|
131
|
+
|
|
132
|
+
> **Purpose:** Keep track of the main task goal and prevent getting lost in deep subtasks.
|
|
133
|
+
> **Update:** After every major decision, subagent spawn, or context shift.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Main Task
|
|
138
|
+
|
|
139
|
+
**Goal:** [One-sentence description of the main task]
|
|
140
|
+
|
|
141
|
+
**Status:** [Not Started / In Progress / Blocked / Completed]
|
|
142
|
+
|
|
143
|
+
**TODO.md Task Line:**
|
|
144
|
+
```
|
|
145
|
+
- [~] feat: implement user authentication system
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Key Decisions Made
|
|
151
|
+
|
|
152
|
+
1. **[Date/Time]** Decision: [What was decided]
|
|
153
|
+
- Reasoning: [Why this choice]
|
|
154
|
+
- Alternative considered: [What was rejected and why]
|
|
155
|
+
|
|
156
|
+
2. **[Date/Time]** Decision: ...
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Architecture/Approach
|
|
161
|
+
|
|
162
|
+
[High-level description of the chosen approach]
|
|
163
|
+
|
|
164
|
+
**Files/Modules Involved:**
|
|
165
|
+
- `src/auth/login.ts` — handles login flow
|
|
166
|
+
- `src/auth/session.ts` — manages session state
|
|
167
|
+
- `src/api/auth-routes.ts` — API endpoints
|
|
168
|
+
|
|
169
|
+
**Key Patterns/Conventions:**
|
|
170
|
+
- Using JWT for tokens
|
|
171
|
+
- Sessions stored in Redis
|
|
172
|
+
- Following existing error handling pattern from `src/errors/`
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Progress Tracker
|
|
177
|
+
|
|
178
|
+
### Completed
|
|
179
|
+
- [x] 2026-05-25 Researched existing auth patterns in codebase
|
|
180
|
+
- [x] 2026-05-25 Decided on JWT + Redis approach
|
|
181
|
+
- [x] 2026-05-25 Spawned Code Agent to implement login.ts
|
|
182
|
+
|
|
183
|
+
### In Progress
|
|
184
|
+
- [~] Verify login.ts implementation
|
|
185
|
+
- [~] Run integration tests
|
|
186
|
+
|
|
187
|
+
### Remaining
|
|
188
|
+
- [ ] Implement session.ts
|
|
189
|
+
- [ ] Implement auth-routes.ts
|
|
190
|
+
- [ ] Add integration tests
|
|
191
|
+
- [ ] Update documentation
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Subagent Spawns
|
|
196
|
+
|
|
197
|
+
### Spawn 1: Code Agent — Implement login.ts
|
|
198
|
+
**When:** 2026-05-25 14:30
|
|
199
|
+
**Brief:** [See full brief below]
|
|
200
|
+
**Result:** Implemented login.ts with JWT generation
|
|
201
|
+
**Verified:** ✅ Tests pass, linter clean
|
|
202
|
+
|
|
203
|
+
### Spawn 2: QA Agent — Write integration tests
|
|
204
|
+
**When:** 2026-05-25 15:00
|
|
205
|
+
**Brief:** [See full brief below]
|
|
206
|
+
**Result:** [Pending]
|
|
207
|
+
**Verified:** [Pending]
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Blockers / Issues
|
|
212
|
+
|
|
213
|
+
- **[Date]** Blocker: [Description]
|
|
214
|
+
- Status: [Open / Resolved]
|
|
215
|
+
- Resolution: [How it was resolved]
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Context Checkpoints
|
|
220
|
+
|
|
221
|
+
Use these checkpoints to verify you're still on track:
|
|
222
|
+
|
|
223
|
+
1. **Can you state the main goal in one sentence?** [Yes/No - if no, re-read above]
|
|
224
|
+
2. **Do you know the next concrete action?** [Yes/No - if no, review Progress Tracker]
|
|
225
|
+
3. **Have you strayed into unrelated work?** [Yes/No - if yes, refocus on main goal]
|
|
226
|
+
4. **Is there a clearer path than current approach?** [Yes/No - if yes, update Decisions]
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Notes / Learnings
|
|
231
|
+
|
|
232
|
+
[Add any important discoveries, gotchas, or learnings that should be remembered]
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Subagent Briefing Template
|
|
239
|
+
|
|
240
|
+
When spawning a subagent for a complex task, use this template:
|
|
241
|
+
|
|
242
|
+
```markdown
|
|
243
|
+
# Subagent Brief: [Agent Type] — [Task Summary]
|
|
244
|
+
|
|
245
|
+
## MISSION (one sentence)
|
|
246
|
+
[Exactly what this subagent must accomplish]
|
|
247
|
+
|
|
248
|
+
## CONTEXT
|
|
249
|
+
[Only the relevant context — not your entire history]
|
|
250
|
+
|
|
251
|
+
**Main Task:** [Link back to the overall goal]
|
|
252
|
+
|
|
253
|
+
**Decisions Already Made:**
|
|
254
|
+
- [Key decision 1]
|
|
255
|
+
- [Key decision 2]
|
|
256
|
+
|
|
257
|
+
**Files/Modules Relevant to This Subtask:**
|
|
258
|
+
- `path/to/file.ts` — [why relevant]
|
|
259
|
+
- `path/to/test.ts` — [why relevant]
|
|
260
|
+
|
|
261
|
+
## WHAT TO IMPLEMENT
|
|
262
|
+
|
|
263
|
+
**Goal:** [Specific implementation goal]
|
|
264
|
+
|
|
265
|
+
**Approach:** [The exact approach to use — no ambiguity]
|
|
266
|
+
- Step 1: [Concrete action]
|
|
267
|
+
- Step 2: [Concrete action]
|
|
268
|
+
- Step 3: [Concrete action]
|
|
269
|
+
|
|
270
|
+
**Files to Edit:**
|
|
271
|
+
1. `path/to/file1.ts`
|
|
272
|
+
- Add: [specific functionality]
|
|
273
|
+
- Modify: [specific section]
|
|
274
|
+
- Use pattern: [reference to existing pattern]
|
|
275
|
+
|
|
276
|
+
2. `path/to/file2.ts`
|
|
277
|
+
- Add: [specific functionality]
|
|
278
|
+
|
|
279
|
+
**Patterns to Follow:**
|
|
280
|
+
- Error handling: Use `src/errors/AppError.ts` pattern
|
|
281
|
+
- Testing: Follow `__tests__/example.test.ts` structure
|
|
282
|
+
- Imports: Use absolute paths from `src/`
|
|
283
|
+
|
|
284
|
+
**DO:**
|
|
285
|
+
- Follow existing code style in the files
|
|
286
|
+
- Add JSDoc comments for public functions
|
|
287
|
+
- Write type-safe TypeScript (no `any`)
|
|
288
|
+
- Handle errors explicitly
|
|
289
|
+
|
|
290
|
+
**DON'T:**
|
|
291
|
+
- Change unrelated code
|
|
292
|
+
- Add libraries without checking existing stack
|
|
293
|
+
- Skip edge case handling
|
|
294
|
+
- Leave TODOs in production code
|
|
295
|
+
|
|
296
|
+
## DONE CRITERIA
|
|
297
|
+
|
|
298
|
+
This subtask is complete when:
|
|
299
|
+
1. [Specific criterion 1]
|
|
300
|
+
2. [Specific criterion 2]
|
|
301
|
+
3. [Specific criterion 3]
|
|
302
|
+
4. All edits are syntactically valid (no compilation errors)
|
|
303
|
+
|
|
304
|
+
## AFTER YOU'RE DONE
|
|
305
|
+
|
|
306
|
+
Return:
|
|
307
|
+
1. **Files changed:** List of file paths
|
|
308
|
+
2. **Summary:** What was implemented (2-3 sentences)
|
|
309
|
+
3. **Any issues:** Blockers, ambiguities, or decisions made
|
|
310
|
+
|
|
311
|
+
DO NOT:
|
|
312
|
+
- Run tests (orchestrator does this)
|
|
313
|
+
- Run linters (orchestrator does this)
|
|
314
|
+
- Verify the full feature (orchestrator does this)
|
|
315
|
+
- Update TODO.md (orchestrator does this)
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Anti-Patterns: NEVER Do These
|
|
321
|
+
|
|
322
|
+
### ❌ WRONG: Spawning subagent to compact context
|
|
323
|
+
|
|
324
|
+
```
|
|
325
|
+
❌ "My context is full. Let me spawn a subagent to continue."
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Why wrong:** The subagent starts with EMPTY context. It will compact its own empty context, not yours. Infinite loop.
|
|
329
|
+
|
|
330
|
+
**✅ RIGHT:** YOU decide what to keep. Update CONTEXT.md. Summarize decisions. THEN spawn subagent with scoped task.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
### ❌ WRONG: Spawning subagent to decide next step
|
|
335
|
+
|
|
336
|
+
```
|
|
337
|
+
❌ "I'm not sure what to do next. Let me spawn a subagent to figure it out."
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Why wrong:** YOU are the orchestrator. YOU make decisions. Subagents execute scoped tasks.
|
|
341
|
+
|
|
342
|
+
**✅ RIGHT:** Re-read CONTEXT.md. Review Progress Tracker. Decide next action. THEN spawn subagent with specific task.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
### ❌ WRONG: Spawning subagent to run tests
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
❌ "Let me spawn a subagent to run `npm test` and tell me the results."
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Why wrong:** Running tests is a deterministic shell command. You run it directly.
|
|
353
|
+
|
|
354
|
+
**✅ RIGHT:** Run `npm test` yourself. Analyze output yourself. Decide on fix. THEN spawn Code Agent to implement fix.
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
### ❌ WRONG: Vague subagent brief
|
|
359
|
+
|
|
360
|
+
```
|
|
361
|
+
❌ "Implement the authentication feature. Figure out the best approach."
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Why wrong:** Subagent doesn't have your context. It will re-explore everything you already researched. Wastes tokens and time.
|
|
365
|
+
|
|
366
|
+
**✅ RIGHT:**
|
|
367
|
+
- YOU decide the approach (JWT + Redis)
|
|
368
|
+
- YOU identify files to edit (`login.ts`, `session.ts`)
|
|
369
|
+
- YOU specify the pattern to follow (existing error handling)
|
|
370
|
+
- THEN spawn subagent with detailed brief (see template above)
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Workflow: Managing Context in Complex Tasks
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
378
|
+
│ START: Complex multi-step task │
|
|
379
|
+
└────────────────────────────────────────────────────────────────┘
|
|
380
|
+
│
|
|
381
|
+
▼
|
|
382
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
383
|
+
│ 1. CREATE CONTEXT.md │
|
|
384
|
+
│ - Write main goal │
|
|
385
|
+
│ - Set up Progress Tracker │
|
|
386
|
+
└────────────────────────────────────────────────────────────────┘
|
|
387
|
+
│
|
|
388
|
+
▼
|
|
389
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
390
|
+
│ 2. RESEARCH & DECIDE │
|
|
391
|
+
│ - Read relevant files │
|
|
392
|
+
│ - Explore codebase │
|
|
393
|
+
│ - Make key decisions │
|
|
394
|
+
│ - UPDATE CONTEXT.md with decisions │
|
|
395
|
+
└────────────────────────────────────────────────────────────────┘
|
|
396
|
+
│
|
|
397
|
+
▼
|
|
398
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
399
|
+
│ 3. BREAK DOWN INTO SUBTASKS │
|
|
400
|
+
│ - Write subtasks in TODO.md │
|
|
401
|
+
│ - Update CONTEXT.md Progress Tracker │
|
|
402
|
+
└────────────────────────────────────────────────────────────────┘
|
|
403
|
+
│
|
|
404
|
+
▼
|
|
405
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
406
|
+
│ 4. FOR EACH SUBTASK: │
|
|
407
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
408
|
+
│ │ 4a. Check: Can I do this directly? (1-3 file edits) │ │
|
|
409
|
+
│ │ → YES: Do it yourself │ │
|
|
410
|
+
│ │ → NO: Continue to 4b │ │
|
|
411
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
412
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
413
|
+
│ │ 4b. Write detailed subagent brief (use template) │ │
|
|
414
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
415
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
416
|
+
│ │ 4c. Spawn subagent with scoped task │ │
|
|
417
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
418
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
419
|
+
│ │ 4d. UPDATE CONTEXT.md with spawn details │ │
|
|
420
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
421
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
422
|
+
│ │ 4e. Receive result from subagent │ │
|
|
423
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
424
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
425
|
+
│ │ 4f. YOU verify (tests, lint, build) │ │
|
|
426
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
427
|
+
│ ┌─────────────────────────────────────────────────────┐ │
|
|
428
|
+
│ │ 4g. UPDATE CONTEXT.md Progress Tracker │ │
|
|
429
|
+
│ └─────────────────────────────────────────────────────┘ │
|
|
430
|
+
└────────────────────────────────────────────────────────────────┘
|
|
431
|
+
│
|
|
432
|
+
▼
|
|
433
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
434
|
+
│ 5. CHECKPOINT: Review CONTEXT.md │
|
|
435
|
+
│ - Am I still on track for main goal? │
|
|
436
|
+
│ - Have I strayed into unrelated work? │
|
|
437
|
+
│ - Is the approach still valid? │
|
|
438
|
+
└────────────────────────────────────────────────────────────────┘
|
|
439
|
+
│
|
|
440
|
+
▼
|
|
441
|
+
┌────────────────────────────────────────────────────────────────┐
|
|
442
|
+
│ 6. COMPLETE: All subtasks done │
|
|
443
|
+
│ - Mark main task [x] │
|
|
444
|
+
│ - Archive CONTEXT.md → DONE_CONTEXT_YYYY-MM-DD.md │
|
|
445
|
+
│ - Commit │
|
|
446
|
+
└────────────────────────────────────────────────────────────────┘
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Quick Reference: Subagent Dispatch Rules
|
|
452
|
+
|
|
453
|
+
| Task Type | Who Does It | Notes |
|
|
454
|
+
|-----------|-------------|-------|
|
|
455
|
+
| Run `npm test` | **YOU** | Never spawn subagent for shell commands |
|
|
456
|
+
| Run `eslint` | **YOU** | Never spawn subagent for linters |
|
|
457
|
+
| Run `npm run build` | **YOU** | Never spawn subagent for builds |
|
|
458
|
+
| Read files | **YOU** | Never spawn subagent to read/parse |
|
|
459
|
+
| Grep/search codebase | **YOU** | Use grep_search/semantic_search directly |
|
|
460
|
+
| Analyze test output | **YOU** | Never spawn subagent to interpret output |
|
|
461
|
+
| Decide what to do next | **YOU** | Never spawn subagent to make decisions |
|
|
462
|
+
| Manage context | **YOU** | Never spawn subagent to compact YOUR context |
|
|
463
|
+
| Edit 1-3 files (simple) | **YOU** | Direct edits faster than subagent |
|
|
464
|
+
| Edit 5+ files (complex) | **Code Agent** | Spawn with detailed brief |
|
|
465
|
+
| Multi-file refactor | **Code Agent** | One file at a time, or spawn with full context |
|
|
466
|
+
| Write new test files | **QA Agent** | Spawn with spec and patterns to follow |
|
|
467
|
+
| Review code/diff | **Reviewer Agent** | Spawn after changes complete |
|
|
468
|
+
| Architectural design | **Architect Agent** | Spawn with requirements and constraints |
|
|
469
|
+
| Context handoff | **Code Agent** | When YOUR context unwieldy + decisions made |
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Success Metrics
|
|
474
|
+
|
|
475
|
+
You're using subagents correctly when:
|
|
476
|
+
|
|
477
|
+
✅ Subagents receive detailed, specific briefs (not "figure it out")
|
|
478
|
+
✅ You update CONTEXT.md before and after subagent spawns
|
|
479
|
+
✅ You never spawn subagents to run commands or read files
|
|
480
|
+
✅ You verify all subagent work yourself (tests, lint, diff review)
|
|
481
|
+
✅ You stay on track with the main goal (no context drift)
|
|
482
|
+
✅ Subagents work on scoped tasks with clean context
|
|
483
|
+
✅ You make all decisions; subagents execute decisions
|
|
484
|
+
|
|
485
|
+
You're doing it WRONG when:
|
|
486
|
+
|
|
487
|
+
❌ Spawning subagent to "compact my context"
|
|
488
|
+
❌ Spawning subagent to "figure out what to do"
|
|
489
|
+
❌ Spawning subagent to run tests or linters
|
|
490
|
+
❌ Giving vague briefs like "implement feature X"
|
|
491
|
+
❌ Losing track of main goal after deep subtasks
|
|
492
|
+
❌ Forgetting to update CONTEXT.md
|
|
493
|
+
❌ Repeating research that you already did
|
|
494
|
+
|
|
495
|
+
---
|
|
496
|
+
|
|
497
|
+
## Integration with Core Loop
|
|
498
|
+
|
|
499
|
+
This skill integrates with the **autodev-core-loop** skill:
|
|
500
|
+
|
|
501
|
+
- **Before Step 4 (THINK & PLAN):** Check if this is a context-heavy task → create CONTEXT.md
|
|
502
|
+
- **During Step 4 (THINK & PLAN):** Make decisions, update CONTEXT.md
|
|
503
|
+
- **During Step 5 (DISPATCH):** Use briefing template for complex tasks
|
|
504
|
+
- **After Step 6 (RECEIVE):** Update CONTEXT.md with result
|
|
505
|
+
- **During Step 7 (VERIFY):** Reference CONTEXT.md to ensure main goal still on track
|
|
506
|
+
- **After Step 8 (RE-READ TODO.md):** Check CONTEXT.md before picking next task
|
|
507
|
+
|
|
508
|
+
**Never let subagent management override the core loop. The loop is primary.**
|
|
509
|
+
|
|
510
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
## 0.20 Project Graph — Durable Shared Memory (`.autodev/graph/`)
|
|
2
|
+
|
|
3
|
+
**The agent forgets, the graph does not.** The project graph is a typed, queryable
|
|
4
|
+
graph of the project's facts and work, persisted at `.autodev/graph/graph.jsonl`
|
|
5
|
+
**relative to the project dir**. It survives your session and is **shared by every
|
|
6
|
+
agent** in the workspace — what one agent learns, the swarm can read.
|
|
7
|
+
|
|
8
|
+
> **Graph ≠ memory.** The file memory (`.autodev/memories/`, §0.2) is prose recall
|
|
9
|
+
> for *you*. The graph is *structured, sourced, versioned* facts for *everyone*,
|
|
10
|
+
> across sessions. Use both: memory for narrative, the graph for the shared world model.
|
|
11
|
+
|
|
12
|
+
### Tools (in the mcp-operate tool list — available to every provider)
|
|
13
|
+
|
|
14
|
+
| Tool | Use it to |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `graph_neighbors` | **At task start** — resolve an entity/node by id or name and expand 1–3 hops to recall what's already known *before* acting. This is context construction, not a dump. |
|
|
17
|
+
| `graph_query` | Search nodes by type and/or text; returns ids to expand or link. |
|
|
18
|
+
| `graph_add_node` | Record a typed fact and get its id. |
|
|
19
|
+
| `graph_add_edge` | Link two nodes with a typed, sourced relationship. |
|
|
20
|
+
| `graph_supersede` | Version a fact that changed (old node stays addressable). |
|
|
21
|
+
| `graph_stats` | Health check — gaps, isolated nodes, contradictions, open questions. |
|
|
22
|
+
|
|
23
|
+
### Schema
|
|
24
|
+
|
|
25
|
+
**Node types:** `entity` · `claim` · `source` · `artifact` · `agent_run` ·
|
|
26
|
+
`evaluation` · `task` · `commit` · `metric` · `note` · `question` · `decision`.
|
|
27
|
+
Entities dedupe by name (idempotent — re-adding merges aliases), so resolve real
|
|
28
|
+
things (services, files, people, modules) as entities.
|
|
29
|
+
|
|
30
|
+
**Edge types:** `mentions` · `supports` · `contradicts` · `derived_from` ·
|
|
31
|
+
`produced` · `evaluates` · `revises` · `supersedes` · `depends_on` · `parent_of` ·
|
|
32
|
+
`resolved_to` · `relates_to`.
|
|
33
|
+
|
|
34
|
+
### Invariants (enforced on write — a rejected write tells you what to add)
|
|
35
|
+
|
|
36
|
+
1. Every **claim** has a `source` (`"file:line"` / url / source-node id) **or** `inference: true`.
|
|
37
|
+
2. Every **artifact** has a `version`.
|
|
38
|
+
3. Every **evaluation** names the `rubric` it judged against.
|
|
39
|
+
4. **Superseded nodes are never deleted** — they stay addressable; `graph_supersede` links the replacement with a `supersedes` edge.
|
|
40
|
+
|
|
41
|
+
Provenance (your run id + agent id + timestamp) is attached to every write automatically.
|
|
42
|
+
|
|
43
|
+
### How it folds into the core loop
|
|
44
|
+
|
|
45
|
+
- **Start of a non-trivial task:** `graph_neighbors` on the entities in the task to
|
|
46
|
+
load prior claims, decisions, and artifacts. Don't rebuild the world from scratch.
|
|
47
|
+
- **While working:** record what you learn as you learn it —
|
|
48
|
+
`claim`s (with a source), `decision`s (what/why), `artifact`s (with version),
|
|
49
|
+
`evaluation`s (with rubric), and the `entity`s/`task`s they concern. Link them
|
|
50
|
+
(`supports`, `contradicts`, `depends_on`, `produced`, `derived_from`, …).
|
|
51
|
+
- **When a fact changes:** `graph_supersede` rather than overwrite — keep the history.
|
|
52
|
+
- **Open questions & conflicts:** add a `question` node, or a `contradicts` edge, so
|
|
53
|
+
the next agent picks it up. Run `graph_stats` to find isolated/unlinked facts.
|
|
54
|
+
|
|
55
|
+
**Goal:** every important output is traceable to an objective, a source, a graph path,
|
|
56
|
+
an evaluation, and a run. When that holds, the swarm's memory compounds instead of resetting.
|