Skip to main content

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.

Option 1: pipx (Recommended)

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

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

Requirements

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

License

MIT

Project details


Download files

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

Source Distribution

styrene_cleave-0.5.0.tar.gz (179.2 kB view details)

Uploaded Source

Built Distribution

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

styrene_cleave-0.5.0-py3-none-any.whl (111.5 kB view details)

Uploaded Python 3

File details

Details for the file styrene_cleave-0.5.0.tar.gz.

File metadata

  • Download URL: styrene_cleave-0.5.0.tar.gz
  • Upload date:
  • Size: 179.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for styrene_cleave-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bdf48062a8439d37263c7ddc2129566b6b773eb23343cbb903f35c9561c7735d
MD5 ef10c93cf19f0b71ecddf1c5237bef5c
BLAKE2b-256 ba8975f2c9909801d2ac9c96d164167e4f1f89dc5dd80ab6f1c3ebe904bf4405

See more details on using hashes here.

File details

Details for the file styrene_cleave-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: styrene_cleave-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 111.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for styrene_cleave-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 938c86fafe5dddc030cc64cd2a4134d6a499ec36c8f8825b8c829b29f367e5bc
MD5 1483adcbdf15b29298347f8f6ef8bc8b
BLAKE2b-256 73c4491e456667d2ff4bf35b6572b5ffd7956534d575affa36f1bb6e3037c828

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page