Skip to content

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

Closed as not planned

Description

@afonsoft

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.

Activity

  1. github-actions commented on Aug 12, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. github-actions commented on Oct 11, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions