Thank you for your interest in contributing. This document explains how to get involved.
Be respectful. Harassment, discrimination, or abusive behaviour in any project space will not be tolerated.
Open an issue on GitHub describing:
- What you expected to happen
- What actually happened
- The full command you ran and its output
- Your Python version (
python3 --version) and operating system
git clone https://github.com/instructkr/claw-code.git
cd claw-code
python3 -m unittest discover -s tests -v # all 20 tests should passNo virtual environment or extra dependencies are needed.
| Branch prefix | Purpose |
|---|---|
feat/<short-description> |
New feature or subsystem port |
fix/<short-description> |
Bug fix |
docs/<short-description> |
Documentation only |
refactor/<short-description> |
Internal restructuring, no behaviour change |
dev/rust |
Rust port (maintained separately) |
Target PRs at main.
- Fork the repository and create a branch from
main. - Make your changes.
- Run the full test suite — all tests must pass:
python3 -m unittest discover -s tests -v
- Open a PR with a clear title and a description of what changed and why.
from __future__ import annotationsat the top of every module.- Type hints on all function signatures and dataclass fields.
- Frozen dataclasses for all value objects (
@dataclass(frozen=True)). functools.lru_cachefor functions that load JSON snapshots (avoid re-reading files on every call).- No external dependencies. The project uses only the Python standard library. Do not add
pipdependencies. - Keep modules focused. If a new concept needs its own module, add a new file rather than growing an existing one.
Each of the 30 subsystem packages in src/ follows the same pattern. To add a new one:
- Create
src/<name>/__init__.pythat loads fromsrc/reference_data/subsystems/<name>.json. - Add a corresponding JSON file in
src/reference_data/subsystems/with keys:archive_name,module_count,sample_files,porting_note. - Add a test in
tests/test_porting_workspace.pyassertingMODULE_COUNT > 0.
The command and tool inventories are driven by:
src/reference_data/commands_snapshot.jsonsrc/reference_data/tools_snapshot.json
Each entry has the shape:
{
"name": "ExampleCommand",
"source_hint": "src/commands/example.ts",
"responsibility": "One-sentence description of what this command does."
}After editing a snapshot, run the full test suite to verify the minimum entry counts still pass (≥150 commands, ≥100 tools).
Every PR must keep all existing tests passing. New behaviour should be covered by new tests. The testing patterns used in tests/test_porting_workspace.py are:
- Unit: import and call Python API directly.
- CLI integration: use
subprocess.run([sys.executable, '-m', 'src.main', ...])and assert on stdout.
<type>: <short summary in present tense>
[Optional longer description]
Types: feat, fix, docs, refactor, test, chore.
Example:
feat: add transcript compaction to QueryEnginePort
This project is a clean-room rewrite. Contributions must not:
- Copy or closely paraphrase any portion of the original Claude Code TypeScript source.
- Include any Anthropic proprietary material.
By submitting a PR you confirm that your contribution is your original work and is free of third-party proprietary content.