You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add SessionStart hook to install Swift toolchain for Claude Code on the web #295
Add a SessionStart hook so Claude Code on the web sessions can run swift build, swift test, swift-format, swiftlint, etc. without manual setup. Sessions today start without a Swift toolchain, so any code-validation step the agent attempts fails immediately.
Proposed approach
Two new files under .claude/:
.claude/hooks/session-start.sh — install Swift + project tooling. Guarded by CLAUDE_CODE_REMOTE=true so it's a no-op for local sessions.
.claude/settings.json — register the hook for the SessionStart event.
Download the Swift 6.1 toolchain (matches Package.swift's swift-tools-version: 6.1) from https://download.swift.org/swift-6.1-release/ubuntu2404/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu24.04.tar.gz into ~/.swift/.
Install mise and run mise install against the existing mise.toml to fetch swift-format 602.0.0, swiftlint 0.62.2, periphery 3.7.4, swift-openapi-generator 1.10.3.
Persist PATH (Swift bin + ~/.local/bin) and the mise env into $CLAUDE_ENV_FILE so they're visible to the session.
Be idempotent — skip apt/Swift/mise installs when already present.
Open questions
Sync vs. async hook: synchronous guarantees tools are ready before the agent can run anything (no race), but adds ~2–4 min to first-time session startup (cached after that). Async swaps the trade-off. Recommendation: start synchronous.
Swift version pinning: the hook should use 6.1 to match swift-tools-version. CI tests against 6.1/6.2/6.3 — agent sessions only need one.
Reference implementation
A working draft was prototyped in this branch's history (commit 36f52f8, since reverted in abf43b9) on PR for #256. It validated the apt step locally; the Swift download and mise install couldn't be exercised in the prototyping sandbox because download.swift.org was on a host allowlist denylist there. The actual web sandbox is expected to permit it.
Acceptance criteria
New web session starts with swift --version returning Swift 6.1.
swift build, swift test, swift-format, swiftlint, periphery, swift run swift-openapi-generator all resolvable on PATH.
Hook is a no-op on local (non-remote) sessions.
Re-running the hook after a cached install completes in seconds, not minutes.
Activity
Adopt two-tier cloud Swift setup and make regeneration work offline o…
Wire SessionStart hook (#295)
Add SessionStart hook to provision Swift toolchain (#295)
Adopt two-tier cloud Swift setup and make regeneration work offline o…
Wire SessionStart hook (#295)
Add SessionStart hook to provision Swift toolchain (#295)
Adopt two-tier cloud Swift setup and make regeneration work offline o…
Wire SessionStart hook (#295)
Add SessionStart hook to provision Swift toolchain (#295)
Adopt two-tier cloud Swift setup and make regeneration work offline o…
Wire SessionStart hook (#295)
Remove deprecated API, model server error codes, refactor FieldValue …
leogdion commentedon Aug 28, 2026
Resolved on
v1.0.0-beta.4via #424 (commit 1411227). SessionStart hook lands at.claude/hooks/session-start.sh.Remove deprecated API, model server error codes, refactor FieldValue …
v1.0.0 beta.4 (#439)