Skip to content

Add Claude model picker and dynamic API port#17

Merged
yoaquim merged 1 commit into
mainfrom
claude/adoring-moore-8b2228
May 3, 2026
Merged

Add Claude model picker and dynamic API port#17
yoaquim merged 1 commit into
mainfrom
claude/adoring-moore-8b2228

Conversation

@jedibrillo

@jedibrillo jedibrillo commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Settings UI: Claude model picker. New "Claude Model" section on the Settings page lets users pick which model Claude Code uses to analyze recordings — Default (Claude Code's choice) / Opus 4.7 / Sonnet 4.6 / Haiku 4.5 — without editing scripts. Slim per-option guidance ("Recommended — balanced quality and cost", etc.) follows @jedibrillo's recommendations in #15. Saves to SEAM_ANALYSIS_MODEL in .env. scripts/pocket-run.sh reads it and forwards as --model to both claude -p calls (analyze loop + pull-debug fallback). Empty/unset = no flag = Claude Code default.
  • Dynamic API port + Vite proxy. API server prefers 3001 but falls back to an OS-assigned port if it's taken (e.g. another worktree is already running), writes the actual port to .seam/api-port, and the Vite dev server reads that file to proxy /api → the API. Hardcoded http://localhost:3001 URLs in the dashboard become relative /api/... paths. CORS widened to any localhost origin. This unblocks running multiple worktrees in parallel.

Why

The #15 RFC discussion calls out that model choice has a real cost/quality impact (Sonnet 4.6 catches subtle commitments that Haiku misses; Opus is overkill). Making this user-configurable from the dashboard is the lowest-friction way to get there. The dynamic-port work fell out of trying to verify the picker in a preview while another worktree had 3001 — without it, parallel npm run dev sessions just collide.

Test plan

  • npm run format:check && npm run lint && npm test — 101/101 TS, 51/51 Python, no new lint errors
  • Manual: started API + dashboard via preview, navigated to Settings, picked "Sonnet 4.6", clicked Save, verified .env got SEAM_ANALYSIS_MODEL=claude-sonnet-4-6 and the Save button disabled
  • Manual: API auto-fell-back from 3001 → 60261 (port held by another worktree), Vite proxy still routed /api/settings correctly
  • Reviewer: try running two worktrees side by side and confirm they don't collide

Notes for reviewer

  • Model list (MODEL_OPTIONS in SettingsPage.tsx) is hardcoded against the lineup current as of this branch (Opus 4.7 / Sonnet 4.6 / Haiku 4.5). Future Claude releases will need this list updated. Considered fetching from the Anthropic API but it requires a key and adds runtime complexity for a list that changes a few times a year — happy to revisit.
  • Per-tier model selection (separate dropdowns for journal/synthesis if #15 lands) is intentionally out of scope. This branch adds a single analysisModel setting; per-tier can be added when those scripts exist.
  • TDD: tests written first, all 5 new tests committed alongside implementation.

🤖 Generated with Claude Code

Settings page gains a "Claude Model" dropdown (Default / Opus 4.7 /
Sonnet 4.6 / Haiku 4.5) that writes SEAM_ANALYSIS_MODEL to .env.
pocket-run.sh forwards it to claude -p as --model when set, so users
can pick the model used for recording analysis without editing the
script. Default keeps Claude Code's own choice.

The API server now falls back to an OS-assigned port when 3001 is
busy, writes its actual port to .seam/api-port, and the Vite dev
server reads that file to proxy /api → the API. CORS is widened to
any localhost origin. All hardcoded http://localhost:3001 fetch URLs
become relative /api/... paths so the dashboard works regardless of
which port the API ended up on. This unblocks running multiple
worktrees in parallel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jedibrillo jedibrillo requested a review from yoaquim May 2, 2026 03:07
@yoaquim yoaquim merged commit 64be7ef into main May 3, 2026
1 check passed
@yoaquim yoaquim deleted the claude/adoring-moore-8b2228 branch May 3, 2026 12:26
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