Skip to main content

pycastle

pycastle is a label-driven orchestrator for agentic coding work: label a GitHub issue ready-for-agent, and a pipeline picks it up, implements it, reviews it, and merges it.

Supported agents

pycastle supports Claude Code, Codex, and OpenCode as agent services.

The bundled defaults are service-aware: OpenCode is first for planning, Codex is first for most execution stages, and Claude is first for review while also serving as fallback elsewhere.

Why pycastle

  • Unattended operation. Once issues are triaged, pycastle runs the full pipeline without anyone at the keyboard — overnight, on a Raspberry Pi, or scheduled via cron.
  • Deliberate human-in-the-loop gate. The ready-for-agent label is set by a person (or a triage agent). Nothing enters automation until a human — or a designated triage step — explicitly approves it.
  • Inspectable phase boundaries. Each phase (preflight, plan, implement, review, merge) is discrete and logged, so you can see exactly where a run succeeded or stalled.
  • Parallel issues without conflict. Multiple issues are implemented in isolated worktrees and merged in a single phase; when conflicts arise a merger agent resolves them rather than blocking the whole run.

The pipeline

Preflight

Before any agent work begins, pycastle runs the configured checks (linting, type-checking, tests) against the current codebase. Preflight exists because agents should start from a green baseline — handing an agent a broken repo compounds errors rather than fixing them. If a check fails, a preflight-issue agent diagnoses the failure and files a structured GitHub issue, routing it to either ready-for-agent or ready-for-human depending on whether automation can fix it.

Plan

The planner agent reads all open ready-for-agent issues, evaluates declared dependencies, filters out anything still blocked, and produces an ordered list of issues to tackle this iteration. The plan phase exists to prevent agents from starting work that depends on unfinished prerequisites.

Implement

An implementer agent is spawned for each planned issue in an isolated worktree. The agent reads the issue, writes the code, and runs the implement checks in a feedback loop until they pass. The implement phase exists because isolating each issue's changes prevents one in-progress fix from interfering with another.

Review

Immediately after each implementer completes, a reviewer agent inspects the same branch — re-running checks, reading the diff, and pushing corrections directly onto the branch. The review phase exists because separating the implementer and reviewer reduces accept-your-own-work bias and catches mistakes that the implementer's own feedback loop missed.

Merge

Once all implementer/reviewer pairs have finished, pycastle merges each completed branch into the default branch and closes the corresponding GitHub issue. When branches conflict, a merger agent resolves them before committing. The merge phase exists as a dedicated integration step so that conflict resolution is handled consistently and issues are only closed after code is confirmed on the main branch.

Improve

Improve is a separate, opt-in mode that is off by default; it can be enabled via docs/usage.md and set to run until_sleep or endless. When active, Improve scans the codebase, produces a lightweight PRD of potential improvements, and files structured GitHub issues automatically. The differentiator that makes unattended operation safe is the AFK-safety filter: it allows only changes that are entirely internal — refactors, dead-code removal, and type tightening — and explicitly forbids anything touching CLI interfaces, configuration, ADRs, UX, or issue contracts. Because every issue Improve files already carries ready-for-agent, it bypasses the manual triage step; the AFK-safety filter is the substitute for the human-in-the-loop gate that the rest of the pipeline relies on.

Labels

ready-for-agent is the entry point into automation. Labelling an issue ready-for-agent is a deliberate act: it means the issue is fully specified, has clear acceptance criteria, and needs no further clarification before an agent can work on it. The planner only considers issues carrying this label — everything else is invisible to the pipeline. If preflight checks fail in a way that requires human attention, the auto-filed issue is labelled ready-for-human instead, and the pipeline pauses until a person re-routes it.

Every ready-for-agent issue that touches code or documentation must carry exactly one slice-mode label: behavior-slice for changes that add or alter observable behaviour, refactor-slice for internal restructuring with no behaviour change, and docs-slice for documentation-only updates. pycastle dispatches a different implement prompt for each label, so agents receive instructions tuned to the kind of work involved. The behavior-slice prompt enforces a red/green TDD gate — tests must fail before the fix and pass after.

Getting started

Acknowledgements

Initial inspiration: sandcastle by Matt Pocock.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycastle-0.8.0.tar.gz (717.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycastle-0.8.0-py3-none-any.whl (264.8 kB view details)

Uploaded Python 3

File details

Details for the file pycastle-0.8.0.tar.gz.

File metadata

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

File hashes

Hashes for pycastle-0.8.0.tar.gz
Algorithm Hash digest
SHA256 ae03129c41d9e75c2aa058f34061c4218d6dfb082d2d972e9f61ed4a3c62968b
MD5 2d99a0c0d5a65fe880a59f8d7c589d54
BLAKE2b-256 45a73884a8cb8e8148aeb0b5527bdb82277fe1a7fe166a63fb6d8798ed7d01b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycastle-0.8.0.tar.gz:

Publisher: publish.yml on Johannes-Kutsch/pycastle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycastle-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: pycastle-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 264.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pycastle-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53a4389c77e51ff8816c511ca6c4cec641c182bf08253d2b8362389171bc178f
MD5 c502dbcdf7dce2ac89cfc281e8ec3c44
BLAKE2b-256 02ff17e08ba27b2de7c9340740e568eadbda51add78e842c00c5455173efe52c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycastle-0.8.0-py3-none-any.whl:

Publisher: publish.yml on Johannes-Kutsch/pycastle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

This release

0.8.0 This release

2 files

0.7.36

2 files

0.7.34

2 files

0.7.33

2 files

0.7.32

2 files

0.7.31

2 files

0.7.30

2 files

0.7.28

2 files

0.7.27

2 files

0.7.25

2 files

0.7.24

2 files

0.7.22

2 files

0.7.21

2 files

0.7.20

2 files

0.7.19

2 files

0.7.18

2 files

0.7.17

2 files

0.7.16

2 files

0.7.14

2 files

0.7.12

2 files

0.7.11

2 files

0.7.10

2 files

0.7.9

2 files

0.7.8

2 files

0.7.7

2 files

0.7.6

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.4

2 files

0.6.2

2 files

0.5.23

2 files

0.5.22

2 files

0.5.21

2 files

0.5.20

2 files

0.5.19

2 files

0.5.18

2 files

0.5.17

2 files

0.5.16

2 files

0.5.15

2 files

0.5.14

2 files

0.5.13

2 files

0.5.12

2 files

0.5.11

2 files

0.5.10

2 files

0.5.9

2 files

0.5.8

2 files

0.5.7

2 files

0.5.5

2 files

0.5.3

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.36

2 files

0.4.35

2 files

0.4.34

2 files

0.4.33

2 files

0.4.32

2 files

0.4.30

2 files

0.4.29

2 files

0.4.28

2 files

0.4.27

2 files

0.4.26

2 files

0.4.25

2 files

0.4.24

2 files

0.4.23

2 files

0.4.22

2 files

0.4.21

2 files

0.4.20

2 files

0.4.19

2 files

0.4.17

2 files

0.4.16

2 files

0.4.15

2 files

0.4.14

2 files

0.4.13

2 files

0.4.12

2 files

0.4.11

2 files

0.4.10

2 files

0.4.9

2 files

0.4.8

2 files

0.4.7

2 files

0.4.6

2 files

0.4.5

2 files

0.4.4

2 files

0.4.3

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.2.3.3

2 files

0.2.3.2

2 files

0.2.3.1

2 files

0.2.2.16

2 files

0.2.2.15

2 files

0.2.2.14

2 files

0.2.2.13

2 files

0.2.2.12

2 files

0.2.2.11

2 files

0.2.2.10

2 files

0.2.2.9

2 files

0.2.2.8

2 files

0.2.2.7

2 files

0.2.2.6

2 files

0.2.2.5

2 files

0.2.2.4

2 files

0.2.2.3

2 files

0.2.2.2

2 files

0.2.1.7

2 files

0.2.1.6

2 files

0.2.1.5

2 files

0.2.1.4

2 files

0.2.1.3

2 files

0.2.1.2

2 files

0.2.1.1

2 files

0.2.1.0

2 files

0.2.0.6

2 files

0.2.0.5

2 files

0.2.0.3

2 files

0.1.3.5

2 files

0.1.3.4

2 files

0.1.3.3

2 files

0.1.3.0

2 files

0.1.2.2

2 files

0.1.2.1

2 files

0.1.2.0

2 files

0.1.1.8

2 files

0.1.1.7

2 files

0.1.1.6

2 files

0.1.1.5

2 files

0.1.1.4

2 files

0.1.1.3

2 files

0.1.1.1

2 files

0.1.1

2 files

0.1.0

2 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