agent-orchestration 0.5.1 → 0.6.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.
Files changed (120) hide show
  1. package/.cursor/rules/orchestrator-auto.mdc +2 -0
  2. package/.cursor/rules/orchestrator-main.mdc +37 -7
  3. package/.cursor/rules/orchestrator-sub.mdc +89 -27
  4. package/README.md +231 -11
  5. package/dist/bin/cli.d.ts +1 -0
  6. package/dist/bin/cli.d.ts.map +1 -1
  7. package/dist/bin/cli.js +54 -157
  8. package/dist/bin/cli.js.map +1 -1
  9. package/dist/bin/cursorCommands.d.ts +3 -0
  10. package/dist/bin/cursorCommands.d.ts.map +1 -0
  11. package/dist/bin/cursorCommands.js +330 -0
  12. package/dist/bin/cursorCommands.js.map +1 -0
  13. package/dist/database.d.ts +32 -1
  14. package/dist/database.d.ts.map +1 -1
  15. package/dist/database.js +105 -5
  16. package/dist/database.js.map +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +6 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/models.d.ts +60 -0
  21. package/dist/models.d.ts.map +1 -1
  22. package/dist/models.js +69 -0
  23. package/dist/models.js.map +1 -1
  24. package/dist/providers/cursor.d.ts +14 -0
  25. package/dist/providers/cursor.d.ts.map +1 -0
  26. package/dist/providers/cursor.js +211 -0
  27. package/dist/providers/cursor.js.map +1 -0
  28. package/dist/providers/types.d.ts +60 -0
  29. package/dist/providers/types.d.ts.map +1 -0
  30. package/dist/providers/types.js +2 -0
  31. package/dist/providers/types.js.map +1 -0
  32. package/dist/tools/agent.d.ts.map +1 -1
  33. package/dist/tools/agent.js +5 -0
  34. package/dist/tools/agent.js.map +1 -1
  35. package/dist/tools/coordination.d.ts.map +1 -1
  36. package/dist/tools/coordination.js +47 -0
  37. package/dist/tools/coordination.js.map +1 -1
  38. package/dist/tools/index.d.ts +3 -0
  39. package/dist/tools/index.d.ts.map +1 -1
  40. package/dist/tools/index.js +3 -0
  41. package/dist/tools/index.js.map +1 -1
  42. package/dist/tools/memory.d.ts.map +1 -1
  43. package/dist/tools/memory.js +6 -1
  44. package/dist/tools/memory.js.map +1 -1
  45. package/dist/tools/provider.d.ts +3 -0
  46. package/dist/tools/provider.d.ts.map +1 -0
  47. package/dist/tools/provider.js +403 -0
  48. package/dist/tools/provider.js.map +1 -0
  49. package/dist/tools/proxy.d.ts +6 -0
  50. package/dist/tools/proxy.d.ts.map +1 -0
  51. package/dist/tools/proxy.js +107 -0
  52. package/dist/tools/proxy.js.map +1 -0
  53. package/dist/tools/research.d.ts +9 -0
  54. package/dist/tools/research.d.ts.map +1 -0
  55. package/dist/tools/research.js +182 -0
  56. package/dist/tools/research.js.map +1 -0
  57. package/dist/tools/task.d.ts.map +1 -1
  58. package/dist/tools/task.js +98 -9
  59. package/dist/tools/task.js.map +1 -1
  60. package/dist/tools/utility.d.ts.map +1 -1
  61. package/dist/tools/utility.js +85 -16
  62. package/dist/tools/utility.js.map +1 -1
  63. package/dist/utils/autoDocumentation.d.ts +8 -0
  64. package/dist/utils/autoDocumentation.d.ts.map +1 -0
  65. package/dist/utils/autoDocumentation.js +140 -0
  66. package/dist/utils/autoDocumentation.js.map +1 -0
  67. package/dist/utils/autoDocumentation.test.d.ts +2 -0
  68. package/dist/utils/autoDocumentation.test.d.ts.map +1 -0
  69. package/dist/utils/autoDocumentation.test.js +47 -0
  70. package/dist/utils/autoDocumentation.test.js.map +1 -0
  71. package/dist/utils/contextSync.d.ts.map +1 -1
  72. package/dist/utils/contextSync.js +21 -1
  73. package/dist/utils/contextSync.js.map +1 -1
  74. package/dist/utils/cursorCli.d.ts +47 -0
  75. package/dist/utils/cursorCli.d.ts.map +1 -0
  76. package/dist/utils/cursorCli.js +178 -0
  77. package/dist/utils/cursorCli.js.map +1 -0
  78. package/dist/utils/cursorCli.test.d.ts +2 -0
  79. package/dist/utils/cursorCli.test.d.ts.map +1 -0
  80. package/dist/utils/cursorCli.test.js +137 -0
  81. package/dist/utils/cursorCli.test.js.map +1 -0
  82. package/dist/utils/delegatedTaskRuntime.d.ts +45 -0
  83. package/dist/utils/delegatedTaskRuntime.d.ts.map +1 -0
  84. package/dist/utils/delegatedTaskRuntime.js +147 -0
  85. package/dist/utils/delegatedTaskRuntime.js.map +1 -0
  86. package/dist/utils/delegationKnowledge.d.ts +51 -0
  87. package/dist/utils/delegationKnowledge.d.ts.map +1 -0
  88. package/dist/utils/delegationKnowledge.js +197 -0
  89. package/dist/utils/delegationKnowledge.js.map +1 -0
  90. package/dist/utils/delegationRecovery.d.ts +17 -0
  91. package/dist/utils/delegationRecovery.d.ts.map +1 -0
  92. package/dist/utils/delegationRecovery.js +63 -0
  93. package/dist/utils/delegationRecovery.js.map +1 -0
  94. package/dist/utils/delegationRecovery.test.d.ts +2 -0
  95. package/dist/utils/delegationRecovery.test.d.ts.map +1 -0
  96. package/dist/utils/delegationRecovery.test.js +42 -0
  97. package/dist/utils/delegationRecovery.test.js.map +1 -0
  98. package/dist/utils/orchestratorConfig.d.ts +19 -0
  99. package/dist/utils/orchestratorConfig.d.ts.map +1 -0
  100. package/dist/utils/orchestratorConfig.js +38 -0
  101. package/dist/utils/orchestratorConfig.js.map +1 -0
  102. package/dist/utils/subprocess.d.ts +27 -0
  103. package/dist/utils/subprocess.d.ts.map +1 -0
  104. package/dist/utils/subprocess.js +84 -0
  105. package/dist/utils/subprocess.js.map +1 -0
  106. package/package.json +17 -5
  107. package/templates/AGENTS.md +164 -0
  108. package/activeContext.md +0 -37
  109. package/src/bin/cli.ts +0 -430
  110. package/src/database.ts +0 -764
  111. package/src/index.ts +0 -71
  112. package/src/models.ts +0 -226
  113. package/src/tools/agent.ts +0 -241
  114. package/src/tools/coordination.ts +0 -152
  115. package/src/tools/index.ts +0 -9
  116. package/src/tools/memory.ts +0 -150
  117. package/src/tools/task.ts +0 -334
  118. package/src/tools/utility.ts +0 -202
  119. package/src/utils/contextSync.ts +0 -144
  120. package/tsconfig.json +0 -20
@@ -17,6 +17,8 @@ This project uses **Agent Orchestration**. You MUST follow these rules.
17
17
  bootstrap
18
18
  ```
19
19
 
20
+ **Important**: `bootstrap` is an MCP tool invocation inside your agent/IDE, not a terminal command.
21
+
20
22
  This registers you with the orchestrator and shows you:
21
23
  - Current project focus
22
24
  - Tasks assigned to you
@@ -13,12 +13,13 @@ You are the **main orchestrator agent** in a multi-agent coordination system. Fo
13
13
  **IMMEDIATELY** when starting any task, register yourself:
14
14
 
15
15
  ```
16
- agent_register:
16
+ bootstrap:
17
17
  name: "main-orchestrator"
18
18
  role: "main"
19
- capabilities: ["planning", "coordination", "review"]
20
19
  ```
21
20
 
21
+ **Important**: `bootstrap` is an MCP tool invocation inside your agent/IDE, not a terminal command.
22
+
22
23
  ## Your Responsibilities
23
24
 
24
25
  1. **Set the Focus** - Always set the current focus so other agents know what we're working on:
@@ -35,7 +36,7 @@ agent_register:
35
36
  title: "<clear task title>"
36
37
  description: "<detailed requirements>"
37
38
  priority: "normal" | "high" | "urgent"
38
- assigned_to: "<agent_id>" (optional)
39
+ complexity: "trivial" | "simple" | "moderate" | "complex" (optional, auto-detected)
39
40
  ```
40
41
 
41
42
  3. **Store Decisions** - Document architectural decisions:
@@ -52,9 +53,22 @@ agent_register:
52
53
  task_list
53
54
  ```
54
55
 
56
+ ## Task Complexity Guidelines
57
+
58
+ When creating tasks, consider the appropriate complexity:
59
+
60
+ | Complexity | Use For | Research Required |
61
+ |------------|---------|-------------------|
62
+ | `trivial` | Typo fixes, config changes | None |
63
+ | `simple` | Bug fixes, small refactors | context, files |
64
+ | `moderate` | New endpoints, components | + requirements |
65
+ | `complex` | New features, migrations | + design |
66
+
67
+ Complexity is auto-detected from keywords, but you can override it.
68
+
55
69
  ## Workflow
56
70
 
57
- 1. Register yourself first
71
+ 1. Register yourself with `bootstrap`
58
72
  2. Check `coordination_status` to see current state
59
73
  3. Set `context:current_focus` with the goal
60
74
  4. Create tasks for work that needs to be done
@@ -75,12 +89,28 @@ This prevents contradicting decisions made by other agents.
75
89
  ## When Delegating
76
90
 
77
91
  1. Create a clear task with `task_create`
78
- 2. Optionally assign to a specific sub-agent
79
- 3. Wait for task completion before creating dependent tasks
80
- 4. Use task dependencies when order matters
92
+ 2. Set appropriate complexity for research requirements
93
+ 3. Optionally assign to a specific sub-agent
94
+ 4. Wait for task completion before creating dependent tasks
95
+ 5. Use task dependencies when order matters
96
+
97
+ ## Reviewing Research
98
+
99
+ Before approving implementation, check sub-agent research:
100
+ ```
101
+ research_status:
102
+ task_id: "<task_id>"
103
+ ```
104
+
105
+ Search past research for relevant context:
106
+ ```
107
+ research_query:
108
+ query: "<search term>"
109
+ ```
81
110
 
82
111
  ## Communication Pattern
83
112
 
84
113
  - Use `memory_set` in namespace `context` for current state
85
114
  - Use `memory_set` in namespace `blockers` for issues
115
+ - Use `memory_set` in namespace `decisions` for architectural choices
86
116
  - Check `agent_list` to see who's available
@@ -19,59 +19,120 @@ claim_todo:
19
19
  description: "<details if any>"
20
20
  ```
21
21
 
22
+ **Important**: tool calls like `claim_todo` / `bootstrap` are MCP tool invocations inside your agent/IDE, not terminal commands.
23
+
22
24
  **DO NOT start coding until you have claimed your task.**
23
25
 
24
26
  This:
25
27
  1. Registers you with the orchestrator
26
28
  2. Creates the task if it doesn't exist
27
- 3. Claims it so no other agent works on it
28
- 4. Returns your agent ID and task ID
29
+ 3. Assigns it to you
30
+ 4. Shows you the **research checklist** based on task complexity
29
31
 
30
32
  ---
31
33
 
32
- ## After Claiming
34
+ ## 🔬 Research-First Workflow
35
+
36
+ After claiming, you'll see a research checklist based on task complexity:
37
+
38
+ | Complexity | Research Required |
39
+ |------------|-------------------|
40
+ | `trivial` | None - start immediately |
41
+ | `simple` | context, files |
42
+ | `moderate` | context, files, requirements |
43
+ | `complex` | context, files, requirements, design |
33
44
 
34
- 1. **Check context** to understand the project:
45
+ ### For Non-Trivial Tasks
46
+
47
+ **BEFORE coding**, document your research:
48
+
49
+ 1. **Context** - Understand the current state:
35
50
  ```
36
- memory_get:
37
- key: "current_focus"
38
- namespace: "context"
51
+ memory_set:
52
+ key: "understanding"
53
+ value: "<what you learned about the codebase>"
54
+ namespace: "research:<task_id>:context"
39
55
  ```
40
56
 
41
- 2. **Check decisions** to avoid contradicting them:
57
+ 2. **Files** - Identify affected files:
42
58
  ```
43
- memory_list:
44
- namespace: "decisions"
59
+ memory_set:
60
+ key: "affected_files"
61
+ value: "<list of files you'll modify>"
62
+ namespace: "research:<task_id>:files"
45
63
  ```
46
64
 
47
- 3. **Lock files** before editing:
65
+ 3. **Requirements** (moderate/complex):
48
66
  ```
49
- lock_acquire:
50
- resource: "<file_path>"
51
- reason: "<what you're doing>"
67
+ memory_set:
68
+ key: "specs"
69
+ value: "<requirements, acceptance criteria, edge cases>"
70
+ namespace: "research:<task_id>:requirements"
52
71
  ```
53
72
 
54
- ---
73
+ 4. **Design** (complex only):
74
+ ```
75
+ memory_set:
76
+ key: "architecture"
77
+ value: "<design decisions, component structure>"
78
+ namespace: "research:<task_id>:design"
79
+ ```
55
80
 
56
- ## While Working
81
+ ### Mark Research Complete
82
+
83
+ When all items are documented:
57
84
 
58
- Update progress periodically:
59
85
  ```
60
- task_update:
86
+ research_ready:
61
87
  task_id: "<your_task_id>"
62
- progress: 50
63
88
  ```
64
89
 
65
- Store important findings:
90
+ ### Then Start Implementation
91
+
66
92
  ```
67
- memory_set:
68
- key: "<finding>"
69
- value: "<details>"
70
- namespace: "findings"
93
+ task_claim:
94
+ task_id: "<your_task_id>"
71
95
  ```
72
96
 
73
97
  ---
74
98
 
99
+ ## Check Research Status
100
+
101
+ To see what's done and what's missing:
102
+
103
+ ```
104
+ research_status:
105
+ task_id: "<your_task_id>"
106
+ ```
107
+
108
+ ---
109
+
110
+ ## While Working
111
+
112
+ 1. **Lock files** before editing:
113
+ ```
114
+ lock_acquire:
115
+ resource: "<file_path>"
116
+ reason: "<what you're doing>"
117
+ ```
118
+
119
+ 2. **Update progress** periodically:
120
+ ```
121
+ task_update:
122
+ task_id: "<your_task_id>"
123
+ progress: 50
124
+ ```
125
+
126
+ 3. **Store findings** for others:
127
+ ```
128
+ memory_set:
129
+ key: "<finding>"
130
+ value: "<details>"
131
+ namespace: "findings"
132
+ ```
133
+
134
+ ---
135
+
75
136
  ## When Done
76
137
 
77
138
  1. Complete the task:
@@ -109,6 +170,7 @@ memory_set:
109
170
  ## Important Rules
110
171
 
111
172
  1. **ALWAYS claim your task first** with `claim_todo`
112
- 2. **ALWAYS lock files** before editing shared resources
113
- 3. **ALWAYS complete your task** when done
114
- 4. **Check shared memory** before making decisions that affect others
173
+ 2. **ALWAYS complete research** before implementation (non-trivial tasks)
174
+ 3. **ALWAYS lock files** before editing shared resources
175
+ 4. **ALWAYS complete your task** when done
176
+ 5. **Check shared memory** before making decisions that affect others
package/README.md CHANGED
@@ -24,6 +24,7 @@ This MCP server provides:
24
24
  - **Task Queue** - Turn-based task execution with dependencies
25
25
  - **Agent Discovery** - Agents can see who else is working on the project
26
26
  - **Resource Locking** - Prevent concurrent access to files or resources
27
+ - **Research-First Workflow** - Ensures agents understand context before coding
27
28
  - **Coordination Status** - Real-time visibility into the orchestration state
28
29
  - **Auto Context Sync** - Automatically updates `activeContext.md` for easy reference
29
30
 
@@ -75,6 +76,15 @@ This copies `.cursor/rules/` with Cursor-specific rules.
75
76
  npx agent-orchestration init # Create AGENTS.md (works with any AI agent)
76
77
  npx agent-orchestration init-cursor # Setup for Cursor IDE (.cursor/rules/)
77
78
  npx agent-orchestration serve # Run the MCP server
79
+ npx agent-orchestration doc --task <task-id>
80
+ npx agent-orchestration cursor check # Verify Cursor CLI support
81
+ npx agent-orchestration cursor delegate --task <task-id>
82
+ npx agent-orchestration cursor status --task <task-id>
83
+ npx agent-orchestration cursor resume --task <task-id>
84
+ npx agent-orchestration cursor sync --task <task-id>
85
+ npx agent-orchestration cursor recover --task <task-id>
86
+ npx agent-orchestration cursor handoff --task <task-id> --summary "..."
87
+ npx agent-orchestration cursor list # Show delegated Cursor tasks
78
88
  npx agent-orchestration help # Show help
79
89
  ```
80
90
 
@@ -106,6 +116,8 @@ Use the `bootstrap` tool to start:
106
116
  bootstrap
107
117
  ```
108
118
 
119
+ **Note**: `bootstrap` is an MCP tool invocation inside your agent/IDE, not a terminal command.
120
+
109
121
  This registers you, shows current focus, pending tasks, and recent decisions.
110
122
 
111
123
  ## Available Tools
@@ -140,13 +152,22 @@ This registers you, shows current focus, pending tasks, and recent decisions.
140
152
 
141
153
  | Tool | Description |
142
154
  |------|-------------|
143
- | `task_create` | Create a new task in the queue |
144
- | `task_claim` | Claim a task to work on |
155
+ | `task_create` | Create a new task (auto-detects complexity) |
156
+ | `task_claim` | Claim a task to work on (requires research for non-trivial) |
145
157
  | `task_update` | Update task status or progress |
146
158
  | `task_complete` | Mark a task as completed |
147
159
  | `task_list` | List tasks with filters |
148
160
  | `is_my_turn` | Check if work is available for you |
149
161
 
162
+ ### Research Workflow
163
+
164
+ | Tool | Description |
165
+ |------|-------------|
166
+ | `research_ready` | Mark research complete for a task |
167
+ | `research_status` | Check research progress for a task |
168
+ | `research_query` | Search past research findings |
169
+ | `research_checklist` | View research requirements by complexity |
170
+
150
171
  ### Coordination
151
172
 
152
173
  | Tool | Description |
@@ -156,6 +177,168 @@ This registers you, shows current focus, pending tasks, and recent decisions.
156
177
  | `lock_check` | Check if a resource is locked |
157
178
  | `coordination_status` | Get overall system status |
158
179
 
180
+ ### Cursor Provider
181
+
182
+ | Tool | Description |
183
+ |------|-------------|
184
+ | `cursor_check` | Verify Cursor CLI availability and supported features |
185
+ | `cursor_delegate_task` | Launch a Cursor CLI run for a task and persist session metadata |
186
+ | `cursor_task_status` | Inspect delegated task health, recovery state, and retryability |
187
+ | `cursor_resume_task` | Return the resume command for a delegated task |
188
+ | `cursor_sync_task` | Refresh delegated task state and sync findings back into shared memory |
189
+ | `cursor_recover_task` | Relaunch a failed or stale delegated task with current shared context |
190
+ | `cursor_handoff_task` | Record a structured handoff for the next agent |
191
+ | `cursor_list_delegations` | Show delegated Cursor tasks and their last known status |
192
+ | `task_generate_doc` | Generate Markdown documentation for a task from current orchestration state |
193
+
194
+ ## Cursor-Native Delegation
195
+
196
+ You can now delegate orchestrator tasks directly to Cursor CLI instead of manually creating a plan, opening a new tab, and pasting context yourself.
197
+
198
+ ### CLI Workflow
199
+
200
+ ```bash
201
+ # Verify Cursor CLI is available
202
+ npx agent-orchestration cursor check
203
+
204
+ # Delegate a task to Cursor
205
+ npx agent-orchestration cursor delegate --task <task-id> --mode agent
206
+
207
+ # Inspect health and recovery hints
208
+ npx agent-orchestration cursor status --task <task-id>
209
+
210
+ # Resume the delegated session later
211
+ npx agent-orchestration cursor resume --task <task-id>
212
+
213
+ # Sync the latest delegated knowledge back into shared memory
214
+ npx agent-orchestration cursor sync --task <task-id>
215
+
216
+ # Recover a stale or failed delegated run
217
+ npx agent-orchestration cursor recover --task <task-id>
218
+
219
+ # Record a structured handoff for another agent
220
+ npx agent-orchestration cursor handoff --task <task-id> --summary "Current implementation is complete; QA and docs remain."
221
+
222
+ # Generate task documentation on demand
223
+ npx agent-orchestration doc --task <task-id>
224
+
225
+ # Or launch the resume session immediately
226
+ npx agent-orchestration cursor resume --task <task-id> --exec
227
+ ```
228
+
229
+ ### MCP Workflow
230
+
231
+ ```text
232
+ cursor_delegate_task:
233
+ task_id: "<task-id>"
234
+ mode: "agent"
235
+ use_worktree: true
236
+ ```
237
+
238
+ Delegations store provider metadata directly on the task, including:
239
+
240
+ - Cursor chat/session ID
241
+ - provider status
242
+ - worktree usage
243
+ - launch command
244
+ - run log path
245
+
246
+ Moderate and complex tasks default to Cursor worktrees for safer parallel execution.
247
+
248
+ ### Delegation Knowledge Loop
249
+
250
+ Delegated Cursor tasks now write structured shared memory so the next agent can resume with live context instead of only the original launch prompt.
251
+
252
+ Namespaces:
253
+
254
+ - `delegation:<task_id>:brief`
255
+ - `delegation:<task_id>:updates`
256
+ - `delegation:<task_id>:findings`
257
+ - `delegation:<task_id>:decisions`
258
+ - `delegation:<task_id>:handoff`
259
+
260
+ Recommended flow:
261
+
262
+ 1. `cursor_delegate_task` or `agent-orchestration cursor delegate`
263
+ 2. `cursor_task_status` to inspect health and recovery hints
264
+ 3. `cursor_sync_task` or `agent-orchestration cursor sync`
265
+ 4. `cursor_recover_task` when the delegated process is stale or failed
266
+ 5. `cursor_handoff_task` when a human or another agent needs to pick up the work
267
+ 6. `cursor_resume_task` to rebuild a resume prompt from the latest shared knowledge
268
+
269
+ ### Graceful Recovery
270
+
271
+ Delegated Cursor runs now track recovery metadata directly on the task:
272
+
273
+ - recovery state (`healthy`, `stale`, `failed`, `completed`, `unknown`)
274
+ - recoverability
275
+ - last error / exit code
276
+ - retry count
277
+ - recovery hints
278
+
279
+ This enables:
280
+
281
+ - stale process detection when no clean exit is captured
282
+ - structured recovery hints in MCP and CLI
283
+ - safe relaunch via `cursor_recover_task`
284
+ - preservation of knowledge and handoff state across retries
285
+
286
+ ### Auto Documentation
287
+
288
+ Task documentation is now generated automatically into `.agent-orchestration/docs/` from:
289
+
290
+ - task metadata and output
291
+ - research namespaces
292
+ - delegation knowledge namespaces
293
+ - provider health and recovery state
294
+ - recent task-specific orchestration events
295
+
296
+ Generated files:
297
+
298
+ - `.agent-orchestration/docs/tasks/<task-id>.md`
299
+ - `.agent-orchestration/docs/README.md`
300
+
301
+ Documentation refreshes automatically during:
302
+
303
+ - delegated task launch
304
+ - delegated sync
305
+ - delegated handoff
306
+ - delegated recovery
307
+ - task completion
308
+
309
+ You can also regenerate docs manually with:
310
+
311
+ ```bash
312
+ npx agent-orchestration doc --task <task-id>
313
+ ```
314
+
315
+ ## Research-First Workflow
316
+
317
+ Tasks are automatically assigned a complexity level that determines research requirements:
318
+
319
+ | Complexity | Examples | Research Required |
320
+ |------------|----------|-------------------|
321
+ | `trivial` | Typo fix, config change | None |
322
+ | `simple` | Bug fix, small refactor | context, files |
323
+ | `moderate` | New endpoint, component | + requirements |
324
+ | `complex` | New feature, migration | + design |
325
+
326
+ ### How It Works
327
+
328
+ 1. **Task Creation** - Complexity is auto-detected from keywords (or manually set)
329
+ 2. **Research Phase** - Agent documents findings in structured namespaces
330
+ 3. **Research Gate** - `task_claim` is blocked until research is complete
331
+ 4. **Implementation** - Agent proceeds with full context
332
+
333
+ ### Research Namespaces
334
+
335
+ ```
336
+ research:<task_id>:context # Understanding of codebase
337
+ research:<task_id>:files # Affected files identified
338
+ research:<task_id>:requirements # Specs and edge cases
339
+ research:<task_id>:design # Architecture decisions
340
+ ```
341
+
159
342
  ## Recommended Workflow
160
343
 
161
344
  ### Main Orchestrator Agent
@@ -163,7 +346,7 @@ This registers you, shows current focus, pending tasks, and recent decisions.
163
346
  ```
164
347
  1. bootstrap # Start session
165
348
  2. memory_set current_focus "..." # Set project focus
166
- 3. task_create "Feature X" # Create tasks
349
+ 3. task_create "Feature X" # Create tasks (complexity auto-detected)
167
350
  4. task_create "Feature Y"
168
351
  5. coordination_status # Monitor progress
169
352
  ```
@@ -171,11 +354,28 @@ This registers you, shows current focus, pending tasks, and recent decisions.
171
354
  ### Sub-Agents (Spawned for Specific Work)
172
355
 
173
356
  ```
174
- 1. claim_todo "Feature X" # Register + claim in one call
175
- 2. lock_acquire "src/feature.ts" # Lock files before editing
357
+ 1. claim_todo "Feature X" # Register + see research checklist
358
+
359
+ # Research Phase (for non-trivial tasks)
360
+ 2. memory_set key="understanding" namespace="research:<task_id>:context" value="..."
361
+ 3. memory_set key="files" namespace="research:<task_id>:files" value="..."
362
+ 4. research_ready task_id="<task_id>" # Validate research complete
363
+
364
+ # Implementation Phase
365
+ 5. task_claim task_id="<task_id>" # Now allowed to start
366
+ 6. lock_acquire "src/feature.ts" # Lock files before editing
367
+ 7. [do the work]
368
+ 8. task_complete <task_id> "Done" # Complete the task
369
+ 9. agent_unregister # Clean up
370
+ ```
371
+
372
+ ### Trivial Tasks (No Research)
373
+
374
+ ```
375
+ 1. claim_todo "Fix typo in README" # Complexity: trivial
376
+ 2. task_claim task_id="<task_id>" # Immediately allowed
176
377
  3. [do the work]
177
- 4. task_complete <task_id> "Done" # Complete the task
178
- 5. agent_unregister # Clean up
378
+ 4. task_complete <task_id> "Done"
179
379
  ```
180
380
 
181
381
  ## Memory Namespaces
@@ -201,6 +401,26 @@ Use these namespaces for organization:
201
401
  | `MCP_ORCH_AGENT_ROLE` | Default agent role | `sub` |
202
402
  | `MCP_ORCH_CAPABILITIES` | Comma-separated capabilities | `code` |
203
403
 
404
+ ### `agent-orchestration.config.json`
405
+
406
+ Optional project-level config for Cursor orchestration:
407
+
408
+ ```json
409
+ {
410
+ "cursor": {
411
+ "binary": "agent",
412
+ "defaultMode": "agent",
413
+ "defaultForce": true,
414
+ "autoApproveMcps": true,
415
+ "trustWorkspace": true,
416
+ "useCreateChat": true,
417
+ "logDir": ".agent-orchestration/providers/cursor",
418
+ "preferWorktreeFor": ["moderate", "complex"],
419
+ "recoveryStaleAfterMs": 600000
420
+ }
421
+ }
422
+ ```
423
+
204
424
  ## Architecture
205
425
 
206
426
  ```
@@ -301,11 +521,11 @@ npm run clean && npm run build
301
521
 
302
522
  We're actively developing new features. Here's what's coming:
303
523
 
524
+ - [x] **Research-First Workflow** - Agents research and prepare before coding (DONE in v0.5.2, carried forward in v0.6.0)
304
525
  - [ ] **External Memory Integration** - Integration with external memory providers like [Mem0](https://mem0.ai/), [Byteover](https://www.byterover.dev/), and our own memory solution
305
- - [ ] **Enhanced Sub-Agent Knowledge** - Fix limitations in knowledge sharing between main agent and sub-agents
306
- - [ ] **Research-First Workflow** - When building from scratch, agents should research first and prepare all requirements before coding
307
- - [ ] **Graceful Error Handling** - Better error handling and recovery across all operations
308
- - [ ] **Auto Documentation** - Automatically generate documentation from and for each sub-agent + main agent interactions
526
+ - [x] **Enhanced Sub-Agent Knowledge** - Delegated Cursor tasks now persist structured briefs, updates, findings, decisions, and handoff state in shared memory
527
+ - [x] **Graceful Error Handling** - Delegated Cursor tasks now track health, stale/failed recovery state, retry counts, and structured recovery hints
528
+ - [x] **Auto Documentation** - Task docs are now generated automatically from orchestration state, delegation memory, provider recovery metadata, and task events
309
529
 
310
530
  Have a feature request? [Open an issue](https://github.com/madebyaris/agent-orchestration/issues)!
311
531
 
package/dist/bin/cli.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * init - Creates AGENTS.md for cross-IDE/CLI compatibility
7
7
  * init-cursor - Copies .cursor/rules/ for Cursor IDE
8
8
  * serve - Run the MCP server (used by IDEs via npx)
9
+ * cursor - Cursor-native orchestration helpers
9
10
  */
10
11
  export {};
11
12
  //# sourceMappingURL=cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}