@pennyfarthing/benchmark 10.2.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.
Files changed (115) hide show
  1. package/commands/benchmark-control.md +69 -0
  2. package/commands/benchmark.md +485 -0
  3. package/commands/job-fair.md +102 -0
  4. package/commands/solo.md +447 -0
  5. package/dist/benchmark-integration.d.ts +182 -0
  6. package/dist/benchmark-integration.d.ts.map +1 -0
  7. package/dist/benchmark-integration.js +710 -0
  8. package/dist/benchmark-integration.js.map +1 -0
  9. package/dist/benchmark-integration.test.d.ts +6 -0
  10. package/dist/benchmark-integration.test.d.ts.map +1 -0
  11. package/dist/benchmark-integration.test.js +41 -0
  12. package/dist/benchmark-integration.test.js.map +1 -0
  13. package/dist/index.d.ts +3 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +5 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/job-fair-aggregator.d.ts +150 -0
  18. package/dist/job-fair-aggregator.d.ts.map +1 -0
  19. package/dist/job-fair-aggregator.js +547 -0
  20. package/dist/job-fair-aggregator.js.map +1 -0
  21. package/dist/job-fair-aggregator.test.d.ts +6 -0
  22. package/dist/job-fair-aggregator.test.d.ts.map +1 -0
  23. package/dist/job-fair-aggregator.test.js +35 -0
  24. package/dist/job-fair-aggregator.test.js.map +1 -0
  25. package/dist/package-exports.test.d.ts +13 -0
  26. package/dist/package-exports.test.d.ts.map +1 -0
  27. package/dist/package-exports.test.js +192 -0
  28. package/dist/package-exports.test.js.map +1 -0
  29. package/docs/BENCHMARK-METHODOLOGY.md +105 -0
  30. package/docs/BENCHMARKING.md +311 -0
  31. package/docs/OCEAN-BENCHMARKING.md +210 -0
  32. package/docs/benchmarks-guide.md +62 -0
  33. package/package.json +66 -0
  34. package/scenarios/README.md +145 -0
  35. package/scenarios/architecture/database-selection.yaml +119 -0
  36. package/scenarios/architecture/legacy-modernization.yaml +153 -0
  37. package/scenarios/architecture/scaling-decision.yaml +88 -0
  38. package/scenarios/code-review/graphql-api-review.yaml +714 -0
  39. package/scenarios/code-review/order-service.yaml +622 -0
  40. package/scenarios/code-review/react-auth-component.yaml +569 -0
  41. package/scenarios/code-review/security-review.yaml +145 -0
  42. package/scenarios/code-review/terraform-infrastructure.yaml +582 -0
  43. package/scenarios/debug/buggy-user-service.yaml +541 -0
  44. package/scenarios/debug/null-pointer.yaml +130 -0
  45. package/scenarios/debugging/async-control-flow.yaml +161 -0
  46. package/scenarios/debugging/auth-bypass.yaml +197 -0
  47. package/scenarios/debugging/error-handling.yaml +178 -0
  48. package/scenarios/debugging/input-validation.yaml +157 -0
  49. package/scenarios/debugging/null-check-missing.yaml +139 -0
  50. package/scenarios/debugging/off-by-one-loop.yaml +132 -0
  51. package/scenarios/debugging/race-condition.yaml +180 -0
  52. package/scenarios/debugging/resource-leak.yaml +166 -0
  53. package/scenarios/debugging/simple-logic-error.yaml +115 -0
  54. package/scenarios/debugging/sql-injection.yaml +163 -0
  55. package/scenarios/dev/event-processor-tdd.yaml +764 -0
  56. package/scenarios/dev/migration-disaster.yaml +415 -0
  57. package/scenarios/dev/race-condition-cache.yaml +546 -0
  58. package/scenarios/dev/tdd-shopping-cart.yaml +681 -0
  59. package/scenarios/schema.yaml +639 -0
  60. package/scenarios/sm/dependency-deadlock.yaml +414 -0
  61. package/scenarios/sm/executive-pet-project.yaml +336 -0
  62. package/scenarios/sm/layoff-planning.yaml +356 -0
  63. package/scenarios/sm/sprint-planning-conflict.yaml +303 -0
  64. package/scenarios/sm/story-breakdown.yaml +240 -0
  65. package/scenarios/sm/three-sprint-failure.yaml +397 -0
  66. package/scenarios/swe-bench/README.md +57 -0
  67. package/scenarios/swe-bench/astropy-12907.yaml +128 -0
  68. package/scenarios/swe-bench/astropy-13398.yaml +177 -0
  69. package/scenarios/swe-bench/astropy-14309.yaml +180 -0
  70. package/scenarios/swe-bench/django-10097.yaml +106 -0
  71. package/scenarios/swe-bench/django-10554.yaml +140 -0
  72. package/scenarios/swe-bench/django-10973.yaml +93 -0
  73. package/scenarios/swe-bench/flask-5014-reviewer.yaml +145 -0
  74. package/scenarios/swe-bench/flask-5014-tea.yaml +123 -0
  75. package/scenarios/swe-bench/flask-5014.yaml +91 -0
  76. package/scenarios/swe-bench/import-swebench.py +246 -0
  77. package/scenarios/swe-bench/matplotlib-13989.yaml +139 -0
  78. package/scenarios/swe-bench/matplotlib-14623.yaml +127 -0
  79. package/scenarios/swe-bench/requests-1142-reviewer.yaml +144 -0
  80. package/scenarios/swe-bench/requests-1142-tea.yaml +135 -0
  81. package/scenarios/swe-bench/requests-1142.yaml +100 -0
  82. package/scenarios/swe-bench/requests-2931.yaml +98 -0
  83. package/scenarios/swe-bench/seaborn-3069.yaml +102 -0
  84. package/scenarios/swe-bench/sphinx-7590.yaml +108 -0
  85. package/scenarios/swe-bench/xarray-3993.yaml +104 -0
  86. package/scenarios/swe-bench/xarray-6992.yaml +136 -0
  87. package/scenarios/tea/checkout-component-tests.yaml +596 -0
  88. package/scenarios/tea/cli-tool-tests.yaml +561 -0
  89. package/scenarios/tea/microservice-integration-tests.yaml +520 -0
  90. package/scenarios/tea/payment-processor-tests.yaml +550 -0
  91. package/scripts/aggregate-benchmark-stats.js +315 -0
  92. package/scripts/aggregate-benchmark-stats.sh +8 -0
  93. package/scripts/benchmark-runner.js +392 -0
  94. package/scripts/benchmark-runner.sh +8 -0
  95. package/scripts/consolidate-job-fair.sh +107 -0
  96. package/scripts/convert-jobfair-to-benchmarks.sh +230 -0
  97. package/scripts/job-fair-batch.sh +116 -0
  98. package/scripts/job-fair-progress.sh +35 -0
  99. package/scripts/job-fair-runner.sh +278 -0
  100. package/scripts/job-fair-status.sh +80 -0
  101. package/scripts/job-fair-watcher-v2.sh +38 -0
  102. package/scripts/job-fair-watcher.sh +50 -0
  103. package/scripts/parallel-benchmark.sh +140 -0
  104. package/scripts/solo-runner.sh +344 -0
  105. package/scripts/test/ensure-swebench-data.sh +59 -0
  106. package/scripts/test/ground-truth-judge.py +220 -0
  107. package/scripts/test/swebench-judge.py +374 -0
  108. package/scripts/test/test-cache.sh +165 -0
  109. package/scripts/test/test-setup.sh +337 -0
  110. package/scripts/theme/compute-theme-tiers.sh +13 -0
  111. package/scripts/theme/compute_theme_tiers.py +402 -0
  112. package/scripts/theme/update-theme-tiers.sh +97 -0
  113. package/skills/finalize-run/SKILL.md +261 -0
  114. package/skills/judge/SKILL.md +644 -0
  115. package/skills/persona-benchmark/SKILL.md +187 -0
@@ -0,0 +1,447 @@
1
+ ---
2
+ description: Run a single agent on a scenario with absolute rubric scoring
3
+ argument-hint: <theme:agent> --scenario <name> [--as <role>] [--runs N] [--no-judge]
4
+ ---
5
+
6
+ # Solo Benchmark
7
+
8
+ <purpose>
9
+ Run a single agent on a scenario. This is the CANONICAL agent execution path.
10
+
11
+ **Modes:**
12
+ - **Full (default):** Agent runs → `/judge` evaluates → `/finalize-run` saves
13
+ - **No-judge (`--no-judge`):** Agent runs only, returns raw response (for /duel, /relay)
14
+ </purpose>
15
+
16
+ <architecture>
17
+ ```
18
+ /solo theme:agent --scenario X
19
+
20
+ ├──► Execute agent via CLI
21
+ │ └──► Response + tokens
22
+
23
+ ├──► /judge --mode solo (if not --no-judge)
24
+ │ └──► Score + verdict
25
+
26
+ └──► /finalize-run --type solo
27
+ └──► Validate + save
28
+ ```
29
+ </architecture>
30
+
31
+ <usage>
32
+ ```
33
+ /solo <contestant> --scenario <name>
34
+ /solo <contestant> --scenario <name> --runs 4
35
+ /solo <contestant> --scenario <name> --no-judge
36
+ /solo <contestant> --as <role> --scenario <name>
37
+ ```
38
+
39
+ **Arguments:**
40
+ - `contestant` - `theme:agent` format (e.g., `discworld:reviewer`) OR `theme:character` with `--as`
41
+ - `--scenario` - Scenario from `scenarios/` directory
42
+ - `--as <role>` - Override role (use character's persona for different role's task)
43
+ - `--runs N` - Number of runs (default: 1, max: 20)
44
+ - `--no-judge` - Skip judging, return raw response
45
+
46
+ **Cross-Role Testing with `--as`:**
47
+
48
+ The `--as` flag enables running any persona as any role, useful for research:
49
+
50
+ ```
51
+ /solo shakespeare:prospero --as dev --scenario django-10554
52
+ ```
53
+
54
+ This uses Prospero's persona traits (wise orchestrator, magic metaphors) but gives him a dev task.
55
+ The scenario's role determines what the agent is asked to do; the character determines how they do it.
56
+ </usage>
57
+
58
+ <on-invoke>
59
+ The user invoked this command with: $ARGUMENTS
60
+
61
+ ## Step 1: Parse Arguments
62
+
63
+ Extract:
64
+ - `contestant`: `theme:agent` spec (or `theme:character` if using `--as`)
65
+ - `scenario_name`: After `--scenario`
66
+ - `role_override`: After `--as` (optional - for cross-role testing)
67
+ - `runs`: Number (default: 1)
68
+ - `no_judge`: Boolean
69
+
70
+ Validate spec contains `:`, scenario is required, runs is 1-20.
71
+
72
+ **If `--as` is provided:**
73
+ - The second part of the spec is a CHARACTER name, not a role
74
+ - `role_override` becomes the effective role for scenario matching
75
+ - Character persona is extracted by name lookup across all agents in theme
76
+
77
+ ## Step 2: Load Scenario
78
+
79
+ ```yaml
80
+ Glob tool:
81
+ pattern: "scenarios/**/{scenario_name}.yaml"
82
+ ```
83
+
84
+ Extract: `prompt`, `scenario_title`, `code_content` (if present)
85
+
86
+ ## Step 3: Load Persona
87
+
88
+ Read: `pennyfarthing-dist/personas/themes/{theme}.yaml`
89
+
90
+ **Standard mode (no `--as`):**
91
+ - Look up `agents.{agent}` section
92
+ - Extract: `character`, `style`, `expertise`, `catchphrases`, `emoji`
93
+ - `effective_role` = agent name from spec
94
+
95
+ **Cross-role mode (with `--as`):**
96
+ - The spec contains `theme:character_name` (e.g., `shakespeare:prospero`)
97
+ - Search ALL agent sections for one where `character` field matches (case-insensitive, partial match OK)
98
+ - Extract persona traits from that agent's config
99
+ - `effective_role` = the `--as` value (NOT the role the character normally fills)
100
+
101
+ ```python
102
+ # Pseudocode for cross-role lookup
103
+ if role_override:
104
+ character_query = spec.split(':')[1].lower() # e.g., "prospero"
105
+ for agent_name, agent_config in theme['agents'].items():
106
+ char_name = agent_config.get('character', '').lower()
107
+ if character_query in char_name or char_name.startswith(character_query):
108
+ persona = agent_config
109
+ source_role = agent_name # where character normally lives
110
+ break
111
+ effective_role = role_override # what we're asking them to do
112
+ else:
113
+ agent_name = spec.split(':')[1] # e.g., "dev"
114
+ persona = theme['agents'][agent_name]
115
+ effective_role = agent_name
116
+ source_role = agent_name
117
+ ```
118
+
119
+ This enables running Prospero (normally SM) as a dev, or Gus Fring (normally orchestrator) as a reviewer.
120
+
121
+ ## Step 3b: Build Agent Prompt
122
+
123
+ Use the Write tool to create the prompt file with this template:
124
+
125
+ ```
126
+ You are {character}.
127
+
128
+ **Style:** {style}
129
+ **Expertise:** {expertise}
130
+ **Catchphrases:** {catchphrases}
131
+
132
+ ---
133
+
134
+ ## Challenge
135
+
136
+ {scenario_prompt}
137
+
138
+ {code_content if present}
139
+
140
+ ---
141
+
142
+ Respond fully in character. Under 500 words.
143
+
144
+ **IMPORTANT:** Provide your complete response directly. Do not attempt to use tools, read files, or make function calls.
145
+ ```
146
+
147
+ **Cross-role note:** When using `--as`, the scenario prompt comes from the `effective_role` (e.g., dev tasks),
148
+ but the character/style/expertise come from the character's original role config. This tests whether
149
+ personality traits affect task performance independent of role-specific training.
150
+
151
+ The final instruction is critical - without it, the model may output tool-call syntax even with `--tools ""`, resulting in incomplete responses.
152
+
153
+ ## Step 4: Execute Agent via CLI
154
+
155
+ **RECOMMENDED: Use the shell script for reliable execution:**
156
+
157
+ ```bash
158
+ ./scripts/solo-runner.sh {theme}:{agent} {scenario} {output_dir}
159
+ ```
160
+
161
+ The shell script handles all escaping, temp files, and JSON parsing correctly.
162
+ Use inline commands only for simple cases or when the script isn't available.
163
+
164
+ ---
165
+
166
+ **CRITICAL: The `--tools ""` flag is MANDATORY.**
167
+
168
+ Without `--tools ""`, agents may use tools internally (Read, Write, Bash, etc.), causing:
169
+ 1. Multi-turn conversations (num_turns > 1)
170
+ 2. The `.result` field only captures the FINAL message (often just a summary)
171
+ 3. Full response content is LOST - judges only see truncated output
172
+ 4. Scores are INVALID because judges evaluate incomplete data
173
+
174
+ **Evidence:** Miles Vorkosigan benchmark (2026-01-01) scored 76.69 with tools enabled vs Leo McGarry's 91.03 with `--tools ""`. Miles' runs had num_turns: 5-7 and judges only saw summaries, not full story breakdowns.
175
+
176
+ **CRITICAL: Use PIPE syntax, NOT heredocs.**
177
+
178
+ **NEVER USE HEREDOCS** - Heredoc syntax (`<<'EOF'`, `<<EOF`, `<<'PROMPT'`, etc.) FAILS in subagents.
179
+ The permission system treats heredocs differently and they get auto-denied.
180
+
181
+ **ALWAYS USE PIPE SYNTAX** - This works in both main sessions and subagents:
182
+ - `echo "$PROMPT" | claude -p ...` - WORKS
183
+ - `cat file.txt | claude -p ...` - WORKS
184
+ - `printf '%s' "$PROMPT" | claude -p ...` - WORKS
185
+ - `claude -p ... <<'EOF'` - **FAILS IN SUBAGENTS - DO NOT USE**
186
+
187
+ **CRITICAL: Use FILE REDIRECTION, NOT variable capture.**
188
+
189
+ **NEVER CAPTURE OUTPUT IN VARIABLES** - Command substitution with `$(...)` causes zsh parse errors
190
+ when the JSON output contains parentheses or special characters:
191
+ - `OUTPUT=$(cat file.txt | claude -p ...)` - **FAILS with `parse error near ')'`**
192
+
193
+ **ALWAYS REDIRECT TO FILES** - This avoids shell parsing issues:
194
+ - `cat file.txt | claude -p ... > output.json` - WORKS
195
+ - Then read: `jq -r '.result' output.json` - WORKS
196
+
197
+ ```bash
198
+ # Step 1: Capture timestamp to file (avoid variable capture issues)
199
+ date -u +%Y-%m-%dT%H:%M:%SZ > /tmp/timestamp_$$.txt
200
+
201
+ # Step 2: Write prompt to file using Write tool (avoids escaping issues)
202
+ # Use the Write tool to create: /tmp/prompt_$$.txt
203
+
204
+ # Step 3: Execute with file redirection (NOT variable capture)
205
+ cat /tmp/prompt_$$.txt | claude -p --output-format json --tools "" > /tmp/output_$$.json
206
+
207
+ # Step 4: Extract results from files
208
+ TIMESTAMP=$(cat /tmp/timestamp_$$.txt)
209
+ RESPONSE=$(jq -r '.result' /tmp/output_$$.json)
210
+ INPUT_TOKENS=$(jq -r '.usage.input_tokens // 0' /tmp/output_$$.json)
211
+ OUTPUT_TOKENS=$(jq -r '.usage.output_tokens // 0' /tmp/output_$$.json)
212
+
213
+ # Step 5: Cleanup
214
+ rm -f /tmp/timestamp_$$.txt /tmp/prompt_$$.txt /tmp/output_$$.json
215
+ ```
216
+
217
+ **Why file redirection works:** The shell never tries to parse the JSON output.
218
+ It goes directly to a file, then jq reads it safely.
219
+
220
+ ## Step 5: Check Mode
221
+
222
+ **If `--no-judge`:** Return raw response and metadata, STOP.
223
+
224
+ ```markdown
225
+ ## Solo Agent Response
226
+
227
+ **Contestant:** {spec} ({character})
228
+ **Scenario:** {scenario_name}
229
+
230
+ ---
231
+
232
+ {response}
233
+
234
+ ---
235
+
236
+ ```json
237
+ {
238
+ "spec": "{spec}",
239
+ "character": "{character}",
240
+ "cli_timestamp": "{TIMESTAMP}",
241
+ "response_length": {length},
242
+ "input_tokens": {INPUT_TOKENS},
243
+ "output_tokens": {OUTPUT_TOKENS}
244
+ }
245
+ ```
246
+ ```
247
+
248
+ **If full mode:** Continue to Step 6.
249
+
250
+ ## Step 6: Invoke Judge Skill
251
+
252
+ **Detect SWE-bench scenarios for deterministic evaluation:**
253
+
254
+ Check if the scenario is from SWE-bench by looking at its path or category:
255
+ ```python
256
+ is_swebench = (
257
+ 'swe-bench' in scenario_path.lower() or
258
+ scenario.get('category') == 'swe-bench' or
259
+ scenario.get('source') == 'swe-bench'
260
+ )
261
+ ```
262
+
263
+ **If SWE-bench scenario:**
264
+
265
+ Use deterministic Python-based evaluation instead of LLM-as-judge:
266
+
267
+ ```bash
268
+ # Save response to temp file for Python judge
269
+ echo '{"result": "{RESPONSE}"}' > /tmp/solo_response_$$.json
270
+
271
+ # Run SWE-bench judge (deterministic scoring against ground truth)
272
+ python3 .pennyfarthing/scripts/test/swebench-judge.py {scenario_name} /tmp/solo_response_$$.json
273
+ ```
274
+
275
+ The Python script returns:
276
+ - `total`: Score out of 100
277
+ - `scores`: Breakdown by category (root_cause, fix_quality, completeness, persona)
278
+ - `details`: Specific findings and matches
279
+
280
+ **If standard scenario (non-SWE-bench):**
281
+
282
+ Use LLM-as-judge:
283
+ ```
284
+ /judge --mode solo --data {
285
+ "spec": "{spec}",
286
+ "character": "{character}",
287
+ "challenge": "{prompt}",
288
+ "response": "{RESPONSE}"
289
+ }
290
+ ```
291
+
292
+ Capture: `score`, `judge_timestamp`, `judge_response`, `judge_tokens`
293
+
294
+ ## Step 7: Invoke Finalize-Run Skill
295
+
296
+ ```
297
+ /finalize-run --type solo --data {
298
+ "timestamp": "{ISO8601}",
299
+ "scenario": {"name": "{scenario_name}", "title": "{title}"},
300
+ "agents": [{
301
+ "spec": "{spec}",
302
+ "cli_timestamp": "{TIMESTAMP}",
303
+ "response_text": "{RESPONSE}",
304
+ "input_tokens": {INPUT_TOKENS},
305
+ "output_tokens": {OUTPUT_TOKENS}
306
+ }],
307
+ "judge": {
308
+ "cli_timestamp": "{judge_timestamp}",
309
+ "response_text": "{judge_response}",
310
+ "input_tokens": {judge_input},
311
+ "output_tokens": {judge_output}
312
+ },
313
+ "scores": {"{spec}": {score}},
314
+ "output_path": "internal/results/solo/{timestamp}-{theme}-{agent}.json"
315
+ }
316
+ ```
317
+
318
+ ## Step 8: Display Results
319
+
320
+ ```markdown
321
+ ## Solo Evaluation
322
+
323
+ {judge verdict}
324
+
325
+ ---
326
+
327
+ ## Efficiency
328
+
329
+ | Metric | Value |
330
+ |--------|-------|
331
+ | Agent Tokens | {agent_total} |
332
+ | Judge Tokens | {judge_total} |
333
+ | Score | {score}/100 |
334
+ | Tokens/Point | {tpp} |
335
+
336
+ ---
337
+
338
+ ✓ Saved to {output_path}
339
+ ```
340
+
341
+ ## Step 9: Multi-Run Mode (if runs > 1)
342
+
343
+ 1. Create output directory (see Step 10 for path logic)
344
+ 2. Repeat Steps 4-7 for each run
345
+ 3. Save each to `runs/run_{i}.json` and `runs/judge_{i}.json`
346
+ 4. Calculate statistics and save summary.yaml (Step 10)
347
+
348
+ ## Step 10: Save Summary (ALWAYS - even for n=1)
349
+
350
+ **Output path logic:**
351
+
352
+ ```
353
+ if theme == "control":
354
+ base_path = "internal/results/baselines/{scenario}/{effective_role}/"
355
+ elif role_override: # cross-role mode
356
+ # Include character name and effective role for clarity
357
+ base_path = "internal/results/benchmarks/{scenario}/{theme}-{character}-as-{effective_role}/"
358
+ else:
359
+ base_path = "internal/results/benchmarks/{scenario}/{theme}-{effective_role}/"
360
+ ```
361
+
362
+ **Cross-role example:** `/solo shakespeare:prospero --as dev --scenario django-10554`
363
+ → saves to `internal/results/benchmarks/django-10554/shakespeare-prospero-as-dev/`
364
+
365
+ **For ALL runs (including n=1):**
366
+
367
+ 1. Create directory structure:
368
+ ```bash
369
+ mkdir -p "{base_path}/runs"
370
+ ```
371
+
372
+ 2. Save run files:
373
+ - `runs/run_{i}.json` - Agent response + tokens
374
+ - `runs/judge_{i}.json` - Judge evaluation
375
+
376
+ 3. Calculate statistics:
377
+ ```python
378
+ scores = [run.score for run in runs]
379
+ mean = sum(scores) / len(scores)
380
+ std_dev = sqrt(sum((s - mean)^2 for s in scores) / len(scores))
381
+ ```
382
+
383
+ 4. **ALWAYS save summary.yaml:**
384
+ ```yaml
385
+ # {theme}:{character} on {scenario} (as {effective_role})
386
+ # Generated: {ISO8601 timestamp}
387
+
388
+ agent:
389
+ theme: {theme}
390
+ character: {character_name}
391
+ effective_role: {effective_role} # role being performed
392
+ source_role: {source_role} # role where character normally lives
393
+ spec: {theme}:{character} # original spec
394
+ cross_role: {true if role_override else false}
395
+
396
+ scenario:
397
+ name: {scenario_name}
398
+ category: {category}
399
+ difficulty: {difficulty}
400
+
401
+ statistics:
402
+ n: {run_count}
403
+ mean: {mean:.2f}
404
+ std_dev: {std_dev:.2f}
405
+ min: {min_score}
406
+ max: {max_score}
407
+ scores: [{score1}, {score2}, ...]
408
+
409
+ efficiency:
410
+ avg_input_tokens: {avg_in}
411
+ avg_output_tokens: {avg_out}
412
+ tokens_per_point: {tpp:.2f}
413
+
414
+ metadata:
415
+ created_at: {ISO8601 timestamp}
416
+ pennyfarthing_version: {version from package.json} # REQUIRED
417
+ model: sonnet
418
+
419
+ # Include baseline comparison if baseline exists and theme != control
420
+ baseline_comparison:
421
+ control_mean: {baseline_mean}
422
+ control_stddev: {baseline_std}
423
+ delta: {mean - baseline_mean:+.2f}
424
+
425
+ runs:
426
+ - run_1.json
427
+ - run_2.json
428
+ # ...
429
+ ```
430
+
431
+ 5. Display:
432
+ ```
433
+ ✓ Saved {n} run(s) to {base_path}
434
+ ✓ Summary: {base_path}/summary.yaml
435
+ ```
436
+
437
+ </on-invoke>
438
+
439
+ <reference>
440
+ - **Judge Skill:** `.claude/project/skills/judge/SKILL.md`
441
+ - **Finalize-Run Skill:** `.claude/project/skills/finalize-run/SKILL.md`
442
+ - **Themes:** `pennyfarthing-dist/personas/themes/*.yaml`
443
+ - **Scenarios:** `scenarios/**/*.yaml`
444
+ - **Baselines:** `internal/results/baselines/{scenario}/{role}/` (control theme)
445
+ - **Benchmarks:** `internal/results/benchmarks/{scenario}/{theme}-{role}/` (all other themes)
446
+ - **Results README:** `internal/results/README.md`
447
+ </reference>
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Benchmark Integration Module
3
+ *
4
+ * Story 11-8: Integrate with Benchmark Output
5
+ * Story 12-6: Update for local results (Epic 12 migration)
6
+ *
7
+ * Correlates Chernoff faces and OCEAN profiles with benchmark performance data.
8
+ * Reads benchmark results from internal/results/ directory (or BENCHMARK_PATH env var).
9
+ */
10
+ export interface OceanScores {
11
+ O: number;
12
+ C: number;
13
+ E: number;
14
+ A: number;
15
+ N: number;
16
+ }
17
+ export interface BenchmarkResult {
18
+ theme: string;
19
+ role: string;
20
+ character: string;
21
+ scenario: string;
22
+ mean: number;
23
+ stdDev: number;
24
+ delta: number;
25
+ cohensD?: number;
26
+ n: number;
27
+ scores: number[];
28
+ ocean: OceanScores;
29
+ face: string;
30
+ benchmarkMissing?: boolean;
31
+ }
32
+ export interface CorrelationResult {
33
+ O: {
34
+ effect: number;
35
+ direction: 'positive' | 'negative' | 'none';
36
+ };
37
+ C: {
38
+ effect: number;
39
+ direction: 'positive' | 'negative' | 'none';
40
+ };
41
+ E: {
42
+ effect: number;
43
+ direction: 'positive' | 'negative' | 'none';
44
+ };
45
+ A: {
46
+ effect: number;
47
+ direction: 'positive' | 'negative' | 'none';
48
+ };
49
+ N: {
50
+ effect: number;
51
+ direction: 'positive' | 'negative' | 'none';
52
+ };
53
+ strongest: {
54
+ dimension: keyof OceanScores;
55
+ effect: number;
56
+ };
57
+ }
58
+ export interface OptimalProfile {
59
+ ocean: OceanScores;
60
+ reasoning: string;
61
+ }
62
+ export interface RoleRecommendations {
63
+ role: string;
64
+ topThemes: Array<{
65
+ theme: string;
66
+ character: string;
67
+ score: number;
68
+ ocean: OceanScores;
69
+ }>;
70
+ avoidThemes: Array<{
71
+ theme: string;
72
+ character: string;
73
+ score: number;
74
+ }>;
75
+ insight: string;
76
+ }
77
+ export interface PerformerResult {
78
+ theme: string;
79
+ character: string;
80
+ score: number;
81
+ delta: number;
82
+ ocean: OceanScores;
83
+ face: string;
84
+ }
85
+ export interface QueryOptions {
86
+ scenario?: string;
87
+ role?: string;
88
+ filter?: string;
89
+ ocean?: string;
90
+ limit?: number;
91
+ minScore?: number;
92
+ sortBy?: 'score' | 'delta' | 'name';
93
+ }
94
+ export interface BenchmarkReportResult {
95
+ markdown: string;
96
+ data: {
97
+ performers: PerformerResult[];
98
+ correlation: CorrelationResult;
99
+ recommendations: RoleRecommendations;
100
+ errorCorrelation?: OceanErrorCorrelation;
101
+ };
102
+ }
103
+ export interface ErrorTypeCell {
104
+ correlation: number;
105
+ arrow: string;
106
+ }
107
+ export interface OceanErrorCorrelation {
108
+ matrix: {
109
+ [dimension: string]: {
110
+ reasoning: ErrorTypeCell;
111
+ planning: ErrorTypeCell;
112
+ execution: ErrorTypeCell;
113
+ };
114
+ };
115
+ strongest: {
116
+ dimension: string;
117
+ errorType: string;
118
+ correlation: number;
119
+ };
120
+ }
121
+ export interface JudgeScore {
122
+ detection_by_type?: {
123
+ reasoning: number;
124
+ planning: number;
125
+ execution: number;
126
+ };
127
+ }
128
+ export interface BenchmarkResultWithOcean {
129
+ ocean: OceanScores;
130
+ mean: number;
131
+ }
132
+ /**
133
+ * Load benchmark data from thunderdome results
134
+ */
135
+ export declare function loadBenchmarkData(scenario: string, role: string): BenchmarkResult[];
136
+ /**
137
+ * Get benchmark result with face visualization attached
138
+ */
139
+ export declare function getBenchmarkWithFace(theme: string, role: string, scenario: string): BenchmarkResult | null;
140
+ /**
141
+ * Calculate OCEAN correlation with benchmark performance
142
+ */
143
+ export declare function calculateOceanCorrelation(scenario: string, role: string): CorrelationResult;
144
+ /**
145
+ * Generate markdown correlation report
146
+ */
147
+ export declare function generateCorrelationReport(scenario: string, role: string): string;
148
+ /**
149
+ * Get optimal OCEAN profile for a role based on benchmark data
150
+ */
151
+ export declare function getOptimalProfile(role: string): OptimalProfile;
152
+ /**
153
+ * Get role recommendations (top themes, themes to avoid)
154
+ */
155
+ export declare function getRoleRecommendations(role: string): RoleRecommendations;
156
+ /**
157
+ * Find top performers for a scenario/role with optional filters
158
+ */
159
+ export declare function findTopPerformers(options: QueryOptions): PerformerResult[];
160
+ /**
161
+ * General query interface for benchmark data
162
+ */
163
+ export declare function queryBenchmarks(options: QueryOptions): PerformerResult[];
164
+ /**
165
+ * Calculate OCEAN × error-type correlation matrix
166
+ * Story 14-5: Correlates OCEAN dimensions with error detection rates
167
+ */
168
+ export declare function calculateErrorTypeCorrelation(results: BenchmarkResultWithOcean[], judgeScores: JudgeScore[]): OceanErrorCorrelation;
169
+ /**
170
+ * Generate markdown heat map for OCEAN × error-type correlations
171
+ * Story 14-5: Produces 5×3 matrix with directional arrows and effect sizes
172
+ */
173
+ export declare function generateOceanErrorHeatMap(correlation: OceanErrorCorrelation): string;
174
+ /**
175
+ * Generate complete benchmark report with faces and correlations
176
+ */
177
+ export declare function generateBenchmarkReport(options: {
178
+ scenario: string;
179
+ role: string;
180
+ includeErrorTypeCorrelation?: boolean;
181
+ }): BenchmarkReportResult;
182
+ //# sourceMappingURL=benchmark-integration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"benchmark-integration.d.ts","sourceRoot":"","sources":["../src/benchmark-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6CH,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAA;KAAE,CAAC;IACnE,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,MAAM,CAAA;KAAE,CAAC;IACnE,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,UAAU,GAAG,UAAU,G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