| 124 | } |
| 125 | |
| 126 | function cleanupScopeClaims(worktreeName) { |
| 127 | if (!worktreeName) return; |
| 128 | try { |
| 129 | const claimsDir = path.join(PROJECT_ROOT, '.planning', 'coordination', 'claims'); |
| 130 | if (!fs.existsSync(claimsDir)) return; |
| 131 | const files = fs.readdirSync(claimsDir); |
| 132 | for (const file of files) { |
| 133 | // Claims named after the worktree or agent |
| 134 | if (file.includes(worktreeName)) { |
| 135 | fs.unlinkSync(path.join(claimsDir, file)); |
| 136 | } |
| 137 | } |
| 138 | } catch { /* non-critical */ } |
| 139 | } |
| 140 | |
| 141 | function updateFleetSession(worktreeName, branch) { |
| 142 | if (!worktreeName && !branch) return; |