Repository navigation
Description
Background
fbuild ships its own tool_guard.py PreToolUse hook that forces all
cargo / rustc / rustfmt calls through soldr cargo … (huge
speed-up — soldr seeds zccache + a cached target-tree, turning
multi-minute cold builds into seconds-long warm hits). The hook is
documented at fbuild#429.
But Claude Code loads hooks from the session project root, not
from whatever directory commands execute in. When an agent runs in
the FastLED workspace and cds into a fbuild dev checkout (e.g.
under clud-pr against a fbuild issue, or working on fbuild from a
FastLED session), the fbuild hook is never consulted — the agent
just runs bare cargo build and burns minutes that should have been
seconds.
Concrete impact: the recent fbuild PR #424 / #427 stack iterated
through ~6-7 cold cargo builds (~3 min each) before someone caught
it and switched to manual soldr cargo. That's ~15 min of wall time
on a single PR loop. Multiply across the agent-driven development
workflow we run and it's measurable.
What this issue asks for
Extend FastLED's .claude/settings.json PreToolUse hook so that any
cargo / rustc / rustfmt / clippy-driver invocation — no
matter what directory the command runs in — is rewritten to
soldr <tool> …. Specifically:
- Add a Rust-tool gate to the existing
ci/hooks/tool_guard.py-style PreToolUse chain (or a new
ci/hooks/rust_tool_guard.py). - Trigger condition: the first whitespace token of the command is
cargo/rustc/rustfmt/clippy-driverAND the cwd
contains aCargo.toml(walking up to root). Avoids false
positives for shell scripts namedcargo. - Block bare invocations with an error message that includes the
correct fix (soldr cargo build …). - Document the rationale + the fbuild#429 cross-link in the hook
source so the next maintainer can see why.
Why FastLED owns this
- fbuild is the canonical Rust workload that gets driven from this
repo (every agent that opens a fbuild PR from a FastLED workspace). - The fbuild-side hook is the right enforcement for sessions whose
project root is fbuild, but it can't catch cross-project
sessions. That's a Claude Code feature gap (fbuild#429 has the
upstream-request discussion). - The cheapest defensive measure that closes the gap today is to
add the gate at FastLED's session-root, where it does fire.
Out of scope
- The deeper Claude Code feature request for per-directory hook
discovery (tracked at fbuild#429). - Any change to soldr itself; it works fine, it just isn't being
invoked.
Related
- Hooks: tool_guard.py (force-soldr-for-cargo) doesn't fire when agent works in fbuild worktree from another project's session fbuild#429 (root-cause investigation: hooks only load at
session project root) - feat(symbols): standalone
fbuild symbols <elf>fine-grained bloat report fbuild#424 / APA102 requires show() to be called twice for a correct update #427 (the PR stack where the issue was first
observed)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
tooling: add rust_tool_guard PreToolUse hook for soldr enforcement (#…