rust-unsafe-code-exorcist
Made by JeffAudit, classify, and optionally remediate Rust unsafe sites. Use when removing unsafe blocks, validating unsafe necessity, hardening FFI/SIMD, exorcising unsafe, or checking #![forbid(unsafe_code)] crates. Remediation lands only in the active checkout after approval; never use git worktrees. Not for broad UB hunts.
From Jeffrey's Skills.md: professionally crafted skills for any AI agent, installed and kept in sync by the jsm CLI. Subscription only, $20/month.
Works With
Quality and Utility come from canonical skill metadata. Community ratings appear separately as stars when subscriber reviews exist.
Subscribe to download
Public previews are available, but downloads, CLI sync, and premium content require an active subscription.
Sign In to Subscribe- Full skill content with deterministic versioning
- CLI sync + local search index
- Access to Jeffrey’s premium library
Save to your account
Saved skills live in your cloud list. Run jsm sync on each machine to pull them locally.
What's New with this Skill
3Updates, enhancements, and release notes for this skill.
Enhanced: rust-unsafe-code-exorcist, Phase 0 history mining that returns results
The skill's cass-mine.sh ran every query with flags cass rejects, so Phase 0 returned zero hits with exit 0 on every run. It now runs valid searches, reports failed and timed-out queries, and exits 1 when nothing answered.
- cass-mine.sh used flags cass rejects, so every Phase 0 query silently returned nothing. It now runs valid searches.
- Remote hosts come from CASS_MINE_HOSTS and receive each query on stdin, never spliced into a command line.
- A search that ran out of cass's time budget counts as failed, not as zero hits.
- Failed queries are logged to phase0_cass_errors.log and counted, and the script exits 1 when nothing answered.
- Hits are tagged with host and query and deduplicated by session line.
- On the same index the old script returned 0 hits and the new one 40.
- CASS_MINE_HOSTS may be separated by commas or spaces, and local or localhost both mean this machine, matching the gauntlet's miner.
Phase 0 mines prior agent sessions for the refactor reasoning behind the exemplar repositories. scripts/cass-mine.sh passed --robot and --json together (cass rejects the duplicate) and a --host flag cass does not have. Every query failed, the errors went to /dev/null, and the audit carried on with an empty hit set that looked like "no prior work".
Enhanced: rust-unsafe-code-exorcist, the Swarm tier runs on real NTM
The Swarm-tier orchestration section shipped a spawn command and a pipeline YAML that matched no NTM release: --panes, --policy, --pipeline flags and a phases/partition schema the binary has never parsed. It now spawns a labeled 12-pane session with --verify-boot and drives phases through NTM's actual v2.0 pipeline schema.
- ntm spawn "$PROJECT_NAME" --label unsafe-exorcist --cc=12 --no-user --verify-boot replaces the fictional spawn grammar
- Phase sequencing points at the real v2.0 pipeline schema (vars/settings/steps) and runs via ntm pipeline run --session
New: Rust Unsafe Code Exorcist. Three-bucket classification (unavoidable / perf-only / refactorable) for every unsafe site, checked by a six-tool harness before any refactor lands.
Every unsafe site in a Rust project lands in one of three buckets: STRICTLY_UNAVOIDABLE (the language can't express the safe form), PERF_ONLY (safe form exists but slower, ships behind a safe-only Cargo feature with measured perf delta), or REFACTORABLE (safe form exists at no cost, the audit drafts it with a property-based equivalence test). A 10-phase loop with adversarial reclassification re-runs until classification stabilizes.
- Three-bucket per-site classification with a falsifiable justification: STRICTLY_UNAVOIDABLE keeps with a hardened SAFETY comment + clippy lint; PERF_ONLY ships behind a safe-only Cargo feature with measured delta; REFACTORABLE gets a drafted rewrite + property-based equivalence test
- Phase 4 classification reapplies until under 5% of sites flip bucket between passes and zero (A)→(C) flips occur. Phase 6's adversarial reclassifier then tries to defeat every (A), find a safe equivalent for every (B), and break every (C) equivalence claim, repeating until quiet
- Composite harness runs miri (Stacked + Tree Borrows), cargo-careful, loom, cargo-fuzz, cargo-mutants, cargo-geiger, and the project's tests under both default and safe-only Cargo features. verify.sh + ci-matrix.yml ship as the CI gate
- Outputs land in <project>/.unsafe-audit/ (its own nested git repo) so the audit stays reviewable: unsafe-inventory.jsonl, per-site write-ups, refactor plans, REVIEWER_RESPONSES.md, and a beads task graph with one parent epic per refactor cluster
- 32 specialized subagents include enumerator, classifier, archeologist, kani-prover, pin-projection-auditor, allocator-identity-auditor, refactor-planner, multi-model-triangulator, maintainer-empathy-reviewer
- Pattern catalog covers FFI, SIMD, atomics, UnsafeCell, transmute, Pin projections, lock-free, allocators, tagged pointers, proc-macro unsafe, Send/Sync impls, embedded, wasm/cxx, cryptography. Each pattern carries case-study citations to real refactors that landed
- 60-second fast-track triage mode handles incident response and pre-release gates; full audit runs 30 minutes to 4 hours per crate and stays read-only until you authorize the refactor
- Pairs with /rust-undefined-behavior-exorcist: this asks 'is this unsafe block necessary?', that asks 'is there UB anywhere in this codebase, safe or unsafe?'. Run them in sequence: unsafe-cleanup first, UB-verify after
Classification starts from first principles, with a falsifiable justification per site. Every site lives in <project>/.unsafe-audit/audit/classification/site-NNNN.md with the bucket, the justification, and the corresponding artifact: a safe rewrite plus equivalence test for REFACTORABLE; a safe-only Cargo feature implementation plus criterion / hyperfine / flamegraph numbers for PERF_ONLY; a hardened SAFETY comment plus clippy proof-obligation lint for STRICTLY_UNAVOIDABLE.