Skip to main content

Craftsman

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

Craftsman adds a layer to an AI coding agent that checks the quality and simplicity of the code it delivers. The agent cannot finish its work until an independent reviewer has examined the change. Craftsman enforces a review loop in which every reported defect is verified and resolved, and at the end the tests must pass on the final version of the code.

Craftsman keeps a ledger in the .git directory, where it collects evidence from review, verification, and tests. When the agent tries to finish, a platform hook checks the ledger and, if anything is missing, sends the agent back with a list of what is missing.

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

How It Works

Craftsman engineering loop

  1. /craftsman <task> records the base commit that the diff is computed from.
  2. The agent implements the change and cleans it up with /simplify.
  3. Craftsman splits the diff into hunks and attaches to each one the context the diff does not show: the rest of the function, its call sites, and risk signals. Defects usually sit where the change meets that code.
  4. Reviewer subagents that did not write the change examine every hunk through several lenses (for example contracts, error handling, tests, security) and record suspected defects.
  5. A separate verifier tries to disprove or reproduce each suspected defect. Searching and judging are kept apart so that the reviewer does not drop leads too early.
  6. The agent fixes confirmed defects. Every piece of evidence in the ledger is tied to a diff fingerprint, so a code change invalidates the old review; the next round covers only the changed parts.
  7. The agent runs the tests through craftsman run, which records the exit code.
  8. The stop hook lets the agent finish once the ledger is complete for the current version of the code. The agent prints a report: what was reviewed, what was found, what was fixed, what was dismissed, and what the gate did not assess.

The level of rigor depends on the gear: quick for small changes (review in the current context), standard by default (subagents and a verifier), deep for risky changes (all lenses, tests, and e2e).

/code-review runs only the review of an existing change, without fixes.

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, the report marks it as SELF-REVIEWED.

Measurements

Pilot on SWR-Bench: 5 PRs from pytest, flask, and requests, 9 confirmed defects, 1 repetition per configuration. The sample is too small for statistical conclusions. Details and Claude Code runs: docs/benchmark.md.

Configuration Defects: without → with Craftsman Avg. time per PR
Antigravity · Gemini 4 Argon low 2/9 → 4/9 1.5 → 4.7 min
Antigravity · Gemini 4 Argon medium 2/9 → 5/9 2.0 → 6.7 min
Antigravity · Gemini 4 Argon high 3/9 → 7/9 15.6 → 26.3 min

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

Usage

/craftsman add pagination to the catalog search
/craftsman --deep migrate the session store to Redis
/code-review

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

Documentation

  • How it works: ledger, lenses, gears, platform enforcement
  • Installation: flags, platform setup, uninstall, craftsman doctor
  • Usage: commands, review-only mode
  • Guards: gate state machine, search scope guard
  • 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 4.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 4.1.0
File Size Uploaded Provenance Actions
craftsman_gate-4.1.0.tar.gz 417.6 kB With provenance Details for craftsman_gate-4.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 723.0 kB

Release files / craftsman_gate-4.1.0.tar.gz

Download URL craftsman_gate-4.1.0.tar.gz
Size 417.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d1bfd967e16b77ce5da715d3f9a742de9b439f59481d9ed685010b7c17c5aa1d
BLAKE2b-256 checksum
How to use checksums
8be6b0fa04ac2f03549e04796838d727a6809095b783bc461cdcf1765f48b537
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 2, 2026.

Transparency log

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

Download URL craftsman_gate-4.1.0-py3-none-any.whl
Size 305.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef0d029521b4074b83c4bc0884d152ac64ac6090b8919d1e159439534b4e0e6c
BLAKE2b-256 checksum
How to use checksums
b9a1a20d13277aad45e205276ab9fe673e40fdf2ae6a326458d81fcf54379b4f
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 2, 2026.

Transparency log

Security for craftsman-gate 4.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-4.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 2, 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