Start · chosen once, from the situation a request begins in

sweep-tests

about 2,700 tokens

sweep-tests as it installs, each line coloured by where its words came from.

  • 3 files
  • 5 edits
  • 5 sentences left out
  • 1 source
  • last changed 2026-10-19

The text

SKILL.md

about 2,600 tokens
  • Freddie Northam
  • greenline

---

name: "sweep-tests"

description: "Prune or audit a test suite with mutation proof, as its own announced task on a green suite. Invoke it by name when tests break on refactors that change no behavior, coverage is high but defects still ship, or production code carries seams only tests use."

---

greenlineOpens sweep-tests: prune a green suite as a change of its own

Sweep tests is the start for a test suite that needs pruning or an audit. It fires by name, when tests break on refactors that change no behavior, when coverage is high but defects still ship, or when production code carries seams only tests use, and it runs on a green suite as a change of its own, never inside another change's build: propose its mode and wait, as AGENTS.md says, open its record with a `## start` section naming sweep-tests, and run the line from `frame`, the sweep itself being the change's build. Propose regular or above, since the sweep's result is reviewed by an agent other than the sweeper only where the review step runs independent; where the owner chooses quick, no review runs, and the close section names that limit. A red check goes to diagnose. It deletes nothing it has not proved by mutation, adds no test, and never certifies its own review without naming that limit.

greenlinePoints at the skill's references page for paths and commands

Greenline's paths and commands for this skill stand on its references page, [references/greenline.md](references/greenline.md): read it when the work lands in the workspace.

Freddie Northamsweep-tests/SKILL.md

A test must justify its presence. A test that changes when the implementation changes, while the behavior stays the same, asserts implementation. Delete it.

Then simplify the source. Seams in production code often exist only because those tests demanded them. When the test goes, the seam goes with it.

## The gate

**Run this only when the suite is green.**

greenlineA red check is repaired through diagnose, then the sweep restartsFreddie Northamsweep-tests/SKILL.md

A red check makes test deletion fraud, not maintenance. When a check is red, repair the source through diagnose, and restart the sweep from the top once the suite is green again. You may not touch a test at all until the suite is green again.

greenlineThe sweep is a separate change with its own record

This skill is a separate change with its own change record. Announce it. Never run it inside another change's build.

Freddie Northamsweep-tests/SKILL.md

## Prove each deletion

You may not read a test and then declare it worthless. That judgment certifies itself, and it always says yes. Run the mutation check instead.

**If the repository already has a mutation runner, use it.** Look for Stryker, mutmut, go-mutesting, PIT, or a `test:mutation` script. Its configuration holds knowledge this skill does not have, such as which files repay the run and which generate thousands of worthless mutants.

**The mutation scope must cover the subject file of every test you delete in the batch.** A test whose subject sits outside the scope is never proved, however green the score looks. Widen the scope, or split the batch.

greenlineLocates bin/mutate.mjs by glob under the installed skills; the command is unchanged

Only when the repository has none, use the tool that ships here, `bin/mutate.mjs` in this skill's installed directory. Find it with the glob `**/sweep-tests/bin/mutate.mjs` under the installed skills rather than assuming a harness:

Freddie Northamsweep-tests/SKILL.md

```bash

node <skill-dir>/bin/mutate.mjs --file src/thing.js --fn theFunction

```

Either tool breaks the source on purpose, one change at a time, and runs the suite after each change. A mutant that survives is a behavior that no test covers.

greenlineValidates the measurement before judging survivors; error-path survivors rank highest

Validate the measurement before judging a survivor. The bundled tool masks strings and comments for its comparison and numeric operators, but its raw-text ternary operator can still swap a quoted ternary example inside a comment, and its "defect your suite ships" line is a candidate, not a diagnosis. A mutation that changes no executable behavior, or whose validity is unresolved, is an invalid measurement, not a shipped defect: the run proves no deletion, so keep the tests and seams, record the invalid measurement with the sweep's evidence, and use an already available capable runner only within the authorized scope. Never add a test for a comment, and never drop a baseline mutant to make the score pass.

A survivor inside error-handling code is the sweep's highest-value finding. Code that has not run does not work, and error handlers run rarest of all: a study of production failures in distributed data-intensive systems (Yuan et al., OSDI 2014) found 92% of catastrophic failures came from incorrect handling of non-fatal errors the software explicitly signaled. A test that exercises an error path is never pruned as redundant on coverage grounds alone; weigh its deletion against what its mutants proved.

Freddie Northamsweep-tests/SKILL.md

**Take the report before you delete anything. Take it again at the end.**

Compare mutants by identity, not by number. Three failures hide behind an unchanged total:

1. **A trade.** Two mutants swap status and the total holds.

2. **A disappearance.** You removed the source a mutant lived in, so the mutant is gone. Nothing moved from killed to survived, and the behaviour is now untested. This is the one that catches seam removal.

3. **A scope change.** The second run covered fewer files than the first.

So: record every baseline mutant identifier before you start, with the source hash and the exact test command. At the end, **every baseline mutant must still exist and must still be killed.** A missing mutant fails the sweep exactly as a survived one does.

The suite stays green throughout, so green proves nothing here.

The score is not proof either. It shows that the mutants this runner generated, under this operator set, over this file set, kept their status. Behaviour no operator reaches is invisible to it, and a dynamic caller found only through a configuration string or a plugin registry is invisible to your grep. **A sweep without a score has proved nothing. A sweep with one has proved something narrow.** Say which.

greenlineBoth reports go to separate paths in the sweep change's folderFreddie Northamsweep-tests/SKILL.md

Write the before-report and the after-report to different paths in the sweep change's folder. A runner that overwrites its own baseline leaves you unable to find the mutant you lost.

greenlineThe bundled tool names no killer; never invent one or infer redundancyFreddie Northamsweep-tests/SKILL.mdgreenlineThe bundled tool names no killer; never invent one or infer redundancy

**A runner that reports per-test identities names one killer for each mutant: the first test that reached it.** That is run order, not ownership. The bundled `mutate.mjs` reports suite-level killed and survived outcomes and names no killer; do not invent that attribution, and its silence is not evidence that a test is redundant. A test credited with no kills can still be the only real net under a mutant that another test happens to reach first. Use the report to shortlist candidates. Never use it as proof. The rerun is the proof.

Freddie Northamsweep-tests/SKILL.md

### Delete in batches

Time one scoped run before you plan the sweep. The cost ranges from seconds to many minutes, so whether one run for each candidate is affordable depends on the repository. When it is not, delete a batch and run once.

- The score holds. The whole batch stands.

- The score falls. One test in the batch was the only killer of a mutant. Restore the batch, halve it, and run again. Repeat until you find the test that matters, then keep it and delete the rest.

A batch proof is weaker than a proof for each test. It shows that no deletion was the unique killer of a mutant. That is enough, and it is affordable.

## Delete

- Tests that assert that a call happened, when the call is not the contract

- Tests whose assertions restate the source line above them

- Snapshot tests that you regenerate instead of read

- Tests that exercise only a mock

- Repeated coverage of one behavior across many cases

- Tests for a private function that a public function already reaches

## Keep

- The only test that covers a behavior, however ugly it is

- Call assertions on a unit whose whole job is to drive other units. There the call and its arguments are the result, and the mutation score will show it

- Regression tests that name a defect or an issue

- Contract tests at a boundary that you do not own

- Property tests and fuzz tests

## Remove the seams

A deleted test may have been the only caller of a seam. Grep for each one.

- An interface with one implementation

- A constructor parameter that only a test supplies

- An exported symbol that only tests import

- A mock or fake, and the hook it plugs into

- A flag that only a test reads

Delete the seam, or inline it. Follow each simplification to its end. When you remove a seam and a wrapper becomes a pass-through, remove the wrapper too.

**A seam can have one caller, and that caller can be a test in another file. Leave that seam alone.** Report it as a candidate for a later sweep. A sweep that reaches past its own scope breaks files that nobody asked you to touch.

**A grep does not find every caller.** Dependency injection tokens, plugin registries, configuration strings and generated registrations all reference a symbol without naming it in a way `rg` matches. Removing such a seam keeps every unit test green, removes the mutants that lived in it, and fails in production. When a symbol is exported across a package boundary, treat the grep as inconclusive and leave it.

## Report

Close with the two scores and one table.

```

Tests: 26 -> 9 (-65%) Mutation score: 16/18 -> 16/18 (no change)

```

The table lists each test you deleted and each seam you removed. Prose is not the report.

greenlineEvidence stays in the change's folder, and review judges the sweep

The baselines, the identified survivors and kills, both reports, the table and the resulting checks stay with the sweep's change in its folder, and acceptance is judged against those measurements: an aggregate score alone cannot prove that each baseline mutant remains killed. The sweep is implementation work. Commit its result with the change's trailer for its review step, like any build; no review runs only where the owner chose quick, and the close section names that limit.

Freddie Northamsweep-tests/SKILL.md

## Don't

- Delete a test to turn a red check green

- Delete a test that you did not prove by mutation

- Rewrite a test and count that as a sweep

- Add a test in this pass

- Change anything outside the test suite and its seams

## It's working if

- Every deletion has a mutation report before it and one after it.

- Both reports name the same mutants, not just the same total.

- The close is two scores and a table. Prose is not the report.

- Seams disappear in the same pass as the tests that demanded them.

- A sweep that cannot prove a deletion says so, and keeps the test.

- You deleted nothing while a check showed red.

greenlineEvidence stays in the change's folder, and review judges the sweep

## Handoff

Consumes: a green suite and the request to sweep it Produces: the before and after mutation results at different paths, the deletion and seam table, and the baselines and kills, in the change's folder under .greenline/ledger/<id>/; the sweep committed as the change's build Next: frame, under the mode the owner approves; the sweep is the change's build, and review and verify follow at the depths its mode gives

SKILL.md as installed, byte for byte SHA-256 209f16cc910bab9d7444aef734c9e6d6f344c47b211c6d819590ef4debafcb15

references/greenline.md

about 90 tokens
  • greenline
greenlineOpens the skill's mechanics page, read with SKILL.md

# Sweep tests: the practice's mechanics

This page holds where sweep-tests's work lands in the workspace and the commands it runs, which `SKILL.md` names by their nouns. Read it with `SKILL.md` when the work lands in the workspace.

greenlineThe sweep's record and folder

## Where its work lands

The sweep's change record is `.greenline/ledger/<id>.md` and its folder `.greenline/ledger/<id>/`.

1 file beside the text
  • bin/mutate.mjs copied byte for byte from Freddie Northam, sweep-tests/bin/mutate.mjs

The edits

Red is upstream's text; green is what greenline shipped in its place.

What the edit kinds mean
method
changes what the method does, under a recorded ruling
correction
fixes an error
scope
fits the text to this skill
pointer
re-points a reference
smaller edits
rename, relocate or adjust tool details
  1. Edit 1 method SKILL.md:24

    Upstream: You may not touch a test at all until the suite is green again.

    Shipped: You may not touch a test at all until the suite is green again.

    Repair goes through its owner, and the sweep restarts once green

    Full reason

    the gate's 'repair the source' names its owner, diagnosing-bugs, and the sweep restarts from the top once the suite is green, a step upstream lacks; upstream's rule that no test is touched until then stands Confirmed by the operator on 2026-09-11 (method-rulings.md).

    Ruling R3

  2. Edit 2 pointer SKILL.md:28

    Upstream: Never run it inside another task.

    Shipped: Never run it inside another change's build.

    Never run inside another change's build, since each change keeps its record

    Full reason

    upstream's 'another task' is another change's build: the sweep is never run inside one, as the installed work guide makes each change its own record.

  3. Edit 4 correction SKILL.md:109

    Upstream: only real net

    Shipped: only real net

    The bundled tool names no killer; never invent one or infer redundancy

    Full reason

    upstream's 'the report names one killer for each mutant' holds only for a runner that reports per-test identities; the bundled mutate.mjs reports suite-level killed and survived outcomes and names no killer, so that attribution is never invented and its absence is not evidence that a test is redundant; the rest of the paragraph (run order, not ownership; shortlist, never proof; the rerun is the proof) is upstream's

  4. Edit 5 correction SKILL.md:110

    Upstream: report to

    Shipped: report to

    The bundled tool names no killer; never invent one or infer redundancy

    Full reason

    upstream's 'the report names one killer for each mutant' holds only for a runner that reports per-test identities; the bundled mutate.mjs reports suite-level killed and survived outcomes and names no killer, so that attribution is never invented and its absence is not evidence that a test is redundant; the rest of the paragraph (run order, not ownership; shortlist, never proof; the rerun is the proof) is upstream's

1 smaller edit

Renames, locations and tool details, each with its reason.

  1. Edit 3 relocate SKILL.md:102

    Upstream: A runner that overwrites its own baseline leaves you unable to find the mutant you lost.

    Shipped: A runner that overwrites its own baseline leaves you unable to find the mutant you lost.

    Before and after reports go to different paths in the change's folder

    Full reason

    the before-report and the after-report go to different paths under the sweep ticket's evidence home, .greenline/work/evidence/TKT-NNN/

What greenline wrote

The full reason for every passage greenline wrote, in the order of the text.

  1. SKILL.md:8 method

    one opening paragraph in the skill's voice after the title: a standing program, not an initiative stage, fired by name on a green suite in its own dedicated ticket and never inside another ticket's build; a red check goes to diagnosing-bugs and the review of the committed result to delivery-review; it deletes nothing unproved by mutation, adds no test and never certifies its own review; re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named. R1

  2. SKILL.md:10 pointer

    The front points at the skill's references page, where greenline's paths and commands for it stand since J-93 S2, so the front holds the method alone.

  3. SKILL.md:22 method

    the gate's 'repair the source' names its owner, diagnosing-bugs, and the sweep restarts from the top once the suite is green, a step upstream lacks; upstream's rule that no test is touched until then stands Confirmed by the operator on 2026-09-11 (method-rulings.md); re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named. R2

    Credits: Freddie Northam

  4. SKILL.md:27 pointer

    upstream's 'separate task' is a dedicated ticket in .greenline/work/tickets/, and 'another task' is another ticket's build; re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named. Since J-93 S2 the front names greenline's homes and commands by their nouns, their paths and commands on the skill's references page.

  5. SKILL.md:44 tool details

    the <skill-dir> in upstream's command is this skill's installed directory, found by the glob **/sweep-tests/bin/mutate.mjs under the installed skills rather than by assuming a harness; the command itself is unchanged

    Credits: Freddie Northam

  6. SKILL.md:57 method

    the bundled mutate.mjs masks strings and comments but its raw-text ternary operator can swap a quoted ternary inside a comment, so a survivor is judged only after the measurement is validated, and a survivor on an error path is the highest-value finding and is never pruned on coverage alone: two criteria upstream does not state Confirmed by the operator on 2026-09-11 (method-rulings.md). R3

  7. SKILL.md:101 relocate

    the before-report and the after-report go to different paths under the sweep ticket's evidence home, .greenline/work/evidence/TKT-NNN/; re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named. Since J-93 S2 the front names greenline's homes and commands by their nouns, their paths and commands on the skill's references page.

    Credits: Freddie Northam

  8. SKILL.md:105 correction

    upstream's 'the report names one killer for each mutant' holds only for a runner that reports per-test identities; the bundled mutate.mjs reports suite-level killed and survived outcomes and names no killer, so that attribution is never invented and its absence is not evidence that a test is redundant; the rest of the paragraph (run order, not ownership; shortlist, never proof; the rerun is the proof) is upstream's

    Credits: Freddie Northam

  9. SKILL.md:106 correction

    upstream's 'the report names one killer for each mutant' holds only for a runner that reports per-test identities; the bundled mutate.mjs reports suite-level killed and survived outcomes and names no killer, so that attribution is never invented and its absence is not evidence that a test is redundant; the rest of the paragraph (run order, not ownership; shortlist, never proof; the rerun is the proof) is upstream's

  10. SKILL.md:180 pointer

    the sweep's evidence and its review: the Report section says the baselines, survivors and kills, both reports, the table and the resulting checks stay with the sweep's ticket under its evidence home, acceptance is judged against those measurements since an aggregate score cannot prove each baseline mutant remains killed, and the committed result goes to delivery-review like any implementation with the sweeper never writing its own review record; the Handoff section names the green suite and the sweep's own ticket consumed, the reports and table produced under .greenline/work/evidence/TKT-NNN/ with the ticket implementing then implemented, and delivery-review next; re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named.

  11. SKILL.md:205 pointer

    the sweep's evidence and its review: the Report section says the baselines, survivors and kills, both reports, the table and the resulting checks stay with the sweep's ticket under its evidence home, acceptance is judged against those measurements since an aggregate score cannot prove each baseline mutant remains killed, and the committed result goes to delivery-review like any implementation with the sweeper never writing its own review record; the Handoff section names the green suite and the sweep's own ticket consumed, the reports and table produced under .greenline/work/evidence/TKT-NNN/ with the ticket implementing then implemented, and delivery-review next; re-cut at S17: the sweep is a change of its own run on the line, its reports in the change's folder, with no ticket lifecycle or retired skill named.

  12. references/greenline.md:1 scope

    The skill's references page opens: greenline's mechanics for the skill, the paths and commands its front names by their nouns, held apart from the upstream prose since J-93 S2.

  13. references/greenline.md:5 relocate

    sweep-tests' mechanics: the ledger the sweep's record and folder live in, held apart since J-93 S2.

What it left out

Freddie Northam

Freddie Northam, sweep-tests/SKILL.md: 5 of 124 sentences left out
  1. When a check is red, repair the source. left out: the gate's 'repair the source' names its owner, diagnose, and the sweep restarts from the top once the suite is green, a step upstream lacks; upstream's rule that no test is touched until then stands Confirmed by the operator on 2026-09-11 (method-rulings.md). R3 replaced by line 22 of SKILL.md
  2. 1 sentence taken
  3. This skill is a separate task. left out: upstream's 'separate task' is a dedicated ticket in .greenline/work/tickets/, and 'another task' is another ticket's build
  4. 12 sentences taken
  5. Only when the repository has none, use the tool that ships here: left out: the <skill-dir> in upstream's command is this skill's installed directory, found by the glob **/sweep-tests/bin/mutate.mjs under the installed skills rather than by assuming a harness; the command itself is unchanged replaced by line 44 of SKILL.md
  6. 25 sentences taken
  7. Write the before-report and the after-report to different paths. left out: the before-report and the after-report go to different paths under the sweep ticket's evidence home, .greenline/work/evidence/TKT-NNN/ replaced by line 101 of SKILL.md
  8. 1 sentence taken
  9. **The report names one killer for each mutant: the first test that reached it.** left out: upstream's 'the report names one killer for each mutant' holds only for a runner that reports per-test identities; the bundled mutate.mjs reports suite-level killed and survived outcomes and names no killer, so that attribution is never invented and its absence is not evidence that a test is redundant; the rest of the paragraph (run order, not ownership; shortlist, never proof; the rerun is the proof) is upstream's replaced by line 105 of SKILL.md

The ledger entry

greenline's ledger logs how each skill was made and changed, with a reason for each entry.

2026-10-19 2026-10-19-sweep-tests-front-and-references

sweep-tests's paths and commands move to a references page

The front names greenline's homes and commands by their nouns and points at a references page, which holds their paths and commands (J-93 S2).

Authorised by
2026-10-18 The operator's words of 2026-10-18 on the redesign (N-56, items 2 and 7), "we need the upstream prose upfront and references hold how to work meaning the artefacts etc" and, on the ingest procedures, "we wanna have there prose .. what we don't wanna have is there artefact system and fit them to use ours"; and J-93 S2's finalise words of 2026-10-19, "Fast route, merged slices, parallel jobs (Recommended)": a skill's front is the upstream prose its recipe cuts, and its mechanics, where its work lands, its section's form, its depths at each mode and its commands, stand on its references page
Pages it touched
SKILL.md, references/greenline.md
Rulings, R1 to R11
  1. The operator's rulings of 2026-10-04, "cool then lock everything in": every change has one record, a start hands the job to a mode the owner approves, and what a record relies on lives in the change's folder; R16 of 2026-10-07, a start chosen from the situation a request begins in; and R22 of 2026-10-08, "yes amend, with one change", the roster table's names and steps; the operator's card of 2026-10-19 naming the three modes, "quick, regular, careful (Recommended)": the old names and the trial step in a skill's prose are corrected by the smallest substitution
  2. series-s7-roster-2026-09-11: the operator's ruling of 2026-09-11 that the plan's open items be finished with the maintainer's recommendations; the recommendation, recorded in that file, keeps the nine method edits; The operator's rulings of 2026-10-04, "cool then lock everything in": every change has one record, a start hands the job to a mode the owner approves, and what a record relies on lives in the change's folder; R16 of 2026-10-07, a start chosen from the situation a request begins in; and R22 of 2026-10-08, "yes amend, with one change", the roster table's names and steps
  3. series-s7-roster-2026-09-11: the operator's ruling of 2026-09-11 that the plan's open items be finished with the maintainer's recommendations; the recommendation, recorded in that file, keeps the nine method edits
  4. The method items carry the operator's ruling of 2026-09-11 (series-s7-roster-2026-09-11), in the operator's words as review-contracts-2026-09-26 records them: "whatever the plan still owed be finished with the maintainer's recommendations"
  5. The method items carry the operator's ruling of 2026-09-11 (series-s7-roster-2026-09-11), "whatever the plan still owed be finished with the maintainer's recommendations"
  6. the operator's rulings of 2026-10-04, "cool then lock everything in": a start hands the job to a mode the owner approves, every change has one record with its working files and its folder, and a start that edits no file needs no mode and no record
  7. R16 of 2026-10-07, a start chosen from the situation a request begins in ("update the agents md created by greenline product to mention the kind with the skill table and also prose about when to use what kind skill")
  8. the operator's ruling R22 of 2026-10-08 on the re-cut brief, "yes amend, with one change": the roster table's names stand, router, diagnose and architecture-survey among them, with the trial names idea-refine, constraint-driven-development, correct and improve-instructions
  9. J-59, on the operator's words of 2026-10-09 ('okay then implement all of this'): a gist of at most twelve words on every account whose reason is stated; no text, measure or method changes
  10. The operator's card of 2026-10-19 naming the three modes, "quick, regular, careful (Recommended)": the old names and the trial step in a skill's prose are corrected by the smallest substitution
  11. The operator's words of 2026-10-18 on the redesign (N-56, items 2 and 7), "we need the upstream prose upfront and references hold how to work meaning the artefacts etc" and, on the ingest procedures, "we wanna have there prose .. what we don't wanna have is there artefact system and fit them to use ours"; and J-93 S2's finalise words of 2026-10-19, "Fast route, merged slices, parallel jobs (Recommended)": a skill's front is the upstream prose its recipe cuts, and its mechanics, where its work lands, its section's form, its depths at each mode and its commands, stand on its references page
4 earlier entries
  1. 2026-10-19 2026-10-19-sweep-tests-three-modes

    Sweep tests names the three modes

    Pages it touched: SKILL.md

  2. 2026-10-09 2026-10-09-sweep-tests-gists

    Every account gets a short gist for the website

  3. 2026-10-08 2026-10-08-sweep-tests-recut

    Re-cut as a start whose sweep is a change of its own

    Pages it touched: SKILL.md

  4. 2026-10-07 2026-10-07-sweep-tests-recipe

    Moves to its recipe byte for byte, nothing changed