pi-turn-stats

Pi extension: /turns viewer and get_turn_stats tool for per-prompt model, cost, and processing-time statistics in the current session branch.

Packages

Package details

extension

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

$ pi install npm:pi-turn-stats
Package
pi-turn-stats
Version
0.1.1
Published
Oct 13, 2026
Downloads
not available
Author
leilei12138235
License
MIT
Types
extension
Size
201.4 KB
Dependencies
0 dependencies · 3 peers
Pi manifest JSON
{
  "image": "https://raw.githubusercontent.com/KaleLjl/pi-turn-stats/main/assets/screenshot.png",
  "extensions": [
    "./extensions/turns.ts"
  ]
}

Security note

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

README

pi-turn-stats

A Pi extension that shows model, cost, and processing-time statistics for every user prompt in the current session branch.

GitHub: https://github.com/KaleLjl/pi-turn-stats · npm: https://www.npmjs.com/package/pi-turn-stats

screenshot

Features

  • /turns command (interactive TUI): a full-screen viewer listing each user prompt in the current branch with:
    • models used in that turn
    • per-turn cost and cumulative cost
    • per-turn and cumulative processing duration
    • average processing time across completed turns
    • jump back to any completed turn with Enter (opens it as a new branch)
  • get_turn_stats tool: returns the same statistics as JSON for the agent to use when reporting the cost of previously completed tasks.

Install

pi install npm:pi-turn-stats

Or try it once without installing:

pi -e npm:pi-turn-stats

Keybindings (/turns)

Key Action
↑ ↓ / k j Select turn
PgUp PgDn / Space Page up / down
Home / g First turn
End / G Last turn
Enter Jump to selected turn (new branch)
Esc q Ctrl+C Close

Notes

  • /turns requires interactive TUI mode; the get_turn_stats tool works in all modes.
  • Costs are summarized from the session record; cumulative values are up to that turn.
  • Turns that have not finished yet are listed but marked as not jumpable, and the tool excludes the still-running turn from its totals.

License

MIT