Skip to content

[FEATURE]: Add /loop command for automated iterative task execution #23578

Closed as not planned
mgajda/opencode
#3

Description

@vipuljaverioutreach

Add a built-in /loop command to OpenCode for automated iterative task execution.

The goal is to support a workflow similar to Claude Code's /loop, where the agent can continue working on a task across repeated iterations without the user having to manually re-prompt each time.

Requested behavior:

  • /loop <prompt>

    • Starts a self-paced loop for the current session
    • Runs one iteration immediately
    • If the model indicates more work is needed, it continues automatically
    • Stops when the task is complete, blocked, or the user stops it
  • /loop <interval> <prompt>

    • Example: /loop 5m check whether the deploy finished
    • Runs one iteration immediately, then repeats on the requested interval
  • /loop stop

    • Stops the active loop for the current session
  • /proactive

    • Optional alias for /loop
  • If /loop is run without a prompt:

    • Use a project-level default prompt from .claude/loop.md if present
    • Otherwise fall back to a built-in default maintenance prompt

Expected benefits:

  • Makes long-running and check-back-later workflows much easier
  • Improves support for proactive/autonomous agent usage
  • Reduces repeated manual prompting for monitoring, validation, and follow-up tasks
  • Brings OpenCode closer to expected behavior from other coding agents that already support loop-style execution

Suggested implementation constraints:

  • Keep it server-backed so it works consistently across app/TUI
  • Reuse the existing session/command runtime instead of building a separate scheduler in the frontend
  • Make loop state session-scoped
  • Ensure users can stop loops explicitly
  • Avoid exposing internal loop control markers in visible assistant output

Examples of use cases:

  • Monitor a deploy and report back when it is complete
  • Periodically rerun tests or checks during ongoing work
  • Continue a multi-step maintenance task until there is nothing left to do
  • Perform proactive project checks when the user asks the agent to “keep going until done”

This would be a core workflow feature, so I’m opening this as a feature request first for discussion and design review.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 20, 2026
  2. assigned and unassigned on Apr 26, 2026
  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 3, 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