Skip to main content

Decree

Decree runs the stack's automations.

  • A script is bash that does one job.
  • A machine is a few lines of YAML naming the script and its params.
  • A trigger (a cron file, an HTTP POST, a file change, another machine) produces a markdown message with machine: in its frontmatter, and the daemon runs that machine with the message's params:.
To…Read
Write your own automationWriting a Plugin — machines, scripts, triggers, chaining
Run something when a file changesFile Handlers
Hand a task to a specific agent profileRouting to Departments
See it all assembled on a real problemNote → Action
Reach the stack from outside over HTTPOver HTTP

Running Decree​

  • automation: routing, AI work, every one-time setup (order file).
  • automation-backup (off by default): backups, triage, and anything needing bulk volume access.

Each is its own decree project with its own runs.

docker exec automation decree status # runs by state, and what is queued
docker exec automation decree status --cron # each cron file and when it fires next
echo | docker exec -i automation decree emit --machine <name> # run one by hand

Every machine and chain an install has is drawn in workspace/.decree/system.md, and each machine in its own machines/<name>/graph.md (and the same in services/automation-backup/), redrawn whenever ./existential.sh installs a change. Which machines those are is up to you: see Plugins.

Claude for machines​

You get new machines by talking to Claude in code-server's terminal: it writes each as a plugin file in .decree/plugins/ and installs it. Machines call AI in two ways:

  • model_chat (workspace/.decree/lib/model.sh) is one answer from the stack's own model endpoint.
  • agent (workspace/.decree/lib/agent.sh) is Claude Code, which can read and search your workspace.

The automation container comes with Claude Code installed, and shares code-server's login: start claude once in code-server's terminal and /login, and machines are signed in too.

The login is kept in volumes/code_server_data/home/.claude. To use an API key or a claude setup-token token instead, set AUTOMATION_ANTHROPIC_API_KEY or AUTOMATION_CLAUDE_CODE_OAUTH_TOKEN in services/automation/.env, then docker compose up -d.

Once it is signed in:

  • the automations you write in a note are built by Claude rather than the chat model;
  • a step of one can hand Claude a task;
  • every call adds a line to .decree/ai-use.md;
  • a call that hits Claude's usage limit waits for it to reset, up to six hours, and otherwise stops the run and tells you on ntfy.

A machine's Claude runs unattended in Claude Code's auto mode.

  • It can't change your notes: the container sees them read-only, so an instruction hidden in an email or web page can't rewrite them.
  • It can use everything else the container reaches: the rest of the workspace, automation's service credentials, the network. Output goes to workspace/ai/.
  • That includes your stored passwords. /secrets (rclone, Gmail, Actual Budget, SSH keys) and automation/.env are in the same container. A machine that hands Claude something from outside, an email, a newsletter, a web page, hands it whatever instructions are hidden in it, and in auto mode a prompt injection that gets past Claude's own checks could read those files and send them out over the network. Turn on only the machines that feed Claude outside content when you accept that, and keep in /secrets only what your plugins need.
  • AUTOMATION_CLAUDE_PERMISSION_MODE=default limits it to reading and searching, : it can still read them, but it can't run a command or reach the network on its own.
  • Calls go to Anthropic under your account's terms.

When a run needs you​

A run that fails or waits for a person sends one ntfy message, with the machine, what happened, and the command to continue. It goes to the decree topic, or to host for a plugin that does the server's own work (x-exist-topic: host: health checks, backups, sync, setup):

  • failed: docker exec automation decree retry <id>
  • waiting: docker exec automation decree reply <wait id> <option>

One message per state. A failed notify run is never reported. automation-backup runs report through Grafana's alert when monitoring is on.

Integrations​

Gmail and rclone have interactive setup scripts: Integrations.

File events​

  • A change matching a handler in workspace/.decree/handlers.yml runs its machine: File Handlers.
  • Nextcloud uploads can post to the webhook's /files endpoint: File Change Processing.