Files
ai-artifacts/projects/dotfiles/068-pi-ui-compact-status-extension-task.md

46 lines
2.8 KiB
Markdown

---
status: resolved
claimed-by: "019fbf55-ae07-7bfe-a774-77f41b55b724"
claimed-at: "2026-08-01T17:58:46-04:00"
completed-at: "2026-08-01T18:03:07-04:00"
parent: "[[063-pi-ui-customization-spec-task]]"
blocked-by: []
tags:
- ticket/implementation
---
# Implement compact Pi status extension
## Question
Promote the accepted compact status prototype into the dotfiles-managed Pi extension tree with credential-safe Codex quota handling.
## What to build
Create a flake-managed Pi extension that replaces the throwaway `compact-status-prototype.ts` behavior with the permanent compact status surface.
The extension should hide Pi's built-in footer by default, render the cwd/branch and model/thinking row above the editor, render the unlabeled `▃` context bar, render the unlabeled `▔` consumed-weekly-Codex quota bar, and provide `/codex-quota` for a manual non-secret quota refresh notification.
The extension should read Pi's local `openai-codex` OAuth credential only for the access token and account id needed by the ChatGPT/Codex usage endpoints.
It should cache only normalized non-secret quota percentages in memory and degrade to an unknown/error state without crashing when credentials, network, or response shape are unavailable.
## Acceptance criteria
- [x] The extension lives under the dotfiles Pi module's managed extension source tree, not only under `~/.pi/agent/extensions`.
- [x] The built-in footer is hidden by default.
- [x] The status widget shows cwd/branch on the left and model/thinking on the right.
- [x] The context bar uses `▃`, fills from `ctx.getContextUsage().percent`, and uses success/warning/error thresholds 70% and 90%.
- [x] The Codex quota bar uses `▔`, fills by consumed weekly quota, uses border blue below 50%, warning at 50%, and error at 80%.
- [x] `/codex-quota` forces a refresh and displays only normalized non-secret details.
- [x] Missing or expired credentials, network errors, and unrecognized quota responses do not break extension loading.
- [x] No default config file is generated.
## Implementation Notes
Use `[[063-pi-ui-customization-spec-task]]` as the source of truth for row shape, colors, quota endpoints, and out-of-scope behavior.
The throwaway prototype at `~/.pi/agent/extensions/compact-status-prototype.ts` is useful reference code, but the finished implementation should be promoted into the repo-managed Pi extension source.
Resolved on branch `pi-ui-customization` in commit `a7ee800`.
Implemented `modules/agents/pi/extensions/compact-status.ts` as a managed Pi extension with an above-editor status widget, hidden footer, context/quota bars, and `/codex-quota`.
Verification: Pi RPC command registration smoke, managed extension derivation build, and `nix flake check`.
Manual post-switch verification remains useful for exact visual placement and live quota endpoint shape.