Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ An automation runs as a turn on a thread. `--instance` and `--model` choose the

### Jobs agents create

Agents can manage the jobs their own thread made through Mousse's tools (`schedule_list`, `schedule_create`, `schedule_update`, `schedule_pause`, `schedule_run`) when the profile gives agents the `manage` access level. The first job a thread's agent creates is not made at once: you are asked at the top of the Automations inbox, under Needs you, and Allow adds it and lets that thread add more; Not now drops it. Only a turn you started can create or start a job. A job an agent creates runs no wider than that agent, runs at most every 15 minutes, ends after 7 days unless you keep it (Keep, in its Edit details, removes only that end) or extend it (`mousse-cli automation extend <id> [--days 7]`), counts against 10 active agent-made jobs in the profile (these three numbers are defaults: Settings, Agent access changes them, for new creates and changes only), shows "added by" its thread, and takes a webhook only after you keep it. The rules are in `docs/CONFIGURATION.md` (scheduled jobs). These limits bind the Mousse tools. An agent that can run shell commands can reach the daemon's local protocol as you do (`mousse-cli automation ...`), which is what the permission mode of that thread governs.
Agents can manage the jobs their own thread made through Mousse's tools (`schedule_list`, `schedule_create`, `schedule_update`, `schedule_pause`, `schedule_run`). The first job a thread's agent creates is not made at once: you are asked at the top of the Automations inbox, under Needs you, and Allow adds it and lets that thread add more; Not now drops it. Only a turn you started can create or start a job. A job an agent creates runs no wider than that agent, runs at most every 15 minutes, ends after 7 days unless you keep it (Keep, in its Edit details, removes only that end) or extend it (`mousse-cli automation extend <id> [--days 7]`), counts against 10 active agent-made jobs in the profile (these three numbers are defaults: Settings, Agent access changes them, for new creates and changes only), shows "added by" its thread, and takes a webhook only after you keep it. The rules are in `docs/CONFIGURATION.md` (scheduled jobs). These limits bind the Mousse tools. An agent that can run shell commands can reach the daemon's local protocol as you do (`mousse-cli automation ...`), which is what the permission mode of that thread governs.

### Webhook trigger

Expand Down Expand Up @@ -263,7 +263,7 @@ Review pull request {{body.pull_request.number}}, "{{body.pull_request.title}}",
- **Syntax.** `{{body}}` or `{{body.a.b.0.c}}`, optionally with spaces inside the braces. Each part is a key of a JSON object or a number for a position in a list (`items.0` is the first); the body must be JSON. A lookup follows the body's own keys and nothing else: there are no expressions, calls or filters, and `__proto__`, `constructor` and `prototype` never match. Text that is not exactly this form, such as `{{headers.x}}` or `{{ body.a + 1 }}`, stays as written.
- **Only single values.** A placeholder gives a string, a number or `true`/`false`. A missing key, `null`, an object or a list, a body that is not JSON, or a placeholder after the 64 KiB total is used up gives an empty value (a single long value is cut, not emptied), and the run record and the delivery log list the placeholder under `missingPlaceholders`. The run still happens.
- **Headers and secrets are not available.** Placeholders read the body only; nothing from the request's headers, the signature or the secret can reach the prompt.
- **The agent is told it is data.** Each value is sent inside a `<webhook-data-ID>` tag with a random ID chosen for that run, and a note at the end of the prompt says that the tagged text came from a webhook request and is not instructions. A value is cut to one line (line breaks become a space; control, hidden and direction-changing characters, variation selectors and lone surrogate halves are removed or replaced) and cannot contain a tag of that kind. Mousse also does not look for skills inside these tags. So that a value cannot become a skill (`/name`), a file mention (`@path`) or a `$name` mention in an agent program, one character is swapped for its fullwidth look-alike (`/`, `@`, `$`) where such a mention could start: a `/` at the start of the value or after whitespace and followed by a letter, digit, `_` or `-` (so `in /srv/app` reads `in /srv/app`), a `@` or `$` not inside a word and followed by a non-space (so `see @notes.txt` reads `see @notes.txt`, while `user@example.com`, `git@host:repo`, `$5` and `a/b` are unchanged). Copy such a value into a command with that in mind. Values are limited to 4 KiB each, and the values with their tags, truncation markers and the closing note to 64 KiB in total; a value is never searched for placeholders again. Treat the body as untrusted anyway: write the prompt so that acting on a wrong value is harmless, and keep the job's mode and access level as low as the work allows.
- **The agent is told it is data.** Each value is sent inside a `<webhook-data-ID>` tag with a random ID chosen for that run, and a note at the end of the prompt says that the tagged text came from a webhook request and is not instructions. A value is cut to one line (line breaks become a space; control, hidden and direction-changing characters, variation selectors and lone surrogate halves are removed or replaced) and cannot contain a tag of that kind. Mousse also does not look for skills inside these tags. So that a value cannot become a skill (`/name`), a file mention (`@path`) or a `$name` mention in an agent program, one character is swapped for its fullwidth look-alike (`/`, `@`, `$`) where such a mention could start: a `/` at the start of the value or after whitespace and followed by a letter, digit, `_` or `-` (so `in /srv/app` reads `in /srv/app`), a `@` or `$` not inside a word and followed by a non-space (so `see @notes.txt` reads `see @notes.txt`, while `user@example.com`, `git@host:repo`, `$5` and `a/b` are unchanged). Copy such a value into a command with that in mind. Values are limited to 4 KiB each, and the values with their tags, truncation markers and the closing note to 64 KiB in total; a value is never searched for placeholders again. Treat the body as untrusted anyway: write the prompt so that acting on a wrong value is harmless, and keep the job's mode as low as the work allows.
- **Workflows.** A prompt that starts with `/` is a workflow and cannot use placeholders: a webhook run of it fails with a message instead of passing outside text to the workflow.

## agents
Expand Down
8 changes: 4 additions & 4 deletions docs/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Automation **definitions** only (the code calls an automation a job). Runtime fi
|-----|------|---------|-------------|
| `scheduled.enabled` | `boolean` | `true` | When false, MMS/GUI does not start the scheduled ticker |
| `scheduled.jobs` | `ScheduledJobDefinition[]` | `[]` | Job definitions (see below) |
| `scheduled.agentJobs` | `boolean` | `false` | Legacy. The switch is gone: the first time a thread's agent adds an automation through the `schedule_*` Mousse tools, the person is asked at the top of the Automations inbox, under Needs you ("<thread> wants to … · Allow / Not now"); Allow adds it and lets that thread add more within the limits. It still needs the `manage` agent access level. A profile that turned this on earlier lets every thread add them without asking |
| `scheduled.agentJobs` | `boolean` | `false` | Legacy. The switch is gone: the first time a thread's agent adds an automation through the `schedule_*` Mousse tools, the person is asked at the top of the Automations inbox, under Needs you ("<thread> wants to … · Allow / Not now"); Allow adds it and lets that thread add more within the limits. A profile that turned this on earlier lets every thread add them without asking |
| `scheduled.agentJobMaxActive` | `integer` (1 to 100) | `10` | "At most … active" (Settings → Agents → Agent access, Automations agents add): active automations agents may have in the profile at once. Only a person sets it (that setting or `scheduled.settings.set`); no tool an agent holds can. Read at every use, so a change needs no restart. Lowering it never pauses or deletes an existing job: it refuses the next `schedule_create` until there is room |
| `scheduled.agentJobMinIntervalMinutes` | `integer` (1 to 1440) | `15` | "At least … minutes apart": the fewest minutes between runs of a job an agent creates or changes. Same rules as above. It is checked when an agent creates a job or changes its schedule; jobs that already exist keep their schedule |
| `scheduled.agentJobLifetimeDays` | `integer` (1 to 365) | `7` | "End after … days": how long a job an agent creates lasts unless a person extends it; also what `automation extend` gives when no number of days is named. It applies to jobs created or extended afterwards; the stored `expiresAt` of an existing job is not rewritten. A saved value that is not a whole number in range reads as the default |
Expand Down Expand Up @@ -244,7 +244,7 @@ Automation **definitions** only (the code calls an automation a job). Runtime fi
| `permissionMode` | `ask` \| `accept_edits` \| `auto` \| `full` | no | How much a run may do without asking. Never above `permissionCeiling`. Absent: the run follows its thread's mode, up to the job's ceiling. A workflow job (a prompt starting with `/`) takes one too |
| `permissionCeiling` | `ask` \| `accept_edits` \| `auto` \| `full` | set by the daemon | The widest mode a run may have: the mode the job's creator held when they created or last edited it. Every job has one, whoever created it. No request can set it (the protocol refuses the key). A mode with no ceiling in a stored job gets `ask` |
| `createdBy` | `{ threadId, runId?, requestId? }` | no | The agent that created the job (and the creating call's key, so a retry finds the job it made); absent for jobs people create. Shown as "Created by an agent", and every run record of the job is labelled the same way. Set by Mousse; no request can set it |
| `accessCap` | `lineage` \| `read` \| `manage` | no | The most agent access a run of the job is granted: the level of whoever created it. Absent reads as `lineage`. Set by Mousse |
| `accessCap` | `lineage` \| `read` \| `manage` | no | Legacy: an agent access cap older builds stored on agent-made jobs. Ignored and no longer written |
| `expiresAt` | ISO string | no | When the job ends. Set on jobs agents create (`scheduled.agentJobLifetimeDays`, 7 by default, after creation); the scheduler ends the job at that time (`completed`) and only a person extends it (`mousse-cli automation extend`) or removes the end (Keep, in the automation's Edit details). Absent: no end |
| `trigger` | `{ webhook: { scheme: 'mousse', secretRef, createdAt, rotatedAt? } }` | no | Set by `automation webhook enable`. `secretRef` names the signing secret in `secrets/refs.json` (mode `0600`; on Windows the `secrets` folder is limited to your account and SYSTEM); the secret itself is never in this file |
| `trigger.threadEvent` | `{ threadId, number, events }` | no | It wakes on pull request #`number`, linked to thread `threadId`, when one of `events` (`checks_failed`, `checks_passed`, `review`, `comment`) happens. Made from a request to the Automation manager ("when #712 gets a review…") or `scheduled.create` with `threadEvent: { threadId, events }`; the daemon reads the number from the thread's link. The schedule is `manual`, and the run goes to `threadId` (the pull request's thread unless another is chosen). The thread's watch reads the pull request in `event` mode, which posts no notice (a Notify watch serves it as it is). Events its own run caused (a review or comment the signed-in account wrote during the run or the 15 minutes after it, checks on a head first seen then) are ignored; it runs at most once per 10 minutes, and events in between wait in one slot. The newest 10 events and what became of each are kept for "(why?)" |
Expand Down Expand Up @@ -275,11 +275,11 @@ A plain-prompt run is a turn on a thread, admitted by the Run Engine like any me
- **Questions and approvals.** A scheduled turn asks for tool approval and questions like any turn. Nobody is likely watching a per-run thread, so a question or approval waits for its timeout (10 minutes; up to an hour for `ask_user`) and is then denied; a person's message on a bound thread dismisses it and stops the run. The job's occurrence and the thread stay held for that time. A scheduled turn has no time limit of its own yet.

> **Warning: `workspace: project` lets an unattended agent edit your own checkout.** The run works in the same folder you work in, with no worktree, no checkpoints and no undo, and two jobs on one project can edit it at the same time. For an agent-mode job in a Git project, use `newWorktree` (`--workspace new-worktree`), or `mode: plan` if the job should not change files.
- **Jobs agents create.** Agents get five tools (`schedule_list`, `schedule_create`, `schedule_update`, `schedule_pause`, `schedule_run`; see `docs/run-engine/SPEC.md` §15.1) when the profile gives them the `manage` access level. A thread's first add asks the person (see `scheduled.agentJobs`).
- **Jobs agents create.** Agents get five tools (`schedule_list`, `schedule_create`, `schedule_update`, `schedule_pause`, `schedule_run`; see `docs/run-engine/SPEC.md` §15.1). A thread's first add asks the person (see `scheduled.agentJobs`).
- **Only a person's turn creates or starts jobs.** `schedule_create`, `schedule_run` and a `schedule_update` of anything but the name are refused unless a person started the run from the app or the CLI. A scheduled or webhook run, a message another agent sent, a subagent, a wake, a continuation, a bot, a remote send, a run with no recorded binding and one that cannot be read are all refused, so a job can never create or start jobs and no chain of jobs can form.
- **Creator scope.** An agent lists, changes, pauses and runs only the jobs its own thread created through these tools. A person's job, and a job another thread made, are refused like jobs that do not exist. Every change an agent makes is an `agent.action` event on its thread with a row in its transcript, and the job and its run records are labelled "Created by an agent".
- **Bounds.** A person sets them (`scheduled.agentJobMaxActive`, `agentJobMinIntervalMinutes`, `agentJobLifetimeDays`; defaults 10, 15 and 7), and the tools read them at every call. At most that many active agent-made jobs in the profile at once (counted from the saved jobs, so a restart does not reset it; paused and ended jobs do not count). A job runs no more often than every that many minutes (a cron expression has exactly five fields and a fixed list of minutes that far apart; above 60 minutes the hours it names must keep its runs that far apart too). A job ends that many days after it is made unless a person extends it. An agent can only shorten a job's number of runs. A lower limit does not delete or pause jobs that exist: it only refuses new creates or changes. A changed lifetime applies to jobs created or extended afterwards, and the `expiresAt` already stored is not rewritten. No `schedule_*` tool and no tool argument can change these settings.
- **No more than the creator.** The job records the access level and permission mode of the turn that made it, and its runs get at most those; a change by an agent can only narrow them. A job cannot have a webhook until a person keeps it, run a workflow (a prompt starting with `/`; agents do not create, change or start those), use an existing worktree, or be enabled again by an agent: a person resumes a paused job. `schedule_run` is refused in the same cases as Run now (running, claimed, a run in progress or waiting in a queue), for a paused job and for one that has ended.
- **No more than the creator.** The job records the permission mode of the turn that made it, and its runs get at most that; a change by an agent can only narrow it. A job cannot have a webhook until a person keeps it, run a workflow (a prompt starting with `/`; agents do not create, change or start those), use an existing worktree, or be enabled again by an agent: a person resumes a paused job. `schedule_run` is refused in the same cases as Run now (running, claimed, a run in progress or waiting in a queue), for a paused job and for one that has ended.
- **No switch stops them.** `scheduled.agentJobs` only decides whether a thread's first add asks the person; turning it off stops nothing that exists. A person pauses or deletes an agent's automation in the Automations inbox.
- **Threads that are gone.** A job bound to a deleted or archived thread, or made from a thread that was deleted, pauses with a reason instead of failing on every tick.
- **`manual` jobs.** They have no next run and never complete; "Run now" starts them.
Expand Down
Loading
Loading