{"slug": "phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit", "title": "phi – the 12 MB alternative to Pi: no Ts, any model, hashline edit", "summary": "A developer has released phi, a 12 MB terminal coding agent written in Go that supports any OpenAI-compatible or Anthropic-native model via a pluggable config. The tool features read-only defaults, hash-anchored line edits to prevent corruption, and a sub-agent system that keeps transcripts out of the main context. It is designed as a lightweight alternative to tools like Pi, Claude Code, Aider, and Goose.", "body_md": "Hi everyone\n\nI’ve been hacking on a terminal coding agent called phi [https://github.com/pulseaiclub/phi](https://github.com/pulseaiclub/phi) for the past few months, and I’d love to share what it is and why it exists.\n\nIf you’ve used tools like Pi, Claude Code, Aider, or Goose, phi tries to hit the same workflow—but deliberately strips away the runtime baggage. It’s a single\n\nGo binary, ~12 MB, with no Node, Electron, or Python in sight.\n\nHere’s what makes it tick:\n\nThis is the whole reason phi exists. Model releases are moving faster than any agent maintainer can keep up with. Instead of chasing every new provider, phi tr\n\neats the model as a pluggable config: anything OpenAI-compatible or Anthropic-native works out of the box. You can swap models in seconds without waiting for a\n\nn author to add support. Config is a single YAML file, and there’s also a tiny HTML editor so you can point-and-click your way through ~/.phi/config.yaml.\n\nGo is the secret sauce here. A stripped release build (CGO_ENABLED=0) comes in at ~12 MB, cold idle RSS around ~21 MB, and a first frame in roughly 40 ms. Ther\n\ne are only 6 direct module dependencies. If you want a coding agent you can go build in half a second and read in an afternoon, this is it.\n\nOne thing that always makes me nervous with coding agents is the \"model deletes your files\" moment. Phi defaults to read-only: the agent can scan your codebase\n\n, but writes and shell commands require explicit approval. The approval dialog gives you three choices—allow, deny with feedback, or allow everything for the r\n\nest of the session.\n\nRules are granular:\n\n• bash.allow → go test ./... is fine.\n\n• bash.deny → rm -rf * is blocked.\n\n• fetch.allowed_hosts → restrict which domains the agent can reach.\n\nOne big agent is fine for small tasks, but long-running work pollutes the context window with noise. Phi ships a full set of sub-agent tools (agent_spawn, agen\n\nt_task, agent_wait, agent_list, agent_log, agent_cancel), and the key design choice is that sub-agent transcripts live under ~/.phi/jobs// and never get in\n\njected into the main agent’s context. Only the task summary comes back. Your main session stays clean.\n\nSub-agents also have roles:\n\n• explore — read-only search\n\n• review — read-only checks\n\n• worker — independent edits\n\nIf you don’t need them, you can disable the whole subsystem in config.\n\nMost coding agents edit by doing a textual search-and-replace. The problem is that if the model’s view of the file is even slightly stale, the replace can land\n\nin the wrong place.\n\nPhi uses hash-anchored lines. When it reads a file, every line gets a short hash (FNV-64a, mapped to a compact 2-char code). Edits target a specific hash, not\n\na fuzzy string. If the file changed since it was last read, the hash won’t match—and instead of failing silently, phi returns the new line references (>>>) so\n\nthe model can retry with fresh anchors. No re-reading the whole file, no accidental corruption.\n\nThe TUI is hand-rolled in Go, no historical cruft. First frame in ~40 ms. Features are functional, not cosmetic:\n\n• Markdown rendering + syntax-highlighted code blocks\n\n• Four themes: Dark, Darcula, Pink, Terminal\n\n• Ctrl+K command palette\n\n• @ fuzzy file mentions\n\n• /sessions and /resume for session management\n\n• !command to stream local shell output directly into the transcript\n\n• Skills: drop a SKILL.md into ~/.phi/skills/ and the agent picks it up.\n\n• Sessions: persisted as JSONL per working directory under ~/.phi/session/. Resume anytime.\n\n• Compaction: long conversations auto-compress so context doesn’t just grow forever.\n\nPhi has a hook system that lets you run arbitrary code around every tool call—before the permission gate and after execution—without recompiling anything or st\n\nuffing logic into config.yaml.\n\nEach hook is just a directory with a hook.json manifest and an executable:\n\nThere are two hook events:\n\n• PreTool — runs before the permission gate. Can allow, deny, or rewrite the tool input. A hard deny here stops the tool before any user prompt.\n\n• PostTool — runs after the tool finishes. Can append model-facing context back into the agent’s observation (useful for audit notes or redaction).\n\nHooks are scoped per project: drop one in /.phi/hooks/ and it overrides the user-level hook of the same name. Set PHI_HOOKS=off to disable discovery entir\n\nely. They’re the right place for org policy, audit trails, or input rewriting that the built-in permission gate doesn’t cover.\n\nPhi is MIT-licensed, and I’d genuinely love contributors. If you’ve ever wanted a coding agent that fits in a single binary and doesn’t drag a runtime along, g\n\nive it a spin and tell me what you think.", "url": "https://wpnews.pro/news/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit", "canonical_source": "https://dev.to/libinops/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit-1p0h", "published_at": "2026-08-11 09:44:58+00:00", "updated_at": "2026-08-11 09:46:08.132715+00:00", "lang": "en", "topics": ["developer-tools", "ai-agents", "artificial-intelligence"], "entities": ["phi", "Pi", "Claude Code", "Aider", "Goose", "OpenAI", "Anthropic"], "alternates": {"html": "https://wpnews.pro/news/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit", "markdown": "https://wpnews.pro/news/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit.md", "text": "https://wpnews.pro/news/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit.txt", "jsonld": "https://wpnews.pro/news/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit.jsonld"}}