跪拜 Guibai
← Back to the summary

Pi's 200-Token System Prompt Undercuts Claude Code by 7x While Hitting 99.93% Cache Rates

Foreword

The system prompt is only 200 tokens, yet it has racked up 86,000 stars on GitHub. How did it become the strongest alternative to Claude Code?

Recently, my tech group has been flooded with one name — Pi.

image

The first time I heard about Pi, I thought it was just another new AI coding tool.

After all, this space is already crowded with Claude Code, Codex, Cursor... one more wouldn't be surprising.

But after digging deeper, I found that Pi is on a completely different track from the other tools.

While everyone else is frantically piling on features, Pi is obsessively subtracting.

Claude Code's system prompt has 14,000 tokens and over a dozen built-in tools.

Cursor and Windsurf are also constantly cramming in new features — sub-agents, plan mode, MCP, permission pop-ups, background Bash, TODO management.

And Pi?

Its system prompt is only 200 tokens.

It has just 4 core tools — Read, Write, Edit, Bash.

One pushes complexity to the extreme; the other pushes simplicity to the extreme.

The result?

Pi has racked up 86,000 stars on GitHub.

Developers have rated it as "the only Agent architecture that can truly replace Claude Code right now."

In this article, I'll break down from start to finish why more and more people are using Pi.

For more project walkthroughs, visit the Java突击队 website: susan.net.cn/project

1. What exactly is Pi?

Pi is an open-source terminal AI coding agent created by libGDX founder Mario Zechner. Its core idea can be summed up in one sentence:

It gives you primitives, not pre-cooked features.

It does something very counter-intuitive in its design: it deliberately removes the features that other tools are frantically adding.

But Pi retains four "primitive-level" tools:

Tool Description
read Read file content (supports text and images)
write Write/create files
edit Precisely replace file content
bash Execute bash commands

The effect of this combination is astonishing: Pi's system prompt plus tool definitions total less than 1,000 tokens.

Claude Code's system prompt alone takes up 14,000 tokens.

Mario Zechner said something very pointed when explaining Pi's design philosophy:

"The current generation of state-of-the-art large models is already very good at a few things: reading files, writing files, editing files, and calling bash. In many cases, bash itself is the most universal tool interface. You don't need to teach the model how to do it; you just need to tell it what tools are available."

This sentence hits the core logic of Pi: Today's frontier models have been trained well enough by RL; they inherently understand what a coding agent is and how to do it. They don't need a 10,000-token essay to teach them how to work.

2. Understanding Pi's core architecture in one diagram

Before diving into the code, let's build an overall understanding.

image

Pi's core architecture is extremely simple — it's essentially a while loop: call the LLM, equip it with 4 tools, and decide whether to continue calling based on the model's returned results.

The direct benefit of this minimalist design is: its complexity is controllable, understandable, and extensible.

3. Why are more and more people using Pi?

3.1 Reason 1: Insanely cheap

A 99.93% cache hit rate.

This is Pi's most shocking statistic.

After a developer connected DeepSeek to Pi, about 99.93% of input tokens successfully hit the cache.

In other words, the cache miss rate is only 0.07% — the vast majority of repeated context does not need to be recomputed.

Why can Pi achieve such an outrageous cache hit rate?

Because Pi's system prompt is only 200 tokens.

Other coding agents' system prompts are often tens of thousands of tokens long, and these tokens must be resent to the model with every call.

Pi only has 200 tokens, and even with tool definitions, it's under 1,000 tokens.

The shorter the system prompt, the higher the proportion of tokens that can hit the cache, and the lower the call cost.

The Composio team horizontally tested 8 mainstream Agent Harnesses, plugging DeepSeek V4 Flash into them to run real tasks.

The result: Pi had the lowest average cost for completing a successful task, requiring only about $0.028 USD.

Claude Code came in at 7 times the price of Pi.

DeepSeek's tokens are already sold very cheaply, and Pi allows users to spend even less.

3.2 Reason 2: No model lock-in

Say goodbye to "platform dependency syndrome."

At the end of June 2026, Claude Code carried out a wave of large-scale account bans.

It did this by reading the user's local timezone (if it was Asia/Shanghai, it would change the date format), checking if a relay domain was used, and replacing characters in the system prompt with different Unicode encodings.

This information was sent back to Anthropic's servers, and the backend directly determined if you were a Chinese user.

Changing IPs, nodes, or relays was useless. Because it wasn't detecting your network environment; it was detecting your device environment.

This incident made many developers realize one thing: tying your means of production to any single tool is dangerous.

Pi, from the very beginning, is not bound to any specific model. It can connect to:

You can use Claude's API to run Pi today, and the model's capability itself is not diminished. But you are no longer dependent on the Claude Code client.

If your account is banned, the model is still there. Just switch to another provider and keep working.

3.3 Reason 3: Compatible with existing assets

Seamless migration of Skills and AGENTS.md.

If you've already accumulated a bunch of Skills in Claude Code, Pi will automatically read the ~/.agents/skills directory after installation — no migration needed, Pi recognizes it directly, ready to use out of the box.

Similarly, Pi also supports AGENTS.md.

The project context file you previously wrote in the project root directory will be automatically loaded when Pi opens the project.

The set of project specifications, constraints, and boundaries you've accumulated can be used in Pi without changing a single line.

3.4 Reason 4: Extensible

If you want a feature, install it yourself.

Pi only provides 4 tools by default. But if you need plan mode, sub-agents, MCP, Git checkpoints, or permission control, you can install them piece by piece through extensions and Skills.

An analogy: other tools are like a fully furnished apartment; everything is there when you move in, but you can't change the layout. Pi is a bare shell — water and electricity are connected, four walls are up. Whether you decorate it into a studio, a gaming room, or a three-bedroom apartment is entirely up to you.

A real-world case: one developer built a configuration based on Pi that included 17 plugins, 18 global Skills, and 2 MCP servers.

Using a one-click install script, they turned Pi into an all-purpose terminal coding agent capable of multi-agent collaboration, token saving, and running a browser.

4. Getting Pi running in three steps

Theory is not enough; let's see how to quickly get started with Pi.

4.1 Step 1: Install Pi

Pi is installed via npm and requires a Node.js environment:

npm install -g @earendil-works/pi-coding-agent

Pi's official documentation recommends using the --ignore-scripts flag:

npm install -g --ignore-scripts @earendil-works/pi-coding-agent

4.2 Step 2: Configure API Key

Pi supports multiple authentication methods:

Method 1: Environment variables (recommended)

# Example using DeepSeek
export DEEPSEEK_API_KEY="your API Key"

# Or Anthropic
export ANTHROPIC_API_KEY="your API Key"

# Start Pi
pi

Method 2: OAuth login (subscription accounts)

pi /login
# Select provider and complete OAuth authentication

Supported subscription services include: Claude Pro/Max, ChatGPT Plus/Pro, GitHub Copilot, Google Gemini CLI, etc.

4.3 Step 3: Enter Pi's interactive interface

After installing and configuring the API Key, simply type pi in the terminal to enter interactive mode:

pi

After startup, the terminal interface displays from top to bottom:

Common shortcuts:

Shortcut Function
Ctrl+C Clear editor
Ctrl+C × 2 Exit pi
Escape Cancel/abort current operation
Ctrl+L Open model selector
Shift+Tab Cycle through thinking levels

Common commands:

Command Function
/login OAuth authentication
/model Switch model
/resume Resume previous session
/new Start new session
/session Show session info
/tree Browse session tree
/compact Manually compact context
/exit Exit

4.4 Hands-on: Using Pi in a Java project

Suppose you have a Spring Boot project and want Pi to fix a unit test. Just type in the terminal:

pi

Then enter the task description:

Help me fix all the broken unit tests in this Spring Boot project

Pi will automatically:

  1. Use read to read the test files
  2. Use bash to execute test commands (e.g., mvn test)
  3. Analyze the error output
  4. Use edit to modify the problematic test code
  5. Run the tests again to verify

The entire process is completed in the terminal; you don't need to switch any tools.

5. Differences between Pi and Claude Code

I put Pi and Claude Code side-by-side for a comparison:

Comparison Dimension Pi Claude Code
System Prompt ~200 Tokens ~14,000 Tokens
Core Tools 4 (read/write/edit/bash) 10+
Model Binding Unbound, supports 15+ providers Claude only
Open Source License MIT Closed source
Extension Method Plugins/Skills/TypeScript Limited (Skills)
Design Philosophy Subtraction Addition
MCP Support Not supported, use CLI tools instead Native support
Permission Management Default YOLO mode Pop-up confirmation
Cost Extremely low (~$0.028/task) High (7x Pi)
GitHub Stars 86,000+ 124,000+

6. Pros and Cons

Pros

1. Ultimate cost savings The system prompt is only 200 tokens, achieving a 99.93% cache hit rate with DeepSeek's caching mechanism. The average cost to complete a task is only $0.028, which is one-seventh of Claude Code.

2. No model lock-in Supports 15+ model providers. If Claude bans you, switch to Kimi; if Kimi doesn't work, switch to DeepSeek. Never worry about being locked into a single platform.

3. Fully open source MIT license, free to use, modify, and commercialize.

4. Compatible with existing assets Automatically reads ~/.agents/skills and AGENTS.md. The Skills and project specifications you've accumulated in Claude Code can be used in Pi without changing a single line.

5. Infinitely extensible Only 4 tools by default, but any feature can be added on demand through Extensions, Skills, and Packages. From bare shell to fully furnished, you decide.

6. Minimalist design, fully controllable Pi is essentially a while loop; you can fully understand what it's doing. Unlike other tools that feel like a black box.

Cons

1. Too few default features When you first install Pi, you'll think, "This is too bare-bones." No plan mode, no sub-agents, no MCP, no permission pop-ups. If you want these features, you have to install extensions yourself.

2. Requires some hands-on ability Pi's philosophy is "giving you a factory to build AI assistants," not "giving you an AI assistant." You need to configure, extend, and tinker yourself.

3. Terminal barrier Pi is a pure terminal tool with no graphical interface. It's not very friendly for developers not accustomed to the command line.

4. Relatively young ecosystem Although developing rapidly, compared to Claude Code's ecosystem, the number of Pi plugins and extensions is still growing fast.

7. Suitable Scenarios

Scenario Recommendation Level Reason
Pursuing ultimate cost-effectiveness ✅✅✅ Highly recommended Cost is one-seventh of Claude Code
Not wanting to be locked into a single platform ✅✅✅ Highly recommended Supports 15+ model providers
Already accumulated Claude Code Skills ✅✅✅ Highly recommended Seamless migration, no changes needed
Enjoy tinkering and customization ✅✅✅ Highly recommended Bare shell design, decorate as you wish
Daily coding assistance ✅✅✅ Highly recommended Lightweight, efficient, fast response
Team-shared workflows ✅✅✅ Highly recommended Configurations are replicable and shareable
Want an out-of-the-box experience ⚠️ Needs evaluation Too few default features, requires tinkering
Developers unfamiliar with the terminal ⚠️ Needs evaluation Pure terminal operation, has a learning curve

For more project walkthroughs, visit the Java突击队 website: susan.net.cn/project

8. Final Thoughts

Back to the original question: Why are more and more people using Pi?

The answer is actually not complicated — while other tools are frantically piling on features, Pi chose to subtract.

Claude Code's system prompt is 14,000 tokens; Pi's is only 200 tokens.

What does this gap mean?

In every round of conversation, Claude Code has to stuff 14,000 tokens into the context; Pi only needs 200 tokens.

Coupled with DeepSeek's caching mechanism, Pi can achieve a 99.93% cache hit rate for input tokens.

But what truly impressed me is the design philosophy behind Pi:

"For an agent, what you deliberately choose not to do is more important than what you do."

When an agent becomes a black box you can't understand or predict, the problem might not be a lack of capability, but complexity itself.

Pi's answer is to converge the system to a minimal kernel: simple enough that you can understand it, control it, and then grow it through extensions. The result, paradoxically, is — the simpler, the more controllable.

Claude Code is "giving you an AI assistant"; Pi is "giving you a factory to build AI assistants."

You will find — an AI coding tool can be this light, this cheap, this free.