Thank you for your interest in contributing! Clean-CTX is an open-source project, and we welcome contributions that improve the codebase, fix bugs, add features, or improve documentation.
- Developer Documentation — build, test, extend
- Architecture Overview — system design and module structure
- Compiler IR Specification — IR protocol, delta transport, wire format
- Angular Meta-Layer — framework annotation layer design
- Performance Guide — benchmarks and optimization
- Security Guide — compliance and hardening
- Troubleshooting Guide — common issues
- Configuration Guide — config precedence, env vars, resource limits
- Changelog — version history
- Roadmap — future plans and priorities
# Clone the repository
git clone https://github.com/codeliftsleep2/Clean-CTX.git
cd Clean-CTX
# Build
cargo build
# Run tests
cargo test
# Run linter (must pass before PR)
cargo clippy --all-targets -- -D warningsPrerequisites: Rust 1.85+ (edition 2024). No external runtimes or dependencies.
Every pull request must pass these checks. The full checklist is in PULL_REQUEST_TEMPLATE.md — GitHub will auto-load it when you open a new PR.
cargo check— compiles without errorscargo clippy --all-targets -- -D warnings— zero warnings (treated as errors)cargo test— all 1,360+ tests passcargo audit— no known security vulnerabilitiesscripts/check-tree-sitter-versions.ps1— all tree-sitter crates share the sametree-sitter-languageABI version- No new
.unwrap()calls without a// SAFETY:comment explaining why it cannot fail - No
let _ = ...dead-code suppression — remove the unused variable instead - No
#![allow(...)]annotations without a// SAFETY:or// Phase N:comment
cargo check && cargo clippy --all-targets -- -D warnings && cargo test && cargo audit --ignore RUSTSEC-2025-0009 && pwsh -ExecutionPolicy Bypass ./scripts/check-tree-sitter-versions.ps1- Check the Troubleshooting Guide to see if your issue is already addressed
- Search existing issues to avoid duplicates
- Include:
- Binary version (build date or commit hash)
- Operating system and Rust version (
rustc --version) - Full error output
- Steps to reproduce
- Input data (redacted if necessary)
Open an issue with:
- A clear description of the proposed change
- Why it improves the project
- If applicable, a sketch of the implementation approach
See the step-by-step guide in Developer Documentation → Adding a New Language.
Summary:
- Add the tree-sitter grammar to
Cargo.toml - Add tree-sitter queries to
src/queries.rs - Register in
src/compression/language.rs - Update documentation
- Add tests
See the step-by-step guide in Developer Documentation → Adding a New Tool.
Summary:
- Add handler function in
src/mcp/tools.rs - Register in
get_tool_definitions() - Wire up dispatch in
dispatch_tools_call() - Add tests in
src/tests/mcp/tools.rs
src/
├── main.rs # Entry point (3 lines)
├── lib.rs # Module declarations
│
├── mcp/ # MCP server layer (JSON-RPC stdio)
├── compression/ # Core compression engine
├── diff/ # AST-level structural diff
├── compaction/ # AST node compaction
├── decompression/ # Opcode → readable expansion
├── dictionary/ # Symbol and path registries
├── cache.rs # Content hash + baseline cache
├── config.rs # .clean-ctx.json configuration
├── queries.rs # Tree-sitter query patterns
├── analytics.rs # Token counting (cl100k BPE)
└── protocol.rs # JSON-RPC types
- Single Responsibility Principle — each module owns exactly one concern
- No unsafe code — the entire codebase is safe Rust (
#![forbid(unsafe_code)]would pass) - No network dependencies — stdio-only MCP transport
- HashMap over BTreeMap — no caller iterates in sorted order
- Explicit errors, not panics — all error paths return
Result, never.unwrap() - Cached at startup — config and BPE data are loaded once and reused
Tests live in src/tests/ and are referenced from their respective source modules via #[path]:
#[cfg(test)]
#[path = "../tests/compression/fidelity.rs"]
mod tests;See Developer Documentation → Testing Conventions for naming, coverage expectations, and running tests.
| Document | Audience | Content |
|---|---|---|
README.md |
Users | Installation, configuration, usage |
CONTRIBUTING.md |
Contributors | This file — overview and process |
docs/DEVELOPER_DOCUMENTATION.md |
Contributors | Detailed build/test/extend guide |
docs/ARCHITECTURE_OVERVIEW.md |
Architects | System design, module structure |
docs/COMPILER_IR.md |
Architects | Compiler IR protocol, delta state transport, wire format |
docs/ANGULAR_META_LAYER.md |
Developers | Angular Meta-Layer design, marker vocabulary, graph |
docs/EDIT_TYPE.md |
Developers | Edit categorization for delta transport |
docs/PERFORMANCE.md |
Architects | Benchmarks, caching, optimization |
docs/SECURITY.md |
Enterprise admins | Compliance, hardening, deployment |
docs/TROUBLESHOOTING.md |
Users | Common issues and resolutions |
docs/CHANGELOG.md |
All | Version history |
docs/INTELLIGENCE_LAYER_PLAN.md |
Architects | Intelligence Layer: PageRank scoring, blast radius, token budget packing |
docs/ROADMAP.md |
Contributors | Future plans and priorities |
CC0-1.0 Universal — Dedicated to the public domain.