Thread engineering for pi — all 7 thread types + stories.
Wraps pi-subagents for P/C/B threads (inheriting agent specialization, chain artifacts, live progress). Builds natively what nobody else has: F-Thread (multi-model fusion), Z-Thread (verify gate), and Stories (goal → auto-decomposed thread phases).
pi install npm:pi-thread-engineOr from source:
pi install ./path/to/pi-threads| Command | Type | Backend | What |
|---|---|---|---|
/pthread |
P-Thread | subagent | N independent tasks in parallel |
/cthread |
C-Thread | subagent | Sequential phases via subagent chain |
/bthread |
B-Thread | subagent | scout → plan → build → review pipeline |
/fthread |
F-Thread | native | Same prompt → N models → compare (UNIQUE) |
/zthread |
Z-Thread | native | Autonomous + verify command gate (UNIQUE) |
/lthread |
L-Thread | native | Extended autonomous run |
/story |
Stories | mixed | Auto-decompose goal into thread phases (UNIQUE) |
Same prompt sent to multiple models in parallel. Compare results, pick the best.
/fthread "Design the caching architecture" --count 5
/fthread "Refactor the auth module" --models anthropic/claude-sonnet-4,google/gemini-2.5-pro,openai/gpt-4o
Autonomous execution with a verification gate. Only ships if the verify command passes.
/zthread "Fix all ESLint warnings" --verify "npm run lint"
/zthread "Add input validation" --verify "npm test"
A goal gets auto-decomposed into thread phases. pi-threads picks the right thread type for each phase.
/story "Add dark mode to the dashboard" --verify "npm test"
Auto-generates phases:
- Scout (meta) — research the codebase
- Plan (fusion) — 3 models brainstorm approaches
- Decide (chained) — human picks the winner
- Build (parallel) — implement across files
- Verify (zero) — run tests
/threads — show all threads + stories
/threads kill t-001 — kill a thread
/threads review — see completed results (fusion shows comparison)
/threads prune — clear finished threads
/stories — list all stories with phase progress
thread_spawn— Start any thread type (auto-selects backend)thread_status— Check progress of threads and storiesthread_kill— Stop a thread
Wrapper layer (pi-subagents): Native layer (pi -p):
┌──────────────────────────┐ ┌────────────────────────┐
│ /pthread → /parallel │ │ /fthread → N models │
│ /cthread → /chain │ │ /zthread → run+verify │
│ /bthread → scout chain │ │ /lthread → long run │
└──────────────────────────┘ └────────────────────────┘
↕ ↕
┌─────────────────────────────────┐
│ ThreadRegistry (state machine) │
│ ThreadExecutor (dispatch) │
│ /threads dashboard │
│ /story orchestrator │
└─────────────────────────────────┘
Based on thread-engineering:
A thread is a unit of engineering work: prompt at the start, review at the end, agent tool calls in between. The metric: tool calls per unit of your attention. Maximize this.
Base → P-Thread → C-Thread → F-Thread → B-Thread → L-Thread → Z-Thread
↑
The north star