Skill Tracer
Skills › Compound Engineering › ce-optimize › judge-prompt-template.md

judge-prompt-template.md

117 lines · skills/ce-optimize/references/judge-prompt-template.md at 3449230

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1# Judge Evaluation Prompt Template
2
3This template is used by the orchestrator to dispatch batched LLM-as-judge evaluation calls. Each judge sub-agent evaluates a batch of sampled output items and returns structured JSON scores.
4
5The orchestrator:
61. Reads the experiment's output
72. Selects samples per the stratification config (using fixed seed)
83. Groups samples into batches of `judge.batch_size`
94. Dispatches `ceil(sample_size / batch_size)` parallel sub-agents using this template
105. Aggregates returned JSON scores
12---

Judge Evaluation Prompt Template

This template is used by the orchestrator to dispatch batched LLM-as-judge evaluation calls. Each judge sub-agent evaluates a batch of sampled output items and returns structured JSON scores.

The orchestrator:

  1. Reads the experiment's output
  2. Selects samples per the stratification config (using fixed seed)
  3. Groups samples into batches of judge.batch_size
  4. Dispatches ceil(sample_size / batch_size) parallel sub-agents using this template
  5. Aggregates returned JSON scores

Raw lines 1 to 13
Starts an agent dispatch :3
Starts an agent sub-agent :3
Starts an agent Dispatches :9
Starts an agent sub-agents :9
14## Item Evaluation Template
16```
17You are a quality judge evaluating output items for an optimization experiment.
19Your job is to score each item using the rubric below and return structured JSON. Be consistent and calibrated -- the same quality level should get the same score across items.
21<rubric>
22{rubric}
23</rubric>
25<items>
26{items_json}
27</items>
29<output-contract>
30Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.
32Each element must have:
33- "item_id": the identifier of the item being evaluated (string or number, matching the input)
34- All fields requested by the rubric (scores, counts, etc.)
35- "reason": one short sentence naming what most held this item's score down, or what earned it the score when nothing did
36- "feedback": one or two sentences naming what is wrong with this item and what change would fix it. For an item at the top of the scale, name what keeps it there. This text drives the next round of hypotheses, so name the defect, not the score.
37- "ambiguous": true if you cannot confidently score this item (e.g., insufficient context, borderline case). When ambiguous, still provide your best-guess score but flag it.
39Example output format (adapt field names to match the rubric):
41 {"item_id": "cluster-42", "score": 4, "distinct_topics": 1, "outlier_count": 0, "reason": "One coherent topic; the title undersells it.", "ambiguous": false, "feedback": "The topic is coherent but the title is vague; name the shared login issue in the title."},
42 {"item_id": "cluster-17", "score": 2, "distinct_topics": 3, "outlier_count": 2, "reason": "Three unrelated topics merged because all mention 'timeout'.", "ambiguous": false, "feedback": "Three unrelated topics grouped on the shared word 'timeout'; splitting on the affected component would fix it."},
43 {"item_id": "cluster-99", "score": 3, "distinct_topics": 2, "outlier_count": 1, "reason": "Two related topics; unclear whether the rubric wants them split.", "ambiguous": true, "feedback": "Two sub-topics (import and export failures) that could reasonably be one or two clusters."}
46Rules:
47- Evaluate each item independently
48- Score the same content the same way every time: the same item must receive the same score and the same fields on a repeat call
49- Score based on the rubric, not on how other items in this batch scored
50- If an item is empty or has only 1 element when it should have more, score it based on what is present
51- For very large items (many elements), focus on a representative subset and note if quality varies across the item
52- Every item in the batch MUST appear in your output
53</output-contract>
54```

Item Evaluation Template

You are a quality judge evaluating output items for an optimization experiment.

Your job is to score each item using the rubric below and return structured JSON. Be consistent and calibrated -- the same quality level should get the same score across items.

<rubric>
{rubric}
</rubric>

<items>
{items_json}
</items>

<output-contract>
Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.

Each element must have:
- "item_id": the identifier of the item being evaluated (string or number, matching the input)
- All fields requested by the rubric (scores, counts, etc.)
- "reason": one short sentence naming what most held this item's score down, or what earned it the score when nothing did
- "feedback": one or two sentences naming what is wrong with this item and what change would fix it. For an item at the top of the scale, name what keeps it there. This text drives the next round of hypotheses, so name the defect, not the score.
- "ambiguous": true if you cannot confidently score this item (e.g., insufficient context, borderline case). When ambiguous, still provide your best-guess score but flag it.

Example output format (adapt field names to match the rubric):
[
  {"item_id": "cluster-42", "score": 4, "distinct_topics": 1, "outlier_count": 0, "reason": "One coherent topic; the title undersells it.", "ambiguous": false, "feedback": "The topic is coherent but the title is vague; name the shared login issue in the title."},
  {"item_id": "cluster-17", "score": 2, "distinct_topics": 3, "outlier_count": 2, "reason": "Three unrelated topics merged because all mention 'timeout'.", "ambiguous": false, "feedback": "Three unrelated topics grouped on the shared word 'timeout'; splitting on the affected component would fix it."},
  {"item_id": "cluster-99", "score": 3, "distinct_topics": 2, "outlier_count": 1, "reason": "Two related topics; unclear whether the rubric wants them split.", "ambiguous": true, "feedback": "Two sub-topics (import and export failures) that could reasonably be one or two clusters."}
]

Rules:
- Evaluate each item independently
- Score the same content the same way every time: the same item must receive the same score and the same fields on a repeat call
- Score based on the rubric, not on how other items in this batch scored
- If an item is empty or has only 1 element when it should have more, score it based on what is present
- For very large items (many elements), focus on a representative subset and note if quality varies across the item
- Every item in the batch MUST appear in your output
</output-contract>
Raw lines 14 to 55
56## Singleton Evaluation Template
58```
59You are a quality judge evaluating singleton items -- items that are currently NOT in any group/cluster.
61Your job is to determine whether each singleton should have been grouped with an existing cluster, or whether it is genuinely unique. Return structured JSON.
63<rubric>
64{singleton_rubric}
65</rubric>
67<singletons>
68{singletons_json}
69</singletons>
71<existing-clusters>
72A summary of existing clusters for reference (titles/themes only, not full contents):
73{cluster_summaries}
74</existing-clusters>
76<output-contract>
77Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.
79Each element must have:
80- "item_id": the identifier of the singleton
81- All fields requested by the singleton rubric (should_cluster, best_cluster_id, confidence, etc.)
83Example output format (adapt field names to match the rubric):
85 {"item_id": "issue-1234", "should_cluster": true, "best_cluster_id": "cluster-42", "confidence": 4},
86 {"item_id": "issue-5678", "should_cluster": false, "best_cluster_id": null, "confidence": 5}
89Rules:
90- A singleton that genuinely has no match in existing clusters should get should_cluster: false
91- A singleton that clearly belongs in an existing cluster should get should_cluster: true with the cluster ID
92- High confidence (4-5) means you are very sure. Low confidence (1-2) means the item is borderline.
93- Every singleton in the batch MUST appear in your output
94</output-contract>
95```

Singleton Evaluation Template

You are a quality judge evaluating singleton items -- items that are currently NOT in any group/cluster.

Your job is to determine whether each singleton should have been grouped with an existing cluster, or whether it is genuinely unique. Return structured JSON.

<rubric>
{singleton_rubric}
</rubric>

<singletons>
{singletons_json}
</singletons>

<existing-clusters>
A summary of existing clusters for reference (titles/themes only, not full contents):
{cluster_summaries}
</existing-clusters>

<output-contract>
Return ONLY a valid JSON array. No prose, no markdown, no explanation outside the JSON.

Each element must have:
- "item_id": the identifier of the singleton
- All fields requested by the singleton rubric (should_cluster, best_cluster_id, confidence, etc.)

Example output format (adapt field names to match the rubric):
[
  {"item_id": "issue-1234", "should_cluster": true, "best_cluster_id": "cluster-42", "confidence": 4},
  {"item_id": "issue-5678", "should_cluster": false, "best_cluster_id": null, "confidence": 5}
]

Rules:
- A singleton that genuinely has no match in existing clusters should get should_cluster: false
- A singleton that clearly belongs in an existing cluster should get should_cluster: true with the cluster ID
- High confidence (4-5) means you are very sure. Low confidence (1-2) means the item is borderline.
- Every singleton in the batch MUST appear in your output
</output-contract>
Raw lines 56 to 96
97## Variable Reference
99| Variable | Source | Description |
100|----------|--------|-------------|
101| `{rubric}` | Spec `metric.judge.rubric` | User-defined scoring rubric |
102| `{items_json}` | Sampled output items | JSON array of items to evaluate (one batch worth) |
103| `{singleton_rubric}` | Spec `metric.judge.singleton_rubric` | User-defined rubric for singleton evaluation |
104| `{singletons_json}` | Sampled singleton items | JSON array of singleton items to evaluate |
105| `{cluster_summaries}` | Experiment output | Summary of existing clusters (titles/themes) for singleton reference |

Variable Reference

VariableSourceDescription
{rubric}Spec metric.judge.rubricUser-defined scoring rubric
{items_json}Sampled output itemsJSON array of items to evaluate (one batch worth)
{singleton_rubric}Spec metric.judge.singleton_rubricUser-defined rubric for singleton evaluation
{singletons_json}Sampled singleton itemsJSON array of singleton items to evaluate
{cluster_summaries}Experiment outputSummary of existing clusters (titles/themes) for singleton reference
Raw lines 97 to 106
107## Notes
109- Written for the `cheap` judge tier by default (`metric.judge.model`) -- prompts are concise and well-structured for smaller models; the harness resolves the tier to a concrete model
110- Where the dispatch surface exposes sampling controls, use the most deterministic setting available; the same item must score the same on a repeat call, which is what makes the run's judge cache and the calibration check valid
111- The rubric is part of the immutable measurement harness -- the experiment agent cannot modify it
112- The `reason` field does not change the score. The orchestrator keeps the reasons for the worst-scoring items so later hypotheses and workers can see why items failed, not just how much
113- The `feedback` field is required on every item. The orchestrator persists it under `judge.items[]`, groups it into the digest's failure themes, and generates hypotheses from those themes; a batch without feedback gives the loop nothing to act on
114- The `ambiguous` flag on items helps the orchestrator identify noisy evaluations without forcing bad scores
115- For singleton evaluation, the orchestrator provides cluster summaries (not full contents) to keep judge context lean
116- Each sub-agent evaluates one batch independently -- sub-agents do not see each other's results
117- **That independence is required, not merely preferred.** These scores decide accept or revert, so a judge must be a separate context from the one that authored the hypothesis and ran the experiment. Where no dispatch is available, block the judge pass rather than scoring inline. An orchestrator grading its own experiment is not a measurement.

Notes

  • Written for the cheap judge tier by default (metric.judge.model) -- prompts are concise and well-structured for smaller models; the harness resolves the tier to a concrete model
  • Where the dispatch surface exposes sampling controls, use the most deterministic setting available; the same item must score the same on a repeat call, which is what makes the run's judge cache and the calibration check valid
  • The rubric is part of the immutable measurement harness -- the experiment agent cannot modify it
  • The reason field does not change the score. The orchestrator keeps the reasons for the worst-scoring items so later hypotheses and workers can see why items failed, not just how much
  • The feedback field is required on every item. The orchestrator persists it under judge.items[], groups it into the digest's failure themes, and generates hypotheses from those themes; a batch without feedback gives the loop nothing to act on
  • The ambiguous flag on items helps the orchestrator identify noisy evaluations without forcing bad scores
  • For singleton evaluation, the orchestrator provides cluster summaries (not full contents) to keep judge context lean
  • Each sub-agent evaluates one batch independently -- sub-agents do not see each other's results
  • That independence is required, not merely preferred. These scores decide accept or revert, so a judge must be a separate context from the one that authored the hypothesis and ran the experiment. Where no dispatch is available, block the judge pass rather than scoring inline. An orchestrator grading its own experiment is not a measurement.
Raw lines 107 to 117
Starts an agent dispatch :110
Starts an agent sub-agent :116
Starts an agent sub-agents :116