Feat/territory based parallel worktree split#14
Feat/territory based parallel worktree split#14rafaelpapastamatiou-afya wants to merge 7 commits into
Conversation
…k groups Add opt-in parallel execution during plan→implement transition. When the plan contains disconnected task groups (no shared dependencies or files), the user is offered a choice: sequential (default) or parallel worktrees with territory-based file isolation. New skill: parallel-split - Builds territory map per task group (ownedFiles, forbidden, shared) - Creates git worktrees with afyapowers state pre-populated at implement phase - Generates PROMPT.md with territory protocol per worktree - Supports Warp, tmux, and manual terminal launch - Writes territory_map.json for merge orchestration Modified: next command (Step 5A) - Parses plan dependency graph to detect disconnected components - Presents choice only when 2+ independent groups exist - Falls through to normal flow when plan is fully connected Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address all 4 review findings: 1. CRITICAL — Parent state path: Revert next.md to original. Worktrees now run ONLY implement phase, merge back into parent branch, and the parent continues with review→complete seeing the consolidated diff. 2. IMPORTANT — Partial review/complete: Removed review and complete from worktree PROMPT.md. Worktrees create WORKTREE_COMPLETE.md and stop. Parent handles unified review and completion after merge. 3. IMPORTANT — Chain architecture: Moved split choice from next command into implementing skill (between plan validation and SDD invocation). This respects the implementing→SDD chain without bypassing it. 4. IMPORTANT — history.yaml format: Fixed to append under `events:` root key matching the framework convention from new.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Worktrees now copy and update the canonical plan.md at .afyapowers/features/<slug>/artifacts/plan.md so checkbox changes merge back cleanly into the parent branch - TASK_SCOPE.md is now a read-only scope summary, not the source of truth for task progress - Removed claude CLI coupling from parallel-split — MCP setup is optional and host-specific, not hardcoded - implementing skill clarifies post-merge path: if all [x] run /afyapowers:next, otherwise stay in implement Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace hardcoded `claude` CLI in Warp launch config with <agent-launch-command> placeholder for host-agnostic distribution - Document plan.md merge conflict resolution: preserve all valid [x] checkboxes from both sides when merging worktree branches - Clarify _deferred/ as temporary merge aid, not final product code — consolidate during parent merge then remove Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…shared-file consolidation
There was a problem hiding this comment.
✨ PR Review
This PR introduces a sophisticated parallel worktree feature with territory-based file isolation. The approach is well-structured, but there are several critical shell command issues and missing error handling that need attention before deployment.
5 issues detected:
🐞 Bug - rm without -r cannot remove directories, leaving orphaned files after cleanup 🛠️
Details: _The cleanup command will fail to remove the deferred directory because rm requires the -r flag for directories.
File:
dist/claude/skills/parallel-split/SKILL.md (342-342)
🛠️ A suggested code correction is included in the review comments.🐞 Bug - Using literal template syntax in a grep pattern that expects actual values causes cleanup to fail silently 🛠️
Details: The grep pattern uses literal angle brackets "<feature_short>" that won't match actual worktree paths after variable substitution.
File:
dist/claude/skills/parallel-split/SKILL.md (341-341)
🛠️ A suggested code correction is included in the review comments.🧹 Maintainability - Critical git operations without error handling can leave the system in an inconsistent state with partial worktree setup
Details: The git worktree add command has no error handling instructions. If the branch already exists or the path conflicts, the script continues without detection.
File:dist/claude/skills/parallel-split/SKILL.md (84-84)🐞 Bug - Unquoted shell variables break when paths contain spaces or special characters
Details: Shell variables in worktree paths are not quoted, which will cause failures if PROJECT_NAME or FEATURE_SHORT contain spaces or special characters.
File:dist/claude/skills/parallel-split/SKILL.md (78-84)🧾 Readability - Ambiguous placeholder replacement instructions can lead to inconsistent PROMPT.md generation across worktrees
Details: Step 3D instructs to replace placeholders in territory-protocol.md but doesn't specify the output format for the territory data (e.g., whether OWNED_FILES should be a markdown list, JSON array, or plain text list).
File:dist/claude/skills/parallel-split/SKILL.md (124-124)
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Review using Guidelines Learn how
|
|
||
| 5. Clean up: | ||
| git worktree list | grep "<feature_short>.*wt" | awk '{print $1}' | xargs -I {} git worktree remove {} | ||
| rm territory_map.json _deferred/ 2>/dev/null |
There was a problem hiding this comment.
🐞 Bug - Broken Cleanup: Change rm territory_map.json _deferred/ 2>/dev/null to rm -f territory_map.json; [ -d _deferred ] && rm -rf _deferred
| rm territory_map.json _deferred/ 2>/dev/null | |
| rm -f territory_map.json; [ -d _deferred ] && rm -rf _deferred |
Is this review accurate? Use 👍 or 👎 to rate it
If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over
| If some tasks are still [ ], stay in implement and continue from there | ||
|
|
||
| 5. Clean up: | ||
| git worktree list | grep "<feature_short>.*wt" | awk '{print $1}' | xargs -I {} git worktree remove {} |
There was a problem hiding this comment.
🐞 Bug - Literal Template: Replace the literal string "<feature_short>" with proper variable reference or provide clear instructions that this placeholder must be replaced with the actual feature_short value before execution.
| git worktree list | grep "<feature_short>.*wt" | awk '{print $1}' | xargs -I {} git worktree remove {} | |
| git worktree list | grep "${FEATURE_SHORT}.*wt" | awk '{print $1}' | xargs -I {} git worktree remove {} |
Is this review accurate? Use 👍 or 👎 to rate it
If you want to tell us more, use /gs feedback e.g. /gs feedback this review doesn't make sense, I disagree, and it keeps repeating over and over
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
No description provided.