Thanks for your interest in contributing! Claw Compactor is an open-source project and we welcome contributions of all kinds.
- Python 3.9+
- Git
# Fork the repository on GitHub, then:
git clone https://github.com/YOUR_USERNAME/claw-compactor.git
cd claw-compactor
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install in development mode with all extras
pip install -e ".[dev,accurate]"
# Verify everything works
pytest tests/ -x -q- Check open issues — look for
good first issueorhelp wantedlabels - Have an idea? Open an issue first to discuss before investing time
git checkout -b feat/your-feature-name
# or: fix/your-bug-fix, docs/your-doc-update- Follow existing code style and patterns
- Keep changes focused — one feature or fix per PR
- Add tests for new functionality
Run the full test suite:
pytest tests/ -x -qRun a specific test file:
pytest tests/test_pipeline.py -vRun tests matching a keyword:
pytest tests/ -k "compression" -v# Run the full test suite
pytest tests/ -x -q
# Run a specific test file
pytest tests/test_fusion_engine.py -v
# Run with coverage
pytest tests/ --cov=scripts --cov=claw_compactor --cov-report=term-missingAll PRs must pass CI on Python 3.9–3.12. The test suite has 1600+ tests — don't be alarmed, they run fast.
- Push your branch to your fork
- Open a Pull Request against
main - Fill in the PR template with a clear description
- Link any related issues
Claw Compactor is built around a 14-stage Fusion Pipeline. Each stage is a self-contained compressor inheriting from FusionStage. See ARCHITECTURE.md for the full design.
- Immutability —
FusionContextis frozen. Every stage produces a newFusionResult. Never mutate inputs. - Gate-before-compress — Each stage has
should_apply(). If a stage doesn't apply to the content type, it should be a no-op at zero cost. - Zero required dependencies — The core pipeline runs without any external packages. Optional dependencies (tiktoken, tree-sitter) are runtime-detected.
- Create a new file in
scripts/lib/fusion/stages/ - Inherit from
FusionStage - Implement
should_apply()andapply() - Register it in the stage registry
- Add tests covering happy path, edge cases, and the gate condition
from scripts.lib.fusion.base import FusionStage, FusionContext, FusionResult
class MyStage(FusionStage):
name = "my_stage"
order = 22 # controls execution order in the pipeline
def should_apply(self, ctx: FusionContext) -> bool:
return ctx.content_type == "log"
def apply(self, ctx: FusionContext) -> FusionResult:
compressed = my_logic(ctx.content)
return FusionResult(content=compressed, ...)- Type hints on all public functions
- Docstrings for non-obvious logic
- Functions under 50 lines, files under 800 lines
- No deep nesting (4 levels max)
Please include:
- Python version (
python --version) - OS (macOS, Linux, Windows)
- Steps to reproduce — minimal example preferred
- Expected vs actual behavior
- Traceback if applicable
- Discord — ask questions, discuss ideas
- GitHub Discussions — longer-form conversations
By contributing, you agree that your contributions will be licensed under the MIT License.