@2008muyu/pi-stats-insight
Add observability extension for the pi coding agent
Install & Use
Copy this prompt and send it to your AI assistant (Claude / Cursor / TRAE / Codex / WorkBuddy etc.) to auto-install:
Help me install this AI Skill: @2008muyu/pi-stats-insight. It is used for: Add observability extension for the pi coding agent Full Skill content: https://321skill.com/skills/2008muyu-pi-stats-insight/raw/index.md Read that page and install it.
The prompt includes a link to the full Skill content. You can also view the full content.
This Skill addresses the lack of fine-grained observability data when using the pi coding agent. While pi's built-in footer displays token and context usage, developers often need key metrics like cache hit rate, tool call statistics, average response time, and provider errors—critical data for optimizing AI call costs and troubleshooting performance bottlenecks.
Usage is straightforward: after installation, no configuration is required. It automatically adds a compact status bar at the bottom of pi, showing cache hit rate level, tool call count, average latency, and error count. Additionally, entering the /stats command opens an interactive menu to drill down into token and cost details, cache performance, per-tool call statistics, context window usage, and HTTP error specifics. To reset session statistics, simply enter /stats reset.
It's ideal for agent developers, backend engineers, and full-stack engineers using the pi coding agent for daily development—especially teams already integrated with multiple AI providers (like Anthropic, OpenAI, Google, Mistral, etc.) who need unified monitoring of cache effectiveness and costs across providers. This Skill directly fills that gap.
It's recommended to monitor cache hit rate data after major refactors or model switches to evaluate cache strategy effectiveness. Note that it only tracks data within the current session; statistics reset after restarting the session, but historical data is persisted locally in JSONL format for later analysis. Also, the Skill relies on pi's ctx.ui.setStatus interface and does not replace pi's native footer—they coexist without interference.
Key Features
Unlike pi's built-in footer—which shows token and context usage (already displayed by pi)—it complements pi by adding uncovered metrics: cache hit rate, tool call statistics, average response time, and provider error counts, with support for interactive deep-diving via the `/stats` command.
Limitations
Requires a pi coding agent environment and only tracks current session data (resets after restart); relies on pi's `ctx.ui.setStatus` and `ctx.ui.select` interfaces and does not support custom UI styling.
FAQ
How do I install pi-stats-insight?
Run the command: `pi install npm:pi-stats-insight`, or add it to the `packages` array in `~/.pi/agent/settings.json`.
How do I view statistics after installation?
After installation, a status bar automatically appears at the bottom showing cache, tools, latency, and error stats; enter `/stats` to open an interactive menu for detailed data.
Installation guide for AI assistants
If your AI coding assistant (Claude Code, Cursor, TRAE etc.) can see this page, send it this message to auto-install:
Visit https://321skill.com/skills/2008muyu-pi-stats-insight/raw/index.md to read the original Skill definition (Markdown format) for @2008muyu/pi-stats-insight, and install it according to the instructions.
Raw Markdown URL for AI: /skills/2008muyu-pi-stats-insight/raw/index.md