@introspection-ai/recipes 0.42.0 → 0.43.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 (40) hide show
  1. package/dist/artifact-review-tui.d.ts +35 -0
  2. package/dist/artifact-review-tui.d.ts.map +1 -0
  3. package/dist/artifact-review-tui.js +315 -0
  4. package/dist/artifact-review-tui.js.map +1 -0
  5. package/dist/artifact-review.d.ts +55 -0
  6. package/dist/artifact-review.d.ts.map +1 -0
  7. package/dist/artifact-review.js +267 -0
  8. package/dist/artifact-review.js.map +1 -0
  9. package/dist/artifact-viewer-tui.d.ts +10 -8
  10. package/dist/artifact-viewer-tui.d.ts.map +1 -1
  11. package/dist/artifact-viewer-tui.js +24 -15
  12. package/dist/artifact-viewer-tui.js.map +1 -1
  13. package/dist/artifact-viewer.d.ts +13 -14
  14. package/dist/artifact-viewer.d.ts.map +1 -1
  15. package/dist/artifact-viewer.js +96 -58
  16. package/dist/artifact-viewer.js.map +1 -1
  17. package/dist/interaction-tui.d.ts +27 -0
  18. package/dist/interaction-tui.d.ts.map +1 -1
  19. package/dist/interaction-tui.js +39 -5
  20. package/dist/interaction-tui.js.map +1 -1
  21. package/dist/pi-extension.d.ts.map +1 -1
  22. package/dist/pi-extension.js +35 -2
  23. package/dist/pi-extension.js.map +1 -1
  24. package/dist/recipe/skills.d.ts +1 -0
  25. package/dist/recipe/skills.d.ts.map +1 -1
  26. package/dist/recipe/skills.js +1 -1
  27. package/dist/recipe/skills.js.map +1 -1
  28. package/dist/recipe-session-entry.d.ts +18 -0
  29. package/dist/recipe-session-entry.d.ts.map +1 -0
  30. package/dist/recipe-session-entry.js +27 -0
  31. package/dist/recipe-session-entry.js.map +1 -0
  32. package/dist/session.js +2 -2
  33. package/dist/session.js.map +1 -1
  34. package/dist/skill-progress.d.ts +68 -0
  35. package/dist/skill-progress.d.ts.map +1 -0
  36. package/dist/skill-progress.js +253 -0
  37. package/dist/skill-progress.js.map +1 -0
  38. package/docs/pi-extension.md +89 -12
  39. package/docs/recipe-format.md +116 -16
  40. package/package.json +5 -5
@@ -0,0 +1,253 @@
1
+ /**
2
+ * Where a Recipe agent is, in Pi's footer:
3
+ * `⧈ Introspection build ✓ brainstorm ▸ draft ○ review · 12:04`. Pi's own
4
+ * "Working" line and the terminal title are left as they are. The clock is the
5
+ * agent's working time from the start of the session, across every step, paused
6
+ * while the person is in the loop, when the current step shows ⏸ in place of ▸; no estimate of what's left is given, since
7
+ * steps vary too much for one to be honest.
8
+ *
9
+ * Nothing is declared for it. The step is the agent's skill it last read: a
10
+ * skill named `<phase>-<step>` (the Operator's `build-draft`) shows its phase's
11
+ * steps in the agent's order, any other by its name. On resume the step is
12
+ * recovered from the session's earlier reads.
13
+ */
14
+ import { basename, dirname } from "node:path";
15
+ import { skillName } from "./recipe/skills.js";
16
+ /** Introspection's mark (two concentric squares) and name, at the front of the footer line. */
17
+ export const BRAND = "⧈ Introspection";
18
+ /** The current step's mark while the clock is paused for the person, in place of ▸. */
19
+ export const PAUSED_MARK = "⏸";
20
+ /** Tools that wait for the person: the step's clock stops while one is open. */
21
+ export const PERSON_IN_THE_LOOP = new Set([
22
+ "ask_user_question",
23
+ "review_artifacts",
24
+ ]);
25
+ /** Tools that read a skill; a write or edit of a `SKILL.md` isn't a step. */
26
+ export const SKILL_READ_TOOLS = new Set(["read", "bash"]);
27
+ /** The footer status the step shows under. */
28
+ export const STEP_STATUS_KEY = "recipe-step";
29
+ /** Lines a read must cover to count as reading a skill; fewer is a glance at it, not the step. */
30
+ export const SKILL_READ_MIN_LINES = 100;
31
+ /** Whether a tool call's input reads a whole file rather than glancing at its top. */
32
+ export function readsWhole(input) {
33
+ if (typeof input.limit === "number" && input.limit < SKILL_READ_MIN_LINES)
34
+ return false;
35
+ if (typeof input.command === "string" &&
36
+ /\b(head|sed\s+-n)\b/.test(input.command))
37
+ return false;
38
+ return true;
39
+ }
40
+ /**
41
+ * The skills that are the agent's steps: those of the phase its first skill
42
+ * belongs to (`build-*` for an agent listing `build-brainstorm` first). Others
43
+ * it lists (`eval-case`, read while writing cases) are consulted, not stepped
44
+ * into, so they don't move the footer. An agent whose first skill has no phase
45
+ * steps through all of them.
46
+ */
47
+ export function stepSkills(skills) {
48
+ const first = skills[0];
49
+ const dash = first ? first.indexOf("-") : -1;
50
+ if (!first || dash <= 0)
51
+ return skills;
52
+ const phase = first.slice(0, dash + 1);
53
+ const steps = skills.filter((name) => name.startsWith(phase));
54
+ return steps.length > 1 ? steps : skills;
55
+ }
56
+ /** Each skill's name by its folder, for the skills whose `name` isn't their folder's. */
57
+ export function skillFolders(skillPaths, recipeDir) {
58
+ const folders = new Map();
59
+ for (const path of skillPaths) {
60
+ const folder = basename(dirname(path));
61
+ const name = skillName(path, recipeDir);
62
+ if (name !== folder)
63
+ folders.set(folder, name);
64
+ }
65
+ return folders;
66
+ }
67
+ /** The agent's step whose `SKILL.md` a tool call's path or command reads, if any. */
68
+ export function skillRead(text, skills) {
69
+ if (typeof text !== "string")
70
+ return undefined;
71
+ const steps = stepSkills(skills.names);
72
+ for (const match of text.matchAll(/([A-Za-z0-9_-]+)\/SKILL\.md\b/g)) {
73
+ const name = skills.folders?.get(match[1]) ?? match[1];
74
+ if (steps.includes(name))
75
+ return name;
76
+ }
77
+ return undefined;
78
+ }
79
+ /** A skill's phase and its steps in the agent's order, or undefined when it isn't one of several `<phase>-<step>` skills. */
80
+ function phaseOf(skill, skills) {
81
+ const dash = skill.indexOf("-");
82
+ if (dash <= 0)
83
+ return undefined;
84
+ const phase = skill.slice(0, dash);
85
+ const steps = skills
86
+ .filter((name) => name.startsWith(`${phase}-`))
87
+ .map((name) => name.slice(phase.length + 1));
88
+ const at = steps.indexOf(skill.slice(dash + 1));
89
+ return steps.length < 2 || at < 0 ? undefined : { phase, steps, at };
90
+ }
91
+ /**
92
+ * The footer's line for a step: `build ✓ brainstorm ▸ draft ○ review · 12:04`,
93
+ * the phase's steps in the agent's order (done ticked,
94
+ * the current one marked, the rest to come), then how long the current one has
95
+ * run. Any other skill shows by its name.
96
+ */
97
+ export function stepLine(skill, skills, clock, paused = false) {
98
+ const found = phaseOf(skill, skills);
99
+ const mark = paused ? PAUSED_MARK : "▸";
100
+ if (!found)
101
+ return `${mark} ${skill} · ${clock}`;
102
+ const done = found.steps
103
+ .slice(0, found.at)
104
+ .map((step) => `✓ ${step}`)
105
+ .join(" ");
106
+ const rest = found.steps
107
+ .slice(found.at + 1)
108
+ .map((step) => `○ ${step}`)
109
+ .join(" ");
110
+ const line = [done, `${mark} ${found.steps[found.at]}`, rest]
111
+ .filter(Boolean)
112
+ .join(" ");
113
+ return `${found.phase} ${line} · ${clock}`;
114
+ }
115
+ /** How long a step has run, as a clock: `00:17`, `03:42`, `1:05:09`. */
116
+ export function elapsed(ms) {
117
+ const total = Math.max(0, Math.floor(ms / 1000));
118
+ const two = (n) => String(n).padStart(2, "0");
119
+ const [hours, minutes, seconds] = [
120
+ Math.floor(total / 3600),
121
+ Math.floor((total % 3600) / 60),
122
+ total % 60,
123
+ ];
124
+ return hours > 0
125
+ ? `${hours}:${two(minutes)}:${two(seconds)}`
126
+ : `${two(minutes)}:${two(seconds)}`;
127
+ }
128
+ /** The last of the agent's skills the session read, from its entries; a read that failed doesn't count. */
129
+ export function lastSkillRead(entries, skills) {
130
+ const failed = new Set(entries
131
+ .filter((entry) => entry.message?.role === "toolResult" && entry.message.isError)
132
+ .map((entry) => entry.message.toolCallId));
133
+ let last;
134
+ for (const entry of entries) {
135
+ if (entry.type !== "message" || entry.message?.role !== "assistant")
136
+ continue;
137
+ const content = Array.isArray(entry.message.content)
138
+ ? entry.message.content
139
+ : [];
140
+ for (const block of content) {
141
+ if (block.type !== "toolCall" ||
142
+ !SKILL_READ_TOOLS.has(block.name ?? "") ||
143
+ failed.has(block.id) ||
144
+ !readsWhole(block.arguments ?? {}))
145
+ continue;
146
+ last =
147
+ skillRead(block.arguments?.path, skills) ??
148
+ skillRead(block.arguments?.command, skills) ??
149
+ last;
150
+ }
151
+ }
152
+ return last;
153
+ }
154
+ /**
155
+ * Keep the footer on the agent's step, with its clock running.
156
+ * `skillsFor` gives the active agent's skills in their listed order, or
157
+ * undefined outside a Recipe session. Returns `resume`, for the host's own
158
+ * session-start handler to call, so a resumed session shows its step at once.
159
+ */
160
+ export function registerSkillProgress(pi, skillsFor, now = Date.now,
161
+ /** Calls `tick` every second until the returned stop is called; injected by tests. */
162
+ every = (tick) => {
163
+ const timer = setInterval(tick, 1000);
164
+ timer.unref?.();
165
+ return () => clearInterval(timer);
166
+ }) {
167
+ let current;
168
+ // The agent's working time this session, across every step: what's banked, plus the run in
169
+ // progress. It pauses while the person is in the loop (the agent's turn has ended, or a question
170
+ // or review is open).
171
+ // Paused until the agent's first turn starts: time before the first prompt isn't the agent's.
172
+ let banked = 0;
173
+ let runningSince;
174
+ const worked = () => banked + (runningSince === undefined ? 0 : now() - runningSince);
175
+ const pause = () => {
176
+ if (runningSince === undefined)
177
+ return;
178
+ banked += now() - runningSince;
179
+ runningSince = undefined;
180
+ };
181
+ const run = () => {
182
+ runningSince ??= now();
183
+ };
184
+ // Redrawn every second, so the clock runs during a long call.
185
+ let shown;
186
+ let stop;
187
+ const show = (ctx) => {
188
+ if (!ctx.hasUI || !current)
189
+ return;
190
+ shown = ctx;
191
+ ctx.ui.setStatus(STEP_STATUS_KEY, `${BRAND} ${stepLine(current.skill, current.skills, elapsed(worked()), runningSince === undefined)}`);
192
+ stop ??= every(() => {
193
+ if (shown)
194
+ show(shown);
195
+ });
196
+ };
197
+ pi.on("session_shutdown", () => {
198
+ stop?.();
199
+ stop = undefined;
200
+ shown = undefined;
201
+ });
202
+ const setStep = (ctx, skill, skills) => {
203
+ if (!skill || !ctx.hasUI)
204
+ return;
205
+ if (current?.skill === skill)
206
+ return;
207
+ current = { skill, skills };
208
+ show(ctx);
209
+ };
210
+ pi.on("agent_start", (_event, ctx) => {
211
+ run();
212
+ show(ctx);
213
+ });
214
+ pi.on("agent_end", (_event, ctx) => {
215
+ pause();
216
+ show(ctx);
217
+ });
218
+ pi.on("tool_execution_start", (event, ctx) => {
219
+ if (!PERSON_IN_THE_LOOP.has(event.toolName))
220
+ return;
221
+ pause();
222
+ show(ctx);
223
+ });
224
+ pi.on("tool_result", (event, ctx) => {
225
+ const skills = skillsFor(ctx);
226
+ if (!skills?.names.length)
227
+ return;
228
+ if (PERSON_IN_THE_LOOP.has(event.toolName))
229
+ run();
230
+ const input = (event.input ?? {});
231
+ if (!event.isError &&
232
+ SKILL_READ_TOOLS.has(event.toolName) &&
233
+ readsWhole(input)) {
234
+ setStep(ctx, skillRead(input.path, skills) ?? skillRead(input.command, skills), skills.names);
235
+ }
236
+ show(ctx);
237
+ });
238
+ return {
239
+ resume(ctx) {
240
+ // Another session in the same process starts from nothing: no step, no time.
241
+ if (current && ctx.hasUI)
242
+ ctx.ui.setStatus(STEP_STATUS_KEY, undefined);
243
+ current = undefined;
244
+ banked = 0;
245
+ runningSince = undefined;
246
+ const skills = skillsFor(ctx);
247
+ if (!skills?.names.length)
248
+ return;
249
+ setStep(ctx, lastSkillRead(ctx.sessionManager?.getEntries?.() ?? [], skills), skills.names);
250
+ },
251
+ };
252
+ }
253
+ //# sourceMappingURL=skill-progress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-progress.js","sourceRoot":"","sources":["../src/skill-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAO9C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,+FAA+F;AAC/F,MAAM,CAAC,MAAM,KAAK,GAAG,iBAAiB,CAAC;AAEvC,uFAAuF;AACvF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACxC,mBAAmB;IACnB,kBAAkB;CACnB,CAA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AE,OAAO;QAClC,IAAI,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;YAAE,GAAG,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAA4B,CAAC;QAC7D,IACE,CAAC,KAAK,CAAC,OAAO;YACd,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC;YACpC,UAAU,CAAC,KAAK,CAAC,EACjB,CAAC;YACD,OAAO,CACL,GAAG,EACH,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,EACjE,MAAM,CAAC,KAAK,CACb,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,CAAC;IACZ,CAAC,CAAC,CAAC;IACH,OAAO;QACL,MAAM,CAAC,GAAG;YACR,6EAA6E;YAC7E,IAAI,OAAO,IAAI,GAAG,CAAC,KAAK;gBAAE,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;YACvE,OAAO,GAAG,SAAS,CAAC;YACpB,MAAM,GAAG,CAAC,CAAC;YACX,YAAY,GAAG,SAAS,CAAC;YACzB,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM;gBAAE,OAAO;YAClC,OAAO,CACL,GAAG,EACH,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,EAC/D,MAAM,CAAC,KAAK,CACb,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -49,6 +49,26 @@ 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 is 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
+ ## The Recipe a session runs
63
+
64
+ When the extension starts a Recipe session it records the Recipe in the session file, as a custom entry of type `recipe_session`:
65
+
66
+ ```json
67
+ { "type": "custom", "customType": "recipe_session", "data": { "recipe_dir": "/abs/path/interviewer", "agent": "agent", "package": "interviewer", "version": "0.1.0" } }
68
+ ```
69
+
70
+ 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.
71
+
52
72
  ## GenAI spans
53
73
 
54
74
  Set `PI_RECIPE_GENAI_SPANS_FILE` to a path and the extension writes the
@@ -85,26 +105,27 @@ tools: [read, write, edit, ask_user_question, show_artifact]
85
105
  ```
86
106
 
87
107
  ```ts
88
- show_artifact({ path: "evals/cases/refund.md" }) // relative to the working directory
108
+ show_artifact({ path: "evals/cases/refund.md" }); // relative to the working directory
89
109
  ```
90
110
 
91
111
  The tool refuses a path outside the working directory (including a symlink
92
112
  that leads out of it), a missing file, and anything that is not `.md` or
93
113
  `.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
114
+ and shows the file name and the visible line range. It draws over the
115
+ conversation, so it isn't drawn on a terminal narrower than 100 columns. It opens without taking
95
116
  the keyboard, so the user keeps typing in the editor. Showing another file
96
117
  replaces the content, and the panel re-renders when the file changes on disk.
97
118
 
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 |
119
+ | Key | Where | Does |
120
+ | ---------------------------------------------- | ----------------------------------- | ---------------------------------------------------------------------------- |
121
+ | `Up` / `Down`, `PgUp` / `PgDn`, `Home` / `End` | panel | Scroll |
122
+ | `o` | panel | Opens the file with the system's default app (`open`, `xdg-open` or `start`) |
123
+ | `Esc` / `q` | panel | Closes the panel |
124
+ | `PgUp` / `PgDn` | a question from `ask_user_question` | Scroll the panel without moving the keyboard to it |
104
125
 
105
126
  `/recipe view <file>` opens a file the same way; `/recipe view` on its own opens
106
127
  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
128
+ session, and `Esc` closes the panel from the editor. They are
108
129
  subcommands of `/recipe`, so they never clash with another extension's or your
109
130
  own commands.
110
131
 
@@ -114,6 +135,61 @@ available in Pi's interactive terminal, ...` so the model can tell the user
114
135
  where to look. If a Recipe extension registers its own `show_artifact`, the
115
136
  host keeps it and registers neither the built-in tool nor `/recipe view`.
116
137
 
138
+ ### Reviewing several files
139
+
140
+ List `review_artifacts` and the agent can ask the user to review several
141
+ markdown files it wrote, one decision per file, as in a pull request review:
142
+ approve, with an optional comment, or request changes, saying what to change.
143
+
144
+ ```ts
145
+ review_artifacts({
146
+ title: "The interview agent's cases",
147
+ items: [
148
+ // 1 to 20, in reading order
149
+ { path: "evals/cases/C1.md", label: "C1: four questions" },
150
+ { path: "evals/cases/C2.md", label: "C2: a vague answer" },
151
+ { path: "docs/DESIGN.md", label: "The brief", section: "Part A" }, // only that part
152
+ ],
153
+ });
154
+ ```
155
+
156
+ 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.
157
+
158
+ In Pi's terminal the review is inline, in place of the editor: a tab per file
159
+ and a Submit tab across the top (a single file has none), the file itself in a
160
+ box, and the choices under it. The artifact panel isn't used; `show_artifact`
161
+ is for showing a file without asking for a decision.
162
+
163
+ | Key | Does |
164
+ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
165
+ | `Left` / `Right`, `Tab` / `Shift+Tab` | Previous or next file, then Submit |
166
+ | `Up` / `Down`, `Enter`, or a number | Pick a choice: `Approve`, `Approve with a comment` (optional), or `Request changes` and say what should change (required) |
167
+ | `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 |
168
+ | `Esc` | Cancel the review; nothing is approved |
169
+
170
+ After a decision the review moves to the next undecided file, and once every
171
+ file has one, to the Submit tab; nothing is sent until the user submits there
172
+ (a single file submits with its decision). The Submit tab lists the decisions and offers
173
+ `Submit` (files left undecided are `not reviewed`) or `Approve the rest and submit`.
174
+
175
+ It is an interaction ([Interactions](interactions.md)), so it works on every
176
+ host: over RPC each file is a select (`Approve`, `Request changes`, `Skip`),
177
+ then a comment (required for changes); on a pause/resume host it pauses with
178
+ `details.interrupt.metadata` `{ kind: "review_artifacts", items: [{ path, label }] }`
179
+ for the host to render its own review, and resumes with `{ answer }` in the
180
+ format below; headless runs and child agents decline, so nothing is approved
181
+ without a person. The model sees, after `Answer: `:
182
+
183
+ ```text
184
+ Reviewed 2 files: 1 approved, 1 with changes requested, 0 not reviewed.
185
+ evals/cases/C1.md: approved
186
+ evals/cases/C2.md: changes requested — "make the question count a code check"
187
+ ```
188
+
189
+ A file approved with `A` before the user opened it says `(not opened)`, so a
190
+ record of approvals can say so. `details.reviews` holds the same decisions as
191
+ `{ path, decision, comment?, opened }`.
192
+
117
193
  ## Structured child events
118
194
 
119
195
  Pi's JSON mode emits root session events directly. Recipes appends one Pi
@@ -183,10 +259,11 @@ introspection check
183
259
 
184
260
  That command uses the Rust validation core (`introspection-recipe-check`),
185
261
  which is also published as a crate and a Python binding so a host can embed it
262
+
186
263
  - 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.
264
+ failure. This npm package no longer ships a validator binary: a launch-time
265
+ check was a third run of the same engine in the one place whose failure mode is
266
+ a dead session, including when the binary simply could not be spawned.
190
267
 
191
268
  ## Host parity
192
269
 
@@ -468,7 +468,8 @@ lists them in `tools`:
468
468
  | Tool | What it does |
469
469
  | --- | --- |
470
470
  | `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). |
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`; Esc closes it. Elsewhere it returns the file's path as text. See [Pi extension](pi-extension.md#artifact-panel). |
472
+ | `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
473
 
473
474
  ```yaml
474
475
  tools: [read, bash, ask_user_question, show_artifact]
@@ -660,15 +661,18 @@ the format and Host API are not a sandbox boundary.
660
661
 
661
662
  ## Evaluations
662
663
 
663
- A Recipe's evaluations live under `evals/` by default:
664
+ A Recipe's evaluations live under `evals/` by default, with its fakes at the
665
+ Recipe root:
664
666
 
665
667
  ```text
666
668
  evals/
667
- vitest/ vitest-evals suites
668
- harbor/<task>/ one Harbor task per folder
669
+ cases/<id>.md one case file per case: the owner's words and approval
670
+ cases/inputs/ optional: synthetic inputs only
671
+ vitest/ vitest-evals suites; each *.eval.jsonl row names its case
672
+ harbor/<id>/ one Harbor task per folder; the folder name is the case id
669
673
  lib/ code shared by several tasks or suites
670
674
  sources/ pinned generators of derived eval data
671
- fakes/<server>/ MCP fakes and their scenarios
675
+ fakes/<server>/ MCP fakes and their scenarios, also used for local testing
672
676
  ```
673
677
 
674
678
  `pi.evals` is optional and overrides those locations. Absent, hosts and tools
@@ -684,7 +688,8 @@ discover `evals/vitest` and `evals/harbor` when they exist.
684
688
  ],
685
689
  "lib": "evals/lib",
686
690
  "sources": "evals/sources",
687
- "fakes": "evals/fakes"
691
+ "fakes": "fakes",
692
+ "cases": "evals/cases"
688
693
  }
689
694
  }
690
695
  }
@@ -692,16 +697,111 @@ discover `evals/vitest` and `evals/harbor` when they exist.
692
697
 
693
698
  `suites[].type` is `harbor` or `vitest`; several suites of one type may exist,
694
699
  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.
700
+ inside the package. Unknown keys are errors. `fakes` defaults to `fakes` at the
701
+ Recipe root; a Recipe that keeps its fakes under `evals/fakes` names that path
702
+ (`"fakes": "evals/fakes"`). `cases` is newer than the other keys, and an older
703
+ `recipe-check` rejects it as unknown, so declare it only for a path other than
704
+ `evals/cases`.
705
+
706
+ ### Cases
707
+
708
+ A case is one situation in the owner's words, in its case file
709
+ `evals/cases/<id>.md`. An implementation is how one runner executes a case: a
710
+ Vitest row or a Harbor task. Implementations point to their case, never the
711
+ other way round, so a case file never names a path.
712
+
713
+ A case file is YAML front matter, then a body. The front matter:
714
+
715
+ | Field | Meaning |
716
+ | --- | --- |
717
+ | `id` | The file name without `.md`. Unique across the Recipe and never reused. Any name safe as a file name. |
718
+ | `title` | One line in the owner's words. |
719
+ | `check` | `code` (a verifier), `person` (the owner or a reviewer) or `later` (left for a later improvement pass). Only `code` cases get an implementation. |
720
+ | `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/`. |
721
+ | `sources` | What the agent must reach for this case, such as `[documents]`. |
722
+ | `approved_by`, `approved_at`, `approved_in` | Who approved the case, when, and in which message. All empty means a draft. |
723
+ | `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. |
724
+ | `issue` | Optional: the UUID of the issue recording the hypothesis the case tests. |
725
+
726
+ Unknown keys are allowed: the other fields and the body are for people. By
727
+ convention the body has the sections Situation, A good result and A bad
728
+ result, and optionally Verification. `evals/cases/inputs/` holds only
729
+ synthetic inputs; real inputs stay where `location` says.
730
+
731
+ ```markdown
732
+ ---
733
+ id: C3
734
+ title: Refund for a late delivery
735
+ check: code
736
+ sources: [orders]
737
+ approved_by: owner@example.com
738
+ approved_at: 2026-11-04
739
+ approved_in: msg_01
740
+ ---
741
+
742
+ ## Situation
743
+ ...
744
+ ```
745
+
746
+ A case has zero or one implementation per runner: zero for `check: person`,
747
+ `check: later` and drafts, and one Vitest and one Harbor implementation at
748
+ most for a `code` case. A case that must run against a deployed version or a
749
+ pushed commit needs a Harbor implementation. Case ids are unique across the
750
+ Recipe, not per suite.
751
+
752
+ - **Vitest.** Each `.eval.jsonl` row names its case with `"case": "<id>"`.
753
+ Rows with a `case` are at `schema_version: 3`, and version 3 requires
754
+ `case`. A row at `schema_version: 2` may carry `case` too, for helpers that
755
+ only read version 2. A row built inline in an `.eval.ts` must still carry
756
+ `case`; the runner checks it there.
757
+ - **Harbor.** A task names its case with `case = "<id>"` in the `[metadata]`
758
+ table of its `task.toml`. Without it, the task's folder name is the case id,
759
+ so a task folder named after its case needs no key. The same table declares
760
+ the scoring contract version the verifier writes, `contract = <n>`; absent
761
+ means 1.
762
+
763
+ ### Scoring
764
+
765
+ Both runners produce the same two objects for a case, whatever language the
766
+ verifier is written in:
767
+
768
+ - **Scores** (`reward.json`): a flat object of finite numbers from 0 to 1,
769
+ booleans rejected. `reward` is the case's score; every other key is one
770
+ dimension. With no `reward`, tooling derives the plain mean of the
771
+ dimensions. A plain `reward.txt` counts as `{"reward": n}`. Counts and other
772
+ numbers that are not scores stay in the verifier's own artifacts.
773
+ - **Reasons** (`reward-details.json`, optional): one entry per key of the
774
+ scores, each with `score` and a `criteria[]` of `name`, `value`, `reasoning`
775
+ and, for a criterion that did not apply, `optional: true` with an `error`.
776
+ It is read tolerantly; without it a case just has no reasoning.
777
+
778
+ A Harbor verifier writes both files to `/logs/verifier/`; a Vitest test hands
779
+ the same objects over in its test metadata. A malformed score object makes the
780
+ case incomplete, never a score of 0, and a criterion that did not apply has no
781
+ score. The contract has an integer version, starting at 1, that changes only
782
+ on a breaking change.
783
+
784
+ ### Packaging and checks
785
+
786
+ Nothing eval-only reaches a running agent: every suite, `lib`, `sources`,
787
+ `fakes` and `cases` path MUST be excluded by `.recipeignore` (an `evals/` line
788
+ and a `fakes/` line do it), and in a Harbor trial only a task's `environment/`
789
+ reaches the agent. Hosts accept `pi.evals` without reading it; it is for
790
+ evaluation tooling and `recipe-check`.
791
+
792
+ `recipe-check` warns about eval paths missing from `.recipeignore` for every
793
+ Recipe. It checks the rest of the layout only for a Recipe that declares
794
+ `pi.evals`; an empty `{}` adopts those checks with the default paths. Those
795
+ checks are Harbor task folders without `task.toml`, eval files outside the
796
+ eval paths, and the links between cases and implementations, all as warnings:
797
+
798
+ | Code | Rule |
799
+ | --- | --- |
800
+ | `pi.evals_case_unknown` | A Vitest row or Harbor task names a case with no case file. |
801
+ | `pi.evals_case_duplicate` | A case has more than one implementation on one runner. |
802
+ | `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. |
803
+ | `pi.evals_case_row_missing_id` | A `.eval.jsonl` row has no `case`. |
804
+ | `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
805
 
706
806
  ## Conformance
707
807
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@introspection-ai/recipes",
3
- "version": "0.42.0",
3
+ "version": "0.43.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.43.0",
110
+ "@introspection-ai/mcp-client-linux-arm64": "0.43.0",
111
+ "@introspection-ai/mcp-client-darwin-arm64": "0.43.0",
112
+ "@introspection-ai/mcp-client-darwin-x64": "0.43.0"
113
113
  },
114
114
  "peerDependencies": {
115
115
  "@earendil-works/pi-agent-core": ">=1.1.0 <2.0.0",