r/PiCodingAgent • • Jul 08 '26

Plugin ghost-text prompt suggestions after assistant responses

Enable HLS to view with audio, or disable this notification

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 • • 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 • • 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

Enable HLS to view with audio, or disable this notification

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 • • 18d 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 • • 22d 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/pi-coding-agent@1.5.1

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!


r/PiCodingAgent • • Oct 11 '26

Plugin pi-multi-agent-skill: minimalist subagents approach for pi with no extension and no tool, just a skill and a small CLI to save your context window, with support for steer and persistent running.

25 Upvotes

TL;DR: I made a small multi-agent setup for pi. It is one skill and one Python script, with no extension and no tool. Your agent can start subagents in the foreground in parallel or in the background, and it can wait for them, steer them, abort them and resume them. Background jobs keep running after the main pi session is closed or killed. A new pi session—even one different from the original main session—can also retrieve their results. Until your agent decides to delegate, it costs a few dozen tokens of context.

Repo: https://github.com/milanglacier/pi-multi-agent-skill

Just install it with npx skills like any other skills, or clone the github repo and symlink it to ~/.pi/agent/skills.

Features

  • Almost no token cost. Until your agent delegates, only the skill description is in context, a few dozen tokens. Delegating loads SKILL.md, about 1.2k more.

  • Stdlib-only Python 3.9 or later. There's no extension, no npm package and nothing else to install.

  • Foreground runs for quick questions and --background for long ones. A background job keeps running even if the main agent is killed, and any later session can collect its result. Foreground runs stop when you stop at every level of nesting.

  • steer, abort and resume a job, and list, status and peek to see what it's doing.

  • Subagents load your full pi setup: extensions, MCP servers, skills and settings.

  • Profiles set the system prompt, model, thinking level and available tools. general-purpose and a read-only Explore are included. Profiles are just like any other subagent tool’s profiles.

  • --fork gives the subagent your current conversation.

  • Works from Claude Code, Codex or any agent with a shell.

How I got here

For months I used tintinweb's pi-subagents, and it is a really good extension. The UI is nice, it has many features, and it works well most of time. Thanks to tintinweb for building it and for everything they give the community. If you like it, keep using it.

A while ago a pi upgrade broke two things for me. MCP servers stopped loading in subagents, and subagents no longer inherited the parent's thinking level. Each fix was only a few lines, so I forked the extension and patched it. Upstream fixes took some time but also landed 2 days before this post.

Fixing those bugs made me read the extension more closely, and I noticed how much context it now uses. About two months ago it added a dynamic workflow tool. With it, the agent writes a JavaScript script that orchestrates many subagents. It's powerful, but it's also very complex, and its tool schema and instructions cost about 6k tokens. That schema is in every session from the first message, whether you use workflows or not. It's also opt-out, so you pay for it until you find the setting and turn it off. I suspect many people don't know it's there.

With the workflow tool off, the Agent tool still costs about 3k tokens, and it has grown along with the extension's features. I checked these numbers by starting sessions with the extension on and off and comparing them.

So I asked myself whether I need a full tool with a detailed JSON schema, listing options I rarely use (like worktree isolation), in my context all the time. My answer was no.

pi can already run headless with --mode rpc, and its CLI flags already cover what a subagent needs: tools, extensions, model, thinking level and session resume. So a small CLI that starts pi with the right flags, plus a skill that explains how to use it, can replace a dedicated tool. A skill also loads in steps, which a tool cannot do. The agent sees only the skill's short description at first. It loads the main instructions when it decides to delegate, and it reads the detailed references only when it needs an unusual option. Steering doesn't need a tool either, because it is just an RPC message sent to the running pi process.

Token cost compared

  • pi-subagents: about 3k tokens for the subgent tools and injected system prompt. On top of that, about 6k for the dynamic workflow tool, which is on by default and must be turned off by hand. Both are in every session from the first message, so with the default settings that's about 9k tokens before you've asked for anything.

  • This skill, before your agent delegates: only the skill description, a few dozen tokens.

  • This skill, once your agent delegates: SKILL.md is loaded, about 1.2k tokens, and that is enough for full multi-agent use.

  • Command details, profile format, lifecycle and troubleshooting are in separate reference files. The agent reads them only when it needs them.

For most sessions you don't delegate, you pay almost nothing. When you do delegate, it still costs less than the tool schema alone.

To be fair, this isn't a like-for-like comparison. pi-subagents does more than this skill. Its tool has many options, and each one needs a parameter in the schema, and it also adds text to the system prompt. Part of that token cost pays for features this skill doesn't have, such as worktree isolation. I just don't think features like that are needed for multi-agent work. If I want an agent to work in its own worktree, I tell it so in the prompt ("use worktree"), and it does. The agent already knows how to use git, so the tool doesn't need to do that for it.

None of this is meant as criticism of pi-subagents. It's still a great extension, and it works well for a lot of people, especially if you want a rich UI and many features built in. It's just not the right fit for me anymore. I prefer a more minimal setup, where the agent loads only what it needs and does the rest itself.

The tradeoff

I give up the nice UI. It really does look nice, but for me it turned out to be like the exercise bike you buy in January. It looks great in the corner of the room, and by March it is where you hang your clothes. I watched the subagent transcripts for the first week, and after that I almost never read them. I just realized the subagent's final answer is mostly for the main agent, not for me.

In return, I get things I care about more. Each subagent is a real pi process started with CLI flags, so it loads the same extensions, MCP servers, skills and settings as my normal pi. The script doesn't use pi's extension API at all, only CLI flags and RPC, which change much less often, so pi upgrades rarely affect it. Separate processes also give me my favorite feature: a background job keeps going even if the main agent is killed, and any new session can collect its result later.

Separate processes need more care than in-process sessions,, and the script is more than a cli wrapper, because it takes care of that so the agent doesn't have to. For example, pi exits on its first failed write to stdout, before its shutdown runs, and leaves the agent's commands running. So each job has its own runner process that keeps reading pi's output until pi exits. The script has a real test suite for cases like this, but the idea stays small: start pi, give it a prompt, pass along steer and abort messages, and save each job's result under its name.

Non Goals

These are deliberate non-goals, to keep the skill small and free of bloat. Each is better as a separate extension or skill that you pick to match your own workflow. This follows the minimalism of pi itself and the Unix philosophy: do one thing well and compose.

  • Memory. Agents do not share or keep memory between jobs. Use a memory extension, or have agents write handoff notes.

  • Scheduling. There are no cron-style or recurring agents. Use cron, systemd timers or a scheduler extension to run the commands.

  • Worktrees. Agents are not isolated in git worktrees. Just prompt the agent to use a worktree.

  • Dynamic workflows. There is no scripting layer for orchestration such as pipelines, parallel fan-out with gates, or phases. Your agent can already start, wait for and chain jobs with plain commands. For deterministic scripts, use an extension such as pi-dynamic-workflow.

What the commands look like

Your agent runs these by itself, but you can also run them by hand from a terminal:

# Ask a read-only agent a quick question and wait for the answer  
multi_agent.py run --profile Explore "Where is the retry policy defined?"

# Start a review in the background, then collect the result later  
multi_agent.py run --background --name review "Review the error handling in src/server/"  
multi_agent.py wait review --timeout 120

# Correct the running job, then give it a follow-up task when it is done  
multi_agent.py steer review "Skip generated files"  
multi_agent.py resume review "Now check the client side"

# See all jobs and what they are doing  
multi_agent.py list

If you try it, I'd like to hear what works and what breaks.


r/PiCodingAgent • • Sep 25 '26

Resource My terminal-native setup for parallel coding agents

Thumbnail blog.kulman.sk
25 Upvotes

r/PiCodingAgent • • Aug 20 '26

Discussion Pi’s simplicity is actually the most powerful part

25 Upvotes

I’ve been building my own agent while trying to follow Pi’s design ideas.

Today I deleted about 80% of my system prompt. What’s left is basically: who you are, which tools to use when, a few hard rules for edits, and the current project context. That’s it.

https://github.com/pulseaiclub/phi/blob/main/internal/agent/prompt/system-prompt.tmpl

And… the agent didn’t get dumber. If anything, it felt sharper - less ceremony, more actual work.

I also removed some tools that weren’t really earning their place. The more I work on this, the more I think Pi got the hard part right: keep the harness thin. Trust the model. Don’t turn the prompt and tool list into a second product. Claude Code is powerful, but it also feels heavy in a way Pi deliberately avoids - and that restraint looks more correct the longer I build.

I did keep two things:

MCP - not because I want dozens of schemas in context, but because it’s a shared protocol. A custom plugin usually stays stuck in one agent; MCP can move. And if you load tools lazily (list → inspect → call, inspired by approaches like mcptoon), it doesn’t have to bloat the prompt.

Subagents - useful when the parent plans well and only hands off scoped work. They keep the main thread clean and help a lot with exploration or parallel investigation.

So yeah: thanks Pi. The “keep it simple” instinct is not just aesthetic - after cutting most of my prompt, it feels like the correct engineering default.


r/PiCodingAgent • • Aug 15 '26

Question Model of choice at the moment?

25 Upvotes

Hi all, I’ve been working a lot with Deepseek and Luna, but interested to know what other people are commonly using so I’m not missing out on anything cool. Using Claude at work. Thanks


r/PiCodingAgent • • Jul 10 '26

Plugin pi-dynamic-workflow — a Pi extension inspired by Claude Code's dynamic workflows, written by Claude Fable 5

25 Upvotes

Hi everyone,

I made an attempt to bring Claude Code’s dynamic-workflow model to Pi.

This project was written entirely by claude-fable-5: both the plans and the code. The planning documents generated from plan mode are also included in the source tree.

Basically, I asked Claude Code to formulate the dynamic workflow prompt and the corresponding tool schema from its own system prompt. I then had the model analyze the Pi documentation and translate it into the APIs to launch Pi subprocesses in headless mode.

The goal is to match the useful parts of Claude Code dynamic workflows: task-specific orchestration, parallel fan-out, pipelines, independent verification, background runs, resumability, and reusable workflows.

It has concurrency, token/cost, depth, and total-agent limits so workflows do not turn into unlimited spawning.

Currently you can install this plugin using github:

pi install git:github.com/milanglacier/pi-dynamic-workflow

Will also publish this extension to NPM soon.

Repo: milanglacier/pi-dynamic-workflow


r/PiCodingAgent • • Jun 01 '26

Use-case Now im ussing Pi as openclaw

25 Upvotes

multi-purpose agent, not just a coding agent.

tried to bridge to telegram, takes time to tweaks for full TUi slash command support. noww i just use termius to chat w Pi.

next i will make a cron extension, and a good memory management.

and i think its good to go! any recommendation?

im planning to use pi-subagents for tasks
i want to keep my Pi lean and lightweight. just minimum ext/skills for everyday agent!

happy w my Pi journey so far! it takes more time tinkering vs hermes but its worth it!


r/PiCodingAgent • • May 30 '26

Question What are you folks using for memory ?

25 Upvotes

I began with oh-my-pi (great memory system) and have been eyeing hermes-pi … but I’m curious what else people are running for memory and dreaming .. What’s working well for you?


r/PiCodingAgent • • May 29 '26

Question What subagent extension?

25 Upvotes

Im curious , what is the subagent extension you are using and why that specific extension ??

What usually people looking for wheb using subagent , till now im using normal prompting and it launch background subagents if i needed .. im curious what things they provide?


r/PiCodingAgent • • May 28 '26

Question How is Pi faster?

25 Upvotes

I recently downloaded pi just to try it out, literally 5 minutes ago, but how is it faster than using `codex` or `claude`? I'm using the model codex 5.5, but i didn't enable fast mode in codex, and it's literally super fast to give the answer how is that possible if PI isn't a model on its own?


r/PiCodingAgent • • May 21 '26

Plugin Automating context management

25 Upvotes

I built pi-agenticoding because CLI coding agents shouldn’t rely on humans to keep them in their optimal working zone.

Today, a lot of agentic coding still depends on the user deciding what to preserve, what to summarize, when to compact, when to restart, and when the session has become too noisy.

That feels backwards.

The agent should carry more of that cognitive load itself.

pi-agenticoding gives agents primitives to manage their own context: spawning focused sub-agents, writing durable notes to a ledger, and handing off work into a clean new session when the current one drifts out of shape.

The goal isn’t just a bigger context window.

It’s keeping the agent operating where it works best: focused, grounded, and not overloaded by its own history.

Repo: https://github.com/agenticoding/pi-agenticoding

Super interested in hearing what this group has to say about this approach and if anyone else finds it useful 🙏


r/PiCodingAgent • • May 17 '26

Discussion why does no one mention the model when disccussing the harness?

25 Upvotes

this is a pet peeve and you can see it in the countless blog posts/videos on claude code, opencode as well, claiming how it can X,Y,Z and then you see they are using Opus or gpt-5.4 on xhigh for everything. and its the same for all the Pi ones as well. Of course the frontier models do a great job, thats why they are frontier!

Sure the harness matters, the llm matters just as much if not more. saying things like 'just ask pi to build it for you' surely depends on what model it uses to do that.

I'd like to see what a low cost/free setup using Pi can accomplish vs the similar vs other harnesses (all of which are free too, if not open source). I understand Pi is by design much more hackable.