P154 · Workflow control

Self-Looping Stop Hook (Ralph Loop)

Drive repeated work with explicit completed, blocked and budget-exhausted exits.

Editorially reviewedSource unconfirmed

These examples and illustrative results are independently authored teaching materials, not measured model results.

Use case

An existing Stop Hook resumes a local repair after each turn. The teaching controller has a three-round budget, structured state and regression-check acceptance. It must terminate from evidence rather than an agent-produced DONE string.

Mechanism

Define controller continuation/exits: complete needs observed acceptance, blocked identifies required missing input, exhausted records budget expiry. Persist state/counts and let the controller verify before resuming. Retain unfinished work on exits; stopping is not automatically completion. Prompts describe a contract, while external logic enforces it.

Bad example

Resume despite failed checks, missing inputs or more than three rounds; declare success when the agent writes DONE.

Good example

Read teaching structured state: current-revision regression-check evidence permits complete; missing required input means blocked; three failed rounds mean exhausted. Resume only with budget and executable work. Preserve attempts/gaps on exit without accepting DONE alone or resetting count after a new session.

Why the change matters

A string produced by the evaluated agent cannot independently establish acceptance. Structured states and external checks connect loop control to observable conditions, separating stop reason from result.

Observable expectation

Simulate passed→complete, missing→blocked and three failures→exhausted. The latter two end automatic resumption with unfinished work retained.

Inspect real cap enforcement and rejection of DONE with failed checks. No actual Hook is configured here.

Limits

The host must support and implement the controller; prompts cannot enforce their own termination. Three rounds/state names are teaching choices, action scope still applies and Ralph naming does not prove capability. Provenance is unconfirmed.

Sources and evidence

Source text has not been located. This method meets the editorial criteria; its examples are independent teaching constructions.

Read the editorial criteria

Related methods