跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    brianlan

    Loop

    v0.3.0其他
    @brianlan/opencode-loop

    OpenCode plugin for session-scoped recurring loops

    GitHub 星标

    0

    月装机量

    47

    近 7 天 7

    综合评分SCORE

    27.2

    生态多维模型

    最近提交

    2 个月前

    2026-06-18

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@brianlan/opencode-loop@0.3.0"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    An OpenCode plugin that lets you create, list, and delete session-scoped recurring loops (like cron jobs, but temporary).

    Key difference from system cron

    These loops live only in memory. They automatically disappear when:

    • The OpenCode TUI / process exits
    • The session is deleted

    This is by design — perfect for temporary automation within a coding session without leaving background tasks behind.

    Features

    • cron_create – Add a recurring loop using standard 5-field cron syntax
    • cron_list – View loops in the current session
    • cron_delete – Remove a loop by name

    When a loop triggers, it sends a prompt back into the same OpenCode session, so the AI picks it up in the next loop turn. Schedules use standard five-field cron syntax and the OpenCode server's local timezone. The loop keeps the agent that created it.

    Installation

    Option A: bunx (zero-config)

    Run this inside your project directory:

    bunx @brianlan/opencode-loop install
    

    This creates .opencode/plugins/opencode-loop.js automatically. Restart OpenCode and the plugin is ready.

    Option B: npm package

    bun add -d @brianlan/opencode-loop
    # or: npm install -D @brianlan/opencode-loop
    

    Then in opencode.json:

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@brianlan/opencode-loop"]
    }
    

    Option C: manual

    Copy dist/index.js into .opencode/plugins/opencode-loop.js in your project.

    Usage

    Once installed, just ask OpenCode:

    • "Create a loop called healthcheck that runs every 5 minutes and tells me to run the test suite"
    • "List my loops"
    • "Delete the healthcheck loop"

    Example behind the scenes:

    cron_create(name="healthcheck", schedule="*/5 * * * *", command="Run the test suite and report any failures")
    

    Every 5 minutes, the plugin injects a prompt into the current session:

    [Scheduled loop triggered] "healthcheck": Run the test suite and report any failures
    

    The AI then acts on it just like a normal user message.

    Permissions

    This plugin inherits the current agent's permission rules. It does not add any new permission surfaces — when the AI acts on a triggered prompt, it goes through the normal OpenCode tool-approval flow.

    License

    MIT