pi-caveman-think

Chain-of-Thought (CoT) internal reasoning compression for Pi Coding Agent — cuts reasoning tokens and latency by ~22% on reasoning models (DeepSeek, o1, QwQ)

Packages

Package details

extension

Install pi-caveman-think from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-caveman-think
Package
pi-caveman-think
Version
1.0.0
Published
Sep 6, 2026
Downloads
147/mo · 147/wk
Author
phlpp-hns
License
MPL-2.0
Types
extension
Size
11.3 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./caveman-think.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-caveman-think 🪨⚡

Why burn tokens on internal monologues?
Chain-of-Thought (CoT) internal reasoning compression for Pi Coding Agent.

Normal "caveman" extensions only compress the visible output you read in chat.
In modern reasoning models (DeepSeek-R1, DeepSeek-V4, o1, o3-mini, QwQ), 70% to 85% of your tokens and generation latency are burned inside the hidden reasoning block (reasoning_content).

pi-caveman-think intercepts the system prompt via before_agent_start with a compact, 46-token cognitive steering directive that forces the model to think in dense, causality-first, smart-caveman reasoning while preserving 100% technical accuracy, variable names, and code syntax.


📊 Measured Results (Production DeepSeek V4 Flash)

Tested against complex debugging tasks (e.g. auth middleware race conditions), $n=10$/arm, temp 0:

Metric Baseline (Normal) With caveman-think Net Savings
Total Completion Tokens 1,180 ± 260 917 ± 214 −22.3% (−263 tokens)
Visible Answer Tokens 313 ± 34 129 ± 28 −58.6%
Per-Turn Latency 32.4s 29.4s −3.0s faster per turn
Net Savings (after directive) −202 tokens saved / turn

🚀 Installation

Install directly into Pi via npm:

pi install npm:pi-caveman-think

Or from a local clone:

pi install /path/to/pi-caveman-think

🎮 Commands & Controls

The extension is opt-in and safe by default. It does nothing until you enable it.

/caveman-think on            # Enable for the current session only
/caveman-think on --global   # Enable globally across all sessions (persists to ~/.pi/caveman-think.json)
/caveman-think off           # Disable for the current session
/caveman-think off --global  # Disable globally
/caveman-think status        # View active state and scope

Environment Override

You can hard-disable it anytime in automated CI or test scripts:

export CAVEMAN_THINK=0

🧠 How it Works

A standard conversational prompt skill rarely compresses the hidden CoT because reasoning blocks are steered primarily by the system prompt.

pi-caveman-think injects a compact directive directly into the active system prompt:

## Caveman reasoning (applies to CoT AND output):
Think and reason in ultra-compressed smart caveman style.
Drop filler, articles, and pleasantries.
Keep ALL technical substance, code, API names, CLI commands, and error strings verbatim.
Short synonyms. Causality-first fragments (X -> Y).
Preserve dominant language. Never announce style.

License

Mozilla Public License 2.0 (MPL-2.0) © 2026 The Authors