Skip to main content

claudeloop

PyPI Python versions CI License: MIT

Onion-architected, autonomous Claude Code session runner and full Anthropic SDK CLI — never blocks on a human, distinguishes an exhausted rate-limit window from exhausted credits, and resumes safely across usage windows.

What problem this solves

Claude Code sessions hit usage limits. A claude -p invocation ending doesn't tell you whether the task finished or just that turn did. And when a rate limit rejects you, you can't tell from the outside whether waiting will ever help — a five-hour window resets on its own; an exhausted credits balance never will, no matter how long you wait.

claudeloop exists to get all three of those distinctions right, automatically, so you can hand it a plan and walk away — including handling the case where you top up your account's credits while it's mid-wait, which it notices on the next probe rather than at some fixed deadline.

This project began as legacy/claude_autoresume.py, a single-file script that did this by shelling out to claude -p and regex-scraping its output. claudeloop replaces that with a tested, typed, onion-architected package built on the official claude-agent-sdk. See docs/architecture/decisions/ for why each specific change was made.

Install

pipx install claudeloop

See docs/getting-started/installation.md for requirements and a from-source setup.

Quickstart

claudeloop run handoff.md      # seed a session from a plan file and run to completion
claudeloop resume               # resume whatever you were last working on
claudeloop resume --session-id <id>
claudeloop doctor                # pre-flight checks before a long unattended run
claudeloop api models list       # any Anthropic SDK endpoint (generated; see docs)

Full walkthrough: docs/getting-started/quickstart.md.

Why it's different from just retrying on 429

Naive retry claudeloop
Sees an HTTP 429 Sleeps a fixed duration, retries Classifies why — a waitable rate-limit window, or exhausted credits that only a human can fix
Credits exhausted Sleeps forever, no reset time exists Probes on a bounded backoff and tells you it needs you
A credit top-up arrives mid-wait Not noticed until the fixed sleep ends Noticed on the next scheduled probe
Turn ends vs. task ends No structured signal — a marker string, easily confused with a truncated limit message Structured per-turn JSON verdict, with the legacy marker kept only as a fallback
Asked a clarifying question Hangs waiting for stdin, or fabricates an answer Denies the tool call with guidance, so the model proceeds on a stated, auditable assumption

See docs/guides/rate-limits-and-credits.md and docs/guides/never-blocking.md for the full reasoning.

Documentation

Full docs (built with MkDocs Material) live at https://adammatthewsteinberger.github.io/claudeloop/, and are also readable directly under docs/ in this repo:

Getting started Install, quickstart, configuration
Guides How autonomous runs work, rate limits vs. credits, never blocking, completion detection
Architecture The onion layers, the domain model, the run-loop state machine
Decision records Why each hard call was made
Contributing Development setup, testing philosophy, release process
Plans The original approved plans this project was built from

Project status

Pre-1.0, but functional through milestone M5. The CLI above genuinely works — run/resume drive Claude Code through claude-agent-sdk, sessions and doctor run against your environment, and claudeloop api exposes a generated 1:1 Anthropic SDK REST surface with a CI drift gate. domain/application carry a CI-enforced 100% test-coverage gate, with a live test suite (tests/live/) exercising the installed console script. See docs/plans/architecture-and-roadmap.md.

Contributing

Contributions are welcome — see CONTRIBUTING.md for the gitflow branch model, Conventional Commits requirement, and how to run every quality gate locally. This repo also ships a set of Claude Code skills that make Claude itself an effective contributor to this specific codebase — see CLAUDE.md.

Security

This tool bypasses Claude Code's interactive permission prompts by design (that's what makes autonomous operation possible) and handles API credentials. See SECURITY.md for the threat model and how to report a vulnerability.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claudeloop-0.3.0.tar.gz (143.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claudeloop-0.3.0-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file claudeloop-0.3.0.tar.gz.

File metadata

  • Download URL: claudeloop-0.3.0.tar.gz
  • Upload date:
  • Size: 143.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for claudeloop-0.3.0.tar.gz
Algorithm Hash digest
SHA256 32dfd8b26eb7f2126ec1604a3abf7204b6ddf9f58a089a55d863c5fe445cc594
MD5 7005e1a9e51d52b5890d9497afc05a67
BLAKE2b-256 80a348322f222206e91c3104273fef471980fa411fff3102496b5901dd3244f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudeloop-0.3.0.tar.gz:

Publisher: publish-to-pypi.yml on adammatthewsteinberger/claudeloop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claudeloop-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: claudeloop-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 57.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for claudeloop-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fed3f9ace637b7543e1c96d370c2ba8fe465624edab796210eb0d717c87cf8f3
MD5 15a7eb75d175b10df5776deacb5c3ecb
BLAKE2b-256 09cdffdd5e0f1ae2e13e3cb089c9c26c70f923d55cfcd526c999a8b65ee14213

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudeloop-0.3.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on adammatthewsteinberger/claudeloop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page