From cfd3e9f8d1f9fc98db131134e669dd907fe2e49c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 19 Apr 2026 08:35:37 +0000 Subject: [PATCH] chore: add SessionStart hook for Claude Code on the web Pre-fetches Go modules and warms the build/test caches when a remote Claude Code session starts, so linters and unit tests can run without extra setup. Gated on CLAUDE_CODE_REMOTE=true so it is a no-op locally. https://claude.ai/code/session_01PeXAW2DA8BnTmFvStfNmWn --- .claude/hooks/session-start.sh | 25 +++++++++++++++++++++++++ .claude/settings.json | 14 ++++++++++++++ .gitignore | 5 ++++- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 .claude/hooks/session-start.sh create mode 100644 .claude/settings.json diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh new file mode 100755 index 0000000..ad2fab0 --- /dev/null +++ b/.claude/hooks/session-start.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -euo pipefail + +# Only run in Claude Code on the web; skip on local machines. +if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then + exit 0 +fi + +cd "${CLAUDE_PROJECT_DIR:-$(pwd)}" + +echo "[openboot session-start] Go version: $(go version)" + +# Pre-fetch and verify Go module deps so tests/builds are fast and offline-safe. +echo "[openboot session-start] Downloading Go modules..." +go mod download + +# Warm the build cache so the first `go build` / `go test` is fast. +echo "[openboot session-start] Warming build cache (go build ./...)..." +go build ./... >/dev/null + +# Warm the test binary cache without executing tests. +echo "[openboot session-start] Warming test cache (go test -count=0 ./...)..." +go test -count=0 ./... >/dev/null + +echo "[openboot session-start] Done." diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 0000000..e06b033 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,14 @@ +{ + "hooks": { + "SessionStart": [ + { + "hooks": [ + { + "type": "command", + "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/session-start.sh" + } + ] + } + ] + } +} diff --git a/.gitignore b/.gitignore index 02b4404..c1a64f7 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,10 @@ __pycache__/ # Work tracking (internal) .sisyphus/ -.claude/ +.claude/* +!.claude/hooks/ +!.claude/settings.json +.claude/settings.local.json # Go vendor (deps downloaded at build time) vendor/