Skip to content

Add Claude Code on the web SessionStart hook for cargo warm-up#63

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/beautiful-edison-x0o5ke
Jun 20, 2026
Merged

Add Claude Code on the web SessionStart hook for cargo warm-up#63
hyperpolymath merged 1 commit into
mainfrom
claude/beautiful-edison-x0o5ke

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

What

Adds a cloud-only SessionStart hook so Claude Code on the web sessions start with the Rust workspace already warm — cargo test, cargo clippy, and cargo fmt are 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

File Purpose
.claude/hooks/session-start.sh The hook. Guarded on CLAUDE_CODE_REMOTE (a no-op on local checkouts); runs cargo fetch --locked then cargo 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.json Registers the hook on startup|resume.
REUSE.toml Covers .claude/** under MPL-2.0, since settings.json (JSON) can't carry an inline SPDX header. The shell script carries its own SPDX header.

Scope notes

  • Only the pre-installed cargo toolchain is exercised — it drives the canonical cargo test suite. 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.
  • The workspace root already excludes src/interface (external echidna path-dep), so --workspace builds cleanly on a standalone checkout.

Validation (run in this cloud session)

  • ✅ Hook executes cleanly in cloud mode (CLAUDE_CODE_REMOTE=true), exit 0
  • ✅ Local-skip path is an instant no-op when CLAUDE_CODE_REMOTE is unset
  • cargo clippy --workspace --all-targets → exit 0 (one pre-existing warning in vcltotal-fmt test code, unrelated to this change)
  • cargo test --test integration_test → 59 passed, 0 failed

Cold 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

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
@hyperpolymath hyperpolymath marked this pull request as ready for review June 20, 2026 08:03
@hyperpolymath hyperpolymath merged commit 29f2e9a into main Jun 20, 2026
14 of 128 checks passed
@hyperpolymath hyperpolymath deleted the claude/beautiful-edison-x0o5ke branch June 20, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants