Skip to content

Scheduled scripts ​

Poll something in the background without spending tokens.

@lukstei/dsh-schedule-script

What it does ​

  • Runs a TypeScript script on an interval in the background, with no model calls while it stays quiet.
  • Keeps state between runs, so a script can count, remember the last result, or stop itself.
  • Wakes the agent only when the script returns a prompt, and delivers that prompt as a new message.
  • Shows the schedule status in a timer button next to the prompt box.
  • The agent writes and tests the script for you and asks for your confirmation before it schedules anything.

How to use ​

  1. Ask the agent for a recurring check, for example: Check main CI every 5 minutes. Wake me only if it fails.
  2. The agent writes a script (usually in .agents/scripts/) and replies with the proposed schedule: script path, title, interval and initial state.
  3. Read the script. It will run with your user permissions. Reply to confirm, or ask for changes.
  4. After you confirm, the agent test-runs the script once and, if that works, schedules it.
  5. Watch the timer button in the prompt toolbar. When the script returns a prompt, it appears as [Scheduled Task: <script path>] followed by the text, and the agent responds.

The script exports a main function that receives state and sessionId and returns the next state, plus optionally prompt (wake the agent), error (warning, keep running) or stop (end the schedule).

Controls & gestures ​

Prompt toolbar
WhereGestureResult
Timer buttonhoverTooltip: Schedule: <script> (<status> · <n> runs)
Chat
WhereGestureResult
dsh-schedule-script command cardnoneShows the run summary; a warning or fatal error appears as a line under it
Listing and stopping schedules
WhereGestureResult
Automation tasks page, taskselect, then Pause, Resume, Run now or Delete task in the actions menuPauses, resumes, runs once now, or removes the task; stopped script schedules do not run again
Chatask the agentThe agent can also pause or delete the schedule for you

The status popover shows the script path, total runs, last duration, last run time, and any error. It is read only.

Settings you might change ​

None needed; defaults work. The minimum interval is 60 seconds and a script run times out after 30 seconds unless the schedule sets another limit. Details are in the package README.

Works with ​

  • Requires the DSH schedule service; without it the plugin does not load and there is nothing to schedule.
  • Needs a Node version that runs .ts files natively.
  • Related: YAML workflows run multi-step routines you start yourself, this plugin runs checks on a timer.

Good to know ​

  • Trust: scripts run as a normal child process with your user permissions, your environment and the session working directory. There is no sandbox. Read every script before you confirm it.
  • One script schedule per session. A script that throws, has an invalid result or times out is stopped and its schedule deleted.
  • The confirmation is a chat reply, not a dialog. The agent is told to propose the parameters and wait; the scheduling tools only become available on the turn after the skill loads.
  • Model Experience: a skill catalog entry is always present and two tools appear once the skill loads. Quiet runs cost no tokens; a wake-up costs the prompt text.

Install ​

sh
dsh plugin --profile <web|desktop> add @lukstei/dsh-schedule-script

Released under the MIT License.