pi-codemode-render

Readable codemode rows for pi: the script's intent and its actions instead of raw JavaScript and JSON

Packages

Package details

extension

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

$ pi install npm:pi-codemode-render
Package
pi-codemode-render
Version
0.1.0
Published
Nov 7, 2026
Downloads
395/mo · 23/wk
Author
quantmind-br
License
MIT
Types
extension
Size
37.6 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

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

README

pi-codemode-render

Readable codemode rows for pi.

With codemode.mode: "only" every tool call goes through a script, so the transcript fills with JavaScript and JSON arguments, and edits lose their diffs: a replace made by a script shows its anchors, not the file it changed. This extension draws each row around what the script does: its intent, one line per action, what changed on disk, a short output preview, and a footer with progress.

codemode Raise the retry limits
✓ read src/config.ts                                                             4ms
✎ src/config.ts +3 −2 · 2 edits                                                  3ms
  -1 export const retries = 3;
  +1 export const retries = 5;
  -2 export const timeoutMs = 1000;
  +2 export const timeoutMs = 2500;
  +3 export const backoffMs = 200;
✎ CHANGELOG.md wrote 4 lines                                                     1ms
  +1 # Changelog
  … 3 more lines (ctrl+o to expand)
✓ $ npm test in packages/core                                                   2.1s
✗ read missing.txt                                                               2ms
  [E_NOT_FOUND] File not found: missing.txt

Tests  47 passed (47)

5 actions · 2 files +3 −2 · 1 failed · 2.2s · ctrl+o for script and output

Consecutive edits to a file fold into one row. Edits and failures stay in view however long the script runs. ctrl+o shows the highlighted script, full diffs with their context, and the full output.

While a script runs, each action shows its own timer and a running shell command shows its last line of output.

Install

pi install npm:pi-codemode-render

Remove it with pi remove npm:pi-codemode-render. Built and tested against pi 1.4.0.

To install a local checkout instead, run pi install /path/to/pi-codemode-render.

How it works

  • pi.registerToolRenderer() replaces how codemode is drawn. What scripts do, and what the model sees of their output, does not change.
  • The tool_execution_* events with parentToolCallId provide the live output of nested calls and the diffs of nested edits, neither of which codemode records.
  • A codemode-render-changes custom session entry keeps each script's diffs, at most 16 KB per edit, so reloaded sessions show them too. Custom entries never reach the model.
  • A codemode_titles system prompt section asks the model to open each script with a one-line // comment, used as the row's title. This is the only change to what the model receives, about 60 tokens. Rows without the comment show codemode.

Limits

  • Codemode records the first 200 characters of each call's arguments, so action rows show at most that much, also when expanded. The script itself is always complete.
  • Only tools that report a diff, plus write, count as changes. A sed -i in a shell command stays a shell command, and a write shows its length since the size of the file it replaced is unknown.
  • Edits made before this version, or while the extension was off, keep their plain rows.
  • Live output needs the tool_execution_update events, so only tools that stream partial results show it.
  • A running row only shows the last line of output. Reloaded sessions and HTML exports show finished rows.

Development

npm install
npm test
npm run typecheck