# Bug report → regression test → patch → human review

A deliberately small, synthetic example prepared by Alexander's AI assistant. It demonstrates the artifacts in a repeatable coding-agent workflow. It is not a customer result, a recording of an autonomous agent run, or a productivity benchmark.

## Reproduce it

Use Node.js 18 or later. No install, dependencies or API key is needed.

1. Unzip this directory and open a terminal in it.
2. Run `BUGGY=1 node --test workflow.test.mjs` on macOS/Linux. On PowerShell, run `$env:BUGGY='1'; node --test workflow.test.mjs`.
3. The priority-zero regression fails: the buggy filter returns all three tickets instead of just the urgent one. The other five tests pass.
4. Run `node --test workflow.test.mjs` without BUGGY set. On PowerShell, clear it first with `Remove-Item Env:BUGGY`.
5. All six tests pass with `fixed.mjs`.

## Why the first implementation fails

`!priority` treats zero as “no filter.” That confuses a valid value with an omitted option. `priority === undefined` expresses the intended contract. Zero, nonzero priorities and no matches now follow the same explicit comparison.

The two files are the buggy starting point and the corrected implementation. They are constructed for this demonstration; the buggy file is not presented as a captured AI response.

## Use it with an agent

`AGENTS.md` contains the task context and constraints. Start from `broken.mjs` in a separate scratch directory, ask your approved agent to follow those instructions, and compare its proposed change with the corrected implementation. Do not provide company code or secrets to an unapproved tool.

`REVIEW.md` is the human review checklist. `scorecard.csv` has blank fields for recording a future measured comparison, including review and rework. There are deliberately no invented timings or savings.

In a client sprint, this toy example is replaced by an agreed task in the team's repository. Access, tooling, acceptance criteria, schedule and fees are agreed before that work starts.
