Correct the Headroom finding: LiteLLM does not know the router's models; install headroom-ai on all three machines

This commit is contained in:
Sam
2026-11-11 19:19:43 +11:00
parent 00abedb66b
commit df861563cf
9 changed files with 683 additions and 17 deletions

View File

@@ -3374,3 +3374,162 @@ Say which of those six you want first, and whether I should close the junk sessi
- action: [[packs/paperclip-harness/40-actions/2026-11-10-wrote-docs-ui-layout-md-and-three-live-layout-mockups|Built and ran bin/triage (Mouse-1 labeller) and measured headroom provider]]
- session: [[packs/paperclip-harness/80-sessions/paperclip-harness-session-snapshot-provider-feasibility-tria|Paperclip harness session snapshot: provider feasibility + triage tooling]]
- session: [[packs/paperclip-harness/80-sessions/rich-discovery-itself-2026-11-11-07-40-01|Rich discovery: itself 2026-11-11 07:40:01]]
---
## Update (2026-11-11 08:00:32)
Bash discovery of TUIOS session state: panes list was `[(1, None), (1, 'shell'), (2, 'board'), (3, 'work'), (4, 'agents'), (5, 'reply'), (6, 'new'), (7, 'project'), (8, 'repair')]` — eight named panes plus default. The Board pane requires 80×24 but the panel rendered at 78×22, showing 'This workspace needs 80 × 24. This panel is 78 × 22. Make it larger, or use Tab and zoom.' Caveat for future: board pane may not render correctly at default terminal sizes. Also observed a compile error during testing: `./board.go:177:22: cannot use rows (variable of type []Row) as Row value in array or slice literal` in paperclip-harness/tui.
## Detailed observations from completed turn
Straight answers, then what I built tonight.
## Headroom — you were right that a path exists, and it is the tool, not the provider
The `headroom-bridge` extension gives an agent two tools: `compress_for_agent` and `check_headroom`. That is the integration that fits: headroom shortens text an agent is about to pass on, rather than standing between the agent and its model.
Measured directly, without the extension:
```
POST http://192.168.20.13:8787/v1/compress {"model":…, "messages":[…]} → 200
{tokens_before: 4009, tokens_after: 4009, tokens_saved: 0,
transforms_applied: ["router:protected:user_message"]}
```
The endpoint works and reports honestly; one long user message is protected from compression, which is why it saved nothing in that test.
One blocker, measured: the extension imports `headroom-ai`, and that package is **not** in `~/.pi/agent/npm`, so it will fail to import until it is installed. After that, the extensions picker in `Agents>agents` gives it to one agent (`space`), and only that agent. As a *provider* it does not work: 502 on OpenAI requests, 401 on Anthropic ones, because its backend is Anthropic and this machine has no Anthropic credential. I removed the provider entry so no agent can point at a failing endpoint.
## Machines: yes, `.13` and `.27` are behind `.51` on Pi
| | `.13` | `.27` | `.51` |
|---|---|---|---|
| Pi | 0.82.1 | 0.82.1 | **0.87.1** |
| Go | 1.26.5 | 1.26.2 | **missing** |
| Nerd Fonts | 384 | 98 | 98 |
| TUIOS | 0.12.1 | 0.12.1 | 0.12.1 |
`.51` needs Go added to its configuration; `.13`/`.27` are on the same Pi and could be bumped to 0.87 for consistency. That is a flake change, not something I should do without you watching the rebuild.
## Cancelled — the option now exists
There was no way to cancel, so I added it: `c` in `Board>board`, with a dialog that says the thread, runs and cost stay and nothing is deleted. Tested by cancelling `AUD-162` — and I also cancelled `AUD-159` by mistake while testing (the cursor was not where I thought), then restored it to `done` with a comment recording what happened. Both are now correct: `AUD-162` cancelled, `AUD-159` done.
## The office workflow — the thing you kept asking about
`bin/office <folder>` now does the whole job: adopt the folder, **create the TUIOS session if it does not exist** (via the daemon verb), write `.harness/harness.toml` and the scaffold, and build all eight panes in that session. Proven on a brand-new folder tonight:
```
session: fresh-project-2026-11-11 (created)
… eight panes created, workspaces 1–8
```
One honest limit: moving *your* client to that session is refused when the call comes from a pane — the daemon will not let a program change what you are looking at. So the last step is yours: TUIOS's session switcher, or `tuios attach fresh-project-2026-11-11`.
## Handover written
`HANDOVER.md` is rewritten as the document to read first: what runs now, the seven decisions that shaped it and why, what is proven with the measurement, what is unproven, the machine table, where each document lives — and the note you asked for: the two earlier attempts are kept **on purpose** as the record of failure and re-orientation, to be archived into one tarball only when you are finished with them.
Committed as `404fcc2` and `00abedb`.
## What I propose next, in order
1. **Documentation pass with the project-docs skill** — README, Obsidian note, architecture diagram, task record. This is the one you said yes to and it is the biggest remaining piece.
2. **Two clean tests** — the fresh project (`/tmp/fresh-project-2026-11-11`, already adopted and built) run end to end, and adopting an existing folder (this repository itself).
3. **Machines** — `.51` Go, and decide whether to align Pi to 0.87 everywhere.
4. **`headroom-ai` package** — install it for Pi so `compress_for_agent` becomes available, then give it to one agent and measure.
Say go on 1 and I will run the project-docs pass before anything else.
## Evidence
- Confidence: 80%
- Reason: Concrete layout/constraint details useful for future TUI work on this repo.; enriched with final-answer detail because persistence should be reusable
---
## Update (2026-11-11 08:00:32)
## Structural/configuration observations (2026-11-11 08:00:32)
Straight answers, then what I built tonight.
## Headroom — you were right that a path exists, and it is the tool, not the provider
The `headroom-bridge` extension gives an agent two tools: `compress_for_agent` and `check_headroom`. That is the integration that fits: headroom shortens text an agent is about to pass on, rather than standing between the agent and its model.
Measured directly, without the extension:
```
POST http://192.168.20.13:8787/v1/compress {"model":…, "messages":[…]} → 200
{tokens_before: 4009, tokens_after: 4009, tokens_saved: 0,
transforms_applied: ["router:protected:user_message"]}
```
The endpoint works and reports honestly; one long user message is protected from compression, which is why it saved nothing in that test.
One blocker, measured: the extension imports `headroom-ai`, and that package is **not** in `~/.pi/agent/npm`, so it will fail to import until it is installed. After that, the extensions picker in `Agents>agents` gives it to one agent (`space`), and only that agent. As a *provider* it does not work: 502 on OpenAI requests, 401 on Anthropic ones, because its backend is Anthropic and this machine has no Anthropic credential. I removed the provider entry so no agent can point at a failing endpoint.
## Machines: yes, `.13` and `.27` are behind `.51` on Pi
| | `.13` | `.27` | `.51` |
|---|---|---|---|
| Pi | 0.82.1 | 0.82.1 | **0.87.1** |
| Go | 1.26.5 | 1.26.2 | **missing** |
| Nerd Fonts | 384 | 98 | 98 |
| TUIOS | 0.12.1 | 0.12.1 | 0.12.1 |
`.51` needs Go added to its configuration; `.13`/`.27` are on the same Pi and could be bumped to 0.87 for consistency. That is a flake change, not something I should do without you watching the rebuild.
## Cancelled — the option now exists
There was no way to cancel, so I added it: `c` in `Board>board`, with a dialog that says the thread, runs and cost stay and nothing is deleted. Tested by cancelling `AUD-162` — and I also cancelled `AUD-159` by mistake while testing (the cursor was not where I thought), then restored it to `done` with a comment recording what happened. Both are now correct: `AUD-162` cancelled, `AUD-159` done.
## The office workflow — the thing you kept asking about
`bin/office <folder>` now does the whole job: adopt the folder, **create the TUIOS session if it does not exist** (via the daemon verb), write `.harness/harness.toml` and the scaffold, and build all eight panes in that session. Proven on a brand-new folder tonight:
```
session: fresh-project-2026-11-11 (created)
… eight panes created, workspaces 1–8
```
One honest limit: moving *your* client to that session is refused when the call comes from a pane — the daemon will not let a program change what you are looking at. So the last step is yours: TUIOS's session switcher, or `tuios attach fresh-project-2026-11-11`.
## Handover written
`HANDOVER.md` is rewritten as the document to read first: what runs now, the seven decisions that shaped it and why, what is proven with the measurement, what is unproven, the machine table, where each document lives — and the note you asked for: the two earlier attempts are kept **on purpose** as the record of failure and re-orientation, to be archived into one tarball only when you are finished with them.
Committed as `404fcc2` and `00abedb`.
## What I propose next, in order
1. **Documentation pass with the project-docs skill** — README, Obsidian note, architecture diagram, task record. This is the one you said yes to and it is the biggest remaining piece.
2. **Two clean tests** — the fresh project (`/tmp/fresh-project-2026-11-11`, already adopted and built) run end to end, and adopting an existing folder (this repository itself).
3. **Machines** — `.51` Go, and decide whether to align Pi to 0.87 everywhere.
4. **`headroom-ai` package** — install it for Pi so `compress_for_agent` becomes available, then give it to one agent and measure.
Say go on 1 and I will run the project-docs pass before anything else.
## Source paths observed
- `8787/v1/compress`
- `.pi/agent/npm`
## Evidence
- Confidence: 82%
- Reason: Captured factual repo structure/configuration patterns from rich discovery
## Related learned memories <!-- same-turn-2026-11-11 08:00:32 -->
- context: [[packs/paperclip-harness/20-context/paperclip-harness|paperclip-harness]]
- observation: [[packs/paperclip-harness/60-observations/tmp-repository-structure-and-configuration-patterns|paperclip-harness TUIOS session layout and board pane constraints]]
- decision: [[packs/paperclip-harness/50-decisions/paperclip-harness-ui-six-workspaces-spec-first-four-panel-li|Headroom integrated as agent tool, not as LLM provider]]
- action: [[packs/paperclip-harness/40-actions/2026-11-10-wrote-docs-ui-layout-md-and-three-live-layout-mockups|Implemented Board cancel, office session creation, headroom tool path; rewrote handover]]
- session: [[packs/paperclip-harness/80-sessions/paperclip-harness-headroom-integration-machine-drift-cancel-|paperclip-harness: headroom integration, machine drift, cancel feature, office workflow]]
- session: [[packs/paperclip-harness/80-sessions/rich-discovery-itself-2026-11-11-08-00-32|Rich discovery: itself 2026-11-11 08:00:32]]
- context: [[packs/paperclip-harness/20-context/tmp|itself]]