$ cat ~/map/pi-ttft.md
pi-ttft
Footer HUD that times the first token and names the culprit — network or server — when one clearly dominates.
extensions✓ Sep 19
Facts
- repository
- github.com/quanxinwang18-a11y/pi-ttft ↗
- GitHub Stars
- ★ 0
- Forks
- 0
- license
- MIT
- npm / mo
- —
- last push
- Sep 18, 2026
install
Run pi install git:github.com/quanxinwang18-a11y/pi-ttft@v1.1.0, or try it in a single session with pi -e git:github.com/quanxinwang18-a11y/pi-ttft. Requires pi 0.85.1 or newer.## TL;DR
A pi footer HUD for time to first token: it holds a compact TTFT reading while a turn runs, then splits a slow first token into network response time versus server-side prefill and names the culprit only when one clearly dominates.
## Key points
- $Four fields, four definitions: TTFT is request to first stream event; resp is request to response headers (network plus server queueing); prefill is headers to first chunk — a spike there usually means the prompt cache missed; tok/s is decode speed over the turn.
- $State-dependent width: the line reports state while running and the last turn while idle, and expands only when something is slow — a normal finish shows TTFT and tok/s, a slow one adds the resp and prefill split plus a culprit marker.
- $Verdicts require dominance: the network or server marker prints only when one side is at least dominantRatio (default 2×) larger; otherwise the HUD names no culprit.
- $Cumulative totals stay off the status line: LLM and tool totals, averages, and extremes live behind /ttft, which also prints the effective configuration and where each value came from; /ttft reload re-reads settings and /ttft reset clears counters.
- $Settings-based tuning: slowMs (default 3000), slowTps (default 20), and dominantRatio (default 2) sit under the ttft key in global or project pi settings, the project file overriding global values key by key; invalid values fall back to the defaults.
## FAQ
Q Why split a slow first token into resp and prefill?
The two halves point at different culprits: a large resp means the delay sits in the network or the provider's queue, while a large prefill is server-side and usually means the prompt cache missed.
Q Does tuning thresholds require editing the extension?
No. Thresholds live in pi settings under the ttft key — slowMs, slowTps, dominantRatio — and /ttft reload picks up changes without restarting; /ttft always prints the effective values and their sources.
## References
## Related entries
$ pi-open-tui
Polished terminal interface for pi: model/thinking header, runtime-aware footer, framed editor, turn metrics (TPS / TTFT / stalls / cost), and 50+ runtime detectors — all configurable from /open-tui.
$ Self Compact
Gives autonomous pi agents their own context gauge — notice and warning lines first, then a hard cutoff where only self_compact runs.
$ big-pi
Model-driven compression that summarizes completed phases into tiered blocks while Pi's JSONL transcript stays authoritative and untouched.
## Guides
Last updated: Sep 19, 2026