@taimoorchatha/pi-context-pulse

pi coding-agent extension: input-editor border pulses yellow → red as the context window fills up, like an FPS damage-vignette.

Packages

Package details

extension

Install @taimoorchatha/pi-context-pulse from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@taimoorchatha/pi-context-pulse
Package
@taimoorchatha/pi-context-pulse
Version
0.1.0
Published
May 10, 2026
Downloads
37/mo · 8/wk
Author
taimoorchatha
License
MIT
Types
extension
Size
9.9 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

@taimoorchatha/pi-context-pulse

A pi coding-agent extension. Makes pi's input-editor border pulse yellow → red as the context window fills up, like an FPS damage-vignette.

  • < 25% — default theme border color, no effect
  • 25 → 100% — border pulses; color lerps yellow → red, pulse depth and speed both ramp with usage
  • > 100% — clamped to 100%

Install

pi install npm:@taimoorchatha/pi-context-pulse

Or drop the source file directly into ~/.pi/agent/extensions/ (global) or .pi/extensions/ in a project:

curl -o ~/.pi/agent/extensions/context-pulse.ts \
  https://raw.githubusercontent.com/taimoorchatha/pi-extensions/main/packages/context-pulse/src/index.ts

No compilation — pi loads TS directly via jiti. /reload or start a new session and it activates.

Load-order caveat

This extension customizes pi's input editor via ctx.ui.setEditorComponent(). If you have another extension that also sets an editor — the most common one is the vim-style modal-editor.ts from pi's own examples — pi loads extensions alphabetically and last-writer-wins, so the other one will clobber this and you'll see nothing.

Fix: rename so this loads after the other, e.g.

mv ~/.pi/agent/extensions/context-pulse.ts ~/.pi/agent/extensions/zz-context-pulse.ts

Commands

/context-pulse            toggle on/off
/context-pulse test <pct> force a fake % for 8s (preview / tuning)
/context-pulse on | off   explicit

Design notes

  • Truecolor ANSI (\x1b[38;2;R;G;Bm). Most modern terminals support it. If yours doesn't, you'll see literal escape junk instead of a colored border — swap to a 256-color palette in pulseColor() if that's your situation.
  • Defensive try/catch around the animation timer and inside the overridden borderColor function. borderColor is called from within Editor.render() every frame — an uncaught throw there takes pi's TUI loop down with it and leaves the terminal stuck in alt-screen + raw mode. This extension silently falls back to the default border color on any unexpected error instead.

License

MIT — see LICENSE.