# Noise goes. Failures stay.

> Footnote Lean compacts noisy shell output while keeping every failure line, guards large and repeated reads in Antigravity, enforces one shared hook + MCP turn budget, and measures prefix cost.

Less for your agent to read, every turn.

Lean trims verbose shell output before your coding agent reads it while preserving every error line, intercepts bloated Antigravity file reads, enforces a shared hook + MCP turn budget and audits Turn-1 prefix bloat.

[Turn on Lean](#start) · [Read the numbers](#numbers)

Claude Code · Codex · Antigravity CLI · runs on your machine

## Five ways Lean shrinks every turn

### Shell compaction via `footnote run`

Hooks installed by `footnote install --lean` wrap builds, tests, linters, git and search commands in Claude Code, Codex and Antigravity CLI (`agy` / T3 Code). Passes through untouched whenever filtering wouldn't make output smaller; full logs stay local via `footnote output <id>` (secrets never cached).

### Read & re-read guards

Intercepts oversized whole-file reads (`≥ 500` lines) on indexed repos with Code Graph outlines, caps unindexed files, blocks unchanged repeat whole-file reads within 20 steps, and guides grep calls toward symbol search.

### Unified hook + MCP turn budget

Hard per-event caps (`3,400 B` start, `1,200 B` prompt/tool) plus an HMAC-verified shared shown-log eliminate **100 %** of hook ↔ MCP duplicates.

154k-token session replay (HOOK-BUDGET, 25 Nov 2026): SessionStart payload dropped from 6,267 B to 2,688 B (-57.1%), with zero hook-to-MCP repeats

### Turn-1 prefix audit

`footnote audit-prefix --probe-mcp` measures what MCP schemas, instructions and skills send on every turn. Footnote's 8-tool MCP schema fits in **3,979 B** (under the `5,000 B` budget).

### Handoff, Lean B & offline pricing

Warns past **140,000** tokens (or **55 idle min** above 60k) for a clean handoff, toggles `memory.lean_rules` via a 4-bar picto in Launcher Usage, and prices transcripts locally using a bundled LiteLLM snapshot (`usage --sync-prices` to refresh).

## Shell filter measurements (T8)

13 cases across 6 command families (20 Nov 2026). Pre-registered gate: keep at least 99 % of failure markers, save at least 20 % of bytes, never bloat output. Every family kept 100 % of failure markers (99 of 99).

| Command family | Cases | Bytes saved | Failure lines kept |
|---|---|---|---|
| `cargo test` | 3 | 88.8 % | 9 of 9 100 % |
| `cargo build` | 1 | 80.6 % | 6 of 6 100 % |
| test runners | 2 | 69.4 % | 7 of 7 100 % |
| linters | 2 | 52.0 % | 10 of 10 100 % |
| git | 3 | 24.7 % | 27 of 27 100 % |
| search | 2 | 22.5 % | 40 of 40 100 % |

Failure markers cover compiler error codes, failing assertions, panic locations, diff hunks, search line numbers and lint rule codes (5 recordings + 8 live commands on this repository; pre-registered gate, not a broad field study).

## Against RTK 1.2.0: same live commands

RTK compresses aggressively on tests and diffs, at the cost of dropping actual failure lines. On `rg` search it saves nothing. Chart compares failure marker retention rate directly above the raw table.

Failure markers kept on live commands (higher is safer): cargo test Footnote 2 of 2 (100%) vs RTK 1.2.0 1 of 2 (50%); git diff Footnote 12 of 12 (100%) vs RTK 6 of 12 (50%); git log -20 both 10 of 10; rg search both 20 of 20 (Footnote 20.9% bytes saved vs RTK 0%)

| Command | Footnote saved | Footnote kept | RTK saved | RTK kept |
|---|---|---|---|---|
| `cargo test` | 88.0 % | 2 of 2 100 % | 96.9 % | 1 of 2 dropped |
| `git diff` (3 commits) | 10.2 % | 12 of 12 100 % | 16.2 % | 6 of 12 dropped |
| `git log -20` | 70.1 % | 10 of 10 100 % | 56.7 % | 10 of 10 |
| `rg` (one pattern) | 20.9 % | 20 of 20 100 % | 0.0 % | 20 of 20 |

## Opt-in Lean B & open measurements

In our 7-arm `claude-haiku-5-5` single-turn evaluation (126 calls, 25 Nov 2026, `LEAN-B`), `lean_b_lite` delivered the lowest cost per accepted answer while keeping 6/6 durable-prose compliance. Paired 95% confidence intervals vs Control crossed zero, so concise output rules remain opt-in (`memory.lean_rules = false` by default).

| Arm (`claude-haiku-5-5`) | Cost / accepted | Durable-prose exclusion | Note |
|---|---|---|---|
| `lean_b_lite` | $0.000803 | 6 / 6 (100 %) | −237.4 output tokens [−442.2, −32.6] vs Control |
| Control (off) | $0.000867 | 6 / 6 (100 %) | Default baseline (memory.lean_rules = false) |
| Ponytail | $0.000871 | — | External terse prompt arm |
| Caveman | $0.001058 | — | 50.0 % task acceptance rate |

- Live monthly quota savings across multi-turn, multi-model sessions remain unmeasured (`HOOK-BUDGET` and `LEAN-C1` measure deterministic replay/paired suites; `T1` Opus pilot measured 20–34 % fewer output tokens at small sample size).
- Prefix sizes across diverse real user setups vary—measure yours directly with `footnote audit-prefix --probe-mcp`.

## Turn it on.

You need Footnote installed first: see [install](https://footnote-alpha.johanproust.workers.dev/index.md#install).

### Filter

Adds the shell filter and read/budget hooks to your agents.

```sh
footnote install --lean
```

### Audit

See what every turn sends before you type a word.

```sh
footnote audit-prefix --probe-mcp
```

---

Page: https://footnote-alpha.johanproust.workers.dev/lean
Source: https://footnote-alpha.johanproust.workers.dev/llms.txt lists every page.
