← Writing

cohort: synthetic users that show their work

By ·

View the cohort project →

I built cohort to try a task in a web app through an AI persona. Give the persona a goal and an agent attempts it in Chromium. I want to see the clicks that led to a complaint before I decide whether to change the interface.

nejcm/cohortLocal-first CLI and dashboard where AI personas operate your web app and leave an inspectable Playwright trail.TypeScript(opens in new tab)

I kept links to Synthetic Users and Uxia in docs/original-idea.md. Both offer AI personas for product feedback. I wanted a local CLI where I supply the model key and keep the browser recordings on disk.

The report has to point to a step

The default mode gives the agent screenshots of the page. A run saves its evidence under .cohort/runs/<run-id>/, including:

  • trace.zip, the native Playwright trace.
  • screenshots/ and steps.jsonl, one record per action.
  • replay.spec.ts, a script that repeats the run with no model.
  • report.{json,md,html}, and manifest.json last.

I can open a friction claim’s screenshot and check the step it cites. The report validator rejects claims with missing evidence, including agent opinions. That check matters to me because a model’s complaint can sound convincing even when it clicked the wrong thing.

The run ends as completed, abandoned, blocked(kind), agent_error(code), or limit_reached(limit). An interruption has the error code interrupted. I don’t want to blame a page because a model ran out of budget.

A blocked run stays out of the completion rate. The report distinguishes blockers the browser code detected from ones the agent reported, which remain unverified. Cohort derives friction measurements such as backtrack, repeated_action, visible_error, long_pause, or focus_trap from recorded actions. The report lists the agent’s complaints separately as opinions.

Three repeats add up

Each persona and goal runs three times by default. cohort estimate shows the batch budget without calling a model and says whether run would refuse it. The default batch ceiling is $10. Individual runs also have step and time limits, with a dollar cap when prices are available.

In the recorded agent session, a persona capped at $0.85 per run had a maximum batch cost of $2.55 for three repeats. With a $0.85 batch limit, the estimate returned over_budget and nothing started. Missing catalog prices make the cost unknown and the dollar cap unenforceable. The report says so.

Base has to pass before I blame head

I also want to check a pull request against a task that already worked. Rerunning the model would let it choose a different path, so cohort compare replays an approved run’s frozen script on base and head deployments. It calls no model and leaves the script unchanged.

A regression requires base to pass and head to fail at the same step in both the initial and confirmation rounds. That takes at most four browser executions. Missing provenance or a failing base produces inconclusive. So does a wrong deployment or a confirmation that disagrees. Only a confirmed regression exits with 1.

The documented workflow runs cohort publish in a separate job with a write token and no model key. It creates or updates one comment for the journey. Validation on real apps and preview deployments is still pending.

One session ended before the first step

This is release candidate 0.1.0-rc.0. Automated tests use a scripted fake model. The compatibility docs record live provider checks, and both shipped models are enabled in the catalog.

I also recorded an agent session, which is less reassuring. A coding agent drove the CLI through --json, but its run ended with interrupted and zero recorded steps. The cause is still unconfirmed. The session did expose missing run flags in the JSON help, which I fixed.

The recordings need care too. trace.zip holds typed values and unmasked page snapshots, including secrets. Keep .cohort/runs private and use test accounts. Synthetic behaviour hasn’t been validated against real people.

cohort docsOperating the lab, personas, PR comparison, and the security review notes.(opens in new tab)