u/agentwyz

How would you implement Pi-style extensions in a Go agent?

Pi's coding-agent extensions are TypeScript modules with an in-process API:

registerTool, registerCommand, lifecycle hooks, and some TUI UI, then

hot-reload. Same language as the host.

If the host is Go (single binary), how would you get close to that?

Options I'm weighing: embed Lua/Starlark/JS, Wasm plugins, a sidecar

extension host over RPC, or accept that hooks+MCP is the ceiling.

If you've built plugin systems for Go CLIs/agents/editors: what would you

actually ship, and what would you refuse to build?

reddit.com
u/agentwyz — 1 day ago

I used Pi to build Phi — a small Go sibling with a few extras

Hey everyone,

Short version: I used Pi to build Phi.

I’ve been using Pi a lot, and at some point I started hacking on my own little harness in Go. The result is Phi — deliberately small, terminal-first, and very much in the same spirit as Pi. I’m sharing it here because a lot of the ideas (and a lot of the motivation) came from using Pi.

Repo: https://github.com/pulseaiclub/phi

  • What Phi tries to add on top Not claiming these are “better” — more like experiments on top of the Pi-shaped workflow I already liked:
  • Permission gate by default — destructive stuff (writes / bash) asks first; rules can go down to command level
  • Hooks — PreTool / PostTool scripts for policy, audit, or input rewrite, without rebuilding the binary
  • Hashline edits — line edits anchored by short hashes, so stale context is less likely to silently rewrite the wrong thing
  • Sub-agents with isolation — explore / review / worker; full traces stay under ~/.phi/jobs/, only summaries come back to the main context
  • Model-agnostic — OpenAI-compatible or Anthropic; swap models without waiting on the tool
  • Small Go binary — ~12 MB stripped, no Node / Electron / Python runtime There’s also a hand-rolled TUI (Markdown, themes, Ctrl+K, @ file picker, session resume).

Phi is still not as good as Pi.

Pi is more polished, the UX feels more finished, and for day-to-day work I’d still reach for Pi first. Phi is the side project where I get to try permissioning, hooks, and edit safety a bit more aggressively. If anything here is useful, great; if it’s rough around the edges, that’s on me.

If you’re a Pi user and curious, feedback is very welcome

https://preview.redd.it/gjmsw51ltwih1.png?width=1037&format=png&auto=webp&s=2af0954a4d360435064606d7271b9f1c8391edb4

u/agentwyz — 8 days ago
▲ 2 r/tui

Built a small Go TUI for a terminal coding agent (custom renderer, ~40ms first paint)

I built phi, a terminal coding agent with a custom Go TUI (not Bubble Tea / not Electron).

What I cared about on the UI side:

first paint ~40ms

Markdown + syntax highlighting in the transcript

4 themes, Ctrl+K command palette, @ fuzzy file picker

sessions you can list/resume from the TUI

Binary is ~12MB stripped, idle RSS ~21MB, 6 direct Go module deps. No Node/Python runtime.

It’s model-agnostic (OpenAI-compatible or Anthropic). There’s also a permission gate, hooks, and hash-anchored edits so the agent doesn’t rewrite stale file snapshots.

Repo: https://github.com/pulseaiclub/phi

If you’ve built agent TUIs before: anything you’d change about the interaction model (approvals, streaming tool output, session resume)? Happy to take feedback.

https://preview.redd.it/ldi9ob5g0wih1.png?width=1063&format=png&auto=webp&s=84327eab5d057e685380c1afca5428506f924892

reddit.com
u/agentwyz — 8 days ago