@mrclrchtr/supi-flow 0.10.1 → 0.11.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
@@ -1,164 +1,243 @@
1
1
  # supi-flow
2
2
 
3
- PI extension for spec-driven workflow with TNDM ticket coordination (optional for trivial changes).
4
-
5
- ## Flow
6
-
7
- ```mermaid
8
- flowchart TD
9
- START(["Start a change"]) --> BRAIN
10
- BRAIN["/skill:supi-flow-brainstorm
11
- HARD-GATE: no code yet
12
- Explore, design, approve
13
- Classify trivial vs non-trivial"]
14
- BRAIN --> APPROVED{Design approved?}
15
- APPROVED -->|"No"| BRAIN
16
- APPROVED -->|"Yes"| TRIVIAL{Trivial change?}
17
-
18
- TRIVIAL -->|"Yes (skip ticket)"| LIGHT["Implement directly
19
- No ticket needed"]
20
- TRIVIAL -->|"No"| PLAN
21
-
22
- PLAN["/skill:supi-flow-plan [ID]
23
- Bite-sized tasks
24
- Exact file paths
25
- No placeholders
26
- TDD: red-green-refactor
27
- Stores plan via supi_flow_plan"]
28
- PLAN --> APPROVE2{"Plan approved?"}
29
- APPROVE2 -->|"No"| PLAN
30
- APPROVE2 -->|"Yes"| APPLY
31
-
32
- APPLY["/skill:supi-flow-apply [ID]
33
- Iron Law: fresh verify each task
34
- TDD gate: test-first or delete
35
- Sets flow:applying at start
36
- Checks off tasks via supi_flow_complete_task"]
37
- APPLY --> BLOCKED{"Verification
38
- failed?"}
39
-
40
- BLOCKED -->|"Yes"| DEBUG["/skill:supi-flow-debug
41
- 4-phase systematic debugging
42
- 3-fix → question architecture"]
43
- DEBUG --> FIXED{Fixed?}
44
- FIXED -->|"Yes"| APPLY
45
- FIXED -->|"No"| USER["Talk to user
46
- before fix #4"]
47
-
48
- BLOCKED -->|"No"| DONE{"All tasks
49
- done?"}
50
- DONE -->|"No"| APPLY
51
- DONE -->|"Yes"| ARCHIVE
52
-
53
- ARCHIVE["/skill:supi-flow-archive [ID]
54
- Fresh verification (gate function)
55
- Update living documentation
56
- Quality gate checklist"]
57
- ARCHIVE --> QGATE{"Quality gate
58
- passes?"}
59
- QGATE -->|"No"| ARCHIVE
60
- QGATE -->|"Yes"| CLOSE
61
-
62
- CLOSE["supi_flow_close
63
- Sets status=done, flow:done
64
- Writes archive.md"]
65
-
66
- classDef phase fill:#e8f5e9,stroke:#4caf50,stroke-width:2
67
- classDef decision fill:#e3f2fd,stroke:#2196f3
68
- classDef entry fill:#e8e8e8,stroke:#666
69
- classDef blocker fill:#ffebee,stroke:#f44336
70
-
71
- class BRAIN,PLAN,APPLY,ARCHIVE,CLOSE phase
72
- class APPROVED,APPROVE2,BLOCKED,FIXED,DONE,TRIVIAL decision
73
- class START entry
74
- class USER blocker
75
- class LIGHT entry
3
+ > **PI-only workflow package for spec-driven changes backed by TNDM tickets.**
4
+
5
+ `supi-flow` adds a lightweight workflow on top of tandem's `tndm` CLI:
6
+ **brainstorm → plan → apply → archive**.
7
+
8
+ It is published as `@mrclrchtr/supi-flow` and ships inside the tandem repository at
9
+ `plugins/supi-flow/`.
10
+
11
+ Use it when a change needs:
12
+
13
+ - an approved design before implementation
14
+ - a durable TNDM ticket for non-trivial work
15
+ - explicit task-by-task verification during implementation
16
+ - archived verification evidence at closeout
17
+
18
+ Trivial changes can still be implemented directly without a ticket.
19
+
20
+ ## What ships in the package
21
+
22
+ `supi-flow` uses PI's conventional package directories, so PI auto-discovers the resources in:
23
+
24
+ - `extensions/`
25
+ - `skills/`
26
+ - `prompts/`
27
+
28
+ Current package contents:
29
+
30
+ - **7 custom tools**
31
+ - `supi_tndm_cli`
32
+ - `supi_flow_start`
33
+ - `supi_flow_plan`
34
+ - `supi_flow_apply`
35
+ - `supi_flow_task`
36
+ - `supi_flow_complete_task`
37
+ - `supi_flow_close`
38
+ - **5 skills**
39
+ - `supi-flow-brainstorm`
40
+ - `supi-flow-plan`
41
+ - `supi-flow-apply`
42
+ - `supi-flow-archive`
43
+ - `supi-flow-debug`
44
+ - **1 prompt template**
45
+ - `/supi-coding-retro`
46
+ - **Startup/reload version check**
47
+ - on PI session start and reload, the extension compares `tndm --version` with the package version and warns when they do not match
48
+
49
+ This package does **not** rely on a `pi` manifest in `package.json`; it uses PI's conventional directory discovery.
50
+
51
+ ## Installation and loading
52
+
53
+ ### Install from npm
54
+
55
+ ```bash
56
+ pi install npm:@mrclrchtr/supi-flow
76
57
  ```
77
58
 
78
- Non-trivial flows require a TNDM ticket created by `supi_flow_start`. Trivial changes can be implemented directly without a ticket.
59
+ ### Install from a local checkout
79
60
 
80
- ## Skills
61
+ From the tandem repository root:
81
62
 
82
- Five skills ship under `skills/`:
63
+ ```bash
64
+ pi install ./plugins/supi-flow
65
+ ```
83
66
 
84
- | Skill | Trigger | Purpose |
85
- |---|---|---|
86
- | `supi-flow-brainstorm` | `/supi-flow-brainstorm` | Explore intent and design, classify trivial vs non-trivial, create ticket if needed |
87
- | `supi-flow-plan` | `/supi-flow-plan [ID]` | Create bite-sized implementation plan |
88
- | `supi-flow-apply` | `/supi-flow-apply` | Execute plan task by task |
89
- | `supi-flow-archive` | `/supi-flow-archive` | Verify, update docs, close out |
90
- | `supi-flow-debug` | Loaded on demand when blocked | Root-cause debugging protocol |
67
+ Or add the package root to PI settings:
91
68
 
92
- ## Tools
69
+ ```json
70
+ {
71
+ "packages": ["./plugins/supi-flow"]
72
+ }
73
+ ```
93
74
 
94
- Five custom tools registered by the extension:
75
+ ### Important: prefer the package root, not just the extension entrypoint
95
76
 
96
- | Tool | Purpose |
97
- |---|---|
98
- | `supi_tndm_cli` | Thin wrapper around the `tndm` CLI with action enum (create/update/show/list/awareness) |
99
- | `supi_flow_start` | Create a ticket with status=todo, tag=flow:brainstorm, and optional design context in `content.md` |
100
- | `supi_flow_plan` | Store the executable implementation plan in `plan.md` while leaving `content.md` as the approved design summary |
101
- | `supi_flow_complete_task` | Check off a numbered task (`**Task N**`) in the registered `plan` document |
102
- | `supi_flow_close` | Mark done and write verification results to `archive.md` |
77
+ If you load only `plugins/supi-flow/extensions/index.ts`, PI gets the extension entrypoint,
78
+ but not the package-style resource loading for the bundled skills and prompt template.
103
79
 
104
- Tools should be used instead of calling `tndm` via bash. The agent invokes them with structured parameters.
80
+ Use the **package root** when you want the full package:
105
81
 
106
- ## Ticket documents
82
+ - extension tools
83
+ - auto-discovered skills
84
+ - auto-discovered prompt template
107
85
 
108
- `supi-flow` uses TNDM's registered document model with one canonical ticket body and two phase-specific attachments:
86
+ ### Dependency: `tndm`
109
87
 
110
- - `content.md`: approved design summary and durable handoff context
111
- - `plan.md`: executable checklist used during `/supi-flow-apply`
112
- - `archive.md`: final verification evidence written during `/supi-flow-archive`
88
+ `supi-flow` wraps the tandem CLI and expects `tndm` to be installed and on your `PATH`.
89
+ Keep `tndm` and `@mrclrchtr/supi-flow` on matching release versions so the startup/reload
90
+ version check stays quiet.
113
91
 
114
- Older tickets may still contain a legacy brainstorm sidecar document, but new flow work should not create or depend on it.
92
+ See the tandem project README for CLI install options:
93
+ <https://github.com/mrclrchtr/tandem>
115
94
 
116
- ## Prompt templates
95
+ ## How you use it in PI
117
96
 
118
- | Prompt | Description |
119
- |---|---|
120
- | `/supi-coding-retro` | Retrospective on project setup, architecture, tooling, workflows, and conventions |
97
+ This package is primarily used through:
98
+
99
+ - **skills** via `/skill:<name>`
100
+ - **tools** invoked by the model
101
+ - **prompt template** `/supi-coding-retro`
102
+
103
+ There is no custom `/supi-flow` slash command registered by the extension.
104
+
105
+ ### Typical workflow
106
+
107
+ 1. **Brainstorm** — `/skill:supi-flow-brainstorm`
108
+ - clarify intent
109
+ - inspect the codebase
110
+ - compare approaches
111
+ - approve a design before editing
112
+ - decide whether the change is trivial or non-trivial
113
+
114
+ 2. **Plan** — `/skill:supi-flow-plan TNDM-XXXXXX`
115
+ - store the approved overview in `content.md`
116
+ - author executable tasks one at a time in `state.toml` via `supi_flow_task`
117
+ - when revising an existing ticket, list the current tasks first and reconcile them with edit/remove/add instead of blindly appending new ones
118
+ - keep tasks concrete, ordered, and verifiable
119
+
120
+ 3. **Apply** — `/skill:supi-flow-apply TNDM-XXXXXX`
121
+ - start with `supi_flow_apply` to load the approved overview and task manifest
122
+ - transition planned tickets into `flow:applying`
123
+ - resume already-applying tickets with their current `in_progress` or `blocked` status intact
124
+ - execute tasks in order
125
+ - run fresh verification for each task
126
+ - check off tasks with `supi_flow_complete_task`
127
+
128
+ 4. **Debug when blocked** — `/skill:supi-flow-debug`
129
+ - use the root-cause workflow instead of guessing
121
130
 
122
- ## Ticket flow phase tracking
131
+ 5. **Archive** — `/skill:supi-flow-archive TNDM-XXXXXX`
132
+ - re-verify the completed change
133
+ - update living docs if needed
134
+ - close the ticket with required archived verification evidence
123
135
 
124
- Flow phases map to TNDM statuses and tags:
136
+ ## Flow phases
137
+
138
+ | Phase | Main skill | Ticket behavior |
139
+ |---|---|---|
140
+ | Brainstorm | `supi-flow-brainstorm` | creates or refines the change definition; non-trivial work starts with `supi_flow_start` |
141
+ | Plan | `supi-flow-plan` | stores the approved overview in `content.md`, then authors structured tasks one at a time via `supi_flow_task` |
142
+ | Apply | `supi-flow-apply` | starts with `supi_flow_apply`, loads the approved overview plus task manifest, transitions to `flow:applying` when needed, preserves the current `in_progress` or `blocked` status for already-applying tickets, then executes tasks and verifies each step fresh |
143
+ | Archive | `supi-flow-archive` | verifies the final result, writes `archive.md`, and closes the ticket |
144
+
145
+ Flow state is tracked with TNDM status/tag combinations:
125
146
 
126
147
  | Flow phase | Status | Tags |
127
148
  |---|---|---|
128
149
  | Brainstorm | `todo` | `flow:brainstorm` |
129
150
  | Plan written | `todo` | `flow:planned` |
130
151
  | Implementing | `in_progress` | `flow:applying` |
152
+ | Paused during apply | `blocked` | `flow:applying` |
131
153
  | Done | `done` | `flow:done` |
132
154
 
133
- ## Dependencies
155
+ ## Ticket document model
134
156
 
135
- - **tndm CLI** (`tandem-cli`): required (all ticket operations shell out to `tndm`)
157
+ `supi-flow` uses tandem's registered document model with an overview-first workflow:
136
158
 
137
- ```sh
138
- brew install mrclrchtr/tap/tandem-cli
139
- ```
159
+ | Artifact | Role |
160
+ |---|---|
161
+ | `content.md` | Canonical approved overview / design / plan prose |
162
+ | `state.toml` tasks | Structured execution manifest used during apply |
163
+ | `tasks/task-XX.md` | Optional task detail attachment for tasks that need more than a headline/files/verification/notes |
164
+ | `archive.md` | Final verification evidence written during archive/closeout |
140
165
 
141
- - **pi**: discovers bundled skills and prompt templates automatically from the package
166
+ Key rules from the current implementation:
142
167
 
143
- ## PI package
168
+ - `content.md` is **overview-first** and may contain zero tasks.
169
+ - Executable tasks live in `state.toml`, not in checklist blocks parsed from markdown.
170
+ - Headline-only tasks are preferred when they are clear enough.
171
+ - The common plan-time task-authoring path is `supi_flow_task`; low-level `task_*` actions remain available as escape hatches.
172
+ - When revising a ticket that already has tasks, list the current manifest first and reconcile it with `edit` / `remove` / `add` operations instead of treating replanning as repeated append-only adds.
173
+ - Task detail docs are optional and attached only when a task needs extra implementation detail.
174
+ - Older tickets may still contain a legacy brainstorm sidecar document, but new flow work should not depend on it.
144
175
 
145
- This extension is published as a [`pi-package`](https://pi.dev/packages) — listed in the PI package gallery. Install directly:
176
+ ## Tools
146
177
 
147
- ```bash
148
- pi install npm:@mrclrchtr/supi-flow
149
- ```
178
+ The extension registers seven custom tools.
150
179
 
151
- ## Installation
180
+ | Tool | What it does |
181
+ |---|---|
182
+ | `supi_tndm_cli` | Structured wrapper around `tndm` for ticket create/update/show/list/awareness plus lower-level task add/list/complete/remove/edit/set actions |
183
+ | `supi_flow_start` | Creates a ticket with `status=todo` and tag `flow:brainstorm`, optionally persisting initial context into `content.md` |
184
+ | `supi_flow_plan` | Stores the approved overview in `content.md` and replaces flow-state tags with `flow:planned` |
185
+ | `supi_flow_apply` | Loads the approved overview from `content.md`, returns the structured task manifest, transitions `flow:planned` tickets into `status=in_progress` with `flow:applying`, and preserves the current `in_progress` or `blocked` status for already-applying tickets |
186
+ | `supi_flow_task` | Adds, edits, or removes one structured task at a time and optionally manages the canonical `tasks/task-XX.md` detail doc; use it to reconcile existing task manifests during replans as well as to create new ones |
187
+ | `supi_flow_complete_task` | Marks one numbered task as done in the structured task manifest |
188
+ | `supi_flow_close` | Requires verification evidence, refuses to close unless the ticket is in `flow:applying` with a non-empty all-done structured task list, writes `archive.md`, syncs documents, and closes the ticket with `status=done` and `flow:done` |
152
189
 
153
- The extension is auto-discovered when the plugin directory is in pi's extension search path:
190
+ ### `supi_tndm_cli` at a glance
154
191
 
155
- ```bash
156
- # Option 1: symlink
157
- ln -s "$(pwd)/plugins/supi-flow" ~/.pi/agent/extensions/supi-flow
192
+ `supi_tndm_cli` is intentionally thinner than the flow skills. Use `supi_flow_task` for the normal plan-time path to author tasks one at a time. Reach for `supi_tndm_cli` when you need direct ticket operations or lower-level task repair.
193
+
194
+ Current action groups:
195
+
196
+ - **ticket actions** — `create`, `update`, `show`, `list`, `awareness`
197
+ - **task actions** — `task_add`, `task_list`, `task_complete`, `task_remove`, `task_edit`, `task_set`
198
+ - these are lower-level escape hatches; normal plan-time task authoring should prefer `supi_flow_task`
199
+
200
+ Task-detail behavior worth knowing:
201
+
202
+ - `task_add` can stay manifest-only for headline tasks
203
+ - when `task_detail` is provided, the tool ensures the canonical task detail doc, writes the markdown body, and runs `tndm ticket sync`
204
+ - `task_edit` can also write or clear linked task detail docs and clear file lists
205
+
206
+ ## Skills
207
+
208
+ The package ships five skills under `skills/`.
209
+
210
+ | Skill | Use it for |
211
+ |---|---|
212
+ | `supi-flow-brainstorm` | Clarify intent, inspect context, compare approaches, and get approval before implementation |
213
+ | `supi-flow-plan` | Turn the approved design into an executable plan with exact files and verification |
214
+ | `supi-flow-apply` | Execute the approved plan task by task with fresh verification gates |
215
+ | `supi-flow-archive` | Re-verify the completed change, update living docs, and close the ticket |
216
+ | `supi-flow-debug` | Systematic root-cause debugging when verification fails or the cause is unclear |
158
217
 
159
- # Option 2: settings.json
160
- # Add to ~/.pi/agent/settings.json:
161
- # { "extensions": ["./plugins/supi-flow/extensions/index.ts"] }
218
+ ## Prompt template
219
+
220
+ | Prompt | Purpose |
221
+ |---|---|
222
+ | `/supi-coding-retro` | Retrospective on setup, architecture, tooling, workflow, and conventions |
223
+
224
+ ## Package layout
225
+
226
+ ```text
227
+ plugins/supi-flow/
228
+ ├── extensions/
229
+ │ ├── index.ts
230
+ │ ├── cli.ts
231
+ │ └── tools/
232
+ ├── skills/
233
+ │ ├── supi-flow-brainstorm/
234
+ │ ├── supi-flow-plan/
235
+ │ ├── supi-flow-apply/
236
+ │ ├── supi-flow-archive/
237
+ │ └── supi-flow-debug/
238
+ ├── prompts/
239
+ │ └── supi-coding-retro.md
240
+ └── __tests__/
162
241
  ```
163
242
 
164
243
  ## Development
@@ -170,6 +249,29 @@ pnpm install
170
249
  # Type-check
171
250
  pnpm exec tsc --noEmit
172
251
 
173
- # Run tests
252
+ # Run the full test suite
174
253
  pnpm exec vitest run
175
254
  ```
255
+
256
+ Useful targeted checks from the current package guidance:
257
+
258
+ ```bash
259
+ # Version-check / tool registration behavior
260
+ pnpm exec vitest run __tests__/index.test.ts __tests__/resources.test.ts
261
+
262
+ # CLI wrapper behavior
263
+ pnpm exec vitest run __tests__/cli.test.ts
264
+
265
+ # Flow tools
266
+ pnpm exec vitest run __tests__/flow-tools.test.ts
267
+
268
+ # TNDM CLI tool behavior
269
+ pnpm exec vitest run __tests__/tndm-cli-tool.test.ts
270
+ ```
271
+
272
+ ## Validation notes while developing
273
+
274
+ - After changing `extensions/`, `skills/`, or `prompts/`, use `/reload` or restart PI before validating behavior.
275
+ - Use the plugin source and tests as the source of truth for README claims.
276
+ - Keep runtime PI packages in `peerDependencies` with `"*"` ranges and non-PI runtime deps in `dependencies`.
277
+ - Do not add `resources_discover` for `skills/` or `prompts/`; PI already auto-discovers them from the conventional directories.
@@ -1,17 +1,21 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
4
+ import type { ExtensionAPI, ToolExecutionMode } from "@earendil-works/pi-coding-agent";
5
5
 
6
6
  import { tndmVersion } from "./cli.js";
7
7
  import { supi_tndm_cli_params, executeTndmCli } from "./tools/tndm-cli.js";
8
8
  import {
9
9
  supiFlowStartParams,
10
10
  supiFlowPlanParams,
11
+ supiFlowApplyParams,
12
+ supiFlowTaskParams,
11
13
  supiFlowCompleteTaskParams,
12
14
  supiFlowCloseParams,
13
15
  executeFlowStart,
14
16
  executeFlowPlan,
17
+ executeFlowApply,
18
+ executeFlowTask,
15
19
  executeFlowCompleteTask,
16
20
  executeFlowClose,
17
21
  } from "./tools/flow-tools.js";
@@ -56,7 +60,13 @@ export default function (pi: ExtensionAPI) {
56
60
  "- update: id (required), title, status, priority, type, tags, add_tags, remove_tags, depends_on, effort, content\n" +
57
61
  "- show: id (required)\n" +
58
62
  "- list: all (boolean), definition (ready|questions|unknown)\n" +
59
- "- awareness: against (git ref, required)",
63
+ "- awareness: against (git ref, required)\n" +
64
+ "- task_add: id (required), task_title (required), task_files, task_verification, task_notes, task_detail\n" +
65
+ "- task_list: id (required)\n" +
66
+ "- task_complete: id (required), task_number (required)\n" +
67
+ "- task_remove: id (required), task_number (required)\n" +
68
+ "- task_edit: id (required), task_number (required), task_title, task_files, task_clear_files, task_verification, task_notes, task_detail, task_clear_detail\n" +
69
+ "- task_set: id (required), task_json (required)",
60
70
  promptSnippet: "Execute tndm ticket operations via supi_tndm_cli",
61
71
  promptGuidelines: [
62
72
  "Use supi_tndm_cli for direct tndm operations instead of running tndm via bash",
@@ -76,9 +86,10 @@ export default function (pi: ExtensionAPI) {
76
86
  "Stores known design context in content.md and returns the ticket ID.",
77
87
  promptSnippet: "Begin a new flow by creating a TNDM ticket",
78
88
  promptGuidelines: [
79
- "Use supi_flow_start at the beginning of every brainstorm to create the required ticket",
89
+ "Use supi_flow_start when a brainstorm becomes non-trivial and needs a durable ticket",
80
90
  "Always include context (design intent/summary) when known",
81
91
  ],
92
+ executionMode: "sequential" as ToolExecutionMode,
82
93
  parameters: supiFlowStartParams,
83
94
  async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
84
95
  return executeFlowStart(params);
@@ -90,31 +101,70 @@ export default function (pi: ExtensionAPI) {
90
101
  name: "supi_flow_plan",
91
102
  label: "Flow Plan",
92
103
  description:
93
- "Store an implementation plan in a ticket's plan.md while keeping content.md as the canonical design summary. " +
94
- "Updates tags from flow:brainstorm to flow:planned. Tasks must be numbered as '**Task {N}**' in the plan.",
104
+ "Store the approved overview / plan in the ticket's canonical content.md. " +
105
+ "Updates tags from flow:brainstorm to flow:planned. Task authoring happens separately in state.toml.",
95
106
  promptSnippet: "Store a plan in a TNDM ticket",
96
107
  promptGuidelines: [
97
- "Use supi_flow_plan after creating a plan to persist it in the ticket",
98
- "Number tasks sequentially as **Task 1**, **Task 2**, etc.",
108
+ "Use supi_flow_plan after creating a plan to persist the approved overview in content.md",
109
+ "Create execution tasks separately after the overview exists; do not rely on supi_flow_plan to parse task blocks into state.toml",
99
110
  ],
111
+ executionMode: "sequential" as ToolExecutionMode,
100
112
  parameters: supiFlowPlanParams,
101
113
  async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
102
114
  return executeFlowPlan(params);
103
115
  },
104
116
  });
105
117
 
118
+ // ── Tool: supi_flow_apply ───────────────────────────────────
119
+ pi.registerTool({
120
+ name: "supi_flow_apply",
121
+ label: "Flow Apply",
122
+ description:
123
+ "Start the apply phase for a planned ticket. " +
124
+ "Loads the approved content.md overview, returns the structured task manifest, transitions flow:planned tickets to status=in_progress with flow:applying, and preserves the current in_progress/blocked status for already-applying tickets.",
125
+ promptSnippet: "Start the apply phase for a TNDM flow ticket",
126
+ promptGuidelines: [
127
+ "Use supi_flow_apply at the beginning of implementation to load the approved overview and task manifest, and to move a planned ticket into flow:applying when needed.",
128
+ ],
129
+ executionMode: "sequential" as ToolExecutionMode,
130
+ parameters: supiFlowApplyParams,
131
+ async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
132
+ return executeFlowApply(params);
133
+ },
134
+ });
135
+
136
+ // ── Tool: supi_flow_task ────────────────────────────────────
137
+ pi.registerTool({
138
+ name: "supi_flow_task",
139
+ label: "Flow Task",
140
+ description:
141
+ "Manage one structured task in a flow ticket. " +
142
+ "Operation determines which params apply: add requires title; edit/remove require task_number; optional detail writes or clears the canonical task detail doc.",
143
+ promptSnippet: "Manage one task at a time in a TNDM flow ticket",
144
+ promptGuidelines: [
145
+ "Use supi_flow_task for the common plan-time path to add, edit, or remove one structured task at a time",
146
+ "Prefer supi_flow_task over raw task_json or detail_path handling when authoring normal flow tasks",
147
+ ],
148
+ executionMode: "sequential" as ToolExecutionMode,
149
+ parameters: supiFlowTaskParams,
150
+ async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
151
+ return executeFlowTask(params);
152
+ },
153
+ });
154
+
106
155
  // ── Tool: supi_flow_complete_task ───────────────────────────
107
156
  pi.registerTool({
108
157
  name: "supi_flow_complete_task",
109
158
  label: "Flow Complete Task",
110
159
  description:
111
- "Mark a task as done in a ticket's plan.md by task number (1-based). " +
112
- "Finds '- [ ] **Task N:**' and changes to '- [x] **Task N:**'.",
160
+ "Mark a task as done in a ticket by task number (1-based). " +
161
+ "Calls 'tndm ticket task complete' to update the structured task in state.toml.",
113
162
  promptSnippet: "Check off a completed plan task in a TNDM ticket",
114
163
  promptGuidelines: [
115
164
  "Use supi_flow_complete_task after each task's verification passes during apply",
116
165
  "Call this with the task number, not the description text",
117
166
  ],
167
+ executionMode: "sequential" as ToolExecutionMode,
118
168
  parameters: supiFlowCompleteTaskParams,
119
169
  async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
120
170
  return executeFlowCompleteTask(params);
@@ -127,12 +177,13 @@ export default function (pi: ExtensionAPI) {
127
177
  label: "Flow Close",
128
178
  description:
129
179
  "Close a ticket and finalize the flow. " +
130
- "Writes verification results to archive.md, sets status=done, and tags=flow:done.",
180
+ "Requires flow:applying with a non-empty all-done task list, writes verification results to archive.md, sets status=done, and tags=flow:done.",
131
181
  promptSnippet: "Close a TNDM ticket after implementation and verification",
132
182
  promptGuidelines: [
133
183
  "Use supi_flow_close at the end of the archive phase after all verification is complete",
134
184
  "Pass the full verification evidence as verification_results",
135
185
  ],
186
+ executionMode: "sequential" as ToolExecutionMode,
136
187
  parameters: supiFlowCloseParams,
137
188
  async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
138
189
  return executeFlowClose(params);