Skill: prairiedoggg/multi-model-critique (version 1.0.1)

--- name: multi-model-critique description: Run complex prompts through a multi-model deliberation pipeline with structured self-improvement. Use when the user sets a complex flag (e.g., complex=true/complex) or asks for high-stakes, ambiguous, or long-form reasoning where one model is not enough. Produces outputs by: (1) parallel model runs, (2) cross-critique, (3) critique-driven revision, and (4) final synthesized answer with uncertainties and evidence notes. metadata: {"openclaw":{"emoji":"🧠"}} --- # Multi-Model Critique ## Overview Use this skill only for complex tasks. Route multiple models through the same 4-step loop (`Plan -> Execute -> Review -> Improve`), then run cross-critique and synthesis to produce a higher-quality final answer than any single-model draft. ## Trigger rule Enable this skill only when the request explicitly sets `complex` to true (or equivalent wording such as “this is complex/deep”). If `complex` is false, skip this skill and respond with normal single-model behavior. ## Inputs Collect or confirm these inputs before execution: - `complex`: boolean flag (must be true) - `question`: user request - `models`: list of ACP `agentId` values (typically 3) - `constraints`: output format, language, length, deadlines, forbidden assumptions - `ops`: optional runtime controls (`timeoutSec`, `maxRetries`, `maxRounds`, `budgetUsd`) ## File map (what each file does) - `SKILL.md` (this file): orchestration policy, trigger conditions, and execution sequence. - `references/prompt-templates.md`: reusable prompts for draft, critique, revision, and final synthesis (includes scoring rubric usage). - `references/orchestration-template.md`: practical OpenClaw orchestration flow using `sessions_spawn`, `sessions_send`, and `sessions_history`. - `references/output-schema.md`: machine-parseable JSON output schema for final result and per-model scoring. - `scripts/build_round_prompts.py`: utility to generate per-model prompt files for repeated runs. - `scripts/run_orchestration.py`: local helper that builds a run plan JSON (model mapping, round prompts, runtime settings). ## Workflow ### Step 1) Parallel draft round Spawn one ACP session per model with the same task and constraints. Per-model requirements: - Follow the exact internal sequence: `Plan -> Execute -> Review -> Improve` - Print all four sections explicitly - End with `Draft Answer` Use `sessions_spawn` with `runtime:"acp"` and explicit `agentId`. ### Step 2) Cross-critique round Share peer `Draft Answer` outputs with each model and require structured critique: - Strengths - Weaknesses - Missing assumptions/data - Hallucination and confidence risks - Concrete fix suggestions Also require ranking of peer drafts with rationale. ### Step 3) Revision round Send critique feedback back to each original model and request revision: - Keep `Plan -> Execute -> Review -> Improve` - Include `Changes from Critique` - End with `Revised Answer` ### Step 4) Final synthesis round Integrate revised answers into one user-facing output: - Best final answer - Why the synthesis is stronger than individual drafts - Remaining uncertainties - Optional next actions ## Scoring rubric (required in critique + synthesis) Score each draft on a 1-5 scale: - `accuracy`: factual correctness and internal consistency - `coverage`: completeness against user request and constraints - `evidence`: quality of assumptions and support - `actionability`: usefulness for concrete decision/action Default weighted score: `0.40 * accuracy + 0.25 * coverage + 0.20 * evidence + 0.15 * actionability` Use this score to justify rankings and the final selected direction. ## Prompting resources - Use `references/prompt-templates.md` for canonical prompts. - Use `scripts/build_round_prompts.py` when you need file-based prompt generation for repeated or batched runs. - Use `scripts/run_orchestration.py` to generate a deterministic run-plan artifact for reproducible execution. - Use `references/orchestration-template.md` for concrete OpenClaw tool-call flow. ## Required user-facing output shape 1. `Final Answer` 2. `Key Improvements from Critique` 3. `Uncertainties` 4. `Next Steps` (optional) When machine consumption is needed, return JSON matching `references/output-schema.md`. Do not expose private chain-of-thought. Provide concise reasoning summaries only. ## Failure handling - One model fails: continue with remaining models and note reduced diversity. - Two or more models fail: ask whether to retry or switch to single-model mode. - Strong disagreement remains: present competing hypotheses and state what evidence would resolve them. ## Runtime defaults (recommended) - `timeoutSec`: 180 per round per model - `maxRetries`: 1 per failed model turn - `maxRounds`: fixed at 4 (draft, critique, revision, synthesis) - `budgetUsd`: optional hard stop when cost-sensitive

path: references/orchestration-template.md
content: # Orchestration Template (OpenClaw ACP)

This document shows a practical execution pattern for the `complex=true` path using OpenClaw tools.

## Goal
Run a 4-round deliberation workflow:
1. Parallel Drafts
2. Cross-Critique
3. Revision
4. Final Synthesis

Each model must follow internal sections:
`Plan -> Execute -> Review -> Improve`

---

## 0) Configure model mapping

Example mapping (replace with your real ACP agent IDs):

```json
{
  "models": [
    { "name": "codex",  "agentId": "acp-codex" },
    { "name": "claude", "agentId": "acp-claude" },
    { "name": "gemini", "agentId": "acp-gemini" }
  ]
}
```

If the user provides only model names, resolve names to allowed ACP harness IDs before spawning.

---

## 1) Round 1: spawn parallel drafts

Call `sessions_spawn` once per model:

```json
{
  "runtime": "acp",
  "agentId": "acp-codex",
  "thread": true,
  "mode": "session",
  "task": "<INITIAL_PROMPT_WITH_PLAN_EXECUTE_REVIEW_IMPROVE>",
  "label": "mmc-codex-draft"
}
```

Repeat for each model.

### Collect outputs
For each spawned session, use `sessions_history` to extract `Draft Answer`.
Store by model key:

```json
{
  "drafts": {
    "codex": "...",
    "claude": "...",
    "gemini": "..."
  }
}
```

---

## 2) Round 2: cross-critique

For each model session, send a critique prompt with:
- its own draft (`SELF_DRAFT`)
- peer drafts (`PEER_DRAFTS`)

Use `sessions_send`:

```json
{
  "sessionKey": "<model_session_key>",
  "message": "<CRITIQUE_PROMPT>"
}
```

Collect critique outputs into:

```json
{
  "critiques": {
    "codex": "...",
    "claude": "...",
    "gemini": "..."
  }
}
```

---

## 3) Round 3: revision

Send each model:
- original draft
- critiques targeting that model

Again use `sessions_send` to the same persistent session.
Require explicit sections:
- Plan
- Execute
- Review
- Improve
- Changes from Critique
- Revised Answer

Collect:

```json
{
  "revised": {
    "codex": "...",
    "claude": "...",
    "gemini": "..."
  }
}
```

---

## 4) Round 4: final synthesis

Option A (recommended): synthesize in main agent directly from `revised` map.

Option B: spawn one additional ACP synthesis session and feed all revised answers.

Expected final user format:
1. Final Answer
2. Key Improvements from Critique
3. Uncertainties
4. Next Steps (optional)

---

## Operational guardrails

- If one model fails: continue and disclose reduced model diversity.
- If 2+ models fail: ask user to retry vs fallback.
- If hard contradictions remain: present multiple hypotheses and a verification plan.
- Never expose private chain-of-thought; expose only concise rationale and decisions.

---

## Minimal run checklist

- [ ] `complex == true` confirmed
- [ ] 3 model `agentId`s resolved
- [ ] Round 1 draft prompts sent
- [ ] Draft outputs captured
- [ ] Round 2 critique prompts sent
- [ ] Critiques captured
- [ ] Round 3 revision prompts sent
- [ ] Revised outputs captured
- [ ] Round 4 final synthesis delivered


path: references/output-schema.md
content: # Output Schema (JSON)

Use this schema when callers need machine-parseable results.

```json
{
  "schemaVersion": "1.0.0",
  "question": "string",
  "models": [
    {
      "name": "codex",
      "agentId": "acp-codex",
      "status": "ok|failed",
      "scores": {
        "accuracy": 1,
        "coverage": 1,
        "evidence": 1,
        "actionability": 1,
        "weighted": 1.0
      },
      "draft": "string",
      "critique": "string",
      "revised": "string",
      "error": "string|null"
    }
  ],
  "final": {
    "answer": "string",
    "keyImprovements": ["string"],
    "uncertainties": ["string"],
    "nextSteps": ["string"],
    "confidence": "low|medium|high"
  },
  "ops": {
    "timeoutSec": 180,
    "maxRetries": 1,
    "maxRounds": 4,
    "budgetUsd": null
  },
  "timestamps": {
    "startedAt": "ISO-8601",
    "finishedAt": "ISO-8601"
  }
}
```

## Notes
- Keep `scores.*` on a 1-5 scale, except `weighted` which is a float.
- Use `status="failed"` with `error` when a model round fails.
- Keep text fields concise if the payload is sent through chat channels.


path: references/prompt-templates.md
content: # Prompt Templates

This file contains canonical prompt templates for each round in the multi-model critique pipeline.

## Usage notes
- Keep all models on the same task statement and constraints.
- Keep output structure identical across models for easier comparison.
- Keep language aligned to user preference (default here: Korean unless overridden).

## A. Initial draft prompt (per model)

Use this for each model independently in Round 1.

```text
You are model {MODEL_NAME}. Solve the task with this exact internal sequence:
1) Plan
2) Execute
3) Review
4) Improve

Rules:
- Be concrete and evidence-aware.
- State assumptions.
- Flag uncertainty explicitly.
- Keep output in Korean unless user asked otherwise.

User question:
{QUESTION}

Constraints:
{CONSTRAINTS}

Output format:
## Plan
...
## Execute
...
## Review
...
## Improve
...
## Draft Answer
...
```

## B. Cross-critique prompt (per model)

Use this in Round 2 after collecting all draft answers.

```text
You are model {MODEL_NAME}. Critique peer drafts.

Your own draft (for reference):
{SELF_DRAFT}

Peer drafts:
{PEER_DRAFTS}

Evaluate each peer draft on:
1) Strengths
2) Weaknesses
3) Missing assumptions/data
4) Hallucination/confidence risks
5) Concrete fixes

Score each peer draft (1-5) on:
- Accuracy (weight 0.40)
- Coverage (weight 0.25)
- Evidence quality (weight 0.20)
- Actionability (weight 0.15)

Then rank peer drafts (best to worst) with reasons and weighted score.

Output format:
## Critique of Peer A
...
## Critique of Peer B
...
## Ranking
1) ...
2) ...
## Highest-impact fixes to apply globally
...
```

## C. Revision prompt (per model)

Use this in Round 3, feeding each model the critiques that target its own draft.

```text
You are model {MODEL_NAME}. Revise your answer using received critiques.

Original draft:
{SELF_DRAFT}

Critiques received:
{CRITIQUES_FOR_SELF}

Run this sequence exactly:
1) Plan
2) Execute
3) Review
4) Improve

Output format:
## Plan
...
## Execute
...
## Review
...
## Improve
...
## Changes from Critique
- ...
## Revised Answer
...
```

## D. Final synthesis prompt

Use this in Round 4 to produce the final user-facing response.

```text
Synthesize one final response from revised answers.

Revised answers:
{REVISED_ANSWERS}

Requirements:
- Provide a single best final answer.
- Explain key improvements gained from cross-critique.
- List uncertainties/open questions.
- Suggest next actions if helpful.

Output format:
## Final Answer
...
## Key Improvements from Critique
...
## Uncertainties
...
## Next Steps
...
```


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)