model-debugger

Debug Pi model interactions: log requests, detect silent failures, track model selection

Packages

Package details

extension

Install model-debugger from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:model-debugger
Package
model-debugger
Version
1.1.0
Published
Sep 28, 2026
Downloads
293/mo · 12/wk
Author
luong.nguyen
License
MIT
Types
extension
Size
20.8 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

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

README

Model Debugger — Pi Extension

Logs all Pi model interactions to help debug silent failures, rate limiting, and model selection issues.

Install

Published on npm: model-debugger. Use Pi's package manager (pi install), not npm install alone.

pi install npm:model-debugger
pi install npm:model-debugger@1.1.0   # pin version once published
pi install -l npm:model-debugger        # project-local (.pi/settings.json)
pi -e npm:model-debugger              # one session, no install

Then run /reload in Pi (or restart).

pi list
pi update npm:model-debugger
pi remove npm:model-debugger

From pi-extensions (git):

cp -r extensions/model-debugger ~/.pi/agent/extensions/model-debugger

Usage

Inside Pi TUI:

Command Description
/model-debugger Open a compact status/settings panel
/debug-status Show current debugger status
/debug-toggle [on|off] Enable or disable logging (persisted across restarts)
/debug-logs [N] Show last N log entries (default: 100)
/debug-clear Clear the log file
/debug-help Show all commands

/model-debugger shows whether logging is enabled, processing state, and a read-only log count/size summary. Enable/disable and Close are the only actions; Escape or Close leaves state and logs unchanged. If saving the toggle fails, Pi warns that the change applies only to the current session. Outside the TUI, the bare command reports status without opening a menu or toggling logging.

Compatibility

The menu is shown only when Pi supplies an extension context with mode === "tui" and hasUI. Older host runtimes that omit ctx.mode use the non-TUI fallback instead of opening UI/RPC dialogs: the bare /model-debugger command reports read-only status.

Log file

~/.pi/agent/logs/model-debugger.log

Safety

  • Logs only write to file, never to console (won't interfere with response streaming)
  • Auto-trims at 5 MB / 10,000 lines on each Pi start
  • Can be disabled at runtime with /debug-toggle off — model interactions are not logged while disabled; toggling still writes the small preference marker
  • The /model-debugger panel never displays raw log lines, clears logs, or exposes credentials; use /debug-logs explicitly when raw entries are needed

License

MIT