Recursive task decomposition for Claude Code - domain-aware splitting and reunification
Project description
Cleave
Recursive task decomposition for Claude Code. Split complex directives along domain boundaries, execute in parallel, reunify with conflict detection.
Etymology
"Cleave" holds contradictory meanings: to split apart AND to hold fast together. This duality captures the tool's essence—we cleave tasks into independent pieces, then cleave the results back into a unified whole.
Installation
Both the CLI tool and Claude Code skill are required for full functionality.
# 1. Clone the repo
git clone git@github.com:styrene-lab/cleave.git ~/projects/cleave
# 2. Install the CLI (editable mode for easy updates)
pip install -e ~/projects/cleave
# 3. Symlink the skill definition to Claude Code's discovery path
ln -sf ~/projects/cleave/src/cleave/skill ~/.claude/skills/cleave
# 4. Verify
cleave --help
To update later:
cd ~/projects/cleave && git pull
# CLI updates automatically (editable install)
# Skill symlink remains valid
Usage
Within Claude Code
Invoke via /cleave in any Claude Code session:
/cleave
Implement user authentication with JWT tokens, ensuring backwards
compatibility with existing session-based auth. Include migration
path and tests.
Claude will:
- Assess complexity
- Split into 2-3 child tasks if needed
- Execute children (parallel or sequential)
- Reunify results with conflict detection
CLI Commands
# Assess complexity of a directive
cleave assess --directive "Add user auth with JWT"
# Match against known patterns
cleave match --directive "Add Stripe payments"
# Initialize workspace for manual execution
cleave init --directive "Add auth" --children '["Backend", "Frontend"]'
# Detect conflicts between task results
cleave conflicts --results ".cleave/0-task.md,.cleave/1-task.md"
# Reunify completed tasks
cleave reunify --workspace .cleave
Concepts
Complexity Assessment
Formula: complexity = (1 + systems) × (1 + 0.5 × modifiers)
- Systems: Distinct architectural boundaries (UI, API, DB, external services)
- Modifiers: State coordination, error handling, concurrency, security, etc.
If complexity > threshold, the directive gets cleaved.
Splitting Strategy
- Binary (2): Clean frontend/backend or data/logic seams
- Ternary (3): Multi-layer stacks (UI/API/DB)
- Never 4+: Coordination overhead exceeds benefits
Workspace Structure
.cleave/
├── manifest.yaml # Intent, ancestry, children, assessment
├── siblings.yaml # Sibling coordination, file claims
├── 0-task.md # Child 0 task file
├── 1-task.md # Child 1 task file
├── metrics.yaml # Telemetry
├── merge.md # Reunification report
└── review.md # Adversarial review
Conflict Detection
Four conflict types detected during reunification:
- File Overlap - Multiple children modified same file
- Decision Contradiction - Incompatible choices (Redis vs Memcached)
- Interface Mismatch - Different signatures for same function
- Assumption Violation - Child assumption contradicts sibling decision
Configuration
Modes
- Lean (default): Terse output, fast-path assessment
- Robust: Verbose reasoning, sequential thinking for all assessments
Flags
--no-tdd: Skip TDD workflow instructions in task files--no-review: Skip adversarial review during reunification--infer-permissions: Detect required bash permissions upfront
Requirements
- Python 3.11+
- Claude Code CLI (for skill usage)
- Sequential Thinking MCP server (recommended for complex assessments)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file styrene_cleave-0.2.0.tar.gz.
File metadata
- Download URL: styrene_cleave-0.2.0.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dad572846cef7f36afcfa07fdfd0fe719a4cc1d2fb7709ffe949de457bb5cc31
|
|
| MD5 |
1bc9ddcb54c7ff22f8a3a989999aec8a
|
|
| BLAKE2b-256 |
1457d6319b1ad9ec7cbc85652694facd83928ea0fefc2365ca75ffa8e64d83fb
|
File details
Details for the file styrene_cleave-0.2.0-py3-none-any.whl.
File metadata
- Download URL: styrene_cleave-0.2.0-py3-none-any.whl
- Upload date:
- Size: 40.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77252b8a93d8e97a4de26a4ad2ca69da3ff465e3161fb9dc17afd29be4047867
|
|
| MD5 |
9eefeba39844bae80909831596c88c0c
|
|
| BLAKE2b-256 |
ab3396b3293b5f2a64dc5d24359fac797d255ac7b0e8a7a41405c7f3eae6b7f2
|