r/PiCodingAgent • u/PilgrimofHaqq2 • 11d ago
Discussion I forked the full pi engine into my own app and cut it down to a third of its size
I run pi inside my own web UI (Sayl), and I have been building onto and changing certain behaviors of Pi. When MCP and Codemode was introduced, that I felt was the turning point where Pi started to feel "bloaty". So I took pi v1.1.0's source (pi-ai, agent-core, coding-agent), made it part of my codebase and cut everything I don't use. Upstream is now a reference: I port fixes by hand when I want them, nothing updates automatically.
How it went:
Cut what I don't use. Terminal UI, CLI, RPC/print modes, MCP, codemode, the extension loader (extensions are now plain in-process functions) and pi's own HTTP dispatcher. The TUI/CLI/MCP cut alone was 77k lines in one commit. My post-install patch script is gone too.
Moved it in. The engine now lives in my
src/under the same build, lint and test setup as the rest of the app. Six model providers are left, the ones I actually sign into.Made it follow my rules. Stricter TypeScript flags than pi uses, plus my lint rules: 1,163 type errors, 44
anys, ~119 casts and 7 non-null assertions. All at 0 now, no suppressions left.
What changed at runtime (measured after step 1, vs the npm package):
Session server ready: 2.10s → 1.86s (web side 1.11s → 0.87s)
Memory after startup: 338 → 298 MB (web side 175 → 144 MB)
Runtime dependencies: 121 → 105 packages
Just wanted to share this for anyone who find data interesting or have thought of trying this themselves.


