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

    Drawer Cadence

    v1.6.0智能体编排
    opencode-drawer-cadence

    Session-level orchestration for OpenCode — loop (interval-driven re-prompts) and goal (idle-driven completion gating).

    GitHub 星标

    5

    月装机量

    11

    近 7 天 6

    综合评分SCORE

    30.0

    生态多维模型

    最近提交

    2 个月前

    2026-06-20

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-drawer-cadence@1.6.0"]
    }

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

    My drawers of independently installable plugins for two agent harnesses — opencode and pi.

    A "drawer" is a Bun-workspace monorepo: each plugin is published and installed on its own, but plugins sit on shared foundations and are grouped by the harness they target — packages/opencode/* and packages/pi/*.

    opencode plugins

    The opencode plugins share @drawers/core, a private package providing the common engine — SDK client adaptation, the completion gate over opencode's session.idle / session.error stream, the per-parent notification queue, and toast notifiers. The plugins are thin entries; the durable machinery lives in core.

    Package What it gives you Docs
    opencode-drawer-agents Fire-and-forget background agents — launch a task in a child session and pull its output later, without blocking the main loop. Tools: bg_task, bg_output, bg_cancel, bg_list. README
    opencode-drawer-workflows Deterministic multi-agent orchestration — author a workflow as JavaScript that fans out subagents, runs barriers and conditionals, and returns schema-conforming results. A port of Claude Code's Workflows feature, with the six named orchestration patterns, per-agent git-worktree isolation, a deep-research built-in, and save-a-run-as-workflow. Tools: workflow, workflow_status, workflow_stop, workflow_save_run (plus a global structured_output tool), and a native /workflows TUI viewer. README
    opencode-drawer-cadence Session-level re-prompting that mirrors Claude Code's /loop and /goal: drive the current session on a fixed interval, or until the model declares a goal met. Tools: loop, goal, cadence_stop, cadence_list. README
    opencode-drawer-statusline A compact prompt status line — directory, worktree, branch, session status, and opencode version under every prompt. README

    Add the plugins you want to your opencode.json:

    {
      "plugin": [
        "opencode-drawer-agents",
        "opencode-drawer-workflows",
        "opencode-drawer-cadence",
        "opencode-drawer-statusline"
      ]
    }
    

    Install any subset — they are independent. See each package README for tool parameters and usage.

    pi plugins

    The pi port of the same set, targeting pi, whose plugin model is called extensions (@earendil-works/pi-coding-agent). They share @drawers/pi-core — the pi-native engine: a SessionRunner that spawns one pi --mode rpc child per task and fuses agent_end + process-exit into an exactly-once terminal (replacing opencode's session.idle completion gate), plus the harness-agnostic persistence / notification-queue / concurrency layers under the pi-drawers data namespace.

    Package What it gives you Source
    pi-drawer-agents Fire-and-forget background agents — launch a task in a child pi session and pull its output later. Tools: bg_task, bg_output, bg_cancel, bg_list. src
    pi-drawer-workflows Deterministic multi-agent orchestration — author a workflow as JavaScript that fans out child pi sessions, runs barriers and conditionals, and returns schema-conforming results; per-agent git-worktree isolation, a deep-research built-in, save-a-run-as-workflow. Tools: workflow, workflow_status, workflow_stop, workflow_save (plus a global structured_output tool), and a /workflows TUI viewer. src
    pi-drawer-cadence Session-level re-prompting: loop (interval-driven) and goal (idle-driven, stops on a GOAL_COMPLETE sentinel). Tools: loop, goal, cadence_stop, cadence_list. src
    pi-drawer-statusline A compact status line in pi's footer — directory, worktree, branch, session status, and pi version. src

    pi loads extensions as TypeScript via jiti (no build step). Install a package with pi install <source> (a local path references it in place; npm/git sources are fetched) or add it to the packages array in pi's settings.json:

    pi install npm:pi-drawer-agents       # once published
    pi install ./packages/pi/workflows    # local, pulled from this repo
    

    Building plugins

    Two Claude Code skills in this repo do the heavy lifting when adding a drawer:

    Skill For SDK
    opencode-plugin-dev opencode plugins @opencode-ai/plugin
    pi-plugin-dev pi extensions @earendil-works/pi-coding-agent

    Development

    bun install          # install workspace dependencies (glob: packages/*/*)
    bun test             # run the test suite (opencode + pi packages)
    bun run typecheck    # tsc --noEmit across every package
    bun run lint         # biome check .
    

    Smoke harnesses exercise the plugins end to end against the real harness. The opencode smokes need an opencode binary on PATH; the pi smokes spawn a real pi --mode rpc child. All hit a live model — they cost tokens and take real wall-clock time, so they are gated out of bun test:

    bun run smoke:agents       # opencode background-agents
    bun run smoke:workflows    # opencode workflows
    bun run smoke              # opencode core harness
    bun run smoke:pi-runner    # pi @drawers/pi-core SessionRunner (real pi child)
    bun run smoke:pi-agents    # pi background-agents (bg_task -> bg_output)
    bun run smoke:pi-workflows # pi workflows (one-agent workflow -> result)
    

    Repository layout

    packages/
      opencode/
        core/                # @drawers/core — private shared engine
        background-agents/   # opencode-drawer-agents
        workflows/           # opencode-drawer-workflows
        cadence/             # opencode-drawer-cadence
        statusline/          # opencode-drawer-statusline
      pi/
        core/                # @drawers/pi-core — private shared engine (SessionRunner)
        background-agents/   # pi-drawer-agents
        workflows/           # pi-drawer-workflows
        cadence/             # pi-drawer-cadence
        statusline/          # pi-drawer-statusline
    .claude/skills/          # opencode-plugin-dev, pi-plugin-dev
    docs/
    

    License

    MIT