@litmers/cursorflow-orchestrator 0.1.6 → 0.1.9
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/CHANGELOG.md +31 -0
- package/README.md +97 -321
- package/commands/cursorflow-doctor.md +28 -0
- package/commands/cursorflow-monitor.md +59 -101
- package/commands/cursorflow-prepare.md +25 -2
- package/commands/cursorflow-resume.md +11 -0
- package/commands/cursorflow-run.md +109 -100
- package/commands/cursorflow-signal.md +85 -14
- package/dist/cli/clean.d.ts +3 -1
- package/dist/cli/clean.js +122 -8
- package/dist/cli/clean.js.map +1 -1
- package/dist/cli/index.js +20 -20
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/monitor.d.ts +1 -1
- package/dist/cli/monitor.js +678 -145
- package/dist/cli/monitor.js.map +1 -1
- package/dist/cli/run.js +1 -0
- package/dist/cli/run.js.map +1 -1
- package/dist/core/orchestrator.d.ts +4 -2
- package/dist/core/orchestrator.js +92 -23
- package/dist/core/orchestrator.js.map +1 -1
- package/dist/core/runner.d.ts +14 -2
- package/dist/core/runner.js +244 -58
- package/dist/core/runner.js.map +1 -1
- package/dist/utils/types.d.ts +11 -0
- package/package.json +1 -1
- package/scripts/patches/test-cursor-agent.js +203 -0
- package/src/cli/clean.ts +129 -9
- package/src/cli/index.ts +20 -20
- package/src/cli/monitor.ts +732 -185
- package/src/cli/run.ts +1 -0
- package/src/core/orchestrator.ts +102 -27
- package/src/core/runner.ts +284 -66
- package/src/utils/types.ts +11 -0
|
@@ -1,131 +1,89 @@
|
|
|
1
1
|
# CursorFlow Monitor
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
|
|
4
|
+
The `cursorflow monitor` command provides a powerful, interactive terminal-based dashboard to track the execution status of all lanes in real-time. It allows you to visualize dependencies, stream live terminal output, and intervene in running tasks.
|
|
5
5
|
|
|
6
6
|
## Steps
|
|
7
7
|
|
|
8
|
-
1. **
|
|
8
|
+
1. **Launch the interactive dashboard**
|
|
9
9
|
```bash
|
|
10
|
-
|
|
10
|
+
# Monitor the most recent run
|
|
11
|
+
cursorflow monitor latest
|
|
11
12
|
```
|
|
12
13
|
|
|
13
|
-
2. **
|
|
14
|
+
2. **Dashboard Controls**
|
|
15
|
+
- **Navigation**: Use `↑` and `↓` to move between lanes.
|
|
16
|
+
- **Details**: Press `→` or `Enter` to see task progress, conversation history, and more.
|
|
17
|
+
- **Flow View**: Press `F` (from list view) to see the Directed Acyclic Graph (DAG) of task dependencies.
|
|
18
|
+
- **Live Terminal**: Press `T` (from lane detail) to stream the real-time output of the AI agent.
|
|
19
|
+
- **Intervention**: Press `I` (from lane detail) to send a manual prompt to a running agent.
|
|
20
|
+
- **Kill Process**: Press `K` (from lane detail) to forcefully terminate a stuck agent.
|
|
21
|
+
- **Back**: Use `←` or `Esc` to navigate back to previous screens.
|
|
22
|
+
- **Quit**: Press `Q` to exit.
|
|
23
|
+
|
|
24
|
+
3. **Monitor a specific run directory**
|
|
14
25
|
```bash
|
|
15
|
-
cursorflow monitor _cursorflow/logs/runs/
|
|
26
|
+
cursorflow monitor _cursorflow/logs/runs/run-2025-12-21T10-00-00
|
|
16
27
|
```
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
## Key Views
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- running: in progress
|
|
23
|
-
- completed: finished
|
|
24
|
-
- failed: failed
|
|
25
|
-
- blocked_dependency: waiting on dependencies
|
|
31
|
+
### List View
|
|
32
|
+
Shows an overview of all lanes, their status (pending, running, completed, failed, blocked), progress percentage, elapsed time, and "Next Action" (what it's waiting for or what it unlocks).
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
### Dependency Flow View
|
|
35
|
+
A visual map of how tasks relate to each other. It shows which lanes must finish before others can start.
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
### Lane Detail View
|
|
38
|
+
Displays:
|
|
39
|
+
- **Status & Progress**: Current task index and total tasks.
|
|
40
|
+
- **PID**: The process ID of the running `cursor-agent`.
|
|
41
|
+
- **Live Terminal (Preview)**: The last few lines of the agent's output.
|
|
42
|
+
- **Conversation History**: A scrollable list of messages between the system and the agent. Select a message to see its full content.
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
### Full Terminal View
|
|
45
|
+
A dedicated view that acts like `tail -f` for the agent's log. You can scroll up/down through the history using `↑` and `↓`.
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
| `--watch` | Refresh in real time (every 2 seconds) |
|
|
40
|
-
| `--interval <sec>` | Refresh interval in seconds |
|
|
41
|
-
| `--json` | Output in JSON format |
|
|
42
|
-
|
|
43
|
-
## Examples
|
|
44
|
-
|
|
45
|
-
### Monitor the latest run
|
|
46
|
-
```bash
|
|
47
|
-
cursorflow monitor
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Real-time monitoring (5-second interval)
|
|
51
|
-
```bash
|
|
52
|
-
cursorflow monitor --watch --interval 5
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### JSON output
|
|
56
|
-
```bash
|
|
57
|
-
cursorflow monitor --json | jq
|
|
47
|
+
### Heartbeat Logs
|
|
48
|
+
During execution, CursorFlow outputs heartbeat messages every 30 seconds:
|
|
58
49
|
```
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
⏱ Heartbeat: 30s elapsed, 1234 bytes received
|
|
51
|
+
⏱ Heartbeat: 60s elapsed, 5678 bytes received
|
|
62
52
|
```
|
|
63
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
64
|
-
📡 Lane Status Monitoring
|
|
65
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
66
53
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
- 03-projects: blocked_dependency (1/2)
|
|
72
|
-
```
|
|
54
|
+
This helps you:
|
|
55
|
+
- Track progress of long-running tasks
|
|
56
|
+
- Identify stalled or hanging processes (0 bytes received)
|
|
57
|
+
- Estimate completion time
|
|
73
58
|
|
|
74
|
-
##
|
|
59
|
+
## Troubleshooting
|
|
75
60
|
|
|
76
|
-
###
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
### Lane is stuck (Thinking too long)
|
|
62
|
+
1. Enter the lane detail view.
|
|
63
|
+
2. Check the **PID** to ensure the process is still alive.
|
|
64
|
+
3. Check the **Live Terminal** to see if it's producing output.
|
|
65
|
+
4. If it's truly stuck, press `K` to kill the process and then use `cursorflow resume` to restart it.
|
|
80
66
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
cat _cursorflow/logs/runs/01-dashboard-xxx/git-operations.jsonl | jq
|
|
84
|
-
```
|
|
67
|
+
### Intervention needed
|
|
68
|
+
If the agent is making a mistake or needs clarification:
|
|
85
69
|
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
cat _cursorflow/logs/runs/01-dashboard-xxx/events.jsonl | jq
|
|
89
|
-
```
|
|
70
|
+
> ⚠️ **Note**: Intervention requires `enableIntervention: true` in your task configuration!
|
|
90
71
|
|
|
91
|
-
|
|
72
|
+
1. Enter the lane detail view.
|
|
73
|
+
2. Press `I`.
|
|
74
|
+
3. Type your instructions (e.g., "Don't change the package.json, just fix the bug in utils.ts").
|
|
75
|
+
4. Press `Enter` to send.
|
|
92
76
|
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
# Inspect state.json for all lanes
|
|
96
|
-
for state in _cursorflow/logs/runs/*/lanes/*/state.json; do
|
|
97
|
-
echo "$(dirname $state):"
|
|
98
|
-
jq '.status, .currentTaskIndex, .totalTasks' $state
|
|
99
|
-
done
|
|
100
|
-
```
|
|
77
|
+
If `enableIntervention` is enabled in your task JSON, the agent receives this as its next prompt. If not, the message is logged but not injected.
|
|
101
78
|
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
79
|
+
**To enable intervention in your task JSON:**
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"enableIntervention": true,
|
|
83
|
+
"tasks": [...]
|
|
84
|
+
}
|
|
107
85
|
```
|
|
108
86
|
|
|
109
|
-
## Checklist
|
|
110
|
-
- [ ] Are lane states healthy?
|
|
111
|
-
- [ ] Did any errors occur?
|
|
112
|
-
- [ ] Have the logs been reviewed?
|
|
113
|
-
- [ ] Are any lanes blocked?
|
|
114
|
-
- [ ] Are there dependency issues?
|
|
115
|
-
|
|
116
|
-
## Troubleshooting
|
|
117
|
-
|
|
118
|
-
### Lane is stuck
|
|
119
|
-
1. Check status in `state.json`.
|
|
120
|
-
2. Inspect the last conversation in `conversation.jsonl`.
|
|
121
|
-
3. Resume if needed with `cursorflow resume <lane>`.
|
|
122
|
-
|
|
123
|
-
### Logs are missing
|
|
124
|
-
1. Confirm the run actually started.
|
|
125
|
-
2. Check log directory permissions.
|
|
126
|
-
3. Verify the `logsDir` path in the config file.
|
|
127
|
-
|
|
128
87
|
## Next steps
|
|
129
|
-
1.
|
|
130
|
-
2.
|
|
131
|
-
3. Analyze logs to identify improvements.
|
|
88
|
+
1. Once all lanes reach `completed`, you can review the generated branches.
|
|
89
|
+
2. Use `cursorflow clean` to remove temporary worktrees after you've merged the changes.
|
|
@@ -46,9 +46,15 @@ Prepare task files for a new feature by gathering requirements and generating la
|
|
|
46
46
|
"branchPrefix": "<feature>/<lane>-",
|
|
47
47
|
"executor": "cursor-agent",
|
|
48
48
|
"autoCreatePr": false,
|
|
49
|
-
"allowDependencyChange": false,
|
|
50
|
-
"lockfileReadOnly": true,
|
|
51
49
|
"pollInterval": 60,
|
|
50
|
+
|
|
51
|
+
"timeout": 300000,
|
|
52
|
+
"enableIntervention": false,
|
|
53
|
+
|
|
54
|
+
"dependencyPolicy": {
|
|
55
|
+
"allowDependencyChange": false,
|
|
56
|
+
"lockfileReadOnly": true
|
|
57
|
+
},
|
|
52
58
|
|
|
53
59
|
"laneNumber": 1,
|
|
54
60
|
"devPort": 3001,
|
|
@@ -70,6 +76,19 @@ Prepare task files for a new feature by gathering requirements and generating la
|
|
|
70
76
|
}
|
|
71
77
|
```
|
|
72
78
|
|
|
79
|
+
**Key Configuration Options:**
|
|
80
|
+
|
|
81
|
+
| Option | Type | Default | Description |
|
|
82
|
+
|--------|------|---------|-------------|
|
|
83
|
+
| `timeout` | number | 300000 | Task timeout in milliseconds |
|
|
84
|
+
| `enableIntervention` | boolean | false | Enable stdin piping for intervention |
|
|
85
|
+
| `dependsOn` | string[] | [] | Lane dependencies |
|
|
86
|
+
|
|
87
|
+
**Timeout Guidelines:**
|
|
88
|
+
- Simple tasks: `60000` (1 min)
|
|
89
|
+
- Medium tasks: `300000` (5 min) - default
|
|
90
|
+
- Complex tasks: `600000` (10 min)
|
|
91
|
+
|
|
73
92
|
4. **Model selection guide**
|
|
74
93
|
|
|
75
94
|
| Model | Purpose | Notes |
|
|
@@ -121,12 +140,16 @@ cursorflow prepare MyFeature --template ./my-template.json
|
|
|
121
140
|
- [ ] Have dependency changes been confirmed?
|
|
122
141
|
- [ ] Are the acceptance criteria clear?
|
|
123
142
|
- [ ] Have the generated files been reviewed?
|
|
143
|
+
- [ ] Are task names valid (letters, numbers, `-`, `_` only)?
|
|
144
|
+
- [ ] Is the timeout appropriate for task complexity?
|
|
124
145
|
|
|
125
146
|
## Notes
|
|
126
147
|
1. **Model names**: Use only valid models (check with the `models` command).
|
|
127
148
|
2. **Paths**: Always create tasks under `_cursorflow/tasks/`.
|
|
128
149
|
3. **Branch prefix**: Make it unique to avoid collisions.
|
|
129
150
|
4. **devPort**: Use unique ports per lane (3001, 3002, ...).
|
|
151
|
+
5. **Task names**: Must only contain letters, numbers, `-`, `_`. No spaces or special characters.
|
|
152
|
+
6. **Timeout**: Set based on task complexity. See timeout guidelines above.
|
|
130
153
|
|
|
131
154
|
## Next steps
|
|
132
155
|
1. Tailor the generated JSON files to the project.
|
|
@@ -163,6 +163,17 @@ git commit -m "fix: build error"
|
|
|
163
163
|
cursorflow resume 01-dashboard
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
### Scenario 5: Timeout errors
|
|
167
|
+
If the lane failed due to timeout:
|
|
168
|
+
1. Increase the timeout in your task JSON:
|
|
169
|
+
```json
|
|
170
|
+
{ "timeout": 600000 }
|
|
171
|
+
```
|
|
172
|
+
2. Resume the lane:
|
|
173
|
+
```bash
|
|
174
|
+
cursorflow resume 01-dashboard
|
|
175
|
+
```
|
|
176
|
+
|
|
166
177
|
### Scenario 3: Branch conflicts
|
|
167
178
|
```bash
|
|
168
179
|
# Clean branches then restart
|
|
@@ -1,129 +1,138 @@
|
|
|
1
1
|
# CursorFlow Run
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
|
-
Execute
|
|
4
|
+
Execute the AI agent orchestration for a set of tasks. CursorFlow uses a sophisticated DAG (Directed Acyclic Graph) scheduler to handle dependencies between tasks and ensure they run in the correct order.
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Usage
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
2. **Run multiple lanes**
|
|
14
|
-
```bash
|
|
15
|
-
cursorflow run _cursorflow/tasks/MyFeature/
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
3. **Run a single lane**
|
|
19
|
-
```bash
|
|
20
|
-
cursorflow lane _cursorflow/tasks/MyFeature/01-task.json
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
4. **Dry run (preview the plan)**
|
|
24
|
-
```bash
|
|
25
|
-
cursorflow run _cursorflow/tasks/MyFeature/ --dry-run
|
|
26
|
-
```
|
|
8
|
+
```bash
|
|
9
|
+
cursorflow run <tasks-dir> [options]
|
|
10
|
+
```
|
|
27
11
|
|
|
28
|
-
|
|
12
|
+
## How it works
|
|
29
13
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
1. **Validation**: CursorFlow validates all task configurations before starting.
|
|
15
|
+
2. **Task Loading**: Scans the specified directory for `.json` task files.
|
|
16
|
+
3. **Dependency Resolution**: Builds a graph based on the `dependsOn` field in each task.
|
|
17
|
+
4. **Execution**:
|
|
18
|
+
- Lanes with no unmet dependencies are started first.
|
|
19
|
+
- When a lane completes, it unlocks dependent lanes.
|
|
20
|
+
- Dependent lanes automatically merge the parent's branch before starting their first task.
|
|
21
|
+
5. **Monitoring**: Heartbeat logs every 30 seconds show progress.
|
|
22
|
+
6. **Concurrency**: Respects `maxConcurrentLanes` (set in `cursorflow.config.js`) to prevent overloading system resources.
|
|
34
23
|
|
|
35
24
|
## Options
|
|
36
25
|
|
|
37
26
|
| Option | Description |
|
|
38
27
|
|------|------|
|
|
39
|
-
|
|
|
40
|
-
| `--
|
|
41
|
-
| `--
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
| `<tasks-dir>` | Directory containing task JSON files (e.g., `_cursorflow/tasks/feature-x/`) |
|
|
29
|
+
| `--max-concurrent <num>` | Limit the number of parallel agents (overrides config) |
|
|
30
|
+
| `--dry-run` | Show the execution plan and dependency graph without starting agents |
|
|
31
|
+
|
|
32
|
+
## Task Definition (JSON)
|
|
33
|
+
|
|
34
|
+
### Full Configuration Schema
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"baseBranch": "main",
|
|
39
|
+
"branchPrefix": "cursorflow/feature-",
|
|
40
|
+
"model": "sonnet-4.5",
|
|
41
|
+
"timeout": 300000,
|
|
42
|
+
"enableIntervention": false,
|
|
43
|
+
"dependsOn": ["other-lane"],
|
|
44
|
+
"dependencyPolicy": {
|
|
45
|
+
"allowDependencyChange": false,
|
|
46
|
+
"lockfileReadOnly": true
|
|
47
|
+
},
|
|
48
|
+
"tasks": [
|
|
49
|
+
{
|
|
50
|
+
"name": "implement-feature",
|
|
51
|
+
"model": "gemini-3-flash",
|
|
52
|
+
"prompt": "Create a reusable button component..."
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
55
56
|
```
|
|
56
57
|
|
|
57
|
-
###
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
### Configuration Options
|
|
59
|
+
|
|
60
|
+
| Option | Type | Default | Description |
|
|
61
|
+
|--------|------|---------|-------------|
|
|
62
|
+
| `timeout` | number | 300000 | Task timeout in milliseconds |
|
|
63
|
+
| `enableIntervention` | boolean | false | Enable stdin piping for intervention feature |
|
|
64
|
+
| `model` | string | "sonnet-4.5" | Default AI model for all tasks |
|
|
65
|
+
| `dependsOn` | string[] | [] | Lane dependencies to merge before starting |
|
|
66
|
+
| `baseBranch` | string | "main" | Base branch for worktree |
|
|
67
|
+
| `branchPrefix` | string | "cursorflow/" | Prefix for created branches |
|
|
68
|
+
|
|
69
|
+
### Task Options
|
|
70
|
+
|
|
71
|
+
| Option | Type | Required | Description |
|
|
72
|
+
|--------|------|----------|-------------|
|
|
73
|
+
| `name` | string | ✅ | Unique task identifier (alphanumeric, `-`, `_` only) |
|
|
74
|
+
| `prompt` | string | ✅ | Task prompt for the AI agent |
|
|
75
|
+
| `model` | string | ❌ | Override model for this specific task |
|
|
76
|
+
|
|
77
|
+
### Example with Dependencies
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"name": "ui-components",
|
|
82
|
+
"dependsOn": ["theme-engine", "common-utils"],
|
|
83
|
+
"timeout": 600000,
|
|
84
|
+
"tasks": [
|
|
85
|
+
{
|
|
86
|
+
"name": "implement-button",
|
|
87
|
+
"prompt": "Create a reusable button component using the theme engine..."
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
60
91
|
```
|
|
61
92
|
|
|
62
|
-
##
|
|
93
|
+
## Validation Errors
|
|
63
94
|
|
|
64
|
-
|
|
65
|
-
- Load configuration
|
|
66
|
-
- Verify the `cursor-agent` CLI
|
|
67
|
-
- Confirm Git repository status
|
|
95
|
+
CursorFlow validates task files before execution and provides helpful error messages:
|
|
68
96
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
97
|
+
| Error | Solution |
|
|
98
|
+
|-------|----------|
|
|
99
|
+
| `Task N missing required "name" field` | Add `"name": "task-name"` to each task |
|
|
100
|
+
| `Task name contains invalid characters` | Use only letters, numbers, `-`, `_` |
|
|
101
|
+
| `"timeout" must be a positive number` | Provide timeout as milliseconds (e.g., `60000`) |
|
|
73
102
|
|
|
74
|
-
|
|
75
|
-
- Execute tasks sequentially
|
|
76
|
-
- Commit after each task
|
|
77
|
-
- Trigger automatic review when enabled
|
|
103
|
+
## Progress Monitoring
|
|
78
104
|
|
|
79
|
-
|
|
80
|
-
- Push changes
|
|
81
|
-
- Create a PR (depending on settings)
|
|
82
|
-
- Store logs
|
|
83
|
-
|
|
84
|
-
## Log location
|
|
85
|
-
|
|
86
|
-
Run logs are stored in `_cursorflow/logs/runs/`:
|
|
105
|
+
During execution, CursorFlow outputs heartbeat logs every 30 seconds:
|
|
87
106
|
|
|
88
107
|
```
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
├── results.json # Task results
|
|
92
|
-
├── conversation.jsonl # Agent conversation
|
|
93
|
-
├── git-operations.jsonl # Git activity log
|
|
94
|
-
└── events.jsonl # Event log
|
|
108
|
+
⏱ Heartbeat: 30s elapsed, 1234 bytes received
|
|
109
|
+
⏱ Heartbeat: 60s elapsed, 5678 bytes received
|
|
95
110
|
```
|
|
96
111
|
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
- [ ] Do branch names avoid collisions?
|
|
102
|
-
- [ ] Are required environment variables set? (for cloud runs)
|
|
112
|
+
This helps identify:
|
|
113
|
+
- Long-running tasks
|
|
114
|
+
- Stalled or hanging processes
|
|
115
|
+
- Network issues (0 bytes received)
|
|
103
116
|
|
|
104
|
-
##
|
|
117
|
+
## Best Practices
|
|
105
118
|
|
|
106
|
-
###
|
|
107
|
-
|
|
108
|
-
# Clean up existing branches
|
|
109
|
-
cursorflow clean branches --pattern "feature/my-*"
|
|
110
|
-
```
|
|
119
|
+
### Sequential Workflows
|
|
120
|
+
For tasks that must happen one after another, chain them using `dependsOn`. CursorFlow will handle the branch merges automatically.
|
|
111
121
|
|
|
112
|
-
###
|
|
113
|
-
|
|
114
|
-
# Clean up existing worktrees
|
|
115
|
-
cursorflow clean worktrees --all
|
|
116
|
-
```
|
|
122
|
+
### Parallel Workflows
|
|
123
|
+
Tasks that don't depend on each other will run in parallel up to the `maxConcurrentLanes` limit.
|
|
117
124
|
|
|
118
|
-
###
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
### Monitoring
|
|
126
|
+
Always use `cursorflow monitor latest` in a separate terminal to keep track of the run.
|
|
127
|
+
|
|
128
|
+
## Troubleshooting
|
|
129
|
+
|
|
130
|
+
### Deadlocks
|
|
131
|
+
If you create circular dependencies (e.g., A depends on B, and B depends on A), CursorFlow will detect the deadlock at startup and refuse to run.
|
|
125
132
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
133
|
+
### Merge Conflicts
|
|
134
|
+
If a parent lane and a child lane modify the same lines, a merge conflict might occur when the child starts.
|
|
135
|
+
1. The monitor will show the lane as `failed` with a merge error.
|
|
136
|
+
2. Go to the lane's worktree (found in the monitor detail).
|
|
137
|
+
3. Manually resolve the conflict.
|
|
138
|
+
4. Run `cursorflow resume <lane>` to continue.
|
|
@@ -1,19 +1,90 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CursorFlow Signal & Intervention
|
|
2
2
|
|
|
3
|
-
##
|
|
4
|
-
Directly intervene in a running lane to provide guidance, corrections, or
|
|
3
|
+
## Overview
|
|
4
|
+
Directly intervene in a running lane to provide guidance, corrections, or mid-task instructions. This is one of CursorFlow's most powerful features for "human-in-the-loop" AI orchestration.
|
|
5
5
|
|
|
6
|
-
##
|
|
7
|
-
1. Type `/cursorflow-signal <lane-name> <your-message>` in the chat.
|
|
8
|
-
2. The message will be injected into the lane's conversation as a high-priority system instruction.
|
|
6
|
+
## ⚠️ Prerequisites
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
Use this command when:
|
|
12
|
-
- You see an agent making a repeated mistake in the monitor.
|
|
13
|
-
- You want to provide specific implementation guidance mid-task.
|
|
14
|
-
- You need to tell the agent to stop or change direction without killing the process.
|
|
8
|
+
**Intervention requires `enableIntervention: true` in your task configuration!**
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
10
|
+
```json
|
|
11
|
+
{
|
|
12
|
+
"enableIntervention": true,
|
|
13
|
+
"tasks": [...]
|
|
14
|
+
}
|
|
15
|
+
```
|
|
19
16
|
|
|
17
|
+
> **Note**: Enabling intervention uses stdin piping, which may cause stdout buffering issues on some systems. If you experience timeout issues, try disabling intervention.
|
|
18
|
+
|
|
19
|
+
## Methods of Intervention
|
|
20
|
+
|
|
21
|
+
### 1. via Interactive Monitor (Recommended)
|
|
22
|
+
The easiest way to intervene is through the dashboard:
|
|
23
|
+
1. Run `cursorflow monitor latest`.
|
|
24
|
+
2. Enter the lane detail view (`→`).
|
|
25
|
+
3. Press **`I`**.
|
|
26
|
+
4. Type your message and press **Enter**.
|
|
27
|
+
|
|
28
|
+
### 2. via CLI / Cursor Command
|
|
29
|
+
You can also send a signal from any terminal or via the Cursor chat:
|
|
30
|
+
```bash
|
|
31
|
+
cursorflow signal <lane-name> "Your message here"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## When to use it
|
|
35
|
+
- **Guidance**: "Focus on the `utils/` directory first."
|
|
36
|
+
- **Correction**: "You are using the wrong API version. Use v2 instead."
|
|
37
|
+
- **Emergency**: "Stop! I just found a critical bug in the base branch."
|
|
38
|
+
- **Clarification**: If the agent is stuck or asking a question in its log.
|
|
39
|
+
|
|
40
|
+
## How it works
|
|
41
|
+
1. Your message is written to an `intervention.txt` file in the lane's log directory.
|
|
42
|
+
2. The CursorFlow runner, which is watching this file, detects the change.
|
|
43
|
+
3. **If `enableIntervention: true`**: It immediately injects your message into the `cursor-agent`'s standard input (stdin).
|
|
44
|
+
4. **If `enableIntervention: false`**: The message is logged but cannot be injected (warning displayed).
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
### Enable Intervention
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"enableIntervention": true,
|
|
53
|
+
"timeout": 300000,
|
|
54
|
+
"tasks": [
|
|
55
|
+
{
|
|
56
|
+
"name": "my-task",
|
|
57
|
+
"prompt": "..."
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Default Behavior (Intervention Disabled)
|
|
64
|
+
|
|
65
|
+
By default, `enableIntervention` is `false` to avoid potential buffering issues. When disabled:
|
|
66
|
+
- Signal commands will still work but messages are **logged only**
|
|
67
|
+
- The agent will **not receive** the injected message
|
|
68
|
+
- A warning will be shown: `Intervention requested but stdin not available`
|
|
69
|
+
|
|
70
|
+
## PID Control (Emergency Stop)
|
|
71
|
+
If an intervention isn't enough and the agent is "looping" or stuck:
|
|
72
|
+
- In the monitor, press **`K`** to kill the process via its PID.
|
|
73
|
+
- This is a hard stop and will immediately terminate the `cursor-agent` for that lane.
|
|
74
|
+
|
|
75
|
+
## Troubleshooting
|
|
76
|
+
|
|
77
|
+
### "Intervention requested but stdin not available"
|
|
78
|
+
|
|
79
|
+
This means `enableIntervention` is not set to `true` in your task JSON.
|
|
80
|
+
|
|
81
|
+
**Solution**: Add `"enableIntervention": true` to your task configuration.
|
|
82
|
+
|
|
83
|
+
### Intervention causes timeout
|
|
84
|
+
|
|
85
|
+
On some systems, enabling stdin piping can cause stdout buffering issues.
|
|
86
|
+
|
|
87
|
+
**Solution**:
|
|
88
|
+
1. Disable intervention: `"enableIntervention": false`
|
|
89
|
+
2. Increase timeout: `"timeout": 600000`
|
|
90
|
+
3. Use `K` (Kill) in monitor for emergency stops instead
|