Files
platform/todo/sub-agents/spawning-must-respect-the-account-s-own.md
T

33 lines
1.8 KiB
Markdown

---
id: sub-agents/spawning-must-respect-the-account-s-own
title: "Spawning must respect the account's own session and weekly limits"
theme: sub-agents
status: open
created: 2026-08-21
date_source: stated
order: 2
---
**Spawning must respect the account's own session and weekly limits.** Wanted 2026-08-21, as a
condition on the spawn endpoint rather than a later refinement. The failure it exists to prevent is
specific: a sub-agent burns the last of a window, and the chat or session the owner is actually in dies
mid-turn because the credits went somewhere nobody was watching.
**The numbers are already read.** `api/chat/claude-usage.ts` fetches the limit windows from Anthropic's
OAuth usage endpoint using the token the CLI stored at login, and exposes them as `UsageLimit` — a label
already fit to render (`Session`, `Weekly`, `Fable Weekly`) with its percentage. So the backend does not
need new plumbing to know how much room is left; it needs to consult what it has before starting work.
Two facts from that file that shape this, both stated in its own header:
- **The windows belong to the ANTHROPIC ACCOUNT, not to Officer.** They are spent by every `claude` on
the machine — this chat, a terminal, a task runner, a pipeline step. So a budget check has to reason
about a shared pool it does not control, and a reservation Officer makes for itself is a guess.
- **The module is owner-only and structurally so.** It takes no identity at all, deliberately, because
`getOwnerHomeDir` ignores the email it is passed. Any budget rule that has to answer "how much has
THIS user left" needs something that does not exist yet.
Open: what the endpoint does when the room is thin — refuse, queue until the window resets (the reset
time is in the same payload), or downgrade the model; and whether the reserve is a fixed floor or a
share the owner sets.