<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: libinops</title>
    <description>The latest articles on DEV Community by libinops (@libinops).</description>
    <link>https://dev.to/libinops</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4072755%2Fbc4f0acf-4a75-4aee-b6fb-ba0abf554ee6.jpg</url>
      <title>DEV Community: libinops</title>
      <link>https://dev.to/libinops</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/libinops"/>
    <language>en</language>
    <item>
      <title>phi – the 12 MB alternative to Pi: no Ts, any model, hashline edit</title>
      <dc:creator>libinops</dc:creator>
      <pubDate>Tue, 11 Aug 2026 09:44:58 +0000</pubDate>
      <link>https://dev.to/libinops/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit-1p0h</link>
      <guid>https://dev.to/libinops/phi-the-12-mb-alternative-to-pi-no-ts-any-model-hashline-edit-1p0h</guid>
      <description>&lt;p&gt;Hi everyone &lt;/p&gt;

&lt;p&gt;I’ve been hacking on a terminal coding agent called phi &lt;a href="https://github.com/pulseaiclub/phi" rel="noopener noreferrer"&gt;https://github.com/pulseaiclub/phi&lt;/a&gt; for the past few months, and I’d love to share what it is and why it exists.&lt;/p&gt;

&lt;p&gt;If 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&lt;br&gt;
 Go binary, ~12 MB, with no Node, Electron, or Python in sight.&lt;/p&gt;

&lt;p&gt;Here’s what makes it tick:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;No model lock-in&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This 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&lt;br&gt;
 eats 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&lt;br&gt;
 n 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.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;As light as it gets&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Go 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&lt;br&gt;
 e 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.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A permission gate that actually matters&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One 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&lt;br&gt;
 , 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&lt;br&gt;
 est of the session.&lt;/p&gt;

&lt;p&gt;Rules are granular:&lt;/p&gt;

&lt;p&gt;• bash.allow → go test ./... is fine.&lt;br&gt;
 • bash.deny → rm -rf * is blocked.&lt;br&gt;
 • fetch.allowed_hosts → restrict which domains the agent can reach.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sub-agents that don’t bloat your context&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One 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&lt;br&gt;
 t_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&lt;br&gt;
 jected into the main agent’s context. Only the task summary comes back. Your main session stays clean.&lt;/p&gt;

&lt;p&gt;Sub-agents also have roles:&lt;/p&gt;

&lt;p&gt;• explore — read-only search&lt;br&gt;
 • review — read-only checks&lt;br&gt;
 • worker — independent edits&lt;/p&gt;

&lt;p&gt;If you don’t need them, you can disable the whole subsystem in config.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hashline edits instead of blind replace&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most 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&lt;br&gt;
  in the wrong place.&lt;/p&gt;

&lt;p&gt;Phi 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&lt;br&gt;
 a 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 (&amp;gt;&amp;gt;&amp;gt;) so&lt;br&gt;
 the model can retry with fresh anchors. No re-reading the whole file, no accidental corruption.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A TUI built for actual use&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The TUI is hand-rolled in Go, no historical cruft. First frame in ~40 ms. Features are functional, not cosmetic:&lt;/p&gt;

&lt;p&gt;• Markdown rendering + syntax-highlighted code blocks&lt;br&gt;
 • Four themes: Dark, Darcula, Pink, Terminal&lt;br&gt;
 • Ctrl+K command palette&lt;br&gt;
 • @ fuzzy file mentions&lt;br&gt;
 • /sessions and /resume  for session management&lt;br&gt;
 • !command to stream local shell output directly into the transcript&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sessions, skills, and compaction&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;• Skills: drop a SKILL.md into ~/.phi/skills/ and the agent picks it up.&lt;br&gt;
 • Sessions: persisted as JSONL per working directory under ~/.phi/session/. Resume anytime.&lt;br&gt;
 • Compaction: long conversations auto-compress so context doesn’t just grow forever.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hooks: custom logic without touching the binary&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Phi 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&lt;br&gt;
 uffing logic into config.yaml.&lt;/p&gt;

&lt;p&gt;Each hook is just a directory with a hook.json manifest and an executable:&lt;/p&gt;

&lt;p&gt;There are two hook events:&lt;/p&gt;

&lt;p&gt;• 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.&lt;br&gt;
 • PostTool — runs after the tool finishes. Can append model-facing context back into the agent’s observation (useful for audit notes or redaction).&lt;/p&gt;

&lt;p&gt;Hooks 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&lt;br&gt;
 ely. They’re the right place for org policy, audit trails, or input rewriting that the built-in permission gate doesn’t cover.&lt;/p&gt;

&lt;p&gt;Phi 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&lt;br&gt;
 ive it a spin and tell me what you think.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>go</category>
    </item>
  </channel>
</rss>
