Skip to content
PiSharp 0.99.1 is out, tracking Pi v0.99.1. Syncing to Pi 1.1.0 is underway. See parity →
v0.99.1 · TRACKS PI v0.99.1 · .NET 10

The minimal agent harness,
native to .NET

PiSharp is an independent C# port of the Pi coding agent. Pi's sessions, RPC and workflow, with native C# extensions, embeddable libraries, and no Node runtime required.

Install as a .NET toolRequires .NET 10
$ dotnet tool install -g PiSharp.Cli

Then run pisharp. Or build from source.

PiSharp — make it yours
~/src/orders-api · anthropic · claude-sonnet

› add exponential backoff to the payment client retries

read   src/Payments/PaymentClient.cs
read   src/Payments/RetryPolicy.cs
edit   src/Payments/RetryPolicy.cs  +18 -6
bash   dotnet test tests/Payments.Tests

Retries now back off exponentially with jitter, capped at 5 attempts.
Tests pass. Want me to make the cap configurable?
Why PiSharp?

Pi's philosophy, without leaving .NET

Native .NET 10

One runtime, no Node. The CLI, terminal UI, RPC and agent loop are all C#.

Zero external dependencies

No third-party packages, a locked restore and a pinned SDK. A short supply chain you can audit.

Extend in C#

Tools, commands, hooks and UI as native extensions, plus an optional bridge for existing Pi extensions.

Embed it anywhere

Every layer ships on NuGet. Use just the LLM client, or the whole agent, in your own app.

Switch models mid-session
/model
› anthropic · messages
  openai · completions / responses
  azure · responses
  google · generative-ai
  mistral · conversations

Bring your providers

Streaming adapters for Anthropic Messages, OpenAI Completions and Responses, Azure Responses, Google Generative AI and Mistral Conversations, with more landing as parity grows.

Switch with /model.

Sessions are trees

Branch from any point, keep every branch in one file, and compact long histories automatically.

PiSharp keeps its own home directory and imports Pi sessions only when you ask. It never touches Pi's files.

Navigate the session tree
● user   plan the retry change
├─● asst   read 2 files
│ ├─● user   use a retry library
│ │ └─○ asst   …abandoned
│ └─● user   keep it dependency-free
│   └─● asst   edit RetryPolicy.cs  ← you are here
└─● compaction   summary of earlier entries
A native extensionC#
public sealed class StatefulTodoExtension : IPiSharpExtension
{
    public ValueTask InitializeAsync(
        IExtensionRegistry registry, CancellationToken ct)
    {
        registry.RegisterTool(new("todo", "todo",
            Description, JsonData.Parse(ParametersJson),
            ExecuteAsync));
        return ValueTask.CompletedTask;
    }
}

Primitives, not features

Register tools, commands, shortcuts, renderers and typed hooks from a plain C# class. Ship it as a NuGet package.

Already have Pi extensions? The optional Node bridge runs them alongside native ones.

Explore extensions →

Four ways to run it

The full terminal UI, print and JSON event streams for scripts, a JSON RPC protocol over stdin/stdout for any language, or the SDK inside your own .NET app.

Interactive

Full terminal UI with steering and follow-ups

Print / JSON

One-shot answers and event streams

RPC

Pi's protocol over stdin/stdout

SDK

Embed the agent in any .NET app

On NuGet

Take the whole agent, or just a layer

Browse the SDK →
Inherited from Pi

What we didn't build

PiSharp keeps Pi's minimal core. Features other agents bake in are left to extensions, so the harness fits your workflow, not the other way around.

Read why, from Pi's author ↗

No sub-agents

Spawn instances via tmux, or build your own as an extension.

No permission popups

Run in a container, or write a confirmation hook that matches your policy.

No plan mode

Write plans to files, or install an extension that does it your way.

No built-in to-dos

Use a TODO.md, or the sample todo extension, in C#.

No background bash

Use tmux. Full observability, direct interaction.

No Node requirement

The one thing PiSharp adds to the list: the bridge is opt-in.

Already using Pi?

Bring your sessions, skills and prompts

PiSharp is built to read Pi's AGENTS.md, skills, prompt templates and themes, and to import sessions on request. Your Pi install stays exactly as it is.

Coming from Pi →

Get involved