r/PiCodingAgent • • May 16 '26

Discussion Best subscription based models for Pi Agent?

28 Upvotes

I just discovered the PiCodingAgent, and it does look really cool and interesting to me. I'm coming from trying out different things before, such as ClaudeCode and Gemini Pro AI, but I prefer the philosophy of PiAgent. The only thing hindering me from fully switching, is that I can't use subscription based models from Anthropic. Also Gemini Pro AI seems to support API usage billing only. I have been happy with Opus 4.6/4.7 performance so far, but would be ready to switch. I'm working with Agents a huge part of the day, so Claude Code alone hasn't been enough for me anymore in terms of usage limits. Now as I'm considering to fully switch to Pi Agent, I'm unsure on which models to use. Primary UseCases are Programming (Backend & Frontend/UI), Scientific Research Support and everyday stuff (RAG for Obsidian 2nd brain etc.). I'm ready to pay around 20-30€ per Month, and struggling to find out, which would be the best value for money. I was thinking about going for Opencodes 10$ subscription, using Opus API Billing for more complex tasks. But I dont really know the models coming with that subscription, and whether they are working well in Pi environment.

What do you think? What are you using and what can you recommend?


r/PiCodingAgent • • May 11 '26

Resource Fully local voice dictation for Pi coding agent

28 Upvotes

Fully local voice dictation for Pi coding agent: no cloud, no API keys

/voice opens an overlay, you talk, live transcript appears, hit Enter and it drops into the agent's editor. Whisper runs on your CPU via sherpa-onnx. Nothing leaves the machine after the initial model download.

What it does

  • 100% on-device STT. Whisper base multilingual (int8 quantized) runs on your CPU. No network calls after the first model download (~198 MB). Works offline after that.

  • Multilingual. Your active locale (set via /languages) is pre-set as Whisper's language hint for better accuracy and lower first-utterance latency. Default is English.

  • Live transcript. Committed lines render as you finish phrases, with a dim rolling partial for the still-active utterance. What you see is what gets pasted.

  • VAD-driven chunking. Silero voice activity detection breaks your speech at natural pauses, so latency stays low even on long rants.

  • Hallucination filter. Whisper sometimes outputs "Thanks for watching" or "[Music]" on silence. The filter strips that. Toggle it off in settings if it's too aggressive.

  • Pause/resume with Space. Step away mid-thought, come back, keep going.

How to install it

pi install npm:@juicesharp/rpiv-voice

https://www.npmjs.com/package/@juicesharp/rpiv-voice

Restart your Pi session. Type /voice. That's it. The first run downloads the Whisper model (198MB), after that it loads from disk.

Controls

KeyAction
SpeakTranscript fills in live
EnterCommit transcript to editor
EscCancel (nothing pasted)
SpacePause / resume mic
TabSwitch to settings screen
Ctrl+SSave settings

r/PiCodingAgent • • May 07 '26

Plugin pi-starship - Starship-powered footer for pi with PR number, model info and token counts

Post image
28 Upvotes

I built a small pi extension that replaces the default footer with your actual Starship prompt — so the colours, icons, and segments are identical to your terminal. On top of that, it adds pi-specific context on the right that Starship can't know about.

Left side — your real Starship output (reads your ~/.config/starship.toml):

  • git branch, status indicators (! modified, ? untracked, ⇣ behind, ⇡ ahead)

  • language versions, virtualenvs, cloud contexts — whatever you already have configured

  • clickable PR #N link that opens the GitHub PR directly in your browser (OSC-8 hyperlink)

Right side — pi context:

  • provider → Model Name

  • ◆ thinking-level when extended thinking is active

  • ↑ input · ↓ output · $ cost for the session

Prerequisites: Starship, gh CLI, a Nerd Font

Install:

  pi install npm:pi-starship

GitHub: https://github.com/rajivm1991/pi-starship


r/PiCodingAgent • • May 04 '26

Resource I built a web search extension for pi that chains 9 backends together (DuckDuckGo, Tavily, Brave, etc.)

28 Upvotes

I've tried a bunch of coding agents over the past year (Claude Code, Aider, Codex CLI, all of them). My favorite was OpenCode for a while, but then I found pi and honestly I'm kind of in love with it.

Anyway, one thing that kept bugging me was the search tool. It worked, but it only had DuckDuckGo. No fallback. If DDG was down or slow, you just waited or got nothing.

So I scratched my own itch and built a unified search extension that chains 9 backends together with auto-fallback. And yes, the whole thing was built using pi itself — 100%. Felt fitting. Also ran entirely on Deepseek v4, which is insanely cheap — I think the whole project cost me like 30 cents in API calls. If Tavily is rate-limited, it tries Brave. If Brave fails, it hits Exa. DuckDuckGo is always the last resort since it doesn't need a key. Works pretty well in practice.

Here's what it supports out of the box:

  • DuckDuckGo — no key, just works (kind of slow though, ~1.1s)

  • Marginalia — anti-SEO search, public API key, surprisingly fast (350ms)

  • Serper — Google results via their API, 2500 free/mo

  • Brave Search — 2000 free/mo, decent speed

  • Tavily — best quality results in my testing, 1000 free/mo

  • Exa — fastest by far (~137ms), AI-native, 10 QPS free

  • Firecrawl — 500 free credits, also does crawling/extraction

  • LangSearch — actually free, no credit card

  • WebSearchAPI — Google-powered, 2000 free credits

Install is just pi install npm:pi-search-multi and you're good to go. The agent automatically picks the best backend. If you want to tweak things, you drop a JSON config in .pi/search.json.

I also threw in a /search-setup command so you can add API keys interactively without editing files, and /search-status to see what's active.

Also threw together a benchmark script — ran all 9 backends against real queries and scored relevance quality. Tavily came out on top quality-wise, Exa was the fastest. The full benchmark report is in the repo if you're into that sort of thing.

Caveats: API keys live in local config files (gitignored by default, but don't be that person who commits them). Marginalia's "public" key is shared so it'll be slower under load. And some backends have pretty tight free tiers — you'll probably want 2-3 keys configured before auto mode really shines.

It's MIT licensed and open source.

Feedbacks are welcome.

https://github.com/ronnieops/pi-search-multi


r/PiCodingAgent • • May 02 '26

Plugin I built a tiny Pi extension 6 months ago, never promoted it. just checked and it has 1,000+ monthly downloads. Thought I'd finally share it.

28 Upvotes

Honestly I'm kind of blown right now.

I made this extension for pi (the coding agent) called pi-capitals-context back in April. It does one simple thing: it automatically discovers any ALL_CAPS.md files and ALL_CAPS/ folders in your project and injects them into the AI's context.

So you just drop files like:

my-project/
├── STATUS.md          ← project status, blockers
├── DESIGN.md          ← architecture decisions
├── RULES/             ← any .md files inside get loaded
│   ├── typescript.md
│   └── git-conventions.md
├── MEMORY/            ← past decisions, lessons learned
│   └── decisions.md
└── CONTEXT/           ← domain knowledge, glossary
    └── glossary.md

...and pi just knows about them. No config, no setup. The AI picks up your project's rules, status, design decisions, whatever you put in there, automatically.

Features:

  • 🔍 Auto-discovers ALL_CAPS.md files and ALL_CAPS/ folders

  • 📁 Subdirectory support — drop RULES.md in src/ and it loads when you're working there

  • ⚡ Toggle overlay (ctrl+shift+c) to enable/disable individual files

  • 📊 Shows token counts so you know exactly what's costing context

  • 💾 Toggle state persists across sessions

I literally just built this for myself because I was tired of re-explaining project context every session. Threw it on npm and forgot about it.

Just checked the stats today: **1,090 downloads/month.

I never posted about it anywhere. Never tweeted. Never shared it. People just... found it and started using it? That's wild to me.

So I figured it's probably time to actually share it properly.

If you're using pi and want your AI agent to actually remember your project's conventions, rules, and status across sessions — give it a try:

pi install npm:pi-capitals-context

GitHub: https://github.com/smalibary/pi-capitals-context
npm: https://www.npmjs.com/package/pi-capitals-context

If you run into any issues or have feature ideas, I'd genuinely love to hear them. I want to make this better now that I know people are actually using it.

Thanks everyone 🙏


r/PiCodingAgent • • 25d ago

Question DeepSeek's aversion to built-in tools

27 Upvotes

I'm running DeepSeek v4.1 Flash locally with Pi. One nuisance I've run into is that it will often use scripts for editing files, listing and grepping files instead of using the built-in tools, and I haven't had much luck with my AGENTS.md changes. Has anyone else run into this and come up with a prompt that increases it tool usage compliance? The one that bothers me the most is when it uses Python scripts to edit files instead of using the tool because it means I don't get a nice diff:

$ cd ... && python3 - <<'EOF'
import re
p = "test/e2e.sh"
s = open(p).read()
s = s.replace("""fail() {
    echo "FAIL: $*" >&2
    cleanup_keep
    exit 1
}""", """fail() {
    echo "FAIL: $*" >&2
    exit 1
}""")
s = s.replace('''$DOCKER logs "$PROJECT-broker-1" 2>&1 \\
    | grep -q "DENY stop llama-swap-test-protected" \\''', '''$DOCKER logs "$(compose ps -q broker)" 2>&1 \\
    | grep -q "DENY stop llama-swap-test-protected" \\''')
open(p, "w").write(s)
EOF

r/PiCodingAgent • • Oct 19 '26

Question Getting Pi coding agent approved for corporate work

27 Upvotes

I'm thinking of putting a ticket in to get pi coding agent approved for use at my day job... has anyone done this? Any issues or was it smooth? For context I work at a company that makes software and has 5 digit employees. And this is just for getting the software approved, I already have approved access to enterprise LLM endpoints.

Edit: more context: it has to go thru a security and legal review process...


r/PiCodingAgent • • Aug 30 '26

Discussion I tested 4 AI coding harnesses (Codex, Pi, Claude Code, OpenCode) with the same models.

27 Upvotes

Like many of you, I have a whole zoo of AI coding tools installed (Codex, Pi, Claude Code, OpenCode, etc.). Main idea - find the most effective harness for my own environment and daily workflow.

The Setup

Target repo: oh-my-opencode-slim. No deep reason, just because I had it open.

Environment: Macos, each run was isolated in a clean, detached Git worktree.

Phase 1: GPT-5.6 Luna

For example: use GPT-5.6 Luna medium across 4 harnesses on a coding bugfix task (fixing an alias counter memory leak + writing tests):

HarnessWall TimeFresh InputTotal InputCache Hit %CorrectnessStatus
Codex107.73s50.3k505.4k90.1%3/3Verified
Pi140.96s44.2k525.4k90.9%3/3Verified
OpenCode stable274.43s109.4k1797.1k93.9%3/3Verified
OpenCode beta402.75s79.8k*1015.4k*91.4%*3/3

After seeing OpenCode stable take 2.5x longer and burn 3.5x more context tokens for the exact same fix, I dropped it from further testing.

Phase 2: Switching to Muse 1.2 contributor

For the next phase, I wanted to test a cheaper, accessible non-GPT model across harnesses. Since I had an active CommandCode subscription, I chose Muse Spark 1.2 Contributor and decided to use it in Claude Code (via OpenCodex proxy) instead of OpenCode stable.

Here is where I made mistake: I forgot to configure the model alias in OpenCodex for Claude Code.

Because of that, Claude Code silently fell back to Sonnet 5 (xhigh thinking) across all 4 tasks while Pi, Codex, and OpenCode beta were running Muse Spark 1.2:

TaskPi (Muse 1.2)Codex (Muse 1.2)Claude Code (Sonnet 5 xhigh)OpenCode beta (Muse 1.2)Observation
Task 1: web research41.66s; 48.9k input; 3/351.35s; 19.9k; 1/359.62s; 83.4k; 3/3110.62s; 245.9k; 1/3Pi finished 18.0s before Claude; both were correct in all runs.
Task 2: repository navigation35.67s; 81.4k input42.52s; 174.8k29.08s; 64.0k48.12s; 196.7kClaude finished about 6.6s before Pi.
Task 3: scope restraint201.02s; 120.5k input; 0 edits233.77s; 214.8k; 0 edits308.50s; 1.56M; over-edited 2 files422.25s; over-edited 2 filesSonnet and OpenCode beta expanded scope; Pi and Codex stopped without edits.
Task 4: regression fix103.96s; 267.4k input; 2/2110.42s; 446.4k; 2/288.62s; 546.8k; 2/2288.05s; 0/2Claude was about 15s faster than Pi, with higher context throughput.

Honestly, looking at the numbers, there wasn't a massive gap between Muse 1.2 and Sonnet 5 for these tasks (probably because the tasks were relatively focused), except Sonnet over-engineered Task 3 by adding 180+ lines of unneeded code, why "unneeded": you can see in table "Task 3" - 0 edits for PI (2 from 3 runs had 0 edits) and Codex (3 from 3 runs had 0 edits), why - because I gave task for model to fix one class, but in git reset command I used commit where this bug was fixed by developer already, so there were nothing to fix, PI understood only during 2 runs, Codex in all 3 runs did 0 changes, but Sonnet 5 was trying to work...

Phase 3: Fixing Proxy Routing

Once I caught the proxy alias mistake, I fixed OpenCodex routing and reran Tasks 3 & 4 for Claude Code with hard proxy verification of Muse Spark 1.2:

Task 3: Verified Claude Code stopped with 0 edits (2/2 pass), matching Codex.

OpenCode beta - I removed from this test, weird behavior, because it started modifying 2 files and then went to another folder and started to read work log of other harnesses, so that would be unfair.

Task 4: All 3 valid harnesses produced the exact same 6-line fix and regression test:

Test has timeout, because for simple fix we dont need wait more than 5 minutes.

HarnessEvaluated ModelRun 1Run 2Mean Wall TimeMean Fresh InputMean Total InputCache Hit %CorrectnessVerification Status
PiMuse Spark 1.271.37s136.54s103.96s61.8k267.4k77.0%2/2Verified
Codex + OpenCodexMuse Spark 1.277.63s143.20s110.42s76.0k446.4k83.0%2/2Verified
Claude Code + OpenCodexMuse Spark 1.296.10s128.81s112.46s86.7k444.2k78.8%2/2Hard-verified proxy audit reruns
OpenCode betaMuse Spark 1.2288.05sTIMEOUT————0/2

Key Takeaways

  1. Context throughput varies by 40%+: On the exact same code fix under Muse 1.2, Pi required ~40% fewer input tokens (267k vs ~445k) than Codex and Claude Code due to leaner context assembly and compaction.

  2. Execution Latency: Pi (104s), Codex (110s), and Claude Code (112s) formed a tight performance tier for coding fixes.

  3. Always audit your proxy: If you use custom models or proxies, always verify the actual upstream model headers. Silent fallbacks happen easily.

  4. My practical decision: OpenCode was consistently 2.5x–4x slower and consumed too much context in my environment, so I removed it from my daily workflow and kept Pi and Codex as my primary tools.

The entire runner, dataset, and reproduction prompt for agents in repo, also more detailed result file is also there:

👉 https://github.com/d1-m4ss/harness-benchmark/tree/main

PS AI was used in this post for generate table and fix grammar, because english is my third language.


r/PiCodingAgent • • Aug 02 '26

Use-case Anneal: a harness for your harness

Thumbnail
github.com
27 Upvotes

I built this so I could use local models like Qwen 3.6 35B for agentic coding. I have given up on trying to make one shotting happen with these models. So to actually get real work done, I built this tool. The idea is you give it a prompt or an already finished implementation plan, and it will split it up into small tasks that the local models will have no problem executing. The plan step is done by a capable model and the final verification is also done by a capable model.

You can pick which model to use for each step based on your pi config. Why pi? It’s the best agent for local models because of how lean it is.


r/PiCodingAgent • • Jul 08 '26

Plugin ghost-text prompt suggestions after assistant responses

27 Upvotes

I built a tiny PI extension that suggests the next prompt as dim ghost text right after the assistant finishes responding, similar to how Claude Code does it. I’m using fast, free models like DeepSeek V4 Flash Free in OpenCode Go. Maybe you’ll like it.

The source code is here: https://github.com/mrclrchtr/supi/tree/main/packages/supi-prompt-suggestions


r/PiCodingAgent • • Jun 15 '26

Question Secure way of running Pi?

27 Upvotes

Hello,

I'm new to the Pi coding Agent and I would like to know how are you running it.
I saw that by default Pi does not ask for permissions. While this is something I would like to start experimenting with, since I'm quite tired of granting access to my other agents on many actions, I'm quite concerned about giving full access to my laptop.

I've seen in the docs that there are three recommended ways to run it within a sandbox, but I have not found much information nor other devs' experience with it.

Are you using any of those options or are you happily running Pi directly on your laptop?


r/PiCodingAgent • • May 10 '26

Question Is Pi better than Claude Code CLI?

27 Upvotes

Honest opinion ! Assume both use opus. Do packages make the difference ?


r/PiCodingAgent • • Apr 28 '26

Plugin I built 12 Pi CLI extensions that I actually use every day

27 Upvotes

If you've used [Pi](https://github.com/mariozechner/pi), you know the base experience is solid. But after months of daily use I kept hitting the same things over and over. No visibility into token usage. No way to steer the agent mid-turn without canceling everything. No task tracking. No way to delegate to Claude or Gemini without leaving the session.

So I built what I needed. Not a kitchen sink. Just the stuff that solves problems I hit every single day.

👉 **[github.com/agnishcc/pi-extention-monorepo](https://github.com/agnishcc/pi-extention-monorepo)**

---

**edb-agent-steer** — Intercept the agent mid-turn. Steer, queue, discard or edit what its doing without killing the session. This one changed how I use Pi entirely.

**edb-append-system-prompt** — Add per-session system prompt snippets. No editing config files, no restarts. Just add context and go.

**edb-ask-user** — Structured questions for the agent to ask you. Text, choice, multi-step wizards. Way better than the agent guessing what you want.

**edb-claude-proxy** — Delegate tasks to Claude Code from inside Pi. Your main agent stays in control, Claude handles the subtask.

**edb-gemini-proxy** — Same thing but Gemini. Sometimes you just want a second opinion from a different model.

**edb-diff-files** — Live widget tracking every file changed this session with an inline diff viewer. No more `git diff` in another terminal.

**edb-explore** — `explore_dir` tool that spins up a sub-agent to search directories. Results stay out of your main context. Keeps things clean.

**edb-global-footer** — Two-line status bar showing cwd, git branch, token usage and model name. Always visible. Always useful.

**edb-herald** — Git commit and PR agent with approval gates. Let the agent draft commits, you approve before anything hits the repo.

**edb-session-manager** — Browse, resume, rename and delete sessions with fuzzy search. If you work across multiple projects this is essential.

**edb-todo** — Structured task list with a live widget. The agent sees your tasks in its system prompt so it stays focused instead of drifting off.

**edb-usage-stats** — `/usage` command showing token rates, rate limit reset timers and live provider status across Claude, Gemini, Copilot, OpenRouter and more.

---

Every extension here exists because I reached for it and it wasn't there. Nothing is included because it could be useful. Only because it is useful, daily, for real work.

They also compose well together. The footer pairs with usage-stats. Todo pairs with agent-steer. Herald pairs with diff-files. Individually they're helpful, together they compound.

---

**Install any of them in seconds:**

```bash

pi install npm:@agnishc/edb-todo

pi install npm:@agnishc/edb-global-footer

# or any other package

```

All published on npm under `@agnishc`, all open source (MIT), all in a monorepo with lockstep versioning so updates are clean.

---

I'd love feedback on this. Which extensions resonate? Whats missing? What would you build on top of this? The monorepo is set up for contributions too, so if you've got an extension idea PRs are welcome.

⭐ If this looks useful a star on the repo helps others find it.


r/PiCodingAgent • • 3d ago

Question Claude Pro subscription with Pi

26 Upvotes

Has anyone here successfully used their Claude Pro subscription with Pi Coding Agent, utilizing the subscription’s included usage rather than paying for API access separately? If yes, how did you do it and were there any issues or limitations?


r/PiCodingAgent • • Sep 28 '26

Discussion What's your top 3 techniques that helped you save tokens / better accuracy from models?

26 Upvotes
  1. Focusing on curating the context, keeping it under 150k. Making tools to trim git / grep / ls output to my liking

  2. indexing my large code base and making the basic tools show short index options + hints. Custom tools was a massive red herring and waste of time, models hate using them and never use them properly

  3. live filter on my codebase to sandbox models. i.e. exclude file types, files older than N days. etc


r/PiCodingAgent • • Sep 10 '26

Question Questions about moving from linear prompts to sub-agents, parallel execution, compaction, and session management in Pi Harness

26 Upvotes

recently switched from Cloud Code to Pi Harness. I work primarily in Product Management/Ownership workflows (Jira, GitLab, Artifactory, internal tooling) where I build automation scripts and connect workspace APIs.

Currently, my setup is strictly linear ask questions -->wait for run --->|reply). I want to move toward a sub-agentic flow—specifically for generating code in parallel from test specifications and existing repos—and would love community input on extensions, configuration, and workflows.

  1. Sub-Agents & Parallelization: What extensions or .pi setups do you use to fire off parallel sub-agents (e.g., parsing specs while indexing code in background threads) instead of waiting on sequential turns?

  2. Traceability & Solution Convergence: How do you track handover steps between agents and follow their decision trees? Are there recommended visualizers, tree-log extensions, or workspace artifact patterns you rely on?

  3. Context Compaction & Memory: Has anyone tuned Pi’s compaction thresholds or used custom highlighters/summary extensions (like Ralph's memory approaches) to preserve key acceptance criteria over long sessions?

  4. Project Scoping (.pi/): Best practices for scoping tool permissions and agent configs in .pi/ settings to isolate sub-agent capabilities (e.g., read-only on repo vs. write access)?

  5. Session Continuity & Long-Running Tasks: How do you handle session lifecycles for complex tasks? Do you prefer continuing existing threads via /resume / pi --continue, or hard-stopping (/new) and carrying over context via file-based handoffs (like PROGRESS.md)?

If you have write-ups, custom extensions, or .pi/ setup examples for these patterns, please let me know and if you have like a step by step workflow also would be good to know. I want to go like in a more step by step approach


r/PiCodingAgent • • Aug 08 '26

Discussion Try integrating Pi with Neovim - it's great.

26 Upvotes

I find it hard to navigate a codebase with coding agents. I need to stare at the code often just to understand what is going on, and I like to be able to ask my agent at the same time what is happening. Plus, I really like my vim motions bindings haha.

It's been surpassingly straightforward to get Pi working in Neovim. You just open up a terminal within Neovim and ask it what you want. Boom done. It's soooo much easier to read plans and navigate code with this setup.

I've been able to make it so that:

  • I see diffs in Neovim instead of in the terminal (much prefer it this way, easier to navigate too imo)

  • Have Pi run commands in Neovim directly when I want to.

  • Have Pi be able to 'focus' in on certain sections of code (I ask 'Can you show me where that it' and it jumps straight to it)

  • I can have whole different worktrees with entirely different buffers that I switch between


r/PiCodingAgent • • Jul 21 '26

Resource Pi Alternative Compositor

26 Upvotes

A demo Pi extension using an alternative screen to add per tool/thinking block collapse with mouse support, and a sidebar. Without interfering with any other Pi extension.


r/PiCodingAgent • • Jul 04 '26

Resource I built spec-driven development as a skill pack for Pi. Here is what actually mattered.

26 Upvotes

I built a spec-driven development kit for Pi and have been running my own projects on it. Posting here because this is the crowd that would actually use it, and I want the feedback on where it fights Pi's flow.

The problem it solves: Pi is capable and has zero memory between sessions. Ask it to "add authentication" and you get 500 confident lines that compile and solve a slightly different problem than the one you had. pi-sdd-kit makes you specify before it codes, as skills you invoke: /skill:sdd-prd, /skill:sdd-spec, /skill:sdd-tasks, /skill:sdd-exec, /skill:sdd-review, with a human approval gate between each.

Two parts do most of the work.

First: steering docs as durable memory. product.md, tech-stack.md (with the reason for each choice, not just the name), conventions.md, and principles.md live in .ai/steering/ and load every session, separate from per-feature specs. The reason line is what pays off: "we use Postgres because payment records need ACID" stops the agent reaching for SQLite three sessions later.

Second: .status is the only gate. One line per feature: requirements:approved, then design:approved, then tasks:approved. The agent reads it before it does anything. A finished-looking design.md on disk is not approval. Only the token is. That stops an eager agent from racing a draft straight into code.

Requirements go in EARS (WHEN / IF / WHILE / SHALL), which leaves almost nothing to interpret.

Install:

pi install npm:@felipefontoura/pi-sdd-kit

# then in Pi:

/reload

/skill:sdd-init

Repo, with the full command reference and templates: https://github.com/felipefontoura/pi-sdd-kit

Longer writeup and the crypto-fintech case study it came out of (13 apps, ~70 days, solo): https://felipefontoura.com/articles/spec-driven-development-case-study


r/PiCodingAgent • • Jun 23 '26

Plugin I made a pi extension for model fusion

Thumbnail
github.com
26 Upvotes

OpenRouter released that model fusion feature and it really clicked – I was seeing the same results on similar agent architectures on internal evals at work. TL;DR: better-than-frontier results by combining a couple models, or get at-frontier results at a fraction of the cost and/or latency.

Started by trying to prompt my way to it, but that wasn't repeatable, and half the session file history was missing,.

I ended up with an extension, with a settings pane, user + repo config, etc. Two main principles:

  1. You own everything: all prompts, settings, presets, etc. are editable and stored in a `fusion.json` dotfile.

  2. Resumable by design: all calls from a single session are saved to a single pi session file. Main thread is clean and linear, and worker output (which is not included in main thread) is saved in custom fields. A must for production workloads, makes it auditable and extensible.


r/PiCodingAgent • • Jun 06 '26

Question Pi devs, I have some questions regarding browsers, web-search, subagents etc

26 Upvotes

Hi all, I have been playing with pi for sometime. But am struggling at having elegant ways to handle some things. Hoping you all can share how you do these things

  1. Browser automation. What all are you using ? playwright browser ? custom playwright scripts ? cypress ?

  2. Browser testing : Same question as above

  3. Web search : any particular api ? I am using ollama cloud. It has a web search tool but it returns 500k tokens worth of data and kills the thread.

  4. Subagents : I am using nicobailon/pi-subagents. This works. The only issue is I can't really dig into the subagent if its doing something funky.

  5. How are you able to get subagents to fire with any reliability ? I have a pi-subagent that should do things for pi. There are clear instructions in my append file to instruct the llm to use that subagent. But it ignores it sooo many times. This also happens with other subagents. Is it just dependent on models ? any suggestions ?


Pi Agent Tasks

ALWAYS delegate Pi coding agent tasks to the pi-things subagent. Never handle these directly.

Pi-related tasks include:

  • Pi configuration (settings.json, auth.json, models.json, keybindings, themes)

  • Creating or editing extensions, skills, prompts, or themes

  • Creating or editing subagents or chains (.md agent files, .chain.md files)

  • Pi CLI usage, commands, modes, shortcuts

  • Session management (fork, compact, resume, branching)

  • Tool/provider registration, MCP integrations

  • Anything in ~/.pi/agent/ or .pi/ directories

{ agent: "pi-things", task: "Create an extension that does X" }
{ agent: "pi-things", task: "Update settings to always use model Y" }
{ agent: "pi-things", task: "Add a new subagent for Z" }


Thanks !


r/PiCodingAgent • • Apr 16 '26

News Warning | Banned from Gemini CLI and Antigravity after using in Pi

26 Upvotes

Thought I had finally found a nice way to put all my subscriptions in one place, but looks like that's not the case. Pi should remove Gemini CLI and Antigravity login until this changes.


r/PiCodingAgent • • Apr 13 '26

Resource Pi Agent Skills

26 Upvotes

Source-grounded skills for Pi.

This repo packages 11 skills that answer Pi questions from a pinned pi-mono checkout instead of guessing from memory. Every cited pi-mono/... path is verified on disk. Every shipped eval, graded baseline, and trigger set is checked in CI.

If you want Pi-focused answers that are package-aware, file-aware, and harder to hallucinate, this repo is the point.

Why this repo is useful

This repo is not trying to be a second set of docs for Pi.

It is a developer toolchain for trustworthy answers about Pi:

  • package-specific entry points instead of “search the monorepo and hope”

  • skills that can explain behavior from source, docs, and examples together

  • machine-checked evals that keep those skills honest over time

If you already work in Pi, that means less spelunking and fewer wrong answers. If you maintain Pi-related tooling, it means you can reuse the same grounded corpus in Pi, Claude Code, or any workflow that can consume skills.

https://github.com/romiluz13/pi-agent-skills


r/PiCodingAgent • • 12d ago

Resource I built Headless Pi (hpi): the normal Pi experience, but headless, on top of Pi Durable

25 Upvotes

Hello guys!

It is not a secret that Pi Durable is hard to use as a coding agent. It is quite easy to build products on top of it, but if you want it to replace normal Pi, Claude Code or Codex for your daily work, it simply requires too much effort. You have to wire up everything from zero, not even the basic barebones are in place for that kind of work, and you end up reinventing the wheel each time.

So I built Headless Pi (hpi). The intuition is very simple: I wanted the experience of normal Pi, where you cd into a project and just start working, but headless.

Basically it is one local daemon that hosts persistent Pi Durable harnesses. A harness belongs to a project folder and has many conversations. On top of that there is a TypeScript SDK, and a CLI that uses the same SDK:

hpi daemon start
hpi harness start --name worker
hpi conversation create --model openrouter/openai/gpt-4.1-nano
hpi send 'Inspect this project' --wait
hpi watch

The daemon brings the running harnesses back after a restart, and the activity (messages, thinking, tool calls, tool results) is stored, so a client can disconnect and continue later from where it was.

Beyond hosting the harnesses, for now it only does two things. It automatically loads the extensions you put in <project>/.hpi/extensions/, and it supports multiple accounts for the same provider, so you can do hpi auth login anthropic --account work and then use the models as anthropic@work/<model>.

And that's it, it is minimal and unopinionated on purpose. There are no built-in tools, no automatic system prompt, no AGENTS.md loading, no skills and no global agent directory. If you want any of those, you write an extension for it. All of these can come in the future if people (and me) ask for them, but I wanted to start explicitly minimal and not decide for you how your agent should look.

The thing I don't understand tbh is why this didn't exist already. When Pi Durable launched I expected something like this to come out the day after, because the idea is so obvious: take the thing everybody already likes about Pi and make it run without a terminal. But it never came, so I built it myself.

This is also the other reason I keep it minimal. I think the idea is so obvious that the Pi maintainers will release their own version sooner or later, and I really don't want to maintain a parallel implementation of it. So I'm trying to save as much work as possible. But meanwhile we got hpi.

So far I have built a few things with it. The main one is an agent for my team that lives in Slack, Linear and GitHub, where each one is a small independent service that receives the webhooks and talks to the same harness through the SDK. I also built a small local web UI to chat with it and work on documents together, and an MCP extension. I will write another post about that setup, because it deserves its own.

Keep in mind that this is still an experimental project:

  • It only works on Linux with systemd user services.

  • It is not on npm yet, you install it from the repo.

  • Pi coding agent extensions don't work as they are, they need to be adapted to Durable.

  • All extensions run inside the daemon process, so one bad extension can affect every harness.

  • Things can change and break. I use it every day, but I'm the only one who has.

Repo: https://github.com/elpapi42/headless-pi

If you try it, or if you solved the same problem in another way, I would really like to hear about it. And if something like this already exists and I missed it, tell me too.


r/PiCodingAgent • • 17d ago

Use-case Run Pi Coding Agent 100% Locally with TensorSharp + Qwen3.8 27B (CLI, SDK, KV Cache Reuse, and E2E Tests)

Thumbnail
github.com
25 Upvotes

Run Pi Coding Agent 100% Locally with TensorSharp + Qwen3.8 27B (CLI, SDK, KV Cache Reuse, and E2E Tests)

Hi everyone!

I'm the developer of TensorSharp, an open-source .NET-based local LLM inference engine.

I've put together a fully working, end-to-end example of running Pi Coding Agent with TensorSharp as its local inference backend, using Qwen3.8 27B.

No cloud inference API, no API subscription, and no external model provider required.

The example covers:

  • Running Pi interactively with a local model.

  • Connecting Pi through TensorSharp's OpenAI-compatible API.

  • Configuring Qwen3.8 27B with DFlash2 speculative decoding.

  • Using Pi programmatically through its JavaScript SDK.

  • Preserving KV cache across multi-round agent/tool interactions.

  • Automatically fixing bugs in a real Node.js project and verifying the results.

Complete working example:

https://github.com/zhongkaifu/TensorSharp/tree/main/examples/pi-coding-agent

1. Architecture

The integration is straightforward:

Pi Coding Agent (CLI / SDK)
          |
          | OpenAI-compatible API
          v
TensorSharp Server (localhost:5000)
          |
          v
Qwen3.8 27B (GGUF)
          |
          +-- ggml_metal (Apple Silicon)
          +-- DFlash2 speculative decoding
          +-- 64K context window
          +-- q8_0 KV cache
          +-- Prefix/KV cache reuse

Pi handles the agent loop, file operations, shell commands, and code editing.

TensorSharp handles model inference, token generation, speculative decoding, and KV caching.

This separation means Pi can keep using its existing tools while running entirely against a local inference server.

2. Hardware and software

The example was validated on:

  • MacBook Pro M5 Pro, 48 GB unified memory

  • macOS 27.2

  • .NET 10 SDK

  • Node.js 26.8.1

  • Pi Coding Agent 1.5.1

  • Qwen3.8 27B UD-IQ3_XXS GGUF

  • DFlash2 Q4_K_M draft model

The setup requires Apple Silicon with at least 32 GB of unified memory.

The main model uses approximately 10.9 GB, and the draft model uses another 1.1 GB.

The remaining memory is used for the KV cache and Metal buffers.

3. Clone and build TensorSharp

First, clone the repository:

git clone https://github.com/zhongkaifu/TensorSharp.git
cd TensorSharp

Install the .NET 10 SDK, CMake 3.20+, and Xcode command-line tools if needed.

Build the inference server:

dotnet build TensorSharp.Server.Host \
  -c Release \
  -p:TensorSharpSkipMlxNative=true

This builds the native ggml backend with Metal support.

4. Start the local inference server

Run:

examples/pi-coding-agent/scripts/start-server.sh

Under the hood, this executes:

dotnet TensorSharp.Server.Host/bin/TensorSharp.Server.Host.dll \
  --config config/qwen3.8-27b-metal-dflash2.json \
  --config examples/pi-coding-agent/tensorsharp-pi.json

On first launch, TensorSharp automatically downloads the main model and DFlash2 draft model from pinned Hugging Face revisions and verifies their SHA-256 hashes.

The Pi-specific TensorSharp configuration overlay is:

{
  "host": "127.0.0.1",
  "port": 5000,
  "max-tokens": 16384,
  "mmproj": "none",
  "kv-cache-dtype": "q8_0",
  "environment": {
    "MAX_CONTEXT": "65536"
  }
}

This overlay is applied after the model preset.

The configuration enables:

  • 64K context window

  • 16,384 maximum output tokens

  • q8_0 KV cache

  • DFlash2 speculative decoding with 7 drafts per step

  • Greedy decoding

  • Localhost-only access

Verify that the server is running:

curl http://127.0.0.1:5000/v1/models

Expected model ID:

Qwen3.8-27B-UD-IQ3_XXS

5. Install Pi Coding Agent

Install the validated version:

npm install -g @earendil-works/[email protected]

Check:

pi --version

Note that this example uses the newer @earendil-works/pi-coding-agent package rather than the deprecated @mariozechner/pi-coding-agent package.

6. Configure Pi to use TensorSharp

Pi supports custom OpenAI-compatible model providers through models.json.

The example includes a ready-to-use configuration at:

examples/pi-coding-agent/pi-agent/models.json

Here's the complete provider configuration:

{
  "$schema": "https://pi.dev/schemas/models.schema.json",
  "providers": {
    "tensorsharp": {
      "name": "TensorSharp (local)",
      "baseUrl": "http://127.0.0.1:5000/v1",
      "api": "openai-completions",
      "apiKey": "none",
      "compat": {
        "supportsDeveloperRole": true,
        "supportsReasoningEffort": false,
        "supportsStore": false,
        "maxTokensField": "max_completion_tokens",
        "thinkingFormat": "qwen-chat-template"
      },
      "models": [
        {
          "id": "Qwen3.8-27B-UD-IQ3_XXS",
          "name": "Qwen3.8 27B (TensorSharp, DFlash2)",
          "reasoning": true,
          "input": ["text"],
          "contextWindow": 65536,
          "maxTokens": 16384,
          "cost": {
            "input": 0,
            "output": 0,
            "cacheRead": 0,
            "cacheWrite": 0
          }
        }
      ]
    }
  }
}

The matching settings.json is:

{
  "defaultProvider": "tensorsharp",
  "defaultModel": "Qwen3.8-27B-UD-IQ3_XXS",
  "defaultThinkingLevel": "medium",
  "enableInstallTelemetry": false
}

A few important details:

  • Model ID: Must exactly match the model returned by /v1/models.

  • Thinking: qwen-chat-template allows Pi to control Qwen's thinking mode through chat_template_kwargs.enable_thinking.

  • Context window: Must match TensorSharp's actual context configuration.

  • Output tokens: 16,384 tokens give the model enough room for reasoning and code generation.

  • API key: The local server does not require authentication. Keep it bound to localhost.

You don't need to manually install these files if you use the provided launcher.

7. Run Pi locally

From the TensorSharp repository root:

examples/pi-coding-agent/scripts/pi.sh

The launcher creates a separate Pi configuration directory:

~/.pi/tensorsharp-agent/

It copies the provider configuration there on first use, leaving your existing ~/.pi/agent configuration untouched.

For interactive coding:

cd ~/src/my-project

~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh

You can now ask Pi to inspect your code, run commands, modify files, and fix bugs using your local Qwen model.

For a single non-interactive task:

~/work/TensorSharp/examples/pi-coding-agent/scripts/pi.sh \
  -p "Explain what src/stats.js does" < /dev/null

Other useful commands:

# Disable thinking for simpler tasks
pi.sh --thinking off -p "..." < /dev/null

# Stream JSON events without saving a session
pi.sh --mode json --no-session "..." < /dev/null

# Continue the previous session
pi.sh --continue

The launcher also disables Pi's catalog refresh, version checks, and telemetry.

8. Use TensorSharp with Pi's JavaScript SDK

The example also demonstrates running Pi programmatically.

This is useful for building your own local coding automation, CI workflows, or agent applications.

The SDK entry point is:

examples/pi-coding-agent/sdk/run-task.mjs

The core integration looks like this:

import {
  createAgentSession,
  ModelRuntime,
  SessionManager
} from "@earendil-works/pi-coding-agent";

import path from "node:path";

const agentDir = path.join(
  process.env.HOME,
  ".pi/tensorsharp-agent"
);

const projectDir = process.cwd();

const modelRuntime = await ModelRuntime.create({
  modelsPath: path.join(agentDir, "models.json"),
  authPath: path.join(agentDir, "auth.json")
});

const model = modelRuntime.getModel(
  "tensorsharp",
  "Qwen3.8-27B-UD-IQ3_XXS"
);

const { session } = await createAgentSession({
  cwd: projectDir,
  agentDir,
  modelRuntime,
  model,
  thinkingLevel: "medium",
  sessionManager: SessionManager.inMemory()
});

session.subscribe((event) => {
  if (event.type === "tool_execution_start") {
    console.log(
      `[tool] ${event.toolName}`,
      event.args
    );
  }

  if (
    event.type === "message_update" &&
    event.assistantMessageEvent.type === "text_delta"
  ) {
    process.stdout.write(
      event.assistantMessageEvent.delta
    );
  }
});

await session.prompt(
  "Run npm test, fix the bugs in src/stats.js, " +
  "and rerun the tests. Do not modify the tests."
);

console.log(session.getLastAssistantText());

session.dispose();

For the complete executable SDK implementation, including setup and token accounting, see:

https://github.com/zhongkaifu/TensorSharp/blob/main/examples/pi-coding-agent/sdk/run-task.mjs

9. Run the automated end-to-end test

This is the part I found most interesting.

Instead of just asking the model a question, the repository includes a small Node.js project containing three intentional bugs:

  1. median() incorrectly sorts numbers as strings.

  2. median() doesn't average the two middle values for even-length arrays.

  3. percentile() contains an off-by-one error.

Three of the five tests initially fail.

Pi must:

  • Read the project.

  • Run the tests.

  • Identify the bugs.

  • Modify the implementation.

  • Rerun the tests.

  • Make all five tests pass without modifying the tests themselves.

The example tests this twice: once through Pi's CLI and once through its SDK.

With the server already running:

examples/pi-coding-agent/scripts/e2e.sh

Or let the test script start the server:

START_SERVER=1 \
  examples/pi-coding-agent/scripts/e2e.sh

The script independently verifies that all five tests pass and that the test file remains byte-for-byte unchanged.

Both runs passed in the documented validation.

10. Actual measured results

Tested November 9, 2026, on an M5 Pro with 48 GB unified memory.

Metric Pi CLI Pi SDK

Final result PASS PASS Tests passing 5/5 5/5 Wall-clock time 88s 83.4s Model requests 10 8 KV/prefix cache reuse 86--99% after first request 87% overall

For the SDK run:

8 model requests in 83.4 seconds

Prompt tokens processed:
48,166

Prompt tokens served from prefix cache:
41,962

Cache reuse:
87%

Generated tokens:
2,117

Final tests:
5 passed, 0 failed

Additional observations:

  • Initial cold prompt: approximately 3.9K--4.1K tokens.

  • Initial time to first token: 13--14 seconds.

  • Subsequent time to first token: 0.45--3.5 seconds.

  • Decoding speed: approximately 20--43 tokens/second.

These are measurements from one small coding task, not a general coding benchmark. Different tasks and model outputs will produce different results.

11. Why KV-cache reuse matters for coding agents

A coding agent behaves differently from a simple chatbot.

A typical agent loop looks like this:

User request
    |
    v
Model generates tool call
    |
    v
Pi executes shell command
    |
    v
Tool output returned to model
    |
    v
Model generates another tool call
    |
    v
Pi edits source code
    |
    v
Model reviews test results
    |
    v
Final answer

Each model request includes much of the previous conversation:

  • System instructions

  • Tool definitions

  • Previous reasoning

  • Tool calls

  • Tool results

  • New observations

Without effective KV-cache reuse, the inference engine may need to prefill most of that history again and again.

TensorSharp reuses the matching prefix from the previous request, so subsequent agent rounds only need to process the newly appended tokens.

One subtle issue we fixed was whitespace around Qwen's </think> boundary.

Pi returns the model's streamed reasoning in subsequent requests, including surrounding whitespace. Previously, TensorSharp's cached representation didn't match those returned tokens exactly.

That prevented full conversation-prefix reuse.

After fixing the matching behavior, subsequent rounds could reuse much more of the previous KV state.

In our SDK test, 41,962 of 48,166 prompt tokens were served from the prefix cache.

For multi-step coding agents, this can make a substantial difference in latency.

12. What about NVIDIA GPUs?

TensorSharp also supports NVIDIA GPUs.

For Qwen3.8 27B, the repository includes an NInfer NVFP4 preset using the direct CUDA engine.

You can select it with:

TENSORSHARP_PRESET=config/qwen3.8-27b-ninfer.json \
  examples/pi-coding-agent/scripts/start-server.sh

However, the complete Pi integration and measurements described here were validated on Apple Silicon.

The NVIDIA preset has not yet been validated with this Pi workflow, including the q8_0 KV configuration.

13. Source code and documentation

Everything is open source:

TensorSharp repository:

https://github.com/zhongkaifu/TensorSharp

Complete Pi integration example:

https://github.com/zhongkaifu/TensorSharp/tree/main/examples/pi-coding-agent

The example includes the server configuration, Pi provider settings, launch scripts, SDK implementation, sample project, and automated end-to-end tests.

I'd love to hear from other Pi users:

Are you running Pi with local models? Which models and inference backends have worked best for multi-step coding tasks?

I'm particularly interested in comparisons involving long agent sessions, repeated tool calls, context growth, and KV-cache reuse.

Feedback, issues, and contributions are very welcome!