Commit 8e5828f
feat(cortex-agents): implement Plan Mode & Spec Mode system (#207)
Implements AGENT_3 mission from ORCHESTRATE/AGENT_3_MODES.md.
## New Features
### Operation Mode System (cortex-agents)
- Added OperationMode enum (Build/Plan/Spec) with full lifecycle support
- Build mode: Full access to modify files and execute commands
- Plan mode: Read-only, describes changes without applying them
- Spec mode: Generates detailed implementation plans for user approval
### Spec Plan System (cortex-agents/src/spec/)
- SpecPlan: Structured specification with title, summary, steps, file changes
- SpecStep: Individual implementation step with dependencies
- FileChange: Describes file operations (Create/Modify/Delete/Rename)
- ApprovalManager: Handles async approval flow with timeout support
- ModeTransition: Manages transitions between modes with system prompt updates
### Permission Filtering
- filter_for_mode(): Restricts permissions based on operation mode
- for_mode(): Factory method for mode-appropriate permissions
- Plan/Spec modes block write operations
### TUI Integration (cortex-core, cortex-tui)
- ModeIndicator widget: Displays current mode with icon and color
- ToggleOperationMode action: Cycles Build -> Plan -> Spec -> Build
- ApproveSpec/RejectSpec actions: Handle spec plan approval workflow
- AppState.operation_mode: Tracks current mode in TUI state
## Tests
- 53 tests added for cortex-agents spec system
- 4 tests added for ModeIndicator widget
- All existing tests pass
Resolves: ORCHESTRATE/AGENT_3_MODES.md
Co-authored-by: Droid Agent <droid@factory.ai>1 parent de82de3 commit 8e5828f
File tree
11 files changed
+1580
-1
lines changed- cortex-agents/src
- spec
- cortex-core/src/widgets
- cortex-tui/src
- runner
11 files changed
+1580
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
10 | 27 | | |
11 | 28 | | |
12 | 29 | | |
| |||
88 | 105 | | |
89 | 106 | | |
90 | 107 | | |
| 108 | + | |
91 | 109 | | |
92 | 110 | | |
93 | 111 | | |
| |||
115 | 133 | | |
116 | 134 | | |
117 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
118 | 140 | | |
119 | 141 | | |
120 | 142 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
87 | 138 | | |
88 | 139 | | |
89 | 140 | | |
| |||
230 | 281 | | |
231 | 282 | | |
232 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
233 | 328 | | |
0 commit comments