Stage 2 — Weeks 4–8

Safety Net & Agent Infrastructure

The stage that earns the right to generate code fast. Also the one most likely to get squeezed.

What Happens Here

Two tracks in parallel: build the net, build the fleet

Stage 2 has no demo. It produces a suite that runs, a pipeline that goes red when it should, and agent definitions in a folder. That is why it gets compressed in most programmes. It is also what makes Stage 3 safe.

Two tracks, weeks 5 to 9
The net has to be done before Stage 3 starts
W4W5W6W7W8
2.1 Enforce the CI gate
W4
2.2 Characterization backfill
W4–7
2.3 Golden datasets
W4–7 — needs your Domain Owners
2.4 Integration + UI harness
W6–8
2.5 Build the 14 agents
W4–8

If this stage slips, the pilot slips

We would rather move Stage 3 back two weeks than start generating code at volume into an unenforced suite. On a platform whose clients depend on its calculations and alerts being right, that is the difference between a programme that improves quality and one that quietly degrades it while reporting velocity gains.

2.1 — Turn On the Gate

The cheapest big win. Available in week five.

Tests exist. Nothing gates on them. The first move is not writing more tests. It is making the ones you have matter, and adding the analyzer and standards checks alongside them so the gate covers all eight of the production-ready checks.

  • Find the true state: what passes, what has been failing for months, what is quarantined
  • Fix or explicitly quarantine every failing test. No ambiguous middle
  • Wire in the analyzer rule set agreed in Stage 0 — ESLint on the React side plus the backend’s linters and static analysis
  • Turn on the gate: red build blocks the merge, with no override that leaves no record
  • Hold the line for two weeks. This is social more than technical
  • Publish the pass rate where the team sees it daily

Expect friction in week one

Builds will break for reasons unrelated to the change in hand. That is the accumulated cost of the tests having been optional, paid at once. It settles quickly, and after that the suite becomes something the team defends instead of routes around.

2.2 — Characterization Backfill

Where agent-generated tests are worth more than agent-generated features

Most of n.tasc has no test and no written spec. Writing specs first takes months. Characterization inverts it: run the code, capture what it does, assert it keeps doing it. Current behaviour becomes the reference. That is exactly what you need to spot a regression, as distinct from a pre-existing bug.

Where the net goes, in order
Bar length is relative effort. Priority is by blast radius, not by size.
1. Core calculation engines
business-critical calculations, rule engines
highest cost if wrong
2. Rules & alerting
rule evaluation, dispatch
false negatives are invisible
3. Repeat-offender areas
from your own defect history
best predictor of the next bug
4. API surface
every endpoint, contract level
what the UI is built on
5. Database business logic
queries, views, scripts
invisible to service-level tests
6. Peripheral modules
only where touched
blanket backfill wastes the stage

The suspicious-behaviour list

Characterization pins current behaviour, including behaviour that is wrong. Every case where the captured output looks incorrect gets raised as a finding, not frozen into a test. This list is usually uncomfortable and one of the more valuable things the stage produces — it is where long-standing defects nobody had a reason to look at come out. Each item goes to the module steward: fix it, or record why it is intentional.

2.3 — Golden Datasets

The biggest ask in the programme, and it cannot be delegated

Detail in QA & Test Readiness. In Stage 2 the work is: build the scenario families with your Domain Owners, agree the reference outputs, freeze them, and wire the Critical-Logic Verification Agent to run automatically when the change map raises the restricted-zone flag.

The scheduling risk, named now

Golden datasets need your most experienced domain people. Those are the same people busy with client work. Two to three days per scenario family. It cannot be substituted with agent-generated data, because the datasets exist to check the agents. If this time is not protected in weeks five to eight, Stage 2 slips and the pilot goes with it.

2.4 — Integration and UI Harness

Real database, real database logic, real journeys

Four steps
Step 1 is where the real engineering is
1
Containerised database per run
Spun up by the pipeline, real schema and database logic deployed, seeded from a known baseline, torn down after. Some code reads config in ways that make this awkward. Those paths need adjusting.
2
Synthetic seed data
Clients, accounts, transactions, reference-data fixtures. Versioned with the tests. Never an extract of live client data.
3
Deterministic clock
Pre-open, session, post-close and settlement windows all testable. Behaviour depends heavily on time of day.
4
Playwright journeys
The React screens and paths your users actually rely on, running in CI on every build.

2.5 — Building the Fleet

One at a time, in the order the pipeline consumes them

Spec and Architecture come first. Every downstream agent inherits their output quality. A weak change map produces confidently wrong code no matter how good the coding agent is.

WeekBuiltProven against
5–6Spec, Architecture & ImpactReplayed on 10 past changes. Does the change map match what was actually touched?
6–7API Contract, Bug Triage, Regulatory WatchReplayed on past breaking changes, past bugs, and the circulars gathered in Stage 1
7–8Characterization Test, Test & QACoverage produced. Defects caught when a known past regression is put back deliberately
7–8Code Review AgentReplayed on 20 past pull requests. Does it find what the reviewers found?
8–9Backend, Web UI — React, Data & MigrationSmall real changes, read line by line by the module steward
9Critical-Logic Verification, Release Pack, Knowledge UpdateVerification agent replayed on a known past defect in critical business logic

Replay validation — how an agent earns its place

A past change where we already know the correct answer Agent runs it cold no hints, no history of what happened Compare did it find what the engineers found? Matches → ready use it on live work Misses → not ready costs nothing to find out An agent that fails on history is not ready for live work. Finding that out on a replay is free.
  • Read-only credentials confirmed. No deploy, DDL or protected-branch merge rights anywhere
  • Agent workspaces scoped so an agent cannot reach outside the repositories it needs
  • Audit logging of every agent run, at the agreed retention
  • AI-assisted commits tagged
  • Kill-switch drill run and documented. Not assumed to work

Stage 2 deliverables

Enforced CI gate with a green suite and analyzer rules · characterization coverage on the priority list · suspicious-behaviour findings with steward decisions · golden datasets frozen and wired in · integration and UI harness running · all fourteen agents built and replay-validated · audit and kill switch verified in practice.