feat: specify confidence gate parsing and mini-Explorer spawning in run skill

This commit is contained in:
2026-04-04 07:33:59 +02:00
parent 960aba5faa
commit 34f101c166
2 changed files with 71 additions and 8 deletions

View File

@@ -126,17 +126,78 @@ After Creator returns:
#### 1c. Confidence Gate (Adaptation Rule A3)
Read Creator's confidence scores from `plan-creator.md`. Apply A3 per `archeflow:orchestration`:
- Task understanding < 0.5 → **Pause**, ask user
- Solution completeness < 0.5 → **Upgrade** to standard, spawn Explorer
- Risk coverage < 0.5 → **Spawn mini-Explorer** for risky area (parallel, 5 min max)
**Parsing instructions:**
Read `plan-creator.md`, locate the `### Confidence` table. Extract scores for each axis as floats:
```bash
CONF_FILE=".archeflow/artifacts/${RUN_ID}/plan-creator.md"
# Extract confidence scores (expects format: "| Task understanding | 0.8 |")
TASK_UNDERSTANDING=$(grep -i "task understanding" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1)
SOLUTION_COMPLETENESS=$(grep -i "solution completeness" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1)
RISK_COVERAGE=$(grep -i "risk coverage" "$CONF_FILE" | grep -oE '[0-9]+\.[0-9]+' | head -1)
# Fallback: if unparseable, treat as 0.7 (safe default — proceed but not overconfident)
TASK_UNDERSTANDING="${TASK_UNDERSTANDING:-0.7}"
SOLUTION_COMPLETENESS="${SOLUTION_COMPLETENESS:-0.7}"
RISK_COVERAGE="${RISK_COVERAGE:-0.7}"
```
**Pause branch** (Task understanding < 0.5):
The Creator does not sufficiently understand the task. Do not spawn Maker.
1. Emit decision event with `"chosen":"pause"`
2. Display message to user: "Creator rated task understanding at <score>. Clarification needed before proceeding."
3. Block until the user provides clarification
4. Re-run Creator with the clarification appended to the task description
If A3 triggers, emit a `decision` event:
```bash
./lib/archeflow-event.sh "$RUN_ID" decision plan "" \
'{"what":"confidence_gate","chosen":"<action>","rationale":"<axis> scored <score>"}' "$SEQ_CREATOR_COMPLETE"
'{"what":"confidence_gate","chosen":"pause","rationale":"task_understanding scored '"$TASK_UNDERSTANDING"'"}' "$SEQ_CREATOR_COMPLETE"
```
**Upgrade branch** (Solution completeness < 0.5):
The Creator's proposal is incomplete — more research is needed.
1. If fast workflow: upgrade to standard, spawn Explorer, then re-run Creator with Explorer output
2. If already standard/thorough: re-run Explorer with a focused prompt targeting the incomplete areas
```bash
./lib/archeflow-event.sh "$RUN_ID" decision plan "" \
'{"what":"confidence_gate","chosen":"upgrade","rationale":"solution_completeness scored '"$SOLUTION_COMPLETENESS"'"}' "$SEQ_CREATOR_COMPLETE"
# If fast → standard upgrade:
WORKFLOW="standard"
# Spawn Explorer, then re-run Creator with Explorer findings
```
**Mini-Explorer branch** (Risk coverage < 0.5):
The Creator identified risks but lacks confidence in their assessment. Spawn a focused Explorer to investigate.
```
Agent(
description: "Mini-Explorer: investigate risk area for <task>",
prompt: "You are the EXPLORER archetype. The Creator rated risk coverage at <score>.
Identified risks: <risks from plan-creator.md>
Research ONLY the risky areas. Answer: Is the risk real? What mitigations exist? What tests/guards would help?
Limit: focused output only.",
subagent_type: "Explore"
)
```
Save output to `.archeflow/artifacts/${RUN_ID}/plan-mini-explorer.md`. The Maker receives both `plan-creator.md` and `plan-mini-explorer.md` as context.
```bash
./lib/archeflow-event.sh "$RUN_ID" decision plan "" \
'{"what":"confidence_gate","chosen":"mini_explorer","rationale":"risk_coverage scored '"$RISK_COVERAGE"'"}' "$SEQ_CREATOR_COMPLETE"
```
**Note:** The mini-Explorer runs in parallel with Do phase preparation (5 min max). The Maker can proceed once both `plan-creator.md` and `plan-mini-explorer.md` are available.
#### 1d. Phase Transition: Plan to Do
```bash