Fix: rate_limit_error on Claude Sonnet 4.6 in a Long Agent Loop
A 429 rate_limit_error on claude-sonnet-4-6 in a long agent loop is almost always ITPM, not RPM. Read retry-after, cache the system prompt, and gate on anthropic-ratelimit-input-tokens-remaining. Step-by-step fix with code.