Last updated: 2026-06-07
Clean-CTX is designed for air-gapped environments with restrictive firewall and DLP (Data Loss Prevention) requirements. The binary has zero network dependencies and zero runtime dependencies, making it suitable for deployment in classified, regulated, or sandboxed environments.
| Requirement | Status | Detail |
|---|---|---|
| Zero network transport | ✅ | stdio-only via MCP — no HTTP, WebSocket, or TCP |
| No egress callouts | ✅ | Binary makes no network connections whatsoever |
| No DNS lookups | ✅ | No hostname resolution required |
| No listening ports | ✅ | No server sockets created |
| Requirement | Status | Detail |
|---|---|---|
| Statically linked binary | ✅ | Single binary — no system library dependencies |
| No runtime downloads | ✅ | BPE data embedded via include_bytes! at compile time |
| Dependency audit | ✅ | cargo audit clean — zero known vulnerabilities |
| License compliance | ✅ | deny.toml allows MIT/Apache-2.0 only; cargo deny check clean |
| Requirement | Status | Detail |
|---|---|---|
| Unsafe code | ✅ ZERO | #![forbid(unsafe_code)] would pass |
| Clippy warnings | ✅ 0 | cargo clippy --all-targets -- -D warnings passes |
| Test coverage | ✅ 1,035 tests | All tests pass; fuzz-style edge cases covered |
| Requirement | Status | Detail |
|---|---|---|
| Data at rest | ✅ No on-disk state | Cache is in-memory only — no files written outside stdin/stdout |
| Data in transit | ✅ N/A | Data never leaves the process boundary |
| Memory safety | ✅ Safe Rust | All memory operations are bounds-checked at compile time |
| Requirement | Status | Detail |
|---|---|---|
| No code mutation | ✅ Purely additive | Meta-Layer never modifies TS compaction output; only appends Φ blocks |
| Zero overhead for non-Angular | ✅ Byte-identical | Non-Angular files produce identical output to builds without Meta-Layer |
| No file system access | ✅ In-memory only | Graph, bundler, and footer state are ephemeral; discarded after workspace emit |
| No external data leakage | ✅ No network | Graph resolution stays in-process; no external lookups |
| tree-sitter-html sandboxed | ✅ Parse-only | Template parser receives raw HTML and returns structural shape; no eval, no code execution |
| Detection heuristic safe | ✅ String scanning | Angular detection uses source.contains() — no regex, no complex parsing |
The binary is a single statically-linked executable. To verify integrity:
# SHA-256 checksum after build
sha256sum target/release/clean-ctx.exeThe Rust toolchain is pinned in rust-toolchain.toml (or via rustup default 1.85). Given the same toolchain and dependencies:
cargo build --release --lockedThe --locked flag prevents dependency resolution drift by using the exact versions in Cargo.lock.
# Copy the single binary to the target machine
scp target/release/clean-ctx user@target:~/bin/
# Verify it starts
echo '{}' | ~/bin/clean-ctx
# Output: (no response — ctrl-c to exit)FROM rust:1.85-slim AS builder
WORKDIR /build
COPY . .
RUN cargo build --release
FROM scratch
COPY --from=builder /build/target/release/clean-ctx /clean-ctx
ENTRYPOINT ["/clean-ctx"]The binary works on --read-only filesystems because BPE data is embedded at compile time (F-22).
services:
clean-ctx:
build: .
image: clean-ctx:latest
read_only: true
stdin_open: true
tty: true-
Run with minimal OS privileges — the binary needs only:
- Read access to the source code directory
- Write access to stdout (already granted by the parent process)
- No file system writes for its own operation
-
Pin the binary version — use
cargo build --release --lockedwith the committedCargo.lockto ensure deterministic builds -
Run
cargo auditregularly — as part of CI, or manually:cargo install cargo-audit --locked cargo audit
-
Run
cargo deny checkregularly — to enforce license policies and ban unsafe dependencies:cargo install cargo-deny --locked cargo deny check
-
Verify no new dependencies — compare
Cargo.lockagainst the last approved baseline before each release
-
Download all crate dependencies to an air-gapped mirror or vendored directory:
mkdir -p vendor cargo vendor --locked vendor/
-
Build with offline mode:
cargo build --release --locked --offline
-
The resulting binary is fully self-contained and requires no network access.
This project has no external vulnerability reporting process yet. For security issues:
-
Open an issue on the GitHub repository with:
- Component and version affected
- Type of vulnerability
- Steps to reproduce
- Proof-of-concept (if available)
-
For critical vulnerabilities, contact the maintainers directly through GitHub.
| Decision | Rationale |
|---|---|
No unsafe blocks |
Eliminates memory-safety vulnerabilities by construction |
tokio not used |
Avoids async runtime complexity; stdio transport does not benefit from async I/O |
| No file-write operations | Prevents unintentional data leakage through temporary files |
| No logging to disk | Prevents sensitive source code from appearing in log files (errors go to stderr only) |
| Config is cached at startup | Prevents TOCTOU (time-of-check-time-of-use) attacks on .clean-ctx.json |
| BPE data embedded in binary | Prevents man-in-the-middle attacks on BPE model data at startup |
| Meta-Layer is purely additive | Non-Angular files produce byte-identical output; no risk of silent data corruption |
| AngularGraph is in-memory only | Cross-file dependency graph is discarded after each workspace call; no persistence, no disk writes |
| No regex in Meta-Layer | Detection and template extraction use string scanning and word-boundary heuristics; avoids ReDoS-class vulnerabilities |
| tree-sitter-html parse-only | Template parser receives HTML and returns structural metadata; no code execution, no network calls |
| Fidelity controls Meta-Layer depth | Low fidelity emits minimal markers; reduces attack surface by limiting the amount of framework metadata exposed |
Generated via cargo install cargo-bom or cargo sbom:
# Generate SPDX SBOM
cargo install cargo-bom
cargo bom --output-path docs/sbom.spdx.json| Crate | Version | License | Purpose |
|---|---|---|---|
tree-sitter |
0.20.10 | MIT | AST parsing framework |
tree-sitter-typescript |
0.20.5 | MIT | TypeScript grammar |
tree-sitter-c-sharp |
0.20.0 | MIT | C# grammar |
tree-sitter-html |
0.20.0 | MIT | HTML grammar (Angular template parsing) |
tiktoken-rs |
0.11 | MIT | cl100k BPE token counting |
serde |
1.0 | MIT/Apache-2.0 | JSON serialization |
serde_json |
1.0 | MIT/Apache-2.0 | JSON parsing |
sha2 |
0.10 | MIT | SHA-256 content hashing |
clap |
4.6.1 | MIT/Apache-2.0 | CLI argument parsing |
All dependencies are MIT or Apache-2.0 licensed. Zero GPL or AGPL dependencies.
The tree-sitter-html crate (added in Phase 2) is the only dependency introduced by the Meta-Layer. It is:
- Parse-only — receives HTML content and returns a syntax tree; no file I/O, no network calls
- Memory-safe — written in safe Rust with the same tree-sitter runtime used by the TypeScript and C# grammars
- Pinned version —
=0.20.0inCargo.tomlprevents automatic upgrades that could introduce behavioral changes - Audit-friendly —
cargo auditcovers it alongside all other dependencies
CC0-1.0 Universal — Dedicated to the public domain.