claudeloop
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 the architecture decision records for why
each specific change was made.
Install
pipx install claudeloop
See the installation guide 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: quickstart.
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 rate limits vs. credits and never blocking on a human for the full reasoning.
Documentation
Full docs (built with MkDocs Material) live at
https://adammatthewsteinberger.github.io/claudeloop/. The same content
is in the docs/ directory on GitHub.
| 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 the architecture roadmap.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claudeloop-0.3.1.tar.gz.
File metadata
- Download URL: claudeloop-0.3.1.tar.gz
- Upload date:
- Size: 144.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67746a0de6dcd9d92422e38d07c8da7c0a439808e3074eb5cca2a344143e34ca
|
|
| MD5 |
a89db1d3b0a618b34904a68d8fdef17a
|
|
| BLAKE2b-256 |
c01022259011ba95f5316dcef1b3fb324a3635a303ccebb5d045808b44ae88ae
|
Provenance
The following attestation bundles were made for claudeloop-0.3.1.tar.gz:
Publisher:
publish-to-pypi.yml on adammatthewsteinberger/claudeloop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claudeloop-0.3.1.tar.gz -
Subject digest:
67746a0de6dcd9d92422e38d07c8da7c0a439808e3074eb5cca2a344143e34ca - Sigstore transparency entry: 2406166188
- Sigstore integration time:
-
Permalink:
adammatthewsteinberger/claudeloop@c45c74ae36c868bebc11f38bf962bb80e386fd8c -
Branch / Tag:
refs/tags/claudeloop-v0.3.1 - Owner: https://github.com/adammatthewsteinberger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@c45c74ae36c868bebc11f38bf962bb80e386fd8c -
Trigger Event:
release
-
Statement type:
File details
Details for the file claudeloop-0.3.1-py3-none-any.whl.
File metadata
- Download URL: claudeloop-0.3.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb10c3bd2626eae6ab71f09850e67c6eeee19952d1f35f010cb4adea1a7711ce
|
|
| MD5 |
c2d0eadba1eb729666a001212466ffdc
|
|
| BLAKE2b-256 |
56fba570f9f9f8c4b69831dc934daa316925886175db51ca32ec4aafc70a38af
|
Provenance
The following attestation bundles were made for claudeloop-0.3.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on adammatthewsteinberger/claudeloop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claudeloop-0.3.1-py3-none-any.whl -
Subject digest:
cb10c3bd2626eae6ab71f09850e67c6eeee19952d1f35f010cb4adea1a7711ce - Sigstore transparency entry: 2406166228
- Sigstore integration time:
-
Permalink:
adammatthewsteinberger/claudeloop@c45c74ae36c868bebc11f38bf962bb80e386fd8c -
Branch / Tag:
refs/tags/claudeloop-v0.3.1 - Owner: https://github.com/adammatthewsteinberger
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@c45c74ae36c868bebc11f38bf962bb80e386fd8c -
Trigger Event:
release
-
Statement type: