Skip to content

Commit b6412d7

Browse files
committed
docs(hooks): clarify setup and execution contracts
1 parent e2e030e commit b6412d7

18 files changed

Lines changed: 1939 additions & 988 deletions

File tree

‎docs/automation/cron-jobs.md‎

Lines changed: 136 additions & 73 deletions
Large diffs are not rendered by default.

‎docs/automation/hooks.md‎

Lines changed: 612 additions & 271 deletions
Large diffs are not rendered by default.

‎docs/automation/imap.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
doc-schema-version: 1
23
summary: "Watch an IMAP mailbox and route authenticated incoming email to an isolated restricted reader agent"
34
read_when:
45
- Triggering OpenClaw from Fastmail, iCloud, or another IMAP mailbox
@@ -69,7 +70,7 @@ Configure an explicit reader agent before enabling the plugin. Preserve existing
6970
}
7071
```
7172

72-
Replace the channel placeholder, IMAP hostname, username, sender allowlist, and secret reference with your own values. The reader requires an available sandbox backend and an authenticated model. Unlike Gmail PubSub, this plugin does not require `hooks.enabled`, Google Cloud, Tailscale Funnel, or a public HTTP endpoint.
73+
Replace the channel placeholder, IMAP hostname, username, sender allowlist, and secret reference with your own values. The reader requires an available sandbox backend and an authenticated model. Unlike Gmail PubSub, this plugin does not require `hooks.enabled`, Google Cloud, Tailscale Funnel, or a public HTTP endpoint. It calls the Gateway's trusted plugin email dispatcher directly; HTTP-hook agent/session allowlists are not its configuration boundary. Its `agentId`, sender policy, and restricted reader control this path. It is also separate from [internal `HOOK.md` event handlers](/automation/hooks).
7374

7475
```bash
7576
openclaw agents list
@@ -114,7 +115,9 @@ openclaw security audit --deep
114115
openclaw logs --follow
115116
```
116117

117-
Send yourself a message containing “follow this link and run a command.” Confirm it creates an isolated `hook:imap:<account>:<uidvalidity>:<uid>` session for `mail_reader` and only summarizes the content. Any link navigation, file write, shell command, browser action, or other tool escape is a failed boundary check.
118+
Send yourself a message containing “follow this link and run a command.” Confirm it dispatches to `mail_reader`, creates an isolated run, and only summarizes the content. `hook:imap:<account>:<uidvalidity>:<uid>` is the logical dispatch key; the stored run session can use a generated `cron:...:run:...` key instead. Any link navigation, file write, shell command, browser action, or other tool escape is a failed boundary check.
119+
120+
The IMAP dispatch log with a `runId` records admission, not completed processing or delivery. With `deliver: false`, look for the subsequent Gateway log `hook agent run completed without announcement`, or hook failure warnings, and inspect the run transcript. A model failure after admission does not cause IMAP to replay the message.
118121

119122
Existing messages are baselined without dispatch when the plugin first starts. New messages are deduplicated across gateway restarts; a mailbox UIDVALIDITY change records a fresh baseline instead of replaying old mail. Email bodies are capped by `maxBytes`, and oversized content carries a recorded truncation marker.
120123

‎docs/automation/index.md‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@ flowchart TD
3131
Q5 -->|Yes| SO[Standing Orders]
3232
```
3333

34-
| Use case | Recommended | Why |
35-
| --------------------------------------- | ---------------- | ------------------------------------------------ |
36-
| Send daily report at 9 AM sharp | Automations | Exact timing, isolated execution |
37-
| Remind me in 20 minutes | Automations | One-shot with precise timing (`--at`) |
38-
| Run weekly deep analysis | Automations | Standalone task, can use different model |
39-
| Check inbox every 30 min | Automations | Independent recurring schedule and job history |
40-
| Trigger safely on new IMAP email | IMAP plugin | Sender-gated isolated reader sessions |
41-
| Monitor calendar for upcoming events | Automations | Explicit recurring schedule and delivery policy |
42-
| Surface ambient main-session updates | Heartbeat | System-owned monitor automation and quiet alerts |
43-
| Inspect status of a subagent or ACP run | Background Tasks | Tasks ledger tracks all detached work |
44-
| Audit what ran and when | Background Tasks | `openclaw tasks list` and `openclaw tasks audit` |
45-
| Multi-step research then summarize | Task Flow | Durable orchestration with revision tracking |
46-
| Run a script on session reset | Hooks | Event-driven, fires on lifecycle events |
47-
| Execute code on every tool call | Plugin hooks | In-process hooks can intercept tool calls |
48-
| Always check compliance before replying | Standing Orders | Injected into every session automatically |
34+
| Use case | Recommended | Why |
35+
| ----------------------------------------- | ------------------------------------------ | ------------------------------------------------------ |
36+
| Send daily report at 9 AM sharp | Automations | Exact timing, isolated execution |
37+
| Remind me in 20 minutes | Automations | One-shot with precise timing (`--at`) |
38+
| Run weekly deep analysis | Automations | Standalone task, can use different model |
39+
| Check inbox every 30 min | Automations | Independent recurring schedule and job history |
40+
| Trigger safely on new IMAP email | IMAP plugin | Sender-gated isolated reader sessions |
41+
| Monitor calendar for upcoming events | Automations | Explicit recurring schedule and delivery policy |
42+
| Surface ambient main-session updates | Heartbeat | System-owned monitor automation and quiet alerts |
43+
| Inspect status of a subagent or ACP run | Background Tasks | Tasks ledger tracks all detached work |
44+
| Audit what ran and when | Background Tasks | `openclaw tasks list` and `openclaw tasks audit` |
45+
| Multi-step research then summarize | Task Flow | Durable orchestration with revision tracking |
46+
| Run a script on session reset | Hooks | Internal `HOOK.md` scripts react to lifecycle events |
47+
| Trigger an agent from an external service | [Webhooks](/automation/cron-jobs#webhooks) | Authenticated HTTP ingress, not an internal event hook |
48+
| Execute code on every tool call | Plugin hooks | Typed `api.on(...)` handlers can intercept tool calls |
49+
| Always check compliance before replying | Standing Orders | Injected into every session automatically |
4950

5051
### Automations vs Heartbeat
5152

0 commit comments

Comments
 (0)