@tangle-network/agent-eval 0.123.1 → 0.123.3

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 (94) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +191 -157
  3. package/dist/analyst/index.d.ts +27 -4
  4. package/dist/analyst/index.js +6 -6
  5. package/dist/authenticity/index.js +3 -2
  6. package/dist/authenticity/index.js.map +1 -1
  7. package/dist/benchmarks/index.d.ts +12 -4
  8. package/dist/benchmarks/index.js +9 -9
  9. package/dist/campaign/index.d.ts +270 -254
  10. package/dist/campaign/index.js +22 -18
  11. package/dist/{chunk-GS3FJGUF.js → chunk-22VO7T2I.js} +805 -366
  12. package/dist/chunk-22VO7T2I.js.map +1 -0
  13. package/dist/{chunk-LBAHQOBI.js → chunk-4KO6D2BO.js} +38 -12
  14. package/dist/chunk-4KO6D2BO.js.map +1 -0
  15. package/dist/{chunk-3FCG7FBV.js → chunk-D5JZ7UDZ.js} +2 -2
  16. package/dist/{chunk-XJYR7XFV.js → chunk-GC4ATIKK.js} +1 -1
  17. package/dist/chunk-GC4ATIKK.js.map +1 -0
  18. package/dist/{chunk-BGVTIE2C.js → chunk-GRCDRKII.js} +13 -2
  19. package/dist/chunk-GRCDRKII.js.map +1 -0
  20. package/dist/{chunk-FHFTYX2Q.js → chunk-JKDNAOF5.js} +2 -2
  21. package/dist/{chunk-S3UZOQ5Y.js → chunk-LOW3U7JZ.js} +2 -2
  22. package/dist/{chunk-FC5NDO3E.js → chunk-MHPEGJHC.js} +4 -4
  23. package/dist/{chunk-NJC7U437.js → chunk-MK3Q6GCL.js} +33 -18
  24. package/dist/chunk-MK3Q6GCL.js.map +1 -0
  25. package/dist/{chunk-U5CHZ5M3.js → chunk-N7ZS6PEF.js} +4 -4
  26. package/dist/{chunk-A5S77LSE.js → chunk-QFQZ3U3X.js} +2 -2
  27. package/dist/chunk-QFQZ3U3X.js.map +1 -0
  28. package/dist/{chunk-G2GPNLSX.js → chunk-QNVBALEX.js} +4 -4
  29. package/dist/{chunk-OYZAPX5G.js → chunk-R226UZOI.js} +2 -2
  30. package/dist/{chunk-6WX7CBAR.js → chunk-SJT4OBVL.js} +20 -9
  31. package/dist/chunk-SJT4OBVL.js.map +1 -0
  32. package/dist/{chunk-HZJF4IUO.js → chunk-SUN7QLPB.js} +6 -6
  33. package/dist/{chunk-HZJF4IUO.js.map → chunk-SUN7QLPB.js.map} +1 -1
  34. package/dist/{chunk-VJ7T5WIO.js → chunk-WP3GEXKI.js} +3 -3
  35. package/dist/cli.js +101 -11
  36. package/dist/cli.js.map +1 -1
  37. package/dist/contract/index.d.ts +115 -8
  38. package/dist/contract/index.js +11 -9
  39. package/dist/contract/index.js.map +1 -1
  40. package/dist/control.js +3 -3
  41. package/dist/fuzz.d.ts +8 -1
  42. package/dist/fuzz.js +7 -6
  43. package/dist/fuzz.js.map +1 -1
  44. package/dist/hosted/index.d.ts +8 -2
  45. package/dist/index.d.ts +36 -10
  46. package/dist/index.js +18 -16
  47. package/dist/index.js.map +1 -1
  48. package/dist/multishot/index.d.ts +2 -2
  49. package/dist/openapi.json +1 -1
  50. package/dist/rl.d.ts +24 -3
  51. package/dist/rl.js +6 -4
  52. package/dist/rl.js.map +1 -1
  53. package/dist/{run-campaign-ZKR5MQMQ.js → run-campaign-I3JXKVAK.js} +3 -3
  54. package/dist/storyboard/index.js +1 -1
  55. package/dist/storyboard/index.js.map +1 -1
  56. package/dist/traces.d.ts +2 -2
  57. package/dist/traces.js +3 -3
  58. package/dist/wire/index.d.ts +77 -5
  59. package/dist/wire/index.js +3 -3
  60. package/docs/adapters-observability.md +6 -6
  61. package/docs/building-doctrine.md +5 -5
  62. package/docs/campaign-proposers.md +142 -131
  63. package/docs/concepts.md +49 -53
  64. package/docs/customer-journeys.md +80 -155
  65. package/docs/design/loop-taxonomy.md +27 -29
  66. package/docs/design.md +69 -0
  67. package/docs/distributed-driver.md +14 -14
  68. package/docs/eval-surface-map.md +11 -11
  69. package/docs/hosted-ingest-spec.md +4 -4
  70. package/docs/insight-report.md +32 -27
  71. package/docs/multi-shot-optimization.md +41 -49
  72. package/docs/research-report-methodology.md +9 -9
  73. package/docs/trace-analysis.md +2 -2
  74. package/docs/wire-protocol.md +16 -16
  75. package/package.json +2 -1
  76. package/dist/chunk-6WX7CBAR.js.map +0 -1
  77. package/dist/chunk-A5S77LSE.js.map +0 -1
  78. package/dist/chunk-BGVTIE2C.js.map +0 -1
  79. package/dist/chunk-GS3FJGUF.js.map +0 -1
  80. package/dist/chunk-LBAHQOBI.js.map +0 -1
  81. package/dist/chunk-NJC7U437.js.map +0 -1
  82. package/dist/chunk-XJYR7XFV.js.map +0 -1
  83. package/docs/auto-research-loop-end-to-end.md +0 -186
  84. package/docs/improvement-glossary.md +0 -204
  85. package/docs/self-improvement-map.md +0 -115
  86. /package/dist/{chunk-3FCG7FBV.js.map → chunk-D5JZ7UDZ.js.map} +0 -0
  87. /package/dist/{chunk-FHFTYX2Q.js.map → chunk-JKDNAOF5.js.map} +0 -0
  88. /package/dist/{chunk-S3UZOQ5Y.js.map → chunk-LOW3U7JZ.js.map} +0 -0
  89. /package/dist/{chunk-FC5NDO3E.js.map → chunk-MHPEGJHC.js.map} +0 -0
  90. /package/dist/{chunk-U5CHZ5M3.js.map → chunk-N7ZS6PEF.js.map} +0 -0
  91. /package/dist/{chunk-G2GPNLSX.js.map → chunk-QNVBALEX.js.map} +0 -0
  92. /package/dist/{chunk-OYZAPX5G.js.map → chunk-R226UZOI.js.map} +0 -0
  93. /package/dist/{chunk-VJ7T5WIO.js.map → chunk-WP3GEXKI.js.map} +0 -0
  94. /package/dist/{run-campaign-ZKR5MQMQ.js.map → run-campaign-I3JXKVAK.js.map} +0 -0
@@ -1,7 +1,7 @@
1
- # Eval surface map which primitive, when
1
+ # Eval surface map: which primitive, when
2
2
 
3
3
  The eval surface is a small set of orthogonal primitives. They compose; they do
4
- not overlap. If two seem interchangeable, read the "use when" the distinction
4
+ not overlap. If two seem interchangeable, read the "use when": the distinction
5
5
  is real and load-bearing. **Do not add a new wrapper to bridge two of these; the
6
6
  composition point already exists (see Produced-state grading below).**
7
7
 
@@ -10,15 +10,15 @@ composition point already exists (see Produced-state grading below).**
10
10
  | Primitive | Use when | Returns |
11
11
  |---|---|---|
12
12
  | `runCampaign` | The measurement primitive. Run a dispatch over scenarios × seeds × reps, score each with judges, aggregate. Caller owns the dispatch. | `CampaignResult` |
13
- | `runEval` | The simplest preset over `runCampaign` just score, no loop, no gate. The 80% "I want a scorecard" case. | `CampaignResult` |
13
+ | `runEval` | The simplest preset over `runCampaign`: just score, no loop, no gate. The 80% "I want a scorecard" case. | `CampaignResult` |
14
14
  | `runProfileMatrix` | Factor the SAME scenarios across N agent **profiles** (models / prompt variants), with RunRecord stamping + a real-backend integrity guard. | `RunRecord[]` |
15
15
  | `runOptimization` | GENERATE: measured or validated premeasured baseline → N generations of propose → measure → rank → promote. No release gate. | generations + winner |
16
16
  | `runImprovementLoop` | The release-gate shell around `runOptimization`: adds a held-out re-score + a promotion gate (+ optional auto-PR). | gate decision + winner |
17
- | `runEvalCampaign` | Inversion-of-control variant of `runCampaign` the runner is handed a pre-wired trace/sink/emitter and integrity gating as a precondition. Use when you need full capture by construction. | `CampaignResult` + records |
17
+ | `runEvalCampaign` | Inversion-of-control variant of `runCampaign`: the runner is handed a pre-wired trace/sink/emitter and integrity gating as a precondition. Use when you need full capture by construction. | `CampaignResult` + records |
18
18
 
19
19
  When variants of the same task run inside one `runCampaign`, give those scenarios the same `seedGroup` so each repetition uses common randomness.
20
20
  Use `runProfileMatrix` instead when profiles are separate campaign axes.
21
- | `runAgentMatrix` | The bare N-axis cartesian scheduler with concurrency control. The layer beneath the eval surface reach for it only when you need raw scheduling, not eval semantics. | cell results |
21
+ | `runAgentMatrix` | The bare N-axis cartesian scheduler with concurrency control. The layer beneath the eval surface: reach for it only when you need raw scheduling, not eval semantics. | cell results |
22
22
 
23
23
  Mental model: **measure** (`runCampaign`/`runEval`) → **factor** (`runProfileMatrix`) →
24
24
  **generate** (`runOptimization`) → **gate** (`runImprovementLoop`). `runEvalCampaign`
@@ -27,11 +27,11 @@ is `runCampaign` with capture inverted; `runAgentMatrix` is the scheduler undern
27
27
  Merging any two of these conflates distinct mental models (measure ≠ search ≠
28
28
  release-gate). Keep them separate; pick by the table.
29
29
 
30
- ## Produced-state grading there is NO persona-dispatch wrapper
30
+ ## Produced-state grading: there is NO persona-dispatch wrapper
31
31
 
32
32
  To grade what an agent actually **produced** (filed the proposal, wrote the
33
33
  artifact) rather than what it said, the composition point is a **judge that wraps
34
- `verifyCompletion`** not a dedicated runner. The pipeline:
34
+ `verifyCompletion`**: not a dedicated runner. The pipeline:
35
35
 
36
36
  ```
37
37
  runtime/app-tool events ──► extractProducedState(events) ──► ProducedState
@@ -43,20 +43,20 @@ runtime/app-tool events ──► extractProducedState(events) ──► Produce
43
43
 
44
44
  `extractProducedState` is a pure function over the produced-event stream; the
45
45
  judge calls it inline. This is why **`runProducedStatePersonaDispatch` does not
46
- exist and should not be built** it would be a fourth layer over a composition
46
+ exist and should not be built**: it would be a fourth layer over a composition
47
47
  that is already one judge. (Archetype: `playback.ts` `scoreUserStory`.)
48
48
 
49
49
  ### The in-band body contract
50
50
 
51
- Produced events carry their **body in-band** the grader never reaches into a
51
+ Produced events carry their **body in-band**: the grader never reaches into a
52
52
  product database to recover it:
53
53
 
54
54
  - `artifact` events carry `content` (the persisted file body).
55
- - `proposal_created` events carry `content` (the `submit_proposal` description)
55
+ - `proposal_created` events carry `content` (the `submit_proposal` description) -
56
56
  same role, same field name. A title-only filing omits it; a content-less
57
57
  proposal is graded presence-only (and, by the completion oracle's rule, does
58
58
  not count as a completed deliverable).
59
59
 
60
60
  A consumer that finds itself re-fetching a deliverable's body from its own DB to
61
- grade it is working around a thin event fix the event (carry `content`), don't
61
+ grade it is working around a thin event: fix the event (carry `content`), don't
62
62
  add an enrichment band-aid.
@@ -1,4 +1,4 @@
1
- # Hosted-ingest wire spec `2026-05-26.v1`
1
+ # Hosted-ingest wire spec: `2026-05-26.v1`
2
2
 
3
3
  The schema **every** orchestrator (ours, partners' self-hosted ones,
4
4
  any future open implementation) must accept. Frozen under semver:
@@ -149,7 +149,7 @@ Any orchestrator implementing this spec MUST:
149
149
  5. **Persist eval-runs durably**: at least the event + cell scores must
150
150
  survive an orchestrator restart. Trace spans MAY be best-effort.
151
151
  6. **Provide read access**: GET endpoints for the tenant to list + fetch
152
- their own runs. Wire format for reads is NOT part of this spec each
152
+ their own runs. Wire format for reads is NOT part of this spec: each
153
153
  orchestrator can pick its own (REST + JSON, gRPC, GraphQL).
154
154
 
155
155
  Servers SHOULD also:
@@ -163,7 +163,7 @@ Servers SHOULD also:
163
163
 
164
164
  ## Reference implementation
165
165
 
166
- `examples/hosted-ingest-server/` a minimal hono-based receiver. ~200
166
+ `examples/hosted-ingest-server/`: a minimal hono-based receiver. ~200
167
167
  LOC. Validates auth, accepts ingest, stores in memory, exposes a
168
168
  read endpoint. Runs anywhere Node runs.
169
169
 
@@ -200,4 +200,4 @@ receiver's `GET /v1/runs` lists it back.
200
200
  Servers MUST reject requests with `X-Tangle-Wire-Version` they don't
201
201
  support, with a 400 listing the versions they DO accept.
202
202
 
203
- The version string IS the spec id pin against it.
203
+ The version string IS the spec id: pin against it.
@@ -1,11 +1,11 @@
1
- # `InsightReport` the decision packet
1
+ # `InsightReport`: the report
2
2
 
3
3
  The single shape every analysis call returns. `selfImprove()` embeds it in `SelfImproveResult.insight`; `analyzeRuns()` returns it directly. The hosted-tier wire format carries it on `EvalRunEvent.insightReport?`.
4
4
 
5
5
  Use `summarizeExecution({ runs })` when observed traces have no task-quality labels.
6
6
  It returns only `execution` and `costProvenance`, so callers do not need to fabricate a quality score to report runtime facts.
7
7
 
8
- Every section is **opt-in based on what your data supports** the function never invents signal. If your runs don't carry judge scores, `judges` is empty. If there's no baseline/candidate split, `lift` is undefined. The shape is consistent; population is honest.
8
+ Every section is **opt-in based on what your data supports**: the function never invents signal. If your runs don't carry judge scores, `judges` is empty. If there's no baseline/candidate split, `lift` is undefined. The shape is consistent; population is honest.
9
9
 
10
10
  This page walks every section with a real (synthetic) example and explains how to act on it.
11
11
 
@@ -27,13 +27,13 @@ interface InsightReport {
27
27
  contamination?: ContaminationInsight // when canaryScenarios supplied
28
28
  outcomeCorrelation?: OutcomeCorrelationInsight // when outcomeSignal supplied
29
29
  release: ReleaseSummary // always
30
- recommendations: Recommendation[] // always read this FIRST
30
+ recommendations: Recommendation[] // always: read this FIRST
31
31
  }
32
32
  ```
33
33
 
34
34
  ---
35
35
 
36
- ## `execution` runtime facts, separate from quality
36
+ ## `execution`: runtime facts, separate from quality
37
37
 
38
38
  Always present.
39
39
  It reports duration, optional queue time, direct input, output, reasoning, cache-read, and cache-write tokens, model-call coverage, model cohorts, explicit failures, and separately reported orchestration aggregates.
@@ -73,7 +73,7 @@ Cost remains in `costQuality`, where observed, estimated, and uncaptured USD sta
73
73
 
74
74
  ---
75
75
 
76
- ## `n` + `composite` + `perDimension` distributional summary
76
+ ## `n` + `composite` + `perDimension`: distributional summary
77
77
 
78
78
  Always present. The basic "where are my numbers" view.
79
79
 
@@ -99,13 +99,13 @@ Always present. The basic "where are my numbers" view.
99
99
 
100
100
  **Read first:** the `composite.mean`. If it's < 0.5, your agent has a ceiling problem, not a tuning problem.
101
101
 
102
- **Read next:** `perDimension`. If `clarity` is high but `concision` is low, your prompts get the right ideas in too many words different fix than "wrong ideas."
102
+ **Read next:** `perDimension`. If `clarity` is high but `concision` is low, your prompts get the right ideas in too many words: different fix than "wrong ideas."
103
103
 
104
104
  **Use the histogram for:** finding bimodal failure modes. A bin with `count > 0` near zero and another > 0 near 1 means your agent has two distinct behaviors, not one noisy one.
105
105
 
106
106
  ---
107
107
 
108
- ## `costQuality` cost-vs-quality Pareto
108
+ ## `costQuality`: cost-vs-quality Pareto
109
109
 
110
110
  Always present. `cost.histogram` is the per-run cost distribution; `pareto` is the substrate's `ParetoFigureSpec`.
111
111
 
@@ -131,11 +131,11 @@ Always present. `cost.histogram` is the per-run cost distribution; `pareto` is t
131
131
 
132
132
  **Use this when:** comparing prompts, models, or candidate surfaces. The Pareto frontier is your menu of "best you can do at each cost level."
133
133
 
134
- **Render with:** any chart library `points` is plain JSON. Hosted-tier dashboards render this as a scatter with the frontier highlighted.
134
+ **Render with:** any chart library: `points` is plain JSON. Hosted-tier dashboards render this as a scatter with the frontier highlighted.
135
135
 
136
136
  ---
137
137
 
138
- ## `judges` per-judge mean
138
+ ## `judges`: per-judge mean
139
139
 
140
140
  Populated when run records carry `outcome.judgeScores`.
141
141
 
@@ -154,20 +154,23 @@ The substrate's full judge-calibration suite (positional bias, self-preference,
154
154
 
155
155
  ---
156
156
 
157
- ## `interRater` multi-rater agreement + disagreement triage
157
+ ## `interRater`: multi-rater agreement and disagreement review
158
158
 
159
- Populated when `analyzeRuns({ raterScores })` is supplied typically via `fromFeedbackTable()`.
159
+ Populated when `analyzeRuns({ raterScores })` is supplied: typically via `fromFeedbackTable()`.
160
160
 
161
161
  ```jsonc
162
162
  {
163
163
  "interRater": {
164
164
  "raters": 3,
165
165
  "jointlyRated": 30,
166
- "kappa": 0.71,
166
+ "kappa": 0.40,
167
+ "icc": 0.42,
168
+ "pearson": 0.43,
169
+ "spearman": 0.41,
167
170
  "perPair": {
168
- "alice::bob": 0.78,
169
- "alice::carol": 0.65,
170
- "bob::carol": 0.69
171
+ "alice::bob": 0.53,
172
+ "alice::carol": 0.47,
173
+ "bob::carol": 0.19
171
174
  },
172
175
  "disagreementCases": [
173
176
  { "runId": "claim-7", "range": 1.00,
@@ -180,13 +183,15 @@ Populated when `analyzeRuns({ raterScores })` is supplied — typically via `fro
180
183
  }
181
184
  ```
182
185
 
183
- **Read first:** the mean `kappa`. < 0.5 means raters disagree on what "good" looks like — surface the disagreement cases at the next review meeting.
186
+ **Read first:** `kappa` and `icc`, which measure absolute agreement.
187
+ Pearson and Spearman measure correlation and can remain high when raters use different score levels.
188
+ When absolute agreement is low, review the largest disagreement cases before automating the rubric.
184
189
 
185
190
  **Use this when:** building per-rater LLM judges. Each rater's individual scores are the gold signal you calibrate against. Once a calibrated LLM matches the human ≥85%, you can auto-grade and escalate only the disagreement cases.
186
191
 
187
192
  ---
188
193
 
189
- ## `lift` paired-bootstrap statistical lift
194
+ ## `lift`: paired-bootstrap statistical lift
190
195
 
191
196
  Populated when baseline + candidate candidates are present (auto-detected from two distinct `candidateId`s, or explicit via `baselineCandidateId` + `candidateCandidateId`).
192
197
 
@@ -211,13 +216,13 @@ Populated when baseline + candidate candidates are present (auto-detected from t
211
216
  - `ci95[0] ≤ threshold < ci95[1]` → **INCONCLUSIVE.** Expand the corpus or wait for more data.
212
217
  - `ci95[1] ≤ threshold` → **HOLD.** No evidence the candidate is better.
213
218
 
214
- The `recommendations` array surfaces exactly this decision (`kind: 'ship' | 'hold' | 'expand-corpus'`) that's what consumers should read.
219
+ The `recommendations` array surfaces exactly this decision (`kind: 'ship' | 'hold' | 'expand-corpus'`): that's what consumers should read.
215
220
 
216
221
  **Why bootstrap, not t-test alone:** paired bootstrap is distribution-free. Your judge scores are bounded in [0,1] and almost never normal; the bootstrap CI is the honest one.
217
222
 
218
223
  ---
219
224
 
220
- ## `failureClusters` grouped failure modes
225
+ ## `failureClusters`: grouped failure modes
221
226
 
222
227
  Populated when an `AnalystRegistry` is passed via `analyzeRuns({ analyst })`. The substrate runs each failed run through the registered analysts and groups findings by `analyst_id` / `area`.
223
228
 
@@ -245,7 +250,7 @@ Populated when an `AnalystRegistry` is passed via `analyzeRuns({ analyst })`. Th
245
250
 
246
251
  ---
247
252
 
248
- ## `contamination` canary check
253
+ ## `contamination`: canary check
249
254
 
250
255
  Populated when canary scenarios are passed via `analyzeRuns({ canaryScenarios })`. Each canary carries a sentinel string the agent should never emit; the report counts leaks.
251
256
 
@@ -277,7 +282,7 @@ When `leaks > 0`:
277
282
 
278
283
  ---
279
284
 
280
- ## `outcomeCorrelation` closing the loop on real outcomes
285
+ ## `outcomeCorrelation`: closing the loop on real outcomes
281
286
 
282
287
  Populated when `outcomeSignal: { metric, valueByRunId }` is supplied.
283
288
 
@@ -307,9 +312,9 @@ This is the layer that says **"does my judge's taste actually predict the metric
307
312
 
308
313
  ---
309
314
 
310
- ## `release` pass/warn/fail axes
315
+ ## `release`: pass/warn/fail axes
311
316
 
312
- Always present. Roll-up across three axes quality lift, contamination, composite distribution.
317
+ Always present. Roll-up across three axes: quality lift, contamination, composite distribution.
313
318
 
314
319
  ```jsonc
315
320
  {
@@ -334,7 +339,7 @@ Overall `status` is `fail` if any axis fails; `warn` if any warn; `pass` otherwi
334
339
 
335
340
  ---
336
341
 
337
- ## `recommendations` the actionable layer
342
+ ## `recommendations`: the actionable layer
338
343
 
339
344
  Always present. Read this first.
340
345
 
@@ -342,7 +347,7 @@ Always present. Read this first.
342
347
  {
343
348
  "recommendations": [
344
349
  { "priority": "critical", "kind": "ship",
345
- "title": "Ship lift 0.070 (95% CI 0.040..0.100)",
350
+ "title": "Ship: lift 0.070 (95% CI 0.040..0.100)",
346
351
  "detail": "Holdout lift exceeds threshold 0.02 with 95% bootstrap confidence (n=40, p=0.0008, d=0.41).",
347
352
  "evidencePath": "lift" },
348
353
  { "priority": "high", "kind": "investigate",
@@ -357,7 +362,7 @@ Always present. Read this first.
357
362
  |---|---|
358
363
  | `ship` | lift CI lower bound > threshold |
359
364
  | `hold` | lift CI upper bound ≤ threshold |
360
- | `expand-corpus` | lift CI straddles threshold more data needed |
365
+ | `expand-corpus` | lift CI straddles threshold: more data needed |
361
366
  | `fix` | canary contamination detected |
362
367
  | `recalibrate` | inter-rater κ < 0.5, OR outcome correlation < 0.3 |
363
368
  | `investigate` | top failure cluster > some-share |
@@ -378,4 +383,4 @@ Always present. Read this first.
378
383
  | `contamination` | `canaryScenarios` passed in |
379
384
  | `outcomeCorrelation` | `outcomeSignal` passed in |
380
385
 
381
- All sections beyond the always-present ones are `T | undefined`, never empty objects. If a section is missing, your inputs didn't support it the report is honest about that.
386
+ All sections beyond the always-present ones are `T | undefined`, never empty objects. If a section is missing, your inputs didn't support it: the report is honest about that.
@@ -1,75 +1,67 @@
1
- # Multi-Shot Optimization
1
+ # Improve One Surface
2
2
 
3
- > **Renamed.** `runMultiShotOptimization` was retired. The live API is
4
- > `runImprovementLoop` (proposer-agnostic, gated promotion) driven by `gepaProposer`,
5
- > with `compareProposers` for head-to-head proposer lift. This doc was rewritten to the
6
- > live API; see also [feature-guide.md](./feature-guide.md) and [concepts.md](./concepts.md).
3
+ `runImprovementLoop` generates candidate prompts or configs, runs them on training scenarios, and checks the selected candidate on separate holdout scenarios.
7
4
 
8
- `runImprovementLoop` is the public entry for GEPA-style optimization over a whole
9
- task trajectory the thing you improve is not a single model call but an agent
10
- system prompt, tool descriptions, a routing policy, or any scaffolding that affects
11
- the entire run. It is the OUTER loop: it improves the SURFACE the inner workers run.
5
+ Use it when the question is: "Can this method improve my current surface?"
6
+ Use [`compareOptimizationMethods`](./campaign-proposers.md#compare-complete-methods) when the question is: "Which complete optimization method performs best?"
12
7
 
13
- ## The shape
8
+ ## Inputs
14
9
 
15
- You own a few seams; the loop owns the release-critical glue (paired seeds, the
16
- held-out re-score, the promotion gate, provenance):
10
+ | Input | Meaning |
11
+ |---|---|
12
+ | `baselineSurface` | Current prompt or config. |
13
+ | `scenarios` | Training scenarios used to generate and score candidates. |
14
+ | `holdoutScenarios` | Separate scenarios used by the release rule after search. |
15
+ | `dispatchWithSurface` | Runs one scenario with one candidate surface. |
16
+ | `judges` | Scores the returned artifact. |
17
+ | `proposer` | Generates candidate surfaces. |
18
+ | `gate` | Applies the caller's release rule to baseline and winner results. |
19
+ | `runDir` | Stores run artifacts, traces, and resumable state. |
17
20
 
18
- - **`baselineSurface`** — the current surface (a prompt string, or a `CodeSurface`).
19
- - **`dispatchWithSurface(surface, scenario, ctx)`** — run one task to completion
20
- under a candidate surface; return the artifact the judges score.
21
- - **`judges`** — score the artifact (`{ composite, dimensions }`).
22
- - **`proposer`** — proposes candidate surfaces each generation: `gepaProposer`
23
- (reflective + Pareto frontier) or `evolutionaryProposer` (mutator).
24
- - **`gate`** — `defaultProductionGate` (held-out significance + red-team +
25
- reward-hacking + canary). Ships ONLY on a CI-lower-bound held-out lift.
26
-
27
- ## Minimal example
21
+ ## Example
28
22
 
29
23
  ```ts
30
24
  import {
31
- runImprovementLoop,
32
- gepaProposer,
33
25
  defaultProductionGate,
34
- } from '@tangle-network/agent-eval/contract'
26
+ gepaProposer,
27
+ runImprovementLoop,
28
+ } from '@tangle-network/agent-eval/campaign'
35
29
 
36
30
  const result = await runImprovementLoop({
37
31
  baselineSurface: currentSystemPrompt,
38
- scenarios: trainScenarios, // optimizer-visible
39
- holdoutScenarios, // DISJOINT — only the gate sees these
40
- dispatchWithSurface: async (surface, scenario) =>
41
- runYourAgentToCompletion({ scenario, prompt: String(surface) }),
42
- judges: [myJudge],
32
+ scenarios: trainScenarios,
33
+ holdoutScenarios,
34
+ dispatchWithSurface: async (surface, scenario, ctx) =>
35
+ runYourAgent({ prompt: String(surface), scenario, signal: ctx.signal }),
36
+ judges: [qualityJudge],
43
37
  proposer: gepaProposer({
44
38
  llm: { apiKey, baseUrl },
45
- model: 'gpt-5',
46
- target: 'enforce a strict output schema',
39
+ model,
40
+ target: 'the complete system prompt',
47
41
  }),
48
42
  populationSize: 4,
49
43
  maxGenerations: 4,
50
- gate: defaultProductionGate({ holdoutScenarios, deltaThreshold: 0 }),
51
- autoOnPromote: 'none', // or 'pr' (+ ghOwner/ghRepo) to open a PR on ship
44
+ gate: defaultProductionGate({
45
+ holdoutScenarios,
46
+ deltaThreshold: 0,
47
+ }),
48
+ autoOnPromote: 'none',
52
49
  runDir,
53
50
  })
54
51
 
55
52
  if (result.gateResult.decision === 'ship') {
56
- deploy(result.winnerSurface) // the proposer's candidate, gated on a real held-out lift
53
+ deploy(result.winnerSurface)
57
54
  }
58
55
  ```
59
56
 
60
- ## Discipline (what makes it trustworthy)
57
+ ## Behavior
61
58
 
62
- - **Holdout is disjoint + gated.** `holdoutScenarios` must not overlap the training
63
- pool. The gate re-scores baseline vs winner on the holdout and ships only when the
64
- paired-bootstrap CI lower bound clears `deltaThreshold`; a few-instance swing at
65
- thin `n` is held (`few_runs`), not promoted.
66
- - **No-op never ships.** If no candidate beats the baseline, the winner IS the
67
- baseline (empty diff) and the loop forces `hold` — it does not score
68
- baseline-vs-itself and read model noise as lift.
69
- - **Provenance falls out.** `result.promotedDiff` + `emitLoopProvenance` give the
70
- auditable candidate→gate→promote chain (rationale, content hashes, a held-out lift
71
- recomputable from the emitted record).
59
+ - Training and holdout scenario IDs must be disjoint.
60
+ - Candidate generation cannot read holdout judge scores through `SurfaceProposer`.
61
+ - The selected candidate is measured against the baseline on holdout scenarios.
62
+ - A selected surface identical to the baseline is held instead of treating model variance as lift.
63
+ - `result.cost` includes worker, candidate-generation, and judge calls recorded through the shared cost ledger.
64
+ - `result.promotedDiff` describes the exact selected surface change.
72
65
 
73
- Reach for `compareProposers` when the question is "which proposer wins" rather than
74
- "improve this surface", and see `tests/campaign/presets.test.ts` for the executable
75
- contract (no-op guard, fail-loud holdout, gate promotion).
66
+ The release decision is only as useful as the scenarios and judges supplied by the caller.
67
+ Calibrate the judge on known strong and weak outputs before using it for promotion.
@@ -1,4 +1,4 @@
1
- # researchReport methodology
1
+ # researchReport: methodology
2
2
 
3
3
  This document is the methodological brief for `researchReport` (exported from
4
4
  `@tangle-network/agent-eval` and `@tangle-network/agent-eval/reporting`). It
@@ -11,14 +11,14 @@ corresponding function or option so the doc and the code don't drift.
11
11
 
12
12
  ## Inputs
13
13
 
14
- - `runs: RunRecord[]` every record carries `runId`, `candidateId`, `seed`,
14
+ - `runs: RunRecord[]`: every record carries `runId`, `candidateId`, `seed`,
15
15
  `experimentId`, `splitTag`, and an `outcome` with the configured score.
16
- - `comparator: string` the candidate id treated as the null reference. Must
16
+ - `comparator: string`: the candidate id treated as the null reference. Must
17
17
  be selected before data inspection; `preregistrationHash` should pin this.
18
- - `split: 'search' | 'holdout'` defaults to `holdout`. Decisions on `search`
18
+ - `split: 'search' | 'holdout'`: defaults to `holdout`. Decisions on `search`
19
19
  are descriptive only; promotion calls require the holdout.
20
- - `rope: { low, high }` Region of Practical Equivalence on the paired delta,
21
- in score units. Must come from the domain owner there is no
20
+ - `rope: { low, high }`: Region of Practical Equivalence on the paired delta,
21
+ in score units. Must come from the domain owner: there is no
22
22
  statistically-defensible default.
23
23
  - `minPairs` (soft floor, default 20) and `RESEARCH_REPORT_HARD_PAIR_FLOOR`
24
24
  (hard floor, 6). Below the soft floor, the verdict is `needs_more_data` and
@@ -35,7 +35,7 @@ with non-finite scores are dropped before pairing.
35
35
 
36
36
  ## Decision rule
37
37
 
38
- In order first match wins:
38
+ In order: first match wins:
39
39
 
40
40
  1. `comparator` itself → `hold` (baseline).
41
41
  2. No comparator → `hold` if on the cost/quality Pareto frontier, else
@@ -46,7 +46,7 @@ In order — first match wins:
46
46
  "below hard floor" reason. Bootstrap CIs degenerate at this size.
47
47
  5. ROPE configured AND paired-delta CI ⊂ ROPE → `equivalent`.
48
48
  6. Paired-delta CI upper bound < 0 → `reject` (CI excludes a non-negative
49
- effect). Note: this uses **paired delta only** not the marginal mean.
49
+ effect). Note: this uses **paired delta only**: not the marginal mean.
50
50
  7. Paired N < `minPairs` (soft floor) → `needs_more_data` with the MDE at
51
51
  current N attached so the verdict is actionable.
52
52
  8. BH-adjusted q ≤ `fdr` AND CI lower bound > 0 → `promote`. The BH q-value
@@ -71,7 +71,7 @@ The Pr(Δ>0) and Pr(Δ∈ROPE) summaries use the bootstrap-prior duality of
71
71
  [Rubin 1981]: under a non-informative Dirichlet prior, the bootstrap
72
72
  distribution of a sample statistic is its posterior. We expose these as
73
73
  posterior summaries on the **mean** delta and the bootstrap CI on the
74
- **median** delta the median is more robust to the heavy-tailed score
74
+ **median** delta: the median is more robust to the heavy-tailed score
75
75
  distributions seen in agent benchmarks; the mean lets us read off the
76
76
  Bayesian-style probability of superiority in a single number.
77
77
 
@@ -51,7 +51,7 @@ The analyst runs one Ax executor loop and accepts only an explicit structured `f
51
51
  ## Deterministic failure coverage (no LLM)
52
52
 
53
53
  Before (or alongside) the LLM analyst, `OtlpFileTraceStore.getOverview()` returns a
54
- `DatasetOverview` whose `error_clusters` are computed deterministically error
54
+ `DatasetOverview` whose `error_clusters` are computed deterministically: error
55
55
  spans are grouped by a normalized failure signature (uuids / hex ids / numbers /
56
56
  absolute paths / durations collapsed), each cluster carrying its prevalence,
57
57
  exemplar `trace_id`/`span_id`, and a verbatim sample. This is a zero-LLM,
@@ -60,7 +60,7 @@ reproducible failure checklist the analyst then explains and closes:
60
60
  ```ts
61
61
  const overview = await store.getOverview()
62
62
  for (const c of overview.error_clusters) {
63
- console.log(`${c.trace_count}× ${c.signature} e.g. trace ${c.exemplar_trace_ids[0]}`)
63
+ console.log(`${c.trace_count}× ${c.signature}: e.g. trace ${c.exemplar_trace_ids[0]}`)
64
64
  }
65
65
  ```
66
66
 
@@ -29,9 +29,9 @@ Both transports talk to identical handlers. If you need a sustained connection (
29
29
 
30
30
  ## Methods
31
31
 
32
- The current surface is the smallest useful slice. Adding a method is mechanical see [§Adding a method](#adding-a-method).
32
+ The current surface is the smallest useful slice. Adding a method is mechanical: see [§Adding a method](#adding-a-method).
33
33
 
34
- ### `judge` score content against a rubric
34
+ ### `judge`: score content against a rubric
35
35
 
36
36
  ```http
37
37
  POST /v1/judge
@@ -63,7 +63,7 @@ Pass either `rubricName` (built-in) or `rubric` (inline definition). Not both. T
63
63
 
64
64
  `rubricVersion` is the stable hash of the rubric used. Scores are only comparable across runs when this matches.
65
65
 
66
- ### `listRubrics` discover what's registered
66
+ ### `listRubrics`: discover what's registered
67
67
 
68
68
  ```http
69
69
  GET /v1/rubrics
@@ -87,7 +87,7 @@ GET /v1/rubrics
87
87
  }
88
88
  ```
89
89
 
90
- ### `version` server + wire-protocol versions
90
+ ### `version`: server + wire-protocol versions
91
91
 
92
92
  ```http
93
93
  GET /v1/version
@@ -102,13 +102,13 @@ GET /v1/version
102
102
  }
103
103
  ```
104
104
 
105
- `version` matches the package version. `wireVersion` bumps independently only on breaking request/response schema changes. Package versions can differ across releases as long as `wireVersion` matches.
105
+ `version` matches the package version. `wireVersion` bumps independently: only on breaking request/response schema changes. Package versions can differ across releases as long as `wireVersion` matches.
106
106
 
107
- ### `GET /healthz` liveness
107
+ ### `GET /healthz`: liveness
108
108
 
109
109
  For probing whether a server is up. Returns `{ "status": "ok", "uptimeSec": <number> }`.
110
110
 
111
- ### `GET /openapi.json` full spec
111
+ ### `GET /openapi.json`: full spec
112
112
 
113
113
  Auto-generated from the Zod schemas. This is what code generators consume to produce typed clients in other languages.
114
114
 
@@ -168,11 +168,11 @@ echo '{}' | agent-eval rpc listRubrics
168
168
  # judge (one-shot)
169
169
  echo '{"rubricName":"anti-slop","content":"…"}' | agent-eval rpc judge
170
170
 
171
- # JSONL batch one request per line
171
+ # JSONL batch: one request per line
172
172
  cat requests.jsonl | agent-eval rpc-batch judge > results.jsonl
173
173
  ```
174
174
 
175
- Each invocation is one process Node startup adds ~500 ms. For more than a few calls, stand up a server.
175
+ Each invocation is one process: Node startup adds ~500 ms. For more than a few calls, stand up a server.
176
176
 
177
177
  ## Clients
178
178
 
@@ -182,13 +182,13 @@ Each invocation is one process — Node startup adds ~500 ms. For more than a fe
182
182
 
183
183
  ## Adding a method
184
184
 
185
- 1. **Schema** define `XRequestSchema` and `XResponseSchema` in `src/wire/schemas.ts`. Every field gets a `.describe()` so docs flow through to OpenAPI.
186
- 2. **Handler** pure function in `src/wire/handlers.ts`. Throws `WireError` for caller-fixable issues.
187
- 3. **Server route** `app.post('/v1/x', …)` in `src/wire/server.ts`.
188
- 4. **RPC case** add `case 'x':` in `dispatchRpc` in `src/wire/rpc.ts`.
189
- 5. **OpenAPI route** register in `src/wire/openapi.ts` so it shows up in the spec.
190
- 6. **Test** add to `tests/wire/`. At minimum: schema validation, happy-path, error-path.
191
- 7. **Python client** add a method on `Client` in `clients/python/src/agent_eval_rpc/client.py`, plus pydantic models in `models.py` mirroring the new schemas.
185
+ 1. **Schema**: define `XRequestSchema` and `XResponseSchema` in `src/wire/schemas.ts`. Every field gets a `.describe()` so docs flow through to OpenAPI.
186
+ 2. **Handler**: pure function in `src/wire/handlers.ts`. Throws `WireError` for caller-fixable issues.
187
+ 3. **Server route**: `app.post('/v1/x', …)` in `src/wire/server.ts`.
188
+ 4. **RPC case**: add `case 'x':` in `dispatchRpc` in `src/wire/rpc.ts`.
189
+ 5. **OpenAPI route**: register in `src/wire/openapi.ts` so it shows up in the spec.
190
+ 6. **Test**: add to `tests/wire/`. At minimum: schema validation, happy-path, error-path.
191
+ 7. **Python client**: add a method on `Client` in `clients/python/src/agent_eval_rpc/client.py`, plus pydantic models in `models.py` mirroring the new schemas.
192
192
 
193
193
  The pattern is mechanical. When the surface grows past ~10 methods, swap the hand-written Python models for `datamodel-code-generator -i openapi.json -o models.py`.
194
194
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "0.123.1",
3
+ "version": "0.123.3",
4
4
  "description": "Evaluate and improve AI agents from runs, traces, judges, and feedback. Compare candidates, cluster failures, measure lift, and gate releases.",
5
5
  "homepage": "https://github.com/tangle-network/agent-eval#readme",
6
6
  "repository": {
@@ -142,6 +142,7 @@
142
142
  "test": "vitest run",
143
143
  "test:watch": "vitest",
144
144
  "typecheck": "tsc --noEmit",
145
+ "typecheck:examples": "tsc -p tsconfig.examples.json",
145
146
  "lint": "biome check src",
146
147
  "format": "biome format --write src",
147
148
  "openapi": "node dist/cli.js openapi --out dist/openapi.json",