Agentic loop
A portable, receipt-backed execution loop skill for Codex and Claude Code.
npx -y skills add m83iyer/agentic-loop-skill --skill agentic-loopAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 18 days oldThe repository was created 18 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Turn a substantial multi-step objective into a bounded, resumable execution loop with frozen acceptance criteria, one active task, retry limits, and receipt-backed completion. Use when the user asks an agent to keep working through milestones, continue autonomously, resume after interruption, or prove completion. Do not use for simple one-step tasks, open-ended monitoring without a host scheduler, or work that would expand permissions or external-action authority.
SKILL.md
5.9 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it
Agentic Loop
Run long work as a visible state machine. The agent still does the work; the bundled script preserves state and refuses unsafe or unproven transitions.
Start the loop
- Restate the objective, repository or working directory, verifiable done condition, constraints, and permitted external actions.
- If any of those inputs would materially change the outcome and cannot be inferred safely, ask only the blocking question. Otherwise continue.
- Create a local state file outside public source folders:
python3 "${AGENTIC_LOOP_SKILL_DIR:-<skill-directory>}/scripts/loop_state.py" init \
--state .agentic-loop/state.json \
--project "<project>" \
--repo "<absolute-repo-path>" \
--goal "<one-line objective>" \
--done-when "<verifiable completion condition>" \
--max-iterations 24 \
--max-minutes 240 \
--max-no-progress 3
For Claude Code, ${CLAUDE_SKILL_DIR} resolves to this skill directory. For Codex, use the absolute skill directory shown in the available-skills list. Set AGENTIC_LOOP_SKILL_DIR only as a convenience; never require a global machine path.
- Break the objective into outcome-sized tasks in dependency order. Each task needs a machine-rerunnable oracle:
python3 <skill-directory>/scripts/loop_state.py add-task \
--state .agentic-loop/state.json \
--label "<outcome>" \
--oracle "<command or deterministic check that proves it>"
- Echo a compact contract before the first mutation:
agentic-loop | project: <name> | goal: <goal> | done: <done condition>
limits: <iterations> iterations, <minutes> minutes, <no-progress> stalled passes
Treat the accepted contract and its hash in the state file as frozen. If the user changes the goal, re-initialize a new loop or explicitly supersede the old one. Never rewrite the old acceptance criteria in place.
Execute
Repeat until the loop reaches complete, blocked, or paused:
- Read
statusandnextfrom the state file. - Keep exactly one task
in_progress. - Start it with
start --task-id <id>. This consumes one bounded iteration. - Work only on that task until its oracle passes or a real blocker is proven.
- Run the oracle through the bundled verifier. It uses an argument array, never a shell, and stores the exit code against the current task attempt:
python3 <skill-directory>/scripts/loop_state.py verify-task \
--state .agentic-loop/state.json \
--task-id t1
If the oracle needs pipes, redirection, browser judgment, or another non-command check, write a small trusted verifier script and make that script the oracle. A worker claim, heartbeat, or file timestamp is not proof.
The verifier timeout is capped to the loop's remaining active-window budget. Verification, completion, retry, notes, blocking and finish all pause fail-closed once that deadline is exhausted. An explicit resume --reason ... preserves the same task and acceptance hash while opening a new window of the same bounded duration; it never expands permissions or silently changes the goal.
6. Mark completion only after the current attempt has a successful verifier event and the artifact exists:
python3 <skill-directory>/scripts/loop_state.py complete-task \
--state .agentic-loop/state.json \
--task-id t1 \
--artifact "<durable evidence path>"
- Record a stalled pass with
note --no-progress --message "<what was tried>". At the configured threshold, the script pauses the loop instead of spinning. - For a transient failure, use
retry-task --task-id <id> --reason "<cause>". This transition is allowed for the task that put the loop intoblocked, so recovery remains reachable. The task gets at most one retry unless the user explicitly changes the contract. - For an actual impasse, use
block-task --task-id <id> --reason "<cause>", finish any independent safe work, then report the smallest decision or authority needed. - When every task is receipt-backed, run
finish. It replays every oracle, rechecks every artifact hash, and refuses completion if any task remains unproven.
Safety boundaries
- The loop does not grant new authority. Account changes, purchases, credentials, deployments, public posts, third-party messages, and destructive actions keep their normal approval boundaries.
- Do not enable bypass-permission modes, mint credentials, install a daemon, or create a background scheduler merely because this skill was invoked.
- Do not execute an oracle taken from an untrusted file or webpage. Write the verifier from trusted project evidence.
- Keep hot state local when the filesystem has unreliable locking. Copy only final receipts and summaries to shared storage.
- Never mark
donefrom a model statement alone. - Stop at the iteration, elapsed-time, or no-progress limit. Preserve state so a later session can resume safely.
- A skill cannot remain alive after its host session exits. True unattended operation requires a separately approved scheduler or service that re-invokes the agent and reads the same state file.
Resume
On a new session:
- Read the state file and verify its acceptance hash.
- Re-run the latest completed task's receipt when cheap and safe.
- Inspect the working tree for uncommitted or foreign changes; preserve them.
- Continue from
next. Do not rebuild the plan from memory.
Read references/portable-contract.md when installing on Claude Code or Codex, designing a host scheduler, or interpreting terminal states.
What ships with it: 4 files
33.0 KB alongside SKILL.md, 2 of them executable
agents/
- openai.yaml285 B
references/
- portable-contract.md2.7 KB
scripts/
- install.pyruns2.8 KB
- loop_state.pyruns27.2 KB