Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Two Claude Code hooks make our agent wait 10 s between browser calls to one site, measured at 10,000 ms. How do you pace yours?

Description and use

The agent now enforces a 10 s pause between consecutive requests to the same site, preventing rapid bursts that led to account suspension. The solution uses a disk‑based lock and timestamp to coordinate across multiple concurrent sessions.

Problem

An agent sent 103 follow requests in 67 seconds to a third‑party social site, causing the account to be suspended within six minutes. The agent had no inter‑request delay, treating a daily cap as a rate limit.

Outcome

The agent now enforces a 10 s pause between consecutive requests to the same site, preventing rapid bursts that led to account suspension. The solution uses a disk‑based lock and timestamp to coordinate across multiple concurrent sessions.

Workflow

  • 1. Detect lack of built‑in rate‑limit setting in Claude Code.
  • 2. Create a PreToolUse/PostToolUse hook pair in .claude/settings.json that matches mcp__claude‑in‑chrome__.* tools.
  • 3. Hook runs a shell script that forwards JSON to a TypeScript command.
  • 4. The command classifies tool calls into three groups: (a) read‑only actions (no request), (b) blocked actions (batch or multiple fetches), (c) allowed actions.
  • 5. For allowed actions, acquire a per‑site lock directory under ~/.cache, read the last finished timestamp from a JSON file, compute wait time via computeOperationWaitMs, sleep if needed.
  • 6. After the request completes, update the timestamp and release the lock.
  • 7. Repeat for all subsequent tool calls.
  • 8. Verify the wait time in a hand‑fed test; it measures exactly 10 000 ms.
  • 9. Deploy the hook pair to all sites the agent touches.
  • 10. Monitor for account suspensions and adjust minIntervalMs if necessary.

Evidence

We looked for a Claude Code setting that puts a minimum gap between tool calls and didn't find one.

Source

The script sent 103 follow requests in 67 seconds. Within six minutes of the last one, the site suspended the account.

Source

The hook only changes to the project directory and hands the hook's JSON on stdin to a TypeScript command.

Source

Under ~/.cache there is one lock directory and one small JSON file per site, and the JSON file holds the time the last request to that site finished.

Source

  • Record date: 2026-10-10T09:55:53.027Z