Skip to main content

Craftsman

CI Version Python 3.10–3.13 Dependencies: stdlib only License: MIT

Craftsman makes an AI coding agent prove its change was reviewed and tested. The idea is build freely, review hard: while building, the agent works without review loops or ceremony. When it finishes, the final diff is frozen and the CLI plans the hunt from it. Fresh-context hunter subagents that did not write the code take every planned slot, separate verifier subagents try to disprove every finding, and the hunt continues while it keeps turning up real defects. The agent cannot finish until every slot is done and the tests pass on the final code.

Craftsman keeps a ledger in the .git directory with the evidence: which hunks each hunter covered, what each finding was judged to be and why, and the test runs. A platform hook checks the ledger when the agent tries to stop and sends it back with a list of what is missing. The gate checks outcomes, not effort, and a hook that fails is logged, never silent.

It works with Claude Code, GitHub Copilot, and Google Antigravity. In Codex and Cursor, the same protocol runs without hooks.

How It Works

Craftsman 5: build freely, review hard

The agent builds with no gate activity. Then the diff is frozen into a round and the CLI turns it into a hunt plan: slots of hunks and lenses, sized by the diff and its risk signals, not by how hard the model feels like trying. Each slot goes to a fresh-context hunter that records every candidate defect with a concrete trigger, and separate verifiers try to disprove each one and reproduce the survivors. Hunters maximize recall; verifiers maximize precision. While a wave proves a defect, another one runs. Confirmed defects are fixed at the root cause, the fix delta is re-checked by fresh hunters, and the tests run through craftsman run on the final code. /craft-review runs the same hunt on an existing change, and fixes only when you ask.

The full protocol, with diagrams, is in docs/how-it-works.md.

Platforms

Platform What blocks completion
Claude Code Stop hook
GitHub Copilot in VS Code Stop hook
GitHub Copilot CLI agentStop hook
Google Antigravity Stop hook
Codex, Cursor, and other tools that read AGENTS.md craftsman gate --complete

Where the platform cannot confirm that a separate subagent performed the review (Codex, Cursor, or a session without hooks), the review is advisory: it is complete when every hunk is covered, the gate still closes, and the report marks it as SELF-REVIEWED.

Measurements

Pilot on SWR-Bench: 5 PRs from pytest, flask, and requests, 9 ground-truth review comments (D1–D9), 1 repetition per configuration, Craftsman 5.0 /craft-review against an unassisted baseline, scored by hand. The sample is too small for statistical conclusions. Per-item matrix, ledger verdicts, and token telemetry: docs/benchmark.md. The seeded-defect suite in evals/ measures recall and cost on any agent platform.

Configuration Review comments found (of 9): without → with Craftsman Defects no reviewer raised (of 6) Avg. time / PR Avg. tokens / PR (in+out · cache read) Avg. tool calls / PR
Antigravity · Gemini 3.8 Flash low 3/9 → 3/9 1 → 2 0.7 → 5.1 min 104k → 1.33M · 0.26M → 4.63M 17 → 224
Antigravity · Gemini 3.8 Flash medium 2/9 → 3/9 4 → 4 3.1 → 18.4 min 246k → 3.82M · 1.04M → 25.13M 37 → 663
Antigravity · Gemini 3.8 Flash high 2/9 → 4/9 4 → 4 5.5 → 24.7 min 346k → 4.10M · 2.06M → 32.44M 55 → 707
Antigravity · Gemini 4 Argon low 1/9 → 3/9 2 → 4 2.4 → 12.6 min 60k → 585k · 0.52M → 3.87M 16 → 184
Antigravity · Gemini 4 Argon medium 2/9 → 4/9 5 → 5 3.5 → 25.4 min 72k → 2.60M · 0.40M → 20.26M 15 → 525
Antigravity · Gemini 4 Argon high 1/9 → 2/9 3 → 6 5.2 → 27.8 min 89k → 689k · 0.58M → 3.91M 20 → 170
Antigravity · Claude Sonnet 5.5 low 2/9 → 3/9 0 → 2 0.2 → 1.3 min 18k → 100k · 0.03M → 0.69M 1 → 24
Antigravity · Claude Sonnet 5.5 medium 2/9 → 4/9 1 → 1 0.2 → 1.2 min 18k → 101k · 0.03M → 0.67M 1 → 25
Antigravity · Claude Sonnet 5.5 high 1/9 → 4/9 2 → 2 0.3 → 2.9 min 23k → 205k · 0.05M → 1.45M 2 → 50

SWR-Bench types three of the nine items as functional (D1, D3, D9) and six as evolvability (documentation, formatting, test structure, changelog). Most of the gain is on documentation and changelog items: every baseline run already found D3, and no run found D4, D5, or D7. The third column counts six defects that /craft-review runs reproduced with a script and no reviewer raised; that list comes from the craftsman arm, so it favours it. Two of the six are in psf__requests-764, a PR that SWR-Bench labels clean. Summed over the nine configurations, the baseline reported 22 of these defects and /craft-review 30; the list is in Verified Defects Found Beyond SWR-Bench Ground Truth. Token counts include subagents. The Claude Sonnet 5.5 runs used an earlier build and ran one wave each, so their time and tool calls are not comparable with the Gemini rows.

Installation

Requires Python 3.10+, with no external dependencies.

pipx install craftsman-gate        # or: uv tool install craftsman-gate
craftsman install                  # detects Claude Code, Copilot, and Antigravity

Or as a plugin:

/plugin marketplace add BuczynskiRafal/craftsman              # Claude Code
/plugin install craftsman@craftsman
agy plugin install https://github.com/BuczynskiRafal/craftsman   # Antigravity
codex plugin marketplace add BuczynskiRafal/craftsman            # Codex
codex plugin add craftsman@craftsman

In Codex and Cursor the plugin brings the skills (and, in Cursor, an always-on rule) but no hooks, so the review stays advisory there. Cursor installs it as a local plugin; see docs/installation.md.

Usage

Type a request in plain words. There are no flags to remember.

/craftsman add pagination to the catalog search
/craftsman migrate the session store to Redis, this is critical
/craft-review review my staged changes and fix what you find
/craft-review review PR 42
/craft-review be thorough, this touches authentication

The agent works out the target (working tree, staged changes, a branch, a PR), whether to fix what it finds, and how deep to go. It goes deep on its own for risky changes or when you ask for care ("critical", "be thorough", ultracraft); the list of triggers is under Depth in the craft-review skill. Depth never goes down during a session. The final report explains what the agent decided and why. See docs/usage.md.

craftsman status shows the current round, coverage, and missing evidence.

Documentation

  • Usage: example requests, what the agent decides, optional flags
  • How it works: the protocol in full, the hunt plan, what hunters read, ledger, gate, lenses, platform enforcement
  • Installation: flags, platform setup, uninstall, craftsman doctor
  • Guards: gate state machine, review guard, command policy, search scope guard, hook error log
  • Skills: catalog of bundled skills
  • Benchmark: methodology, results, replication
  • Architecture: project internals for contributors

Contributing

See CONTRIBUTING.md.

Citation

@article{zeng2026swrbench,
  author    = {Zeng, Zhengran and Shi, Ruikai and Han, Keke and Li, Yixin and Sun, Kaicheng and Wang, Yidong and Yu, Zhuohao and Xie, Rui and Ye, Wei and Zhang, Shikun},
  title     = {{SWR-Bench}: Assessing {LLM} Performance in Real-World Code Review Comment Generation},
  journal   = {Proceedings of the ACM on Software Engineering},
  volume    = {3},
  number    = {FSE},
  articleno = {FSE137},
  year      = {2026},
  doi       = {10.1145/3808144}
}

License

MIT, see LICENSE and attribution in NOTICE.

Metadata

Release files for craftsman-gate 5.1.0

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

Source distribution (sdist)

Source distribution for craftsman-gate 5.1.0
File Size Uploaded Provenance Actions
craftsman_gate-5.1.0.tar.gz 796.8 kB With provenance Details for craftsman_gate-5.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for craftsman-gate 5.1.0
File Interpreter ABI Platform Actions
craftsman_gate-5.1.0-py3-none-any.whl Python 3 none any Details for craftsman_gate-5.1.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / craftsman_gate-5.1.0.tar.gz

Download URL craftsman_gate-5.1.0.tar.gz
Size 796.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b8460a7f078f203b6d72e0da4d8343fe5ee4c2f8c6b60a074469642e70aabcfd
BLAKE2b-256 checksum
How to use checksums
1d5de5756f0d1dbb2dd4b2625fbca55c062751863f33ba1b8825739bad14c4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Release files / craftsman_gate-5.1.0-py3-none-any.whl

Download URL craftsman_gate-5.1.0-py3-none-any.whl
Size 433.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1698e268178821f8a24174dcdda183e007580414d7054cf02025158061ea154c
BLAKE2b-256 checksum
How to use checksums
16908a12923b93a7d2cdc7451b7395ae308acd3ea643b274f30fa88f4d9b559a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 12, 2026.

Transparency log

Security for craftsman-gate 5.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for craftsman_gate-5.1.0.tar.gz

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 Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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