Skip to main content

Cleaner Crew 🧹

A crew of Claude Code agents that picks up small, safe tasks from your tracker (Linear, Jira), fixes them in isolation, and opens merge requests on GitHub or GitLab. It only ships a change when a deterministic policy gate agrees, it never merges, and it earns more autonomy per category only as humans accept its work.

scout ──► proposed tickets (cleaner-crew:proposed)
             │  a human adds the `cleaner-crew` label to the ones worth doing
candidate tickets (cleaner-crew)
             │
manager ──► claim ──► triage + plan
             │
             ├─► inspector   write a failing test that reproduces the bug (bugfix)
             ├─► janitor     implement the plan (cannot edit tests)
             ├─► inspector   cover the change with tests (can only edit tests)
             ├─► tests + lint + diff + mutation testing, run by the orchestrator
             └─► hooded      read-only security review, can veto
             │
policy gate + manager verdict + trust level ──► MR │ draft MR │ shadow │ escalate │ reject
             │
target repo CI: cleaner-crew-verify (required check) + human approval ──► merge

Install into a repository

cd path/to/your/cloned/repo
uvx cleaner-crew init        # or: uv tool install cleaner-crew && cleaner-crew init

init walks you through:

  1. Code host. It detects GitHub/GitLab from origin, checks the token (or an existing gh login) and verifies that it has push and MR permissions.
  2. Task manager. You choose Linear or Jira, paste a token if one is missing, pick the team/project, and map the todo / in progress / in review statuses.
  3. Tests. It detects the stack, confirms the test and lint commands, and runs the suite once. If the baseline is red, the crew is installed disabled.
  4. Files. It writes .cleaner-crew/config.yml, policy.yml and .claude/agents/cleaner-crew-*.md.
  5. Runner. Choose a scheduled CI job (GitHub Actions / GitLab schedule), a local daemon (loop or systemd user timer), or both.
  6. Protection. It adds the cleaner-crew-verify CI check, checks branch protection on the default branch and tells you exactly what to turn on.

Secrets go to .cleaner-crew/secrets.env (gitignored, mode 600) or your CI secrets. config.yml holds only the variable names.

Commands

command what it does
cleaner-crew init install and connect
cleaner-crew doctor re-check connections, CLI, test baseline, kill switch
cleaner-crew run --dry-run scout and plan only; nothing is claimed, filed or pushed
cleaner-crew run one run: up to max_tasks_per_run tickets
cleaner-crew trust each category's earned trust level and acceptance rate
cleaner-crew verify --base main CI check re-applying the base branch's policy to a crew branch
cleaner-crew daemon run in a loop on this machine
cleaner-crew stop / resume kill switch (commit .cleaner-crew/STOP to stop CI too)

How it earns trust

Humans choose the work. The scout only proposes (cleaner-crew:proposed). Adding the cleaner-crew label takes about ten seconds and is far cheaper than reviewing a pointless MR. At most max_open_proposals proposals are open at once.

Autonomy per category is measured, not assumed. An MR counts as accepted if it was merged with no human commits pushed to its branch (crew commits carry Cleaner-Crew-* git trailers). Over the last trust.window closed MRs per category:

record level behaviour
fewer than min_samples draft MRs are opened as drafts
acceptance ≥ promote_at (80%) ready MRs are opened ready for review
acceptance < demote_below (50%) shadow the plan is posted on the ticket; nothing changes
otherwise draft

The earned level is capped by each category's max_level in policy.yml. After fixing whatever caused a demotion, set trust_since to today's date to start a fresh record. History is read from the code host, so CI and local runners agree.

Tests must actually test the change. After tests pass, the crew mutates the changed lines (==→!=, <→<=, n→n+1, and→or, ...) and re-runs the tests. If fewer than mutation.min_score of the mutants are caught, the MR becomes a draft, and the surviving mutants are listed in the MR.

Protecting the target repo

The crew never merges. The repository's own protections are the real safety net:

  • Branch protection on the default branch: require at least one approving review, dismiss stale approvals, and require cleaner-crew-verify plus your test workflow.
  • cleaner-crew-verify re-checks every cleaner-crew/* MR against the policy from the base branch. It checks forbidden paths (including the crew's own config), size limits, required tests, category enabled, and crew trailers present. On GitHub it runs as pull_request_target, so an MR can't edit the check that judges it, and it never executes the MR's code.
  • CODEOWNERS for /.cleaner-crew/, /.claude/ and CI config.

cleaner-crew doctor reports whether the default branch is adequately protected.

Safety model

  • The policy gate is code, not a prompt. policy.yml sets size limits, forbidden paths, required tests and security approval. The manager's verdict can only be made stricter by the policy.
  • Separate contexts. Each role is a separate claude -p process. The inspector and hooded agent see the plan and diff, never the janitor's reasoning.
  • Separation of duties. Janitors cannot edit tests, and inspectors can only edit tests. Scout, manager and hooded agents are read-only.
  • Three layers of tool restriction: --allowedTools per role, the agent's tools: frontmatter, and a PreToolUse guard hook (cleaner_crew.hooks.guard). The guard blocks the network, git history commands, secrets files, anything outside the task worktree, and the crew's own config.
  • Agents hold no credentials. Tracker and code host tokens are stripped from agent environments. Only the orchestrator claims tickets, commits, pushes and opens MRs.
  • Ticket text is untrusted. It is wrapped as data. The hooded agent checks the diff against the plan and flags suspected prompt injection, which blocks the change.
  • Limits: max open crew MRs, a per-task cost cap, a green baseline requirement, and a kill switch.
  • Audit trail: every agent transcript, the test log and the outcome are kept under .cleaner-crew/runs/ (uploaded as a CI artifact).

Extending

Add a tracker or code host by implementing TaskSource or CodeHost in src/cleaner_crew/adapters/base.py and registering it in adapters/__init__.py. Customise agent behaviour by editing .claude/agents/cleaner-crew-*.md in the target repo.

Development

uv sync
uv run pytest

Release files for cleaner-crew 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cleaner-crew 0.1.1
File Size Uploaded
cleaner_crew-0.1.1.tar.gz 61.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cleaner-crew 0.1.1
File Interpreter ABI Platform
cleaner_crew-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 119.9 kB

Release files / cleaner_crew-0.1.1.tar.gz

Download URL cleaner_crew-0.1.1.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
46ca4287bfd4f98cbc4ff3be74a8eee220901429a1d5347c7faff8c836552cae
BLAKE2b-256 checksum
How to use checksums
6f645d7173b4714b861bdda0ae07716af7a56f910fb21c3d7067263fd7c3d518
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / cleaner_crew-0.1.1-py3-none-any.whl

Download URL cleaner_crew-0.1.1-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8043610198cce5ff681501093ba291a23d17e6c32fd9d715e00e2ce226b0223f
BLAKE2b-256 checksum
How to use checksums
9f7321ec848d0fae807e82931521a4a91e024f04573aa1e12fb920d1e8d7dd1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page