convez.ai
AgenteAutomaçãoIntermediário
EmilioEsposito

OpenCode Routines

EmilioEsposito/opencode-routines

Loops, cron prompts e agentes agendados para automação no OpenCode

Ver no GitHub
InicialPluginScore · de 0 a 100

Agente para criar rotinas automáticas no OpenCode: loops na mesma sessão, prompts cron e agentes agendados standalone com suporte a host. Permite executar comandos repetidamente em intervalos fixos ou dinâmicos, além de agendar tarefas duráveis no scheduler do sistema.

Instalação

$npx convez-ai EmilioEsposito/opencode-routines

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
0
Forks
1
Acompanhando
0
Saúde
42%
Último commit
há 4 meses
Versão
—
Issues abertas
0
Contribuidores
3

Casos de uso

  • Monitorar PRs em intervalos regulares
  • Executar verificações de CI automaticamente
  • Agendar tarefas repetitivas na sessão atual
  • Criar agentes standalone que rodam independentemente

Veredito

Ferramenta sólida para automação em OpenCode com três modelos de execução bem definidos (loops, cron, standalone). Adequada para desenvolvedores que precisam de rotinas recorrentes integradas ao fluxo de desenvolvimento, com bom suporte a agendamento persistente via systemd/launchd.

README

A tradução para o português deste README ainda está na fila.

opencode-routines

npm npm downloads license GitHub

Claude-Code-style routines for OpenCode: same-session loops, same-session cron prompts, and host-backed standalone scheduled agents.

Use it for things like:

/loop 5m /babysit-prs
Create a standalone scheduled run every weekday at 9am to summarize my open PRs
Create a same-session cron prompt for 17 * * * * to check whether CI is done

Install

Add the server plugin to your OpenCode config (~/.config/opencode/opencode.jsonc or project-level .opencode/opencode.jsonc):

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

OpenCode installs the package from npm on next start. Use @latest if you want new versions on restart, or pin a version such as "opencode-routines@0.1.9".

That single entry is the whole packaged experience: on load, the server plugin also installs slash commands (/loop, /loops, /stop-loop, /schedule-standalone-session) as managed OpenCode custom command files under ~/.config/opencode/commands/. These work in both the terminal TUI and OpenCode Desktop. The install is idempotent and marker-guarded: only files containing the managed-by: opencode-routines marker are ever created or updated, so a user-edited loop.md (marker removed) is never touched. Restart OpenCode once after the first install for the commands to appear. Opt out with plugin options:

{
  "plugin": [["opencode-routines@latest", { "commands": false }]]
}

What it provides

CapabilitySession modelWhere it runsPersistencePrimary tools / commands
LoopSame conversationCurrent OpenCode host/processProcess-scopedLoopCreate, LoopList, LoopDelete, ScheduleWakeup, /loop
Cron promptSame conversationCurrent OpenCode host/processSession-only for nowCronCreate, CronList, CronDelete
Standalone scheduleFresh standalone opencode runHost scheduler: launchd, systemd, Task Scheduler, or cronDurableScheduleCreate, ScheduleList, ScheduleDelete, ScheduleRun, ScheduleLogs

The ambiguous /schedule slash command is intentionally not registered. Use ScheduleCreate for durable standalone schedules, or /schedule-standalone-session for TUI help.

Same-session loops

Loops run prompts back into the current conversation.

Fixed interval loop

/loop 5m /babysit-prs

Equivalent tool shape:

{
  "prompt": "/babysit-prs",
  "interval": "5m"
}

Dynamic loop

Dynamic loops are self-paced. The first prompt fires immediately, then the model can call ScheduleWakeup to decide when to resume.

/loop /babysit-prs

ScheduleWakeup parameters:

ParamTypeRequiredDescription
delaySecondsnumberyesSeconds until wake-up. Clamped to 60-3600.
promptstringyesThe active loop prompt to fire on wake-up.
reasonstringyesShort explanation for the wake-up.

Omitting ScheduleWakeup ends a dynamic loop.

Same-session cron prompts

Cron prompts enqueue prompts into the current session at wall-clock times. They are not standalone processes and do not run while OpenCode is closed.

Tools:

ToolDescription
CronCreateSchedule a prompt at wall-clock times in the current session.
CronListList active same-session cron prompts.
CronDeleteCancel a same-session cron prompt.

CronCreate parameters:

ParamTypeRequiredDefaultDescription
cronstringyes—5-field cron in local timezone: M H DoM Mon DoW.
promptstringyes—Prompt to enqueue in the same session.
recurringbooleannotruefalse makes a one-shot cron prompt.
durablebooleannofalseAccepted for Claude compatibility, but currently session-only.

Durable standalone schedules

Standalone schedules are independent opencode run processes launched by the host scheduler. They survive terminal exit and machine restarts according to the host scheduler's behavior.

Claude-aligned tools:

ToolDescription
ScheduleCreateCreate a durable host-backed standalone scheduled OpenCode run.
ScheduleListList standalone schedules.
ScheduleDeleteDelete a standalone schedule.
ScheduleRunRun a standalone schedule immediately.
ScheduleLogsView logs for a standalone schedule.

Legacy compatibility tools from opencode-scheduler are still present: schedule_job, list_jobs, get_job, update_job, delete_job, run_job, job_logs, and cleanup_global.

TUI slash commands

Available after the managed command files have been installed (see Install above):

CommandMeaning
/loopStart a same-session live loop. Fixed interval syntax: 5m /babysit-prs; dynamic syntax: /babysit-prs.
/loopsList active loops. Selecting a loop stops it.
/stop-loopStop an active loop.
/schedule-standalone-sessionHelp entry for durable standalone schedules.

Storage and platform support

Standalone schedule storage remains compatible with opencode-scheduler:

WhatWhere
Job configs~/.config/opencode/scheduler/scopes/<scopeId>/jobs/*.json
Run records~/.config/opencode/scheduler/scopes/<scopeId>/runs/*.jsonl
Locks~/.config/opencode/scheduler/scopes/<scopeId>/locks/*.json
Logs~/.config/opencode/logs/scheduler/<scopeId>/*.log
Supervisor script~/.config/opencode/scheduler/supervisor.pl

Standalone schedule backends:

PlatformBackend
macOSlaunchd
Linux with systemdsystemd --user
Linux / POSIX fallbackcron
WindowsTask Scheduler (schtasks)

Compatibility notes

  • Requires OpenCode 1.17.3 or newer.
  • OpenCode loads config once at startup. Restart OpenCode after changing plugin configuration.
  • CronCreate({ durable: true }) is accepted for Claude Code compatibility but currently behaves as session-only.

Debugging

  • Use LoopList and CronList for live same-session state.
  • Use ScheduleList and ScheduleLogs for durable standalone schedules.
  • Standalone run logs live under ~/.config/opencode/logs/scheduler/<scopeId>/.

Development

npm install
npm test
npm run typecheck

For local development, point OpenCode at this repo's built files or source path. Do not load both a local shim and the npm package at the same time, or tools may register twice.

Publishing

This package publishes through GitHub Actions trusted publishing from .github/workflows/publish.yml.

For maintainer release steps and verification, use:

  • .claude/skills/publish-package/SKILL.md

Credits

opencode-routines is a hard fork / successor of opencode-scheduler by Benjamin Shafii. The host-backed standalone scheduling implementation is derived from that project; this fork adds the routines-oriented model, same-session loops, cron prompts, and Claude-aligned tool names.

License

MIT

Ver o original no GitHub

Bom para

Relacionados