A pi-coding-agent extension that automates a fully configurable improvement workflow on the current project.
/workflow [rounds]— runs the configured workflow: a start phase (analysis messages), then review rounds. The whole sequence is defined inworkflow.json, so you decide which messages or commands happen when./workflow-edit— opens an interactive editor overlay with two tabs: [Workflow] (rounds, start order, loop steps, tree anchor, add/delete/reorder, if-changes toggle) and [Messages] (add, edit and delete message entries). Changes are saved withs(per tab) and closing with unsaved changes warns you./tree <number>— workflow-exclusive command that resets the agent's context to the response of a predefined message (by its/msg//cmdindex). The workflow loop always begins with a tree step.- Start-phase resume. Messages whose text is already present in the session branch are skipped, so an interrupted workflow continues where it left off.
- Resilient sends. Follow-ups are polled until they appear in the session branch (up to 3 attempts) before waiting for idle.
- Config validation. Invalid
workflow.jsonvalues are reported and fall back to safe defaults.
pi install npm:pi-improve-workflowThe workflow messages (1–7) are read from pi-msg-store, which is bundled as a dependency — install this package alone and /workflow works out of the box. Install pi-msg-store as well to edit the messages with /change-msg; both packages then share the same store.
/workflow
/workflow 3
/tree 1
/workflow-edit| Key | Action |
|---|---|
Tab / Shift+Tab |
switch between Workflow and Messages tabs |
j / k |
move selection |
e |
edit the selected row (tree anchor, step index, git args, message content) |
a |
add a row (start index, send <n> / git <args> loop step, new message) |
x |
delete the selected row |
J / K |
move the selected step up/down (tree step stays first) |
t |
toggle onlyIfChanges on a send step |
[ / ] |
decrease / increase rounds |
s |
save the active tab |
q / Esc |
close (warns about unsaved changes) |
Saving the Workflow tab refuses indices that reference missing messages, so add those in the Messages tab first. The tree step is fixed as the first loop step — only its anchor index is editable.
The workflow is defined in workflow.json inside the package:
{
"rounds": 2,
"start": ["1", "2", "3", "4", "5"],
"loop": [
{ "tree": "1" },
{ "git": ["add", "."] },
{ "send": "6" },
{ "send": "7" },
{ "send": "5", "onlyIfChanges": true },
{ "git": ["add", "."] }
]
}Number of review-loop iterations (default 2, max 5). /workflow <n> overrides it for a single run.
Ordered list of message indices sent once before the loop begins. Messages whose text is already in the session are skipped, so a re-run resumes the phase instead of repeating it.
Ordered list of steps repeated each round. The first step must be a tree step — the context reset always happens at the beginning of the loop. Supported steps:
| Step | Meaning |
|---|---|
{ "tree": "1" } |
Reset the agent's context to the response of message 1 (same as /tree 1) |
{ "send": "6" } |
Send message 6 and wait for the turn to finish |
{ "send": "5", "onlyIfChanges": true } |
Send message 5 only when git status --porcelain shows changes |
{ "git": ["add", "."] } |
Run git with the given arguments (e.g. stage changes) |
Message indices refer to the numbered store shared with pi-msg-store — /msg 6, /cmd 6, and { "send": "6" } all address the same message. The default store is numbered 1–7 in workflow order: read, improvements, value check, implement, validate, closer look, fix.
Invalid config values are reported with a [pi-improve-workflow] warning and fall back to the defaults shown above.