Repository navigation
feat(footer): present Atlas-style Pi status line - #2
Merged
Merged
Conversation
Rework the Pi footer to the Atlas status-line information architecture: π + Pi version, provider/model with thinking level, working directory shortened to …/<parent>/<current>, git branch with the Nerd Font branch glyph, a responsive 24-cell context meter, and cache hit percent from the latest successful assistant prompt with the Nerd Font cache glyph. Extension statuses keep their own ANSI styling; codex-status and mcp are suppressed, and the background-process status keeps its /proc special case. One-space side padding and the trailing blank line are preserved. Add unit tests locking item order, path shortening, meter widths, cache math, and mcp suppression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Rework this repo's Pi footer (extensions/footer/src/index.ts, re-exported by packages/pi-bits) to present the Atlas status-line information design, adapting the repo's footer to the Atlas information architecture rather than copying the Config spec (Atlas/Config/pi/.pi/agent/extensions/atlas-status-line.ts) wholesale.
Required footer content and order: (1) Pi identity and version -- the 'π' symbol plus the Pi VERSION from @earendil-works/pi-coding-agent; must never render the removed LIFEOS/Atlas identity. (2) provider/model and thinking level. (3) working directory shortened to …// (not the full path) and git branch with the Nerd Font branch glyph (U+F418). (4) a context meter: 24-cell ⛁ at normal widths, smaller responsive meters at narrow widths (16/8/6), whole-number percent from ctx.getContextUsage(). (5) cache percent from the latest SUCCESSFUL assistant prompt computed as cacheRead/(input+cacheRead+cacheWrite) rounded to a whole percent, with the Nerd Font cache glyph (U+F49B). (6) preserve other extensions' ANSI-styled statuses but suppress 'mcp'.
Kept the existing footer contract where it still fits: one-space side padding, hide 'codex-status', and keep the background-process status special-case (/proc). Deliberate adaptations (not mistakes): dropped Config's ~/.config/theme-switcher file read because it is inappropriate for a published package, detecting light/dark from theme.name only; the context meter sizes off the RAW terminal width so the 80-column boundary correctly shows 24 cells, while item packing/truncation respects the one-space padded content width.
Added unit tests locking item order, path shortening, meter widths (including the 80->24 boundary), cache math and latest-successful selection (skipping aborted/error prompts), plus mcp and codex-status suppression and ANSI-status preservation. Added a patch changeset for the publishable @edheltzel/pi-bits because its built dist re-exports this footer (AGENTS.md requires a changeset for publishable package changes). Deliberately did NOT add the footer to the Git collection root manifest -- it is not required, since the root manifest already loads extensions/*/src/index.ts and the footer is loadable via its own pi manifest. packages/pi-bits builds dist/ only at publish/prepack time (gitignored, not committed). Assessed risk: low (single private extension, additive tests, no public API or dependency change).
What Changed
mcpandcodex-status, retaining/procbackground-process handling, and refreshing cached usage when the session leaf changes.pi-bitsre-export.Risk Assessment
✅ Low: The latest commit closes the remaining required error-prompt coverage gap, and the well-bounded footer change now conforms to the stated content, ordering, status, cache, responsiveness, packaging, and test criteria.
Testing
After confirming the isolated worktree and change scope, I fixed the package-level test discovery failure and reran the focused tests successfully. Real offline Pi TUI checks then proved the packed install, required item order and copy, shortened cwd, branch glyph, 80-column boundary, responsive meters, context percentage, successful-prompt cache percentage, hidden statuses, ANSI preservation, and
/proc; reviewer-visible PNGs were inspected and all transient worktree artifacts were removed./var/folders/88/3h9cyc4979d2l6p7xkn79yqr0000gn/T/no-mistakes-evidence/01M0B227PAKSBP4AD6ART9HADP/footer-cache-live.png)/var/folders/88/3h9cyc4979d2l6p7xkn79yqr0000gn/T/no-mistakes-evidence/01M0B227PAKSBP4AD6ART9HADP/footer-pi-bits-installed-live.png)/var/folders/88/3h9cyc4979d2l6p7xkn79yqr0000gn/T/no-mistakes-evidence/01M0B227PAKSBP4AD6ART9HADP/footer-responsive-widths.png)Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed (3) ✅
extensions/footer/src/index.ts:299- Intent requires keeping “the background-process status special-case (/proc),” but this footer still recognizesbackgroundBashProcesseswhile the repository’s tmux-bash producer publishesbackgroundBashTmuxCommands. The added test also uses the obsolete key, so the real status falls through and renders without the/procspecial case. Align the consumer/test with the producer, or confirm both keys must be supported.extensions/footer/src/index.ts:261- Unavailable context usage is converted to0%. Pi’s pinned API makespercentnullable—including after compaction before a new successful response—so this can display an empty meter and falsely imply full headroom. Define an explicit unavailable-state rendering instead of inventing zero.extensions/footer/src/index.ts:232- Every footer render callsgetBranch()and scans the entire session for cache usage. The footer renders during streaming updates and other TUI refreshes, making this O(session length) work recur per frame. Cache the result by session leaf ID or update it from message/session events.🔧 Fix: Fix footer status, context, and cache handling
2 issues (1 error, 1 warning) still open:
extensions/footer/src/index.ts:393- The required cache value must come from “the latest SUCCESSFUL assistant prompt,” but navigating with/treechanges the session leaf viasession_tree, which is not subscribed above.footerData.onBranchChange()here only reports Git-branch changes, so the cached percent remains from the abandoned conversation branch until another message or compaction. Invalidate onsession_treeor key the cache bysessionManager.getLeafId().extensions/footer/src/index.ts:243- When the newest successful assistant prompt has zero prompt-token usage,calculateCacheHitPercent()returns null and this loop continues to an older successful prompt. That displays a stale older percentage instead of the required latest-prompt value. Stop at the first successful prompt and return null/hide the cache item unless this fallback is deliberate.🔧 Fix: Fix footer cache selection and leaf tracking
1 error still open:
extensions/footer/tests/footer.unit.test.ts:247- Intent requires “unit tests locking ... latest-successful selection (skipping aborted/error prompts),” but this test only adds an"aborted"prompt; no"error"fixture exists, so removing the production error-skip branch would still pass. Add an error-prompt case or explicitly relax that criterion.🔧 Fix: Cover failed prompt cache selection
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
pwd -P && git rev-parse --show-toplevel && git status --short --branchpnpm --filter @edheltzel/pi-footer test— initially found no tests; after repairing the root-relative scripts, the focused footer tests passedpnpm --filter @edheltzel/pi-bits buildpnpm --filter @edheltzel/pi-bits pack --pack-destination /var/folders/88/3h9cyc4979d2l6p7xkn79yqr0000gn/T/no-mistakes-evidence/01M0B227PAKSBP4AD6ART9HADPUnpacked the tarball, installed itspackagedirectory into an isolatedPI_CODING_AGENT_DIR, and launched a fresh offline Pi TUIRendered the real TUI at 120, 80, 79, 54, and 34 columns; observed 24, 24, 16, 8, and 6 context cells respectivelyExercisedmcp,codex-status,backgroundBashTmuxCommands, and an ANSI-styled extension status in the live TUICompleted a successful deterministic local assistant turn with input=100, cacheRead=300, cacheWrite=100; the packed footer rendered the cache glyph and60%Inspected all three generated PNG artifacts, removed generatedpackages/pi-bits/dist, closed bounded tmux sessions, and verified final worktree statuspackage.json:42- Author intent says the root Git collection already loads every extension, but the authoritative manifest exports only three extensions and omits the footer. Documentation now reflects the manifest; adding the footer requires an out-of-scope functional decision.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.