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

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. Milestone M2 is complete: the CLI above genuinely works — run/resume drive a real Claude Code session through claude-agent-sdk, sessions and doctor run against your real environment, and domain/application carry a CI-enforced 100% test-coverage gate, verified further by a live test suite (tests/live/) that exercises the actual installed console script against a real account. Milestone M4 (the generated 1:1 REST surface, claudeloop api ...) and M5 (final polish) are still roadmap. 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.2.0.tar.gz (134.4 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.2.0-py3-none-any.whl (47.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for claudeloop-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e020bb654368340e319b96b909b0f5e53331e7a0442505d9dd23751c48acb6d3
MD5 e2e3d1631982b76b006fb7aa35b9cd85
BLAKE2b-256 6f324bbcbbefebfe1b9539474f063352ea53ec54e70362908f98590717b4ca0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudeloop-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: claudeloop-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 47.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3224b236690c8b03a8c090e03b45ff1871a027c74660c07fd3d5b274c8cf5ca3
MD5 9d6912ab559de2d2698119f1dc722861
BLAKE2b-256 d8ba8a13ab257fca289df3eac6c1057bb2f7a39466bbb2c65e3accccd57b358d

See more details on using hashes here.

Provenance

The following attestation bundles were made for claudeloop-0.2.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