Skill v1.0.0
currentLLM-judged scan90/100version: "1.0.0" name: pi-fanout description: Fan Claude Code work out to a non-Claude model (Kimi K3 by default, or any model pi supports such as GLM, MiniMax, DeepSeek) through the pi-relay plugin. Use when the user says "fan out to kimi", "run this on kimi/glm/pi", "use cheap workers", "have pi do the design/implementation", or wants a Workflow where some or all steps run on a different model while Claude orchestrates and reviews.
pi-fanout
The pi-relay plugin gives every Claude Code session a relay subagent, pi-relay:pi-runner, that runs one headless pi job and returns pi's output verbatim. Claude keeps the orchestration and the judgment steps; pi does the generation.
Before the first run on a machine
Run "${CLAUDE_PLUGIN_ROOT}/bin/pi-doctor". It checks that pi is installed, the model is in pi's catalog, credentials exist, and a three-second smoke test passes. If it fails, stop and show the user the output; nothing below will work until it passes.
The relay task format
A relay task is plain text. MODE and PROMPT are required; the rest are optional.
MODE: text | buildCWD: <directory for build mode; default: current working directory>MODEL: <pi model id> e.g. accounts/fireworks/models/kimi-k3PROVIDER: <pi provider> e.g. fireworksTHINKING: off|minimal|low|medium|highPROMPT:<the prompt, verbatim, to the end>
text mode gives pi no tools: use it for answers, plans, reviews, JSON. build mode gives pi its read/bash/edit/write tools inside CWD: use it when pi should create or change files. Defaults come from env PI_RELAY_PROVIDER, PI_RELAY_MODEL, PI_RELAY_THINKING.
Using it from the Agent tool
Agent({ subagent_type: 'pi-relay:pi-runner',prompt: 'MODE: text\nPROMPT:\nSummarize the tradeoffs of ...' })
Using it inside a Workflow script
Define one helper and choose per step who does the work:
const kimi = (mode, prompt, opts = {}) => agent(`MODE: ${mode}\nPROMPT:\n${prompt}`,{ agentType: 'pi-relay:pi-runner', model: 'haiku', effort: 'low', ...opts })const design = await kimi('build', 'Read the spec below and write DESIGN.md ...') // piconst impl = await parallel(files.map(f => () =>kimi('build', `Read DESIGN.md. Write only ${f} ...`, { label: `impl:${f}` }))) // pi, parallelconst review = await agent('Review DESIGN.md against the files ...', { schema }) // Claude
Rules that matter:
- Keep the relay cheap: always
model: 'haiku', effort: 'low'. The relay only copies text
and runs a command.
- Every step is stateless, exactly like a Claude subagent. Pass context through prompts or
files on disk. A shared contract file (DESIGN.md) is the usual way to let parallel pi runs agree on names.
- Structured output works: put
schemaon the relay call and tell pi in the prompt to answer
with JSON in that shape. The relay copies it into the schema.
- Parallel
buildsteps must write disjoint files, or give each relay
isolation: 'worktree' (pi inherits the relay's cwd).
- Keep judgment on Claude: reviews, adversarial verification, synthesis, and anything that
decides what happens next. Send generation and mechanical work to pi.
- Two limits stack: the workflow's concurrency cap and the provider's rate limit. A handful
of parallel pi runs is fine; dozens will queue at the provider.
- Never put a prompt into a shell command yourself. The relay writes it to a file and
pi-run pipes the file into pi.
Ready-made workflow
Workflow({ name: 'pi-relay:design-build-review', args: {...} }) runs the pattern above end to end: pi writes a design contract, pi implements each file in parallel, Claude reviews for cross-file mismatches, pi applies any blocker/major findings. Args:
{spec: 'one paragraph describing what to build', // requiredfiles: [{ file: 'index.html', note: 'markup only ...' }], // required, one parallel pi run eachdesignFile: 'DESIGN.md', // optionalskipDesign: false, // true if designFile already existsmodel: 'accounts/fireworks/models/kimi-k3', // optional, any pi model idprovider: 'fireworks', // optionalthinking: 'medium', // optionalreviewEffort: 'medium', // optional, Claude review effort}