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

@@ -46,6 +46,7 @@ Artifacts follow the pattern: `<phase>-<agent>.<ext>`
|-------|-------|----------|--------| |-------|-------|----------|--------|
| plan | explorer | `plan-explorer.md` | Markdown research report | | plan | explorer | `plan-explorer.md` | Markdown research report |
| plan | creator | `plan-creator.md` | Markdown proposal with confidence scores | | plan | creator | `plan-creator.md` | Markdown proposal with confidence scores |
| plan | mini-explorer | `plan-mini-explorer.md` | Focused risk research (only if confidence gate triggers) |
| do | maker | `do-maker.md` | Markdown implementation summary | | do | maker | `do-maker.md` | Markdown implementation summary |
| do | maker | `do-maker-files.txt` | Plain text, one file path per line | | do | maker | `do-maker-files.txt` | Plain text, one file path per line |
| check | guardian | `check-guardian.md` | Markdown verdict + findings table | | check | guardian | `check-guardian.md` | Markdown verdict + findings table |
@@ -89,8 +90,8 @@ Note: Address each unresolved issue listed above. Explain how your revised propo
| Agent | Receives | Does NOT receive | | Agent | Receives | Does NOT receive |
|-------|----------|-----------------| |-------|----------|-----------------|
| **Maker** (cycle 1) | `plan-creator.md` (the proposal) | `plan-explorer.md`, reviewer outputs, raw task description | | **Maker** (cycle 1) | `plan-creator.md` (the proposal), `plan-mini-explorer.md` (if exists) | `plan-explorer.md`, reviewer outputs, raw task description |
| **Maker** (cycle 2+) | `plan-creator.md`, Maker-routed findings from `act-feedback.md` | Explorer research, Guardian/Skeptic findings (those went to Creator) | | **Maker** (cycle 2+) | `plan-creator.md`, `plan-mini-explorer.md` (if exists), Maker-routed findings from `act-feedback.md` | Explorer research, Guardian/Skeptic findings (those went to Creator) |
**Maker context injection template (cycle 2+):** **Maker context injection template (cycle 2+):**
```markdown ```markdown
@@ -254,6 +255,7 @@ Before injecting an artifact into an agent's context, always check if the file e
| Artifact | Missing when | | Artifact | Missing when |
|----------|-------------| |----------|-------------|
| `plan-explorer.md` | Fast workflow (no Explorer) | | `plan-explorer.md` | Fast workflow (no Explorer) |
| `plan-mini-explorer.md` | Confidence gate did not trigger for risk coverage |
| `check-skeptic.md` | Fast workflow, or A2 fast-path taken | | `check-skeptic.md` | Fast workflow, or A2 fast-path taken |
| `check-sage.md` | Fast workflow, or A2 fast-path taken | | `check-sage.md` | Fast workflow, or A2 fast-path taken |
| `check-trickster.md` | Non-thorough workflow, or A2 fast-path taken | | `check-trickster.md` | Non-thorough workflow, or A2 fast-path taken |

View File

@@ -126,17 +126,78 @@ After Creator returns:
#### 1c. Confidence Gate (Adaptation Rule A3) #### 1c. Confidence Gate (Adaptation Rule A3)
Read Creator's confidence scores from `plan-creator.md`. Apply A3 per `archeflow:orchestration`: **Parsing instructions:**
- Task understanding < 0.5 → **Pause**, ask user
- Solution completeness < 0.5 → **Upgrade** to standard, spawn Explorer Read `plan-creator.md`, locate the `### Confidence` table. Extract scores for each axis as floats:
- Risk coverage < 0.5 → **Spawn mini-Explorer** for risky area (parallel, 5 min max)
```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 ```bash
./lib/archeflow-event.sh "$RUN_ID" decision plan "" \ ./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 #### 1d. Phase Transition: Plan to Do
```bash ```bash