# astro-footer

Two-line footer for the [pi coding agent](https://github.com/badlogic/pi-mono). Replaces the built-in footer with a compact status bar that auto-grows to a second row only when there's information to show.

```
π | ◈ MoonshotAI: Kimi K2.6 | ? think:high | dir pi-astro | git main +2 *3 ?1     ↑1.2k ↓567 | $ $0.05 | ◫ 25.0%/256k AC
t 12m34s | name before-rewrite | cR 8.5k cW 2.1k | 🪨 caveman:full
```

Ships as part of [`@astrofoundry/pi-astro`](../../README.md). No extra install. Auto-activates on every pi session.

## What it shows

### Row 1 (always)

| Segment | Value |
|---|---|
| `π` | Pi marker |
| **model** | `Provider: Model Name` (e.g. `MoonshotAI: Kimi K2.6`) |
| **thinking** | `think:off` … `think:xhi`, colour-coded by level |
| **path** | Current working directory (`basename` by default) |
| **git** | Current branch + `+N` staged, `*N` unstaged, `?N` untracked. Branch turns yellow when dirty. |
| **tokens** | `↑input ↓output` for the session |
| **cost** | Cumulative cost - `$0.05` paid models, `(sub)` when the active model is OAuth-authed (Claude Pro / Codex Pro etc.) |
| **context** | `<percent>%/<total>` with `AC` suffix when auto-compaction is enabled. Yellow ≥ 70%, red ≥ 90%. |

### Row 2 (only when populated)

| Segment | Value |
|---|---|
| **session time** | Time since session start (only after 1 minute) |
| **session name** | Custom name set via `/name <text>` |
| **cache** | `cR <read> cW <write>` prompt-cache totals |
| **extension statuses** | Anything any extension publishes via `ctx.ui.setStatus(key, text)` (e.g. caveman's mode badge) |

The second row appears only when at least one of these has content. Otherwise the footer is a single line.

## Commands

| Command | Effect |
|---|---|
| `/footer` or `/footer status` | Print current state |
| `/footer on` | Re-enable after `/footer off` |
| `/footer off` | Restore pi's built-in footer |

## Environment overrides

```bash
ASTRO_FOOTER_NERD_FONTS=1   # force Nerd Font icons
ASTRO_FOOTER_NERD_FONTS=0   # force ASCII

ASTRO_FOOTER_PATH=basename     # default: just the leaf folder
ASTRO_FOOTER_PATH=abbreviated  # collapse middle dirs to … when long (e.g. ~/…/apps/web)
ASTRO_FOOTER_PATH=full         # full home-tilded path (e.g. ~/wb/github/astrofoundry/pi-astro)
```

## Auto-compact (`AC`)

`AC` reflects pi's `compaction.enabled` setting (default `true`). Read from `<cwd>/.pi/settings.json` first, then `~/.pi/agent/settings.json`, with project overriding global. When `AC` is missing, pi will hit the context wall instead of summarising.

## Subscription detection

The cost segment shows `(sub)` instead of `$X.XX` when:

- `ctx.modelRegistry.isUsingOAuth(model)` returns true - i.e. you're authed via OAuth (Claude / Codex Pro flow), so per-token cost is covered by the subscription.

Pi-tracked dollar costs would otherwise mislead you into thinking the call had a real bill.

## Git ± counts

astro-footer runs `git status --porcelain` async with a 750 ms cooldown. It refreshes:

- on session start
- when an `edit`, `write`, or `bash` tool finishes (debounced)

Heavy enough to surface uncommitted-work signal, light enough to never block rendering.

## Extension-status pass-through

Any extension that calls `ctx.ui.setStatus(key, text)` automatically appears on row 2 in muted colour.
