Cognition & Introspection

Pre-Generative Loop Gate

Before the next generation fires, detect divergence signatures (narration loops, frustration paths, repetition pressure) and inject a diagnostic steering hint into the prompt rather than veto the call.

Problem

Today's post-hoc detectors only catch these failures after the model has already produced the bad output, by which point the tokens are billed and the user has seen them. The agent itself would frequently avoid the failure if it were told the diagnostic before generating, but nothing reads the available pre-call signal and surfaces it. A hard veto on the next call is too aggressive because the same signature sometimes appears in legitimate work, but doing nothing means paying for the bad output every time.

Solution

A pre-tick function takes recent thoughts, recent tool calls, the affect snapshot, and the preoccupation list and returns either None or a short steering string of the form `[steering] divergence pattern <id> detected; consider <move>`. The hint is appended to the prompt as a system line and the call proceeds. The decision (hint or no hint, which pattern) is logged so post-hoc review can correlate hint-presence with subsequent behavior. Vetoing remains the job of explicit safety patterns.

When to use

  • Specific divergence signatures are detectable from telemetry pre-call.
  • Post-hoc detectors catch the failure too late to avoid the cost.
  • The model is responsive to short steering hints in the system context.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related