Skip to main content

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.

Install in isolated environment with automatic skill installation:

# Install from PyPI
pipx install styrene-cleave

# Install the skill (creates symlink or copy as needed)
cleave install-skill

# Verify
cleave --help

Updates:

pipx upgrade styrene-cleave
cleave install-skill  # Auto-detects and updates stale installations

Option 2: pip

# Install from PyPI
pip install styrene-cleave

# Install the skill
cleave install-skill

# Verify
cleave --help

Option 3: Development (Editable)

# Clone the repo
git clone git@github.com:styrene-lab/cleave.git ~/projects/cleave

# Install in editable mode
pip install -e ~/projects/cleave

# Install the skill
cleave install-skill

# Verify
cleave --help

Updates:

cd ~/projects/cleave && git pull
cleave install-skill  # Updates if version changed

Windows Users

On Windows 11, cleave install-skill will:

  • Try to create a symlink (requires Developer Mode or admin privileges)
  • Automatically fall back to directory copy if symlink fails
  • Track version and auto-update on upgrades

To enable symlinks (optional, for better performance):

  1. Open Settings → System → For developers
  2. Enable "Developer Mode"
  3. Run cleave install-skill again

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:

  1. Assess complexity
  2. Split into 2-3 child tasks if needed
  3. Execute children (parallel or sequential)
  4. 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

Workspaces are auto-generated with unique names based on the directive to prevent collisions:

  • cleave init -d "Add JWT auth" -c '["A", "B"]' → .cleave-add-jwt-auth/
  • cleave init -d "Optimize queries" -c '["X", "Y"]' → .cleave-optimize-queries/

If a workspace already exists, a numeric suffix is added (.cleave-add-jwt-auth-2/). To override, use --output explicitly: cleave init -d "..." -c '[...]' -o .cleave-custom/

All .cleave* directories are gitignored; they are ephemeral artifacts consumed by cleave reunify and should be removed once the workspace is closed.

Conflict Detection

Four conflict types detected during reunification:

  1. File Overlap - Multiple children modified same file
  2. Decision Contradiction - Incompatible choices (Redis vs Memcached)
  3. Interface Mismatch - Different signatures for same function
  4. 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

Development

Running Tests

The test suite includes unit tests and integration tests.

# Install development dependencies
pip install -e ".[dev]"

# Run all tests
pytest

# Run with coverage
pytest --cov=cleave --cov-report=html

# Run specific test files
pytest tests/test_assessment.py
pytest tests/test_probe_integration.py

# Run only unit tests (fast)
pytest tests/ -k "not integration"

# Run only integration tests
pytest tests/test_probe_integration.py

# Run with verbose output
pytest -v

Integration Test Coverage

Probe Integration Tests (tests/test_probe_integration.py):

  • Real project probing (uses cleave codebase as test subject)
  • Stack detection for Python, TypeScript, JavaScript, Go, Rust
  • Infrastructure detection (Docker, Kubernetes, Terraform)
  • Relevant file discovery based on directive keywords
  • Context-aware question generation
  • Pattern matching integration
  • Edge cases and error handling

Test Requirements

Integration tests require:

  • pytest>=8.0

Install all test dependencies:

pip install -e ".[dev]"

Requirements

  • Python 3.11+
  • Claude Code CLI (for skill usage)
  • Sequential Thinking MCP server (recommended for complex assessments)

License

MIT

Metadata

Release files for styrene-cleave 0.9.7

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

Source distribution (sdist)

Source distribution for styrene-cleave 0.9.7
File Size Uploaded Provenance Actions
styrene_cleave-0.9.7.tar.gz 261.3 kB With provenance Details for styrene_cleave-0.9.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for styrene-cleave 0.9.7
File Interpreter ABI Platform Actions
styrene_cleave-0.9.7-py3-none-any.whl Python 3 none any Details for styrene_cleave-0.9.7-py3-none-any.whl

Total release size: 400.3 kB

Release files / styrene_cleave-0.9.7.tar.gz

Download URL styrene_cleave-0.9.7.tar.gz
Size 261.3 kB
Tags Source
SHA-256 checksum
How to use checksums
66c41e2b4ddddeeb76355dea9772c0d2ec41bc01f0aa23d115b745aee0ca0b26
BLAKE2b-256 checksum
How to use checksums
bdb69245954d1c1a81e91d7367c6246f4dec1c5975c6a5e8dd15cdee7a13efb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 26, 2026.

Transparency log

Release files / styrene_cleave-0.9.7-py3-none-any.whl

Download URL styrene_cleave-0.9.7-py3-none-any.whl
Size 139.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
890f3eec90ee90ed20227f8ed0279ead427f6f0a48824514ba9a1b7654ff4179
BLAKE2b-256 checksum
How to use checksums
3560d57cd028ae551de4626e04f9a4f9b5ce3568a37de3cf841dea09468ca615
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Feb 26, 2026.

Transparency log

Security for styrene-cleave 0.9.7

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 styrene_cleave-0.9.7.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 Feb 26, 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