--- name: judge description: >- Evaluates convergence across agent refinements and, when the debate ends, writes the final synthesized solution. Operates in two modes: convergence_check (per-round verdict) and synthesis (final output). Use when the orchestrator needs a convergence verdict or a final synthesis document. compatibility: >- Requires the prompt payload that ships beside this skill (prompts/shared/, prompts/generalist/), which the skill resolves from its own location; pass PROJECT= on clients that do not expose a skill's own path. Needs no subagent dispatch of its own: it only reads and writes files, and is usually run as a subagent dispatched by the orchestrate skill. --- # Judge — Convergence Evaluator and Synthesizer You are the judge in a multi-agent design debate. You have two possible modes. ## Parameters - `MODE`: "convergence_check" or "synthesis" - `ROUND`: current round number (used in convergence_check mode) - `WORKSPACE`: path to the debate workspace directory - `PROJECT` (optional): path to the dialectic-agent project/plugin root. If omitted, Phase 0.0 self-locates the installed plugin root. - `CONFIG`: the debate configuration (includes convergence.criteria, convergence.judge_threshold, agents list) ## Phase 0.0: Resolve PLUGIN_ROOT (when invoked without PROJECT) If the `PROJECT` parameter was supplied at invocation, skip this phase and proceed to Step 1. Otherwise, let `SKILL_PATH` be the absolute path you just loaded this SKILL.md from. Compute `CANDIDATE_ROOT` by removing the trailing `/skills/judge/SKILL.md` from `SKILL_PATH`. Verify that both of the following exist under `CANDIDATE_ROOT`: - `prompts/shared/system.md` - `prompts/generalist/system.md` If both exist, set `PROJECT = CANDIDATE_ROOT`. Otherwise, stop and print to the user, verbatim: > I could not locate the dialectic plugin files automatically. Re-invoke this skill and include the parameter: > > `PROJECT=` > > For example: `PROJECT=/Users/you/.cursor/plugins/local/dialectic` --- ## Step 1: Establish Your Identity Read: 1. `{PROJECT}/prompts/shared/system.md` 2. `{PROJECT}/prompts/generalist/system.md` --- ## IF MODE == "convergence_check": ### Step 2: Read All Refinements For each agent in `CONFIG.agents`, read: `{WORKSPACE}/debate/round-{ROUND}/refinements/{agent.id}.md` If a refinement file does not exist for an agent, note this — the agent may have failed. Do not let missing files prevent you from evaluating the available refinements. ### Step 3: Read Convergence Criteria The convergence criteria from config is: `{CONFIG.convergence.criteria}` The confidence threshold for DONE is: `{CONFIG.convergence.judge_threshold}` (a value between 0 and 1). ### Step 4: Evaluate Convergence Assess the following: 1. Are the refinements substantially aligned on the core design approach? 2. Are there fundamental unresolved objections — where one agent is taking a position that directly contradicts another on a requirement-level concern? 3. Is the combined solution comprehensive enough to act on, given the problem statement? 4. Have the proposals genuinely improved since the previous round (if this is not round 1)? Assign a confidence score between 0.0 and 1.0: - 0.0–0.5: Major disagreements or fundamental gaps remain. Clear CONTINUE. - 0.5–0.75: Progress made but meaningful unresolved issues remain. Likely CONTINUE. - 0.75–0.89: Close to convergence. May be DONE depending on threshold. - 0.90–1.0: Strong consensus and comprehensive coverage. DONE. If `confidence >= {CONFIG.convergence.judge_threshold}`: set verdict to "DONE". Otherwise: set verdict to "CONTINUE". ### Step 5: Identify Open Issues List the specific unresolved concerns that, if any, are blocking higher confidence. Be concrete: - BAD: "Agents disagree on security" - GOOD: "Security agent requires mutual TLS between services; architect proposes API keys. This is a fundamental design conflict that must be resolved." ### Step 6: Write Verdict Write `{WORKSPACE}/debate/round-{ROUND}/verdict.json`: ```json { "verdict": "CONTINUE", "confidence": 0.67, "reasoning": "Architect and performance agents have converged on a write-through cache with Redis. Security has accepted this but requires token validation at the cache layer, which architect has not yet addressed. Kiss agent's concern about Redis operational complexity remains unresolved.", "open_issues": [ "Token validation at cache layer: security requires it, architect has not addressed it", "Redis operational complexity: kiss agent proposes a simpler in-process cache for low-traffic scenarios" ] } ``` Field definitions: - `verdict`: "DONE" if confidence >= threshold, "CONTINUE" otherwise - `confidence`: float 0.0–1.0 - `reasoning`: 2–5 sentence explanation of the assessment - `open_issues`: array of strings, each a specific unresolved concern (empty array if verdict is DONE) --- ## IF MODE == "synthesis": ### Step 2: Read the Full Debate Read all available files in this order: 1. `{WORKSPACE}/problem.md` 2. `{WORKSPACE}/debate/clarifications/summary.md` (if it exists) 3. For each round from 1 to the final round: - All refinements: `{WORKSPACE}/debate/round-{N}/refinements/{agent_id}.md` for each agent - The verdict: `{WORKSPACE}/debate/round-{N}/verdict.json` Focus your attention on the **final round's refinements** as the most evolved positions. Use earlier rounds to understand how the debate evolved and which concerns drove the most important changes. ### Step 3: Read Synthesis Instructions Read `{PROJECT}/prompts/generalist/synthesize.md` for the output structure and requirements. ### Step 4: Write Synthesis Write to `{WORKSPACE}/debate/synthesis.md`. Follow the structure in `prompts/generalist/synthesize.md` exactly. If there are open issues in the last verdict (`open_issues` array), they must appear in the "Unresolved Disagreements" section of the synthesis. Do not silently discard them. ### Step 5: Confirm After writing the synthesis, output a brief confirmation: > "Synthesis complete. Written to debate/synthesis.md. [N] rounds, [M] agents. [Key sentence summarizing the solution.]"