loop-task

A command that runs a coding task through repeated stages: triage, implementation, verification, and a merge gate.

In plain words
What is it for?
Use it to have a maker agent implement each increment, a separate checker verify it, and the loop continue until the task is done or needs your decision.
Why use it?
It breaks work into checkable increments and avoids treating a complex task as a single unreviewed edit.

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/eshwarvijay/secondmate/loop-task
Clone the repo
git clone --depth 1 https://github.com/eshwarvijay/secondmate
Per session 21 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 904 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.00021 $0.00904
Opus 5 $0.00010 $0.00452
Sonnet 5 $0.00004 $0.00181
Haiku 4.5 $0.00002 $0.00090

Measured yesterday against content hash 7f2d70df38e8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

loop-task 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 yesterday.

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.

commands/loop-task.md · 73 lines

How it starts

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

Loop: $ARGUMENTS

Complete the goal above by running the loop below until an exit condition holds. This is the "loop-engineering" pattern (design the loop, not the prompt): a maker/checker split with a human gate before anything risky. Do NOT one-shot the goal — run the stages.

The loop

Repeat until done or escalate:

  1. Triage. State the goal in one line. Break it into the smallest next increment that can be independently verified. If the goal is already met, say so and stop. If it's ambiguous or you'd be guessing at intent, escalate (ask the user) instead of proceeding.

  2. State. Read any existing state relevant to the goal (repo's .claude/task_state.md if present, prior loop notes, the files involved). After each iteration, jot what changed + what's next so a resumed loop has a spine. Keep it to a few lines — not a document.

  3. Implement. Spawn ONE sub-agent (the maker) to make the increment: Agent(subagent_type: "general-purpose"). If the change touches files that a parallel iteration could also touch, pass isolation: "worktree". The maker returns a diff/summary, not a merged result you assumed.

  4. Verify. Spawn a SEPARATE sub-agent (the checker) to verify — never the same context that made the change. The checker runs the tests/build/lints the repo actually has and reads the diff adversarially: does it meet the goal, did it break anything, is the verification itself real (tests exist and ran)? It returns pass/fail with evidence. On fail, feed the reason back to step 1 and iterate. Verification is the human's responsibility by proxy — a green checker that didn't actually run anything is a failure, not a pass.

  5. Gate. Before any outward-facing or hard-to-reverse action (commit, push, PR, deploy, delete, send, external API write):

    • Safe / explicitly pre-authorized → do it, log what you did.
    • Risky / ambiguous / not authorizedescalate: stop and present the user the diff, the verifier's evidence, and the specific action you want to take. Wait for approval. Do not self-approve.

Read the full file on GitHub · 73 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. yesterday First seen · 73 lines · 21 tokens per session scan A 7f2d70df38e8

Subscribe to this mod's changes

loop-task is a command published in the GitHub repository eshwarvijay/secondmate (3 stars, last pushed 5d ago), licensed MIT. It adds 21 tokens to every session and 904 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-31.