Problem
The /issue-lifecycle skill is brittle when running in Claude Code worktrees. It sometimes works, sometimes doesn't. Two distinct failure scenarios:
1. Worktree not initialized
When Claude Code creates a worktree via EnterWorktree, it creates a git worktree but doesn't run swamp repo init. Without .swamp/ and .swamp.yaml, all swamp model commands fail. The skill doesn't include initialization as a prerequisite step.
2. Scratch repo can't load dev extension models
During triage reproduction (Phase 1 Step 5), when a scratch repo is created at /tmp/swamp-repro-issue-<N>, dev extension models like @si/issue-lifecycle aren't available. The Deno bundler can't resolve zod imports because the scratch repo has no deno.json import map. The workaround is SWAMP_MODELS_DIR=<worktree>/extensions/models, but this isn't documented in the skill.
3. findNearestDenoConfig boundary check ordering
In user_model_loader.ts:1084-1105, the repo boundary check fires before the deno.json check, meaning if a model file is at the repo root level, its deno.json would be missed.
Expected Behavior
The issue-lifecycle skill should work flawlessly every time in any context (main repo, worktree, scratch repo) without manual environment setup.
Proposed Fix
- Skill: Add Phase 0 (Environment Setup) with worktree detection,
swamp repo init, model verification, and SWAMP_MODELS_DIR guidance
- Skill: Update triage.md scratch repo instructions to set
SWAMP_MODELS_DIR
- Code: Fix
findNearestDenoConfig boundary check order
- Code: Improve error messages when model type not found
Problem
The
/issue-lifecycleskill is brittle when running in Claude Code worktrees. It sometimes works, sometimes doesn't. Two distinct failure scenarios:1. Worktree not initialized
When Claude Code creates a worktree via
EnterWorktree, it creates a git worktree but doesn't runswamp repo init. Without.swamp/and.swamp.yaml, allswamp modelcommands fail. The skill doesn't include initialization as a prerequisite step.2. Scratch repo can't load dev extension models
During triage reproduction (Phase 1 Step 5), when a scratch repo is created at
/tmp/swamp-repro-issue-<N>, dev extension models like@si/issue-lifecyclearen't available. The Deno bundler can't resolve zod imports because the scratch repo has nodeno.jsonimport map. The workaround isSWAMP_MODELS_DIR=<worktree>/extensions/models, but this isn't documented in the skill.3.
findNearestDenoConfigboundary check orderingIn
user_model_loader.ts:1084-1105, the repo boundary check fires before the deno.json check, meaning if a model file is at the repo root level, its deno.json would be missed.Expected Behavior
The issue-lifecycle skill should work flawlessly every time in any context (main repo, worktree, scratch repo) without manual environment setup.
Proposed Fix
swamp repo init, model verification, andSWAMP_MODELS_DIRguidanceSWAMP_MODELS_DIRfindNearestDenoConfigboundary check order