Add Claude Code on the web SessionStart hook for cargo warm-up#63
Merged
Conversation
Web (cloud) sessions start from a fresh clone, so dependencies and the build cache are cold. This adds a cloud-only SessionStart hook that warms the Rust workspace before Claude starts working, so `cargo test`, `cargo clippy`, and `cargo fmt` are immediately usable. - .claude/hooks/session-start.sh: guarded on CLAUDE_CODE_REMOTE (no-op on local checkouts); runs `cargo fetch --locked` then `cargo build --workspace --all-targets`; logs verbose cargo output to a temp file to keep session context clean; best-effort so a transient failure never blocks session startup. - .claude/settings.json: registers the hook on startup|resume. - REUSE.toml: cover .claude/** under MPL-2.0 (settings.json carries no inline SPDX header; the shell script has one). Only the pre-installed cargo toolchain is exercised; the optional Idris2/Zig recipes are not required for the Rust test/lint path and are intentionally omitted. Validated in a cloud session: hook exits 0, local-skip is a no-op, `cargo clippy --workspace` and the integration tests pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017nyxs8RgqZa72PzrTu3L75
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a cloud-only
SessionStarthook so Claude Code on the web sessions start with the Rust workspace already warm —cargo test,cargo clippy, andcargo fmtare usable immediately instead of paying a cold fetch/compile on first use.Cloud sessions begin from a fresh clone with cold dependencies and an empty build cache. This hook closes that gap.
Changes
.claude/hooks/session-start.shCLAUDE_CODE_REMOTE(a no-op on local checkouts); runscargo fetch --lockedthencargo build --workspace --all-targets; pipes verbose cargo output to a temp log to keep the session context clean; best-effort (|| true) so a transient failure never blocks session startup..claude/settings.jsonstartup|resume.REUSE.toml.claude/**under MPL-2.0, sincesettings.json(JSON) can't carry an inline SPDX header. The shell script carries its own SPDX header.Scope notes
cargotoolchain is exercised — it drives the canonicalcargo testsuite. The optional Idris2/Zig recipes (idris-check,zig-build) are not pre-installed in cloud sessions and are not required for the Rust test/lint path, so they're intentionally omitted.src/interface(externalechidnapath-dep), so--workspacebuilds cleanly on a standalone checkout.Validation (run in this cloud session)
CLAUDE_CODE_REMOTE=true), exit 0CLAUDE_CODE_REMOTEis unsetcargo clippy --workspace --all-targets→ exit 0 (one pre-existing warning invcltotal-fmttest code, unrelated to this change)cargo test --test integration_test→ 59 passed, 0 failedCold warm-up cost is ~20s (
cargo fetch~4s +cargo build --all-targets~16s); near-instant once cached.Hook execution mode
Synchronous — guarantees dependencies are ready before the session begins (no race where Claude runs tests/lints before they're built), at the cost of that warm-up time being added to session startup. Can be switched to async if faster startup is preferred.
Note
Once merged into
main, all future web sessions on this repo will use the hook.🤖 Generated with Claude Code
https://claude.ai/code/session_017nyxs8RgqZa72PzrTu3L75
Generated by Claude Code