Skip to content

issue-lifecycle skill fails in worktrees: missing init and dev extension model resolution #1110

@keeb

Description

@keeb

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

  1. Skill: Add Phase 0 (Environment Setup) with worktree detection, swamp repo init, model verification, and SWAMP_MODELS_DIR guidance
  2. Skill: Update triage.md scratch repo instructions to set SWAMP_MODELS_DIR
  3. Code: Fix findNearestDenoConfig boundary check order
  4. Code: Improve error messages when model type not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglifecycle/ci-reviewPR created, waiting on CI and code review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions