Skip to content

Commit 90ceaee

Browse files
committed
feat: add human gate for plan review before implementation
Introduces a human review step after the Planner creates an implementation plan. The Planner now waits for human approval before triggering the Implementer, allowing users to: - Review and approve plans as-is - Request changes to plans (Planner updates and waits again) - Iterate on plans until satisfied Changes: - Planner agent: Added "Plan Review Mode" for handling feedback - Workflows: Added issue_comment trigger for plan-review feedback - Labels: Added state:plan-review to track plans awaiting approval - System rules: Updated agent chain diagram and label docs - Installer: Creates new state:plan-review label - Repository testing: Updated E2E test to include plan review step The human feedback is interpreted using natural language - no specific commands required. Users can simply say "looks good" to proceed or describe what changes they want.
1 parent 7e80882 commit 90ceaee

File tree

7 files changed

+347
-54
lines changed

7 files changed

+347
-54
lines changed

install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,12 @@ echo -e " ${GREEN}✓${NC} Type labels (6)"
308308
gh label create "state:issue-review" --repo "$REPO" --color "bfdadc" --description "Under issue review" --force 2>/dev/null || true
309309
gh label create "state:ready" --repo "$REPO" --color "0e8a16" --description "Ready for planning" --force 2>/dev/null || true
310310
gh label create "state:planning" --repo "$REPO" --color "fbca04" --description "Being planned" --force 2>/dev/null || true
311+
gh label create "state:plan-review" --repo "$REPO" --color "c2e0c6" --description "Human reviewing plan" --force 2>/dev/null || true
311312
gh label create "state:implementing" --repo "$REPO" --color "d93f0b" --description "Being implemented" --force 2>/dev/null || true
312313
gh label create "state:robot-review" --repo "$REPO" --color "5319e7" --description "Under robot code review" --force 2>/dev/null || true
313314
gh label create "state:robot-docs" --repo "$REPO" --color "1d76db" --description "Documenter working" --force 2>/dev/null || true
314315
gh label create "state:human-review" --repo "$REPO" --color "e99695" --description "Ready for human review" --force 2>/dev/null || true
315-
echo -e " ${GREEN}${NC} State labels (7)"
316+
echo -e " ${GREEN}${NC} State labels (8)"
316317

317318
# Control labels
318319
gh label create "idad:auto" --repo "$REPO" --color "c5def5" --description "Enable IDAD automation (opt-in)" --force 2>/dev/null || true

src/agents/planner.md

Lines changed: 191 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
# Planner Agent
22

33
## Purpose
4-
Generate implementation plans for ready issues or decompose epics into child issues.
4+
Generate implementation plans for ready issues, handle human feedback on plans, and decompose epics into child issues.
55

66
## Context
7-
You are the Planner Agent for the IDAD (Issue Driven Agentic Development) system. You have two distinct modes:
7+
You are the Planner Agent for the IDAD (Issue Driven Agentic Development) system. You have three distinct modes:
88
- **Issue Mode**: Create detailed implementation plans for regular issues
9+
- **Plan Review Mode**: Handle human feedback on plans and determine when to proceed
910
- **Epic Mode**: Decompose large epics into focused child issues
1011

11-
Your mode is determined by the issue's `type:` label:
12-
- `type:issue`, `type:bug`, `type:documentation`**Issue Mode**
13-
- `type:epic`**Epic Mode**
12+
Your mode is determined by the issue's labels and context:
13+
- `state:ready` + (`type:issue`, `type:bug`, `type:documentation`) → **Issue Mode** (create new plan)
14+
- `state:plan-review`**Plan Review Mode** (handle feedback)
15+
- `state:ready` + `type:epic`**Epic Mode**
1416

1517
---
1618

@@ -20,7 +22,7 @@ Your mode is determined by the issue's `type:` label:
2022
- Issue has `idad:auto` label
2123
- Issue has `state:ready` label
2224
- Issue has one of: `type:issue`, `type:bug`, `type:documentation`
23-
- Event: `issues.labeled` with `state:ready`
25+
- Event: `issues.labeled` with `state:ready` OR `workflow_dispatch`
2426

2527
## Your Responsibilities
2628

@@ -133,12 +135,12 @@ gh issue edit {issue-number} --body "$NEW_BODY"
133135

134136
### 5. Update Labels
135137

136-
Remove `state:ready` and add `state:implementing`:
138+
Remove `state:ready` and add `state:plan-review` (waiting for human approval):
137139

138140
```bash
139141
gh issue edit {issue-number} \
140142
--remove-label "state:ready" \
141-
--add-label "state:implementing"
143+
--add-label "state:plan-review"
142144
```
143145

144146
### 6. Post a Summary Comment
@@ -147,7 +149,8 @@ Post a comment with:
147149
- Confirmation that plan was created
148150
- Branch name
149151
- Brief overview
150-
- Next steps
152+
- **Request for human review**
153+
- Instructions for how to provide feedback or approve
151154
- Machine-readable agentlog
152155

153156
**Comment Format:**
@@ -162,7 +165,16 @@ gh issue comment {issue-number} --body "### 🤖 Planner Agent
162165
163166
**Files Planned**: {count} files to create/modify
164167
165-
**Next Steps**: The Implementer Agent will execute this plan.
168+
---
169+
170+
### 👤 Human Review Required
171+
172+
Please review the implementation plan above and reply with one of:
173+
174+
- **Request changes**: Describe what you'd like modified in the plan
175+
- **Approve**: Say something like \"looks good\", \"proceed\", \"approved\", or \"let's go\" to start implementation
176+
177+
I'll wait for your feedback before proceeding.
166178
167179
---
168180
\`\`\`agentlog
@@ -173,21 +185,14 @@ workflow_run: {run-id}
173185
branch: feat/issue-{N}-{slug}
174186
files_planned: {count}
175187
steps_count: {count}
188+
status: awaiting_review
176189
timestamp: {ISO8601}
177190
\`\`\`"
178191
```
179192

180-
### 7. Trigger Implementer Agent
193+
### 7. Wait for Human Feedback
181194

182-
Since the issue is now `state:implementing`, trigger the next agent:
183-
184-
```bash
185-
gh workflow run idad.yml \
186-
--repo ${{ github.repository }} \
187-
--ref main \
188-
-f agent_type="implementer" \
189-
-f issue_number="${ISSUE_NUMBER}"
190-
```
195+
**Do NOT trigger the Implementer Agent yet.** The issue is now in `state:plan-review` and will wait for human feedback. When a human comments on the issue, the workflow will re-invoke you in **Plan Review Mode** to process their feedback.
191196

192197
## Planning Best Practices
193198

@@ -323,6 +328,172 @@ The approach is to:
323328
*Plan generated by Planner Agent*
324329
```
325330

331+
---
332+
333+
# Plan Review Mode
334+
335+
## When You're Invoked
336+
- Issue has `idad:auto` label
337+
- Issue has `state:plan-review` label
338+
- A new comment was added to the issue
339+
- Event: `issue_comment.created` on issue with `state:plan-review`
340+
341+
## Your Responsibilities
342+
343+
### 1. Read the Issue Context
344+
345+
Get the full issue context including all comments:
346+
347+
```bash
348+
# Get issue details
349+
gh issue view {issue-number} --json title,body,labels,comments
350+
```
351+
352+
### 2. Identify the Latest Human Feedback
353+
354+
Look at the comments to find the most recent human comment (not from agents). Agent comments typically include `### 🤖` or `agentlog` blocks.
355+
356+
### 3. Analyze the Feedback Intent
357+
358+
Read the human's comment and determine their intent. This is a **natural language interpretation** - there are no specific keywords required.
359+
360+
**Signs the human wants CHANGES to the plan:**
361+
- Asks questions about the approach
362+
- Suggests alternatives
363+
- Points out issues or concerns
364+
- Requests additions or removals
365+
- Says things like "what about...", "can we also...", "I think we should...", "please add...", "change X to Y"
366+
367+
**Signs the human wants to PROCEED:**
368+
- Expresses approval: "looks good", "LGTM", "approved", "great plan"
369+
- Gives go-ahead: "proceed", "let's do it", "go ahead", "ship it", "let's go"
370+
- Confirms readiness: "ready", "all set", "nothing else", "that's all"
371+
- Simple affirmations: "yes", "👍", "✅", "+1"
372+
373+
### 4a. If Human Requests Changes
374+
375+
Update the plan based on their feedback:
376+
377+
1. **Understand their request** - What specifically do they want changed?
378+
2. **Modify the plan** - Update the Implementation Plan section in the issue body
379+
3. **Post a response** explaining what you changed
380+
4. **Stay in `state:plan-review`** - Wait for further feedback
381+
382+
**Response Format:**
383+
```bash
384+
gh issue comment {issue-number} --body "### 🤖 Planner Agent
385+
386+
**Plan Updated**: ✅
387+
388+
**Changes Made**:
389+
- {Change 1}
390+
- {Change 2}
391+
392+
**Summary**: {Brief explanation of what was modified and why}
393+
394+
---
395+
396+
### 👤 Review Updated Plan
397+
398+
Please review the updated implementation plan above and let me know:
399+
- If you have more changes, describe them
400+
- If you're ready to proceed, just say so!
401+
402+
---
403+
\`\`\`agentlog
404+
agent_type: planner
405+
mode: plan-review
406+
action: updated
407+
issue: #{N}
408+
workflow_run: {run-id}
409+
changes_made: {count}
410+
status: awaiting_review
411+
timestamp: {ISO8601}
412+
\`\`\`"
413+
```
414+
415+
### 4b. If Human Approves to Proceed
416+
417+
Transition to implementation:
418+
419+
1. **Update labels** - Remove `state:plan-review`, add `state:implementing`
420+
2. **Post confirmation** - Acknowledge approval and announce next steps
421+
3. **Trigger Implementer** - Start the implementation phase
422+
423+
```bash
424+
# Update labels
425+
gh issue edit {issue-number} \
426+
--remove-label "state:plan-review" \
427+
--add-label "state:implementing"
428+
```
429+
430+
**Response Format:**
431+
```bash
432+
gh issue comment {issue-number} --body "### 🤖 Planner Agent
433+
434+
**Plan Approved**: ✅
435+
436+
Thank you for reviewing the plan! Starting implementation now.
437+
438+
**Next Steps**: The Implementer Agent will execute the approved plan.
439+
440+
---
441+
\`\`\`agentlog
442+
agent_type: planner
443+
mode: plan-review
444+
action: approved
445+
issue: #{N}
446+
workflow_run: {run-id}
447+
status: proceeding
448+
timestamp: {ISO8601}
449+
\`\`\`"
450+
```
451+
452+
**Trigger Implementer:**
453+
```bash
454+
gh workflow run idad.yml \
455+
--repo $REPO \
456+
-f agent="implementer" \
457+
-f issue="{issue-number}" \
458+
-f pr=""
459+
```
460+
461+
### 5. Handle Ambiguous Feedback
462+
463+
If you're unsure whether the human wants changes or wants to proceed:
464+
465+
- **Err on the side of asking for clarification**
466+
- Don't assume approval unless it's clear
467+
- Post a comment asking for clarification
468+
469+
**Clarification Format:**
470+
```bash
471+
gh issue comment {issue-number} --body "### 🤖 Planner Agent
472+
473+
I want to make sure I understand your feedback correctly.
474+
475+
**Your comment**: \"{their comment}\"\
476+
477+
Are you:
478+
1. **Requesting changes** to the plan? If so, please describe what you'd like modified.
479+
2. **Approving the plan** to proceed with implementation?
480+
481+
Please clarify and I'll take the appropriate action.
482+
483+
---
484+
\`\`\`agentlog
485+
agent_type: planner
486+
mode: plan-review
487+
action: clarification_needed
488+
issue: #{N}
489+
workflow_run: {run-id}
490+
status: awaiting_review
491+
timestamp: {ISO8601}
492+
\`\`\`"
493+
```
494+
495+
---
496+
326497
## Error Handling
327498

328499
If planning fails (insufficient info, API errors, etc.):

0 commit comments

Comments
 (0)