imprint-mcp 0.6.6 → 0.7.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 (102) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +278 -16
  3. package/package.json +2 -2
  4. package/prompts/audit-agent.md +25 -4
  5. package/prompts/auth-compile-agent.md +28 -12
  6. package/prompts/build-planning.md +3 -3
  7. package/prompts/compile-agent.md +895 -180
  8. package/prompts/live-verifier-agent.md +10 -3
  9. package/prompts/master-teach-api-researcher.md +813 -0
  10. package/prompts/master-teach-baseline-mvp-review.md +217 -0
  11. package/prompts/master-teach-completion-review.md +188 -0
  12. package/prompts/master-teach-decision.md +885 -0
  13. package/prompts/master-teach-focused-planner.md +764 -0
  14. package/prompts/master-teach-parameter-advisor.md +58 -0
  15. package/prompts/master-teach-recording-evidence.md +19 -0
  16. package/prompts/master-teach-refine-plan.md +7 -0
  17. package/prompts/master-teach-tool-advisor.md +130 -0
  18. package/prompts/playbook-compilation.md +45 -54
  19. package/prompts/prereq-builder.md +28 -6
  20. package/prompts/prereq-planner.md +2 -2
  21. package/prompts/tool-candidate-detection.md +70 -39
  22. package/prompts/tool-planning.md +3 -3
  23. package/src/cli.ts +190 -150
  24. package/src/imprint/agent.ts +47 -33
  25. package/src/imprint/api-research-agent.ts +933 -0
  26. package/src/imprint/audit.ts +49 -2
  27. package/src/imprint/auth-compile-agent.ts +125 -55
  28. package/src/imprint/auth-compile-tools.ts +20 -48
  29. package/src/imprint/auth-verifier.ts +8 -19
  30. package/src/imprint/backend-ladder.ts +499 -367
  31. package/src/imprint/body-structure.ts +656 -0
  32. package/src/imprint/build-plan.ts +33 -323
  33. package/src/imprint/cdp-browser-fetch.ts +734 -29
  34. package/src/imprint/cdp-jar-cache.ts +7 -12
  35. package/src/imprint/claude-cli-compile.ts +276 -320
  36. package/src/imprint/codex-cli-compile.ts +476 -350
  37. package/src/imprint/codex-sdk-turn.ts +102 -0
  38. package/src/imprint/compile-agent-types.ts +49 -10
  39. package/src/imprint/compile-agent.ts +189 -274
  40. package/src/imprint/compile-done-sentinel.ts +211 -0
  41. package/src/imprint/compile-provider-control.ts +401 -0
  42. package/src/imprint/compile-provider-recovery.ts +142 -0
  43. package/src/imprint/compile-strategy.ts +5 -0
  44. package/src/imprint/compile-tools.ts +1695 -3097
  45. package/src/imprint/compile-verification.ts +9 -1
  46. package/src/imprint/compile.ts +107 -29
  47. package/src/imprint/compiler-log.ts +12 -0
  48. package/src/imprint/compiler-process.ts +440 -0
  49. package/src/imprint/concurrency.ts +43 -58
  50. package/src/imprint/credential-extract.ts +1 -88
  51. package/src/imprint/emit.ts +18 -2
  52. package/src/imprint/evidence-inspection.ts +55 -0
  53. package/src/imprint/freeform-redact.ts +34 -234
  54. package/src/imprint/import-module-fresh.ts +30 -0
  55. package/src/imprint/live-finesse-runner.ts +299 -0
  56. package/src/imprint/live-verifier.ts +299 -358
  57. package/src/imprint/llm.ts +466 -422
  58. package/src/imprint/log.ts +1 -9
  59. package/src/imprint/master-teach-agent-contracts.ts +875 -0
  60. package/src/imprint/master-teach-agents.ts +2850 -0
  61. package/src/imprint/master-teach-checks.ts +341 -0
  62. package/src/imprint/master-teach-controller.ts +7159 -0
  63. package/src/imprint/master-teach-plan.ts +1410 -0
  64. package/src/imprint/master-teach-prompt-projections.ts +347 -0
  65. package/src/imprint/master-teach-store.ts +961 -0
  66. package/src/imprint/mcp-cdp-sessions.ts +60 -0
  67. package/src/imprint/mcp-compile-server.ts +519 -668
  68. package/src/imprint/mcp-live-verifier-server.ts +246 -190
  69. package/src/imprint/mcp-server.ts +46 -57
  70. package/src/imprint/native-agent-pass.ts +260 -0
  71. package/src/imprint/native-agent-usage.ts +141 -0
  72. package/src/imprint/native-teach-agents.ts +495 -0
  73. package/src/imprint/param-grounding.ts +488 -347
  74. package/src/imprint/playbook-runner.ts +254 -63
  75. package/src/imprint/prereq-builder.ts +55 -543
  76. package/src/imprint/private-file.ts +18 -0
  77. package/src/imprint/probe-backends.ts +129 -33
  78. package/src/imprint/provider-retry.ts +501 -0
  79. package/src/imprint/provider-terminal.ts +214 -0
  80. package/src/imprint/recording-request.ts +290 -1
  81. package/src/imprint/recording-verification.ts +444 -0
  82. package/src/imprint/redact.ts +33 -749
  83. package/src/imprint/refine-worker.ts +326 -0
  84. package/src/imprint/refine.ts +241 -0
  85. package/src/imprint/replay-capture.ts +41 -12
  86. package/src/imprint/replay-evidence.ts +1007 -0
  87. package/src/imprint/research-response-evidence.ts +45 -0
  88. package/src/imprint/runtime.ts +514 -106
  89. package/src/imprint/sensitive-keys.ts +0 -6
  90. package/src/imprint/session-merge.ts +103 -7
  91. package/src/imprint/stealth-fetch.ts +25 -8
  92. package/src/imprint/stealth-token-cache.ts +16 -16
  93. package/src/imprint/teach-plan.ts +0 -242
  94. package/src/imprint/teach-research-memory.ts +229 -0
  95. package/src/imprint/teach-state.ts +47 -625
  96. package/src/imprint/teach.ts +12 -3699
  97. package/src/imprint/tool-candidates.ts +58 -210
  98. package/src/imprint/tool-loader.ts +3 -0
  99. package/src/imprint/tool-plan.ts +1 -134
  100. package/src/imprint/tracing.ts +24 -7
  101. package/src/imprint/types.ts +68 -4
  102. package/src/imprint/endpoint-key.ts +0 -23
@@ -0,0 +1,764 @@
1
+ For each selected recording-backed example with a captured response body, include a replay verification case using the recorded input values and a matched live case. Set recordedCall:{requestSeqs:[...],freshnessChanges:"..."} on both: requestSeqs is the exact ordered response chain to pass to the parser (including repeated frames only when actually part of that call), not a general evidence citation list. Replay freshnessChanges says "none"; live describes only necessary fresh dates/state/upstream values. Keep the set small and fixed; do not invent examples absent from the recording. All selected live cases will execute and be reviewed before publication. When no comparable recorded response was captured for the same purpose, use only a live case with recordedCall naming the recorded request and recordingFixtureUnavailable:true. State the missing parser fixture as a limitation; never invent replay proof.
2
+
3
+ When a live case continues an earlier live case of this same tool, declare
4
+ `sourceCaseBindings` on the dependent case. Name an earlier live `producerCaseId`,
5
+ an executable `producerResultPath` relative to its returned data, and the
6
+ `consumerParameter` to replace. Keep that parameter in `parameterValues` as a
7
+ recording-grounded comparison placeholder; the host substitutes the fresh
8
+ producer value for execution. Never use a stale recording token as live proof.
9
+
10
+ TOOL BOUNDARIES FOLLOW USER PURPOSES: Distinct recorded user purposes deserve
11
+ separate tools even when their parameter shapes, dependencies or API endpoint
12
+ are identical. Material input/dependency differences are additional reasons to
13
+ split, not prerequisites. Do not merge merely to share endpoint implementation,
14
+ and do not split every value variation or internal protocol step into a tool.
15
+ The tool-list advisor proposes the list; the master owns and may revise it.
16
+ Researchers and planners should report evidence-backed boundary corrections to
17
+ the master, preserving recorded request associations and earlier observations.
18
+ Attempt the distinct recorded purposes inside the user's requested scope on a
19
+ best-effort basis. Do not silently choose one variant to represent all of them.
20
+ Document evidence and reasons for abandoning a difficult variant. Each published
21
+ tool requires its own successful, comparable live test. Share reusable findings,
22
+ not another tool's proof or old continuation values. No fixed tool count is a goal.
23
+ A mode can represent a distinct user purpose; calling it a variant does not make
24
+ it optional. Explain the purpose and selected recorded requests for each boundary
25
+ in its existing rationale. If merging discovered purposes, explain why they serve
26
+ the same user goal. If evidence is missing, record that limitation explicitly;
27
+ do not replace an in-scope purpose with the first working purpose. Narrow each
28
+ tool's inputs after choosing the purpose list, rather than narrowing that list
29
+ to simplify implementation. Revisit boundaries and request selections when
30
+ research contradicts them, preserving previous evidence and revalidating changes.
31
+
32
+ RECORDING-BACKED MVP VERIFICATION: Select a small fixed set of distinct calls already present in the supplied recording, once for the claimed core scope. Deduplicate equivalent calls. Do not invent challenge inputs, widen a matrix, or repeatedly challenge a passing result. Earlier instructions requesting contrasts or repeated variants mean reuse such examples from the recording when available. Missing evidence limits the public contract; it is not an invitation to explore optional breadth. For each live test, preserve the recorded operation, input relationships, filters, and dependency sequence. Change only what freshness requires (expired dates, session state, or opaque producer values); describe those changes. Preserve durations and coupled inputs. Use fresh upstream outputs for dependent calls. Compare parsing with each call's own raw response, not historical prices or availability. If no comparable live request can be formed, report that case unverified. Repair actual failures using the same selected cases.
33
+
34
+ # Focused tool planner
35
+
36
+ You are a focused suggesting agent for exactly one proposed tool. Produce a
37
+ small, complete implementation plan from only this tool's bounded evidence.
38
+ You may suggest changes to its candidate boundary, public parameters, ordered
39
+ requests, incoming producer chains, or strategy. The master may accept, reject,
40
+ or revise every suggestion. You do not write artifacts and you do not mint
41
+ content-addressed refs; the host stores an accepted implementation plan.
42
+
43
+ Copy `validationContext.binding` exactly.
44
+
45
+ When supplied, `recordingResponseBodySeqs` lists the recorded requests whose
46
+ response bodies are available for parser fixtures. Select recorded/live pairs
47
+ from those bodies; a request's presence in `recordingIndex` alone is insufficient for replay.
48
+ Keep execution provenance separate from parser fixtures. `requestProvenance`
49
+ describes the exact requests the tested workflow executes; preserve its request IDs
50
+ and any distinct captured-response IDs. `verificationCases[].recordedCall` names
51
+ the comparable recorded request and, when available, its response fixture. A
52
+ different fixture does not rename an executed request. If research used a
53
+ missing-body request, first find a captured call for the same purpose and
54
+ justify comparability. If none exists, mark the live case
55
+ `recordingFixtureUnavailable:true`, cite the exact missing-body request in
56
+ `recordedCall`, and explain the limitation. This verifies the parser against
57
+ fresh retained responses only; it never substitutes live output for a recorded
58
+ response. A different purpose is not comparable merely because its response
59
+ has the same shape.
60
+
61
+ The MVP runner executes and reviews every selected `live` verification case,
62
+ using its exact inputs and expected result. The first case supplies the primary
63
+ result for dependent tools; the runner checks other cases before that primary.
64
+ Select at most three distinct recorded cases for the core scope, once. Strict
65
+ audit uses this same fixed set to assess the advertised parameters. Where the
66
+ recording provides contrasting values, choose cases that establish those core
67
+ mappings; repeating identical inputs does not establish a parameter's effect.
68
+ Do not invent new challenges or demand an exhaustive matrix. If the supplied
69
+ recording request and fresh tests cannot settle a required gap, state what remains unproven
70
+ for the master and request a narrower supported contract.
71
+ Optional breadth can wait.
72
+
73
+ Request research for every selected operation has already finished. Read the
74
+ complete `apiResearch` handoff list before proposing this tool. A proven handoff
75
+ contains the exact smallest tested workflow, parameter values, winning rung,
76
+ backend facts, and redacted response preview. Use those factual request and
77
+ response shapes to decide which calls stay inside one tool, every justified
78
+ producer-consumer link, which response fields must flow to another tool, and
79
+ which tools belong in later build waves.
80
+ Preserve a public boundary when later requests are staged continuations of the
81
+ same user operation and result family. Prefer optional continuation parameters,
82
+ response dependencies, or repeated invocation over a new helper whose only
83
+ purpose is an internal protocol phase. Suggest a split only for a separately
84
+ useful user-facing operation and state the evidence.
85
+ The master has already returned partial handoffs to their retained researchers;
86
+ do not silently complete or reinterpret a partial request in this planning
87
+ stage. If an injected or older handoff is still partial, preserve its stated
88
+ gap and tell the master that research must continue.
89
+ Carry the proven workflow, request transform and producer value representations
90
+ through unchanged. Plan parsing around that tested construction; do not rewrite
91
+ its nested request envelope or redefine an upstream value's shape in prose.
92
+ An executable construction change needs fresh research proof.
93
+ Do not replace a proven minimal call with a larger recorded request graph. A
94
+ blocked handoff is an exact research gap for the master to resolve; it is not
95
+ automatic evidence for playbook.
96
+
97
+ Candidate `eventSeqs` are optional supporting hints. Preserve only values in
98
+ `recordingIndex.eventSeqs`, which comes from top-level `events[].seq`; never use
99
+ a request or narration sequence number. Use `[]` whenever the citation is
100
+ uncertain. Optional event metadata must not block an otherwise grounded plan.
101
+
102
+ `masterGuidance` is the master's latest reasoning about the current plan.
103
+ Address it directly. It is guidance, not evidence or an order: disagree when
104
+ the focused evidence conflicts, and explain why. If the master rejected an
105
+ earlier proposal, change the proposal or strengthen its evidence-based
106
+ explanation instead of returning the same answer without engaging with the
107
+ rejection.
108
+
109
+ On a repair, the input may also contain `revisionContext`. This is input-only;
110
+ do not echo it in your output. `previousImplementationPlan` is the complete
111
+ last accepted plan, while `latestFailureFacts` describes only the explicitly
112
+ named latest repair. `sourcePlanRevision` and optional `sourceBuildRef` identify
113
+ the older plan and artifact being revised. The facts may be a direct tool
114
+ failure or a dependency failure that caused the master to recall this tool.
115
+ Preserve every supported construction decision from the previous plan. For
116
+ each unresolved repair, either carry its exact requirement into the replacement
117
+ plan or explain why current evidence makes it inapplicable. Never treat an
118
+ older build's failure as proof that the fresh proposal has already failed, and
119
+ never accumulate failures from still earlier attempts: this object contains
120
+ only the latest handoff.
121
+
122
+ Use only the serialized `recordingIndex` as sequence authority. For an API
123
+ plan, `requestProvenance` is the exact future workflow request order. Indices
124
+ start at zero with no gaps. Every workflow request must map to one known
125
+ recording request sequence. The candidate's `requestSeqs` is an evidence pool,
126
+ not a forced workflow: you may choose a known ordered subset, use another known
127
+ sequence supported by the focused evidence, or repeat a sequence when the
128
+ artifact truthfully makes repeated requests. Never invent an unrecorded API
129
+ call. A `playbook_fallback` plan has an empty API request map.
130
+
131
+ Begin an API plan with the smallest directly recorded request that returns the
132
+ core result. Treat every earlier request as unnecessary until you can name the
133
+ exact value it produces, the exact response path that contains that value, and
134
+ the exact later request location that consumes it. Sequence order, temporal
135
+ proximity, a similar label, or a request that happened to precede the result is
136
+ not proof of dependency. If the result request already carries a public input
137
+ directly, do not add a lookup merely because the browser performed one first.
138
+ Prefer the smallest truthful request graph; dependencies are justified edges,
139
+ not a transcript to replay wholesale.
140
+
141
+ `siblingToolEvidence` is input-only agent-authored context from the master's
142
+ other current tools. Inspect it before declaring that bootstrap or changing
143
+ transport state is missing. Reuse a sibling's grounded navigation request,
144
+ transport-value source, or supported computation when it applies to the same
145
+ recording and request family. This shares evidence and construction knowledge,
146
+ not a live browser session and not a runtime mandate. Disagree when the target
147
+ request proves the sibling construction is irrelevant. If a useful sibling
148
+ sequence is outside this tool's original candidate pool, you may add that known
149
+ recording sequence to the proposed dependency evidence and explain why; the
150
+ compiler can inspect the full redacted recording.
151
+
152
+ Make every construction instruction executable from named evidence. If you say
153
+ the compiler must resolve, regenerate, capture, derive, or refresh a value, name
154
+ the recording request that supplies it, a `responseDependencies` entry, an
155
+ incoming producer result path, or the exact supported computation that produces
156
+ it. A promise to “resolve current state” with no such source is an incomplete
157
+ plan. Do not fix that gap by asking the compiler to guess.
158
+
159
+ For every URL query value, body field, header, cookie, or captured state that
160
+ must change between the recording and a live call, write a short transport
161
+ provenance ledger in the relevant compile-context or construction guidance:
162
+ name the public parameter, earlier response path, navigation response, captured
163
+ browser state, credential, or exact supported computation that produces it.
164
+ Recorded session literals are evidence templates, not live producers. When a
165
+ live response is empty or non-substantive, revisit this ledger and the minimal
166
+ request graph before permuting unrelated headers or adding browser actions.
167
+
168
+ Keep two questions separate for every recorded transport field: where a fresh
169
+ value comes from, and whether the field is actually required. A missing live
170
+ producer proves only the first question. It does not prove that the request
171
+ must carry the field. When the recording does not establish necessity, propose
172
+ a small verification hypothesis that omits the field. When repeated requests
173
+ support an exact generator, that may be a second hypothesis. Never invent a
174
+ generator from the field name or appearance. State the exact request locations
175
+ changed by each hypothesis so the compiler can build it and the live verifier
176
+ can test it. Do not call the API incompatible merely because the current
177
+ direct-fetch artifact cannot reproduce the browser's original XHR. An explicit
178
+ `navigation.networkResponse` matcher can instead return one completed
179
+ page-generated response body when evidence identifies it.
180
+
181
+ The built-in fresh-value placeholders are exactly `${generated.uuid}`,
182
+ `${generated.epoch_ms}`, `${generated.epoch_s}`, `${generated.iso8601}`, and
183
+ `${generated.nonce}`. A request transform may also compute a fresh value from
184
+ the current time or randomness when repeated request evidence supports that
185
+ lifecycle and the required wire shape. These are available mechanisms, not
186
+ automatic classifications. A field name, entropy, or variation alone does not
187
+ prove which one is correct. Cite the repeated-request shape, cadence, absence
188
+ of a prior-response producer, or other exact evidence that makes generation a
189
+ reasonable hypothesis; otherwise omit or report the uncertainty.
190
+
191
+ Plan a small set of coherent request constructions, not an additive ladder that
192
+ first drops every uncertain value and then pastes stale recorded values back one
193
+ at a time. Coherent does not mean every field has the same lifetime. A valid
194
+ request may combine fresh bootstrap/session state, a newly generated per-call
195
+ value, and a stable recorded protocol literal. Group only the fields whose
196
+ evidence indicates the same lifetime, and keep plausible mixed-lifecycle
197
+ combinations available for verification. Treat one failed generator shape as
198
+ one failed hypothesis, not as proof that all supported fresh-value shapes fail.
199
+ Keep the closest recorded construction as a diagnostic comparison. Failure of
200
+ an omit-everything construction does not prove that every omitted field is
201
+ required, and failure after adding several recorded values does not identify
202
+ which one mattered.
203
+
204
+ The representative request is a starting point, not the whole evidence set.
205
+ Before claiming that an opaque transport value has no usable lifecycle, direct
206
+ the compiler to search the entire combined recording for the same method and
207
+ path and inspect calls spread across sessions. For a one-off endpoint, compare
208
+ nearby calls in the same request family. A field with no observed producer may
209
+ still be a stable literal; opacity and entropy do not make it session-bound.
210
+
211
+ Know the API artifact's actual vocabulary before proposing a plan. It can issue
212
+ ordered recorded requests; substitute parameters, credentials, captured state,
213
+ earlier responses, and the supported generated values; and use a TypeScript
214
+ transform to construct URLs, bodies, and headers from parameters and prior
215
+ responses. A plan may declare a request with `mode: "navigate"` for a
216
+ top-level GET or form-encoded POST plus bounded CSS click actions, then declare
217
+ a later API request if needed. When research proves that the parameterized page
218
+ itself renders the core operation data, that navigation may be the load-bearing
219
+ request and its returned HTML may feed the parser. This is a CDP workflow route,
220
+ not a DOM playbook. Prefer direct API replay, and preserve navigation only when
221
+ the research handoff contains a successful rendered response with core data.
222
+ The artifact does not copy an arbitrary XHR generated by page JavaScript
223
+ automatically. However, an agent may explicitly set
224
+ `navigation.networkResponse:{urlIncludes,recordingResponseRequestSeq,method?,resourceType?,occurrence?}` to
225
+ return one mechanically matched completed response body as the navigation
226
+ request's raw result. That body can feed the parser or a later declared request.
227
+ `occurrence` counts matching requests by request-start order within this
228
+ navigation. The runtime does not infer the matcher or semantic meaning. Use this only after
229
+ cheaper direct API constructions cannot reproduce page-owned transport.
230
+ If the selected response alone completes the request, omit `waitUntil`; retain
231
+ other waits only when the researched workflow needs them after navigation.
232
+ Navigation readiness is ordered: `navigation.urlIncludes`, `navigation.selector`,
233
+ and `navigation.cookie` are checked **before** `navigation.actions`. They must
234
+ be satisfied by the initial navigation, not by a later click. Use
235
+ `navigation.resultSelector` to wait for rendered results **after** the actions.
236
+ `navigation.networkResponse.urlIncludes` matches the captured response URL;
237
+ it is separate from the page URL readiness condition. A pre-action readiness
238
+ failure means no declared click has run; fix that condition before changing selectors.
239
+
240
+ Navigation is not an implicit pre-step: declare it as the load-bearing workflow
241
+ request when its rendered or captured response is the evidence-backed result.
242
+
243
+ For a `navigation.networkResponse` request, keep both origins in that one
244
+ request-provenance entry: `recordingRequestSeq` is the document navigation
245
+ actually sent, while `recordingResponseRequestSeq` is the background request
246
+ whose response the workflow returns. Replay provenance lists the navigation
247
+ sequence followed by the distinct response sequence. Do not substitute one for
248
+ the other.
249
+
250
+ `recordedCall.requestSeqs` is different: it lists only the bodies returned to
251
+ the parser, one per executed artifact request. For a captured API response,
252
+ include its response sequence and exclude the navigation document. A two-request
253
+ artifact has at most two raw response entries even when its provenance cites
254
+ four recording rows. Several frames in one response body remain one entry.
255
+
256
+ The document reference grounds the page, not every literal future URL. A
257
+ parameterized destination may be derived from recorded Referers, navigation
258
+ events, links, or request data and proved live without an exact Document row.
259
+
260
+ `requestProvenance` maps only `workflow.requests`. A document load used solely
261
+ to establish cookies or capture HTML/storage state belongs in top-level
262
+ `workflow.bootstrap`; it does not receive an `artifactRequestIndex`. Name its
263
+ recording sequence, URL, captures, and every later `${state.*}` consumer in
264
+ compile guidance. Do not inflate the API request graph merely to represent a
265
+ bootstrap that the artifact already models separately.
266
+
267
+ The focused evidence is intentionally split across several small entries. It
268
+ contains a compact request summary for every owned and dependency sequence,
269
+ then distributes detailed evidence across representative requests and needed
270
+ dependencies within one mechanical prompt budget. Read every supplied entry
271
+ and the final `prompt_evidence_omissions` counts. Missing detail means only that
272
+ the budget omitted it; do not infer a value or strategy from an omission.
273
+ `focused_request_structure` entries carry chunked exact redacted scalar values
274
+ and pointers for query, headers, JSON, forms, decimal-framed JSON, and
275
+ successfully decoded nested JSON strings. `focused_request_preview` preserves
276
+ bounded request and response previews for those same representative/dependency
277
+ requests. Read their explicit decode and truncation status; an omitted oversized
278
+ scalar is not an observed empty value. A
279
+ `request_variation_and_response_correlation` fact names the accepted consumer
280
+ request sequence and exact request location, whether that location was the same
281
+ or different in an independently executed recording, the mechanical alignment
282
+ confidence, and any exact match in a prior response sequence/path. These are
283
+ observations, not explanations. A prior-response match is correlation rather
284
+ than proof of origin or causality. No match—and an unavailable independent
285
+ execution—says nothing about whether an API is compatible and is never evidence
286
+ for choosing browser fallback. An `ambiguous_repeated_occurrence` alignment
287
+ means its values and correlations were not observed; do not guess which repeated
288
+ request matched. Likewise, event/request associations are only temporal; use
289
+ narration and the focused request facts to decide what they mean.
290
+
291
+ The only evidence references authorized for your output are listed in
292
+ `validationContext.authorizedEvidenceRefs` and are identical to
293
+ `input.tool.evidenceRefs`. Copy that list exactly into `tool.evidenceRefs` and
294
+ into every `verificationCases[].provenance.evidenceRefs`. Do not copy the
295
+ individual `input.evidence.payload.entries[].ref` values into the output; those
296
+ identify pieces inside the one authorized focused bundle, not separately
297
+ authorized verification evidence.
298
+
299
+ The live verification case must demonstrate the tool's core operation, not
300
+ merely produce a technically successful response. When the recorded operation
301
+ returned core records, options, matches, prices, availability, or other items,
302
+ choose representative live parameters and require at least one credible core
303
+ item. Do not weaken that proof with phrases such as “or an empty result.” Empty
304
+ output can be a legitimate production outcome, but it does not prove a new
305
+ retrieval MVP works. The exception is an operation whose intended purpose is
306
+ itself to establish absence or emptiness; a retrieval call that happens to find
307
+ nothing is not such an operation.
308
+
309
+ Every API rung has higher priority than `playbook_fallback`. Suggest the
310
+ fallback only when the evidence makes you certain no API rung is compatible,
311
+ not because browser automation looks easier. These are the only two strategy
312
+ kinds; do not invent backend, browser, auth, or request taxonomies.
313
+ Compatibility is limited to what this recording can ground and the required
314
+ checks can verify. Inspect all supplied request evidence first. If no recorded
315
+ request can truthfully implement the operation, say exactly what you reviewed
316
+ and why an API workflow cannot be constructed; you need not speculate about
317
+ undocumented APIs outside the recording.
318
+
319
+ API infeasibility and playbook feasibility are two separate proofs. A blocked
320
+ API-research handoff proves neither a working browser sequence nor a browser
321
+ result. Suggest `playbook_fallback` only when separate browser evidence shows
322
+ the complete parameter-controlled interaction reaching a credible core result.
323
+ Placeholders, loading state, a route form, or missing results are evidence that
324
+ the fallback is unproven; do not invent steps or extraction instructions for
325
+ them. Explain that the operation remains unresolved so the master can omit it
326
+ while shipping the proven tools.
327
+
328
+ Treat a browser playbook as a final escape hatch. The usual legitimate case is
329
+ bot protection that requires live page state the supported API artifact cannot
330
+ capture, reproduce, or preserve. A rotating-looking field, one empty live
331
+ result, one failed render comparison, or a compiler's unsupported conclusion
332
+ does not prove that. When request construction is uncertain, propose a small
333
+ prioritized set of meaningfully different API combinations for the retained
334
+ compiler to try: include the closest recorded construction and the strongest
335
+ fresh-state construction, and state what each combination is meant to test.
336
+ Do not demand an exhaustive Cartesian search, but do not recommend playbook
337
+ while a plausible grounded combination remains untried.
338
+
339
+ Discovery parameter guesses may have a missing type or description. They are a
340
+ starting suggestion, not a checklist: accept, rename, add, or remove them from
341
+ your proposed `tool.candidate.likelyParams` when the focused evidence supports
342
+ that change. Your proposed public parameters may not have a missing type or
343
+ description: give every parameter one concrete scalar type (`string`, `number`,
344
+ or `boolean`) and a useful nonempty description. The parameter list you return
345
+ becomes the blocking contract for the first usable MVP, not an inventory of
346
+ every control the final tool might someday offer. Propose the smallest honest
347
+ parameter set needed for one representative successful core invocation and
348
+ every required incoming producer binding.
349
+ Omit optional input breadth within the assigned purpose from this first
350
+ contract; the parameter-finesse agent reviews that breadth after publication.
351
+ If the assigned boundary mixes distinct user purposes, propose the correction
352
+ to the master rather than silently implementing only one. Never omit an input required to perform the core operation, and
353
+ never erase a distinct user-facing operation merely to make its implementation
354
+ smaller.
355
+ Internal request-construction hypotheses for the same core operation remain
356
+ part of the bounded API repair set above.
357
+ Return one parameter mapping for every proposed public parameter. A mapping
358
+ lists the artifact requests it affects plus concise construction guidance.
359
+ Response dependencies identify an earlier producer request, a later consumer
360
+ request, the response path, and its consumer target. Result sources say which
361
+ artifact response (or, for a playbook, `null`) supplies results, followed by
362
+ concise output guidance. These are declared facts and instructions for the
363
+ compiler, not semantic classifications.
364
+
365
+ Preserve the exact response-produced selection context a consumer request
366
+ needs. A readable name or label is not a substitute for an opaque identifier,
367
+ token, or composite selection object merely because both describe the same
368
+ thing. When the evidence supports a producer-consumer flow, expose the required
369
+ scalar field or keep the producing request inside the consumer workflow and map
370
+ its exact response path. When the evidence does not establish which field is
371
+ required, state that gap and ask the master for a revised evidence plan instead
372
+ of choosing the friendliest-looking value.
373
+
374
+ Also explain how a caller obtains every required public input without access
375
+ to the private recording or research transcript. Prefer ordinary caller input
376
+ with evidence-backed internal resolution, an available producer tool, or a
377
+ documented caller prerequisite genuinely supported by the intended use case.
378
+ A successful call using a hidden recorded identifier proves the API, not that
379
+ the public tool is usable. An example identifier alone is not a lookup path.
380
+ If that path is missing, ask the master for focused research rather than
381
+ inventing an identifier or relabeling an opaque ID as a human-readable name.
382
+
383
+ Author the live invocation cases that should verify this exact plan. Each case
384
+ states where its parameter values came from, states the expected result in
385
+ plain language, and cites only the focused tool's exact evidence refs and known
386
+ recording request/event sequences.
387
+
388
+ Every new API plan must pair each selected `replay` case with a `live` case.
389
+ Both declare `recordedCall` with the same exact ordered response sequences.
390
+ The host validates this pairing before compilation, runs the parser against
391
+ the recorded and live responses, and requires independent evidence review.
392
+ The sole exception is an explicitly live-only case when its recorded response
393
+ body was not captured: declare `recordingFixtureUnavailable:true` on that live
394
+ case, cite the exact recorded request, and let the host review the retained
395
+ live raw response without claiming replay verification.
396
+ Use exact recorded public values for replay; never invent them. Keep the live
397
+ inputs comparable and describe necessary freshness changes. Exact request
398
+ equality can expose a construction bug, but differences may be legitimate
399
+ because of current dates, rotating state, authentication, nonces, or signatures.
400
+
401
+ For live verification, the existing wire label `parameterValueOrigin:"synthetic_live"`
402
+ means executable current inputs, not permission to invent challenge cases.
403
+ Supply one scalar value of the declared type for every public parameter,
404
+ preserving the selected recording's inputs except necessary freshness changes.
405
+ Live cases cite the particular recorded requests or events that support their
406
+ inputs and expectation. Never reproduce a credential, cookie, token, or other
407
+ secret; dependent inputs come from fresh producer calls. These cases are the
408
+ compiler/verifier's declared core inputs—the runtime must not invent additional
409
+ semantic cases or force deferred breadth into the MVP.
410
+ When a live case changes a date, route, locale, or other value that appears in
411
+ more than one place, explicitly tell the compiler to derive every coupled
412
+ representation from that same live input. This includes request bodies, URLs,
413
+ bootstrap or navigation URLs, `Referer`/`Origin` headers, and captured state.
414
+ A recorded URL or header containing the old value is useful replay evidence;
415
+ it is not a valid constant for a live case with a different value. Call out
416
+ these coupled locations in `parameterMappings` or construction guidance so the
417
+ compiler does not produce an internally contradictory request.
418
+ Every plan needs at least one live case. A playbook plan must not declare
419
+ replay because recording comparison is not applicable to it.
420
+
421
+ Incoming chain edges may refer to `availableProducers` or this tool's own prior
422
+ result, must target this tool's public name, and must name a proposed public
423
+ consumer parameter. Group bindings for one call by `consumerInvocationId`; omit
424
+ it for the original single call. Repeated calls use distinct IDs. An optional
425
+ `producerChainEdgeId` names an edge of the earlier producer call whose output
426
+ is required; without it the source is the standalone live result. Preserve
427
+ those explicit references and leave the complete acyclic schedule to the master.
428
+ If that default result cannot be compared with this tool's recorded call, set
429
+ `producerLiveCaseId` to the producer's specific live verification case and
430
+ `consumerLiveCaseId` to this tool's matching live case. Select these from the
431
+ recording-backed cases when the producer case ID is available in the supplied
432
+ plan or master guidance; otherwise name the needed comparison in `reason` for
433
+ the master to select after the producer's focused proposal arrives. The host
434
+ will execute the chosen producer case freshly.
435
+ Do not set both `producerChainEdgeId` and `producerLiveCaseId`, and use the
436
+ same consumer case on every edge of one invocation. Revise a rejected case
437
+ selection instead of changing the parser to fit unrelated inputs.
438
+ Every tool listed in `dependsOnTools` must supply at least one executable
439
+ incoming edge before this implementation plan is accepted. If a sibling only
440
+ informed research or build order and supplies no runtime value, remove that
441
+ dependency instead. A token copied from a research test into a live case is
442
+ not a producer binding; revise the producer result or consumer input contract
443
+ to expose the required scalar, then test the fresh chain.
444
+ Do not add this tool to its own `dependsOnTools` or split its public boundary
445
+ merely to call it again. Tool IDs in this wire format must exactly equal the
446
+ corresponding public `candidate.toolName`; invocation IDs and edge IDs identify
447
+ calls and bindings separately. Return no implementation-plan ref.
448
+
449
+ `outgoingChainEdges` are current consumer obligations on this tool's result.
450
+ Account for each named `producerResultPath` when proposing the result shape.
451
+ These are executable paths into returned data, not schema descriptions:
452
+ `items[1].id` selects the second item and `$.items[1]["item-id"]` supports a
453
+ quoted property. Use concrete zero-based indices, not `[]`, `[*]`, filters, or
454
+ projections. Choose a compatible record from the live evidence; related values
455
+ must refer to that same record. Bind a scalar matching the consumer parameter
456
+ type; objects and arrays are not automatically serialized. If the consumer
457
+ needs an encoded string, plan an explicit producer output for it. A path-only
458
+ repair changes the edge, not an otherwise working tool implementation.
459
+ They are context only: return this tool's proposed incoming edges in
460
+ `chainEdges`; the master decides whether an outgoing consumer edge should be
461
+ revised separately.
462
+
463
+ For every proposed outgoing value, confirm that one declared `resultSource`
464
+ actually exposes the value in the artifact's returned response surface. A
465
+ navigation result that returns rendered text cannot supply a hidden DOM
466
+ attribute, link URL, or background network field merely because the live page
467
+ used it. When the chosen response surface does not contain a promised value,
468
+ revise the request graph or public representation, or report the plan gap. Do
469
+ not send the compiler an instruction to extract data it cannot receive.
470
+
471
+ Design every chained public value backward from the consumer's exact recorded
472
+ request position and construction options. Decide whether the consumer needs a
473
+ server-produced opaque scalar or a stable structured selection that it can
474
+ encode itself. Prefer the stable structured form when the consumer can rebuild
475
+ its transport deterministically. Never label a value opaque merely because a
476
+ nearby wire field is long or encoded, and never pair two candidate strings by
477
+ proximity alone. The plan must explain how all sibling values come from the
478
+ same producer record and match the consumer's required representation.
479
+
480
+ For a serialized selection, spell out the source and wire representation of
481
+ each constituent field. Keep machine identifiers distinct from display labels
482
+ (for example, a catalog code and its product name); a shared field name or
483
+ string type does not establish interchangeability. Plan the consumer check
484
+ using the producer's unchanged returned selection, rather than a more
485
+ convenient test value rebuilt by hand. Compare the consumer's accepted structure
486
+ with the observed producer records: one selected record can contain several
487
+ members. Prefer an available such record for the representative chain when the
488
+ public contract does not explicitly exclude it. A singular operation name or
489
+ one-member fixture does not establish that exclusion. Align any narrower scope
490
+ explicitly across the connected tools instead of choosing an easier singleton.
491
+
492
+ All incoming edges for this consumer form one explicit consumer invocation.
493
+ Use at most one producer binding for each consumer parameter. If the evidence
494
+ offers alternative bindings, choose the best supported one; do not return
495
+ alternatives and do not ask the runtime to group or rank them.
496
+
497
+ Exact output schema (all objects reject extra fields):
498
+
499
+ ```text
500
+ {
501
+ binding: {
502
+ runId, site, recordingSha256, toolId
503
+ },
504
+ tool: {
505
+ id, candidate, compileContext, evidenceRefs,
506
+ strategy: {kind:"api"|"playbook_fallback", reason:string}
507
+ },
508
+ chainEdges: Array<{
509
+ id, producerToolId, producerResultPath, consumerToolId, consumerParameter
510
+ }>,
511
+ implementationPlan: {
512
+ version: 1, toolId, strategyKind:"api"|"playbook_fallback",
513
+ requestProvenance: Array<{
514
+ artifactRequestIndex, recordingRequestSeq,
515
+ recordingResponseRequestSeq?:integer
516
+ }>,
517
+ parameterMappings: Array<{
518
+ parameterName, artifactRequestIndices:integer[], guidance:string
519
+ }>,
520
+ responseDependencies: Array<{
521
+ producerArtifactRequestIndex, consumerArtifactRequestIndex,
522
+ responsePath, consumerTarget, guidance
523
+ }>,
524
+ resultSources: Array<{artifactRequestIndex:integer|null, source:string}>,
525
+ outputGuidance: string,
526
+ verificationCases: Array<{
527
+ id: string, check:"replay"|"live",
528
+ parameterValueOrigin:"recorded_baseline"|"synthetic_live"|"unavailable",
529
+ parameterValues:Array<{parameterName,value:string|number|boolean}>,
530
+ sourceCaseBindings?:Array<{
531
+ producerCaseId:string, producerResultPath:string, consumerParameter:string
532
+ }>,
533
+ expectedResult:string,
534
+ recordedCall:{requestSeqs:integer[],freshnessChanges:string},
535
+ recordingFixtureUnavailable?:true,
536
+ provenance:{
537
+ recordingRequestSeqs:integer[], recordingEventSeqs:integer[],
538
+ evidenceRefs:content-addressed refs[]
539
+ }
540
+ }>
541
+ },
542
+ reason: string
543
+ }
544
+ ```
545
+
546
+ <!-- BEGIN IMPRINT CANONICAL OUTPUT EXAMPLE -->
547
+
548
+ {
549
+ "binding": {
550
+ "runId": "run-fixture-1",
551
+ "site": "fixture.invalid",
552
+ "recordingSha256": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
553
+ "toolId": "search_catalog"
554
+ },
555
+ "tool": {
556
+ "id": "search_catalog",
557
+ "candidate": {
558
+ "toolName": "search_catalog",
559
+ "description": "Search a fixture catalog",
560
+ "rationale": "Requests 12 and 18 record the same catalog operation with distinct search texts.",
561
+ "confidence": 0.96,
562
+ "requestSeqs": [
563
+ 12,
564
+ 18
565
+ ],
566
+ "representativeSeqs": [
567
+ 12,
568
+ 18
569
+ ],
570
+ "eventSeqs": [
571
+ 4
572
+ ],
573
+ "expectedOutput": "Catalog matches with identifiers",
574
+ "likelyParams": [
575
+ {
576
+ "name": "query",
577
+ "type": "string",
578
+ "description": "Catalog search text"
579
+ }
580
+ ],
581
+ "dependencySeqs": [],
582
+ "dependsOnTools": []
583
+ },
584
+ "compileContext": {
585
+ "loginRequestSeqs": [],
586
+ "credentialNames": [],
587
+ "tokenExtractionNotes": "",
588
+ "sharedHelperNotes": "",
589
+ "authRequestSeqs": [],
590
+ "authNotes": ""
591
+ },
592
+ "evidenceRefs": [
593
+ {
594
+ "path": "runs/run-fixture-1/evidence/recording.json",
595
+ "sha256": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
596
+ }
597
+ ],
598
+ "strategy": {
599
+ "kind": "api",
600
+ "reason": "The focused evidence contains a replayable request."
601
+ }
602
+ },
603
+ "chainEdges": [],
604
+ "implementationPlan": {
605
+ "version": 1,
606
+ "toolId": "search_catalog",
607
+ "strategyKind": "api",
608
+ "requestProvenance": [
609
+ {
610
+ "artifactRequestIndex": 0,
611
+ "recordingRequestSeq": 12
612
+ }
613
+ ],
614
+ "parameterMappings": [
615
+ {
616
+ "parameterName": "query",
617
+ "artifactRequestIndices": [
618
+ 0
619
+ ],
620
+ "guidance": "Interpolate the public query at the recorded request location."
621
+ }
622
+ ],
623
+ "responseDependencies": [],
624
+ "resultSources": [
625
+ {
626
+ "artifactRequestIndex": 0,
627
+ "source": "Return normalized catalog entries from the recorded response body."
628
+ }
629
+ ],
630
+ "outputGuidance": "Return a stable array of catalog entries and their identifiers.",
631
+ "verificationCases": [
632
+ {
633
+ "id": "replay_search_catalog",
634
+ "check": "replay",
635
+ "parameterValueOrigin": "recorded_baseline",
636
+ "parameterValues": [
637
+ {
638
+ "parameterName": "query",
639
+ "value": "fixture query"
640
+ }
641
+ ],
642
+ "expectedResult": "Return the recorded catalog entries matching the recorded search text.",
643
+ "provenance": {
644
+ "recordingRequestSeqs": [
645
+ 12
646
+ ],
647
+ "recordingEventSeqs": [
648
+ 4
649
+ ],
650
+ "evidenceRefs": [
651
+ {
652
+ "path": "runs/run-fixture-1/evidence/recording.json",
653
+ "sha256": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
654
+ }
655
+ ]
656
+ },
657
+ "recordedCall": {
658
+ "requestSeqs": [
659
+ 12
660
+ ],
661
+ "freshnessChanges": "none"
662
+ }
663
+ },
664
+ {
665
+ "id": "live_search_catalog",
666
+ "check": "live",
667
+ "parameterValueOrigin": "synthetic_live",
668
+ "parameterValues": [
669
+ {
670
+ "parameterName": "query",
671
+ "value": "fixture query"
672
+ }
673
+ ],
674
+ "expectedResult": "Return current catalog entries matching the supplied search text.",
675
+ "provenance": {
676
+ "recordingRequestSeqs": [
677
+ 12
678
+ ],
679
+ "recordingEventSeqs": [
680
+ 4
681
+ ],
682
+ "evidenceRefs": [
683
+ {
684
+ "path": "runs/run-fixture-1/evidence/recording.json",
685
+ "sha256": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
686
+ }
687
+ ]
688
+ },
689
+ "recordedCall": {
690
+ "requestSeqs": [
691
+ 12
692
+ ],
693
+ "freshnessChanges": "none; the recorded query remains usable"
694
+ }
695
+ },
696
+ {
697
+ "id": "replay_search_catalog__alternate_recorded_query",
698
+ "check": "replay",
699
+ "parameterValueOrigin": "recorded_baseline",
700
+ "parameterValues": [
701
+ {
702
+ "parameterName": "query",
703
+ "value": "alternate recorded query"
704
+ }
705
+ ],
706
+ "expectedResult": "Return the recorded catalog entries matching the recorded search text.",
707
+ "provenance": {
708
+ "recordingRequestSeqs": [
709
+ 18
710
+ ],
711
+ "recordingEventSeqs": [
712
+ 4
713
+ ],
714
+ "evidenceRefs": [
715
+ {
716
+ "path": "runs/run-fixture-1/evidence/recording.json",
717
+ "sha256": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
718
+ }
719
+ ]
720
+ },
721
+ "recordedCall": {
722
+ "requestSeqs": [
723
+ 18
724
+ ],
725
+ "freshnessChanges": "none"
726
+ }
727
+ },
728
+ {
729
+ "id": "live_search_catalog__alternate_recorded_query",
730
+ "check": "live",
731
+ "parameterValueOrigin": "synthetic_live",
732
+ "parameterValues": [
733
+ {
734
+ "parameterName": "query",
735
+ "value": "alternate recorded query"
736
+ }
737
+ ],
738
+ "expectedResult": "Return current catalog entries matching the supplied search text.",
739
+ "provenance": {
740
+ "recordingRequestSeqs": [
741
+ 18
742
+ ],
743
+ "recordingEventSeqs": [
744
+ 4
745
+ ],
746
+ "evidenceRefs": [
747
+ {
748
+ "path": "runs/run-fixture-1/evidence/recording.json",
749
+ "sha256": "sha256:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
750
+ }
751
+ ]
752
+ },
753
+ "recordedCall": {
754
+ "requestSeqs": [
755
+ 18
756
+ ],
757
+ "freshnessChanges": "none; the recorded query remains usable"
758
+ }
759
+ }
760
+ ]
761
+ },
762
+ "reason": "Two distinct recorded queries support the search operation and query mapping without inventing additional challenges."
763
+ }
764
+ <!-- END IMPRINT CANONICAL OUTPUT EXAMPLE -->