Skip to content

Authoring: derive flows from real material, with an acceptance gate that the spec can actually fail #227

Description

@AminChirazi

Writing up a design discussion so it is actionable. The friction being solved: authoring a .flow.yaml by hand is real work, and the prompts people invent for specs are not the prompts users type.

The reframe: a spec has two halves, and different material feeds each

This is the part I would build around, because treating all input as "material to transform" hides where the difficulty is.

  • A recording gives you the PROMPT. A real session shows what a user actually asked, in their phrasing. That is strictly better than an invented task, and it is cheap to extract because the session is already structured.
  • A requirements document gives you the ASSERTION. A requirement states a BELIEF ("the agent must not export while in plan mode"), and a belief is exactly what an assert_* line encodes.

Neither substitutes for the other. A recording shows behaviour and contains no belief; a requirement states a belief and does not know how the system is driven. So the pipeline is two extractions feeding two fields, not one transform.

Evidence that real material beats invented material, from an adopter: the FIRST real recording of an agent flow found a self-contradiction in a tool description that nobody had spotted by reading it - the description asked for "the existing scenario names" as choices four lines before forbidding the enumeration that produces them. An invented prompt would not have surfaced it, because whoever invents the prompt also invents what they expect.

Video is the wrong input, and this repo already says so

docs/recording.md states the position: "Structured data is the machine surface; video is the human surface. Nothing programmatic ever parses pixels." The non-goals are explicit: "any agent-facing video parsing (never planned)."

That is right, and for agent flows it is not close. What is under test is which model calls were made and which tools were invoked. A video shows that indirectly, through pixels, and would need OCR to recover what already exists losslessly as JSON. Session export is the same idea without the loss.

The acceptance gate: can the generated spec FAIL?

A model will happily produce a plausible assertion that is subtly false, and the result is a green flow that asserts nothing - worse than no flow, because it looks like coverage.

Three real instances, all from one adopter in one week:

  1. A spec asserted the agent must not enumerate; the tool description made enumerating mandatory. Plausible, and wrong.
  2. Two tool policies shipped completely inert behind six green unit tests, because the tests were written from the same mental model as the code.
  3. A hand-written audit table was wrong three ways within an hour of being written.

So the gate on a generated spec should not be "does it parse" or even "does it pass". It should be "can it fail?" - generate the spec, generate a deliberately broken variant of the system, and require the flow to go red against it. Only then is it accepted. A spec nobody has seen fail is a guess about what it covers.

This is a natural fit here because the machinery exists: recording an adversarial variant is the same code path as recording the intended one.

It must be allowed to refuse

Most requirements are not assertable at the boundary a flow can reach. In the adopter case, governance (kill switch, volume caps, write approval) executes INSIDE the MCP server, so a cassette replaces the very thing under test and can never assert it. Roughly two thirds of that project's real bugs were found by reading enforcement code rather than by replay, and no amount of spec generation would have changed that.

A pipeline that always emits a spec will emit specs for things the harness structurally cannot check, and those come back green forever. "Not assertable at this boundary, and here is why" has to be a first-class output, alongside a pointer to where the check belongs instead (a unit test, an integration test, or a structural change that makes the case impossible).

Shape

A skill plus a validation loop, not a framework. The pieces mostly exist:

  1. The spec schema (already in flowproof-trace).
  2. A generator that emits a candidate flow from (session | requirement) input.
  3. flowproof record for the intended run, and again for an adversarial variant.
  4. The accept/reject gate above.
  5. The existing structured "here is what I would need to know" payload for ambiguity, rather than guessing when input is thin.

Explicitly NOT worth building: a bespoke transform framework for arbitrary "materials", and video parsing.

Open question

Whether the adversarial variant is generated (mutate the system under test) or declared (the author states what should break it). Generated is more automatic; declared is more honest, because stating what would falsify a claim is most of the thinking that makes the claim worth asserting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions