Main branch is protected. Direct pushes are BLOCKED.
| Rule | Status | Description |
|---|---|---|
| 🔒 Direct Push | ❌ Blocked | All changes must use Pull Request |
| ✅ PR Required | Mandatory | At least 1 approval needed |
| 🔄 Linear History | Enforced | No merge commits allowed |
| 💬 Conversation Resolution | Required | All discussions must be resolved |
| Yes | Even repository admins must use PR |
What This Means:
- You CANNOT push directly to
mainbranch - You MUST create a feature branch and submit a PR
- All PRs need at least 1 approval before merging
- GitHub will reject any direct push attempts
Attempting Direct Push?
$ git push origin main
remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: - Changes must be made through a pull request.
! [remote rejected] main -> main (protected branch hook declined)✅ This is expected behavior. Use the PR process below.
Every PR should be minimal, focused, and reviewable.
A minimal PR:
- Solves one problem or implements one feature
- Has clear scope (not a mix of unrelated changes)
- Is small enough to review in 15-30 minutes
- Contains related changes that belong together
| Size | Lines Changed | Files Changed | Review Time |
|---|---|---|---|
| Ideal | < 400 | < 10 | 15-30 min |
| Acceptable | 400-800 | 10-20 | 30-60 min |
| Too Large | > 800 | > 20 | > 60 min |
Rule: If review takes > 60 minutes, split the PR.
PR Title: "Add agent runtime and fix bugs and update docs"
Changes:
- Agent runtime implementation (500 lines)
- Fix typo in README (1 line)
- Refactor error handling (200 lines)
- Update ROADMAP.md (50 lines)
- Add .gitignore entry (2 lines)
Problem: Mixed concerns, hard to review, hard to revert.
PR #1: "feat: implement agent task domain model"
- Task struct and state machine
- TaskRepository trait
- Unit tests for task transitions
PR #2: "fix: correct typo in README"
- Fix typo in installation section
PR #3: "refactor: improve error handling in runtime"
- Refactor runtime error handling
- Add error tests
Use sub-branches when:
- Feature is too large for single PR (> 800 lines)
- Feature has distinct phases (design, implementation, tests)
- Multiple developers work on different aspects of same feature
feature/agent-runtime (Parent branch)
├── feature/agent-runtime/domain (Sub-branch: domain models)
├── feature/agent-runtime/runtime (Sub-branch: runtime implementation)
└── feature/agent-runtime/tests (Sub-branch: integration tests)
Step 1: Create parent branch
git checkout main
git checkout -b feature/agent-runtime
Step 2: Create sub-branch from parent
git checkout feature/agent-runtime
git checkout -b feature/agent-runtime/domain
Step 3: Work on sub-branch
git add .
git commit -m "feat: add task domain model"
Step 4: Create PR from sub-branch to parent
gh pr create --base feature/agent-runtime
Step 5: After approval, merge sub-branch to parent
(Maintains linear history on parent)
Step 6: When all sub-branches merged, create PR from parent to main
gh pr create --base main
Must Have:
- Clear scope definition (what this sub-branch implements)
- Reference to parent branch in PR description
- All checks pass before merge to parent
- Squash merge to parent (to keep clean history)
Should Have:
- Link to tracking issue (if exists)
- Tests for new functionality
- Documentation updates (if needed)
Must NOT:
- Mix unrelated changes across sub-branches
- Skip review for sub-branch PRs (still need review)
- Merge to parent without passing checks
Every PR must have:
What this PR does in 2-3 sentences.
## Summary
Implement Agent Task domain model with state machine, repository trait,
and unit tests for all state transitions.
- Add Task struct with status field
- Implement TaskRepository trait
- Add comprehensive unit testsWhat is included and what is NOT included.
## Scope
**Included:**
- Task domain model
- TaskRepository trait definition
- Unit tests for Task state machine
**NOT Included:**
- Runtime implementation (separate PR)
- Provider integration (separate PR)
- Persistence layer (separate PR)How the changes were tested.
## Testing
```bash
# Ran unit tests
cargo test task::tests
# Result: 12 tests passed
# Ran type check
cargo check
# Result: No errorsFrom .github/pull_request_template.md:
## Checklist
- [x] TypeScript compiles without errors.
- [x] Rust compiles without errors.
- [x] `cargo fmt` passes.
- [x] `cargo clippy` passes.
- [x] ESLint passes.
- [x] Tests pass.
- [x] Documentation updated.
- [x] No secrets committed.Before Creating PR:
- Self-review your changes (
git diff main) - Run all checks locally
- Write clear PR description
- Keep PR focused (split if needed)
After Creating PR:
- Respond to all review comments
- Make changes in new commits (not amend)
- Mark conversations as resolved
- Don't force push after review starts
Review Criteria:
- Does PR have clear scope?
- Is PR minimal (not mixing unrelated changes)?
- Does code follow AGENTS.md guidelines?
- Are tests adequate?
- Is documentation updated?
Review Turnaround:
- Aim for review within 24 hours
- If review will take > 60 minutes, request split
When to Squash:
- Feature branches → main
- Sub-branches → parent branches
Why Squash:
- Clean history on main/parent
- Single commit per feature
- Easier to revert if needed
Squash Message:
feat: implement agent task domain model (#123)
Implement Task domain model with state machine, repository trait,
and comprehensive unit tests.
- Add Task struct with status field
- Implement TaskRepository trait
- Add 12 unit tests for state transitions
Reviewed-by: Reviewer Name
PR can be merged when:
- ✅ All checks pass
- ✅ At least 1 approval
- ✅ No unresolved conversations
- ✅ Branch is up-to-date with base
- ✅ Linear history maintained
❌ Bad:
PR: "Implement entire Agent Runtime"
Changes: 5000 lines, 50 files
Review: 3+ hours
✅ Good:
PR #1: "feat: add agent task domain" (400 lines)
PR #2: "feat: add agent runtime core" (600 lines)
PR #3: "feat: add provider integration" (500 lines)
PR #4: "test: add integration tests" (300 lines)
❌ Bad:
PR: "Add feature X and fix bugs"
- Feature X implementation (600 lines)
- Unrelated bug fix (50 lines)
✅ Good:
PR #1: "feat: implement feature X"
PR #2: "fix: resolve bug in module Y"
❌ Bad:
Sub-branch PR: "WIP: partial implementation"
Review: Self-approved or no review
✅ Good:
Sub-branch PR: "feat: implement sub-component"
Review: Requires same review process as main PRs
❌ Bad:
PR: "Update code"
Summary: "Various changes"
✅ Good:
PR: "feat: add task cancellation support"
Summary: "Implement cooperative cancellation for agent tasks using CancellationToken"
Before creating PR, verify:
- Single purpose: PR solves ONE problem
- Related changes: All changes belong together
- Under 800 lines: PR is reviewable in reasonable time
- Clear scope: What's included/excluded is documented
- Tests included: New functionality has tests
- Docs updated: Architecture changes documented
- Self-reviewed: You reviewed your own changes first
- Checks pass: All CI checks green
Title: feat: add task state transition validation
Summary: Implement validation for task state transitions to prevent invalid state changes.
Scope:
- Included: Task::transition() method with validation
- Included: Unit tests for all valid/invalid transitions
- NOT included: UI for state display (separate PR)
Testing:
cargo test task::tests::transitions
# Result: 15 tests passedChecklist: All items checked ✅
Review: Approved after 20 minutes
Title: feat: implement agent runtime
Changes:
- Task domain model (300 lines)
- Runtime implementation (400 lines)
- Provider trait (200 lines)
- SQLite repository (250 lines)
- Tests (300 lines)
- Total: 1450 lines, 25 files
Problem: Too large, multiple concerns
Should Be:
- PR #1: Task domain model (300 lines)
- PR #2: Runtime implementation (400 lines)
- PR #3: Provider trait (200 lines)
- PR #4: SQLite repository (250 lines)
- PR #5: Integration tests (300 lines)
Document Version: 1.0 Last Updated: 2026-07-31