scaffold_test
Generate a pending test stub from a post-incident lesson to document behavioural mistakes. The stub carries incident provenance and returns the sensor arming command.
Instructions
Generate a PENDING post-incident test from a lesson (attempt/gotcha) — the on-ramp to a command sensor. A command sensor routes YOUR test as its oracle, but someone has to write it; this writes the skeleton so you only fill in the assertion.
USE THIS right after mem_tried when the mistake is behavioural (a regex can't express it): it
writes a stub carrying the incident's provenance and returns the exact sensors propose --kind test command to arm it.
It DOES NOT arm a sensor — propose_sensor stays the sole validated writer, and the stub is left PENDING (todo/skip) so the suite stays green until you write the assertion. Monorepo-aware: the framework and location come from the package that owns the lesson's anchor paths.
PARAMETERS: memory_id — the attempt/gotcha to scaffold from framework — vitest | jest | pytest | gotest (auto-detected when omitted) out_path — override the test file path (repo-relative) write — write the file (default true); false returns the content for preview
RETURNS: { ok, path, run_command, propose_command, content, written, already_exists, notice }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| style | No | Test shape (default 'example'): 'property' states the invariant once and checks it over many generated inputs (fast-check/Hypothesis); 'differential' asserts the subject agrees with a `reference` implementation for all inputs. Both lower the cost of expressing the invariant. | |
| write | No | Write the file to disk (default). false = return the content for preview without writing. | |
| red_ref | No | Pre-fix incident commit/ref. When set, the scaffold names the symbols the fix (<red_ref>..HEAD) touched within the lesson's anchor scope and pre-fills the example around them, so the assertion is a targeted edit rather than a blank page. A bad ref falls back to the generic template. | |
| out_path | No | Override the generated test file path (repo-relative). | |
| framework | No | Test framework. Auto-detected from the package that owns the lesson's anchor paths when omitted. | |
| memory_id | Yes | Id of the attempt/gotcha lesson to scaffold a post-incident test from. | |
| reference | No | Required for style='differential': import specifier of the reference implementation to compare against. |