Make /define worktree-aware: write tasks to main repo#10
Merged
Conversation
When invoked from a linked worktree, /define now resolves the main repo path and writes the task file there, so the backlog stays centralized and survives /close removing the worktree. - Resolve <main-repo> via `git worktree list --porcelain`; detect linked-worktree invocation via `git rev-parse --show-toplevel` - Thread the absolute <main-repo>/tasks/ path through the duplicate check, write step, and confirmation output (no persistent cd) - Main-worktree invocation: paths identical, behavior unchanged - Bump work-system 1.2.4 -> 1.2.5; document centralized backlog in README Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address code-review findings on the worktree-aware /define change:
- Add scripts/main-repo-path.sh as the canonical resolver:
- `path` strips the porcelain prefix via parameter expansion, so it
survives repo paths containing spaces (the inline `awk '{print $2}'`
truncated at the first space)
- `linked` compares --git-common-dir vs --git-dir, immune to symlinked
paths (the prior --show-toplevel string compare could false-positive)
- Route /define step 1 through the helper instead of an inline command,
removing a divergent copy of the worktree-resolution logic
Sibling skills (kickoff/close/adopt/list/continue) still inline their own
copy; migrating them to this helper is tracked as a separate task.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
Author
|
@claude review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/definenow writes the task file to the main repo'stasks/, even when invoked from inside a linked worktree/kickoffand/list, and prevents loss when/closeremoves the worktreeChanges
define/SKILL.md: new step 1 resolves<main-repo>viagit worktree list --porcelainand detects linked-worktree invocation viagit rev-parse --show-toplevel; threads the absolute<main-repo>/tasks/path through the duplicate check, write step, and confirmation output (no persistentcd); steps renumbered 1–9work-systemversion bump 1.2.4 → 1.2.5 (plugin.json + marketplace.json)work-system/README.md: documents the centralized backlog behaviorReadiness
Test plan
/definewrites to<main-repo>/tasks/<name>.mdpython3 scripts/check-structure.pystays green🤖 Generated with Claude Code