Skip to main content

plan-shard

Split monolithic AI-generated plans into executable shards.

Claude Code's Plan Mode (and similar agent planners) produce one giant markdown plan. Change a single bullet and the whole document gets rewritten. plan-shard cuts the monolith into numbered PLAN_001.md / PLAN_002.md / … shards, each carrying its dependency order and resume index in frontmatter — so feedback can be applied to one shard at a time without regenerating everything.

Zero dependencies. Python 3.9+. Stdlib only.

Install

pip install plan-shard

Usage

1. Shard a plan

plan-shard shard plan.md -o shards/

Produces:

shards/
  PLAN_001.md   # preamble / overview
  PLAN_002.md
  PLAN_003.md
  ...
  PLAN_INDEX.md # table of all shards

Each shard starts with frontmatter:

---
shard: 3
total: 6
title: "Step 1: Add the Redis client"
source: plan.md
depends_on: [2, 4]
resume_index: 3
status: pending
revisions: []
---

2. Apply feedback to one shard

plan-shard feedback shards/PLAN_003.md \
  --old "app/cache.py" \
  --new "app/caching.py" \
  --note "rename module"

Only that file is modified; every other shard stays byte-identical. The change is logged in the shard's revisions list. If the pattern isn't found, nothing is written and the command fails loudly.

3. Track progress

plan-shard list shards/     # table of shards, deps, status
plan-shard done shards/PLAN_003.md   # mark done ( --undo to revert )
plan-shard resume shards/   # print the next pending shard

Options

  • shard --level 3 — split on ### headings instead of ## (default: 2)
  • feedback --all — replace all occurrences (default: first only, with a warning)

How splitting works

  • Every heading at the chosen level starts a new shard.
  • Text before the first heading becomes shard 1 (titled from the # H1, or "Overview"); if there is no preamble, the first heading is shard 1.
  • depends_on is sequential (each shard depends on the previous one) plus any PLAN_XXX references found in the shard's own body.
  • PLAN_INDEX.md lists every shard with its title, dependencies, and status.

Honest limitations

  • Splitting is heuristic. It keys off markdown heading levels. Plans that don't use headings (or use them inconsistently) will slice badly — a heading-free plan becomes a single shard, and deeply nested plans may need --level 3 or manual adjustment.
  • --feedback is text-level, not semantic. It does exact string replacement inside one shard. It won't reword surrounding prose, update cross-shard references, or understand what your change means. If a rename ripples across shards, apply feedback to each affected shard yourself.
  • Dependency detection is shallow. depends_on combines sequential order with literal PLAN_XXX mentions. It doesn't parse "after step 2" prose or build a real dependency graph.
  • No concurrency safety. Shard files are plain markdown; two processes editing the same shard can clobber each other (writes are atomic per file, but there's no locking).
  • Frontmatter is a small YAML subset, not full YAML. Hand-editing exotic YAML inside the frontmatter block may not round-trip.

Development

python -m pytest tests/ -q   # 24 tests

License

MIT

Metadata

Release files for plan-shard 0.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 plan-shard 0.1.0
File Size Uploaded Provenance Actions
plan_shard-0.1.0.tar.gz 11.1 kB Without provenance Details for plan_shard-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plan-shard 0.1.0
File Interpreter ABI Platform Actions
plan_shard-0.1.0-py3-none-any.whl Python 3 none any Details for plan_shard-0.1.0-py3-none-any.whl

Total release size: 20.4 kB

Release files / plan_shard-0.1.0.tar.gz

Download URL plan_shard-0.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
14a4486f8d9e682d10930f64c762552bd5d8cd89782e473dde202260c3de53c0
BLAKE2b-256 checksum
How to use checksums
58032c64092a1492e64d3ae431085b58f3e8e977af59869bfd83499a9e63e720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / plan_shard-0.1.0-py3-none-any.whl

Download URL plan_shard-0.1.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5529373a893861b38ff702176db117b4c328f0a7974bcd2643e53c983d1ed8eb
BLAKE2b-256 checksum
How to use checksums
6864125d1c20ed9c8097f705eeaa039546dbedc95cae5efda9c900e86f8ecd90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for plan-shard 0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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