loopback

An iterative coding workflow that repeatedly sends the same task to Codex, while preserving progress in files and Git history. It stops when a stated completion signal, iteration limit, or cancellation condition is reached.

In plain words
What is it for?
Use it for multi-step features, repeated bug fixing, self-correction, and gradual improvement of existing code.
Why use it?
It reduces the need to manually restart Codex for complex work that needs several rounds of implementation and correction. A guide mode and a dry run help check the task settings before starting.

Skill for Claude CodeCodex

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 skills/okwinds/miscellany/loopback
Any agent
npx skills add okwinds/miscellany --skill loopback
Clone the repo
git clone --depth 1 https://github.com/okwinds/miscellany

Made for: Claude Code, Codex.

Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,263 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.00107 $0.02263
Opus 5 $0.00053 $0.01131
Sonnet 5 $0.00021 $0.00453
Haiku 4.5 $0.00011 $0.00226

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

Security

Grade A, and why

loopback 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.

The scan reads SKILL.md. This mod also ships 7 executable files (scripts/codex-loopback-wrapper.sh, scripts/extract_codex_json.py, scripts/loopback-manager.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

agent/skills/loopback/SKILL.md · 225 lines

How it starts

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

Loopback 迭代开发循环

快速开始(推荐)

  1. 直接启动(默认会进入“向导模式”)
/loopback "修复 X。完成后输出 <promise>DONE</promise>。" --completion-promise "DONE" --max-iterations 10

说明:

  • 如果当前环境支持交互式输入,/loopback 会默认进入向导:先展示全局步骤,再一步步帮你完善参数与契约
  • 如果当前环境不支持交互式输入,/loopback 会输出步骤概览,并在缺少关键契约时直接失败(避免跑飞)
  • 如需跳过向导:加 --no-wizard
  1. 不确定怎么传参:先看参数说明(不会创建状态文件、不会启动循环)
/loopback --guide
  1. 参数看起来没问题:先用 --dry-run 预演(不会创建状态文件、不会启动循环)
/loopback "修复 X。完成后输出 <promise>DONE</promise>。" --completion-promise "DONE" --max-iterations 10 --dry-run
  1. 正式启动
/loopback "修复 X。完成后输出 <promise>DONE</promise>。" --completion-promise "DONE" --max-iterations 10

什么是 Loopback?

Loopback 是一个基于 Ralph Loop 思想的迭代开发方法论,适配到 Codex CLI 环境。

核心概念:

while true; do
  # 从 .codex/loopback.local.md 读取同一条 PROMPT
  # 运行 Codex 一轮(例如:codex exec)
  # 检查停止条件(max-iterations / completion-promise / cancel)
  if is_complete; then break; fi
done

同样的提示词被反复发送给 Codex。Codex 通过以下方式"看到"自己的先前工作:

  • 文件系统中的修改文件
  • git 历史记录
  • 之前生成的代码

⚠️ 注意:Codex CLI 本身不会“自动重复同一条 prompt”。Loopback 通过状态文件 .codex/loopback.local.md 持久化上下文,再由 driver 脚本反复调用 codex exec 来实现循环。

每次迭代:

  1. Codex 接收相同的提示词
  2. 在任务上工作,修改文件
  3. 尝试完成
  4. 检查完成条件
  5. 如果未完成,进入下一次迭代
  6. 看到之前的工作,逐步改进
  7. 直到完成或达到最大迭代次数

命令

/loopback [OPTIONS]

在当前 Codex 会话中启动 Loopback 循环。

用法:

/loopback "重构缓存层" --max-iterations 20
/loopback "添加测试" --completion-promise "TESTS COMPLETE"
/loopback "修复认证 bug" --dry-run

选项:

  • --max-iterations <n> - 最大迭代次数(默认:无限)
  • --completion-promise <text> - 完成承诺短语(当该短语出现时停止)
  • --guide - 输出轻量参数说明(不启动循环)
  • --wizard - 强制启用向导流程(默认已启用;有些环境会自动降级为非交互预检)
  • --no-wizard - 跳过默认向导(直接按原始参数运行)
  • --allow-infinite - 允许缺少停止契约(危险:可能无限运行;不推荐)
  • --dry-run - 仅显示计划,不执行
  • --no-run - 仅创建状态文件,不启动 driver(用于手动运行 wrapper/调试)
  • --reuse-session - 复用同一个 Codex session(默认,更像 Ralph Loop 的“同一对话”迭代)
  • --fresh-session - 每轮启动新 Codex session(更隔离,但更不“自引用对话”)

/cancel-loop

取消活动的 Loopback 循环。

用法:

/cancel-loop

注意:不要把取消命令当成 prompt 传给 /loopback(例如 /loopback /cancel-loop)。取消应使用 /cancel-loop,或手动删除 .codex/loopback.local.md

Read the full file on GitHub · 225 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 · 225 lines · 107 tokens per session scan A 389b9cf7ea03

Subscribe to this mod's changes

loopback is a skill published in the GitHub repository okwinds/miscellany (50 stars, last pushed 3mo ago), licensed MIT. It adds 107 tokens to every session and 2,263 once invoked, about $0.0005 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.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

babysit-pr

Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…

openai/codex · 114 tokens

imagegen

Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…

openai/codex · 113 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens