decapod 0.47.21

Decapod is the daemonless, local-first control plane that agents call on demand to align intent, enforce boundaries, and produce proof-backed completion across concurrent multi-agent work. 🦀
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# GIT.md - Git Etiquette and Workflow Contract

**Authority:** constitutional (BINDING)
**Layer:** Constitution (Guiding Principles)
**Binding:** Yes (for all agents and operators)
**Scope:** Git operations, branching strategy, commit conventions, push policies

This document defines the mandatory git workflow and etiquette that all agents and operators must follow when working in Decapod-managed repositories.

---

## 0. Purpose

Git is the canonical state layer for all project work. Poor git hygiene leads to:
- Lost work (destructive operations without recovery)
- Merge conflicts (uncoordinated changes)
- Broken history (force pushes to shared branches)
- Unclear attribution (malformed commits)
- Deployment failures (untagged releases)

**This contract prevents these failure modes.**

---

## 1. Branch Management

### 1.0. Container Workspace Mandate

All git-tracked implementation work MUST execute in Docker-isolated git workspaces rooted at `.decapod/workspaces/*`, not by directly editing the host repository working tree (claim: `claim.git.container_workspace_required`).

Required:
- Use container workspace flows for branch creation, commits, and pushes.
- Keep host repo usage to orchestration/inspection unless explicitly authorized.
- Container runtime permission preflight MUST succeed before workspace execution; on denied access, re-run with elevated permissions instead of bypassing container mode (claim: `claim.git.container_runtime_preflight_required`).

Violation of this boundary is a git workflow contract breach.

### 1.1. Branch Naming Convention

**Required format:** `<owner>/<purpose>`

Examples:
- `ahr/work` — General development work
- `ahr/feature-policy-engine` — Specific feature branch
- `claude/fix-validation-bug` — Agent-created bug fix
- `gemini/refactor-cli` — Agent-created refactoring

**Rationale:** Clear ownership and purpose. Prevents namespace collisions.

### 1.2. Protected Branches

**NEVER force-push to:**
- `master` (or `main`)
- `production`
- `stable`
- Any branch prefixed with `release/`

**Exception:** Only force-push to `master` when explicitly instructed by the operator.

**Violation:** Force-pushing to protected branches without authorization is a contract violation.

### 1.3. Working Branch Policy

**Default:** All agent work happens in designated working branches (e.g., `ahr/work`) unless explicitly instructed otherwise.

**Rationale:** Isolates experimental work from stable branches. Allows parallel exploration without conflicts.

**Enforcement:** Agents MUST check current branch before making commits. Use `git branch --show-current` to verify.

### 1.4. Branch Lifecycle

1. **Create:** Branch from `master` (or designated base branch)
2. **Work:** Make atomic commits with clear messages
3. **Sync:** Regularly pull/rebase from base branch
4. **Review:** Create PR when ready for integration
5. **Merge:** Merge via PR (never direct push to master)
6. **Cleanup:** Delete branch after merge (optional but recommended)

---

## 2. Commit Conventions

### 2.1. Commit Message Format

**Required:** [Conventional Commits](https://www.conventionalcommits.org/) format

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

**Allowed types:**
- `feat`: New feature
- `fix`: Bug fix
- `chore`: Maintenance (dependencies, cleanup)
- `docs`: Documentation only
- `style`: Formatting, whitespace (no code change)
- `refactor`: Code restructuring (no behavior change)
- `perf`: Performance improvement
- `test`: Adding or fixing tests
- `ci`: CI/CD pipeline changes

**Examples:**
```
feat(policy): add risk classification engine
fix(validate): handle missing .decapod directory
chore: bump dependency versions
docs(README): update installation instructions
refactor(cli): consolidate command groups
```

**Enforcement:** Use `decapod setup hook --pre-commit` to install validation hook.

### 2.2. Commit Atomicity

**Rule:** One logical change per commit.

**Good:**
```
feat(todo): add priority field to task schema
test(todo): add priority field tests
docs(TODO.md): document priority field usage
```

**Bad:**
```
feat: add priority field, fix validation bug, update README
```

**Rationale:** Atomic commits enable:
- Clean reverts (undo one change without affecting others)
- Clear history (understand what changed and why)
- Bisection (find bugs via git bisect)

### 2.3. Commit Co-Authorship

**User preference:** Do NOT add AI agents as co-authors unless explicitly requested.

**Rationale:** Some operators prefer attribution to remain human-only. Respect this preference.

**How to check:** Look for aptitude preference entries like:
```bash
decapod data aptitude get --pattern commit
```

---

## 3. Push Policies

### 3.1. Standard Push

**Safe operation:** `git push` or `git push -u origin <branch>`

**When to use:**
- Pushing new commits to your working branch
- Sharing work-in-progress
- Backing up local work to remote

**No authorization needed** for pushing to your own working branches.

### 3.2. Force Push

**Destructive operation:** `git push --force` or `git push --force-with-lease`

**NEVER force-push to:**
- `master` or `main`
- Any shared branch
- Any branch you don't own

**Only force-push to your own working branch when:**
- You've rebased and need to update the remote
- You've amended a commit that was already pushed
- You've cleaned up history before merging

**Prefer:** `git push --force-with-lease` (safer - checks remote hasn't changed)

**User authorization required** for force-pushing to `master`. Always ask first.

### 3.3. Push Verification

Before pushing, verify:

```bash
git status                    # Check working tree is clean
git log origin/master..HEAD   # See what you're about to push
git diff origin/master        # Review changes being pushed
```

---

## 4. Pull Request Requirements

### 4.1. When to Create a PR

Create a PR when:
- Work is complete and validated (`decapod validate` passes)
- Tests pass (if applicable)
- Documentation is updated
- Ready for human review

**Do NOT create PR for:**
- Work-in-progress (unless marked as draft)
- Broken/unvalidated changes
- Experimental branches (unless requesting feedback)

### 4.2. PR Description Format

```markdown
## Summary
<1-3 bullet points describing the change>

## Motivation
<Why this change is needed>

## Test Plan
<How to verify the change works>

## Checklist
- [ ] `decapod validate` passes
- [ ] Tests pass (if applicable)
- [ ] Documentation updated
- [ ] No force-push to master
```

### 4.3. PR Workflow

1. **Create:** `gh pr create --title "..." --body "..."`
2. **Review:** Wait for human approval
3. **Update:** Address feedback via new commits (don't force-push during review)
4. **Merge:** Operator merges when approved
5. **Cleanup:** Delete branch after merge

---

## 5. Merge Strategies

### 5.1. Allowed Merge Methods

**Prefer:** Merge commit (preserves full history)
```bash
git merge --no-ff feature-branch
```

**Alternative:** Rebase and merge (linear history)
```bash
git rebase master
git checkout master
git merge feature-branch
```

**Avoid:** Squash and merge (loses commit granularity) unless explicitly requested

### 5.2. Conflict Resolution

When conflicts occur:

1. **Understand:** Read both versions of conflicting changes
2. **Communicate:** Ask operator for guidance if unclear
3. **Resolve:** Manually edit files to resolve conflicts
4. **Test:** Verify merged code works (`decapod validate`)
5. **Commit:** Complete the merge with clear message

**NEVER:**
- Auto-resolve with `git checkout --ours` or `--theirs` without understanding
- Skip conflicts by deleting code
- Force-push to bypass conflicts

---

## 6. Tag and Release Conventions

### 6.1. Version Tags

**Format:** Semantic versioning `vMAJOR.MINOR.PATCH`

Examples:
- `v0.3.2` — Patch release
- `v1.0.0` — Major release
- `v1.2.0` — Minor release

**Create tag:**
```bash
git tag -a v0.3.2 -m "Release v0.3.2: CLI streamlining"
git push origin v0.3.2
```

**NEVER:**
- Delete tags without authorization
- Re-tag the same version (causes confusion)
- Push tags for unreleased code

### 6.2. Release Workflow

1. **Validate:** `decapod validate` passes
2. **Test:** `decapod qa verify` passes (if applicable)
3. **Version bump:** Update `Cargo.toml` version
4. **Commit:** `chore: bump version to vX.Y.Z`
5. **Tag:** Create annotated tag
6. **Push:** Push commit and tag together
7. **Build:** `cargo build --release`
8. **Publish:** `cargo publish` (if applicable)

---

## 7. Destructive Operations (Require Authorization)

The following operations are **destructive** and require **user authorization** before execution:

### 7.1. Force Push
```bash
git push --force
git push --force-with-lease
```
**When:** Only to your own working branch after rebase/amend
**NEVER:** To `master` or shared branches without explicit approval

### 7.2. Hard Reset
```bash
git reset --hard
git reset --hard origin/master
```
**When:** Discarding local changes you don't need
**Danger:** Loses uncommitted work - cannot be recovered

### 7.3. Branch Deletion
```bash
git branch -D <branch>
git push origin --delete <branch>
```
**When:** After PR is merged and branch is no longer needed
**Danger:** Loses unmerged work if branch wasn't backed up

### 7.4. Rebase Operations
```bash
git rebase -i HEAD~5
git rebase master
```
**When:** Cleaning up commit history before merge
**Danger:** Rewrites history - requires force-push

### 7.5. Cherry-Pick and Revert
```bash
git cherry-pick <commit>
git revert <commit>
```
**When:** Backporting fixes or undoing commits
**Caution:** Can cause conflicts and confusion

**Rule:** Always ask operator before performing destructive operations that affect:
- Shared branches
- Published commits
- Work that might be in use elsewhere

---

## 8. Git Hooks Integration

### 8.1. Available Hooks

Install via `decapod setup hook`:

**Commit-msg hook:**
- Validates conventional commit format
- Rejects malformed commit messages

**Pre-commit hook:**
- Runs `cargo fmt --all --check`
- Runs `cargo clippy --all-targets --all-features`
- Prevents committing unformatted or non-idiomatic code

### 8.2. Hook Enforcement

**NEVER bypass hooks** unless explicitly instructed:
```bash
git commit --no-verify   # DON'T DO THIS without authorization
```

**Rationale:** Hooks enforce code quality and conventions. Bypassing them introduces technical debt.

---

## 9. Safe Operations Checklist

Before any git operation, ask:

1. **Is this reversible?** (If no → ask operator first)
2. **Am I on the right branch?** (Check `git branch --show-current`)
3. **Is this a shared branch?** (If yes → be extra cautious)
4. **Have I validated my changes?** (Run `decapod validate`)
5. **Do I have a backup?** (Commit/push before destructive ops)

**When in doubt:** Ask the operator. The cost of asking is low; the cost of lost work is high.

---

## 10. Common Patterns

### 10.1. Starting Work

```bash
git checkout master
git pull origin master
git checkout -b ahr/work          # Or existing working branch
decapod todo list                  # See what to work on
```

### 10.2. During Work

```bash
# Make changes
git status                         # Check what changed
git add <files>                    # Stage specific files
git commit -m "feat: add feature"  # Commit with convention
git push -u origin ahr/work        # Push to remote
```

### 10.3. Preparing for PR

```bash
git checkout master
git pull origin master
git checkout ahr/work
git rebase master                  # Sync with master
# Resolve any conflicts
decapod validate                   # Ensure system is healthy
git push --force-with-lease        # Update remote after rebase
gh pr create                       # Create PR
```

### 10.4. After PR Merge

```bash
git checkout master
git pull origin master
git branch -d ahr/work             # Delete local branch (optional)
git push origin --delete ahr/work  # Delete remote branch (optional)
```

---

## 11. Troubleshooting

### 11.1. "Detached HEAD" State

**Problem:** `git checkout <commit-hash>` leaves you in detached HEAD

**Fix:**
```bash
git checkout master                # Return to branch
git checkout -b temp/recovery      # Or create branch if you made commits
```

### 11.2. Accidental Commit to Wrong Branch

**Fix:**
```bash
git log                            # Find commit hash
git checkout correct-branch
git cherry-pick <commit-hash>
git checkout wrong-branch
git reset --hard HEAD~1            # Remove from wrong branch
```

### 11.3. Lost Commits After Reset

**Recovery:**
```bash
git reflog                         # Find lost commit hash
git cherry-pick <commit-hash>      # Recover the commit
```

### 11.4. Merge Conflict Hell

**Abort and restart:**
```bash
git merge --abort                  # Cancel the merge
# Ask operator for guidance
```

---

## 12. Enforcement

This contract is enforced through:

1. **Git hooks** — Automated validation of commit format and code quality
2. **Agent contracts** — All agent templates mandate this document
3. **Code review** — Operators review PRs for compliance
4. **Validation gates** — `decapod validate` checks repository health

**Violations** of this contract (especially destructive operations without authorization) result in:
- Work rejection
- Branch restoration from backup
- Reduced agent autonomy (more oversight required)

---

## 13. See Also

- `specs/SYSTEM.md` — Authority and proof doctrine
- `specs/INTENT.md` — Methodology contract
- `core/DECAPOD.md` — Router (agent entry point)
- `plugins/AUTOUPDATE.md` — Session start protocol

---

**This contract is binding. Git operations MUST follow these rules.**

## Links

### Core Router
- `core/DECAPOD.md` - **Router and navigation charter (START HERE)**

### Authority (Constitution Layer)
- `specs/INTENT.md` - **Methodology contract (READ FIRST)**
- `specs/SYSTEM.md` - System definition and authority doctrine
- `specs/SECURITY.md` - Security contract
- `specs/AMENDMENTS.md` - Change control

### Registry (Core Indices)
- `core/PLUGINS.md` - Subsystem registry
- `core/INTERFACES.md` - Interface contracts index

### Contracts (Interfaces Layer)
- `interfaces/CONTROL_PLANE.md` - Sequencing patterns
- `interfaces/DOC_RULES.md` - Doc compilation rules

### Operations (Plugins Layer)
- `plugins/TODO.md` - Work tracking
- `plugins/VERIFY.md` - Validation subsystem