
Scripting Claude Code for headless & unattended tasks
Claude code’s today
(2025-07-22 in this case) usage as json
for each 5 hour blocks
of time:
ccusage blocks --since 20250722 --until 20250722 --json
Personal use case: Claude pro’s paid quota gets wasted during:
- holidays
- night when user is sleeping
- or even during the day on wekdays when we sometimes don’t use it much.
It’s quota is reset every 5 hours https://support.anthropic.com/en/articles/8325612-does-claude-pro-have-any-usage-limits
Trying to write a python/bash script that could parse this json, see if quota is unused 30-60minutes before 5 hr block gets expired…. and utilize it to run some background tasks via claude cli + MCP’s (e.g. generate text posts for social media OR analyze codebase passively in background to reveal bugs).