Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,65 @@ To demo/test:
```bash
make demo
```

## Claude Subscription Quota Mode

YAS can display an approximate **subscription quota gauge** instead of the per-session dollar cost rows. This is useful on flat-rate plans (Claude Pro, Max 5x, Max 20x) where dollar totals matter less than remaining headroom for the window.

### Why approximation?

Anthropic does not expose live quota data through the transcript API the way Codex rollouts do. YAS approximates usage from local session/day token totals against hardcoded plan ceilings. The ceilings are heuristic estimates based on Anthropic's "5x / 20x of Pro" framing — [check the current plan page](https://www.anthropic.com/pricing) and tune via env vars if the defaults diverge from your observed experience.

### Env-var contract

| Variable | Default | Description |
|---|---|---|
| `YAS_CLAUDE_MODE` | `cost` | `cost` = existing dollar rows · `quota` = subscription gauge |
| `YAS_CLAUDE_PLAN` | `max20` | `pro` · `max5` · `max20` |
| `YAS_CLAUDE_5H_CAP_TOKENS` | _(plan default)_ | Override the 5-hour window ceiling |
| `YAS_CLAUDE_WEEKLY_CAP_TOKENS` | _(plan default)_ | Override the weekly window ceiling |

### Plan ceilings (heuristic defaults)

| Plan | 5h cap | Weekly cap |
|---|---|---|
| `pro` | 1.5M tokens | 18M tokens |
| `max5` | 7.5M tokens | 90M tokens |
| `max20` | 30M tokens | 360M tokens |

### Quota gauge render

```
Wide: 󱙄 5h ▆▆░░░░░░ 24% │ 7d ▆░░░░░░░ 12% │ max20x
Medium: 󱙄 5h 24% · 7d 12%
Narrow: 󱙄 5h 24%
```

Color thresholds: `< 60%` green · `60–85%` yellow · `> 85%` red (same as Codex gauge).

When `YAS_CLAUDE_MODE=quota`, the two cost rows are replaced by a single quota gauge row. The Codex gauge row (if Codex data is present) still appears beneath it.

### Example

```bash
YAS_CLAUDE_MODE=quota YAS_CLAUDE_PLAN=max20 python3 ~/.claude/statusline_command.py < session.json
```

---

## Codex Rate-Limit Gauge

A third row beneath the Claude cost rows shows your **Codex rate-limit window consumption** (rate limits, not dollars — Codex Pro is flat-rate).

```
󰞬 5h ▆░░░░░░░ 12% │ 7d ▆▆░░░░░░ 28% │ pro
```

- Reads from `~/.codex/sessions/<YYYY>/<MM>/<DD>/rollout-*.jsonl`
- Override the sessions root with `YAS_CODEX_SESSIONS_DIR`
- Shows the **5-hour** and **7-day** window consumption percentages
- Color thresholds: `< 60%` green · `60–85%` yellow · `> 85%` red
- If the latest rollout is older than 1 hour, a `(stale Xh)` indicator appears
- Narrows gracefully: medium width shows both percentages without bars; narrow shows only the 5h window
- If no Codex session data is found, renders `no codex data` in dim grey

Loading