Skip to content

feat: Haiku agents stay out of the running and starts limits - #50

Open
rbartoli wants to merge 1 commit into
mainfrom
feat/haiku-agents-outside-caps
Open

rbartoli wants to merge 1 commit into
mainfrom
feat/haiku-agents-outside-caps

Conversation

@rbartoli

Copy link
Copy Markdown
Owner

This is steal (10) from the 2026-10-23 competitor check (internal note, Q3).

A burst of Haiku agents, such as Explore searches, asked like any other fan-out, though Haiku draws far less on a plan's usage than larger models. This PR leaves Haiku agents out of the running (4) and starts (12 per 10 min) limits. They still count toward the subagent token budget, the burn rule and every plan-window rule.

How the model is known

  • At the gate: agent.spawn's model (the Agent tool's parameter, alias or id), or parentModel for a fork. When Claude names Haiku, the running and starts trips are skipped.
  • After the start: next(e) resolves the model the agent really runs on. An agent whose own definition picks Haiku (the call names no model) is judged like any agent at the gate, then stops counting once it starts: its reserved start is released and its record is marked cheap.
  • Resumes by SendMessage follow the agent's recorded cheap.

runningAgents skips cheap agents, so the peer record other sessions read leaves them out too. A Haiku agent still counts briefly while it starts (pendingStarts). That keeps its own SubagentStart from being counted as an unclaimed fork.

Default (my call, reversible): on. AGENT_GUARD_HAIKU_EXEMPT=0 counts Haiku agents like any other. It's a new switch, read by name, and claude plugin validate lists it.

Test plan

  • New tests: with 4 agents running, 5 Haiku agents start and the peer record still says 4 running and 4 starts; an agent whose definition picks Haiku (the harness reports claude-haiku-4-5) never counts; AGENT_GUARD_HAIKU_EXEMPT=0 refuses the 5th Haiku agent
  • claude plugin test . on 2.1.310: 106 pass. With core/ and hooks/register.ts stashed, the two exemption tests fail.
  • claude plugin validate . --strict lists AGENT_GUARD_HAIKU_EXEMPT; tsc is clean
  • CI is green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant