Automations

Have DCode run a prompt on a schedule: a daily summary, a weekly dependency check, a nightly test run.

On this page

An automation is a prompt with a schedule and a project. At each run, DCode opens a session in that project and works the prompt as if you had sent it. The desktop app keeps its scheduled tasks under Automations; the CLI hands its schedules to your computer's own scheduler.

Scheduled tasks in the desktop app

Open Settings, Automations (marked Beta) with a project open. There are two ways to make a task:

  • Create in chat. Describe it in your own words, for example Every weekday at 9 AM, summarize code changes and follow-ups for this project, and DCode sets up the task. Making a schedule always asks for your yes in Auto.
  • Create scheduled task. Fill in the form yourself.

The form

  1. Give the task a title, such as Daily standup summary.
  2. Pick the schedule: Every hour, Every day, Every weekday, Every week, Every month, or Custom for any interval of minutes, hours, days, weeks, months or years. The form shows when it will run.
  3. Write the Instructions: what the task should do each time it runs.
  4. Choose the model and the permission mode its runs use.
  5. Leave Repeat indefinitely on, or turn it off and set Max runs to stop after that many.
  6. Choose Create scheduled task.

Run, pause and check a task

  • Each task shows its state (Active, Paused, Completed or Failure), its next run and how many times it has run.
  • Run now starts a run at once. Pause and Continue stop and restart the schedule; Restart starts a finished or failed task again.
  • History lists every run with when it started, whether it was scheduled or manual, its status and how long it took. Go to session opens the run's conversation.
  • You can keep up to 20 scheduled tasks, counting paused, completed and failed ones. Delete one to make room.

dcode schedule in the CLI

shell
# every weekday at 9:00, in this folderdcode schedule add "every weekday at 9:00" "Summarize yesterday's commits and open TODOs"# a cron expression, another folder, plan modedcode schedule add "30 7 * * 1" "Check the dependencies for updates and list them" --cwd ~/code/api --mode plandcode schedule listdcode schedule run <id>dcode schedule remove <id>
  • <when> is a five-field cron expression in local time (minute, hour, day, month, weekday), or words such as "every day at 9:00", "every monday at 8:30", "every weekday at 9:00" or "every 2 hours".
  • Each run is dcode -p "<prompt>" in that folder, the current one unless you pass --cwd, in the auto mode unless you pass --mode.
  • Your computer's own scheduler starts the runs, so the CLI does not need to be open. Each run's output is added to a log under ~/.dcode/cli/schedules.
  • run starts one run now, and list --json prints the schedules as JSON.

Permissions in a scheduled run

Nobody is there to answer during a scheduled CLI run, so a step that would ask is refused. In auto, that means anything Auto always asks about, such as a push or a deploy, does not happen. Pass --mode plan for a task that should only read and report, or another mode when the task needs more (Permissions in a run).

Prompts that work on a schedule

  • Say what to produce and where: write the summary to reports/daily.md, or list the findings in your answer.
  • Keep each run self-contained: put what it needs in the prompt, or point it at a file that holds it.
  • Start in a careful mode and widen it once the runs look right.