Skip to content

PiG v0.5.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 18:40
Immutable release. Only release title and notes can be modified.
7a5422f

PiG 0.5.0

PiG-v0 5 0-herd

Summary

PiG 0.5.0 follows Pi 1.3.0+1402973a. Install it with go install github.com/MichaelKinsy/PiG/cmd/pig@v0.5.0. The full story is on the blog at https://pi-in-go.dev/blog/pig-0-5-0/. PiG is free and open source under the MIT licence, and nothing is held back for a hosted or paid tier.

  • Every Pi commit up to 1402973a is ported, including Chord link protocols 3 and 4 and Pi's telemetry propagation, span links and metrics. Every one of Pi's semantic interface IDs is closed, held by a strict zero-gap gate. Every place PiG differs is a numbered, owner-approved divergence.
  • Durable. Pi Durable keeps an agent's state on a server, separate from the client and the chat history. PiG runs it natively in Go. Its cost no longer grows with your history, and a session finds its next wake without walking every live task. The Cloudflare Durable host follows Pi 1.3.0 and is tested in CI. [DOCS: durable]
  • Piglets can keep, replace or strip any part of PiG on the Go SDK, and a stripped part leaves the binary. Go, Rust and Python extensions get the same conversation tools TypeScript has in Pi. [DOCS: piglets]
  • Less CPU and memory than 0.4.1 on every task we measured. pig --version takes 5 ms of CPU, against 282 for Pi on Node. Pi-Bolt is a little ahead on interactive start and long-session resume. TypeScript extensions add a fixed startup cost because PiG starts a Node host for them, which is much better than 0.4.1 but still slower than Pi and Pi-Bolt. Rerun it yourself with buffon. [BUFFON]
  • A long session no longer grows from three PiG-only retentions. What remains is the same per-entry retention Pi has.
  • More robust under heavy load. Much harder stress testing with large parallel sweeps under the race detector hardened Durable, Chord and the interactive mode.
  • A failing extension reports its own error instead of a generic "process exited".
  • A few breaking changes for Go code and models.json are listed under Upgrading, and pig extension upgrade rewrites the old Go forms.

0.4.1 to 0.5.0

Area 0.4.1 0.5.0
Pi version followed Pi 1.0.3 Pi 1.3.0+1402973a, Pi's newest
Interface coverage Pi 1.x surface Every Pi semantic interface, held by a zero-gap gate
Durable Ported Lighter: cost no longer grows with history; code mode and tool search
Cloudflare Earlier Pi facade Follows Pi 1.3.0, suite in CI
Piglets/SDK Shareable configurations Slots to keep, replace or strip any part; Go SDK Piglets; equal tools in Go, Rust and Python
Long-session cost Grew with session length in model lookup, branch summary and Durable turns Model lookup and branch summary scale linearly; Durable turns no longer copy history
Robustness testing Regular CI Large parallel stress sweeps, race detector, many CPUs

Highlights

Parity with Pi 1.3.0+1402973a. Chord (state cells, registries, links, records, the host manager), Pi Durable's code mode, deferred tools and tool search, remote execution environments over SSH (env), and code mode's Cloudflare entry. Chord speaks link protocol 4, as Pi does. Parity is checked against the real Pi, not against PiG's own output. Hundreds of fixes in the CHANGELOG are Pi-observable differences found and removed. The bug fix ledger is public.

Durable. Harness turns no longer copy the history; a session recomputes its next wake without walking every live task on each commit; request cost flat in requests in flight; task listings page from storage; Close after a cancelled Begin is hardened.

Performance. From buffon on the 0.5.0 release candidate, one machine, median of a clean rerun. CPU ms / peak memory MiB, lower is better. Rerun it yourself. [BUFFON]

Task PiG 0.5.0 PiG 0.4.1 Pi-Bolt Pi (Node)
--version 5 / 4 18 / 9 11 / 7 282 / 58
one prompt (-p) 16 / 7 64 / 16 44 / 19 424 / 63
one prompt with tools 29 / 11 119 / 18 56 / 22 518 / 86
RPC session 71 / 21 438 / 21 108 / 30 675 / 89
interactive start (PTY) 61 / 15 145 / 26 55 / 19 536 / 73
resume a long session 69 / 21 137 / 25 50 / 23 443 / 68
streaming a long answer in the TUI 403 / 18 2,451 / 37 925 / 36 2,850 / 113
one prompt, 10 TypeScript extensions 934 / 217 2,191 / 509 109 / 34 676 / 106
RPC, 10 TypeScript extensions 2,016 / 421 9,430 / 595 194 / 44 950 / 148

0.5.0 is lighter than 0.4.1 on every row. Without extensions it beats Pi on every row, and Pi-Bolt is a little ahead on interactive start and long-session resume. With TypeScript extensions PiG is slower than Pi and Pi-Bolt, because it starts a separate Node host for them. The same extensions ported to Go in a Piglet are in the table below.

Scripts, raw results and the Piglet sources are attached as go-ext-comparison.tar.gz.

  • Long streamed answers and streamed file writes now do linear work, output unchanged.
  • Startup allocates less. --version skips the Piglet cell manifest, and many tables are built on first use.

Memory. A soak of tens of thousands of turns found three PiG-only retentions (a search-text arena built eagerly, a cache keeping dead tool-call arguments, a per-turn timing list). All three are fixed with counter tests. Live heap growth per turn fell sharply. Pi keeps every session entry too, so a very long session still grows slowly in both.

Durability and Chord. Durable code mode (durable/codemode), links that deflate large frames, a host manager with start/stop/replace/liveness, and Kubernetes benchmarks (bench/k8s).

Terminal UI. The header keeps its drawn lines instead of redrawing every frame, streamed write cards highlight only new lines, deeply nested Markdown renders far faster, and typing in the editor allocates fewer objects. PiG reports working, blocked, done and error over OSC 7501.

Extensions and Piglets. A Piglet can strip built-ins and leave their code out of the binary, publish to npm (pig piglet publish --to npm), carry TypeScript and JavaScript extensions, and fuse a frontend member that draws the interactive mode (D91). New offline diagnostics: pig piglet tree, pig piglet lineage, pig piglet verify --source. The Go, Rust and Python SDKs gained Pi's conversation components, footer data, parseFrontmatter, serializeConversation and branch-summary helpers. pig extension upgrade rewrites Go extensions for an older SDK, and extensionsAutoUpgrade can run it at startup. TypeScript extensions can run on Bun.

Fixes ported from Pi since 3daa2028.

  • Malformed final tool-call arguments are reported instead of running with the parsed prefix.
  • Codex GPT-6.1 Sol uses its 500K context window.
  • OpenCode providers use their inference endpoints, and opencode-go adds deepseek-v4-flash.
  • kimi-coding uses Chat Completions at api.kimi.com/coding/v1.
  • GPT-6 thinking level changes keep the prompt cache, through configuration_update items.
  • One model-reference resolver serves --model, --models, /model and auth printing. An ambiguous reference now errors and names the providers.
  • Read line ranges with a string offset or limit display correctly in the TUI, in /tree and in HTML export. Pi fixed this too, so divergence D154 is retired.
  • PiG retries on the gateway error "Unable to forward upstream stream".
  • When a completions chunk carries both thinking and text, thinking comes first.
  • Gemini 4 supports thinkingLevel.
  • Xiaomi MiMo has an on/off thinking toggle.
  • Empty quoted prompt-template arguments are kept.
  • Durable: the baseline leads after a compaction that keeps assistant messages.

Also in 0.5.0. Compaction summary requests clamp output tokens to the context window. A failed branch summary reports Pi's plain error text. The events turn_end, agent_before_settle, before_agent_start and provider_stream_event keep Pi's member order on the wire.

Robustness under heavy load. Much more aggressive stress testing (large parallel sweeps, race detector, many CPUs) hardened rare edge cases under heavy concurrency, each fixed at the cause with a test: provider stream start, a Durable tool cancelled before it starts (it now reports the cancel), Durable waits now waiting for event listeners, sleep timers, Durable Close after a cancelled Begin, Chord publication (now in Pi's single-queue order) and the interactive mode. Error reporting is clearer: a failing extension now reports its own error instead of a generic "process exited".

Docs. Worked examples on every main page, applied use cases for people who do not program, and the public bug fix ledger.

Upgrading from 0.4.x

  1. Go API: agent.NewAgent returns (a, err); Agent.Continue(ctx) returns only an error; Context.SetEditorComponent takes an sdk.EditorFactory.

  2. agent.TimingSnapshot.Turns (a []time.Duration) is replaced by TurnCount int. The recorder no longer keeps a duration per turn, so a long session's memory stays flat. /cost output is unchanged.

  3. models.json: a custom model needs an api on the model or its provider, as in Pi (0.4.x defaulted it). Without one the entry is ignored with an error.

  4. Local Packages: a library-only local package must add "pi": {} to its package.json, or loading fails.

  5. Go SDK before_agent_start: data["systemPrompt"] is an *sdk.SystemPrompt; read it with .Get(). pig extension upgrade rewrites the old forms.

  6. Go API: the unused assistant-message frame API is removed, as in Pi. Code that calls ai.AssistantMessageFrame* must stop using it.

  7. models.json: if you override the kimi-coding base URL, it must now include /v1, because kimi-coding uses Chat Completions at api.kimi.com/coding/v1.

Pigpen's Packages are republished for the new SDK after this release.

Where PiG still loses (named, not hidden)

  • TinyGo Durable core (the Cloudflare and JS-host build, never the default pig): cold start is slower than Pi's pi-durable. Accepted by the owner.
  • The first code-mode use in a process costs a few ms more (decompressing the embedded QuickJS module).
  • TypeScript extensions use more start-up memory under PiG than under Pi.
  • Long sessions still grow slowly because PiG keeps every entry for /tree, as Pi does.

Known issues

  • models.classify() keeps the order of a script's questions but not the key order of its state.
  • The OAuth credential store (D40) is available to Go, Python and Rust extensions, not yet to Node extensions.

Full changelog

See CHANGELOG.md (0.5.0 section) in the repository. Thanks to everyone in the herd image: contributors and people who filed issues.