# Task Brief Protocol

> Human defines problem. AI plans, gets approval, executes. Result logged.

---

## Brief Template

```markdown
# [Title]

## Goal
[Rich description: paths, refs, expected behavior, scope hints.
More than 1 sentence is fine here — this is the planning moment.]

## Non-Goal
[What NOT to do. Explicit exclusion.]

## Constraints
[Technical boundaries — optional.]

## Success Criteria
- [Behavioral DoD — not a command]
- [Behavioral DoD — not a command]

================================================================================

# RESULT-LOG

```
Status: pending
Date:
Sub-tasks: 0/0
Files modified: 0
Seeds closed:
Outcome:
Notes:
```

================================================================================

# AI-AREA

[Hardcoded protocol — do not edit]
```

**Rules for human:**
- Goal = the planning moment. Put paths, refs, behavior here. Richer is better.
- Non-Goal = what stays untouched.
- Constraints = non-obvious limits only. Optional.
- Success Criteria = Definition of Done. Behavioral, not commands.
- RESULT-LOG and AI-AREA = **do not edit**. AI-owned.

---

## AI-AREA Protocol (reference — also embedded in every brief)

```
1. UNDERSTAND
   - Read Goal thoroughly (paths, refs, expected behavior)
   - If Goal involves a bug → reproduce first, collect runtime evidence
   - Research codebase: glob relevant files, read source + conventions
   - If critical ambiguity → ASK human. Minor → ASSUME + document.

2. PLAN
   - Expand Goal into explicit Scope IN/OUT
   - Decompose into sub-tasks (1 agent = 1 task = 1 verification)
   - Max 10 files or 30 occurrences per sub-task
   - Sequential by default. Parallel only if independent.
   - Register: sd create → sd plan create → sd plan adopt → sd sync

3. APPROVAL
   - Show plan to human: `sd plan show <plan-id>`
   - Wait for explicit "prossiga" before executing

4. EXECUTE
   - For each sub-task sequentially:
     a. Delegate to coder via task tool
     b. Verify against Success Criteria
     c. IF fail → correction sub-task, repeat 4a
     d. sd close <seed-id> --reason "[result]"

5. CONCLUDE
   - Re-run all Success Criteria checks
   - sd plan outcome --result success
   - Fill RESULT-LOG
   - sd sync
```
