A small streaming proxy for pi in RPC mode. It launches pi --mode rpc,
sends a single prompt over its JSON-RPC stdin, and renders the event stream
from pi's stdout as styled terminal output:
-
thinking tokens in dim italic
-
assistant text plain
-
tool execution rendered as a box with live, line-by-line streamed output:
┌─ ⚡ bash ─ seq 1 5 | while read i; do echo line $i; sleep 0.3; done │ line 1 │ line 2 │ line 3 │ line 4 │ line 5 └─ ✓ bash (1.6s, 5 lines)The top-corner header opens when the tool starts, each new line of the tool's stdout streams in with a
│gutter as soon aspiemits it, and the bottom corner closes with a green✓(success) or red✗(error), the elapsed time, and the line count. Full output is preserved — nothing is truncated.
- A working
pibinary on$PATH(pi-stream spawns it as a subprocess)
One-liner — Linux and macOS, detects OS/arch automatically, installs to ~/.local/bin:
curl -sSfL https://raw.githubusercontent.com/crazy-goat/pi-stream/main/install.sh | shCustom install directory:
curl -sSfL https://raw.githubusercontent.com/crazy-goat/pi-stream/main/install.sh | INSTALL_DIR=/usr/local/bin shFrom source (requires Go 1.23+):
make install # builds and copies pi-stream to ~/.local/binpi-stream [flags] <prompt>| Flag | Default | Description |
|---|---|---|
--model |
(auto) | Model name forwarded to pi (e.g. "GLM 5.1"). |
--thinking |
high |
Thinking level: off, minimal, low, medium, high, xhigh. |
-t |
(none) | Comma-separated tool allowlist (e.g. bash,read). |
--session |
(none) | pi session file path; share between invocations to carry context over. |
--version |
Print version and exit. |
# Quick one-shot prompt
pi-stream --model "GLM 5.1" --thinking off "tell me a one-line joke"
# Let the model use bash
pi-stream --model "GLM 5.1" -t bash "list files in this repo and summarize"
# Reuse a session across multiple calls
pi-stream --session /tmp/sess "first message"
pi-stream --session /tmp/sess "follow-up that should remember the first"| Code | Meaning |
|---|---|
| 0 | Normal completion (agent_end received) |
| 1 | pi reported an error, or startup failed |
| 2 | Invalid CLI flags / missing prompt |
| 130 | Interrupted by SIGINT or SIGTERM (Ctrl+C) |
make build # compile
make test # go test -race ./...
make lint # golangci-lint run
make tidy # go mod tidy + diff checkLayout:
main.go # thin entrypoint — signal handling + os.Exit
internal/event/ # typed structs for pi's JSON-RPC event stream
internal/render/ # state-machine Renderer: styles events as ANSI output
internal/pi/ # subprocess lifecycle (Start, Events, Close)
internal/cli/ # flag parsing + event-loop orchestration
MIT