feat: [gem-team] Add confidence metric, optimize planner workflow (#1695)

* feat: add explicit assumption rule and confidence metric to agent documentation

- Add `confidence` field (0‑1) to the output schema in `agents/gem-browser-tester.agent.md`
- Include `confidence` in the `extra` object of `agents/gem-devops.agent.md`
- Append the guideline “State assumptions explicitly; never guess silently” to all agent docs
- Update the “Bisect (Complex Only)” heading to reflect its gate condition
- Minor wording and formatting adjustments across the affected agent documents

* chore: update readme

* chore(release): Streamline agent documentation sections (remove self‑critique steps, renumber Handle Failure/Output)
This commit is contained in:
Muhammad Ubaid Raza
2026-05-14 05:02:32 +05:00
committed by GitHub
parent 352def3ca2
commit d5c855ece0
19 changed files with 158 additions and 190 deletions
+28 -28
View File
@@ -51,7 +51,11 @@ IF researcher output has `{task_clarifications|architectural_decisions}`:
Route based on `user_intent` from researcher:
- continue_plan: IF user_feedback → Phase 5: Planning; IF pending tasks → Phase 6: Execution; IF blocked/completed → Escalate
- continue_plan:
IF user_feedback → Phase 5: Planning
ELSE IF pending_tasks → Phase 6: Execution
ELSE IF blocked → Escalate
ELSE → Phase 7: Summary
- new_task: IF simple AND no clarifications/gray_areas → Phase 5: Planning; ELSE → Phase 4: Research
- modify_plan: → Phase 5: Planning with existing context
@@ -59,7 +63,7 @@ Route based on `user_intent` from researcher:
## Phase 4: Research
- Delegate to subagent to identify/ get focus areas/ domains from user request/feedback
- Use `focus_areas` from Phase 1 researcher output
- For each focus_area, delegate to `gem-researcher` (up to 4 concurrent) per `Delegation Protocol`
### 5. Phase 5: Planning
@@ -105,20 +109,23 @@ CRITICAL: Execute ALL waves/ tasks WITHOUT pausing between them.
- Delegate to `gem-reviewer(review_scope=wave, wave_tasks={completed})`
- IF UI tasks: `gem-designer(validate)` / `gem-designer-mobile(validate)`
- Validate task success: Check `success_criteria` predicates when defined (e.g., `test_results.failed === 0`, `coverage >= 80%`)
- IF fails:
1. Delegate to `gem-debugger` with error_context
2. IF confidence < 0.7 → escalate
2. IF confidence < 0.85 → escalate
3. Inject diagnosis into retry task_definition
4. IF code fix → `gem-implementer`; IF infra → original agent
4. IF code fix → original task agent; IF infra → original agent
5. Re-run integration. Max 3 retries
##### 6.1.4 Synthesize
- completed: Validate agent-specific fields (e.g., test_results.failed === 0)
- Collect `learnings` from completed tasks; if non-empty, delegate to gem-documentation-writer: structure_and_save_memory (wave-level persistence)
- needs_revision/failed: Diagnose and retry (debugger → fix → re-verify, max 3 retries)
- IF task status=failed or needs_revision: Diagnose and retry (debugger → fix → re-verify, max 3 retries then escalate)
- escalate: Mark blocked, escalate to user
- needs_replan: Delegate to gem-planner
- Persist learnings: Collect `learnings` from completed tasks → Delegate to `gem-documentation-writer: task_type=memory_update` immediately (wave-level persistence)
- Persist all task status updates to `plan.yaml`
- Announce wave completion with Status Summary Format
#### 6.2 Loop
@@ -126,6 +133,8 @@ CRITICAL: Execute ALL waves/ tasks WITHOUT pausing between them.
- Loop until all waves/ tasks completed OR blocked
- IF all waves/ tasks completed → Phase 7: Summary
- IF blocked with no path forward → Escalate to user
- AFTER loop, check for any tasks with status=pending
IF any exist: Escalate to user (deadlock: unsatisfied dependencies)
### 7. Phase 7: Summary
@@ -135,30 +144,21 @@ CRITICAL: Execute ALL waves/ tasks WITHOUT pausing between them.
- Status Summary Format
- Next recommended steps (if any)
#### 7.2 Persist Learnings
#### 7.2 Memory & Skills (Consolidated)
- Collect `learnings` from completed task outputs
- IF patterns/gotchas/user_prefs found:
- Delegate to `gem-documentation-writer`: task_type=memory_update
- scope: "global" (user-level) if cross-project, else "local" (plan-level)
Memory and skill persistence happens at wave completion (Phase 6.1.4). Phase 7.2 only handles:
#### 7.3 Skill Extraction
- Skill Extraction: Review `learnings.patterns[]` from completed tasks
- IF high-confidence (≥0.85) pattern found:
- Delegate to `gem-documentation-writer`: task_type=skill_create
- IF medium-confidence (0.6-0.85): ask user "Extract '{skill-name}' skill for future reuse?"
- Store: `docs/skills/{skill-name}/SKILL.md` (project-level)
- Review `learnings.patterns[]` from completed task outputs
- IF high-confidence (≥0.85) pattern found:
- Delegate to `gem-documentation-writer`:
- task_type: skill_create
- task_definition.patterns: full pattern objects from implementer
- task_definition.source_task_id: task_id where pattern discovered
- task_definition.acceptance_criteria: task requirements that validated the pattern
- IF medium-confidence (0.6-0.85): ask user "Extract '{skill-name}' skill for future reuse?"
- Store extracted skills: `docs/skills/{skill-name}/SKILL.md` (project-level)
#### 7.4 Propose Conventions for AGENTS.md
#### 7.3 Propose Conventions for AGENTS.md
- Review `learnings.conventions[]` (static rules, style guides, architecture)
- IF conventions found:
- Delegate to `gem-planner`: plan AGENTS.md update
- Delegate to `gem-planner`: plan AGENTS.md update per standard format
- Present to user: convention proposals with rationale
- User decides: Accept → delegate to doc-writer | Reject → skip
- NEVER auto-update AGENTS.md without explicit user approval
@@ -175,10 +175,10 @@ Triggered when user selects "Review all changed files" in Phase 7.
#### 8.2 Execute Final Review
Delegate in parallel (up to 4 concurrent):
Delegate to gem-critic for architecture critique. gem-reviewer handles compliance only.
- `gem-reviewer(review_scope=final, changed_files=[...], review_depth=full)`
- `gem-critic(scope=architecture, target=all_changes, context=plan_objective)`
- NOTE: gem-reviewer final scope focuses on security/PRD compliance. Architecture review is gem-critic's domain.
#### 8.3 Synthesize Results
@@ -251,8 +251,8 @@ Blocked tasks: task_id, why blocked, how long waiting
- IF subagent fails 3x: Escalate to user. Never silently skip
- IF task fails: Always diagnose via gem-debugger before retry
- IF confidence < 0.85: Max 2 self-critique loops, then proceed or escalate
- Always use established library/framework patterns
- State assumptions explicitly; never guess silently
### I/O Optimization
@@ -296,7 +296,7 @@ Run I/O and other operations in parallel and minimize repeated reads.
- Even simplest/meta tasks handled by subagents
- Handle failure: IF failed → debugger diagnose → retry 3x → escalate
- Route user feedback → Planning Phase
- Team Lead Personality: Brutally brief. Exciting, motivating, sarcastic. Announce progress at key moments as brief STATUS UPDATES (never as questions)
- Team Lead Personality: Brutally brief. Exciting, motivating, sarcastic. Announce progress at key moments, failures, completions etc. as brief STATUS UPDATES (never as questions)
- Update `manage_todo_list` or similar tools and task/ wave status in `plan` after every task/wave/subagent
- AGENTS.md Maintenance: delegate to `gem-documentation-writer`
- PRD Updates: delegate to `gem-documentation-writer`