lite-kits 0.1.1__py3-none-any.whl → 0.3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lite_kits/__init__.py +56 -4
- lite_kits/cli.py +782 -189
- lite_kits/core/__init__.py +6 -0
- lite_kits/core/banner.py +1 -1
- lite_kits/core/conflict_checker.py +115 -0
- lite_kits/core/detector.py +177 -0
- lite_kits/core/installer.py +242 -351
- lite_kits/core/manifest.py +146 -146
- lite_kits/core/validator.py +183 -0
- lite_kits/kits/README.md +6 -6
- lite_kits/kits/dev/README.md +241 -241
- lite_kits/kits/dev/{claude/commands → commands/.claude}/audit.md +143 -143
- lite_kits/kits/dev/{claude/commands → commands/.claude}/cleanup.md +2 -2
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/commit.md +2 -2
- lite_kits/kits/{project/claude/commands → dev/commands/.claude}/orient.md +3 -4
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/pr.md +1 -1
- lite_kits/kits/{git/claude/commands → dev/commands/.claude}/review.md +202 -202
- lite_kits/kits/{project/claude/commands → dev/commands/.claude}/stats.md +162 -162
- lite_kits/kits/{project/github/prompts → dev/commands/.github}/audit.prompt.md +143 -143
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/cleanup.prompt.md +2 -2
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/commit.prompt.md +2 -2
- lite_kits/kits/dev/{github/prompts → commands/.github}/orient.prompt.md +3 -4
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/pr.prompt.md +1 -1
- lite_kits/kits/{git/github/prompts → dev/commands/.github}/review.prompt.md +202 -202
- lite_kits/kits/dev/{github/prompts → commands/.github}/stats.prompt.md +163 -163
- lite_kits/kits/kits.yaml +497 -180
- lite_kits/kits/multiagent/README.md +6 -6
- lite_kits/kits/multiagent/{claude/commands → commands/.claude}/sync.md +331 -331
- lite_kits/kits/multiagent/{github/prompts → commands/.github}/sync.prompt.md +73 -69
- lite_kits/kits/multiagent/memory/git-worktrees-protocol.md +370 -370
- lite_kits/kits/multiagent/memory/parallel-work-protocol.md +536 -536
- lite_kits/kits/multiagent/memory/pr-workflow-guide.md +275 -275
- lite_kits/kits/multiagent/templates/collaboration-structure/README.md +166 -166
- lite_kits/kits/multiagent/templates/decision.md +79 -79
- lite_kits/kits/multiagent/templates/handoff.md +95 -95
- lite_kits/kits/multiagent/templates/session-log.md +68 -68
- lite_kits-0.3.2.dist-info/METADATA +259 -0
- lite_kits-0.3.2.dist-info/RECORD +41 -0
- {lite_kits-0.1.1.dist-info → lite_kits-0.3.2.dist-info}/licenses/LICENSE +21 -21
- lite_kits/kits/dev/claude/commands/commit.md +0 -612
- lite_kits/kits/dev/claude/commands/orient.md +0 -146
- lite_kits/kits/dev/claude/commands/pr.md +0 -593
- lite_kits/kits/dev/claude/commands/review.md +0 -202
- lite_kits/kits/dev/claude/commands/stats.md +0 -162
- lite_kits/kits/dev/github/prompts/audit.prompt.md +0 -143
- lite_kits/kits/dev/github/prompts/cleanup.prompt.md +0 -382
- lite_kits/kits/dev/github/prompts/commit.prompt.md +0 -591
- lite_kits/kits/dev/github/prompts/pr.prompt.md +0 -603
- lite_kits/kits/dev/github/prompts/review.prompt.md +0 -202
- lite_kits/kits/git/README.md +0 -365
- lite_kits/kits/git/claude/commands/cleanup.md +0 -361
- lite_kits/kits/git/scripts/bash/get-git-context.sh +0 -208
- lite_kits/kits/git/scripts/powershell/Get-GitContext.ps1 +0 -242
- lite_kits/kits/project/README.md +0 -228
- lite_kits/kits/project/claude/commands/audit.md +0 -143
- lite_kits/kits/project/claude/commands/review.md +0 -112
- lite_kits/kits/project/github/prompts/orient.prompt.md +0 -150
- lite_kits/kits/project/github/prompts/review.prompt.md +0 -112
- lite_kits/kits/project/github/prompts/stats.prompt.md +0 -163
- lite_kits-0.1.1.dist-info/METADATA +0 -447
- lite_kits-0.1.1.dist-info/RECORD +0 -58
- {lite_kits-0.1.1.dist-info → lite_kits-0.3.2.dist-info}/WHEEL +0 -0
- {lite_kits-0.1.1.dist-info → lite_kits-0.3.2.dist-info}/entry_points.txt +0 -0
@@ -1,370 +1,370 @@
|
|
1
|
-
# Git Worktrees Protocol for Multi-Agent Development
|
2
|
-
|
3
|
-
**Version**: 1.0.0
|
4
|
-
**Last Updated**: 2025-10-06
|
5
|
-
|
6
|
-
## Purpose
|
7
|
-
|
8
|
-
Enable multiple AI agents to work on different aspects of the same feature simultaneously using git worktrees, avoiding merge conflicts and coordination overhead.
|
9
|
-
|
10
|
-
## What Are Git Worktrees?
|
11
|
-
|
12
|
-
Git worktrees allow multiple working directories from a single repository:
|
13
|
-
- Each worktree is a separate checkout
|
14
|
-
- All worktrees share the same .git database
|
15
|
-
- Changes in one worktree don't affect others until pushed
|
16
|
-
|
17
|
-
## When to Use Worktrees
|
18
|
-
|
19
|
-
**Use worktrees when**:
|
20
|
-
- Multiple agents working on same feature simultaneously
|
21
|
-
- Frontend + backend split work
|
22
|
-
- Independent file sets with no overlap
|
23
|
-
- Testing different approaches in parallel
|
24
|
-
|
25
|
-
**Don't use worktrees when**:
|
26
|
-
- Single agent working alone
|
27
|
-
- Sequential work (use normal git workflow)
|
28
|
-
- Frequent file overlap (high merge conflict risk)
|
29
|
-
|
30
|
-
## Basic Worktree Workflow
|
31
|
-
|
32
|
-
### Setup: Create Worktrees
|
33
|
-
|
34
|
-
**Agent 1 (Claude Code)** - Backend work:
|
35
|
-
```bash
|
36
|
-
# From main repository
|
37
|
-
git worktree add ../feature-auth-backend 003-user-auth
|
38
|
-
|
39
|
-
# This creates:
|
40
|
-
# - New directory: ../feature-auth-backend
|
41
|
-
# - Checked out to branch: 003-user-auth
|
42
|
-
# - Ready for backend work
|
43
|
-
|
44
|
-
cd ../feature-auth-backend
|
45
|
-
# Work on backend files here
|
46
|
-
```
|
47
|
-
|
48
|
-
**Agent 2 (Copilot)** - Frontend work:
|
49
|
-
```bash
|
50
|
-
# From main repository
|
51
|
-
git worktree add ../feature-auth-frontend 003-user-auth
|
52
|
-
|
53
|
-
cd ../feature-auth-frontend
|
54
|
-
# Work on frontend files here
|
55
|
-
```
|
56
|
-
|
57
|
-
### Working: Independent Development
|
58
|
-
|
59
|
-
Each agent works in their own worktree:
|
60
|
-
|
61
|
-
```bash
|
62
|
-
# Agent 1: Backend
|
63
|
-
cd ../feature-auth-backend
|
64
|
-
# Edit src/auth.py, src/models.py
|
65
|
-
git add src/auth.py src/models.py
|
66
|
-
git commit -m "feat: Add authentication backend
|
67
|
-
|
68
|
-
via claude-sonnet-4.5 @ claude-code"
|
69
|
-
git push origin 003-user-auth
|
70
|
-
```
|
71
|
-
|
72
|
-
```bash
|
73
|
-
# Agent 2: Frontend (in parallel)
|
74
|
-
cd ../feature-auth-frontend
|
75
|
-
# Edit src/components/LoginForm.tsx
|
76
|
-
git add src/components/LoginForm.tsx
|
77
|
-
git commit -m "feat: Add login form component
|
78
|
-
|
79
|
-
via gpt-4 @ github-copilot-cli"
|
80
|
-
git push origin 003-user-auth
|
81
|
-
```
|
82
|
-
|
83
|
-
### Synchronization: Pull Changes
|
84
|
-
|
85
|
-
Each agent periodically pulls others' work:
|
86
|
-
|
87
|
-
```bash
|
88
|
-
# Agent 1: Get frontend changes
|
89
|
-
cd ../feature-auth-backend
|
90
|
-
git pull origin 003-user-auth
|
91
|
-
|
92
|
-
# Agent 2: Get backend changes
|
93
|
-
cd ../feature-auth-frontend
|
94
|
-
git pull origin 003-user-auth
|
95
|
-
```
|
96
|
-
|
97
|
-
### Cleanup: Remove Worktrees
|
98
|
-
|
99
|
-
When work is complete:
|
100
|
-
|
101
|
-
```bash
|
102
|
-
# Remove worktree (from main repo)
|
103
|
-
cd /path/to/main/repo
|
104
|
-
git worktree remove ../feature-auth-backend
|
105
|
-
git worktree remove ../feature-auth-frontend
|
106
|
-
|
107
|
-
# Or if worktrees already deleted:
|
108
|
-
git worktree prune
|
109
|
-
```
|
110
|
-
|
111
|
-
## Advanced Patterns
|
112
|
-
|
113
|
-
### Pattern 1: Component Isolation
|
114
|
-
|
115
|
-
**Scenario**: Split large feature by components
|
116
|
-
|
117
|
-
```bash
|
118
|
-
# Agent 1: Database layer
|
119
|
-
git worktree add ../feature-db 005-ecommerce
|
120
|
-
cd ../feature-db
|
121
|
-
# Work on: src/database/, migrations/
|
122
|
-
|
123
|
-
# Agent 2: API layer
|
124
|
-
git worktree add ../feature-api 005-ecommerce
|
125
|
-
cd ../feature-api
|
126
|
-
# Work on: src/api/, src/routes/
|
127
|
-
|
128
|
-
# Agent 3: Tests
|
129
|
-
git worktree add ../feature-tests 005-ecommerce
|
130
|
-
cd ../feature-tests
|
131
|
-
# Work on: tests/
|
132
|
-
```
|
133
|
-
|
134
|
-
### Pattern 2: Experimental Branches
|
135
|
-
|
136
|
-
**Scenario**: Try different approaches simultaneously
|
137
|
-
|
138
|
-
```bash
|
139
|
-
# Approach A: REST API
|
140
|
-
git worktree add ../feature-rest 006-api
|
141
|
-
cd ../feature-rest
|
142
|
-
# Implement REST endpoints
|
143
|
-
|
144
|
-
# Approach B: GraphQL
|
145
|
-
git worktree add ../feature-graphql 006-api
|
146
|
-
cd ../feature-graphql
|
147
|
-
# Implement GraphQL schema
|
148
|
-
|
149
|
-
# Later: Merge winning approach back
|
150
|
-
```
|
151
|
-
|
152
|
-
### Pattern 3: Review + Fix
|
153
|
-
|
154
|
-
**Scenario**: One agent reviews while another implements
|
155
|
-
|
156
|
-
```bash
|
157
|
-
# Agent 1: Continue implementing
|
158
|
-
git worktree add ../feature-impl 007-feature
|
159
|
-
cd ../feature-impl
|
160
|
-
# Keep coding...
|
161
|
-
|
162
|
-
# Agent 2: Review previous work
|
163
|
-
git worktree add ../feature-review 007-feature
|
164
|
-
cd ../feature-review
|
165
|
-
# Read code, test, create review notes in collaboration/
|
166
|
-
```
|
167
|
-
|
168
|
-
## Collaboration Directory Integration
|
169
|
-
|
170
|
-
### Session Tracking
|
171
|
-
|
172
|
-
Each worktree session should be logged:
|
173
|
-
|
174
|
-
```markdown
|
175
|
-
# collaboration/active/sessions/2025-10-06-claude-backend-worktree.md
|
176
|
-
|
177
|
-
## Worktree Session: Backend Development
|
178
|
-
|
179
|
-
**Agent**: Claude Code (claude-sonnet-4.5)
|
180
|
-
**Worktree**: ../feature-auth-backend
|
181
|
-
**Branch**: 003-user-auth
|
182
|
-
**Start**: 2025-10-06 14:00
|
183
|
-
**End**: 2025-10-06 16:30
|
184
|
-
|
185
|
-
### Work Completed
|
186
|
-
- Implemented authentication logic
|
187
|
-
- Added password hashing
|
188
|
-
- Created session management
|
189
|
-
|
190
|
-
### Commits
|
191
|
-
- a1b2c3d: feat: Add authentication backend
|
192
|
-
- d4e5f6g: feat: Add session management
|
193
|
-
|
194
|
-
### Synchronized With
|
195
|
-
- Pulled frontend changes at 15:00 (commit h7i8j9k)
|
196
|
-
- No merge conflicts
|
197
|
-
|
198
|
-
### Status
|
199
|
-
Ready for integration testing with frontend
|
200
|
-
```
|
201
|
-
|
202
|
-
### Handoff Documents
|
203
|
-
|
204
|
-
Create handoffs between worktree agents:
|
205
|
-
|
206
|
-
```markdown
|
207
|
-
# collaboration/active/decisions/worktree-handoff.md
|
208
|
-
|
209
|
-
## Worktree Coordination
|
210
|
-
|
211
|
-
### Active Worktrees
|
212
|
-
|
213
|
-
| Agent | Worktree | Focus Area | Last Push |
|
214
|
-
|-------|----------|------------|-----------|
|
215
|
-
| Claude Code | feature-auth-backend | Backend API | 16:30 |
|
216
|
-
| Copilot CLI | feature-auth-frontend | React components | 16:15 |
|
217
|
-
|
218
|
-
### File Territory (Avoid Conflicts)
|
219
|
-
|
220
|
-
**Backend worktree** owns:
|
221
|
-
- src/auth.py
|
222
|
-
- src/models.py
|
223
|
-
- src/database/
|
224
|
-
- tests/test_auth.py
|
225
|
-
|
226
|
-
**Frontend worktree** owns:
|
227
|
-
- src/components/LoginForm.tsx
|
228
|
-
- src/components/ProtectedRoute.tsx
|
229
|
-
- src/hooks/useAuth.ts
|
230
|
-
- tests/components/LoginForm.test.tsx
|
231
|
-
|
232
|
-
**Shared** (coordinate before editing):
|
233
|
-
- README.md
|
234
|
-
- package.json / requirements.txt
|
235
|
-
- specs/003-user-auth/
|
236
|
-
|
237
|
-
### Merge Strategy
|
238
|
-
Both agents push to `003-user-auth` branch.
|
239
|
-
Final merge to main after both complete + integration tests pass.
|
240
|
-
```
|
241
|
-
|
242
|
-
## Best Practices
|
243
|
-
|
244
|
-
### DO:
|
245
|
-
- ✅ Create worktrees in sibling directories (`../feature-*`)
|
246
|
-
- ✅ Use descriptive worktree directory names
|
247
|
-
- ✅ Pull frequently to stay synchronized
|
248
|
-
- ✅ Document worktree sessions in collaboration/
|
249
|
-
- ✅ Define clear file territories to avoid conflicts
|
250
|
-
- ✅ Clean up worktrees when done
|
251
|
-
|
252
|
-
### DON'T:
|
253
|
-
- ❌ Create worktrees inside existing worktrees (nested)
|
254
|
-
- ❌ Edit same files in multiple worktrees simultaneously
|
255
|
-
- ❌ Forget to push before switching context
|
256
|
-
- ❌ Leave stale worktrees around (prune regularly)
|
257
|
-
- ❌ Use worktrees for simple sequential work
|
258
|
-
|
259
|
-
## Troubleshooting
|
260
|
-
|
261
|
-
### Problem: "Branch already checked out"
|
262
|
-
|
263
|
-
**Symptom**: Can't create worktree for a branch already checked out
|
264
|
-
|
265
|
-
**Solution**:
|
266
|
-
```bash
|
267
|
-
# Option 1: Use same branch in multiple worktrees (advanced)
|
268
|
-
git worktree add --detach ../feature-copy
|
269
|
-
cd ../feature-copy
|
270
|
-
git checkout 003-user-auth
|
271
|
-
|
272
|
-
# Option 2: Create from commit instead
|
273
|
-
git worktree add ../feature-copy abc123
|
274
|
-
```
|
275
|
-
|
276
|
-
### Problem: Merge conflicts between worktrees
|
277
|
-
|
278
|
-
**Symptom**: Pull fails with conflicts
|
279
|
-
|
280
|
-
**Solution**:
|
281
|
-
```bash
|
282
|
-
# In worktree with conflict
|
283
|
-
git pull origin 003-user-auth
|
284
|
-
# Resolve conflicts manually
|
285
|
-
git add .
|
286
|
-
git commit -m "merge: Resolve conflicts from other worktree
|
287
|
-
|
288
|
-
via claude-sonnet-4.5 @ claude-code"
|
289
|
-
git push origin 003-user-auth
|
290
|
-
```
|
291
|
-
|
292
|
-
### Problem: Can't remove worktree (locked)
|
293
|
-
|
294
|
-
**Symptom**: `git worktree remove` fails
|
295
|
-
|
296
|
-
**Solution**:
|
297
|
-
```bash
|
298
|
-
# Force remove (if directory deleted manually)
|
299
|
-
git worktree remove --force ../feature-old
|
300
|
-
|
301
|
-
# Or prune all stale worktrees
|
302
|
-
git worktree prune
|
303
|
-
```
|
304
|
-
|
305
|
-
### Problem: Lost track of worktrees
|
306
|
-
|
307
|
-
**Symptom**: Don't remember what worktrees exist
|
308
|
-
|
309
|
-
**Solution**:
|
310
|
-
```bash
|
311
|
-
# List all worktrees
|
312
|
-
git worktree list
|
313
|
-
|
314
|
-
# Example output:
|
315
|
-
# /path/to/main/repo abc123 [003-user-auth]
|
316
|
-
# /path/to/feature-auth-backend def456 [003-user-auth]
|
317
|
-
# /path/to/feature-auth-frontend ghi789 [003-user-auth]
|
318
|
-
```
|
319
|
-
|
320
|
-
## Integration with lite-kits
|
321
|
-
|
322
|
-
### Check Worktree Status
|
323
|
-
|
324
|
-
```bash
|
325
|
-
# From main repo
|
326
|
-
lite-kits status
|
327
|
-
|
328
|
-
# Output should show active worktrees (TODO: implement)
|
329
|
-
# Worktrees:
|
330
|
-
# ✓ ../feature-auth-backend (claude-code, last commit 2h ago)
|
331
|
-
# ✓ ../feature-auth-frontend (copilot, last commit 30m ago)
|
332
|
-
```
|
333
|
-
|
334
|
-
### Validate Worktree Collaboration
|
335
|
-
|
336
|
-
```bash
|
337
|
-
# Ensure collaboration docs exist for each worktree
|
338
|
-
lite-kits validate
|
339
|
-
|
340
|
-
# Checks:
|
341
|
-
# - Session logs for each worktree
|
342
|
-
# - File territory definitions
|
343
|
-
# - No conflicting edits
|
344
|
-
```
|
345
|
-
|
346
|
-
## Quick Reference
|
347
|
-
|
348
|
-
```bash
|
349
|
-
# Create worktree
|
350
|
-
git worktree add <path> <branch>
|
351
|
-
|
352
|
-
# List worktrees
|
353
|
-
git worktree list
|
354
|
-
|
355
|
-
# Remove worktree
|
356
|
-
git worktree remove <path>
|
357
|
-
|
358
|
-
# Clean up stale worktrees
|
359
|
-
git worktree prune
|
360
|
-
|
361
|
-
# Move worktree (manual)
|
362
|
-
mv <old-path> <new-path>
|
363
|
-
git worktree repair <new-path>
|
364
|
-
```
|
365
|
-
|
366
|
-
## Resources
|
367
|
-
|
368
|
-
- Git worktree docs: https://git-scm.com/docs/git-worktree
|
369
|
-
- Parallel development patterns: https://github.blog/2015-07-29-git-2-5-including-multiple-worktrees-and-triangular-workflows/
|
370
|
-
- Multi-agent coordination: [pr-workflow-guide.md](./pr-workflow-guide.md)
|
1
|
+
# Git Worktrees Protocol for Multi-Agent Development
|
2
|
+
|
3
|
+
**Version**: 1.0.0
|
4
|
+
**Last Updated**: 2025-10-06
|
5
|
+
|
6
|
+
## Purpose
|
7
|
+
|
8
|
+
Enable multiple AI agents to work on different aspects of the same feature simultaneously using git worktrees, avoiding merge conflicts and coordination overhead.
|
9
|
+
|
10
|
+
## What Are Git Worktrees?
|
11
|
+
|
12
|
+
Git worktrees allow multiple working directories from a single repository:
|
13
|
+
- Each worktree is a separate checkout
|
14
|
+
- All worktrees share the same .git database
|
15
|
+
- Changes in one worktree don't affect others until pushed
|
16
|
+
|
17
|
+
## When to Use Worktrees
|
18
|
+
|
19
|
+
**Use worktrees when**:
|
20
|
+
- Multiple agents working on same feature simultaneously
|
21
|
+
- Frontend + backend split work
|
22
|
+
- Independent file sets with no overlap
|
23
|
+
- Testing different approaches in parallel
|
24
|
+
|
25
|
+
**Don't use worktrees when**:
|
26
|
+
- Single agent working alone
|
27
|
+
- Sequential work (use normal git workflow)
|
28
|
+
- Frequent file overlap (high merge conflict risk)
|
29
|
+
|
30
|
+
## Basic Worktree Workflow
|
31
|
+
|
32
|
+
### Setup: Create Worktrees
|
33
|
+
|
34
|
+
**Agent 1 (Claude Code)** - Backend work:
|
35
|
+
```bash
|
36
|
+
# From main repository
|
37
|
+
git worktree add ../feature-auth-backend 003-user-auth
|
38
|
+
|
39
|
+
# This creates:
|
40
|
+
# - New directory: ../feature-auth-backend
|
41
|
+
# - Checked out to branch: 003-user-auth
|
42
|
+
# - Ready for backend work
|
43
|
+
|
44
|
+
cd ../feature-auth-backend
|
45
|
+
# Work on backend files here
|
46
|
+
```
|
47
|
+
|
48
|
+
**Agent 2 (Copilot)** - Frontend work:
|
49
|
+
```bash
|
50
|
+
# From main repository
|
51
|
+
git worktree add ../feature-auth-frontend 003-user-auth
|
52
|
+
|
53
|
+
cd ../feature-auth-frontend
|
54
|
+
# Work on frontend files here
|
55
|
+
```
|
56
|
+
|
57
|
+
### Working: Independent Development
|
58
|
+
|
59
|
+
Each agent works in their own worktree:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
# Agent 1: Backend
|
63
|
+
cd ../feature-auth-backend
|
64
|
+
# Edit src/auth.py, src/models.py
|
65
|
+
git add src/auth.py src/models.py
|
66
|
+
git commit -m "feat: Add authentication backend
|
67
|
+
|
68
|
+
via claude-sonnet-4.5 @ claude-code"
|
69
|
+
git push origin 003-user-auth
|
70
|
+
```
|
71
|
+
|
72
|
+
```bash
|
73
|
+
# Agent 2: Frontend (in parallel)
|
74
|
+
cd ../feature-auth-frontend
|
75
|
+
# Edit src/components/LoginForm.tsx
|
76
|
+
git add src/components/LoginForm.tsx
|
77
|
+
git commit -m "feat: Add login form component
|
78
|
+
|
79
|
+
via gpt-4 @ github-copilot-cli"
|
80
|
+
git push origin 003-user-auth
|
81
|
+
```
|
82
|
+
|
83
|
+
### Synchronization: Pull Changes
|
84
|
+
|
85
|
+
Each agent periodically pulls others' work:
|
86
|
+
|
87
|
+
```bash
|
88
|
+
# Agent 1: Get frontend changes
|
89
|
+
cd ../feature-auth-backend
|
90
|
+
git pull origin 003-user-auth
|
91
|
+
|
92
|
+
# Agent 2: Get backend changes
|
93
|
+
cd ../feature-auth-frontend
|
94
|
+
git pull origin 003-user-auth
|
95
|
+
```
|
96
|
+
|
97
|
+
### Cleanup: Remove Worktrees
|
98
|
+
|
99
|
+
When work is complete:
|
100
|
+
|
101
|
+
```bash
|
102
|
+
# Remove worktree (from main repo)
|
103
|
+
cd /path/to/main/repo
|
104
|
+
git worktree remove ../feature-auth-backend
|
105
|
+
git worktree remove ../feature-auth-frontend
|
106
|
+
|
107
|
+
# Or if worktrees already deleted:
|
108
|
+
git worktree prune
|
109
|
+
```
|
110
|
+
|
111
|
+
## Advanced Patterns
|
112
|
+
|
113
|
+
### Pattern 1: Component Isolation
|
114
|
+
|
115
|
+
**Scenario**: Split large feature by components
|
116
|
+
|
117
|
+
```bash
|
118
|
+
# Agent 1: Database layer
|
119
|
+
git worktree add ../feature-db 005-ecommerce
|
120
|
+
cd ../feature-db
|
121
|
+
# Work on: src/database/, migrations/
|
122
|
+
|
123
|
+
# Agent 2: API layer
|
124
|
+
git worktree add ../feature-api 005-ecommerce
|
125
|
+
cd ../feature-api
|
126
|
+
# Work on: src/api/, src/routes/
|
127
|
+
|
128
|
+
# Agent 3: Tests
|
129
|
+
git worktree add ../feature-tests 005-ecommerce
|
130
|
+
cd ../feature-tests
|
131
|
+
# Work on: tests/
|
132
|
+
```
|
133
|
+
|
134
|
+
### Pattern 2: Experimental Branches
|
135
|
+
|
136
|
+
**Scenario**: Try different approaches simultaneously
|
137
|
+
|
138
|
+
```bash
|
139
|
+
# Approach A: REST API
|
140
|
+
git worktree add ../feature-rest 006-api
|
141
|
+
cd ../feature-rest
|
142
|
+
# Implement REST endpoints
|
143
|
+
|
144
|
+
# Approach B: GraphQL
|
145
|
+
git worktree add ../feature-graphql 006-api
|
146
|
+
cd ../feature-graphql
|
147
|
+
# Implement GraphQL schema
|
148
|
+
|
149
|
+
# Later: Merge winning approach back
|
150
|
+
```
|
151
|
+
|
152
|
+
### Pattern 3: Review + Fix
|
153
|
+
|
154
|
+
**Scenario**: One agent reviews while another implements
|
155
|
+
|
156
|
+
```bash
|
157
|
+
# Agent 1: Continue implementing
|
158
|
+
git worktree add ../feature-impl 007-feature
|
159
|
+
cd ../feature-impl
|
160
|
+
# Keep coding...
|
161
|
+
|
162
|
+
# Agent 2: Review previous work
|
163
|
+
git worktree add ../feature-review 007-feature
|
164
|
+
cd ../feature-review
|
165
|
+
# Read code, test, create review notes in collaboration/
|
166
|
+
```
|
167
|
+
|
168
|
+
## Collaboration Directory Integration
|
169
|
+
|
170
|
+
### Session Tracking
|
171
|
+
|
172
|
+
Each worktree session should be logged:
|
173
|
+
|
174
|
+
```markdown
|
175
|
+
# collaboration/active/sessions/2025-10-06-claude-backend-worktree.md
|
176
|
+
|
177
|
+
## Worktree Session: Backend Development
|
178
|
+
|
179
|
+
**Agent**: Claude Code (claude-sonnet-4.5)
|
180
|
+
**Worktree**: ../feature-auth-backend
|
181
|
+
**Branch**: 003-user-auth
|
182
|
+
**Start**: 2025-10-06 14:00
|
183
|
+
**End**: 2025-10-06 16:30
|
184
|
+
|
185
|
+
### Work Completed
|
186
|
+
- Implemented authentication logic
|
187
|
+
- Added password hashing
|
188
|
+
- Created session management
|
189
|
+
|
190
|
+
### Commits
|
191
|
+
- a1b2c3d: feat: Add authentication backend
|
192
|
+
- d4e5f6g: feat: Add session management
|
193
|
+
|
194
|
+
### Synchronized With
|
195
|
+
- Pulled frontend changes at 15:00 (commit h7i8j9k)
|
196
|
+
- No merge conflicts
|
197
|
+
|
198
|
+
### Status
|
199
|
+
Ready for integration testing with frontend
|
200
|
+
```
|
201
|
+
|
202
|
+
### Handoff Documents
|
203
|
+
|
204
|
+
Create handoffs between worktree agents:
|
205
|
+
|
206
|
+
```markdown
|
207
|
+
# collaboration/active/decisions/worktree-handoff.md
|
208
|
+
|
209
|
+
## Worktree Coordination
|
210
|
+
|
211
|
+
### Active Worktrees
|
212
|
+
|
213
|
+
| Agent | Worktree | Focus Area | Last Push |
|
214
|
+
|-------|----------|------------|-----------|
|
215
|
+
| Claude Code | feature-auth-backend | Backend API | 16:30 |
|
216
|
+
| Copilot CLI | feature-auth-frontend | React components | 16:15 |
|
217
|
+
|
218
|
+
### File Territory (Avoid Conflicts)
|
219
|
+
|
220
|
+
**Backend worktree** owns:
|
221
|
+
- src/auth.py
|
222
|
+
- src/models.py
|
223
|
+
- src/database/
|
224
|
+
- tests/test_auth.py
|
225
|
+
|
226
|
+
**Frontend worktree** owns:
|
227
|
+
- src/components/LoginForm.tsx
|
228
|
+
- src/components/ProtectedRoute.tsx
|
229
|
+
- src/hooks/useAuth.ts
|
230
|
+
- tests/components/LoginForm.test.tsx
|
231
|
+
|
232
|
+
**Shared** (coordinate before editing):
|
233
|
+
- README.md
|
234
|
+
- package.json / requirements.txt
|
235
|
+
- specs/003-user-auth/
|
236
|
+
|
237
|
+
### Merge Strategy
|
238
|
+
Both agents push to `003-user-auth` branch.
|
239
|
+
Final merge to main after both complete + integration tests pass.
|
240
|
+
```
|
241
|
+
|
242
|
+
## Best Practices
|
243
|
+
|
244
|
+
### DO:
|
245
|
+
- ✅ Create worktrees in sibling directories (`../feature-*`)
|
246
|
+
- ✅ Use descriptive worktree directory names
|
247
|
+
- ✅ Pull frequently to stay synchronized
|
248
|
+
- ✅ Document worktree sessions in collaboration/
|
249
|
+
- ✅ Define clear file territories to avoid conflicts
|
250
|
+
- ✅ Clean up worktrees when done
|
251
|
+
|
252
|
+
### DON'T:
|
253
|
+
- ❌ Create worktrees inside existing worktrees (nested)
|
254
|
+
- ❌ Edit same files in multiple worktrees simultaneously
|
255
|
+
- ❌ Forget to push before switching context
|
256
|
+
- ❌ Leave stale worktrees around (prune regularly)
|
257
|
+
- ❌ Use worktrees for simple sequential work
|
258
|
+
|
259
|
+
## Troubleshooting
|
260
|
+
|
261
|
+
### Problem: "Branch already checked out"
|
262
|
+
|
263
|
+
**Symptom**: Can't create worktree for a branch already checked out
|
264
|
+
|
265
|
+
**Solution**:
|
266
|
+
```bash
|
267
|
+
# Option 1: Use same branch in multiple worktrees (advanced)
|
268
|
+
git worktree add --detach ../feature-copy
|
269
|
+
cd ../feature-copy
|
270
|
+
git checkout 003-user-auth
|
271
|
+
|
272
|
+
# Option 2: Create from commit instead
|
273
|
+
git worktree add ../feature-copy abc123
|
274
|
+
```
|
275
|
+
|
276
|
+
### Problem: Merge conflicts between worktrees
|
277
|
+
|
278
|
+
**Symptom**: Pull fails with conflicts
|
279
|
+
|
280
|
+
**Solution**:
|
281
|
+
```bash
|
282
|
+
# In worktree with conflict
|
283
|
+
git pull origin 003-user-auth
|
284
|
+
# Resolve conflicts manually
|
285
|
+
git add .
|
286
|
+
git commit -m "merge: Resolve conflicts from other worktree
|
287
|
+
|
288
|
+
via claude-sonnet-4.5 @ claude-code"
|
289
|
+
git push origin 003-user-auth
|
290
|
+
```
|
291
|
+
|
292
|
+
### Problem: Can't remove worktree (locked)
|
293
|
+
|
294
|
+
**Symptom**: `git worktree remove` fails
|
295
|
+
|
296
|
+
**Solution**:
|
297
|
+
```bash
|
298
|
+
# Force remove (if directory deleted manually)
|
299
|
+
git worktree remove --force ../feature-old
|
300
|
+
|
301
|
+
# Or prune all stale worktrees
|
302
|
+
git worktree prune
|
303
|
+
```
|
304
|
+
|
305
|
+
### Problem: Lost track of worktrees
|
306
|
+
|
307
|
+
**Symptom**: Don't remember what worktrees exist
|
308
|
+
|
309
|
+
**Solution**:
|
310
|
+
```bash
|
311
|
+
# List all worktrees
|
312
|
+
git worktree list
|
313
|
+
|
314
|
+
# Example output:
|
315
|
+
# /path/to/main/repo abc123 [003-user-auth]
|
316
|
+
# /path/to/feature-auth-backend def456 [003-user-auth]
|
317
|
+
# /path/to/feature-auth-frontend ghi789 [003-user-auth]
|
318
|
+
```
|
319
|
+
|
320
|
+
## Integration with lite-kits
|
321
|
+
|
322
|
+
### Check Worktree Status
|
323
|
+
|
324
|
+
```bash
|
325
|
+
# From main repo
|
326
|
+
lite-kits status
|
327
|
+
|
328
|
+
# Output should show active worktrees (TODO: implement)
|
329
|
+
# Worktrees:
|
330
|
+
# ✓ ../feature-auth-backend (claude-code, last commit 2h ago)
|
331
|
+
# ✓ ../feature-auth-frontend (copilot, last commit 30m ago)
|
332
|
+
```
|
333
|
+
|
334
|
+
### Validate Worktree Collaboration
|
335
|
+
|
336
|
+
```bash
|
337
|
+
# Ensure collaboration docs exist for each worktree
|
338
|
+
lite-kits validate
|
339
|
+
|
340
|
+
# Checks:
|
341
|
+
# - Session logs for each worktree
|
342
|
+
# - File territory definitions
|
343
|
+
# - No conflicting edits
|
344
|
+
```
|
345
|
+
|
346
|
+
## Quick Reference
|
347
|
+
|
348
|
+
```bash
|
349
|
+
# Create worktree
|
350
|
+
git worktree add <path> <branch>
|
351
|
+
|
352
|
+
# List worktrees
|
353
|
+
git worktree list
|
354
|
+
|
355
|
+
# Remove worktree
|
356
|
+
git worktree remove <path>
|
357
|
+
|
358
|
+
# Clean up stale worktrees
|
359
|
+
git worktree prune
|
360
|
+
|
361
|
+
# Move worktree (manual)
|
362
|
+
mv <old-path> <new-path>
|
363
|
+
git worktree repair <new-path>
|
364
|
+
```
|
365
|
+
|
366
|
+
## Resources
|
367
|
+
|
368
|
+
- Git worktree docs: https://git-scm.com/docs/git-worktree
|
369
|
+
- Parallel development patterns: https://github.blog/2015-07-29-git-2-5-including-multiple-worktrees-and-triangular-workflows/
|
370
|
+
- Multi-agent coordination: [pr-workflow-guide.md](./pr-workflow-guide.md)
|