anomalyco / anomalyco/opencode

[FEATURE]: /loop — dynamically repeat a command N times

Open
#41,907 1 comment 0 reactions 1 assignee View on GitHub

@rekram1-node is already working on this.

Since Aug 12, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Requested feature

Add a /loop <command> slash command (inspired by Claude Code's /loop) that repeats a command dynamically — either a fixed count or until a condition is met.

Why

openCode's session.command execution path (packages/opencode/src/command/index.ts) is single-shot: one slash command maps to one template invocation. There is no built-in looping/iteration primitive for rerunning a task until success, until a test passes, or a fixed N times.

Proposed behavior

  • /loop 5 <cmd> runs a command 5 times.
  • /loop until-pass <cmd> retries a command until it exits successfully.
  • Loop state (count, per-iteration result/timestamps) surfaced in the TUI; interruption via the existingsession.interrupt path.

Benefits

  • Native retry/iterate workflows for flaky tests, convergence loops, or repeated formatting/lint passes without writing a script.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.