Guardrails that learn from failure
A Ralph-style loop that writes its own rules: when a check fails the same way twice, the failure pattern gets appended to a guardrails file that every later iteration reads first.
/loop read .ralph/guardrails.md before doing anything, then run the full check suite and fix the first failure; if a check fails twice with the same error, append the failure pattern and a one-line rule for avoiding it to .ralph/guardrails.md before retrying; stop when all checks pass or after 15 turns
claude-code · codex
Implementation note
Create an empty .ralph/guardrails.md first and commit it so learned rules survive across sessions. The file becomes a project-specific playbook of what not to do.
Source: Geoffrey Huntley (Ralph technique) ↗
More automation loops
Run workflows with dynamic sub-agents
Split a task into packets, run sub-agents in parallel, synthesize results, and verify completion.
/goal loop and verify until complete
automationlow risk
Run agent turns until goal met
Agent executes repeated turns toward a condition, with a lightweight evaluator checking progress after each turn until the goal is reached.
/goal <condition turns a prompt into a durable objective. Thanos immediately starts a turn toward the condition, and after each turn a fresh, tool-less side-channel evaluator (a one-shot completeSimple call, not a subagent — so no extra agent turn and no re-entrancy) reads the last turn's evidence and returns MET / NOT MET . NOT MET auto-continues another turn with the reason as guidance; MET clears the goal and records the achievement. Unparseable evaluator output is treated as NOT MET (fail-safe: it never declares a false "done
automationmedium risk
Run agent until goal met
Queue agent turns with goal context until your objective is achieved, treating the goal as untrusted data.
/goal <objective , after /goal resume , and after every agent turn that leaves the goal active , the extension queues Codex's goal continuation prompt as hidden model-visible context. The objective is XML-escaped and wrapped as untrusted user data so it does not become higher-priority instructions
automationlow risk