@introspection-ai/recipes 0.42.0 → 0.44.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 (215) hide show
  1. package/dist/agents.d.ts.map +1 -1
  2. package/dist/agents.js +11 -4
  3. package/dist/agents.js.map +1 -1
  4. package/dist/api/session.d.ts +2 -1
  5. package/dist/api/session.d.ts.map +1 -1
  6. package/dist/artifact-review-tui.d.ts +33 -0
  7. package/dist/artifact-review-tui.d.ts.map +1 -0
  8. package/dist/artifact-review-tui.js +315 -0
  9. package/dist/artifact-review-tui.js.map +1 -0
  10. package/dist/artifact-review.d.ts +72 -0
  11. package/dist/artifact-review.d.ts.map +1 -0
  12. package/dist/artifact-review.js +335 -0
  13. package/dist/artifact-review.js.map +1 -0
  14. package/dist/artifact-viewer-tui.d.ts +10 -8
  15. package/dist/artifact-viewer-tui.d.ts.map +1 -1
  16. package/dist/artifact-viewer-tui.js +24 -15
  17. package/dist/artifact-viewer-tui.js.map +1 -1
  18. package/dist/artifact-viewer.d.ts +5 -68
  19. package/dist/artifact-viewer.d.ts.map +1 -1
  20. package/dist/artifact-viewer.js +98 -63
  21. package/dist/artifact-viewer.js.map +1 -1
  22. package/dist/ask-user-question.d.ts +0 -32
  23. package/dist/ask-user-question.d.ts.map +1 -1
  24. package/dist/ask-user-question.js +9 -5
  25. package/dist/ask-user-question.js.map +1 -1
  26. package/dist/channels/index.d.ts +1 -1
  27. package/dist/channels/index.d.ts.map +1 -1
  28. package/dist/channels/index.js +1 -1
  29. package/dist/channels/index.js.map +1 -1
  30. package/dist/channels/module.d.ts.map +1 -1
  31. package/dist/channels/module.js +15 -5
  32. package/dist/channels/module.js.map +1 -1
  33. package/dist/channels/refs.d.ts.map +1 -1
  34. package/dist/channels/refs.js +10 -2
  35. package/dist/channels/refs.js.map +1 -1
  36. package/dist/channels/tools.d.ts.map +1 -1
  37. package/dist/channels/tools.js +80 -36
  38. package/dist/channels/tools.js.map +1 -1
  39. package/dist/child/agent-completions.d.ts.map +1 -1
  40. package/dist/child/agent-completions.js +3 -1
  41. package/dist/child/agent-completions.js.map +1 -1
  42. package/dist/child/agent-store.d.ts +3 -2
  43. package/dist/child/agent-store.d.ts.map +1 -1
  44. package/dist/child/agent-store.js.map +1 -1
  45. package/dist/child/agent.d.ts.map +1 -1
  46. package/dist/child/agent.js +1 -3
  47. package/dist/child/agent.js.map +1 -1
  48. package/dist/child/session.d.ts +2 -2
  49. package/dist/child/session.d.ts.map +1 -1
  50. package/dist/child/session.js +1 -3
  51. package/dist/child/session.js.map +1 -1
  52. package/dist/connector-tools.d.ts +5 -4
  53. package/dist/connector-tools.d.ts.map +1 -1
  54. package/dist/connector-tools.js +19 -9
  55. package/dist/connector-tools.js.map +1 -1
  56. package/dist/documents/index.d.ts +3 -3
  57. package/dist/documents/index.d.ts.map +1 -1
  58. package/dist/documents/index.js +1 -1
  59. package/dist/documents/index.js.map +1 -1
  60. package/dist/documents/module.d.ts +0 -2
  61. package/dist/documents/module.d.ts.map +1 -1
  62. package/dist/documents/module.js +30 -11
  63. package/dist/documents/module.js.map +1 -1
  64. package/dist/documents/profile.d.ts.map +1 -1
  65. package/dist/documents/profile.js +10 -4
  66. package/dist/documents/profile.js.map +1 -1
  67. package/dist/documents/python.d.ts.map +1 -1
  68. package/dist/documents/python.js +12 -3
  69. package/dist/documents/python.js.map +1 -1
  70. package/dist/documents/tools.d.ts.map +1 -1
  71. package/dist/documents/tools.js +105 -29
  72. package/dist/documents/tools.js.map +1 -1
  73. package/dist/documents/types.d.ts.map +1 -1
  74. package/dist/extensions.d.ts.map +1 -1
  75. package/dist/extensions.js +6 -2
  76. package/dist/extensions.js.map +1 -1
  77. package/dist/genai-spans-file.d.ts +1 -14
  78. package/dist/genai-spans-file.d.ts.map +1 -1
  79. package/dist/genai-spans-file.js +5 -3
  80. package/dist/genai-spans-file.js.map +1 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +1 -1
  84. package/dist/index.js.map +1 -1
  85. package/dist/inspect.d.ts.map +1 -1
  86. package/dist/inspect.js +2 -3
  87. package/dist/inspect.js.map +1 -1
  88. package/dist/interaction-tui.d.ts +25 -0
  89. package/dist/interaction-tui.d.ts.map +1 -1
  90. package/dist/interaction-tui.js +45 -6
  91. package/dist/interaction-tui.js.map +1 -1
  92. package/dist/interactions.d.ts.map +1 -1
  93. package/dist/interactions.js +1 -3
  94. package/dist/interactions.js.map +1 -1
  95. package/dist/mcp/catalog.d.ts.map +1 -1
  96. package/dist/mcp/catalog.js.map +1 -1
  97. package/dist/mcp/cli/command-context.d.ts.map +1 -1
  98. package/dist/mcp/cli/command-context.js.map +1 -1
  99. package/dist/mcp/cli/core.d.ts +0 -41
  100. package/dist/mcp/cli/core.d.ts.map +1 -1
  101. package/dist/mcp/cli/core.js +79 -37
  102. package/dist/mcp/cli/core.js.map +1 -1
  103. package/dist/mcp/cli/help.js +3 -3
  104. package/dist/mcp/cli/help.js.map +1 -1
  105. package/dist/mcp/cli/index.js.map +1 -1
  106. package/dist/mcp/cli/policy.d.ts +2 -1
  107. package/dist/mcp/cli/policy.d.ts.map +1 -1
  108. package/dist/mcp/cli/policy.js +19 -11
  109. package/dist/mcp/cli/policy.js.map +1 -1
  110. package/dist/mcp/client-entry.js.map +1 -1
  111. package/dist/mcp/contract.d.ts.map +1 -1
  112. package/dist/mcp/contract.js +8 -3
  113. package/dist/mcp/contract.js.map +1 -1
  114. package/dist/mcp/daemon/client.d.ts +4 -0
  115. package/dist/mcp/daemon/client.d.ts.map +1 -1
  116. package/dist/mcp/daemon/client.js +4 -0
  117. package/dist/mcp/daemon/client.js.map +1 -1
  118. package/dist/mcp/daemon/index.js +9 -4
  119. package/dist/mcp/daemon/index.js.map +1 -1
  120. package/dist/mcp/daemon/protocol.d.ts +7 -6
  121. package/dist/mcp/daemon/protocol.d.ts.map +1 -1
  122. package/dist/mcp/index.d.ts +2 -6
  123. package/dist/mcp/index.d.ts.map +1 -1
  124. package/dist/mcp/index.js +36 -20
  125. package/dist/mcp/index.js.map +1 -1
  126. package/dist/mcp/tools.d.ts +1 -14
  127. package/dist/mcp/tools.d.ts.map +1 -1
  128. package/dist/mcp/tools.js +9 -4
  129. package/dist/mcp/tools.js.map +1 -1
  130. package/dist/mcp-chunks/{chunk-EZKOZO3F.js → chunk-GODH4VLN.js} +179 -70
  131. package/dist/mcp-daemon.js +29 -19
  132. package/dist/mcp-run-worker.js +1 -1
  133. package/dist/memory.d.ts.map +1 -1
  134. package/dist/memory.js +1 -1
  135. package/dist/memory.js.map +1 -1
  136. package/dist/model-binding.d.ts +4 -5
  137. package/dist/model-binding.d.ts.map +1 -1
  138. package/dist/model-binding.js +5 -5
  139. package/dist/model-binding.js.map +1 -1
  140. package/dist/pi-extension.d.ts.map +1 -1
  141. package/dist/pi-extension.js +73 -34
  142. package/dist/pi-extension.js.map +1 -1
  143. package/dist/python.d.ts.map +1 -1
  144. package/dist/python.js +5 -1
  145. package/dist/python.js.map +1 -1
  146. package/dist/recipe/agent.d.ts +9 -6
  147. package/dist/recipe/agent.d.ts.map +1 -1
  148. package/dist/recipe/agent.js +23 -28
  149. package/dist/recipe/agent.js.map +1 -1
  150. package/dist/recipe/companions.d.ts +0 -15
  151. package/dist/recipe/companions.d.ts.map +1 -1
  152. package/dist/recipe/companions.js +29 -11
  153. package/dist/recipe/companions.js.map +1 -1
  154. package/dist/recipe/extensions.d.ts.map +1 -1
  155. package/dist/recipe/extensions.js +23 -6
  156. package/dist/recipe/extensions.js.map +1 -1
  157. package/dist/recipe/mcp-config.d.ts +0 -12
  158. package/dist/recipe/mcp-config.d.ts.map +1 -1
  159. package/dist/recipe/mcp-config.js +1 -70
  160. package/dist/recipe/mcp-config.js.map +1 -1
  161. package/dist/recipe/model.d.ts +8 -7
  162. package/dist/recipe/model.d.ts.map +1 -1
  163. package/dist/recipe/model.js +2 -6
  164. package/dist/recipe/model.js.map +1 -1
  165. package/dist/recipe/package.d.ts +3 -16
  166. package/dist/recipe/package.d.ts.map +1 -1
  167. package/dist/recipe/package.js +105 -40
  168. package/dist/recipe/package.js.map +1 -1
  169. package/dist/recipe/python.d.ts +0 -8
  170. package/dist/recipe/python.d.ts.map +1 -1
  171. package/dist/recipe/python.js +40 -13
  172. package/dist/recipe/python.js.map +1 -1
  173. package/dist/recipe/resolve.d.ts.map +1 -1
  174. package/dist/recipe/resolve.js +4 -9
  175. package/dist/recipe/resolve.js.map +1 -1
  176. package/dist/recipe/session.d.ts +3 -2
  177. package/dist/recipe/session.d.ts.map +1 -1
  178. package/dist/recipe/session.js +4 -3
  179. package/dist/recipe/session.js.map +1 -1
  180. package/dist/recipe/skills-prompt.d.ts.map +1 -1
  181. package/dist/recipe/skills-prompt.js +6 -1
  182. package/dist/recipe/skills-prompt.js.map +1 -1
  183. package/dist/recipe/skills.d.ts +1 -6
  184. package/dist/recipe/skills.d.ts.map +1 -1
  185. package/dist/recipe/skills.js +9 -6
  186. package/dist/recipe/skills.js.map +1 -1
  187. package/dist/recipe/suggestions.d.ts.map +1 -1
  188. package/dist/recipe/suggestions.js +21 -8
  189. package/dist/recipe/suggestions.js.map +1 -1
  190. package/dist/recipe-session-entry.d.ts +18 -0
  191. package/dist/recipe-session-entry.d.ts.map +1 -0
  192. package/dist/recipe-session-entry.js +27 -0
  193. package/dist/recipe-session-entry.js.map +1 -0
  194. package/dist/run-controller.d.ts +0 -2
  195. package/dist/run-controller.d.ts.map +1 -1
  196. package/dist/run-controller.js +4 -2
  197. package/dist/run-controller.js.map +1 -1
  198. package/dist/session.d.ts +10 -4
  199. package/dist/session.d.ts.map +1 -1
  200. package/dist/session.js +32 -28
  201. package/dist/session.js.map +1 -1
  202. package/dist/skill-progress.d.ts +117 -0
  203. package/dist/skill-progress.d.ts.map +1 -0
  204. package/dist/skill-progress.js +369 -0
  205. package/dist/skill-progress.js.map +1 -0
  206. package/dist/suggestion-picker.d.ts +0 -3
  207. package/dist/suggestion-picker.d.ts.map +1 -1
  208. package/dist/suggestion-picker.js +4 -2
  209. package/dist/suggestion-picker.js.map +1 -1
  210. package/dist/test-utils.d.ts.map +1 -1
  211. package/dist/test-utils.js.map +1 -1
  212. package/docs/agent-composition.md +1 -0
  213. package/docs/pi-extension.md +125 -12
  214. package/docs/recipe-format.md +122 -16
  215. package/package.json +18 -6
@@ -49,6 +49,49 @@ reads them as its defaults, but an agent name only counts for the Recipe it
49
49
  came with: `pi --recipe <another Recipe>` run from a Recipe session's shell
50
50
  selects that Recipe's default agent, not the parent's.
51
51
 
52
+ ## Where the agent is
53
+
54
+ A Recipe agent's step shows in Pi's footer, with how long the agent has worked:
55
+
56
+ ```text
57
+ ⧈ Introspection build ✓ brainstorm ▸ draft ○ review · 12:04
58
+ ```
59
+
60
+ Nothing need be declared for it. The step is the agent's skill it last read, among the skills of the phase it lists first (`build-*` for an agent listing `build-brainstorm` first; others it consults, such as `eval-case`, don't move it): a skill named `<phase>-<step>` shows its phase's steps in the order the agent lists them, done ticked, the current one marked and the rest to come; any other skill shows by its name. The clock is the agent's working time from the start of the session, across every step, redrawn every second. It pauses while the person is in the loop, when the agent's turn has ended or a question or review is open, and the current step then shows ⏸ in place of ▸. It's never an estimate of what's left. Pi's "Working" line and the terminal title are left as they are. A resumed session shows its step at once, from its earlier reads.
61
+
62
+ An agent that moves through several phases declares them in its agent file, in order:
63
+
64
+ ```yaml
65
+ skills: [build-brainstorm, build-draft, build-review, build-deploy, improve-collect, improve-classify, improve-propose, eval-run]
66
+ phases: [build, improve]
67
+ ```
68
+
69
+ The phase is then that of the last step skill it read, a skill named `<phase>-<step>` of a declared phase, and its steps and ticks are that phase's skills in the order listed. Reading `improve-classify` shows:
70
+
71
+ ```text
72
+ ⧈ Introspection improve ✓ collect ▸ classify ○ propose · 31:40
73
+ ```
74
+
75
+ Any other of the agent's skills is a helper: reading it never changes the phase, and it shows after the current step, its first dash as a space (`eval-run` as `eval run`, a name without a dash as it is), until the agent next reads a step:
76
+
77
+ ```text
78
+ ⧈ Introspection build ✓ brainstorm ▸ draft · eval run ○ review ○ deploy · 12:04
79
+ ```
80
+
81
+ A helper read counts the same way a step read does: a glance at its top (fewer than 100 lines, or `head`) doesn't. While the clock is paused the step shows ⏸ as before, and a resumed session restores phase, step and helper from its earlier reads. Without `phases`, the footer works as described above.
82
+
83
+ A host that draws its own line (the platform's task chat) passes `onRecipeStep` to `createAgentSession`, with or without a UI. It receives the same step as data, `{ skill, phase?, steps: [{ name, state: "done" | "current" | "todo" }], paused, worked_ms }`, whenever the step changes or the clock starts or stops, not every second; the host runs the clock on from `worked_ms` while `paused` is false. A skill outside a phase has no `steps` and shows by `skill`.
84
+
85
+ ## The Recipe a session runs
86
+
87
+ When the extension starts a Recipe session it records the Recipe in the session file, as a custom entry of type `recipe_session`:
88
+
89
+ ```json
90
+ { "type": "custom", "customType": "recipe_session", "data": { "recipe_dir": "/abs/path/interviewer", "agent": "agent", "package": "interviewer", "version": "0.1.0" } }
91
+ ```
92
+
93
+ It's written again only when the Recipe, agent or version changes, so the latest one is what the session runs now. Whoever continues the session (`introspection local`, a local task, a person) reads it to start the same Recipe and agent without being told. A session that can't record it still runs.
94
+
52
95
  ## GenAI spans
53
96
 
54
97
  Set `PI_RECIPE_GENAI_SPANS_FILE` to a path and the extension writes the
@@ -85,26 +128,27 @@ tools: [read, write, edit, ask_user_question, show_artifact]
85
128
  ```
86
129
 
87
130
  ```ts
88
- show_artifact({ path: "evals/cases/refund.md" }) // relative to the working directory
131
+ show_artifact({ path: "evals/cases/refund.md" }); // relative to the working directory
89
132
  ```
90
133
 
91
134
  The tool refuses a path outside the working directory (including a symlink
92
135
  that leads out of it), a missing file, and anything that is not `.md` or
93
136
  `.markdown`. The panel takes the top-right 45% of the terminal at full height
94
- and shows the file name and the visible line range. It opens without taking
137
+ and shows the file name and the visible line range. It draws over the
138
+ conversation, so it isn't drawn on a terminal narrower than 100 columns. It opens without taking
95
139
  the keyboard, so the user keeps typing in the editor. Showing another file
96
140
  replaces the content, and the panel re-renders when the file changes on disk.
97
141
 
98
- | Key | Where | Does |
99
- | --- | --- | --- |
100
- | `Alt+R` | editor or panel | Moves the keyboard to the panel and back; with no panel open, reopens the last file |
101
- | `Up` / `Down`, `PgUp` / `PgDn`, `Home` / `End` | panel | Scroll |
102
- | `o` | panel | Opens the file with the system's default app (`open`, `xdg-open` or `start`) |
103
- | `Esc` / `q` | panel | Closes the panel |
142
+ | Key | Where | Does |
143
+ | ---------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------- |
144
+ | `Up` / `Down`, `PgUp` / `PgDn`, `Home` / `End` | panel | Scroll |
145
+ | `o` | panel | Opens the file with the system's default app (`open`, `xdg-open` or `start`) |
146
+ | `Esc` / `q` | panel | Closes the panel |
147
+ | `PgUp` / `PgDn` | a question from `ask_user_question` | Scroll the panel without moving the keyboard to it |
104
148
 
105
149
  `/recipe view <file>` opens a file the same way; `/recipe view` on its own opens
106
150
  the last markdown file the agent showed or wrote with `write` or `edit` in this
107
- session, and `/recipe close` closes the panel from the editor. They are
151
+ session, and `Esc` closes the panel from the editor. They are
108
152
  subcommands of `/recipe`, so they never clash with another extension's or your
109
153
  own commands.
110
154
 
@@ -114,6 +158,74 @@ available in Pi's interactive terminal, ...` so the model can tell the user
114
158
  where to look. If a Recipe extension registers its own `show_artifact`, the
115
159
  host keeps it and registers neither the built-in tool nor `/recipe view`.
116
160
 
161
+ ### Reviewing several files
162
+
163
+ List `review_artifacts` and the agent can ask the user to review several
164
+ markdown files it wrote, one decision per file, as in a pull request review:
165
+ approve, with an optional comment, or request changes, saying what to change.
166
+
167
+ ```ts
168
+ review_artifacts({
169
+ title: "The interview agent's cases",
170
+ items: [
171
+ // 1 to 20, in reading order
172
+ { path: "evals/cases/C1.md", label: "C1: four questions" },
173
+ { path: "evals/cases/C2.md", label: "C2: a vague answer" },
174
+ { path: "docs/DESIGN.md", label: "The brief", section: "Part A" }, // only that part
175
+ ],
176
+ });
177
+ ```
178
+
179
+ A case's front matter shows as one line (its check, inputs and approval), and `section` shows only the part under that heading, so the review holds what is being approved.
180
+
181
+ In Pi's terminal the review is inline, in place of the editor: a tab per file
182
+ and a Submit tab across the top (a single file has none), the file itself in a
183
+ box, and the choices under it. The artifact panel isn't used; `show_artifact`
184
+ is for showing a file without asking for a decision.
185
+
186
+ | Key | Does |
187
+ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
188
+ | `Left` / `Right`, `Tab` / `Shift+Tab` | Previous or next file, then Submit |
189
+ | `Up` / `Down`, `Enter`, or a number | Pick a choice: `Approve`, `Approve with a comment` (optional), or `Request changes` and say what should change (required) |
190
+ | `j` / `k`, `Space` / `b` (also `PgUp` / `PgDn`, `Shift+Up` / `Shift+Down`) | Scroll a file longer than the box, which takes at most half the terminal |
191
+ | `Esc` | Cancel the review; nothing is approved |
192
+
193
+ After a decision the review moves to the next undecided file, and once every
194
+ file has one, to the Submit tab; nothing is sent until the user submits there
195
+ (a single file submits with its decision). The Submit tab lists the decisions and offers
196
+ `Submit` (files left undecided are `not reviewed`) or `Approve the rest and submit`.
197
+
198
+ It is an interaction ([Interactions](interactions.md)), so it works on every
199
+ host: over RPC each file is a select (`Approve`, `Request changes`, `Skip`),
200
+ then a comment (required for changes); on a pause/resume host it pauses with
201
+ `details.interrupt.metadata` `{ kind: "review_artifacts", items: [...] }` for
202
+ the host to render its own review, and resumes with `{ answer }` in the format
203
+ below; headless runs and child agents decline, so nothing is approved without a
204
+ person.
205
+
206
+ Each item carries what the reviewer is shown, so the host needs no access to
207
+ the files:
208
+
209
+ | Field | What it is |
210
+ | --- | --- |
211
+ | `path`, `label`, `section` | As given; `section` only when one was |
212
+ | `content` | The file as the terminal review shows it: front matter folded into one line, only `section` when given |
213
+ | `sha256` | Of the whole file on disk when asked (`null` when it doesn't exist), so a record of approval can say exactly which file was approved |
214
+ | `previous_content` | What this session's last review of the path showed, when the file has changed since; kept in memory only, so a restarted session sends none |
215
+ | `truncated` | `true` when `content` was cut to the interrupt's cap (256 KB of content across the review); the host lets such a file be read but not approved |
216
+
217
+ `details.files` holds `{ path, sha256 }` for every item, on every host. The model sees, after `Answer: `:
218
+
219
+ ```text
220
+ Reviewed 2 files: 1 approved, 1 with changes requested, 0 not reviewed.
221
+ evals/cases/C1.md: approved
222
+ evals/cases/C2.md: changes requested — "make the question count a code check"
223
+ ```
224
+
225
+ A file approved with `A` before the user opened it says `(not opened)`, so a
226
+ record of approvals can say so. `details.reviews` holds the same decisions as
227
+ `{ path, decision, comment?, opened }`.
228
+
117
229
  ## Structured child events
118
230
 
119
231
  Pi's JSON mode emits root session events directly. Recipes appends one Pi
@@ -183,10 +295,11 @@ introspection check
183
295
 
184
296
  That command uses the Rust validation core (`introspection-recipe-check`),
185
297
  which is also published as a crate and a Python binding so a host can embed it
298
+
186
299
  - the Introspection platform validates there, and blocks task creation on a
187
- failure. This npm package no longer ships a validator binary: a launch-time
188
- check was a third run of the same engine in the one place whose failure mode is
189
- a dead session, including when the binary simply could not be spawned.
300
+ failure. This npm package no longer ships a validator binary: a launch-time
301
+ check was a third run of the same engine in the one place whose failure mode is
302
+ a dead session, including when the binary simply could not be spawned.
190
303
 
191
304
  ## Host parity
192
305
 
@@ -132,6 +132,12 @@ All remaining agent fields are optional. Omitted `tools`, `skills`, and
132
132
  provider or session default. Omitted agent instructions preserve `SYSTEM.md`
133
133
  when present, or Pi's normal base prompt otherwise.
134
134
 
135
+ `phases` MAY list, in order, the phases the agent moves through, each the
136
+ prefix of its step skills (`build` for `build-draft`). It changes only what
137
+ Pi's footer shows: the phase of the step skill last read, with the agent's
138
+ other skills shown as helpers. See
139
+ [Where the agent is](pi-extension.md#where-the-agent-is).
140
+
135
141
  Recipe-authored configuration uses `snake_case`. `ai.options` is normalized at
136
142
  the Pi boundary to Pi's camelCase portable `streamSimple` request options, so
137
143
  newly added portable Pi options do not require a Recipe schema release. It is
@@ -468,7 +474,8 @@ lists them in `tools`:
468
474
  | Tool | What it does |
469
475
  | --- | --- |
470
476
  | `ask_user_question` | Asks the user one to four multiple-choice questions and waits for the answers; the user can always type their own answer. Works in Pi's terminal, on pause/resume hosts and headless. See [Interactions](interactions.md#the-built-in-ask_user_question-tool). |
471
- | `show_artifact` | Shows a markdown file the agent wrote (a brief, test cases, a report) in a panel on the right of Pi's terminal, and adds `/recipe view` and `/recipe close`. Elsewhere it returns the file's path as text. See [Pi extension](pi-extension.md#artifact-panel). |
477
+ | `show_artifact` | Shows a markdown file the agent wrote (a brief, test cases, a report) in a panel on the right of Pi's terminal, and adds `/recipe view`; Esc closes it. Elsewhere it returns the file's path as text. See [Pi extension](pi-extension.md#artifact-panel). |
478
+ | `review_artifacts` | Asks the user to review several markdown files the agent wrote, one decision per file (approve, or request changes saying what to change). In Pi's terminal each file shows in the artifact panel; other hosts render their own review. See [Pi extension](pi-extension.md#reviewing-several-files). |
472
479
 
473
480
  ```yaml
474
481
  tools: [read, bash, ask_user_question, show_artifact]
@@ -660,15 +667,18 @@ the format and Host API are not a sandbox boundary.
660
667
 
661
668
  ## Evaluations
662
669
 
663
- A Recipe's evaluations live under `evals/` by default:
670
+ A Recipe's evaluations live under `evals/` by default, with its fakes at the
671
+ Recipe root:
664
672
 
665
673
  ```text
666
674
  evals/
667
- vitest/ vitest-evals suites
668
- harbor/<task>/ one Harbor task per folder
675
+ cases/<id>.md one case file per case: the owner's words and approval
676
+ cases/inputs/ optional: synthetic inputs only
677
+ vitest/ vitest-evals suites; each *.eval.jsonl row names its case
678
+ harbor/<id>/ one Harbor task per folder; the folder name is the case id
669
679
  lib/ code shared by several tasks or suites
670
680
  sources/ pinned generators of derived eval data
671
- fakes/<server>/ MCP fakes and their scenarios
681
+ fakes/<server>/ MCP fakes and their scenarios, also used for local testing
672
682
  ```
673
683
 
674
684
  `pi.evals` is optional and overrides those locations. Absent, hosts and tools
@@ -684,7 +694,8 @@ discover `evals/vitest` and `evals/harbor` when they exist.
684
694
  ],
685
695
  "lib": "evals/lib",
686
696
  "sources": "evals/sources",
687
- "fakes": "evals/fakes"
697
+ "fakes": "fakes",
698
+ "cases": "evals/cases"
688
699
  }
689
700
  }
690
701
  }
@@ -692,16 +703,111 @@ discover `evals/vitest` and `evals/harbor` when they exist.
692
703
 
693
704
  `suites[].type` is `harbor` or `vitest`; several suites of one type may exist,
694
705
  and no two share a path. Every path is Recipe-relative, uses `/`, and stays
695
- inside the package. Unknown keys are errors.
696
-
697
- Nothing eval-only reaches a running agent: every suite, `lib`, `sources` and
698
- `fakes` path MUST be excluded by `.recipeignore` (a single `evals/` line does
699
- it), and in a Harbor trial only a task's `environment/` reaches the agent.
700
- Hosts accept `pi.evals` without reading it; it is for evaluation tooling and
701
- `recipe-check`. `recipe-check` warns about eval paths missing from `.recipeignore`
702
- for every Recipe, and checks the rest of the layout (Harbor task folders, eval
703
- files outside the eval paths) only for a Recipe that declares `pi.evals`; an
704
- empty `{}` adopts those checks with the default paths.
706
+ inside the package. Unknown keys are errors. `fakes` defaults to `fakes` at the
707
+ Recipe root; a Recipe that keeps its fakes under `evals/fakes` names that path
708
+ (`"fakes": "evals/fakes"`). `cases` is newer than the other keys, and an older
709
+ `recipe-check` rejects it as unknown, so declare it only for a path other than
710
+ `evals/cases`.
711
+
712
+ ### Cases
713
+
714
+ A case is one situation in the owner's words, in its case file
715
+ `evals/cases/<id>.md`. An implementation is how one runner executes a case: a
716
+ Vitest row or a Harbor task. Implementations point to their case, never the
717
+ other way round, so a case file never names a path.
718
+
719
+ A case file is YAML front matter, then a body. The front matter:
720
+
721
+ | Field | Meaning |
722
+ | --- | --- |
723
+ | `id` | The file name without `.md`. Unique across the Recipe and never reused. Any name safe as a file name. |
724
+ | `title` | One line in the owner's words. |
725
+ | `check` | `code` (a verifier), `person` (the owner or a reviewer) or `later` (left for a later improvement pass). Only `code` cases get an implementation. |
726
+ | `inputs` | A list of `{ name, sha256, location }`: each input by its hash and where it came from. The case file never holds an input; the implementation carries the copy it runs on, such as a Harbor task's `environment/`. |
727
+ | `sources` | What the agent must reach for this case, such as `[documents]`. |
728
+ | `approved_by`, `approved_at`, `approved_in` | Who approved the case, when, and in which message. All empty means a draft. |
729
+ | `conversation` | Optional: `{ id, task_id, turn }` of the real conversation the case came from, `task_id` only when it ran as a platform task. Provenance only: a run never fetches it. |
730
+ | `issue` | Optional: the UUID of the issue recording the hypothesis the case tests. |
731
+
732
+ Unknown keys are allowed: the other fields and the body are for people. By
733
+ convention the body has the sections Situation, A good result and A bad
734
+ result, and optionally Verification. `evals/cases/inputs/` holds only
735
+ synthetic inputs; real inputs stay where `location` says.
736
+
737
+ ```markdown
738
+ ---
739
+ id: C3
740
+ title: Refund for a late delivery
741
+ check: code
742
+ sources: [orders]
743
+ approved_by: owner@example.com
744
+ approved_at: 2026-11-04
745
+ approved_in: msg_01
746
+ ---
747
+
748
+ ## Situation
749
+ ...
750
+ ```
751
+
752
+ A case has zero or one implementation per runner: zero for `check: person`,
753
+ `check: later` and drafts, and one Vitest and one Harbor implementation at
754
+ most for a `code` case. A case that must run against a deployed version or a
755
+ pushed commit needs a Harbor implementation. Case ids are unique across the
756
+ Recipe, not per suite.
757
+
758
+ - **Vitest.** Each `.eval.jsonl` row names its case with `"case": "<id>"`.
759
+ Rows with a `case` are at `schema_version: 3`, and version 3 requires
760
+ `case`. A row at `schema_version: 2` may carry `case` too, for helpers that
761
+ only read version 2. A row built inline in an `.eval.ts` must still carry
762
+ `case`; the runner checks it there.
763
+ - **Harbor.** A task names its case with `case = "<id>"` in the `[metadata]`
764
+ table of its `task.toml`. Without it, the task's folder name is the case id,
765
+ so a task folder named after its case needs no key. The same table declares
766
+ the scoring contract version the verifier writes, `contract = <n>`; absent
767
+ means 1.
768
+
769
+ ### Scoring
770
+
771
+ Both runners produce the same two objects for a case, whatever language the
772
+ verifier is written in:
773
+
774
+ - **Scores** (`reward.json`): a flat object of finite numbers from 0 to 1,
775
+ booleans rejected. `reward` is the case's score; every other key is one
776
+ dimension. With no `reward`, tooling derives the plain mean of the
777
+ dimensions. A plain `reward.txt` counts as `{"reward": n}`. Counts and other
778
+ numbers that are not scores stay in the verifier's own artifacts.
779
+ - **Reasons** (`reward-details.json`, optional): one entry per key of the
780
+ scores, each with `score` and a `criteria[]` of `name`, `value`, `reasoning`
781
+ and, for a criterion that did not apply, `optional: true` with an `error`.
782
+ It is read tolerantly; without it a case just has no reasoning.
783
+
784
+ A Harbor verifier writes both files to `/logs/verifier/`; a Vitest test hands
785
+ the same objects over in its test metadata. A malformed score object makes the
786
+ case incomplete, never a score of 0, and a criterion that did not apply has no
787
+ score. The contract has an integer version, starting at 1, that changes only
788
+ on a breaking change.
789
+
790
+ ### Packaging and checks
791
+
792
+ Nothing eval-only reaches a running agent: every suite, `lib`, `sources`,
793
+ `fakes` and `cases` path MUST be excluded by `.recipeignore` (an `evals/` line
794
+ and a `fakes/` line do it), and in a Harbor trial only a task's `environment/`
795
+ reaches the agent. Hosts accept `pi.evals` without reading it; it is for
796
+ evaluation tooling and `recipe-check`.
797
+
798
+ `recipe-check` warns about eval paths missing from `.recipeignore` for every
799
+ Recipe. It checks the rest of the layout only for a Recipe that declares
800
+ `pi.evals`; an empty `{}` adopts those checks with the default paths. Those
801
+ checks are Harbor task folders without `task.toml`, eval files outside the
802
+ eval paths, and the links between cases and implementations, all as warnings:
803
+
804
+ | Code | Rule |
805
+ | --- | --- |
806
+ | `pi.evals_case_unknown` | A Vitest row or Harbor task names a case with no case file. |
807
+ | `pi.evals_case_duplicate` | A case has more than one implementation on one runner. |
808
+ | `pi.evals_case_unapproved` | A case with an implementation has an empty approval field. It stays a warning: a draft case is how one is proposed, and the owner approves it in review. |
809
+ | `pi.evals_case_row_missing_id` | A `.eval.jsonl` row has no `case`. |
810
+ | `pi.evals_case_invalid` | A case file has no readable front matter, an `id` other than its file name, or an `issue` that is not a UUID. |
705
811
 
706
812
  ## Conformance
707
813
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-ai/recipes",
3
- "version": "0.42.0",
3
+ "version": "0.44.0",
4
4
  "description": "The open format for vertical agents, built on Pi.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -106,10 +106,10 @@
106
106
  "@introspection-ai/recipe-channel-slack": ">=0.6.0",
107
107
  "@introspection-ai/recipe-documents-docx": ">=0.3.0",
108
108
  "@introspection-ai/recipe-documents-pdf": ">=0.2.0",
109
- "@introspection-ai/mcp-client-linux-x64": "0.42.0",
110
- "@introspection-ai/mcp-client-linux-arm64": "0.42.0",
111
- "@introspection-ai/mcp-client-darwin-arm64": "0.42.0",
112
- "@introspection-ai/mcp-client-darwin-x64": "0.42.0"
109
+ "@introspection-ai/mcp-client-linux-x64": "0.44.0",
110
+ "@introspection-ai/mcp-client-linux-arm64": "0.44.0",
111
+ "@introspection-ai/mcp-client-darwin-arm64": "0.44.0",
112
+ "@introspection-ai/mcp-client-darwin-x64": "0.44.0"
113
113
  },
114
114
  "peerDependencies": {
115
115
  "@earendil-works/pi-agent-core": ">=1.1.0 <2.0.0",
@@ -123,11 +123,19 @@
123
123
  "@earendil-works/pi-ai": "1.4.0",
124
124
  "@earendil-works/pi-coding-agent": "1.4.0",
125
125
  "@earendil-works/pi-tui": "1.4.0",
126
+ "@eslint/js": "9.39.5",
126
127
  "@types/node": "^26.1.2",
127
128
  "@types/semver": "^7.8.0",
129
+ "@typescript/native": "npm:typescript@^7.0.2",
128
130
  "esbuild": "^0.28.1",
131
+ "eslint": "9.39.5",
132
+ "eslint-config-prettier": "10.1.8",
133
+ "eslint-plugin-only-warn": "1.2.1",
134
+ "knip": "6.44.0",
135
+ "prettier": "3.9.10",
129
136
  "typebox": "^1.0.56",
130
- "typescript": "^7.0.2",
137
+ "typescript": "npm:@typescript/typescript6@^6.0.2",
138
+ "typescript-eslint": "8.72.1",
131
139
  "vitest": "^5.0.1"
132
140
  },
133
141
  "scripts": {
@@ -137,6 +145,10 @@
137
145
  "build:native": "cargo build --release -p pi-mcp-client && node scripts/package-mcp-client.mjs",
138
146
  "bench:mcp-client": "pnpm build:ts && cargo build --release -p pi-mcp-client && node scripts/benchmark-mcp-client.mjs",
139
147
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json && pnpm --filter './packages/**' --filter './examples/**' typecheck",
148
+ "lint": "eslint . --max-warnings 0",
149
+ "format": "prettier --write \"{src,test,packages,examples}/**/*.{ts,mjs,md}\" \"*.{ts,mjs}\"",
150
+ "format:check": "prettier --check \"{src,test,packages,examples}/**/*.{ts,mjs,md}\" \"*.{ts,mjs}\"",
151
+ "knip": "knip",
140
152
  "test": "pnpm build:ts && cargo test -p pi-mcp-client -p introspection-recipe-check && cargo build -p pi-mcp-client && MCP_CLIENT_BIN=target/debug/mcp-client node scripts/package-mcp-client.mjs && vitest run && pnpm --filter './examples/**' test",
141
153
  "pack:check": "pnpm pack --dry-run --json | node scripts/check-npm-pack.mjs && pnpm --filter './packages/**' pack:check",
142
154
  "clean": "rm -rf dist .turbo node_modules target vendor/mcp-client"