@giladbarnea/pi-custom-footer

中文文档
0.1.16发布于 2026/11/15MITES Module零依赖构建来源已验证近 30 天下载 2563

Context, cache, cost, and loaded skills at a glance in Pi.

原始使用文档

last_updated: 2026-11-15T13-19

Custom Footer

Know how much context remains. See what each turn costs.

pi extension npm license

A Pi footer that puts your session’s context, cache usage, cost, and loaded skills around the editor.

Mobile-friendly and optimized for multiplexers. It works on a phone with the keyboard up, in a narrow tmux pane, and on a wide desktop. Every line drops its least important detail first, so you keep the facts that matter at any size.

pi install npm:@giladbarnea/pi-custom-footer

Supports Pi 1.4.x and 1.5.x, the latest stable minor and its predecessor.

Above the editor, see your model, thinking level, session name and ID. Loaded skills get their own row, with token ages. Compaction and context edits remove skills whose loaded text is no longer present verbatim. Restoring that text restores the skill. A skill read inside a codemode script counts when the script output carries that read verbatim. Pi does not keep nested read results, so the footer records the read text in a custom session entry that is never sent to the model.

Below the editor, see:

  • Context remaining at a glance: a color-graded gauge and used/window tokens.
  • Cost across the conversation: cumulative cost and average cost per assistant turn.
  • Cache behavior: session hit rate, with reused tokens when there is room (97.6% session (38M reused)), and the last message as hit 100% or miss 45%. A hit means more than 90% of the prompt was read from the cache. Like Pi’s own notice, a miss that re-billed cached tokens shows what it cost and why it happened: an idle gap or a model switch.
  • How long the cache stays warm: warm for 26m, live: the footer redraws once a minute. It counts down to the latest of three times: the last request or cache warm plus the model’s cache lifetime; the end of Pi’s own idle warming, when Pi will refresh this context; and a deadline set with pi-keep-cache-warm in this Pi session. Once that time has passed, the fact hides. Pi’s idle warming counts on Pi 1.5.1 and later; earlier versions show last touch plus lifetime. Models without a declared cache lifetime, such as OpenAI and Codex, show nothing.
  • Where you are: Git branch, dirty marker, directory, and other extensions’ status messages.
  • Subscription pace: this week’s pace against the target rate, as pace ━━━━●┊─── 1.07× ≤ target 1.18× · resets in 12h. With less room, it reads pace ≤ target (1.18×), then pace ≤ 1.18×. The sign turns to > when you are over budget, and the dot passes the time marker. A reading more than 30 minutes old adds its age, such as · 2h old. The age outlasts the pace bar and goes before the rest of the pace. Optional: shown only when a quota cache file exists.

The layout follows your Pi theme. The header and the footer each take the fewest lines they can. To fit, the footer first drops the optional reused-token suffix, before any other detail or fact. It then drops the pace bar and labels, round readings, remove whitespace, and drop the branch icon. The cache time drops its label (26m). A hit or miss drops its percentage. Only then does the footer hide facts: the sub mark of a subscription, a stale reading's age, the pace reading with its reset time, the last message's plain hit or miss, the token counts, the session hit rate, the word target, the cache time, and last the cost per turn. The target rate stays down to pace ≤ 1.18×. A cache miss drops its re-billed tokens early. It keeps its cause until every one of those facts has hidden, and keeps its cost to the end. Last, the target rate hides only where it alone would add a line.

Skills get one row for every eight terminal rows past the first six, with a minimum of one. A 21-row phone screen gets one row, a 27-row screen two, and a 34-row screen three. To fit, the row first drops token ages, then separators, then shortens long names in the middle (caut…ctor). Only then does it hide skills from the end, behind a +N count at the end of the last row.

Resize without rescanning the conversation. The header and footer share cached values. Session changes refresh them, including forks and compaction.

Skill age measures context-token growth since the first response after a skill load. Cache misses mirror Pi’s own miss accounting: the tokens re-billed since the last request or cache warm, their extra cost over cache reads, and the idle time. Costs use the model’s reported pricing, including when you use a subscription. Numbers show two decimal places below 10, one from 10, and none from 100.

The pace comes from ~/.cache/quota/provider-usage.json (or under XDG_CACHE_HOME), which the author’s quota tool writes. That tool is not public yet, and without the file the footer shows no pace. The reading is for the pool of the session’s model: Claude, Fable or Codex. The footer only reads that file. It never runs quota and never fetches. Pace and target each take a color from quota’s heat map: green near 1.0×, cool where allowance goes unused, amber then red where it runs out early. A Fable session shows Fable’s target capped by the room left in the shared Claude week.

Development

npm ci
npm test
npm run check

Tests cover rendered values, skill tracking, cache reuse, session changes, forks, compaction, and native context edits. SDK tests use a local scripted provider, with no external model calls.

版本与发布记录

@giladbarnea/pi-custom-footer 共发布 17 个版本,首次发布于 2026/09/06;过去 12 个月发布了 17 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.16latest2026/11/15今天
0.1.152026/11/141 天前
0.1.142026/11/141 天前
0.1.132026/11/124 天前
0.1.122026/11/124 天前
0.1.112026/11/114 天前

关于 @giladbarnea/pi-custom-footer 的常见问题

@giladbarnea/pi-custom-footer 是什么?

Context, cache, cost, and loaded skills at a glance in Pi.

如何安装 @giladbarnea/pi-custom-footer?

在项目目录运行 npm install @giladbarnea/pi-custom-footer,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@earendil-works/pi-ai(>=1.4.0)、@earendil-works/pi-tui(>=1.4.0)、@earendil-works/pi-coding-agent(>=1.4.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@giladbarnea/pi-custom-footer 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/giladbarnea__pi-custom-footer 是否存在。

@giladbarnea/pi-custom-footer 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@giladbarnea/pi-custom-footer 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.19.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@giladbarnea/pi-custom-footer 可以商用吗?

@giladbarnea/pi-custom-footer 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@giladbarnea/pi-custom-footer 的下载量有多少?

根据 npm 官方下载统计,@giladbarnea/pi-custom-footer 在 2026/10/17 – 2026/11/15 这 30 天内被下载 2,563 次,日均约 85 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@giladbarnea/pi-custom-footer 还在维护吗?

最新版本 0.1.16 发布于 2026/11/15(今天);至今共发布 17 个版本,其中过去 12 个月发布了 17 个;首次发布于 2026/09/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。