---
status: open
parent: "[[063-pi-ui-customization-spec-task]]"
blocked-by:
  - "[[073-pi-ui-community-pi-packaging-research]]"
tags:
  - ticket/task/afk
---

# Patch Pi prompt-area layout

## Question

Make the ordinary flake-managed `pi` command use the accepted flex-spacer prompt-area layout and harden local tool lookup for NixOS.

## What to build

Add a small local Pi package patch through the dotfiles flake so Pi's interactive layout renders flow content separately from the pinned prompt-area content.
When the rendered TUI is shorter than the terminal, insert flexible blank rows between the flow content and the prompt-area group.
When the rendered TUI is long enough to fill the terminal, preserve stock scrolling behavior with no inserted spacer.

Also harden Pi tool lookup so unusable downloaded local binaries in `~/.pi/agent/bin` do not mask working Nix-provided `fd` and `rg` binaries on `PATH`.
A local tool should count as available only when `<tool> --version` exits successfully.

## Acceptance criteria

- [ ] The ordinary flake-managed `pi` command uses the patched layout after rebuild.
- [ ] Short conversations leave spare vertical space above the status/editor area, not below the editor.
- [ ] Long conversations preserve stock Pi scrolling behavior.
- [ ] Terminal resize recomputes spacer rows without accumulating stale blank lines.
- [ ] `/` autocomplete still works.
- [ ] `@` autocomplete still works even when `~/.pi/agent/bin/fd` is an unusable generic Linux binary.
- [ ] Closing autocomplete leaves the editor visually bottom-aligned.
- [ ] The patch is delivered through dotfiles, not by an unmanaged copy under `~/.local/share`.

## Implementation Notes

Use [[072-pi-ui-patched-pi-packaging-research]] for the packaging plan.
Patch `pkgs.pi-coding-agent` at the TypeScript source level with `overrideAttrs`, assign the result to `programs.pi-coding-agent.package`, and keep the ordinary `pi` command managed by Home Manager.

The prototype at `/home/alexion/.local/share/pi-flex-spacer-prototype/pi-monorepo` added `FlexSpacerBottomLayout` in Pi's `dist/modes/interactive/interactive-mode.js` and patched tool lookup in `dist/utils/tools-manager.js`.
Use it as behavior reference, but implement through the flake-managed Pi package path.
