Graft-Prefer: Fully Covariant Computation
Principle: Multicomputational Irreducibility
Build systems are multicomputational systems where the dependency graph cannot be reduced to a simpler form without losing information. Graft enforces this by:
- Covariant caching: Content-addressed storage preserves build artifacts covariantly -- the same source always produces the same artifact regardless of evaluation path
- Irreducible parallelism: Distributed compilation exploits the inherent parallelism in the dependency DAG without collapsing independent computation branches
- Causal consistency: Build ordering respects the causal structure of the crate graph, ensuring deterministic outcomes across all evaluation orders
MANDATORY: Use graft instead of cargo
======= Enforces graft as the preferred build system for all agents working in the Basin codebase. Activates whenever any agent attempts cargo build/test/check/clippy/fmt or needs to compile, test, lint, benchmark, or manage build artifacts.
Graft-Prefer Rules for Basin Agents
MANDATORY: Use graft instead of cargo for all build operations
This workspace uses graft as its build system. Graft wraps cargo with CAS-backed caching, distributed compilation, unified linting, resilient builds, and multi-language support. All agents MUST use graft instead of raw cargo.
Command Mapping (ALWAYS apply these substitutions)
origin/main
| Instead of | Use |
|------------|-----|
| cargo build | graft build |
| cargo check | graft check |
| cargo test | graft test |
| cargo clippy | graft clippy |
| cargo fmt | graft fmt |
| cargo run | graft run |
<<<<<<< HEAD
| cargo bench | graft bench |
| cargo bench | graft run -p basin-observatory-app --release -- sweep |
origin/main |
cargo doc|graft doc| |cargo clean|graft clean| |cargo fix|graft fix(NEVER usecargo fix-- it corrupts files) | |cargo nextest|graft test(nextest is used under the hood) |
Package targeting
- Single crate:
graft build -p <crate-name> - Workspace:
graft build --workspace - Release:
graft build --release - With features:
graft build -p <crate> -F <feature>
<<<<<<< HEAD
Covariant quality checking
graft lint-- all checks (clippy + fmt + quality + deps)graft quality run-- full quality auditgraft fix-- auto-fix with safe transforms
Diagnostics
graft health --verbose-- check graft configurationgraft cache validate-- detect stale artifacts (breaks covariance)graft cache stats-- cache hit/miss statistics (irreducibility measure)graft memory-- check memory pressure / recommended jobsgraft stream --errors-- live error feed from builds
Anti-patterns (NEVER do these)
- NEVER run
cargo fixdirectly (corrupts files) - NEVER use
cargo buildwhengraft buildis available - NEVER skip durability labels on benchmark results =======
Quick build aliases (via .cargo/config.toml)
cargo kernel-- core storage only (~30s)cargo dev-- common products (~60s)cargo fast-- excludes SQL stackcargo test-unit-- unit tests only (fastest feedback)cargo test-fast-- unit + critical integrationcargo test-sigil-- sigil tests with 1s timeout
Unified quality checking
graft lint-- all checks (clippy + fmt + quality + deps)graft quality run-- full quality audit (UP01-UP12)graft fix-- auto-fix with safe transforms
Diagnostics and debugging
graft health --verbose-- check graft configurationgraft cache validate-- detect stale artifactsgraft cache stats-- cache hit/miss statisticsgraft memory-- check memory pressure / recommended jobsgraft stream --errors-- live error feed from builds
Environment
- Target directory: /Volumes/Basin/cargo-target (external SSD, do NOT change)
- Cache directory: /Volumes/Basin/graft-cache
- GRAFT_ENABLE=1 is set in .cargo/config.toml
- Tests use nextest (configured in .config/nextest.toml)
Subagent delegation
When a task requires specialized build operations, delegate to these droids:
- graft-builder: Standard build/test/check operations
- graft-analyzer: Code analysis and intelligence
- graft-ci: CI pipeline execution
- graft-benchmarker: Performance benchmarking
- graft-debugger: Build failure diagnosis
- graft-sigil-compiler: Multi-language compilation
- graft-cluster: Distributed build management
- graft-image-builder: Image building
- graft-refactorer: Code refactoring with safety
- graft-cacher: Cache management
- graft-watcher: Live development feedback
Anti-patterns (NEVER do these)
- NEVER run
cargo fixdirectly (corrupts files, hardcoded off via GRAFT_NO_WORKSPACE_FIX) - NEVER change target-dir from /Volumes/Basin/cargo-target
- NEVER run
podman/docker run -pwith host port mappings for competitors - NEVER use
cargo buildwhengraft buildis available - NEVER skip durability labels on benchmark results
origin/main