yield/Documentation

Primitive 04 / Proof

Require

Make a finish rule executable. If the claim fails, later operations cannot run.

01 / When

Use it before work that depends on a claim.

Turn a value that must be true into an executable gate before later work.

Useful for

  • Require tests to passDo not continue after a failed test.
  • Require zero critical findingsStop while serious issues remain.
  • Require a clean dry runApply only after a safe preview.
  • Require the artifact to existCheck the output before using it.
  • Require saved approvalBind later work to the answer.
  • Require verified stateFinish only when observed state agrees.
Bind the evidence.Pass the command result or structured answer that supports the Boolean expression.
02 / Code

Put the requirement before the effect.

Require · TypeScript
import { defineSkill } from "@operatorstack/yield"

defineSkill((ctx) => {
  const dryRun = ctx.runCommand("dry-run", "npm run migrate -- --dry-run", 300)
  ctx.require(dryRun.exit_code === 0, "dry run succeeds", dryRun)
  return { ready: true }
})
03 / Run

The workflow checks the command evidence.

CursorRequire · passed

› /migrate-database

● Dry run finished with exit code 0.

Requirement passeddry run succeeds

Bound evidence

{ "exit_code": 0, "timed_out": false }
Saved event data{ "claim": "dry run succeeds", "passed": true, "evidence_digest": "sha256:…" }

The coding agent displays the result. The skill workflow evaluates the Boolean and binds the command result as evidence.

04 / Shape

One Boolean, one claim, one evidence value.

Condition
The Boolean expression your program evaluates.
Claim
A short description of what must be true.
Evidence
The optional value supporting the claim.
Failure
Records requirement_failed and ends at that line.
05 / Saved

The requirement and evidence digest are recorded.

Passed requirements travel with the terminal result. A failed requirement makes completion structurally unreachable in that execution.

What Require does not do

It checks the Boolean expression you wrote. It cannot make an agent answer true or prove that a missing check was unnecessary.

Set your examples once

Which language are you using?

We’ll open every language-aware example in your choice. You can still switch any individual code block.