Skip to content

Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.

Add describer eval harness

adilei3a3ff3222a3e
diff --git a/.gitignore b/.gitignore
index c087b94..ce6a580 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@ dist-electron
release
*.log
.DS_Store
+
+# Eval run outputs (timestamped result logs)
+evals/results/
diff --git a/electron/recorder/session-store.ts b/electron/recorder/session-store.ts
index d9745c6..d6464ad 100644
--- a/electron/recorder/session-store.ts
+++ b/electron/recorder/session-store.ts
@@ -7,6 +7,8 @@ import type { RecEvent, SessionMeta } from "../../common/types";
/** Root folder that holds one sub-directory per recorded session. */
export function sessionsRoot(): string {
+ const override = process.env.SKILL_RECORDER_SESSIONS_DIR;
+ if (override) return path.resolve(override);
return path.join(app.getPath("userData"), "sessions");
}
diff --git a/evals/README.md b/evals/README.md
new file mode 100644
index 0000000..d07ac84
--- /dev/null
+++ b/evals/README.md
@@ -0,0 +1,117 @@
+# Skill Recorder — Evals
+
+Repeatable evals for the part of the system with real variance: the multi-turn
+**Copilot describer** that turns captured signals into an *overall intent* + an
+*ordered list of steps*. Each eval feeds the describer a fixed, synthetic
+recording and scores its analysis against a rubric.
+
+## Why fixture-based (not live capture)
+
+The evals are **deterministic and video-less on purpose**. Live capture (driving
+real apps, recording the screen) is flaky and slow, and it's not the part we're
+trying to measure. By materializing a fixed event stream we isolate the describer
+so a run is repeatable and fast (~15–25s per scenario), and a failure points at
+the model/instructions, not at capture flakiness. The events are authored to
+mirror what the real collectors emit for the same task, so a scenario is a
+faithful stand-in for a real recording. Matching **mock pages** live in
+`evals/mocks/` for when you *do* want a real end-to-end capture (see below).
+
+## Run
+
+```bash
+npm run eval # all scenarios
+npm run eval -- --only=web-to-spreadsheet
+npm run eval -- --judge # also run the semantic LLM judge
+npm run eval -- --keep # print the temp sessions dir (artifacts kept)
+npm run eval -- --model=<model-id> # override the describer model
+```
+
+Requires GitHub Copilot CLI to be signed in (same auth the app uses). Exit code
+is non-zero if any scenario fails. Full results are written to
+`evals/results/<timestamp>.json` (git-ignored).
+
+Under the hood the runner uses Node's TypeScript support
+(`--experimental-transform-types`) plus a tiny resolution hook
+(`evals/register.mjs` → `evals/hooks.mjs`) that (1) resolves the project's
+extensionless imports to `.ts` and (2) swaps the one `electron` import for a
+headless stub (`evals/electron-stub.mjs`). No bundler, runs the real app source.
+
+## How a run works
+
+For each scenario the harness:
+
+1. **Materializes** a synthetic session (`session.json` + `events.jsonl`) into an
+ isolated temp sessions root (via the `SKILL_RECORDER_SESSIONS_DIR` override, so
+ your real sessions are never touched).
+2. Runs the **real pipeline** — `processSession()` builds `bundle.json` +
+ `description.md` exactly as the app does after Stop.
+3. Runs the **real describer** — `new Describer().analyze(id)`, the same agent the
+ app uses (reads the timeline/events, pulls frames only if ambiguous, calls
+ `submit_analysis`).
+4. **Scores** the analysis against the scenario's rubric.
+
+## Scoring
+
+`scoring.ts` is deterministic and LLM-free — the primary pass/fail signal:
+
+- **intent keywords** — the intent sentence names the right subject.
+- **step count** — within an expected range (catches over/under-segmentation).
+- **expected apps** — the right applications appear.
+- **ordered actions** — key actions appear as an ordered subsequence across steps
+ (validates the reconstructed order, e.g. *open page → copy → into spreadsheet*).
+- **must-mention** — specific copied values/entities are surfaced.
+- **forbidden noise** — recorder bracketing (the Skill Recorder app), permission
+ dialogs, and tracking-param hops must **not** appear as steps. Scoped to step
+ titles/apps + intent, so the agent isn't penalized for *explaining* that it
+ correctly ignored noise.
+
+A forbidden-noise hit fails the scenario outright; otherwise pass = ≥80% of checks.
+
+`--judge` adds an optional second opinion: a separate Copilot agent grades
+faithfulness 0–5 against the scenario's ground truth (`judge.ts`). Off by default
+to keep runs deterministic.
+
+## Scenarios
+
+Business, repeatable knowledge-work patterns (`evals/scenarios/`):
+
+| id | task |
+|----|------|
+| `web-to-spreadsheet` | Copy pricing figures from a web page into a spreadsheet |
+| `invoice-extract` | Extract invoice rows from a web table into a spreadsheet |
+| `research-compile` | Research two articles and compile quotes into a note |
+| `directory-lookup` | Collect contact details from a directory into a spreadsheet |
+
+Each also exercises the describer's judgment: **pastes are inferred** (a paste
+emits no event), **recorder start/stop bracketing is dropped**, and **tracking
+params are merged**.
+
+## Add a scenario
+
+Create `evals/scenarios/<id>.ts` exporting a `Scenario`, and add it to
+`evals/scenarios/index.ts`. Build the event stream with the helpers in
+`scenario.ts` (`recorder`, `visit`, `appActivate`, `clipboard`, `terminal`,
+`marker`), and describe a good result in `rubric`. Keep `truth` accurate — it's
+what the `--judge` grades against.
+
+```ts
+export const myScenario: Scenario = {
+ id: "my-task",
+ title: "…",
+ truth: "What the user actually did, in plain language.",
+ build: () => [ recorder(0), ...visit(1500, "Google Chrome", url, title), clipboard(4000, "…"), recorder(8000) ],
+ rubric: { intentKeywordsAny: [["…"]], expectedApps: ["chrome"], orderedActions: [["…"]], forbidden: ["skill recorder"] },
+};
+```
+
+## Mock pages (`evals/mocks/`)
+
+Static, self-contained HTML fixtures matching the scenarios (`pricing.html`,
+`invoices.html`, `directory.html`, `article-habits.html`, `article-focus.html`;
+open `index.html` as a launcher). They're **safe** — nothing submits or sends.
+
+Use them for an optional **real** end-to-end capture: open a page in a browser,
+copy a value, paste it into TextEdit/Numbers *while the recorder is running*, then
+Stop and Analyze. This never performs an irreversible action (no emails, no
+messages, no saving over files). The synthetic scenarios reference the same
+pages/values, so a live capture should reconstruct the same intent + steps.
diff --git a/evals/electron-stub.mjs b/evals/electron-stub.mjs
new file mode 100644
index 0000000..436ea44
--- /dev/null
+++ b/evals/electron-stub.mjs
@@ -0,0 +1,39 @@
+// Headless stand-in for the `electron` module so the describer/pipeline code can
+// run under plain Node in the eval harness. The only real dependency in that code
+// path is `app.getPath` inside session-store.ts, and the harness overrides the
+// sessions root via SKILL_RECORDER_SESSIONS_DIR — so getPath is never actually
+// called. Everything else is a benign no-op provided only to satisfy static
+// `import { … } from "electron"` links in modules that might get pulled in.
+import os from "node:os";
+import path from "node:path";
+
+const notAvailable = (name) => () => {
+ throw new Error(`electron.${name} is not available in the headless eval runtime`);
+};
+
+export const app = {
+ getPath: (name) => path.join(os.tmpdir(), "skill-recorder-eval", String(name ?? "userData")),
+ getVersion: () => "0.0.0-eval",
+ getName: () => "skill-recorder-eval",
+ getAppPath: () => process.cwd(),
+ on: () => app,
+ whenReady: () => Promise.resolve(),
+ quit: () => undefined,
+};
+
+export const ipcMain = { handle: () => undefined, on: () => undefined, removeHandler: () => undefined };
+export const globalShortcut = { register: () => false, unregisterAll: () => undefined };
+export const clipboard = { readText: () => "", readImage: () => ({ isEmpty: () => true }), availableFormats: () => [] };
+export const screen = { getPrimaryDisplay: notAvailable("screen.getPrimaryDisplay"), getDisplayMatching: notAvailable("screen.getDisplayMatching") };
+export const desktopCapturer = { getSources: async () => [] };
+export const nativeImage = { createEmpty: () => ({ isEmpty: () => true }), createFromPath: () => ({ isEmpty: () => true }) };
+
+export class BrowserWindow {
+ constructor() { throw new Error("electron.BrowserWindow is not available in the headless eval runtime"); }
+}
+export class Menu {}
+export class Tray {
+ constructor() { throw new Error("electron.Tray is not available in the headless eval runtime"); }
+}
+
+export default { app, ipcMain, globalShortcut, clipboard, screen, desktopCapturer, nativeImage, BrowserWindow, Menu, Tray };
diff --git a/evals/hooks.mjs b/evals/hooks.mjs
new file mode 100644
index 0000000..35fa142
--- /dev/null
+++ b/evals/hooks.mjs
@@ -0,0 +1,31 @@
+// A Node module-resolution hook that lets the eval harness run the app's
+// TypeScript source directly (no bundler), by:
+// 1. redirecting the lone `electron` dependency to a headless stub, and
+// 2. resolving extensionless relative/absolute imports to their `.ts` file
+// (the project is authored Vite-style, without extensions).
+// Node itself strips/transforms the TypeScript (run with
+// `--experimental-transform-types`). Registered via register.mjs.
+import { existsSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath, pathToFileURL } from "node:url";
+
+const here = path.dirname(fileURLToPath(import.meta.url));
+const ELECTRON_STUB = pathToFileURL(path.join(here, "electron-stub.mjs")).href;
+
+export async function resolve(specifier, context, next) {
+ if (specifier === "electron") {
+ return { url: ELECTRON_STUB, shortCircuit: true };
+ }
+
+ const isRelative = specifier.startsWith("./") || specifier.startsWith("../");
+ if (isRelative && context.parentURL && !path.extname(specifier)) {
+ const base = path.resolve(path.dirname(fileURLToPath(context.parentURL)), specifier);
+ for (const candidate of [`${base}.ts`, path.join(base, "index.ts")]) {
+ if (existsSync(candidate)) {
+ return { url: pathToFileURL(candidate).href, shortCircuit: true };
+ }
+ }
+ }
+
+ return next(specifier, context);
+}
diff --git a/evals/judge.ts b/evals/judge.ts
new file mode 100644
index 0000000..063f16e
--- /dev/null
+++ b/evals/judge.ts
@@ -0,0 +1,91 @@
+// Optional semantic judge: asks a Copilot agent to rate how faithfully the
+// describer's analysis captures the scenario's ground-truth task. Off by default
+// (`--judge`); the deterministic rubric in scoring.ts is the primary signal. This
+// adds a qualitative, human-like second opinion for the overnight report.
+
+import { approveAll, CopilotClient, type Tool } from "@github/copilot-sdk";
+
+import type { Analysis } from "../common/analysis";
+import type { Scenario } from "./scenario";
+
+export interface JudgeResult {
+ score: number;
+ max: number;
+ verdict: string;
+ reasons: string;
+}
+
+const JUDGE_INSTRUCTIONS = `
+You are grading an AI system that reconstructs "what a user did" from captured OS
+events. You are given (1) the ground-truth description of the task and (2) the
+system's produced intent + ordered steps. Judge how faithfully the produced
+analysis captures the real task: correct overall intent, right key actions in the
+right order, no invented steps, and no leftover recorder/tool noise. Then call
+submit_judgement exactly once. Do not reply with prose.
+`.trim();
+
+function renderPrompt(scenario: Scenario, a: Analysis): string {
+ const steps = a.steps.map((s, i) => `${i + 1}. ${s.title} — ${s.detail}`).join("\n");
+ return [
+ `GROUND TRUTH (what the user actually did):`,
+ scenario.truth,
+ ``,
+ `PRODUCED ANALYSIS:`,
+ `intent (${a.intentConfidence}): ${a.intent}`,
+ `steps:`,
+ steps || "(none)",
+ ``,
+ `Grade faithfulness from 0 (wrong/unusable) to 5 (accurate and complete), then call submit_judgement.`,
+ ].join("\n");
+}
+
+export async function judgeAnalysis(
+ scenario: Scenario,
+ analysis: Analysis,
+ model?: string,
+): Promise<JudgeResult> {
+ const client = new CopilotClient();
+ await client.start();
+ try {
+ const holder: { result: JudgeResult | undefined } = { result: undefined };
+ const submit: Tool = {
+ name: "submit_judgement",
+ description: "Submit your final faithfulness grade (0–5) for the produced analysis.",
+ parameters: {
+ type: "object",
+ properties: {
+ score: { type: "number", description: "0–5 faithfulness grade." },
+ verdict: { type: "string", description: "A few words, e.g. 'accurate' or 'missed the paste step'." },
+ reasons: { type: "string", description: "1–3 sentences justifying the grade." },
+ },
+ required: ["score", "verdict"],
+ additionalProperties: false,
+ },
+ handler: (raw) => {
+ const r = (raw ?? {}) as { score?: number; verdict?: string; reasons?: string };
+ holder.result = {
+ score: Math.max(0, Math.min(5, Number(r.score) || 0)),
+ max: 5,
+ verdict: r.verdict ?? "",
+ reasons: r.reasons ?? "",
+ };
+ return "Judgement recorded.";
+ },
+ };
+
+ const session = await client.createSession({
+ systemMessage: { mode: "append", content: JUDGE_INSTRUCTIONS },
+ tools: [submit],
+ onPermissionRequest: approveAll,
+ enableHostGitOperations: false,
+ infiniteSessions: { enabled: false },
+ ...(model ? { model } : {}),
+ });
+ await session.sendAndWait(renderPrompt(scenario, analysis), 120_000);
+ await session.disconnect().catch(() => undefined);
+ if (!holder.result) throw new Error("judge did not submit a grade");
+ return holder.result;
+ } finally {
+ await client.stop().catch(() => undefined);
+ }
+}
diff --git a/evals/mocks/article-focus.html b/evals/mocks/article-focus.html
new file mode 100644
index 0000000..850549f
--- /dev/null
+++ b/evals/mocks/article-focus.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>The Power of Focus — Zen Habits (mock)</title>
+<style>
+ :root { --ink:#17201a; --muted:#5f6b62; --line:#e2e8e3; --accent:#2f8f5b; --paper:#f7faf7; }
+ body { margin:0; font:18px/1.75 Georgia,"Times New Roman",serif; color:var(--ink); background:var(--paper); }
+ .wrap { max-width:660px; margin:0 auto; padding:56px 28px 80px; }
+ .eyebrow { font:12px/1 -apple-system,Segoe UI,sans-serif; letter-spacing:.16em; text-transform:uppercase; color:var(--accent); }
+ h1 { font-size:36px; line-height:1.18; letter-spacing:-.01em; margin:12px 0 8px; }
+ .byline { font:14px/1 -apple-system,Segoe UI,sans-serif; color:var(--muted); margin-bottom:28px; }
+ blockquote { margin:26px 0; padding:4px 0 4px 20px; border-left:3px solid var(--accent); font-size:22px; line-height:1.5; }
+ p { margin:18px 0; }
+</style>
+</head>
+<body>
+ <div class="wrap">
+ <div class="eyebrow">Focus</div>
+ <h1>The power of one habit at a time</h1>
+ <div class="byline">By Leo · 4 min read · mock page for Skill Recorder evals</div>
+ <p>When we try to change everything at once, we usually change nothing. Our attention
+ is finite, and spreading it thin across a dozen new routines guarantees that none
+ of them take root.</p>
+ <blockquote>Focus on one habit at a time to make it stick.</blockquote>
+ <p>Pick the smallest version of the habit you can imagine. Do it every day, at the
+ same time, until it feels automatic. Only then add the next one.</p>
+ <p>Consistency beats intensity. A quiet, repeatable practice will outlast any burst of
+ motivation.</p>
+ </div>
+</body>
+</html>
diff --git a/evals/mocks/article-habits.html b/evals/mocks/article-habits.html
new file mode 100644
index 0000000..3992974
--- /dev/null
+++ b/evals/mocks/article-habits.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Atomic Habits — James Clear (mock)</title>
+<style>
+ :root { --ink:#1a1a17; --muted:#6b675e; --line:#e7e3d9; --accent:#b4531f; --paper:#faf7f0; }
+ body { margin:0; font:18px/1.7 Georgia,"Times New Roman",serif; color:var(--ink); background:var(--paper); }
+ .wrap { max-width:680px; margin:0 auto; padding:56px 28px 80px; }
+ .eyebrow { font:12px/1 -apple-system,Segoe UI,sans-serif; letter-spacing:.16em; text-transform:uppercase; color:var(--accent); }
+ h1 { font-size:38px; line-height:1.15; letter-spacing:-.01em; margin:12px 0 8px; }
+ .byline { font:14px/1 -apple-system,Segoe UI,sans-serif; color:var(--muted); margin-bottom:28px; }
+ blockquote { margin:28px 0; padding:4px 0 4px 20px; border-left:3px solid var(--accent); font-size:22px; line-height:1.5; }
+ p { margin:18px 0; }
+</style>
+</head>
+<body>
+ <div class="wrap">
+ <div class="eyebrow">Habits</div>
+ <h1>You fall to the level of your systems</h1>
+ <div class="byline">By James Clear · 6 min read · mock page for Skill Recorder evals</div>
+ <p>We often think progress comes from ambitious goals. But goals are about the
+ results you want to achieve. Systems are about the processes that lead to those
+ results.</p>
+ <blockquote>You do not rise to the level of your goals. You fall to the level of your systems.</blockquote>
+ <p>If you want better results, forget about setting goals for a while. Focus on your
+ system instead. The score takes care of itself when you tend to the inputs.</p>
+ <p>Small habits don't add up — they compound. That is why the seemingly minor choices
+ you make each day matter far more than the occasional dramatic effort.</p>
+ </div>
+</body>
+</html>
diff --git a/evals/mocks/directory.html b/evals/mocks/directory.html
new file mode 100644
index 0000000..ce4810b
--- /dev/null
+++ b/evals/mocks/directory.html
@@ -0,0 +1,58 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Team Directory — Acme</title>
+<style>
+ :root { --ink:#141a24; --muted:#5b6672; --line:#e4e8ee; --accent:#2f6bff; --paper:#fbfcfe; }
+ * { box-sizing:border-box; }
+ body { margin:0; font:15px/1.5 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
+ color:var(--ink); background:var(--paper); }
+ header { padding:24px 32px; border-bottom:1px solid var(--line); display:flex; align-items:baseline; gap:12px; }
+ .brand { font-weight:700; letter-spacing:-.02em; font-size:19px; }
+ .tag { color:var(--muted); font-size:13px; }
+ main { max-width:860px; margin:0 auto; padding:36px 32px 64px; }
+ h1 { font-size:26px; letter-spacing:-.02em; margin:0 0 20px; }
+ .people { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
+ .card { border:1px solid var(--line); border-radius:12px; padding:16px 18px; background:#fff; }
+ .name { font-weight:600; font-size:16px; }
+ .role { color:var(--muted); font-size:13px; margin-bottom:10px; }
+ .row { font-size:14px; }
+ .row .k { display:inline-block; width:56px; color:var(--muted); }
+ a { color:var(--accent); text-decoration:none; }
+</style>
+</head>
+<body>
+ <header><div class="brand">Acme</div><div class="tag">Intranet · Team Directory</div></header>
+ <main>
+ <h1>Team directory</h1>
+ <section class="people">
+ <article class="card">
+ <div class="name">Dana Lee</div>
+ <div class="role">Product Design · Design</div>
+ <div class="row"><span class="k">Email</span><a href="mailto:[email protected]">[email protected]</a></div>
+ <div class="row"><span class="k">Phone</span>+1 555 0142</div>
+ </article>
+ <article class="card">
+ <div class="name">Sam Ortiz</div>
+ <div class="role">Backend Engineer · Platform</div>
+ <div class="row"><span class="k">Email</span><a href="mailto:[email protected]">[email protected]</a></div>
+ <div class="row"><span class="k">Phone</span>+1 555 0177</div>
+ </article>
+ <article class="card">
+ <div class="name">Priya Nair</div>
+ <div class="role">Data Analyst · Insights</div>
+ <div class="row"><span class="k">Email</span><a href="mailto:[email protected]">[email protected]</a></div>
+ <div class="row"><span class="k">Phone</span>+1 555 0193</div>
+ </article>
+ <article class="card">
+ <div class="name">Marco Rossi</div>
+ <div class="role">Account Executive · Sales</div>
+ <div class="row"><span class="k">Email</span><a href="mailto:[email protected]">[email protected]</a></div>
+ <div class="row"><span class="k">Phone</span>+1 555 0128</div>
+ </article>
+ </section>
+ </main>
+</body>
+</html>
diff --git a/evals/mocks/index.html b/evals/mocks/index.html
new file mode 100644
index 0000000..def4b4c
--- /dev/null
+++ b/evals/mocks/index.html
@@ -0,0 +1,33 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Skill Recorder — Mock Pages</title>
+<style>
+ :root { --ink:#141a24; --muted:#5b6672; --line:#e4e8ee; --accent:#2f6bff; --paper:#fbfcfe; }
+ body { margin:0; font:16px/1.55 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
+ color:var(--ink); background:var(--paper); }
+ .wrap { max-width:640px; margin:0 auto; padding:56px 28px; }
+ h1 { font-size:26px; letter-spacing:-.02em; margin:0 0 6px; }
+ p.lede { color:var(--muted); margin:0 0 28px; }
+ a.card { display:block; border:1px solid var(--line); border-radius:12px; padding:16px 18px;
+ margin:10px 0; background:#fff; text-decoration:none; color:inherit; }
+ a.card:hover { border-color:var(--accent); }
+ .card b { display:block; font-size:16px; }
+ .card span { color:var(--muted); font-size:13px; }
+</style>
+</head>
+<body>
+ <div class="wrap">
+ <h1>Mock pages for evals</h1>
+ <p class="lede">Static fixtures used by the Skill Recorder eval scenarios. Safe to open
+ and copy from — nothing here submits or sends anything.</p>
+ <a class="card" href="pricing.html"><b>Pricing — Acme</b><span>web-to-spreadsheet</span></a>
+ <a class="card" href="invoices.html"><b>Invoices — Acme Books</b><span>invoice-extract</span></a>
+ <a class="card" href="directory.html"><b>Team Directory — Acme</b><span>directory-lookup</span></a>
+ <a class="card" href="article-habits.html"><b>Atomic Habits — James Clear</b><span>research-compile</span></a>
+ <a class="card" href="article-focus.html"><b>The Power of Focus — Zen Habits</b><span>research-compile</span></a>
+ </div>
+</body>
+</html>
diff --git a/evals/mocks/invoices.html b/evals/mocks/invoices.html
new file mode 100644
index 0000000..d570a82
--- /dev/null
+++ b/evals/mocks/invoices.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Invoices — Acme Books</title>
+<style>
+ :root { --ink:#141a24; --muted:#5b6672; --line:#e4e8ee; --accent:#2f6bff; --paper:#fbfcfe; }
+ * { box-sizing:border-box; }
+ body { margin:0; font:15px/1.5 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
+ color:var(--ink); background:var(--paper); }
+ header { padding:24px 32px; border-bottom:1px solid var(--line); display:flex; align-items:baseline; gap:12px; }
+ .brand { font-weight:700; letter-spacing:-.02em; font-size:19px; }
+ .tag { color:var(--muted); font-size:13px; }
+ main { max-width:820px; margin:0 auto; padding:36px 32px 64px; }
+ h1 { font-size:26px; letter-spacing:-.02em; margin:0 0 20px; }
+ table { width:100%; border-collapse:collapse; background:#fff; border:1px solid var(--line); border-radius:12px; overflow:hidden; }
+ th, td { text-align:left; padding:12px 16px; border-bottom:1px solid var(--line); }
+ th { font-size:12px; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); background:#f6f8fb; }
+ tbody tr:last-child td { border-bottom:none; }
+ td.amount { text-align:right; font-variant-numeric:tabular-nums; font-weight:600; }
+ .status { font-size:12px; padding:2px 8px; border-radius:999px; background:#eef2f7; color:var(--muted); }
+ .status.due { background:#fff2e8; color:#b4530f; }
+</style>
+</head>
+<body>
+ <header><div class="brand">Acme Books</div><div class="tag">Accounts · Invoices</div></header>
+ <main>
+ <h1>Outstanding invoices — Q3</h1>
+ <table>
+ <thead>
+ <tr><th>Invoice</th><th>Customer</th><th>Status</th><th style="text-align:right">Amount</th></tr>
+ </thead>
+ <tbody>
+ <tr><td>INV-1001</td><td>Soylent</td><td><span class="status">Paid</span></td><td class="amount">$620.00</td></tr>
+ <tr><td>INV-1002</td><td>Globex</td><td><span class="status due">Due</span></td><td class="amount">$1,250.00</td></tr>
+ <tr><td>INV-1003</td><td>Initech</td><td><span class="status due">Due</span></td><td class="amount">$980.00</td></tr>
+ <tr><td>INV-1004</td><td>Umbrella</td><td><span class="status due">Due</span></td><td class="amount">$3,400.00</td></tr>
+ <tr><td>INV-1005</td><td>Hooli</td><td><span class="status">Paid</span></td><td class="amount">$210.00</td></tr>
+ </tbody>
+ </table>
+ </main>
+</body>
+</html>
diff --git a/evals/mocks/pricing.html b/evals/mocks/pricing.html
new file mode 100644
index 0000000..14afe42
--- /dev/null
+++ b/evals/mocks/pricing.html
@@ -0,0 +1,61 @@
+<!doctype html>
+<html lang="en">
+<head>
+<meta charset="utf-8" />
+<meta name="viewport" content="width=device-width, initial-scale=1" />
+<title>Pricing — Acme</title>
+<style>
+ :root { --ink:#141a24; --muted:#5b6672; --line:#e4e8ee; --accent:#2f6bff; --paper:#fbfcfe; }
+ * { box-sizing:border-box; }
+ body { margin:0; font:16px/1.55 -apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
+ color:var(--ink); background:var(--paper); }
+ header { padding:28px 32px; border-bottom:1px solid var(--line); display:flex; align-items:baseline; gap:12px; }
+ .brand { font-weight:700; letter-spacing:-.02em; font-size:20px; }
+ .brand span { color:var(--accent); }
+ .tag { color:var(--muted); font-size:13px; }
+ main { max-width:900px; margin:0 auto; padding:40px 32px 64px; }
+ h1 { font-size:30px; letter-spacing:-.02em; margin:0 0 6px; }
+ .lede { color:var(--muted); margin:0 0 32px; }
+ .plans { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
+ .plan { border:1px solid var(--line); border-radius:14px; padding:22px; background:#fff; }
+ .plan.pro { border-color:var(--accent); box-shadow:0 6px 24px rgba(47,107,255,.10); }
+ .plan h2 { margin:0 0 4px; font-size:18px; }
+ .plan .who { color:var(--muted); font-size:13px; min-height:34px; }
+ .price { font-size:34px; font-weight:700; letter-spacing:-.03em; margin:10px 0 2px; }
+ .price small { font-size:14px; font-weight:500; color:var(--muted); }
+ .annual { color:var(--muted); font-size:14px; }
+ ul { padding-left:18px; margin:14px 0 0; color:#31404f; }
+ li { margin:5px 0; }
+</style>
+</head>
+<body>
+ <header><div class="brand">Acme<span>·</span></div><div class="tag">Product · Pricing</div></header>
+ <main>
+ <h1>Simple, transparent pricing</h1>
+ <p class="lede">Pick a plan. Upgrade or cancel anytime.</p>
+ <section class="plans">
+ <article class="plan">
+ <h2>Starter</h2>
+ <div class="who">For individuals getting started.</div>
+ <div class="price">$0 <small>/ month</small></div>
+ <div class="annual">Free forever</div>
+ <ul><li>1 project</li><li>Community support</li><li>1 GB storage</li></ul>
+ </article>
+ <article class="plan pro">
+ <h2>Pro</h2>
+ <div class="who">For professionals who need more.</div>
+ <div class="price">$49 <small>/ month</small></div>
+ <div class="annual">or $490 / year (save 17%)</div>
+ <ul><li>Unlimited projects</li><li>Priority support</li><li>100 GB storage</li></ul>
+ </article>
+ <article class="plan">
+ <h2>Team</h2>
+ <div class="who">For growing teams.</div>
+ <div class="price">$129 <small>/ month</small></div>
+ <div class="annual">or $1,290 / year</div>
+ <ul><li>Everything in Pro</li><li>SSO &amp; roles</li><li>1 TB storage</li></ul>
+ </article>
+ </section>
+ </main>
+</body>
+</html>
diff --git a/evals/register.mjs b/evals/register.mjs
new file mode 100644
index 0000000..665792a
--- /dev/null
+++ b/evals/register.mjs
@@ -0,0 +1,5 @@
+// Registers the resolution hooks (hooks.mjs) for the eval harness. Pass to Node
+// with `--import ./evals/register.mjs` so the hooks are active before the harness
+// entry (and all the app TypeScript it imports) is loaded.
+import { register } from "node:module";
+register("./hooks.mjs", import.meta.url);
diff --git a/evals/run.ts b/evals/run.ts
new file mode 100644
index 0000000..3f98062
--- /dev/null
+++ b/evals/run.ts
@@ -0,0 +1,170 @@
+// Eval harness: runs the multi-turn Copilot describer against each fixed
+// scenario and scores the resulting analysis against its rubric.
+//
+// For every scenario it: materializes a synthetic session (session.json +
+// events.jsonl) into a temp sessions root, runs the real post-stop pipeline
+// (processSession → bundle.json + description.md), invokes the real
+// Describer.analyze (the same agent the app uses), then scores the analysis.
+//
+// Run:
+// node --experimental-transform-types --import ./evals/register.mjs evals/run.ts [flags]
+// Flags:
+// --only=slug,slug run a subset of scenarios
+// --judge also run the optional semantic LLM judge
+// --keep print the temp sessions dir (artifacts kept for inspection)
+// --model=<id> override the describer model (else auto vision model)
+
+import { mkdirSync, mkdtempSync, writeFileSync } from "node:fs";
+import os from "node:os";
+import path from "node:path";
+
+import type { Analysis } from "../common/analysis";
+import { processSession } from "../electron/pipeline";
+import { Describer } from "../electron/describer/describer";
+import { judgeAnalysis, type JudgeResult } from "./judge";
+import { makeSessionMeta, materializeEvents, type Scenario } from "./scenario";
+import { scenarios } from "./scenarios/index";
+import { scoreAnalysis, type ScoreResult } from "./scoring";
+
+interface Flags {
+ only: Set<string> | null;
+ judge: boolean;
+ keep: boolean;
+ model?: string;
+}
+
+function parseFlags(argv: string[]): Flags {
+ const flags: Flags = { only: null, judge: false, keep: false };
+ for (const arg of argv) {
+ if (arg.startsWith("--only=")) flags.only = new Set(arg.slice(7).split(",").map((s) => s.trim()).filter(Boolean));
+ else if (arg === "--judge") flags.judge = true;
+ else if (arg === "--keep") flags.keep = true;
+ else if (arg.startsWith("--model=")) flags.model = arg.slice(8);
+ }
+ return flags;
+}
+
+interface ScenarioResult {
+ id: string;
+ title: string;
+ ok: boolean;
+ error?: string;
+ durationMs: number;
+ stepCount?: number;
+ intent?: string;
+ score?: ScoreResult;
+ judge?: JudgeResult;
+}
+
+function materialize(root: string, scenario: Scenario): string {
+ const startedAt = Date.now();
+ const raw = scenario.build();
+ const durationMs = Math.max(0, ...raw.map((e) => e.atMs)) + 1000;
+ const events = materializeEvents(raw, startedAt);
+ const meta = makeSessionMeta(scenario.id, startedAt, durationMs, scenario.platform ?? "darwin");
+
+ const dir = path.join(root, scenario.id);
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(dir, "session.json"), JSON.stringify(meta, null, 2));
+ writeFileSync(
+ path.join(dir, "events.jsonl"),
+ events.map((e) => JSON.stringify(e)).join("\n") + "\n",
+ );
+ return dir;
+}
+
+const bar = "─".repeat(64);
+
+async function main(): Promise<void> {
+ const flags = parseFlags(process.argv.slice(2));
+ if (flags.model) process.env.SKILL_RECORDER_MODEL = flags.model;
+
+ // Sessions root: honor an external override, else an isolated temp dir.
+ let root = process.env.SKILL_RECORDER_SESSIONS_DIR;
+ if (!root) {
+ root = mkdtempSync(path.join(os.tmpdir(), "sr-evals-"));
+ process.env.SKILL_RECORDER_SESSIONS_DIR = root;
+ }
+
+ const selected = scenarios.filter((s) => !flags.only || flags.only.has(s.id));
+ if (selected.length === 0) {
+ console.error("No scenarios matched", flags.only ? [...flags.only] : "");
+ process.exit(2);
+ }
+
+ console.error(`\nSkill Recorder — describer evals`);
+ console.error(`${selected.length} scenario(s) · sessions root: ${root}`);
+ if (flags.judge) console.error("semantic judge: ON");
+ console.error(bar);
+
+ const describer = new Describer((p) => {
+ if (p.message) process.stderr.write(` · [${p.sessionId}] ${p.message}\n`);
+ });
+
+ const results: ScenarioResult[] = [];
+ for (const scenario of selected) {
+ console.error(`\n▶ ${scenario.id} — ${scenario.title}`);
+ const started = Date.now();
+ const res: ScenarioResult = { id: scenario.id, title: scenario.title, ok: false, durationMs: 0 };
+ try {
+ const dir = materialize(root, scenario);
+ await processSession(dir);
+ const analysis: Analysis = await describer.analyze(scenario.id);
+ res.stepCount = analysis.steps.length;
+ res.intent = analysis.intent;
+ res.score = scoreAnalysis(analysis, scenario.rubric);
+ res.ok = res.score.pass;
+ if (flags.judge) {
+ try {
+ res.judge = await judgeAnalysis(scenario, analysis, flags.model);
+ } catch (err) {
+ console.error(` judge failed: ${err instanceof Error ? err.message : String(err)}`);
+ }
+ }
+ } catch (err) {
+ res.error = err instanceof Error ? err.message : String(err);
+ }
+ res.durationMs = Date.now() - started;
+ results.push(res);
+ printScenario(res);
+ }
+
+ await describer.dispose();
+
+ // Persist + summarize.
+ const stamp = new Date().toISOString().replace(/[:.]/g, "-");
+ const outFile = path.join(process.cwd(), "evals", "results", `${stamp}.json`);
+ mkdirSync(path.dirname(outFile), { recursive: true });
+ writeFileSync(outFile, JSON.stringify({ at: stamp, root, results }, null, 2));
+
+ console.error(`\n${bar}\nSummary`);
+ const passed = results.filter((r) => r.ok).length;
+ for (const r of results) {
+ const pct = r.score ? `${Math.round(r.score.score * 100)}%` : " — ";
+ const status = r.error ? "ERROR" : r.ok ? "PASS " : "FAIL ";
+ console.error(` ${status} ${pct.padStart(4)} ${r.id}${r.error ? ` (${r.error})` : ""}`);
+ }
+ console.error(`\n ${passed}/${results.length} scenarios passed`);
+ if (flags.keep) console.error(` artifacts: ${root}`);
+ console.error(` results: ${path.relative(process.cwd(), outFile)}\n`);
+
+ process.exit(passed === results.length ? 0 : 1);
+}
+
+function printScenario(r: ScenarioResult): void {
+ if (r.error) {
+ console.error(` ✗ error: ${r.error}`);
+ return;
+ }
+ console.error(` intent: ${r.intent}`);
+ console.error(` steps: ${r.stepCount} · score: ${Math.round((r.score?.score ?? 0) * 100)}% · ${r.ok ? "PASS" : "FAIL"} · ${(r.durationMs / 1000).toFixed(1)}s`);
+ for (const c of r.score?.checks ?? []) {
+ if (!c.pass) console.error(` ✗ ${c.name}${c.detail ? ` — ${c.detail}` : ""}`);
+ }
+ if (r.judge) console.error(` judge: ${r.judge.score}/5 — ${r.judge.verdict}`);
+}
+
+main().catch((err) => {
+ console.error("Harness crashed:", err);
+ process.exit(3);
+});
diff --git a/evals/scenario.ts b/evals/scenario.ts
new file mode 100644
index 0000000..2b7a4b0
--- /dev/null
+++ b/evals/scenario.ts
@@ -0,0 +1,186 @@
+// Scenario model + authoring helpers for the describer evals.
+//
+// A scenario is a fixed, synthetic recording (a list of captured OS events) plus
+// a rubric describing what a good analysis of it looks like. Fixtures are
+// deterministic and video-less on purpose: they isolate the part of the system
+// with real variance — the multi-turn Copilot describer — from flaky live
+// capture, so the eval is repeatable. The events are authored to mirror what the
+// real collectors would emit for the same task (see evals/mocks/*.html for the
+// pages these flows reference).
+
+import { EventType } from "../common/events";
+import type { RecEvent, SessionMeta } from "../common/types";
+
+/** An event as authored in a scenario: just a time offset + type + payload. */
+export interface RawEvent {
+ /** Milliseconds since the user pressed Start. */
+ atMs: number;
+ type: string;
+ source?: string;
+ payload: Record<string, unknown>;
+}
+
+/** Deterministic scoring rubric for a scenario's analysis. */
+export interface Rubric {
+ /** Every keyword must appear (case-insensitive) in the intent sentence. */
+ intentKeywordsAll?: string[];
+ /** Each group: at least one of its keywords must appear in the intent. */
+ intentKeywordsAny?: string[][];
+ minSteps?: number;
+ maxSteps?: number;
+ /** Each app must appear in the union of the steps' apps/text (substring, ci). */
+ expectedApps?: string[];
+ /**
+ * Ordered flow: each group is a set of synonyms; the groups must appear as an
+ * ordered subsequence across the steps (any synonym satisfies its group).
+ */
+ orderedActions?: string[][];
+ /** Anywhere across the steps' text, each group needs at least one match. */
+ mustMentionAny?: string[][];
+ /** None of these may appear anywhere in the intent or steps text (noise). */
+ forbidden?: string[];
+}
+
+export interface Scenario {
+ /** Slug used for the session id and result keys. */
+ id: string;
+ /** Human-readable title. */
+ title: string;
+ platform?: NodeJS.Platform;
+ /** Ground-truth description of the task (for docs + the optional LLM judge). */
+ truth: string;
+ /** Produce the ordered raw events for this recording. */
+ build: () => RawEvent[];
+ rubric: Rubric;
+}
+
+// --- Event authoring helpers ------------------------------------------------
+
+const RECORDER_APP = "Skill Recorder";
+
+/** Focus the Skill Recorder window (to press Start/Stop) — recorder bracketing. */
+export const recorder = (atMs: number, title = "Skill Recorder"): RawEvent => ({
+ atMs,
+ type: EventType.AppActivate,
+ source: "active-window",
+ payload: { app: RECORDER_APP, title },
+});
+
+export const appActivate = (
+ atMs: number,
+ app: string,
+ title: string,
+ extra: Partial<Record<string, unknown>> = {},
+): RawEvent => ({
+ atMs,
+ type: EventType.AppActivate,
+ source: "active-window",
+ payload: { app, title, ...extra },
+});
+
+export const titleChange = (atMs: number, app: string, title: string): RawEvent => ({
+ atMs,
+ type: EventType.AppTitleChange,
+ source: "active-window",
+ payload: { app, title },
+});
+
+export const browserUrl = (
+ atMs: number,
+ app: string,
+ url: string,
+ title?: string,
+): RawEvent => {
+ let host: string | undefined;
+ try {
+ host = new URL(url).host;
+ } catch {
+ host = undefined;
+ }
+ return {
+ atMs,
+ type: EventType.BrowserUrl,
+ source: "active-window",
+ payload: { app, url, host, ...(title ? { title } : {}) },
+ };
+};
+
+/** A page visit: emit both the app focus (with url) and a browser.url event. */
+export const visit = (
+ atMs: number,
+ app: string,
+ url: string,
+ title: string,
+): RawEvent[] => {
+ let host: string | undefined;
+ try {
+ host = new URL(url).host;
+ } catch {
+ host = undefined;
+ }
+ return [
+ appActivate(atMs, app, title, { url, host }),
+ browserUrl(atMs + 1, app, url, title),
+ ];
+};
+
+export const clipboard = (atMs: number, text: string, formats: string[] = ["text/plain"]): RawEvent => ({
+ atMs,
+ type: EventType.ClipboardChange,
+ source: "clipboard",
+ payload: {
+ formats,
+ length: text.length,
+ hash: `h${text.length}_${text.slice(0, 8)}`,
+ textPreview: text,
+ },
+});
+
+export const terminal = (
+ atMs: number,
+ command: string,
+ cwd: string,
+ extra: Partial<Record<string, unknown>> = {},
+): RawEvent => ({
+ atMs,
+ type: EventType.TerminalCommand,
+ source: "terminal",
+ payload: { command, cwd, shell: "zsh", ...extra },
+});
+
+export const marker = (atMs: number, note: string): RawEvent => ({
+ atMs,
+ type: EventType.Marker,
+ source: "ui",
+ payload: { note },
+});
+
+// --- Materialization --------------------------------------------------------
+
+/** Stamp raw events into on-disk RecEvents (seq/t/epoch) sorted by time. */
+export function materializeEvents(raw: RawEvent[], startedAt: number): RecEvent[] {
+ const sorted = [...raw].sort((a, b) => a.atMs - b.atMs);
+ return sorted.map((e, i) => ({
+ seq: i,
+ t: e.atMs,
+ epoch: startedAt + e.atMs,
+ type: e.type,
+ source: e.source ?? "eval",
+ payload: e.payload,
+ }));
+}
+
+export function makeSessionMeta(
+ id: string,
+ startedAt: number,
+ durationMs: number,
+ platform: NodeJS.Platform,
+): SessionMeta {
+ return {
+ id,
+ startedAt,
+ stoppedAt: startedAt + durationMs,
+ platform,
+ appVersion: "eval",
+ };
+}
diff --git a/evals/scenarios/directory-lookup.ts b/evals/scenarios/directory-lookup.ts
new file mode 100644
index 0000000..a0458ba
--- /dev/null
+++ b/evals/scenarios/directory-lookup.ts
@@ -0,0 +1,46 @@
+// Scenario: look up people in a directory and build a contact list in a sheet.
+// Two lookup→copy→switch cycles against an intranet directory. Tests a
+// back-and-forth "collect contact details into a spreadsheet" flow.
+
+import { appActivate, clipboard, recorder, visit, type Scenario } from "../scenario";
+
+const CHROME = "Google Chrome";
+const NUMBERS = "Numbers";
+const DIR = "https://intranet.acme.example/directory";
+
+export const directoryLookup: Scenario = {
+ id: "directory-lookup",
+ title: "Collect contact details from a directory into a spreadsheet",
+ truth:
+ "The user opened the company team directory in Chrome, copied one person's contact " +
+ "line (Dana Lee — [email protected] — +1 555 0142) and pasted it into a Contacts " +
+ "spreadsheet in Numbers, then returned to the directory, copied a second person " +
+ "(Sam Ortiz — [email protected] — +1 555 0177) and pasted that too — building a " +
+ "contact list.",
+ build: () => [
+ recorder(0),
+ ...visit(1500, CHROME, DIR, "Team Directory — Acme"),
+ clipboard(4000, "Dana Lee — [email protected] — +1 555 0142"),
+ appActivate(6000, NUMBERS, "Contacts — Numbers"), // paste #1 (inferred)
+ appActivate(8200, CHROME, "Team Directory — Acme", { url: DIR, host: "intranet.acme.example" }),
+ clipboard(10200, "Sam Ortiz — [email protected] — +1 555 0177"),
+ appActivate(12400, NUMBERS, "Contacts — Numbers"), // paste #2 (inferred)
+ recorder(14500),
+ ],
+ rubric: {
+ intentKeywordsAny: [
+ ["contact", "contacts", "directory", "email", "phone", "people", "roster"],
+ ["spreadsheet", "numbers", "list", "copy", "collect", "compile", "gather"],
+ ],
+ minSteps: 2,
+ maxSteps: 7,
+ expectedApps: ["chrome", "numbers"],
+ orderedActions: [
+ ["directory", "team", "intranet", "web"],
+ ["copy", "copied"],
+ ["numbers", "spreadsheet", "contacts", "paste"],
+ ],
+ mustMentionAny: [["email", "@acme", "phone", "contact", "dana", "sam"]],
+ forbidden: ["skill recorder", "usernotificationcenter"],
+ },
+};
diff --git a/evals/scenarios/index.ts b/evals/scenarios/index.ts
new file mode 100644
index 0000000..3bb1694
--- /dev/null
+++ b/evals/scenarios/index.ts
@@ -0,0 +1,13 @@
+import type { Scenario } from "../scenario";
+import { directoryLookup } from "./directory-lookup";
+import { invoiceExtract } from "./invoice-extract";
+import { researchCompile } from "./research-compile";
+import { webToSpreadsheet } from "./web-to-spreadsheet";
+
+/** All eval scenarios, in run order. */
+export const scenarios: Scenario[] = [
+ webToSpreadsheet,
+ invoiceExtract,
+ researchCompile,
+ directoryLookup,
+];
diff --git a/evals/scenarios/invoice-extract.ts b/evals/scenarios/invoice-extract.ts
new file mode 100644
index 0000000..207c7a2
--- /dev/null
+++ b/evals/scenarios/invoice-extract.ts
@@ -0,0 +1,43 @@
+// Scenario: extract several rows from a web data table into a spreadsheet.
+// Three sequential clipboard copies from one invoices page, then a switch to a
+// spreadsheet. Tests multi-record extraction (the "copy a table into a sheet" job).
+
+import { appActivate, clipboard, recorder, visit, type Scenario } from "../scenario";
+
+const CHROME = "Google Chrome";
+const NUMBERS = "Numbers";
+
+export const invoiceExtract: Scenario = {
+ id: "invoice-extract",
+ title: "Extract invoice rows from a web table into a spreadsheet",
+ truth:
+ "The user opened an invoices list page in Chrome and copied three invoice rows " +
+ "(INV-1002 Globex $1,250.00, INV-1003 Initech $980.00, INV-1004 Umbrella $3,400.00), " +
+ "then switched to a Numbers spreadsheet to paste them — extracting the invoice table " +
+ "into the spreadsheet.",
+ build: () => [
+ recorder(0),
+ ...visit(1500, CHROME, "https://books.acme.example/invoices", "Invoices — Acme Books"),
+ clipboard(4000, "INV-1002\tGlobex\t$1,250.00"),
+ clipboard(6500, "INV-1003\tInitech\t$980.00"),
+ clipboard(9000, "INV-1004\tUmbrella\t$3,400.00"),
+ appActivate(11500, NUMBERS, "Q3 Invoices — Numbers"), // paste rows (inferred)
+ recorder(13500),
+ ],
+ rubric: {
+ intentKeywordsAny: [
+ ["invoice", "invoices", "billing", "table", "rows"],
+ ["spreadsheet", "numbers", "extract", "copy", "enter", "record", "transfer"],
+ ],
+ minSteps: 3,
+ maxSteps: 8,
+ expectedApps: ["chrome", "numbers"],
+ orderedActions: [
+ ["invoice", "acme books", "invoices page", "web", "table"],
+ ["copy", "copied"],
+ ["numbers", "spreadsheet", "paste", "enter"],
+ ],
+ mustMentionAny: [["inv-100", "globex", "initech", "umbrella", "1,250", "invoice", "amount", "row"]],
+ forbidden: ["skill recorder", "usernotificationcenter"],
+ },
+};
diff --git a/evals/scenarios/research-compile.ts b/evals/scenarios/research-compile.ts
new file mode 100644
index 0000000..f2ca519
--- /dev/null
+++ b/evals/scenarios/research-compile.ts
@@ -0,0 +1,53 @@
+// Scenario: research a topic across two articles and compile quotes into a note.
+// Signals: a Google search, two article visits, two clipboard copies, then a
+// switch to a text editor (the paste is inferred). A common knowledge-work task.
+
+import { appActivate, clipboard, recorder, visit, type Scenario } from "../scenario";
+
+const CHROME = "Google Chrome";
+const EDITOR = "TextEdit";
+
+export const researchCompile: Scenario = {
+ id: "research-compile",
+ title: "Research a topic and compile quotes into a note",
+ truth:
+ "The user searched Google for material on building better habits, opened two " +
+ "articles (James Clear's Atomic Habits page and a Zen Habits post), copied a key " +
+ "sentence from each, then switched to TextEdit to paste the quotes into a notes " +
+ "document — gathering and compiling research quotes.",
+ build: () => [
+ recorder(0),
+ ...visit(
+ 1500,
+ CHROME,
+ "https://www.google.com/search?q=building+better+habits",
+ "building better habits - Google Search",
+ ),
+ ...visit(4200, CHROME, "https://jamesclear.com/atomic-habits", "Atomic Habits — James Clear"),
+ clipboard(
+ 7000,
+ "You do not rise to the level of your goals. You fall to the level of your systems.",
+ ),
+ ...visit(10200, CHROME, "https://zenhabits.net/focus/", "The Power of Focus — Zen Habits"),
+ clipboard(13000, "Focus on one habit at a time to make it stick."),
+ appActivate(16000, EDITOR, "habits-notes.txt — Edited"), // paste both quotes (inferred)
+ recorder(18500),
+ ],
+ rubric: {
+ intentKeywordsAny: [
+ ["research", "compile", "gather", "collect", "summar", "notes", "quote"],
+ ["habit", "habits"],
+ ],
+ minSteps: 3,
+ maxSteps: 8,
+ expectedApps: ["chrome", "textedit"],
+ orderedActions: [
+ ["google", "search"],
+ ["article", "atomic", "james clear", "jamesclear", "zen habits", "zenhabits", "read"],
+ ["copy", "copied", "quote"],
+ ["textedit", "note", "notes", "paste", "document"],
+ ],
+ mustMentionAny: [["quote", "sentence", "passage", "text", "habit"]],
+ forbidden: ["skill recorder", "usernotificationcenter"],
+ },
+};
diff --git a/evals/scenarios/web-to-spreadsheet.ts b/evals/scenarios/web-to-spreadsheet.ts
new file mode 100644
index 0000000..b2b11f0
--- /dev/null
+++ b/evals/scenarios/web-to-spreadsheet.ts
@@ -0,0 +1,56 @@
+// Scenario: copy pricing figures from a web page into a spreadsheet.
+// The canonical "copy info from a website into a spreadsheet" business task.
+// Note the pastes are invisible to the collectors (a paste emits no clipboard
+// event) — the describer must infer them from "copy, then switch to the
+// spreadsheet". Also seeds recorder bracketing + a tracking param as noise.
+
+import {
+ appActivate,
+ clipboard,
+ marker,
+ recorder,
+ visit,
+ type Scenario,
+} from "../scenario";
+
+const CHROME = "Google Chrome";
+const NUMBERS = "Numbers";
+const PRICING = "https://acme.example/pricing";
+const PRICING_TRACKED = "https://acme.example/pricing?utm_source=newsletter&gclid=abc123";
+
+export const webToSpreadsheet: Scenario = {
+ id: "web-to-spreadsheet",
+ title: "Copy pricing from a website into a spreadsheet",
+ truth:
+ "The user opened the Acme pricing page in Chrome, copied the Pro plan's monthly " +
+ "price ($49) and annual price ($490), and pasted each into a budget spreadsheet in " +
+ "Numbers — transferring the two pricing figures from the web page into the spreadsheet.",
+ build: () => [
+ recorder(0), // Start pressed
+ ...visit(1500, CHROME, PRICING_TRACKED, "Pricing — Acme"),
+ ...visit(3200, CHROME, PRICING, "Pricing — Acme"), // tracking params stripped on nav
+ clipboard(4300, "$49 / month"), // copied Pro monthly price
+ appActivate(6000, NUMBERS, "Budget 2026 — Numbers"), // paste #1 (inferred)
+ appActivate(8200, CHROME, "Pricing — Acme", { url: PRICING, host: "acme.example" }),
+ clipboard(9600, "$490 / year"), // copied Pro annual price
+ appActivate(11200, NUMBERS, "Budget 2026 — Numbers"), // paste #2 (inferred)
+ marker(12000, "entered both prices"),
+ recorder(14000), // Stop pressed
+ ],
+ rubric: {
+ intentKeywordsAny: [
+ ["price", "pricing", "cost"],
+ ["spreadsheet", "numbers", "budget"],
+ ],
+ minSteps: 2,
+ maxSteps: 6,
+ expectedApps: ["chrome", "numbers"],
+ orderedActions: [
+ ["pricing", "acme", "web page", "webpage", "chrome", "browser"],
+ ["copy", "copied", "copies"],
+ ["numbers", "spreadsheet", "budget", "paste"],
+ ],
+ mustMentionAny: [["$49", "49", "$490", "490", "price", "pricing"]],
+ forbidden: ["skill recorder", "usernotificationcenter", "gclid", "utm_source"],
+ },
+};
diff --git a/evals/scoring.ts b/evals/scoring.ts
new file mode 100644
index 0000000..709bcd7
--- /dev/null
+++ b/evals/scoring.ts
@@ -0,0 +1,135 @@
+// Deterministic, LLM-free scoring of a describer analysis against a scenario
+// rubric. Repeatable and fast: this is the pass/fail signal for the eval loop.
+// (An optional semantic LLM judge lives in judge.ts and is off by default.)
+
+import type { Analysis } from "../common/analysis";
+import type { Rubric } from "./scenario";
+
+export interface CheckResult {
+ name: string;
+ pass: boolean;
+ detail?: string;
+ /** A forbidden-noise failure fails the whole scenario regardless of score. */
+ critical?: boolean;
+}
+
+export interface ScoreResult {
+ score: number; // 0..1 over all checks
+ pass: boolean;
+ checks: CheckResult[];
+}
+
+const PASS_THRESHOLD = 0.8;
+
+const lc = (s: string) => s.toLowerCase();
+
+function stepTexts(a: Analysis): string[] {
+ return a.steps.map((s) =>
+ lc([s.title, s.detail, s.apps.join(" "), s.evidence.join(" ")].join(" ")),
+ );
+}
+
+/** Are the synonym groups present as an ordered (non-decreasing) subsequence? */
+function orderedSubsequence(
+ texts: string[],
+ groups: string[][],
+): { pass: boolean; missing: string[] } {
+ let ptr = 0;
+ const missing: string[] = [];
+ for (const group of groups) {
+ let found = -1;
+ for (let i = ptr; i < texts.length; i++) {
+ if (group.some((g) => texts[i].includes(lc(g)))) {
+ found = i;
+ break;
+ }
+ }
+ if (found === -1) missing.push(group[0]);
+ else ptr = found;
+ }
+ return { pass: missing.length === 0, missing };
+}
+
+export function scoreAnalysis(a: Analysis, rubric: Rubric): ScoreResult {
+ const checks: CheckResult[] = [];
+ const intent = lc(a.intent);
+ const steps = stepTexts(a);
+ const allSteps = steps.join(" \n ");
+ const appsText = lc(a.steps.flatMap((s) => s.apps).join(" ")) + " " + allSteps;
+ // Noise scope for `forbidden`: the intent + each step's title/apps only — the
+ // places where discarded noise would surface as a *spurious step*. Deliberately
+ // excludes detail/evidence prose, so the agent isn't penalized for *explaining*
+ // that it correctly ignored a tracking param or the recorder bracketing.
+ const noiseScope =
+ intent + " \n " + lc(a.steps.map((s) => `${s.title} ${s.apps.join(" ")}`).join(" \n "));
+
+ if (rubric.intentKeywordsAll) {
+ for (const kw of rubric.intentKeywordsAll) {
+ checks.push({
+ name: `intent mentions "${kw}"`,
+ pass: intent.includes(lc(kw)),
+ });
+ }
+ }
+
+ if (rubric.intentKeywordsAny) {
+ for (const group of rubric.intentKeywordsAny) {
+ const pass = group.some((g) => intent.includes(lc(g)));
+ checks.push({ name: `intent mentions one of [${group.join(", ")}]`, pass });
+ }
+ }
+
+ if (rubric.minSteps != null || rubric.maxSteps != null) {
+ const min = rubric.minSteps ?? 0;
+ const max = rubric.maxSteps ?? Infinity;
+ const n = a.steps.length;
+ checks.push({
+ name: `step count in [${min}, ${max === Infinity ? "∞" : max}]`,
+ pass: n >= min && n <= max,
+ detail: `got ${n}`,
+ });
+ }
+
+ if (rubric.expectedApps) {
+ for (const app of rubric.expectedApps) {
+ checks.push({ name: `involves app "${app}"`, pass: appsText.includes(lc(app)) });
+ }
+ }
+
+ if (rubric.orderedActions) {
+ const { pass, missing } = orderedSubsequence(steps, rubric.orderedActions);
+ checks.push({
+ name: `ordered flow (${rubric.orderedActions.length} actions)`,
+ pass,
+ detail: pass ? undefined : `missing/out-of-order: ${missing.join(", ")}`,
+ });
+ }
+
+ if (rubric.mustMentionAny) {
+ for (const group of rubric.mustMentionAny) {
+ checks.push({
+ name: `mentions one of [${group.join(", ")}]`,
+ pass: group.some((g) => allSteps.includes(lc(g))),
+ });
+ }
+ }
+
+ if (rubric.forbidden) {
+ for (const term of rubric.forbidden) {
+ const present = noiseScope.includes(lc(term));
+ checks.push({
+ name: `no noise step "${term}"`,
+ pass: !present,
+ critical: true,
+ detail: present ? "present in a step title/app or the intent" : undefined,
+ });
+ }
+ }
+
+ const total = checks.length || 1;
+ const passed = checks.filter((c) => c.pass).length;
+ const score = passed / total;
+ const criticalFail = checks.some((c) => c.critical && !c.pass);
+ const pass = !criticalFail && score >= PASS_THRESHOLD;
+ return { score, pass, checks };
+}
diff --git a/evals/tsconfig.json b/evals/tsconfig.json
new file mode 100644
index 0000000..641164b
--- /dev/null
+++ b/evals/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "noEmit": true,
+ "types": ["node"]
+ },
+ "include": ["**/*.ts", "../common", "../electron"]
+}
diff --git a/package.json b/package.json
index ece0a06..d89a32f 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,8 @@
"build:vite": "vite build",
"build": "tsc --noEmit && vite build",
"typecheck": "tsc --noEmit",
+ "typecheck:evals": "tsc --noEmit -p evals/tsconfig.json",
+ "eval": "node --experimental-transform-types --no-warnings --import ./evals/register.mjs evals/run.ts",
"dist": "vite build && electron-builder",
"start": "electron ."
},