Copy the prompt. Let the agent build the control plane. Keep the loop from eating your data.
The rule
Only continue if status = completed
and a new version is detected.
Version check + status guard + debounce lock. That is the whole control plane.
Status machine
- pending
- processing
- validated
- applied
- completed
Failure path: failed → retry with backoff →
escalated to a human.
How the loop works
- Main Agent receives a task / domain / project
- Users hit a website or API
-
Request lands in the DB as
pending+version - DB/Railway event wakes a Sub-Agent
- Sub-Agent checks version + status (stops if stale)
- Route Layer chooses CRUD or API
- Validator runs (must be idempotent)
-
Second Agent applies change →
applied -
Main Agent writes context + history →
completed+ version bump - Loop returns only on completed + new version
What you get
- No double apply Idempotency keys and apply receipts survive webhook retries.
- No half writes Validate and apply stay separate jobs with different risk.
- No self eating loops Re-entry needs completed status and a new version.
Install
Paste into Cursor, Claude Code, Codex, Gemini, or Grok:
Install this skill globally: https://github.com/Ezra-Black/EB-Flow