Experience
Projects
My Stack
Case studies
Contact me
Open my CV

·5 min read

DailyBrief's eval harness: real model runs on a data copy, judged by pure functions

I had changed a prompt in DailyBrief and had no way to say whether the brief got better or worse. The app writes a daily brief and checks a kanban board by running PowerShell scripts that call Claude, and for weeks my method of judging a prompt change was reading the next morning's output and deciding it felt fine. That is not a test. So I wrote an eval harness, and the interesting part turned out to be how little of it involves a model.

Project
DailyBrief
Date
Oct 2026
Stack
Node.js, PowerShell, Claude CLI
Commit
12770cb

The shape of the harness

The header of scripts/eval.js says what it is: it "runs the real pipeline against a COPY of this user's data and judges the output, so a prompt or digest change can be measured instead of eyeballed." The modes are brief, check or both, and it can keep the temp copy for inspection or write a JSON report.

code
npm run eval                       daily brief + kanban check
npm run eval -- --mode brief       daily brief only
npm run eval -- --mode check       kanban check only
npm run eval -- --keep             keep the temp copy to inspect it

It spends real tokens, Sonnet for the brief and Haiku for the check, and it says so in its own header. That is a deliberate tradeoff. A mocked model would make the harness fast and free, and would also make it worthless for the one thing I wanted to know, which is what the real model does with the real prompt.

Protecting the real data

The fixture holds personal data: tasks, project names, briefs. The harness treats it accordingly. It copies the data folder into a temp directory and runs every script with DAILYBRIEF_DATA pointing at the copy. Before copying it refuses to continue if the temp directory would land inside the real data folder. The copy also leaves out things that are install content and not data, so the copy cannot be mistaken for the scripts themselves:

js
const SKIP_RE = /(\.ps1|^prompt.*\.md|^strings.*\.json|\.log|^check-(digest|patch|run)-.*|^ask-(digest|out|run)-.*|^brief-(digest|out)-.*|^execute-.*|^publish.*|^dailybrief\.db.*)$/i;

Old run logs and digests are dropped so that every log in the copy belongs to this run. And at the end it compares a fingerprint of the real folder, made of size and mtime for today's brief files, before and after. If it differs, the output ends with a warning: files in the real data folder changed during the eval, and the app may be running. The harness cannot stop the app from writing, but it can tell me when a result is contaminated.

What counts as a good brief

All the judging lives in src/eval-checks.js, which the header describes as having no fs, no spawn and no AI. The harness gathers files, these functions judge them, and test/eval-checks.test.js pins the judgement down.

The brief checks are structural. A brief needs a non-empty tldr, between 3 and 5 tasks, numeric weights that sum to exactly 100, and a warnings array. The rest encode rules from the prompt that the model sometimes breaks:

js
// The prompt forbids monitoring tasks: uncertainty is a question, not a task.
const FORBIDDEN_TITLE_RE = /^\s*(check on|observe|monitor|work out)\b/i;

// "129.7 to 116.3", "3,693.0 -> 239.4": a folder's activity score moving.
const TREND_RE = /\d[\d,]*(?:\.\d+)?\s*(?:to|->|→|=>)\s*\d[\d,]*(?:\.\d+)?/i;

A warning that cites only a score moving, such as "activity fell from 129.7 to 116.3", tells a reader nothing they can go and look at. isTrendOnlyWarning flags it unless the same text also contains evidence: a backticked identifier, a file name, a commit hash or a TODO. The unit test shows the line it draws: a trend next to PushDeployJob.php is a legitimate warning, and a trend alone is not. The test for forbidden titles keeps a negative case as well, so "Monitoring dashboard: add CPU chart" is allowed while "Monitor CI" is not.

Two checks protect the board. missingIds lists ids a run referenced that the board did not have before it, which catches a model inventing a task id in kanban.updates. The same function run the other way round catches any task id that vanished from the board after the run.

The caveman check

The oddest check exists because of something that happened. According to the comment in the code, caveman prose ("Fix bug. Ship invoice. Deploy blocked.") leaked in once from a user's terse-style hook. Its fingerprints are next to no articles and very short sentences, so proseStats measures both:

js
if (stats.words >= 40 && stats.articleRatio < 0.02) stats.flags.push('almost no articles (caveman-style)');
if (stats.sentences >= 4 && stats.avgWordsPerSentence < 5) stats.flags.push('very short sentences (caveman-style)');

The thresholds are heuristics and I do not pretend otherwise. There is a guard for text that is mostly not Latin script: below a 0.5 Latin ratio it reports "mostly non-English text" and returns early, because an article count means nothing in another language.

Reading the run

parseUsage mirrors the app's own parser in main.js. The CLI's final JSON result line is the source of truth; cache reads and cache creation count as input tokens; a log that starts with skipped: means the run never reached the model. It also pulls the script's own [timing] ... total Ns line. The harness prints one table per run with exit code, wall seconds, script seconds, model seconds, turns, input and output tokens, cost and a pass or FAIL count, and exits with 1 on any failure and 2 on a harness error.

The lesson

I had assumed an eval for an AI feature would be mostly about the model. It is mostly about writing down, as code, what I already believed a good output looks like. Every check above is a rule that was already in my head or in the prompt, and several came from a specific bad output. Once they are functions with unit tests, a prompt edit has a before and an after. The harness also only runs on Windows, since the pipeline is PowerShell 5.1, and it throws a clear error elsewhere instead of failing halfway through.

#testing#llm#evals#powershell#nodejs

Keep reading

Have a project in mind?