From ctx
Generates executable shell scripts to run AI tools (Claude, Aider, generic) in autonomous iteration loops until completion signals like SYSTEM_CONVERGED. Supports custom prompts, max iterations, and CI workflows.
npx claudepluginhub activememory/ctx --plugin ctxThis skill is limited to using the following tools:
Generate a ready-to-use autonomous loop shell script.
Generates copy-paste bash scripts for Ralph Wiggum/AI agent loops to iteratively plan and build code via PROMPT.md, AGENTS.md, specs/*.md, and IMPLEMENTATION_PLAN.md with PLANNING/BUILDING modes, backpressure, and sandboxing.
Restructures human-in-the-loop workflows into autonomous LLM CLI loops with file outputs, structured logs, and trap-or-abandon decisions. For iterative grunt work, web UIs, dashboards, or Claude automation.
Provides patterns for autonomous Claude Code loops from sequential pipelines to RFC-driven multi-agent DAGs. Use for continuous dev workflows, parallel agents, and quality-gated pipelines.
Share bugs, ideas, or general feedback.
Generate a ready-to-use autonomous loop shell script.
loop.sh in the
project root; confirm before overwritingPROMPT.md; if missing, ask the user what prompt file
to usectx init first if neededPROMPT.md (set
those up first with ctx init --ralph)/ctx-loop
/ctx-loop --tool aider
/ctx-loop --prompt TASKS.md --max-iterations 10
/ctx-loop --completion SYSTEM_BLOCKED --output my-loop.sh
| Flag | Short | Default | Purpose |
|---|---|---|---|
--prompt | -p | PROMPT.md | Prompt file the loop reads |
--tool | -t | claude | AI tool: claude, aider, generic |
--max-iterations | -n | 0 (unlimited) | Stop after N iterations |
--completion | -c | SYSTEM_CONVERGED | Signal that ends the loop |
--output | -o | loop.sh | Output script filename |
| Tool | Command generated |
|---|---|
claude | claude --print "$(cat <prompt>)" |
aider | aider --message-file <prompt> |
generic | Template stub for custom AI CLI |
The loop watches AI output for these signals:
| Signal | Meaning |
|---|---|
SYSTEM_CONVERGED | All tasks complete; loop exits |
SYSTEM_BLOCKED | Needs human input; loop exits |
BOOTSTRAP_COMPLETE | Initial scaffolding done; loop exits |
ctx loop $ARGUMENTS
The command writes a shell script (default loop.sh) and makes
it executable. Report the generated path and how to run it:
chmod +x loop.sh # already done by ctx loop
./loop.sh
set -e and a 1-second sleep
between iterations to prevent runaway loops--max-iterations is strongly recommended for first runs;
suggest a reasonable default (e.g., 10) if the user omits it|| true so one
failed iteration does not kill the loopBefore reporting success, verify:
--max-iterations 0, user is aware it runs until
a completion signal (warn them)