Skip to content

Custom Footer

The custom-footer extension replaces pi’s default footer with a rich, color-coded statusline that keeps the most useful session metrics visible at all times. Here it is in action:

pi — custom-footer

$ pi

> colorize the footer example

edited custom-footer.mdx

Two snapshots: a clean branch with a green context bar, and a dirty branch nearing the context limit (red bar). The ± turns red and the bar shifts through yellow to red as usage climbs.

Layout, left to right:

Segment Meaning
folder Current working directory’s folder name
[± branch] Git branch — when clean, ± (red) when there are uncommitted changes
↑ input Cumulative input tokens for the session (green arrow)
↓ output Cumulative output tokens for the session (red arrow)
Context bar Progress bar of total tokens vs. the model’s context window
model Active model id

The context bar is color-coded by usage:

  • green < 70%
  • yellow 70–90%
  • red > 90%

The extension listens to branch-change events and re-renders automatically, so git status stays current as you work.

The extension is a single TypeScript file. Pi auto-discovers extensions placed in ~/.pi/agent/extensions/, so there is nothing to compile — TypeScript is loaded via jiti.

Terminal window
mkdir -p ~/.pi/agent/extensions
cp custom-footer.ts ~/.pi/agent/extensions/
Section titled “Option 2: Symlink from a checkout (recommended for development)”
Terminal window
mkdir -p ~/.pi/agent/extensions
ln -sf ~/projects/jreb-pi-extensions/custom-footer.ts ~/.pi/agent/extensions/

With a symlink, edits to the source file are picked up on /reload with no copy step.

/reload # pick up the new extension
/footer # toggle the custom footer on (and off again)

The extension enables itself automatically on every session_start, and the /footer command toggles it on or off at any time.

The context bar needs to know the active model’s context window. If your model’s window isn’t detected (for example a local or custom model), add it to ~/.pi/agent/models.json:

{
"providers": {
"your-provider": {
"models": [
{ "id": "your-model", "contextWindow": 262144 }
]
}
}
}

When no context window is known, the footer falls back to a plain ctx: <tokens> readout instead of the progress bar.