Vercel Logo

Would you merge this?

Four agent-authored changes reach the review queue together. You still have to decide what is safe.

Uppercase channel names fail   → fix
Clarify webhook retries        → ask a question
Empty messages are delivered   → stop
Add delivery priority          → wait for a person

Not every request should become a pull request. The next action depends on the available evidence and the uncertainty that remains.

Give the Factory Four Honest Exits

Build a command that traces four issues through four different factory outcomes.

Hands-on Exercise 1.1

Create your course repository

The course starter has two branches:

  • main is the starter branch you will modify throughout the course.
  • solution contains the completed project for reference. Complete the exercises on main.

Two repositories appear in the workflow:

RepositoryPurpose
vercel-labs/academy-software-factoryThe upstream course template and reference branches.
Your personal forkThe repository the factory clones, changes on factory/* branches, and opens draft pull requests against.

Create your GitHub copy and Vercel project:

Deploy with Vercel

The button creates a repository in your GitHub account and connects it to a Vercel project. If you prefer to fork manually, fork the starter on GitHub and import that fork into a new Vercel project.

Clone your copy, then confirm that it is on main:

git clone https://github.com/YOUR_GITHUB_NAME/signalworks-software-factory.git
cd signalworks-software-factory
git switch main
pnpm install

The project starts small:

agent/                         # eve agent, channels, policies, and stations
fixtures/issues/               # prompts for the four course cases
fixtures/runs/                 # recorded outcomes used before live model calls
packages/notification-sdk/     # sample TypeScript product the factory maintains
evals/                         # regression evaluations added in Section 5

Trace the four outcomes

Read each issue before its recording. Predict where it should finish and what evidence would change your answer.

Now add the trace command to package.json:

package.json
{
  "scripts": {
    "trace": "node scripts/trace-work-order.mjs"
  }
}

Keep the existing scripts. The shortened object shows the new entry only.

Create scripts/trace-work-order.mjs. Load every JSON recording instead of hard-coding one issue:

scripts/trace-work-order.mjs
import { readdir, readFile } from "node:fs/promises";
 
const runsUrl = new URL("../fixtures/runs/", import.meta.url);
const files = (await readdir(runsUrl))
  .filter((file) => file.endsWith(".json"))
  .sort();
 
for (const file of files) {
  const run = JSON.parse(await readFile(new URL(file, runsUrl), "utf8"));
  console.log(`${run.workOrderId}: ${run.issue.title} [${run.outcome}]`);
 
  for (const [index, event] of run.events.entries()) {
    const step = String(index + 1).padStart(2, "0");
    const station = event.station.toUpperCase().padEnd(12);
    console.log(`${step} ${station} ${event.status}`);
    console.log(`   ${event.summary}`);
  }
 
  console.log();
}

import.meta.url keeps the fixture path relative to the script.

Before running it, inspect issue-44.json. Routing accepts a plausible bug; investigation disproves it.

Run the trace now:

pnpm trace

The output should show four outcomes:

issue-42: Uppercase channel names fail [fix]
issue-43: Clarify webhook retries [clarify]
issue-44: Empty messages are delivered [reject-premise]
issue-45: Add delivery priority [human-judgment]

Find the earliest divergence. The unclear request stops at routing, the false premise reaches investigation, and the public API request waits after specification.

Move one boundary

Change issue 45's final status from awaiting-approval to building, then run the trace again. What decision has the factory silently taken away from the reviewer? Restore the recording when you finish.

Only one issue appears

Read the directory with readdir(runsUrl) and loop over every .json file. A path to issue-42.json preserves the old single-case version.

The trace order changes

Call .sort() after filtering the filenames so the trace order is deterministic.

Try It

Verify the local project:

pnpm validate

pnpm validate should finish with zero diagnostics. Section 3 connects the services immediately before the first live invocation.

Commit

git add package.json scripts/trace-work-order.mjs
git commit -m "feat(factory): trace four outcomes"

Done-When

  • pnpm trace prints all four work orders
  • The unclear request stops before investigation
  • The false premise stops after repository evidence arrives
  • The public API request pauses before implementation
  • The recordings show only independently verified work reaching draft pull request approval
  • pnpm validate reports zero diagnostics

The first factory success changed zero files. Now we can give every future decision a durable record.

Solution

The exercise contains the complete package.json entry and scripts/trace-work-order.mjs. Your result should match the four headings in Trace the four outcomes.

Was this helpful?

supported.