pi-thread-engine

Thread engineering for pi โ€” all 7 thread types, stories, fusion, zero-touch, TUI dashboard

Package details

extension

Install pi-thread-engine from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-thread-engine
Package
pi-thread-engine
Version
0.2.4
Published
Mar 7, 2026
Downloads
68/mo ยท 12/wk
Author
artale
License
MIT
Types
extension
Size
54.3 KB
Dependencies
0 dependencies ยท 4 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/index.ts"
  ],
  "commands": [
    "threads",
    "pthread",
    "cthread",
    "bthread",
    "fthread",
    "zthread",
    "lthread",
    "story",
    "stories"
  ],
  "tools": [
    "thread_spawn",
    "thread_status",
    "thread_kill"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

๐Ÿงต pi-threads

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).

Install

pi install npm:pi-thread-engine

Or from source:

pi install ./path/to/pi-threads

Commands

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)

Unique Features (not in pi-subagents or pi-messenger)

Fusion (/fthread)

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

Zero-Touch (/zthread)

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"

Stories (/story)

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:

  1. Scout (meta) โ€” research the codebase
  2. Plan (fusion) โ€” 3 models brainstorm approaches
  3. Decide (chained) โ€” human picks the winner
  4. Build (parallel) โ€” implement across files
  5. Verify (zero) โ€” run tests

Dashboard

/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

LLM Tools

  • thread_spawn โ€” Start any thread type (auto-selects backend)
  • thread_status โ€” Check progress of threads and stories
  • thread_kill โ€” Stop a thread

Architecture

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              โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The Thread Framework

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