Repository navigation
Closed
Milestone
Description
Summary
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 byCLAUDE_CODE_REMOTE=trueso it's a no-op for local sessions..claude/settings.json— register the hook for theSessionStartevent.
The script should:
- Install Swift's runtime apt deps on Ubuntu 24.04 (
libcurl4-openssl-dev,libxml2-dev,libz3-dev,libstdc++-13-dev, etc.). Tolerate failures from unrelated third-party PPAs (apt-get update -qq || true). - Download the Swift 6.1 toolchain (matches
Package.swift'sswift-tools-version: 6.1) fromhttps://download.swift.org/swift-6.1-release/ubuntu2404/swift-6.1-RELEASE/swift-6.1-RELEASE-ubuntu24.04.tar.gzinto~/.swift/. - Install
miseand runmise installagainst the existingmise.tomlto fetchswift-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_FILEso 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.1to matchswift-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 --versionreturning Swift 6.1. -
swift build,swift test,swift-format,swiftlint,periphery,swift run swift-openapi-generatorall resolvable onPATH. - Hook is a no-op on local (non-remote) sessions.
- Re-running the hook after a cached install completes in seconds, not minutes.
Metadata
Metadata
Assignees
Labels
No labels
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)