styrene-cleave 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ .venv/
25
+ venv/
26
+ ENV/
27
+
28
+ # IDE
29
+ .idea/
30
+ .vscode/
31
+ *.swp
32
+ *.swo
33
+ *~
34
+
35
+ # Testing
36
+ .pytest_cache/
37
+ .coverage
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+
42
+ # Type checking
43
+ .mypy_cache/
44
+
45
+ # Cleave workspaces (generated during execution)
46
+ .cleave/
47
+
48
+ # OS
49
+ .DS_Store
50
+ Thumbs.db
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 styrene-lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,159 @@
1
+ Metadata-Version: 2.4
2
+ Name: styrene-cleave
3
+ Version: 0.1.0
4
+ Summary: Recursive task decomposition for Claude Code - domain-aware splitting and reunification
5
+ Project-URL: Repository, https://github.com/styrene-lab/cleave
6
+ Author: styrene-lab
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: agent,claude,cleave,cli,task-decomposition
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
17
+ Requires-Python: >=3.11
18
+ Requires-Dist: pyyaml>=6.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: mypy>=1.8; extra == 'dev'
21
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
22
+ Requires-Dist: pytest>=8.0; extra == 'dev'
23
+ Requires-Dist: ruff>=0.1; extra == 'dev'
24
+ Requires-Dist: types-pyyaml; extra == 'dev'
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Cleave
28
+
29
+ Recursive task decomposition for Claude Code. Split complex directives along domain boundaries, execute in parallel, reunify with conflict detection.
30
+
31
+ ## Etymology
32
+
33
+ "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.
34
+
35
+ ## Installation
36
+
37
+ Both the CLI tool and Claude Code skill are required for full functionality.
38
+
39
+ ```bash
40
+ # 1. Clone the repo
41
+ git clone git@github.com:styrene-lab/cleave.git ~/projects/cleave
42
+
43
+ # 2. Install the CLI (editable mode for easy updates)
44
+ pip install -e ~/projects/cleave
45
+
46
+ # 3. Symlink the skill definition to Claude Code's discovery path
47
+ ln -sf ~/projects/cleave/src/cleave/skill ~/.claude/skills/cleave
48
+
49
+ # 4. Verify
50
+ cleave --help
51
+ ```
52
+
53
+ To update later:
54
+ ```bash
55
+ cd ~/projects/cleave && git pull
56
+ # CLI updates automatically (editable install)
57
+ # Skill symlink remains valid
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ### Within Claude Code
63
+
64
+ Invoke via `/cleave` in any Claude Code session:
65
+
66
+ ```
67
+ /cleave
68
+
69
+ Implement user authentication with JWT tokens, ensuring backwards
70
+ compatibility with existing session-based auth. Include migration
71
+ path and tests.
72
+ ```
73
+
74
+ Claude will:
75
+ 1. Assess complexity
76
+ 2. Split into 2-3 child tasks if needed
77
+ 3. Execute children (parallel or sequential)
78
+ 4. Reunify results with conflict detection
79
+
80
+ ### CLI Commands
81
+
82
+ ```bash
83
+ # Assess complexity of a directive
84
+ cleave assess --directive "Add user auth with JWT"
85
+
86
+ # Match against known patterns
87
+ cleave match --directive "Add Stripe payments"
88
+
89
+ # Initialize workspace for manual execution
90
+ cleave init --directive "Add auth" --children '["Backend", "Frontend"]'
91
+
92
+ # Detect conflicts between task results
93
+ cleave conflicts --results ".cleave/0-task.md,.cleave/1-task.md"
94
+
95
+ # Reunify completed tasks
96
+ cleave reunify --workspace .cleave
97
+ ```
98
+
99
+ ## Concepts
100
+
101
+ ### Complexity Assessment
102
+
103
+ **Formula**: `complexity = (1 + systems) × (1 + 0.5 × modifiers)`
104
+
105
+ - **Systems**: Distinct architectural boundaries (UI, API, DB, external services)
106
+ - **Modifiers**: State coordination, error handling, concurrency, security, etc.
107
+
108
+ If `complexity > threshold`, the directive gets cleaved.
109
+
110
+ ### Splitting Strategy
111
+
112
+ - **Binary (2)**: Clean frontend/backend or data/logic seams
113
+ - **Ternary (3)**: Multi-layer stacks (UI/API/DB)
114
+ - **Never 4+**: Coordination overhead exceeds benefits
115
+
116
+ ### Workspace Structure
117
+
118
+ ```
119
+ .cleave/
120
+ ├── manifest.yaml # Intent, ancestry, children, assessment
121
+ ├── siblings.yaml # Sibling coordination, file claims
122
+ ├── 0-task.md # Child 0 task file
123
+ ├── 1-task.md # Child 1 task file
124
+ ├── metrics.yaml # Telemetry
125
+ ├── merge.md # Reunification report
126
+ └── review.md # Adversarial review
127
+ ```
128
+
129
+ ### Conflict Detection
130
+
131
+ Four conflict types detected during reunification:
132
+
133
+ 1. **File Overlap** - Multiple children modified same file
134
+ 2. **Decision Contradiction** - Incompatible choices (Redis vs Memcached)
135
+ 3. **Interface Mismatch** - Different signatures for same function
136
+ 4. **Assumption Violation** - Child assumption contradicts sibling decision
137
+
138
+ ## Configuration
139
+
140
+ ### Modes
141
+
142
+ - **Lean** (default): Terse output, fast-path assessment
143
+ - **Robust**: Verbose reasoning, sequential thinking for all assessments
144
+
145
+ ### Flags
146
+
147
+ - `--no-tdd`: Skip TDD workflow instructions in task files
148
+ - `--no-review`: Skip adversarial review during reunification
149
+ - `--infer-permissions`: Detect required bash permissions upfront
150
+
151
+ ## Requirements
152
+
153
+ - Python 3.11+
154
+ - Claude Code CLI (for skill usage)
155
+ - Sequential Thinking MCP server (recommended for complex assessments)
156
+
157
+ ## License
158
+
159
+ MIT
@@ -0,0 +1,133 @@
1
+ # Cleave
2
+
3
+ Recursive task decomposition for Claude Code. Split complex directives along domain boundaries, execute in parallel, reunify with conflict detection.
4
+
5
+ ## Etymology
6
+
7
+ "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.
8
+
9
+ ## Installation
10
+
11
+ Both the CLI tool and Claude Code skill are required for full functionality.
12
+
13
+ ```bash
14
+ # 1. Clone the repo
15
+ git clone git@github.com:styrene-lab/cleave.git ~/projects/cleave
16
+
17
+ # 2. Install the CLI (editable mode for easy updates)
18
+ pip install -e ~/projects/cleave
19
+
20
+ # 3. Symlink the skill definition to Claude Code's discovery path
21
+ ln -sf ~/projects/cleave/src/cleave/skill ~/.claude/skills/cleave
22
+
23
+ # 4. Verify
24
+ cleave --help
25
+ ```
26
+
27
+ To update later:
28
+ ```bash
29
+ cd ~/projects/cleave && git pull
30
+ # CLI updates automatically (editable install)
31
+ # Skill symlink remains valid
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ ### Within Claude Code
37
+
38
+ Invoke via `/cleave` in any Claude Code session:
39
+
40
+ ```
41
+ /cleave
42
+
43
+ Implement user authentication with JWT tokens, ensuring backwards
44
+ compatibility with existing session-based auth. Include migration
45
+ path and tests.
46
+ ```
47
+
48
+ Claude will:
49
+ 1. Assess complexity
50
+ 2. Split into 2-3 child tasks if needed
51
+ 3. Execute children (parallel or sequential)
52
+ 4. Reunify results with conflict detection
53
+
54
+ ### CLI Commands
55
+
56
+ ```bash
57
+ # Assess complexity of a directive
58
+ cleave assess --directive "Add user auth with JWT"
59
+
60
+ # Match against known patterns
61
+ cleave match --directive "Add Stripe payments"
62
+
63
+ # Initialize workspace for manual execution
64
+ cleave init --directive "Add auth" --children '["Backend", "Frontend"]'
65
+
66
+ # Detect conflicts between task results
67
+ cleave conflicts --results ".cleave/0-task.md,.cleave/1-task.md"
68
+
69
+ # Reunify completed tasks
70
+ cleave reunify --workspace .cleave
71
+ ```
72
+
73
+ ## Concepts
74
+
75
+ ### Complexity Assessment
76
+
77
+ **Formula**: `complexity = (1 + systems) × (1 + 0.5 × modifiers)`
78
+
79
+ - **Systems**: Distinct architectural boundaries (UI, API, DB, external services)
80
+ - **Modifiers**: State coordination, error handling, concurrency, security, etc.
81
+
82
+ If `complexity > threshold`, the directive gets cleaved.
83
+
84
+ ### Splitting Strategy
85
+
86
+ - **Binary (2)**: Clean frontend/backend or data/logic seams
87
+ - **Ternary (3)**: Multi-layer stacks (UI/API/DB)
88
+ - **Never 4+**: Coordination overhead exceeds benefits
89
+
90
+ ### Workspace Structure
91
+
92
+ ```
93
+ .cleave/
94
+ ├── manifest.yaml # Intent, ancestry, children, assessment
95
+ ├── siblings.yaml # Sibling coordination, file claims
96
+ ├── 0-task.md # Child 0 task file
97
+ ├── 1-task.md # Child 1 task file
98
+ ├── metrics.yaml # Telemetry
99
+ ├── merge.md # Reunification report
100
+ └── review.md # Adversarial review
101
+ ```
102
+
103
+ ### Conflict Detection
104
+
105
+ Four conflict types detected during reunification:
106
+
107
+ 1. **File Overlap** - Multiple children modified same file
108
+ 2. **Decision Contradiction** - Incompatible choices (Redis vs Memcached)
109
+ 3. **Interface Mismatch** - Different signatures for same function
110
+ 4. **Assumption Violation** - Child assumption contradicts sibling decision
111
+
112
+ ## Configuration
113
+
114
+ ### Modes
115
+
116
+ - **Lean** (default): Terse output, fast-path assessment
117
+ - **Robust**: Verbose reasoning, sequential thinking for all assessments
118
+
119
+ ### Flags
120
+
121
+ - `--no-tdd`: Skip TDD workflow instructions in task files
122
+ - `--no-review`: Skip adversarial review during reunification
123
+ - `--infer-permissions`: Detect required bash permissions upfront
124
+
125
+ ## Requirements
126
+
127
+ - Python 3.11+
128
+ - Claude Code CLI (for skill usage)
129
+ - Sequential Thinking MCP server (recommended for complex assessments)
130
+
131
+ ## License
132
+
133
+ MIT
@@ -0,0 +1,4 @@
1
+ Refactor the API layer to use async handlers throughout. Currently
2
+ mixing sync and async patterns causing connection pool exhaustion
3
+ under load. Maintain backwards compatibility with existing clients.
4
+ Add integration tests for the new async paths.
@@ -0,0 +1,4 @@
1
+ Implement JWT-based authentication alongside existing session auth.
2
+ Sessions should remain valid during 30-day migration window.
3
+ Add /auth/token endpoint for JWT issuance. Update middleware to
4
+ accept both auth methods. Include migration guide for API consumers.
@@ -0,0 +1,63 @@
1
+ [project]
2
+ name = "styrene-cleave"
3
+ version = "0.1.0"
4
+ description = "Recursive task decomposition for Claude Code - domain-aware splitting and reunification"
5
+ readme = "README.md"
6
+ requires-python = ">=3.11"
7
+ license = "MIT"
8
+ authors = [
9
+ { name = "styrene-lab" }
10
+ ]
11
+ keywords = ["claude", "agent", "task-decomposition", "cli", "cleave"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Environment :: Console",
15
+ "Intended Audience :: Developers",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
20
+ ]
21
+
22
+ dependencies = [
23
+ "pyyaml>=6.0",
24
+ ]
25
+
26
+ [project.optional-dependencies]
27
+ dev = [
28
+ "pytest>=8.0",
29
+ "pytest-cov>=4.0",
30
+ "ruff>=0.1",
31
+ "mypy>=1.8",
32
+ "types-PyYAML",
33
+ ]
34
+
35
+ [project.scripts]
36
+ cleave = "cleave.cli:main"
37
+
38
+ [project.urls]
39
+ Repository = "https://github.com/styrene-lab/cleave"
40
+
41
+ [build-system]
42
+ requires = ["hatchling"]
43
+ build-backend = "hatchling.build"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/cleave"]
47
+
48
+ [tool.ruff]
49
+ line-length = 100
50
+ target-version = "py311"
51
+
52
+ [tool.ruff.lint]
53
+ select = ["E", "F", "I", "UP", "B", "SIM", "RUF"]
54
+ ignore = ["E501"]
55
+
56
+ [tool.mypy]
57
+ python_version = "3.11"
58
+ strict = true
59
+ warn_return_any = true
60
+ warn_unused_ignores = true
61
+
62
+ [tool.pytest.ini_options]
63
+ testpaths = ["tests"]
@@ -0,0 +1,77 @@
1
+ """Cleave - Task decomposition library for complex directive management.
2
+
3
+ This library provides the core algorithms for the Cleave skill:
4
+ - Complexity assessment and pattern matching
5
+ - Workspace generation and task file management
6
+ - Conflict detection during reunification
7
+ - Permission inference for fire-and-forget execution
8
+
9
+ Usage:
10
+ from cleave import assess_directive, init_workspace, reunify_workspace
11
+ from cleave.core.assessment import match_pattern, calculate_complexity
12
+ from cleave.core.conflicts import detect_conflicts
13
+ """
14
+
15
+ from cleave.core.assessment import (
16
+ AssessmentResult,
17
+ PatternMatch,
18
+ assess_directive,
19
+ calculate_complexity,
20
+ detect_modifiers,
21
+ effective_complexity,
22
+ match_pattern,
23
+ )
24
+ from cleave.core.conflicts import Conflict, detect_conflicts
25
+ from cleave.core.permissions import (
26
+ check_missing_permissions,
27
+ format_settings_snippet,
28
+ infer_permissions,
29
+ load_current_permissions,
30
+ )
31
+ from cleave.core.reunify import (
32
+ aggregate_results,
33
+ generate_merge_md,
34
+ generate_review_md,
35
+ parse_task_result,
36
+ reunify_workspace,
37
+ )
38
+ from cleave.core.workspace import (
39
+ generate_manifest,
40
+ generate_siblings_yaml,
41
+ generate_task_file,
42
+ init_workspace,
43
+ reconstruct_context,
44
+ )
45
+
46
+ __version__ = "0.1.0"
47
+
48
+ __all__ = [
49
+ # Assessment
50
+ "AssessmentResult",
51
+ "PatternMatch",
52
+ "assess_directive",
53
+ "calculate_complexity",
54
+ "detect_modifiers",
55
+ "effective_complexity",
56
+ "match_pattern",
57
+ # Conflicts
58
+ "Conflict",
59
+ "detect_conflicts",
60
+ # Permissions
61
+ "check_missing_permissions",
62
+ "format_settings_snippet",
63
+ "infer_permissions",
64
+ "load_current_permissions",
65
+ # Reunify
66
+ "aggregate_results",
67
+ "generate_merge_md",
68
+ "generate_review_md",
69
+ "parse_task_result",
70
+ "reunify_workspace",
71
+ # Workspace
72
+ "generate_manifest",
73
+ "generate_siblings_yaml",
74
+ "generate_task_file",
75
+ "init_workspace",
76
+ "reconstruct_context",
77
+ ]