loop

A set of patterns for running software-development tasks repeatedly, from simple step-by-step pipelines to complex workflows with multiple agents.

In plain words
What is it for?
Use it to design autonomous coding workflows, continuous development pipelines, parallel agent work, or repeated cleanup passes.
Why use it?
It helps you choose how much automation and coordination a development process needs, while covering state, quality checks, and merging work.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/jcarlosrodicio/opencode-agent-orchestration-kit/loop
Clone the repo
git clone --depth 1 https://github.com/jcarlosrodicio/opencode-agent-orchestration-kit
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,913 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00018 $0.01913
Opus 5 $0.00009 $0.00957
Sonnet 5 $0.00004 $0.00383
Haiku 4.5 $0.00002 $0.00191

Measured 2d ago against content hash 658651f40738, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loop scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

opencode/commands/loop.md · 197 lines

How it starts

The opening of the file, as written. The whole thing — 197 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Objective or action:

$ARGUMENTS

Run a manual, resumable engineering loop for work with mechanical validation. This command does not schedule recurring runs or turn the task into unattended automation.

Verifiable invariants

approval_gate: explicit_before_writes
max_iterations_per_invocation: 3
planned_iteration_budget: task_specific_1_to_6
hard_safety_ceiling: 6
completion_authority: reviewer_only
canonical_review_policy: code-review-and-quality/references/review-policy.md
final_review_authority: reviewer
canonical_state_path: .opencode/loops/<slug>.json
history_path: .opencode/loops/<slug>.history.jsonl
lock_path: .opencode/loops/<slug>.lock
human_view_path: .opencode/loops/<slug>.md
worktree_mode: explicit_opt_in

The three-iteration value limits one invocation. The persisted planned_iteration_budget (planned_iterations in canonical state) is the total budget for the mission and may not exceed the hard ceiling of six; current_iteration may never exceed that budget. Once the total budget is exhausted, the loop must stop as blocked or completed rather than injecting another continuation.

The durable handoff_packet (.opencode/handoffs/<slug>.md with approval_status) persists human approval to survive session restarts. /loop keeps .opencode/loops/<slug>.json as canonical state, .opencode/loops/<slug>.history.jsonl as append-only history, and .opencode/loops/<slug>.md as the human view. See docs/ai/harness/agents.md section "Durable /loop state".

Each iteration follows:

developer -> reviewer -> developer (state sync)

Interface

  • /loop <objective> designs a new loop.
  • /loop resume <slug> inspects canonical state before the gate and acquires the durable lock only after explicit approval.
  • Enable a worktree only when the user explicitly includes worktree in the arguments or requests it at the approval gate. Otherwise work sequentially in the current checkout.
  • Every invocation, including a resume, opens a new block of at most three iterations.

Read the full file on GitHub · 197 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 197 lines · 18 tokens per session scan A 658651f40738

Subscribe to this mod's changes

loop is a command published in the GitHub repository jcarlosrodicio/opencode-agent-orchestration-kit (105 stars, last pushed 4d ago), licensed Apache-2.0. It adds 18 tokens to every session and 1,913 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.