@leclabs/agent-flow-navigator-mcp 1.1.0 → 1.3.0

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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  A workflow state machine MCP server that navigates agents through DAG-based workflows.
6
6
 
7
- Navigator tracks task state and evaluates graph edges - it tells the orchestrator _where to go next_, but doesn't drive. Think of it like a GPS: you tell it where you are and what happened, it tells you where to go.
7
+ Navigator tracks task state and evaluates graph edges -- it tells the orchestrator _where to go next_, but doesn't drive. Think of it like a GPS: you tell it where you are and what happened, it tells you where to go.
8
8
 
9
9
  ## Installation
10
10
 
@@ -39,21 +39,21 @@ Add to your `.mcp.json`:
39
39
 
40
40
  Navigator works with the [flow plugin](https://github.com/leclabs/agent-toolkit/tree/main/plugins/flow) to provide structured workflow execution:
41
41
 
42
- 1. **Initialize workflows** - Copy workflow templates to your project with `CopyWorkflows`
43
- 2. **Start a task** - Use `Navigate` with a workflow type and description
44
- 3. **Follow the flow** - Navigator tells you the current step and what to do
45
- 4. **Advance on completion** - Report `passed` or `failed` to move to the next step
42
+ 1. **Initialize workflows** -- Copy workflow templates to your project with `CopyWorkflows`
43
+ 2. **Start a task** -- Use `Navigate` with a workflow type and description
44
+ 3. **Follow the flow** -- Navigator tells you the current step and what to do
45
+ 4. **Advance on completion** -- Report `passed` or `failed` to move to the next step
46
46
 
47
47
  ```
48
48
  User: "Add dark mode support"
49
49
 
50
50
  Navigate(workflowType: "feature-development", description: "Add dark mode support")
51
51
 
52
- Navigator returns: Step 1 of 8 - "Create implementation plan"
52
+ Navigator returns: currentStep: "parse_requirements", stage: "planning"
53
53
 
54
- Agent executes step, then calls Navigate(result: "passed")
54
+ Agent executes step, then calls Navigate(taskFilePath: "...", result: "passed")
55
55
 
56
- Navigator returns: Step 2 of 8 - "Implement changes"
56
+ Navigator returns: currentStep: "explore_codebase", stage: "planning"
57
57
 
58
58
  ... continues through workflow ...
59
59
  ```
@@ -71,7 +71,11 @@ Navigator returns: Step 2 of 8 - "Implement changes"
71
71
 
72
72
  ### Navigate
73
73
 
74
- The primary tool for workflow navigation.
74
+ The primary tool. Operates in 3 modes:
75
+
76
+ - **Start**: Pass `workflowType` + `description` to begin a workflow
77
+ - **Current**: Pass `taskFilePath` to get current step state
78
+ - **Advance**: Pass `taskFilePath` + `result` to move to the next step
75
79
 
76
80
  | Parameter | Type | Description |
77
81
  | -------------- | -------------------- | --------------------------------------------------------- |
@@ -89,54 +93,65 @@ Generates a mermaid diagram for visualizing workflow structure.
89
93
  | `workflowType` | string | Workflow ID to visualize (required) |
90
94
  | `currentStep` | string | Optional step to highlight |
91
95
 
92
- ## Architecture Overview
96
+ ### ListWorkflows
97
+
98
+ Lists available workflows, filterable by source.
99
+
100
+ | Parameter | Type | Description |
101
+ | --------- | ------ | --------------------------------------------------------------------------- |
102
+ | `source` | string | Filter: `"project"`, `"catalog"`, or `"all"`. Defaults to project if exists |
103
+
104
+ ### SelectWorkflow
105
+
106
+ Returns a workflow selection dialog for user interaction. No parameters.
107
+
108
+ ### CopyWorkflows
109
+
110
+ Copies workflows from catalog to the project's `.flow/workflows/` directory.
111
+
112
+ | Parameter | Type | Description |
113
+ | ------------- | -------- | -------------------------------------- |
114
+ | `workflowIds` | string[] | Workflow IDs to copy. Empty = copy all |
115
+
116
+ ### ListCatalog
117
+
118
+ Lists workflows available in the built-in catalog. No parameters.
119
+
120
+ ## Architecture
93
121
 
94
122
  ```
95
- ┌─────────────────────────────────────────────────────────────────────┐
96
- ORCHESTRATOR
97
- │ (Source of Truth: GitHub Issues, External DB, etc.)
98
- │ (Executes tasks, makes decisions, drives the workflow) │
99
- └─────────────────────────┬───────────────────────────────────────────┘
100
-
101
- ┌───────────────┼───────────────┐
102
- load_workflow │ load_task_tree│
103
- │ │
104
- ▼ ▼ │
105
- ┌─────────────────────────────────────────┴───────────────────────────┐
106
- NAVIGATOR
107
- (Workflow State Machine MCP Server)
108
-
109
- ┌──────────────────┐ ┌──────────────────┐
110
- │ │ Workflow Store │Task Tree
111
- │ (Graph Defs) │ │ (State Tracker)
112
- └──────────────────┘ └──────────────────┘
113
-
114
- ┌──────────────────┐ ┌──────────────────┐
115
- │ │ Edge Evaluator │ │ Sync Tracker │ │
116
- │ │ (Next Step?) │ │ (Pending Syncs) │ │
117
- │ └──────────────────┘ └──────────────────┘ │
118
- │ │
119
- └─────────────────────────┬───────────────────────────────────────────┘
120
-
121
- ┌───────────────┼───────────────┐
122
- │ get_next_tasks│ advance_task │
123
- │ "What's next?"│ "I got X" │
124
- ▼ ▼ │
125
- ┌─────────────────────────────────────────┴───────────────────────────┐
126
- │ ORCHESTRATOR │
127
- │ (Receives directions, executes, persists, confirms syncs) │
128
- └─────────────────────────────────────────────────────────────────────┘
123
+ ┌─────────────────────────────────────────────────┐
124
+ ORCHESTRATOR
125
+ │ (Executes tasks, delegates to subagents)
126
+ └──────────────────────┬──────────────────────────┘
127
+
128
+ Navigate ───────┼─────── Diagram
129
+ ListWorkflows ──┤ CopyWorkflows
130
+ SelectWorkflow ─┤ ListCatalog
131
+
132
+ ┌──────────────────────┴──────────────────────────┐
133
+ │ NAVIGATOR │
134
+ (Workflow State Machine MCP)
135
+
136
+ ┌──────────────────┐ ┌──────────────────┐
137
+ │ │ Workflow Store │ │ Edge Evaluator │ │
138
+ │ │ (Graph Defs) │ (Next Step?)
139
+ └──────────────────┘ └──────────────────┘
140
+
141
+ Write-through: state transitions persist
142
+ atomically to the task file on disk
143
+ └─────────────────────────────────────────────────┘
129
144
  ```
130
145
 
131
146
  ### Key Concepts
132
147
 
133
- | Concept | Description |
134
- | ----------------------- | ------------------------------------------------------------------------------------ |
135
- | **Workflow Definition** | A DAG blueprint describing how to execute a type of work (nodes + conditional edges) |
136
- | **Task Tree** | A runtime priority queue of actual work items across multiple workflow types |
137
- | **Sync Tracking** | Mutations are tracked; orchestrator is reminded to persist to primary store |
138
- | **Conditional Edges** | Edges with `on` condition (passed/failed) - retry logic is on nodes via `maxRetries` |
139
- | **HITL Escalation** | When retries are exhausted, tasks route to end nodes with `escalation: "hitl"` |
148
+ | Concept | Description |
149
+ | ----------------------- | ------------------------------------------------------------------------------------- |
150
+ | **Workflow Definition** | A DAG blueprint describing how to execute a type of work (nodes + conditional edges) |
151
+ | **Navigate 3-Mode API** | Start a workflow, get current state, or advance -- one tool, three calling patterns |
152
+ | **Write-Through** | State transitions are persisted to the task file atomically on every advance |
153
+ | **Conditional Edges** | Edges with `on` condition (passed/failed) -- retry logic is on nodes via `maxRetries` |
154
+ | **HITL Escalation** | When retries are exhausted, tasks route to end nodes with `escalation: "hitl"` |
140
155
 
141
156
  ## Workflow Definition Schema
142
157
 
@@ -159,89 +174,24 @@ Generates a mermaid diagram for visualizing workflow structure.
159
174
 
160
175
  ### Task/Gate Node Properties
161
176
 
162
- | Property | Description |
163
- | ------------ | ---------------------------------------------------------- |
164
- | `name` | Human-readable name (required) |
165
- | `outputs` | Possible outcomes (default: `["passed", "failed"]`) |
166
- | `maxRetries` | Retry count on failure before following "failed" edge |
167
- | `agent` | Agent type to perform this task |
168
- | `stage` | Workflow phase: planning/development/verification/delivery |
177
+ | Property | Description |
178
+ | ------------ | -------------------------------------------------------------------- |
179
+ | `name` | Human-readable name (required) |
180
+ | `outputs` | Possible outcomes (default: `["passed", "failed"]`) |
181
+ | `maxRetries` | Retry count on failure before following "failed" edge |
182
+ | `agent` | Agent type to perform this task |
183
+ | `stage` | Workflow phase (e.g., planning, development, verification, delivery) |
184
+ | `metadata` | Arbitrary key-value data for workflow tooling and extensions |
169
185
 
170
186
  ### Edge Properties
171
187
 
172
- | Property | Description |
173
- | -------- | -------------------------------------------------------------- |
174
- | `from` | Source node ID |
175
- | `to` | Target node ID |
176
- | `on` | Output value that triggers this edge (for conditional routing) |
177
- | `label` | Human-readable edge description |
178
-
179
- ## Advanced Usage
180
-
181
- ### Loading Workflow Definitions
182
-
183
- ```json
184
- {
185
- "tool": "load_workflow",
186
- "arguments": {
187
- "id": "ui-reconstruction",
188
- "definition": {
189
- "nodes": {
190
- "start": { "type": "start" },
191
- "analyze": { "type": "task", "name": "Analyze Components" },
192
- "review": { "type": "gate", "name": "Review Analysis", "maxRetries": 3 },
193
- "end": { "type": "end", "result": "success" },
194
- "hitl": { "type": "end", "result": "blocked", "escalation": "hitl" }
195
- },
196
- "edges": [
197
- { "from": "start", "to": "analyze" },
198
- { "from": "analyze", "to": "review" },
199
- { "from": "review", "to": "analyze", "on": "failed", "label": "Retry on failure" },
200
- { "from": "review", "to": "hitl", "on": "max_retries_exceeded", "label": "Escalate after 3 failures" },
201
- { "from": "review", "to": "end", "on": "passed" }
202
- ]
203
- }
204
- }
205
- }
206
- ```
207
-
208
- ### Task Tree Management
209
-
210
- Load a priority queue of tasks:
211
-
212
- ```json
213
- {
214
- "tool": "load_task_tree",
215
- "arguments": {
216
- "tasks": [
217
- {
218
- "id": "task-001",
219
- "issueId": "ISSUE-042",
220
- "workflowType": "ui-reconstruction",
221
- "currentStep": "start",
222
- "priority": 100,
223
- "status": "PENDING",
224
- "context": { "targetUrl": "https://example.com" }
225
- }
226
- ]
227
- }
228
- }
229
- ```
230
-
231
- ### Advancing Tasks
232
-
233
- After executing a task step:
234
-
235
- ```json
236
- {
237
- "tool": "advance_task",
238
- "arguments": {
239
- "taskId": "task-001",
240
- "result": "passed",
241
- "output": "Analysis complete, found 5 components"
242
- }
243
- }
244
- ```
188
+ | Property | Description |
189
+ | ----------- | -------------------------------------------------------------- |
190
+ | `from` | Source node ID |
191
+ | `to` | Target node ID |
192
+ | `on` | Output value that triggers this edge (for conditional routing) |
193
+ | `label` | Human-readable edge description |
194
+ | `condition` | Expression for future conditional routing (informational) |
245
195
 
246
196
  ## Testing
247
197
 
@@ -253,8 +203,7 @@ npm test
253
203
 
254
204
  - [GitHub Repository](https://github.com/leclabs/agent-toolkit)
255
205
  - [Flow Plugin](https://github.com/leclabs/agent-toolkit/tree/main/plugins/flow)
256
- - [Full Documentation](https://github.com/leclabs/agent-toolkit/tree/main/packages/agent-flow-navigator-mcp)
257
206
 
258
207
  ## License
259
208
 
260
- MIT
209
+ ISC
@@ -125,6 +125,12 @@
125
125
  {
126
126
  "from": "commit",
127
127
  "to": "end_success"
128
+ },
129
+ {
130
+ "from": "hitl_failed",
131
+ "to": "implement",
132
+ "on": "passed",
133
+ "label": "Human resolved issue, resume"
128
134
  }
129
135
  ]
130
136
  }
@@ -148,6 +148,18 @@
148
148
  {
149
149
  "from": "commit",
150
150
  "to": "end_success"
151
+ },
152
+ {
153
+ "from": "hitl_cannot_reproduce",
154
+ "to": "reproduce",
155
+ "on": "passed",
156
+ "label": "Human provided reproduction info, resume"
157
+ },
158
+ {
159
+ "from": "hitl_fix_failed",
160
+ "to": "write_fix",
161
+ "on": "passed",
162
+ "label": "Human resolved fix issue, resume"
151
163
  }
152
164
  ]
153
165
  }
@@ -0,0 +1,116 @@
1
+ {
2
+ "id": "build-review-murder-board",
3
+ "name": "Build-Review Murder Board",
4
+ "description": "High-scrutiny iterative build-review loop. A fresh reviewer agent tears apart each build attempt with maximum rigor. Ideal for critical changes requiring independent verification.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start",
9
+ "description": "Build-review cycle begins"
10
+ },
11
+ "build": {
12
+ "type": "task",
13
+ "name": "Build",
14
+ "description": "Implement or revise the changes based on requirements or review feedback",
15
+ "agent": "Developer",
16
+ "stage": "development"
17
+ },
18
+ "review": {
19
+ "type": "gate",
20
+ "name": "Murder Board Review",
21
+ "description": "Independent high-scrutiny review. Reviewer must be a fresh agent with no prior context of this build. Approval requires confidence score >= 80.",
22
+ "agent": "Reviewer",
23
+ "stage": "verification",
24
+ "maxRetries": 3,
25
+ "config": {
26
+ "scrutinyLevel": 5,
27
+ "blindShot": true,
28
+ "approvalThreshold": 80
29
+ }
30
+ },
31
+ "lint_format": {
32
+ "type": "gate",
33
+ "name": "Lint & Format",
34
+ "description": "Run lint and format checks. Auto-fix issues where possible.",
35
+ "agent": "Developer",
36
+ "stage": "delivery",
37
+ "maxRetries": 3
38
+ },
39
+ "commit": {
40
+ "type": "task",
41
+ "name": "Commit Changes",
42
+ "description": "Commit all changes with a descriptive message summarizing the work done",
43
+ "agent": "Developer",
44
+ "stage": "delivery"
45
+ },
46
+ "end_success": {
47
+ "type": "end",
48
+ "result": "success",
49
+ "name": "Approved",
50
+ "description": "Build passed murder board review and delivered"
51
+ },
52
+ "hitl_blocked": {
53
+ "type": "end",
54
+ "result": "blocked",
55
+ "escalation": "hitl",
56
+ "name": "Review Blocked",
57
+ "description": "Build failed murder board review after all retries - needs human intervention"
58
+ }
59
+ },
60
+ "edges": [
61
+ {
62
+ "from": "start",
63
+ "to": "build"
64
+ },
65
+ {
66
+ "from": "build",
67
+ "to": "review"
68
+ },
69
+ {
70
+ "from": "review",
71
+ "to": "build",
72
+ "on": "failed",
73
+ "label": "Revise build based on review feedback"
74
+ },
75
+ {
76
+ "from": "review",
77
+ "to": "hitl_blocked",
78
+ "on": "failed",
79
+ "label": "Review failures exhausted retries"
80
+ },
81
+ {
82
+ "from": "review",
83
+ "to": "lint_format",
84
+ "on": "passed",
85
+ "label": "Review passed, run lint checks"
86
+ },
87
+ {
88
+ "from": "lint_format",
89
+ "to": "commit",
90
+ "on": "passed",
91
+ "label": "Lint passes, commit changes"
92
+ },
93
+ {
94
+ "from": "lint_format",
95
+ "to": "build",
96
+ "on": "failed",
97
+ "label": "Fix lint/format issues"
98
+ },
99
+ {
100
+ "from": "lint_format",
101
+ "to": "hitl_blocked",
102
+ "on": "failed",
103
+ "label": "Lint issues persist"
104
+ },
105
+ {
106
+ "from": "commit",
107
+ "to": "end_success"
108
+ },
109
+ {
110
+ "from": "hitl_blocked",
111
+ "to": "build",
112
+ "on": "passed",
113
+ "label": "Human resolved issue, resume"
114
+ }
115
+ ]
116
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "id": "build-review-quick",
3
+ "name": "Build-Review Quick",
4
+ "description": "Low-scrutiny iterative build-review loop. A lightweight review pass ensures basic correctness before delivery. Suited for low-risk or well-understood changes.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start",
9
+ "description": "Build-review cycle begins"
10
+ },
11
+ "build": {
12
+ "type": "task",
13
+ "name": "Build",
14
+ "description": "Implement or revise the changes based on requirements or review feedback",
15
+ "agent": "Developer",
16
+ "stage": "development"
17
+ },
18
+ "review": {
19
+ "type": "gate",
20
+ "name": "Quick Review",
21
+ "description": "Lightweight review checking basic correctness and completeness",
22
+ "agent": "Reviewer",
23
+ "stage": "verification",
24
+ "maxRetries": 2,
25
+ "config": {
26
+ "scrutinyLevel": 1
27
+ }
28
+ },
29
+ "lint_format": {
30
+ "type": "gate",
31
+ "name": "Lint & Format",
32
+ "description": "Run lint and format checks. Auto-fix issues where possible.",
33
+ "agent": "Developer",
34
+ "stage": "delivery",
35
+ "maxRetries": 3
36
+ },
37
+ "commit": {
38
+ "type": "task",
39
+ "name": "Commit Changes",
40
+ "description": "Commit all changes with a descriptive message summarizing the work done",
41
+ "agent": "Developer",
42
+ "stage": "delivery"
43
+ },
44
+ "end_success": {
45
+ "type": "end",
46
+ "result": "success",
47
+ "name": "Complete",
48
+ "description": "Build passed review and delivered"
49
+ },
50
+ "hitl_blocked": {
51
+ "type": "end",
52
+ "result": "blocked",
53
+ "escalation": "hitl",
54
+ "name": "Blocked",
55
+ "description": "Build failed review after all retries - needs human intervention"
56
+ }
57
+ },
58
+ "edges": [
59
+ {
60
+ "from": "start",
61
+ "to": "build"
62
+ },
63
+ {
64
+ "from": "build",
65
+ "to": "review"
66
+ },
67
+ {
68
+ "from": "review",
69
+ "to": "build",
70
+ "on": "failed",
71
+ "label": "Revise build based on review feedback"
72
+ },
73
+ {
74
+ "from": "review",
75
+ "to": "hitl_blocked",
76
+ "on": "failed",
77
+ "label": "Review failures exhausted retries"
78
+ },
79
+ {
80
+ "from": "review",
81
+ "to": "lint_format",
82
+ "on": "passed",
83
+ "label": "Review passed, run lint checks"
84
+ },
85
+ {
86
+ "from": "lint_format",
87
+ "to": "commit",
88
+ "on": "passed",
89
+ "label": "Lint passes, commit changes"
90
+ },
91
+ {
92
+ "from": "lint_format",
93
+ "to": "build",
94
+ "on": "failed",
95
+ "label": "Fix lint/format issues"
96
+ },
97
+ {
98
+ "from": "lint_format",
99
+ "to": "hitl_blocked",
100
+ "on": "failed",
101
+ "label": "Lint issues persist"
102
+ },
103
+ {
104
+ "from": "commit",
105
+ "to": "end_success"
106
+ },
107
+ {
108
+ "from": "hitl_blocked",
109
+ "to": "build",
110
+ "on": "passed",
111
+ "label": "Human resolved issue, resume"
112
+ }
113
+ ]
114
+ }
@@ -61,12 +61,19 @@
61
61
  "name": "Complete",
62
62
  "description": "Context optimization complete"
63
63
  },
64
- "hitl_failed": {
64
+ "hitl_design_failed": {
65
65
  "type": "end",
66
66
  "result": "blocked",
67
67
  "escalation": "hitl",
68
- "name": "Needs Help",
69
- "description": "Optimization needs human guidance"
68
+ "name": "Design Needs Help",
69
+ "description": "Design optimization needs human guidance"
70
+ },
71
+ "hitl_verify_failed": {
72
+ "type": "end",
73
+ "result": "blocked",
74
+ "escalation": "hitl",
75
+ "name": "Verification Needs Help",
76
+ "description": "Verification needs human intervention"
70
77
  }
71
78
  },
72
79
  "edges": [
@@ -94,7 +101,7 @@
94
101
  },
95
102
  {
96
103
  "from": "review_design",
97
- "to": "hitl_failed",
104
+ "to": "hitl_design_failed",
98
105
  "on": "failed",
99
106
  "label": "Design needs human input"
100
107
  },
@@ -116,7 +123,7 @@
116
123
  },
117
124
  {
118
125
  "from": "verify",
119
- "to": "hitl_failed",
126
+ "to": "hitl_verify_failed",
120
127
  "on": "failed",
121
128
  "label": "Verification failed"
122
129
  },
@@ -125,6 +132,18 @@
125
132
  "to": "end_success",
126
133
  "on": "passed",
127
134
  "label": "Optimization verified"
135
+ },
136
+ {
137
+ "from": "hitl_design_failed",
138
+ "to": "design_improvements",
139
+ "on": "passed",
140
+ "label": "Human resolved design issue, resume"
141
+ },
142
+ {
143
+ "from": "hitl_verify_failed",
144
+ "to": "implement",
145
+ "on": "passed",
146
+ "label": "Human resolved verification issue, resume"
128
147
  }
129
148
  ]
130
149
  }
@@ -220,6 +220,18 @@
220
220
  {
221
221
  "from": "create_pr",
222
222
  "to": "end_success"
223
+ },
224
+ {
225
+ "from": "hitl_plan_failed",
226
+ "to": "create_plan",
227
+ "on": "passed",
228
+ "label": "Human resolved planning issue, resume"
229
+ },
230
+ {
231
+ "from": "hitl_impl_failed",
232
+ "to": "implement",
233
+ "on": "passed",
234
+ "label": "Human resolved implementation issue, resume"
223
235
  }
224
236
  ]
225
237
  }
@@ -0,0 +1,46 @@
1
+ {
2
+ "id": "hitl-test",
3
+ "name": "HITL Test",
4
+ "description": "Minimal workflow for testing HITL recovery: work, gate, escalate, human resumes.",
5
+ "nodes": {
6
+ "start": {
7
+ "type": "start",
8
+ "name": "Start"
9
+ },
10
+ "work": {
11
+ "type": "task",
12
+ "name": "Do Work",
13
+ "description": "Do the thing",
14
+ "agent": "Developer",
15
+ "stage": "development"
16
+ },
17
+ "check": {
18
+ "type": "gate",
19
+ "name": "Check",
20
+ "description": "Pass or fail",
21
+ "agent": "Reviewer",
22
+ "stage": "verification",
23
+ "maxRetries": 1
24
+ },
25
+ "end_success": {
26
+ "type": "end",
27
+ "result": "success",
28
+ "name": "Done"
29
+ },
30
+ "hitl_blocked": {
31
+ "type": "end",
32
+ "result": "blocked",
33
+ "escalation": "hitl",
34
+ "name": "Blocked",
35
+ "description": "Needs human help"
36
+ }
37
+ },
38
+ "edges": [
39
+ { "from": "start", "to": "work" },
40
+ { "from": "work", "to": "check" },
41
+ { "from": "check", "to": "end_success", "on": "passed" },
42
+ { "from": "check", "to": "work", "on": "failed", "label": "Retry" },
43
+ { "from": "check", "to": "hitl_blocked", "on": "failed", "label": "Escalate" },
44
+ { "from": "hitl_blocked", "to": "work", "on": "passed", "label": "Human fixed it, resume" }
45
+ ]
46
+ }