# Ralph Guardrails

The Ralph loop now includes these guardrails:

## 1. Enabled-state check
Before every iteration, Ralph checks whether `.openclaw/ralph-state.json` has `"enabled": true`.
If not, it exits cleanly.

## 2. Eligible-task check
Before calling OpenClaw, Ralph checks `tasks/TASKS.md` for at least one eligible task in `## Active` marked:
- `[ ] NOT STARTED`
- `[~] IN PROGRESS`

It excludes tasks whose `Status`, `Blockers`, or `Next step` show they are waiting on Shawn or the user.

If no eligible non-waiting task exists, Ralph does not call the agent for work.

## 3. Idle-pass limit
Ralph tracks idle/no-progress passes.
Default: `3`

If Ralph sees no eligible tasks or no visible task-file changes for 3 consecutive passes, it exits.

## 4. Iteration cap
Ralph still stops after `50` iterations by default.

## 5. Config file
Guardrail settings live in:

`/home/clawbot/.openclaw/workspace/.openclaw/ralph-config.json`

Current fields:
- `maxIterations`
- `maxIdlePasses`

## Why this matters
These guardrails reduce unnecessary token usage by making Ralph stop when:
- it is disabled
- there are no eligible tasks
- work is not making visible progress
- iteration limits are reached
