@assertrx/dino 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +293 -0
- package/extensions/dino.ts +70 -0
- package/extensions/mabl-mcp.ts +306 -0
- package/extensions/playwright-mcp.ts +142 -0
- package/package.json +47 -0
- package/prompts/create-pr.md +110 -0
- package/prompts/generate-bdd-from-url.md +65 -0
- package/prompts/generate-pom-from-url-cli.md +48 -0
- package/prompts/generate-pom-from-url.md +45 -0
- package/prompts/generate-spec-from-feature.md +64 -0
- package/prompts/heal-playwright-failures.md +106 -0
- package/prompts/setup-playwright.md +81 -0
- package/scripts/start-dino.cmd +8 -0
- package/scripts/start-dino.mjs +226 -0
- package/scripts/start-dino.ps1 +9 -0
- package/scripts/start-dino.sh +10 -0
- package/skills/acli/SKILL.md +292 -0
- package/skills/bdd-gherkin/SKILL.md +552 -0
- package/skills/build-review-interface/SKILL.md +96 -0
- package/skills/error-analysis/SKILL.md +164 -0
- package/skills/eval-audit/SKILL.md +183 -0
- package/skills/evaluate-rag/SKILL.md +177 -0
- package/skills/generate-synthetic-data/SKILL.md +131 -0
- package/skills/mabl-mcp/SKILL.md +79 -0
- package/skills/playwright-cli/SKILL.md +246 -0
- package/skills/playwright-cli/advanced-workflows.md +679 -0
- package/skills/playwright-cli/core-commands.md +375 -0
- package/skills/playwright-cli/device-emulation.md +475 -0
- package/skills/playwright-cli/request-mocking.md +373 -0
- package/skills/playwright-cli/running-custom-code.md +553 -0
- package/skills/playwright-cli/screenshots-and-media.md +457 -0
- package/skills/playwright-cli/session-management.md +425 -0
- package/skills/playwright-cli/storage-and-auth.md +487 -0
- package/skills/playwright-cli/test-generation.md +336 -0
- package/skills/playwright-cli/tracing-and-debugging.md +501 -0
- package/skills/playwright-core/SKILL.md +101 -0
- package/skills/playwright-core/accessibility.md +1517 -0
- package/skills/playwright-core/angular.md +1086 -0
- package/skills/playwright-core/api-testing.md +1623 -0
- package/skills/playwright-core/assertions-and-waiting.md +703 -0
- package/skills/playwright-core/auth-flows.md +1081 -0
- package/skills/playwright-core/authentication.md +1409 -0
- package/skills/playwright-core/browser-apis.md +673 -0
- package/skills/playwright-core/browser-extensions.md +319 -0
- package/skills/playwright-core/canvas-and-webgl.md +494 -0
- package/skills/playwright-core/clock-and-time-mocking.md +427 -0
- package/skills/playwright-core/common-pitfalls.md +1318 -0
- package/skills/playwright-core/component-testing.md +1179 -0
- package/skills/playwright-core/configuration.md +731 -0
- package/skills/playwright-core/crud-testing.md +945 -0
- package/skills/playwright-core/debugging.md +827 -0
- package/skills/playwright-core/drag-and-drop.md +992 -0
- package/skills/playwright-core/electron-testing.md +622 -0
- package/skills/playwright-core/error-and-edge-cases.md +1181 -0
- package/skills/playwright-core/error-index.md +1903 -0
- package/skills/playwright-core/file-operations.md +749 -0
- package/skills/playwright-core/file-upload-download.md +1012 -0
- package/skills/playwright-core/fixtures-and-hooks.md +1072 -0
- package/skills/playwright-core/flaky-tests.md +883 -0
- package/skills/playwright-core/forms-and-validation.md +1056 -0
- package/skills/playwright-core/i18n-and-localization.md +622 -0
- package/skills/playwright-core/iframes-and-shadow-dom.md +488 -0
- package/skills/playwright-core/locator-strategy.md +588 -0
- package/skills/playwright-core/locators.md +743 -0
- package/skills/playwright-core/mobile-and-responsive.md +1669 -0
- package/skills/playwright-core/multi-context-and-popups.md +581 -0
- package/skills/playwright-core/multi-user-and-collaboration.md +477 -0
- package/skills/playwright-core/network-mocking.md +1395 -0
- package/skills/playwright-core/nextjs.md +1013 -0
- package/skills/playwright-core/performance-testing.md +608 -0
- package/skills/playwright-core/react.md +1082 -0
- package/skills/playwright-core/search-and-filter.md +1366 -0
- package/skills/playwright-core/security-testing.md +624 -0
- package/skills/playwright-core/service-workers-and-pwa.md +524 -0
- package/skills/playwright-core/test-architecture.md +569 -0
- package/skills/playwright-core/test-data-management.md +1209 -0
- package/skills/playwright-core/test-organization.md +947 -0
- package/skills/playwright-core/third-party-integrations.md +754 -0
- package/skills/playwright-core/trace-analysis.md +161 -0
- package/skills/playwright-core/visual-regression.md +1027 -0
- package/skills/playwright-core/vue.md +1162 -0
- package/skills/playwright-core/websockets-and-realtime.md +623 -0
- package/skills/playwright-core/when-to-mock.md +827 -0
- package/skills/playwright-pom/SKILL.md +94 -0
- package/skills/playwright-pom/page-object-model.md +921 -0
- package/skills/playwright-pom/pom-vs-fixtures-vs-helpers.md +937 -0
- package/skills/validate-evaluator/SKILL.md +215 -0
- package/skills/write-judge-prompt/SKILL.md +144 -0
- package/themes/dino.json +66 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: validate-evaluator
|
|
3
|
+
description: >
|
|
4
|
+
Calibrate an LLM judge against human labels using data splits, TPR/TNR, and
|
|
5
|
+
bias correction. Use after writing a judge prompt (write-judge-prompt) when you
|
|
6
|
+
need to verify alignment before trusting its outputs. Do NOT use for code-based
|
|
7
|
+
evaluators (those are deterministic; test with standard unit tests).
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Validate Evaluator
|
|
11
|
+
|
|
12
|
+
Calibrate an LLM judge against human judgment.
|
|
13
|
+
|
|
14
|
+
## Overview
|
|
15
|
+
|
|
16
|
+
1. Split human-labeled data into train (10-20%), dev (40-45%), test (40-45%)
|
|
17
|
+
2. Run judge on dev set and measure TPR/TNR
|
|
18
|
+
3. Iterate on the judge until TPR and TNR > 90% on dev set
|
|
19
|
+
4. Run once on held-out test set for final TPR/TNR
|
|
20
|
+
5. Apply bias correction formula to production data
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
- A built LLM judge prompt (from write-judge-prompt)
|
|
25
|
+
- Human-labeled data: ~100 traces with binary Pass/Fail labels per failure mode
|
|
26
|
+
- Aim for ~50 Pass and ~50 Fail (balanced, even if real distribution is skewed)
|
|
27
|
+
- Labels must come from a domain expert, not outsourced annotators
|
|
28
|
+
- Candidate few-shot examples from your labeled data
|
|
29
|
+
|
|
30
|
+
## Core Instructions
|
|
31
|
+
|
|
32
|
+
### Step 1: Create Data Splits
|
|
33
|
+
|
|
34
|
+
Split human-labeled data into three disjoint sets:
|
|
35
|
+
|
|
36
|
+
| Split | Size | Purpose | Rules |
|
|
37
|
+
|-------|------|---------|-------|
|
|
38
|
+
| **Training** | 10-20% (~10-20 examples) | Source of few-shot examples for the judge prompt | Only clear-cut Pass and Fail cases. Used directly in the prompt. |
|
|
39
|
+
| **Dev** | 40-45% (~40-45 examples) | Iterative evaluator refinement | Never include in the prompt. Evaluate against repeatedly. |
|
|
40
|
+
| **Test** | 40-45% (~40-45 examples) | Final unbiased accuracy measurement | Do NOT look at during development. Used once at the end. |
|
|
41
|
+
|
|
42
|
+
Target: 30-50 examples of each class (Pass and Fail) across dev and test combined. Use balanced splits even if real-world prevalence is skewed — you need enough Fail examples to measure TNR reliably.
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from sklearn.model_selection import train_test_split
|
|
46
|
+
|
|
47
|
+
# First split: separate test set
|
|
48
|
+
train_dev, test = train_test_split(
|
|
49
|
+
labeled_data, test_size=0.4, stratify=labeled_data['label'], random_state=42
|
|
50
|
+
)
|
|
51
|
+
# Second split: separate training examples from dev set
|
|
52
|
+
train, dev = train_test_split(
|
|
53
|
+
train_dev, test_size=0.75, stratify=train_dev['label'], random_state=42
|
|
54
|
+
)
|
|
55
|
+
# Result: ~15% train, ~45% dev, ~40% test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 2: Run Evaluator on Dev Set
|
|
59
|
+
|
|
60
|
+
Run the judge on every example in the dev set. Compare predictions to human labels.
|
|
61
|
+
|
|
62
|
+
### Step 3: Measure TPR and TNR
|
|
63
|
+
|
|
64
|
+
**TPR (True Positive Rate):** When a human says Pass, how often does the judge also say Pass?
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
TPR = (judge says Pass AND human says Pass) / (human says Pass)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**TNR (True Negative Rate):** When a human says Fail, how often does the judge also say Fail?
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
TNR = (judge says Fail AND human says Fail) / (human says Fail)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from sklearn.metrics import confusion_matrix
|
|
78
|
+
|
|
79
|
+
tn, fp, fn, tp = confusion_matrix(human_labels, evaluator_labels,
|
|
80
|
+
labels=['Fail', 'Pass']).ravel()
|
|
81
|
+
tpr = tp / (tp + fn)
|
|
82
|
+
tnr = tn / (tn + fp)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use TPR/TNR, not Precision/Recall or raw accuracy. These two metrics directly map to the bias correction formula. Use Cohen's Kappa only for measuring agreement between two human annotators, not for judge-vs-ground-truth.
|
|
86
|
+
|
|
87
|
+
### Step 4: Inspect Disagreements
|
|
88
|
+
|
|
89
|
+
Examine every case where the judge disagrees with human labels:
|
|
90
|
+
|
|
91
|
+
| Disagreement Type | Judge | Human | Fix |
|
|
92
|
+
|-------------------|-------|-------|-----|
|
|
93
|
+
| **False Pass** | Pass | Fail | Judge is too lenient. Strengthen Fail definitions or add edge-case examples. |
|
|
94
|
+
| **False Fail** | Fail | Pass | Judge is too strict. Clarify Pass definitions or adjust examples. |
|
|
95
|
+
|
|
96
|
+
For each disagreement, determine whether to:
|
|
97
|
+
- Clarify wording in the judge prompt
|
|
98
|
+
- Swap or add few-shot examples from the training set
|
|
99
|
+
- Add explicit rules for the edge case
|
|
100
|
+
- Split the criterion into more specific sub-checks
|
|
101
|
+
|
|
102
|
+
### Step 5: Iterate
|
|
103
|
+
|
|
104
|
+
Refine the judge prompt and re-run on the dev set. Repeat until TPR and TNR stabilize.
|
|
105
|
+
|
|
106
|
+
**Stopping criteria:**
|
|
107
|
+
- **Target:** TPR > 90% AND TNR > 90%
|
|
108
|
+
- **Minimum acceptable:** TPR > 80% AND TNR > 80%
|
|
109
|
+
|
|
110
|
+
**If alignment stalls:**
|
|
111
|
+
|
|
112
|
+
| Problem | Solution |
|
|
113
|
+
|---------|---------|
|
|
114
|
+
| TPR and TNR both low | Use a more capable LLM for the judge |
|
|
115
|
+
| One metric low, one acceptable | Inspect disagreements for the low metric specifically |
|
|
116
|
+
| Both plateau below target | Decompose the criterion into smaller, more atomic checks |
|
|
117
|
+
| Consistently wrong on certain input types | Add targeted few-shot examples from training set |
|
|
118
|
+
| Labels themselves seem inconsistent | Re-examine human labels; the rubric may need refinement |
|
|
119
|
+
|
|
120
|
+
### Step 6: Final Measurement on Test Set
|
|
121
|
+
|
|
122
|
+
Run the judge **exactly once** on the held-out test set. Record final TPR and TNR.
|
|
123
|
+
|
|
124
|
+
Do not iterate after seeing test set results. Go back to step 4 with new dev data if needed.
|
|
125
|
+
|
|
126
|
+
### Step 7 (Optional): Estimate True Success Rate (Rogan-Gladen Correction)
|
|
127
|
+
|
|
128
|
+
Raw judge scores on unlabeled production data are biased. If you need an accurate aggregate pass rate, correct for known judge errors:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
theta_hat = (p_obs + TNR - 1) / (TPR + TNR - 1)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Where:
|
|
135
|
+
- `p_obs` = fraction of unlabeled traces the judge scored as Pass
|
|
136
|
+
- `TPR`, `TNR` = from test set measurement
|
|
137
|
+
- `theta_hat` = corrected estimate of true success rate
|
|
138
|
+
|
|
139
|
+
Clip to [0, 1]. Invalid when TPR + TNR - 1 is near 0 (judge is no better than random).
|
|
140
|
+
|
|
141
|
+
**Example:**
|
|
142
|
+
- Judge TPR = 0.92, TNR = 0.88
|
|
143
|
+
- 500 production traces: 400 scored Pass -> p_obs = 0.80
|
|
144
|
+
- theta_hat = (0.80 + 0.88 - 1) / (0.92 + 0.88 - 1) = 0.68 / 0.80 = **0.85**
|
|
145
|
+
- True success rate is ~85%, not the raw 80%
|
|
146
|
+
|
|
147
|
+
### Step 8: Confidence Interval
|
|
148
|
+
|
|
149
|
+
Compute a bootstrap confidence interval. A point estimate alone is not enough.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
import numpy as np
|
|
153
|
+
|
|
154
|
+
def bootstrap_ci(human_labels, eval_labels, p_obs, n_bootstrap=2000):
|
|
155
|
+
"""Bootstrap 95% CI for corrected success rate."""
|
|
156
|
+
n = len(human_labels)
|
|
157
|
+
estimates = []
|
|
158
|
+
for _ in range(n_bootstrap):
|
|
159
|
+
idx = np.random.choice(n, size=n, replace=True)
|
|
160
|
+
h = np.array(human_labels)[idx]
|
|
161
|
+
e = np.array(eval_labels)[idx]
|
|
162
|
+
|
|
163
|
+
tp = ((h == 'Pass') & (e == 'Pass')).sum()
|
|
164
|
+
fn = ((h == 'Pass') & (e == 'Fail')).sum()
|
|
165
|
+
tn = ((h == 'Fail') & (e == 'Fail')).sum()
|
|
166
|
+
fp = ((h == 'Fail') & (e == 'Pass')).sum()
|
|
167
|
+
|
|
168
|
+
tpr_b = tp / (tp + fn) if (tp + fn) > 0 else 0
|
|
169
|
+
tnr_b = tn / (tn + fp) if (tn + fp) > 0 else 0
|
|
170
|
+
denom = tpr_b + tnr_b - 1
|
|
171
|
+
|
|
172
|
+
if abs(denom) < 1e-6:
|
|
173
|
+
continue
|
|
174
|
+
theta = (p_obs + tnr_b - 1) / denom
|
|
175
|
+
estimates.append(np.clip(theta, 0, 1))
|
|
176
|
+
|
|
177
|
+
return np.percentile(estimates, 2.5), np.percentile(estimates, 97.5)
|
|
178
|
+
|
|
179
|
+
lower, upper = bootstrap_ci(test_human, test_eval, p_obs=0.80)
|
|
180
|
+
print(f"95% CI: [{lower:.2f}, {upper:.2f}]")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Or use `judgy` (`pip install judgy`):
|
|
184
|
+
|
|
185
|
+
```python
|
|
186
|
+
from judgy import estimate_success_rate
|
|
187
|
+
|
|
188
|
+
# judgy expects 0/1 integer labels (1 = Pass, 0 = Fail)
|
|
189
|
+
test_labels = [1 if l == 'Pass' else 0 for l in test_human_labels]
|
|
190
|
+
test_preds = [1 if l == 'Pass' else 0 for l in test_eval_labels]
|
|
191
|
+
unlabeled_preds = [1 if l == 'Pass' else 0 for l in prod_eval_labels]
|
|
192
|
+
|
|
193
|
+
theta_hat, lower, upper = estimate_success_rate(
|
|
194
|
+
test_labels, test_preds, unlabeled_preds
|
|
195
|
+
)
|
|
196
|
+
print(f"Corrected rate: {theta_hat:.2f}")
|
|
197
|
+
print(f"95% CI: [{lower:.2f}, {upper:.2f}]")
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Practical Guidance
|
|
201
|
+
|
|
202
|
+
- **Pin exact model versions** for LLM judges (a dated snapshot id like `<model>-<YYYY-MM-DD>`, not a floating alias). Providers update models without notice, causing silent drift.
|
|
203
|
+
- **Re-validate** after changing the judge prompt, switching models, or when production confidence intervals widen unexpectedly.
|
|
204
|
+
- Use ~100 labeled examples (50 Pass, 50 Fail). Below 60, confidence intervals become wide.
|
|
205
|
+
- **One trusted domain expert** is the most efficient labeling path. If not feasible, have two annotators label 20-50 traces independently and resolve disagreements before proceeding.
|
|
206
|
+
- **Improving TPR narrows the confidence interval more than improving TNR.** The correction divides by `(TPR + TNR - 1)`, so a low TPR shrinks the denominator and amplifies estimation errors into wide CIs.
|
|
207
|
+
|
|
208
|
+
## Anti-Patterns
|
|
209
|
+
|
|
210
|
+
- **Assuming judges "just work" without validation.** A judge may consistently miss failures or flag passing traces.
|
|
211
|
+
- **Using raw accuracy or percent agreement.** Use TPR and TNR. With class imbalance, raw accuracy is misleading.
|
|
212
|
+
- **Dev/test examples as few-shot examples.** This is data leakage.
|
|
213
|
+
- **Reporting dev set performance as final accuracy.** Dev numbers are optimistic. The test set gives the unbiased estimate.
|
|
214
|
+
- **Raw judge scores without bias correction.** If you report an aggregate pass rate, apply the Rogan-Gladen formula (Step 7).
|
|
215
|
+
- **Point estimates without confidence intervals.** A corrected rate of 85% could easily be 78-92% with small test sets. Report the range so stakeholders know how much to trust the number.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-judge-prompt
|
|
3
|
+
description: >
|
|
4
|
+
Design LLM-as-Judge evaluators for subjective criteria that code-based checks
|
|
5
|
+
cannot handle. Use when a failure mode requires interpretation (tone,
|
|
6
|
+
faithfulness, relevance, completeness). Do NOT use when the failure mode can be
|
|
7
|
+
checked with code (regex, schema validation, execution tests). Do NOT use when
|
|
8
|
+
you need to validate or calibrate the judge — use validate-evaluator instead.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Write LLM-as-Judge Prompt
|
|
12
|
+
|
|
13
|
+
Design a binary Pass/Fail LLM-as-Judge evaluator for one specific failure mode. Each judge checks exactly one thing.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- Error analysis is complete. The failure mode is identified.
|
|
18
|
+
- You have human-labeled traces for this failure mode (at least 20 Pass and 20 Fail examples).
|
|
19
|
+
- A code-based evaluator cannot check this failure mode. Exhaust code-based options before reaching for a judge — many failure modes that seem subjective reduce to keyword checks, regex, or API calls when you understand the domain. Example: detecting whether an AI interviewing coach suggests "general" questions (asking about typical behavior instead of a specific past event) seems to require semantic understanding, but in practice a keyword check for words like "usually," "typical," and "normally" could work quite well.
|
|
20
|
+
|
|
21
|
+
## The Four Components
|
|
22
|
+
|
|
23
|
+
Every judge prompt requires exactly four components:
|
|
24
|
+
|
|
25
|
+
### 1. Task and Evaluation Criterion
|
|
26
|
+
|
|
27
|
+
State what the judge evaluates. One failure mode per judge.
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
You are an evaluator assessing whether a real estate assistant's email
|
|
31
|
+
uses the appropriate tone for the client's persona.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Not: "Evaluate whether the email is good" or "Rate the email quality from 1-5."
|
|
35
|
+
|
|
36
|
+
### 2. Pass/Fail Definitions
|
|
37
|
+
|
|
38
|
+
Outcomes are strictly binary: Pass or Fail. No Likert scales, no letter grades, no partial credit. Define exactly what constitutes Pass and Fail. These definitions come from your error analysis failure mode descriptions.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
## Definitions
|
|
42
|
+
|
|
43
|
+
PASS: The email matches the expected communication style for the client persona:
|
|
44
|
+
- Luxury Buyers: formal language, emphasis on exclusive features, premium
|
|
45
|
+
market positioning, no casual slang
|
|
46
|
+
- First-Time Homebuyers: warm and encouraging tone, educational explanations,
|
|
47
|
+
avoids jargon, patient and supportive
|
|
48
|
+
- Investors: data-driven language, ROI-focused, market analytics, concise
|
|
49
|
+
and professional
|
|
50
|
+
|
|
51
|
+
FAIL: The email uses a tone mismatched to the client persona. Examples:
|
|
52
|
+
- Using casual slang ("hey, check out this pad!") for a luxury buyer
|
|
53
|
+
- Using heavy financial jargon for a first-time homebuyer
|
|
54
|
+
- Using overly emotional language for an investor
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Few-Shot Examples
|
|
58
|
+
|
|
59
|
+
Include labeled Pass and Fail examples from your human-labeled data.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
## Examples
|
|
63
|
+
|
|
64
|
+
### Example 1: PASS
|
|
65
|
+
Client Persona: Luxury Buyer
|
|
66
|
+
Email: "Dear Mr. Harrington, I am pleased to present an exclusive listing
|
|
67
|
+
at 1200 Pacific Heights Drive. This distinguished property features..."
|
|
68
|
+
Critique: The email opens with a formal salutation and uses language
|
|
69
|
+
consistent with luxury positioning — "exclusive listing," "distinguished
|
|
70
|
+
property." No casual slang or informal phrasing. The tone matches the
|
|
71
|
+
luxury buyer persona throughout.
|
|
72
|
+
Result: Pass
|
|
73
|
+
|
|
74
|
+
### Example 2: FAIL
|
|
75
|
+
Client Persona: Luxury Buyer
|
|
76
|
+
Email: "Hey! Just found this awesome place you might like. It's got a
|
|
77
|
+
pool and stuff, super cool neighborhood..."
|
|
78
|
+
Critique: The greeting "Hey!" is informal. Phrases like "awesome place,"
|
|
79
|
+
"got a pool and stuff," and "super cool" are casual slang inappropriate
|
|
80
|
+
for a luxury buyer. The email reads like a text message, not a
|
|
81
|
+
professional communication for a high-end client.
|
|
82
|
+
Result: Fail
|
|
83
|
+
|
|
84
|
+
### Example 3: PASS (borderline)
|
|
85
|
+
Client Persona: First-Time Homebuyer
|
|
86
|
+
Email: "Hi Sarah, I found a property that might be a great fit for your
|
|
87
|
+
first home. The neighborhood has good schools nearby, and the monthly
|
|
88
|
+
payment would be similar to what you're currently paying in rent..."
|
|
89
|
+
Critique: The greeting is warm but not overly casual. The email explains
|
|
90
|
+
the property in relatable terms — comparing mortgage to rent, mentioning
|
|
91
|
+
schools — which is educational without being condescending. It avoids
|
|
92
|
+
jargon like "amortization" or "LTV ratio." While not deeply technical,
|
|
93
|
+
this matches the supportive tone expected for a first-time buyer.
|
|
94
|
+
Result: Pass
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Rules for selecting examples:**
|
|
98
|
+
- Include at least one clear Pass, one clear Fail, and one borderline case. Borderline examples are the most valuable — they teach nuance.
|
|
99
|
+
- Draw examples from the training split (10-20% of labeled data set aside for this purpose).
|
|
100
|
+
- Any example used in the judge prompt must be excluded from dev and test sets. Using dev/test examples is data leakage.
|
|
101
|
+
- 2-4 examples is typical. Performance plateaus after 4-8.
|
|
102
|
+
|
|
103
|
+
### 4. Structured Output Format
|
|
104
|
+
|
|
105
|
+
Enforce structured output using your LLM provider's schema enforcement (e.g., `response_format` in OpenAI, tool definitions in Anthropic) or a library like Instructor or Outlines. If the provider doesn't support schema enforcement, specify the JSON schema in the prompt.
|
|
106
|
+
|
|
107
|
+
The output must include a critique before the verdict. Placing the critique first forces the judge to articulate its assessment before committing to a decision.
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"critique": "string — detailed assessment of the output against the criterion",
|
|
112
|
+
"result": "Pass or Fail"
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Critiques must be detailed, not terse. A good critique explains what specifically was correct or incorrect and references concrete evidence from the output. The critiques in your few-shot examples set the bar for the level of detail the judge will produce.
|
|
117
|
+
|
|
118
|
+
## Choosing What to Pass to the Judge
|
|
119
|
+
|
|
120
|
+
Feed only what the judge needs for an accurate decision:
|
|
121
|
+
|
|
122
|
+
| Failure Mode | What the Judge Needs |
|
|
123
|
+
|-------------|---------------------|
|
|
124
|
+
| Tone mismatch | Client persona + generated email |
|
|
125
|
+
| Answer faithfulness | Retrieved context + generated answer |
|
|
126
|
+
| SQL correctness | User query + generated SQL + schema |
|
|
127
|
+
| Instruction following | System prompt rules + generated response |
|
|
128
|
+
| Tool call justification | Conversation history + tool call + tool result |
|
|
129
|
+
|
|
130
|
+
For long documents, feed only the relevant snippet, not the entire document.
|
|
131
|
+
|
|
132
|
+
## Model Selection
|
|
133
|
+
|
|
134
|
+
Start with the most capable model available. The same model used for the main task works as judge (the judge performs a different, narrower task). Optimize for cost later once alignment is confirmed.
|
|
135
|
+
|
|
136
|
+
## Anti-Patterns
|
|
137
|
+
|
|
138
|
+
- **Vague criteria like "is this helpful?"** Target a specific, observable failure mode from error analysis.
|
|
139
|
+
- **Holistic judge for the entire trace.** A single judge covering multiple dimensions produces unactionable verdicts.
|
|
140
|
+
- **No few-shot examples.** Without examples, the model won't know what counts as a failure in your application.
|
|
141
|
+
- **Dev/test examples used as few-shot.** This is data leakage. Use only the training split.
|
|
142
|
+
- **Likert scales (1-5, letter grades, etc.).** Binary pass/fail only. Likert scales produce scores that sound precise but can't be calibrated: annotators disagree on the difference between a 3 and a 4, and the judge inherits that noise. Binary forces you to define a clear decision boundary upfront, which makes inter-annotator agreement measurable and the judge's errors actionable. If you need to capture severity, use multiple binary judges (e.g., "factually wrong" and "dangerously wrong") rather than one ordinal scale.
|
|
143
|
+
- **Skipping validation.** Measure alignment with human labels using validate-evaluator before trusting the judge.
|
|
144
|
+
- **Judges for specification failures without fixing the prompt first.** If the prompt never asked for the behavior, add the instruction before building an evaluator. For critical requirements, a judge can still serve as a regression guard.
|
package/themes/dino.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/earendil-works/pi/main/packages/coding-agent/src/modes/interactive/theme/theme-schema.json",
|
|
3
|
+
"name": "dino",
|
|
4
|
+
"vars": {
|
|
5
|
+
"purple": "#7d4e8c",
|
|
6
|
+
"lightPurple": "#b98cc4",
|
|
7
|
+
"green": "#78c74d",
|
|
8
|
+
"yellow": "#f5d742",
|
|
9
|
+
"dark": "#2a1d35",
|
|
10
|
+
"gray": 242
|
|
11
|
+
},
|
|
12
|
+
"colors": {
|
|
13
|
+
"accent": "lightPurple",
|
|
14
|
+
"border": "purple",
|
|
15
|
+
"borderAccent": "lightPurple",
|
|
16
|
+
"borderMuted": "gray",
|
|
17
|
+
"success": "green",
|
|
18
|
+
"error": "#ff5555",
|
|
19
|
+
"warning": "yellow",
|
|
20
|
+
"muted": "gray",
|
|
21
|
+
"dim": 240,
|
|
22
|
+
"text": "",
|
|
23
|
+
"thinkingText": "gray",
|
|
24
|
+
"selectedBg": "dark",
|
|
25
|
+
"userMessageBg": "dark",
|
|
26
|
+
"userMessageText": "",
|
|
27
|
+
"customMessageBg": "dark",
|
|
28
|
+
"customMessageText": "",
|
|
29
|
+
"customMessageLabel": "lightPurple",
|
|
30
|
+
"toolPendingBg": "#221a29",
|
|
31
|
+
"toolSuccessBg": "#1a291a",
|
|
32
|
+
"toolErrorBg": "#291a1a",
|
|
33
|
+
"toolTitle": "lightPurple",
|
|
34
|
+
"toolOutput": "",
|
|
35
|
+
"mdHeading": "yellow",
|
|
36
|
+
"mdLink": "lightPurple",
|
|
37
|
+
"mdLinkUrl": "gray",
|
|
38
|
+
"mdCode": "green",
|
|
39
|
+
"mdCodeBlock": "",
|
|
40
|
+
"mdCodeBlockBorder": "gray",
|
|
41
|
+
"mdQuote": "gray",
|
|
42
|
+
"mdQuoteBorder": "gray",
|
|
43
|
+
"mdHr": "gray",
|
|
44
|
+
"mdListBullet": "green",
|
|
45
|
+
"toolDiffAdded": "green",
|
|
46
|
+
"toolDiffRemoved": "#ff5555",
|
|
47
|
+
"toolDiffContext": "gray",
|
|
48
|
+
"syntaxComment": "gray",
|
|
49
|
+
"syntaxKeyword": "lightPurple",
|
|
50
|
+
"syntaxFunction": "yellow",
|
|
51
|
+
"syntaxVariable": "green",
|
|
52
|
+
"syntaxString": "green",
|
|
53
|
+
"syntaxNumber": "yellow",
|
|
54
|
+
"syntaxType": "lightPurple",
|
|
55
|
+
"syntaxOperator": "lightPurple",
|
|
56
|
+
"syntaxPunctuation": "gray",
|
|
57
|
+
"thinkingOff": "gray",
|
|
58
|
+
"thinkingMinimal": "lightPurple",
|
|
59
|
+
"thinkingLow": "purple",
|
|
60
|
+
"thinkingMedium": "lightPurple",
|
|
61
|
+
"thinkingHigh": "yellow",
|
|
62
|
+
"thinkingXhigh": "green",
|
|
63
|
+
"thinkingMax": "#ff88cc",
|
|
64
|
+
"bashMode": "yellow"
|
|
65
|
+
}
|
|
66
|
+
}
|