Repository navigation
Description
Part of the contributor-unblocking meta (#699).
Problem
The build and cache tooling is Soldr, and it cannot be mixed with bare Rust tools. Bare cargo, rustup, rustc and friends skip Soldr's zccache-backed cache and can disagree with the toolchain Soldr pins.
AGENTS.md states the rule ("Use soldr cargo ..., never bare cargo"), but nothing in this repo enforces it. Maintainer sessions are protected only because clud enforces it from the maintainer's own clud settings. External contributors and their agents (Claude Code or Codex without clud) get no guard at all. A contributor's fork CI hit soldr: command not found and then Soldr permission errors, the setup this rule exists to prevent (see #370).
Prior art: we had this before
- soldr —
.claude/hooks/tool_guard.py, about 300 lines, withtest_tool_guard.py(about 315 lines) beside it.- A
PreToolUseBash hook that denies barecargo,cargo-clippy,cargo-fmt,clippy-driver,rustc,rustdoc,rustfmt,rustup,rust-gdb,rust-lldbandrust-analyzer. - It also denies bare
python/pip(must use uv). - It strips leading
FOO=barenv assignments so they can't bypass it (soldr linux-v4l2: Apply saved camera controls when the device opens #364). - It respects shell quoting, including
bash -c,dockerandssh(soldr test: verify the gate sees changed Rust source #435). - It was introduced in soldr rust: Port libobs/graphics/math-extra.c to obs-graphics #351 ("dogfood soldr via test script + add tool_guard pre-tool hook").
- The file is still in the tree, but
.claude/settings.jsonno longer wires it.
- A
- zccache —
ci/hooks/tool_guard.py, still wired as aPreToolUsehook (uv run --no-project python ci/hooks/tool_guard.py)..claude/hooks/README.mddescribes it as "blocks bare Rust commands (must usesoldr)". - fbuild — dropped its project
tool_guard.pyin fbuild libobs: keep the live PulseAudio monitor when reset fails (#486) #713. The.claude/settings.jsoncomment says: "tool_guard.pyis intentionally absent here — that one is installed globally." - clud (current mechanism) —
crates/clud-bin/src/repo_clud_config.rsreads.clud/settings.json(user, repo and repo-local layers). With"rust": { "use_soldr": true }, clud:- puts Soldr's shim directory first on the session
PATH(feat: detect.cludmarker in repo; prepend soldr's global shim dir to session PATH so child cargo invocations route through soldr (no global PATH edits) talos-hq/clud#343) - blocks bare Rust commands through
block_bad_cmd.rs - That is why maintainer sessions see "Use
soldr …instead of bare …".
- puts Soldr's shim directory first on the session
The guard moved out of the repos and into clud and the global setup, so only people running our tooling get it.
Change
- Ship a repo-level hook that doesn't depend on clud.
- Port soldr's
tool_guard.py, with its tests, into this repo, for example asci/hooks/tool_guard.py. - Make it a
uv run --scriptfile (repo rule). - Drop or keep the python/pip arm to match AGENTS.md (this repo also requires uv).
- Port soldr's
- Wire it in the repo's Claude Code project settings as a
PreToolUsehook onBash, following fbuild's wedge-proof pattern:- anchor on
$CLAUDE_PROJECT_DIR, and guard with[ -f <script> ] - mention any Codex equivalent in AGENTS.md
- anchor on
- Don't double-fire for clud users.
- Either the hook exits early when it detects a clud session, or we accept both firing; they give the same answer.
- Also ship
.clud/settings.jsonwith"rust": { "use_soldr": true }, so clud users get the shims too.
- Match on the parsed command, not substrings.
- The current clud guard blocks text that merely mentions the tool names: it rejected a
gh issue createwhose body said "rustup" while this issue was being filed. - soldr's
tool_guard.pyalready parses withshlex; keep that and add regression tests for heredoc and quoted-body cases (process: Friction points in the dev cycle and how to remove them #634 item 9).
- The current clud guard blocks text that merely mentions the tool names: it rejected a
- CI side. A
./lintcheck that no script underci/orrust/tools/invokes bare Rust tools, so the rule also holds for non-agent contributors.
Acceptance
- In a fresh clone with plain Claude Code (no clud),
cargo testis denied with asoldr cargo testhint, andsoldr cargo testruns. FOO=1 cargo build,bash -c "cargo build"andenv cargo buildare denied.gh issue create --body "use soldr instead of bare rustup",echo cargo:warningand heredoc bodies are allowed.- With clud, behaviour is unchanged and there are no confusing duplicate denials.
./lintruns the hook's tests.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Oct 14, 2026
Claiming.
ci: Repo-level hook that enforces soldr over bare cargo/rustup (obs-r…