@aitne-sh/aitne 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/README.md +41 -11
  2. package/agent-assets/agent-profiles/background-task.md +53 -0
  3. package/agent-assets/agent-profiles/conversational.md +1 -0
  4. package/agent-assets/agent-profiles/routine-fetch-window.md +14 -75
  5. package/agent-assets/agent-profiles/routine.md +1 -1
  6. package/agent-assets/agents/{hourly-check → activity-scan}/agent.md +22 -17
  7. package/agent-assets/agents/monthly-review/agent.md +6 -5
  8. package/agent-assets/docs/concepts/agent-day.md +6 -7
  9. package/agent-assets/docs/concepts/auth-health.md +23 -20
  10. package/agent-assets/docs/concepts/backends-and-tiers.md +13 -9
  11. package/agent-assets/docs/concepts/costs-and-quotas.md +14 -12
  12. package/agent-assets/docs/concepts/delegated-mode.md +18 -17
  13. package/agent-assets/docs/concepts/memory-model.md +16 -9
  14. package/agent-assets/docs/concepts/observations.md +24 -20
  15. package/agent-assets/docs/concepts/process-keys.md +10 -9
  16. package/agent-assets/docs/concepts/routines.md +34 -31
  17. package/agent-assets/docs/concepts/safety-and-execution.md +11 -7
  18. package/agent-assets/docs/concepts/safety-model.md +39 -25
  19. package/agent-assets/docs/concepts/skills.md +12 -10
  20. package/agent-assets/docs/features/integrations/browser-history.md +23 -18
  21. package/agent-assets/docs/features/integrations/calendar.md +28 -17
  22. package/agent-assets/docs/features/integrations/git.md +13 -11
  23. package/agent-assets/docs/features/integrations/github.md +22 -14
  24. package/agent-assets/docs/features/integrations/mail.md +25 -22
  25. package/agent-assets/docs/features/integrations/notion.md +35 -11
  26. package/agent-assets/docs/features/integrations/obsidian.md +8 -8
  27. package/agent-assets/docs/features/lifestyle/git.md +27 -23
  28. package/agent-assets/docs/features/lifestyle/reading.md +20 -11
  29. package/agent-assets/docs/features/lifestyle/receipts.md +11 -10
  30. package/agent-assets/docs/features/lifestyle/travel-bookings.md +4 -3
  31. package/agent-assets/docs/features/memory-files/agent-journal.md +53 -26
  32. package/agent-assets/docs/features/memory-files/agent-lessons.md +178 -0
  33. package/agent-assets/docs/features/memory-files/projects.md +11 -8
  34. package/agent-assets/docs/features/memory-files/roadmap.md +17 -14
  35. package/agent-assets/docs/features/memory-files/schedule.md +6 -3
  36. package/agent-assets/docs/features/memory-files/today.md +10 -7
  37. package/agent-assets/docs/features/memory-files/user-profile.md +14 -9
  38. package/agent-assets/docs/features/messaging/bang-commands.md +21 -6
  39. package/agent-assets/docs/features/messaging/overview.md +17 -14
  40. package/agent-assets/docs/features/messaging/telegram.md +10 -9
  41. package/agent-assets/docs/features/operations/activity-and-conversations.md +6 -5
  42. package/agent-assets/docs/features/operations/approvals.md +6 -5
  43. package/agent-assets/docs/features/operations/browser-tasks.md +184 -0
  44. package/agent-assets/docs/features/operations/cost-tracking.md +11 -1
  45. package/agent-assets/docs/features/operations/managed-chromium.md +4 -2
  46. package/agent-assets/docs/features/operations/notifications.md +11 -1
  47. package/agent-assets/docs/features/operations/quiet-hours.md +41 -11
  48. package/agent-assets/docs/features/operations/schedule-approaching.md +2 -2
  49. package/agent-assets/docs/features/routines/activity-scan.md +220 -0
  50. package/agent-assets/docs/features/routines/custom-routines.md +82 -134
  51. package/agent-assets/docs/features/routines/evening-review.md +23 -13
  52. package/agent-assets/docs/features/routines/morning-routine.md +7 -5
  53. package/agent-assets/docs/features/routines/weekly-review.md +24 -3
  54. package/agent-assets/docs/features/wiki/commands.md +4 -4
  55. package/agent-assets/docs/features/wiki/cost-and-approval.md +4 -3
  56. package/agent-assets/docs/features/wiki/dashboard.md +7 -6
  57. package/agent-assets/docs/features/wiki/overview.md +3 -3
  58. package/agent-assets/docs/features/wiki/search.md +5 -5
  59. package/agent-assets/docs/features/wiki/workspaces.md +2 -2
  60. package/agent-assets/docs/getting-started/01-what-is-this.md +3 -3
  61. package/agent-assets/docs/getting-started/02-first-steps.md +5 -3
  62. package/agent-assets/docs/getting-started/04-first-day.md +27 -30
  63. package/agent-assets/docs/glossary.md +8 -8
  64. package/agent-assets/docs/guides/add-a-custom-routine.md +122 -68
  65. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +2 -2
  66. package/agent-assets/docs/guides/connect-a-new-mail-account.md +4 -2
  67. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +5 -4
  68. package/agent-assets/docs/guides/install-and-run.md +2 -2
  69. package/agent-assets/docs/guides/maintain-wiki-health.md +2 -2
  70. package/agent-assets/docs/guides/pause-the-agent.md +27 -21
  71. package/agent-assets/docs/guides/reinstall-cleanly.md +2 -0
  72. package/agent-assets/docs/guides/setup-wizard.md +12 -6
  73. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +6 -6
  74. package/agent-assets/docs/reference/api.md +26 -5
  75. package/agent-assets/docs/reference/cli-commands.md +3 -3
  76. package/agent-assets/docs/reference/config.md +51 -24
  77. package/agent-assets/docs/reference/disallowed-tools.md +6 -4
  78. package/agent-assets/docs/reference/keyboard-shortcuts.md +2 -2
  79. package/agent-assets/docs/reference/knowledge-layout.md +25 -12
  80. package/agent-assets/docs/reference/process-keys.md +9 -9
  81. package/agent-assets/docs/reference/skills.md +10 -6
  82. package/agent-assets/docs/troubleshooting/auth-failed.md +9 -8
  83. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +16 -9
  84. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +2 -2
  85. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +32 -16
  86. package/agent-assets/docs/troubleshooting/observation-not-detected.md +26 -24
  87. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -6
  88. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +3 -3
  89. package/agent-assets/skills/agent-actions/SKILL.md +23 -39
  90. package/agent-assets/skills/agent-create/SKILL.md +26 -6
  91. package/agent-assets/skills/attach/SKILL.md +8 -27
  92. package/agent-assets/skills/background-task/SKILL.md +184 -0
  93. package/agent-assets/skills/background-task-reply/SKILL.md +100 -0
  94. package/agent-assets/skills/browser-history/SKILL.md +60 -29
  95. package/agent-assets/skills/browser-history-respond/SKILL.md +6 -1
  96. package/agent-assets/skills/browser-task/SKILL.md +33 -31
  97. package/agent-assets/skills/context/SKILL.md +26 -34
  98. package/agent-assets/skills/context/curation.json +12 -12
  99. package/agent-assets/skills/context/references/api.md +22 -20
  100. package/agent-assets/skills/context/references/required-frontmatter.md +10 -9
  101. package/agent-assets/skills/context/references/snapshot-files.md +16 -15
  102. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +5 -5
  103. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
  104. package/agent-assets/skills/docs-search/SKILL.md +19 -31
  105. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +8 -95
  106. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +8 -94
  107. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +8 -94
  108. package/agent-assets/skills/external-services/SKILL.native.claude.md +15 -9
  109. package/agent-assets/skills/external-services/SKILL.native.codex.md +11 -5
  110. package/agent-assets/skills/external-services/SKILL.native.gemini.md +11 -5
  111. package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
  112. package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
  113. package/agent-assets/skills/gmail-lifestyle/SKILL.md +3 -2
  114. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
  115. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
  116. package/agent-assets/skills/mail/SKILL.delegated.claude.md +13 -25
  117. package/agent-assets/skills/mail/SKILL.delegated.codex.md +3 -2
  118. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +3 -2
  119. package/agent-assets/skills/mail/SKILL.md +12 -20
  120. package/agent-assets/skills/mail/SKILL.native.claude.md +24 -16
  121. package/agent-assets/skills/mail/SKILL.native.codex.md +16 -9
  122. package/agent-assets/skills/mail/SKILL.native.gemini.md +12 -6
  123. package/agent-assets/skills/mail/references/api.md +6 -1
  124. package/agent-assets/skills/mail/references/examples.md +2 -1
  125. package/agent-assets/skills/managed-tasks/SKILL.md +44 -77
  126. package/agent-assets/skills/managed-tasks/references/errors.md +25 -14
  127. package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
  128. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +26 -16
  129. package/agent-assets/skills/management-policy/SKILL.md +36 -28
  130. package/agent-assets/skills/management-policy/curation.json +1 -1
  131. package/agent-assets/skills/management-policy/references/policy-workflow.md +30 -18
  132. package/agent-assets/skills/notify/SKILL.md +16 -13
  133. package/agent-assets/skills/notify/references/priority.md +42 -26
  134. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  135. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  136. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  137. package/agent-assets/skills/notion/SKILL.md +18 -18
  138. package/agent-assets/skills/notion/SKILL.native.claude.md +4 -4
  139. package/agent-assets/skills/notion/SKILL.native.codex.md +3 -3
  140. package/agent-assets/skills/notion/SKILL.native.gemini.md +3 -3
  141. package/agent-assets/skills/observations/SKILL.md +9 -24
  142. package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
  143. package/agent-assets/skills/project-doc/SKILL.md +9 -6
  144. package/agent-assets/skills/project-doc/curation.json +3 -3
  145. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +2 -2
  146. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  147. package/agent-assets/skills/reading/SKILL.md +8 -42
  148. package/agent-assets/skills/reading/references/reading-taste.md +5 -5
  149. package/agent-assets/skills/roadmap/SKILL.md +3 -19
  150. package/agent-assets/skills/roadmap/references/api.md +23 -8
  151. package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
  152. package/agent-assets/skills/roadmap/references/migration.md +8 -6
  153. package/agent-assets/skills/roadmap/references/retention.md +18 -0
  154. package/agent-assets/skills/schedule/SKILL.md +20 -28
  155. package/agent-assets/skills/schedule/references/importance.md +23 -0
  156. package/agent-assets/skills/schedule/references/recurrence-rule.md +26 -16
  157. package/agent-assets/skills/scheduled-managed-task/SKILL.md +46 -46
  158. package/agent-assets/skills/today/SKILL.md +38 -81
  159. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +9 -4
  160. package/agent-assets/skills/today/references/agent-plan-revision.md +28 -0
  161. package/agent-assets/skills/today/references/today-skeleton.md +66 -0
  162. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
  163. package/agent-assets/skills/today/seeds/section-shape.seed.json +6 -6
  164. package/agent-assets/skills/user-interview/SKILL.md +15 -90
  165. package/agent-assets/skills/user-interview/references/op-briefing.md +1 -1
  166. package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
  167. package/agent-assets/skills/user-interview/references/op-morning.md +2 -2
  168. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  169. package/agent-assets/skills/user-profile/SKILL.md +16 -26
  170. package/agent-assets/skills/user-profile/curation.json +3 -3
  171. package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
  172. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
  173. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +5 -4
  174. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
  175. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
  176. package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
  177. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
  178. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
  179. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
  180. package/agent-assets/system-prompts/routine-research-cluster-update.md +71 -0
  181. package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
  182. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +47 -21
  183. package/agent-assets/task-flows/background_task.md +81 -0
  184. package/agent-assets/task-flows/git.local_ahead.stale.md +1 -1
  185. package/agent-assets/task-flows/git.push.detected.md +1 -1
  186. package/agent-assets/task-flows/git.tag.created.md +1 -1
  187. package/agent-assets/task-flows/github.assigned.md +1 -1
  188. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  189. package/agent-assets/task-flows/github.security_alert.md +1 -1
  190. package/agent-assets/task-flows/message.received.dm.md +11 -3
  191. package/agent-assets/task-flows/message.received.dm_first.md +8 -2
  192. package/agent-assets/task-flows/{routine.hourly_check.md → routine.activity_scan.md} +31 -23
  193. package/agent-assets/task-flows/{routine.hourly_check.triage.md → routine.activity_scan.triage.md} +3 -3
  194. package/agent-assets/task-flows/routine.evening_review.md +80 -0
  195. package/agent-assets/task-flows/routine.monthly_review.md +81 -8
  196. package/agent-assets/task-flows/routine.research_cluster_update.md +33 -19
  197. package/agent-assets/task-flows/routine.roadmap_refresh.md +2 -2
  198. package/agent-assets/task-flows/routine.today_refresh.md +1 -1
  199. package/agent-assets/task-flows/routine.weekly_review.md +124 -4
  200. package/agent-assets/task-flows/schedule.approaching.md +2 -2
  201. package/agent-assets/task-flows/scheduled.dm.md +77 -1
  202. package/agent-assets/task-flows/scheduled.task.md +7 -1
  203. package/agent-assets/task-flows/wiki.trace.md +1 -1
  204. package/agent-assets/templates/_manifest.json +2 -2
  205. package/agent-assets/templates/knowledge/dossiers/_index.md +1 -1
  206. package/agent-assets/templates/knowledge/dossiers/{hourly.md → activity-scan.md} +1 -1
  207. package/agent-assets/templates/policies/journal-format.md +1 -1
  208. package/agent-assets/templates/policies/mcp.md +1 -1
  209. package/agent-assets/templates/policies/routines/_index.md +1 -1
  210. package/agent-assets/templates/policies/routines/{hourly.md → activity-scan.md} +5 -5
  211. package/bin/aitne.mjs +45 -11
  212. package/package.json +6 -5
  213. package/scripts/commands/doctor.mjs +11 -2
  214. package/scripts/lib/process-identity.d.mts +46 -0
  215. package/scripts/lib/process-identity.mjs +193 -0
  216. package/scripts/lib/read-api-token.mjs +1 -1
  217. package/scripts/start.mjs +14 -4
  218. package/agent-assets/docs/features/routines/hourly-check.md +0 -205
@@ -122,7 +122,7 @@ curl -sS -X POST http://localhost:8321/api/integrations/google_calendar/exec \
122
122
  }'
123
123
  ```
124
124
 
125
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
125
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
126
126
  `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
127
127
  for genuinely larger intents.
128
128
 
@@ -157,31 +157,7 @@ destructive-confirm second call.
157
157
  know about, call `POST /api/notify` with a one-line summary. The
158
158
  daemon does NOT auto-notify — it's an explicit choice.
159
159
 
160
- ### Error envelope
161
-
162
- `/exec` extends the direct-mode envelope with delegated-mode fields.
163
- Discriminator: `body.mode === "delegated"`.
164
-
165
- | HTTP | `error` | retry? | What to do |
166
- |---|---|---|---|
167
- | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
168
- | 409 | `mode_mismatch` | no | Calendar isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md`. |
169
- | 409 | `precondition` | no | Mode/backend flipped during queue wait. Re-check state. |
170
- | 429 | `task_quota_exhausted` | no | Daily cap reached. Wait or surface. |
171
- | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Simplify schema. |
172
- | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
173
- | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface verbatim. |
174
- | 502 | `auth_error` | no | Connector signed out. Re-authenticate. |
175
- | 502 | `policy_violation` | no | Subprocess attempted an out-of-allowlist tool (anti-injection). |
176
- | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump or simplify. |
177
- | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
178
- | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Surface with partial trace. |
179
- | 503 | `delegated_proxy_busy` | yes | Queue saturated. Backoff and retry once. |
180
- | 503 | `task_mode_disabled` | no | Operator killed it. Stop. |
181
- | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once. |
182
- | 500 | `subprocess_crashed` | no | Daemon-side defect. Surface and stop. |
183
-
184
- Always preserve `body.message` verbatim when reporting to the user.
160
+ {{> ref:exec-errors }}
185
161
  <!-- /service:calendar -->
186
162
 
187
163
  ---
@@ -266,72 +242,10 @@ existing rows (dedup). → Full guide: load the `agent-create` or `schedule` ski
266
242
 
267
243
  ---
268
244
 
269
- ## One-Shot Scheduling
245
+ ## Scheduling & Skills CRUD
270
246
 
271
- Schedule a future DM or agent task. Use `<current_time>` to resolve relative times into absolute ISO 8601 with offset.
272
-
273
- ### DM vs Agent Task
274
-
275
- | Criterion | `/api/schedule/dm` (free) | `/api/schedule` (~$0.03) |
276
- |---|---|---|
277
- | Message text knowable now? | Yes | No — needs lookup/decision at execution |
278
- | Needs API data at execution? | No | Yes |
279
- | Multi-step action? | No | Yes |
280
- | Conditional on state that may change? | No | Yes |
281
-
282
- **Default to DM** — every agent wake-up costs money and context.
283
-
284
- ### Context-loss warning
285
-
286
- > The wake-up agent has NO memory of why it was scheduled — the `description` field is its only context.
287
-
288
- Include: **What** (verb + object), **Why** (trigger/reason), **Who/What** (names, IDs, URLs), **Expected output** (what success looks like).
289
-
290
- Bad: `"Meeting prep"` — which meeting? when? what to prepare? The wake-up agent will skip ambiguous descriptions.
291
-
292
- ### POST /api/schedule/dm — Pre-composed DM
293
- ```bash
294
- curl -s -X POST http://localhost:8321/api/schedule/dm \
295
- -H 'Content-Type: application/json' \
296
- -d '{"time": "2026-04-06T16:00:00-04:00", "message": "Reminder: Design review in 30 min.", "platform": "slack"}'
297
- ```
298
-
299
- ### POST /api/schedule — Agent task
300
- ```bash
301
- curl -s -X POST http://localhost:8321/api/schedule \
302
- -H 'Content-Type: application/json' \
303
- -d '{"time": "2026-04-06T16:00:00-04:00", "taskType": "wake", "prompt": "Check PR #42 status and notify user.", "description": "PR #42 status check", "tier": "medium", "taskContext": {"scheduledBy": "dm_conversation"}}'
304
- ```
305
- Fields: `time` (required), `taskType` (`wake`), `prompt` (required — the agent instruction, ≤8000 chars), `description` (optional label, ≤200 chars), `tier` (`lite`/`medium`/`high`) **or** `model` (registered id like `claude-opus-4-8`, legacy alias `sonnet`/`opus`, or composite `<backendId>/<modelId>`) — mutually exclusive, `taskContext` (optional metadata). See the `schedule` skill body for the full surface and `/api/schedule/options` for the live model list.
306
-
307
- ### Manage pending items
308
- ```bash
309
- curl -s "http://localhost:8321/api/schedule?status=pending" # list
310
- curl -s -X PATCH http://localhost:8321/api/schedule/42 \
311
- -H 'Content-Type: application/json' -d '{"time": "2026-04-06T17:00:00-04:00"}' # edit
312
- curl -s -X DELETE http://localhost:8321/api/schedule/42 # cancel
313
- ```
314
- Editable: `time`, `description`, `message` (dm only), `tier` (or `model`, mutually exclusive — pass `null` to clear), `taskContext`. Only `pending` items.
315
-
316
- ### Time discipline
317
- - Absolute ISO 8601 with offset required — no relative times.
318
- - Do not schedule during quiet hours (default 22:00–08:00, configurable) unless critical.
319
- - Maximum 5 wake-ups per execution.
320
-
321
- ---
322
-
323
- ## Skills Management
324
-
325
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
326
-
327
- ```bash
328
- curl -s http://localhost:8321/api/skills # list all
329
- curl -s http://localhost:8321/api/skills/todo-digest # read one
330
- curl -s -X POST http://localhost:8321/api/skills \
331
- -H 'Content-Type: application/json' \
332
- -d '{"name": "todo-digest", "description": "Summarize today.md", "content": "# TODO Digest\n...", "allowedTools": ["Bash(curl *)", "Read"]}'
333
- curl -s -X PUT http://localhost:8321/api/skills/todo-digest \
334
- -H 'Content-Type: application/json' -d '{"description": "New description"}' # update
335
- curl -s -X DELETE http://localhost:8321/api/skills/todo-digest # delete
336
- ```
337
- Always `GET /api/skills` before creating (check name collisions). **Omit frontmatter** from `content` — the API injects it.
247
+ One-shot DMs / agent wake-ups (`/api/schedule`, `/api/schedule/dm`) and
248
+ user-authored Skills CRUD (`/api/skills`) work identically to direct
249
+ mode they are never proxied. Load the `schedule` skill for scheduling
250
+ and the `agent-create` skill for recurring work; this variant does not
251
+ mirror those surfaces.
@@ -121,7 +121,7 @@ curl -sS -X POST http://localhost:8321/api/integrations/google_calendar/exec \
121
121
  }'
122
122
  ```
123
123
 
124
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
124
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
125
125
  `maxBudgetUsd=0.05`, `timeoutMs=60000`.
126
126
 
127
127
  ### Destructive-confirm two-step (`allowDestructive`)
@@ -155,31 +155,7 @@ destructive-confirm second call.
155
155
  know about, call `POST /api/notify` with a one-line summary. The
156
156
  daemon does NOT auto-notify — it's an explicit choice.
157
157
 
158
- ### Error envelope
159
-
160
- `/exec` extends the direct-mode envelope with delegated-mode fields.
161
- Discriminator: `body.mode === "delegated"`.
162
-
163
- | HTTP | `error` | retry? | What to do |
164
- |---|---|---|---|
165
- | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
166
- | 409 | `mode_mismatch` | no | Calendar isn't delegated. Re-read `integrations.md`. |
167
- | 409 | `precondition` | no | Mode/backend flipped during queue wait. Re-check state. |
168
- | 429 | `task_quota_exhausted` | no | Daily cap reached. Wait or surface. |
169
- | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Simplify schema. |
170
- | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
171
- | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface verbatim. |
172
- | 502 | `auth_error` | no | Connector signed out. Re-authenticate. |
173
- | 502 | `policy_violation` | no | Subprocess attempted an out-of-allowlist tool (anti-injection). |
174
- | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump or simplify. |
175
- | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
176
- | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Surface with partial trace. |
177
- | 503 | `delegated_proxy_busy` | yes | Queue saturated. Backoff and retry once. |
178
- | 503 | `task_mode_disabled` | no | Operator killed it. Stop. |
179
- | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once. |
180
- | 500 | `subprocess_crashed` | no | Daemon-side defect. Surface and stop. |
181
-
182
- Always preserve `body.message` verbatim when reporting to the user.
158
+ {{> ref:exec-errors }}
183
159
  <!-- /service:calendar -->
184
160
 
185
161
  ---
@@ -264,72 +240,10 @@ existing rows (dedup). → Full guide: load the `agent-create` or `schedule` ski
264
240
 
265
241
  ---
266
242
 
267
- ## One-Shot Scheduling
243
+ ## Scheduling & Skills CRUD
268
244
 
269
- Schedule a future DM or agent task. Use `<current_time>` to resolve relative times into absolute ISO 8601 with offset.
270
-
271
- ### DM vs Agent Task
272
-
273
- | Criterion | `/api/schedule/dm` (free) | `/api/schedule` (~$0.03) |
274
- |---|---|---|
275
- | Message text knowable now? | Yes | No — needs lookup/decision at execution |
276
- | Needs API data at execution? | No | Yes |
277
- | Multi-step action? | No | Yes |
278
- | Conditional on state that may change? | No | Yes |
279
-
280
- **Default to DM** — every agent wake-up costs money and context.
281
-
282
- ### Context-loss warning
283
-
284
- > The wake-up agent has NO memory of why it was scheduled — the `description` field is its only context.
285
-
286
- Include: **What** (verb + object), **Why** (trigger/reason), **Who/What** (names, IDs, URLs), **Expected output** (what success looks like).
287
-
288
- Bad: `"Meeting prep"` — which meeting? when? what to prepare? The wake-up agent will skip ambiguous descriptions.
289
-
290
- ### POST /api/schedule/dm — Pre-composed DM
291
- ```bash
292
- curl -s -X POST http://localhost:8321/api/schedule/dm \
293
- -H 'Content-Type: application/json' \
294
- -d '{"time": "2026-04-06T16:00:00-04:00", "message": "Reminder: Design review in 30 min.", "platform": "slack"}'
295
- ```
296
-
297
- ### POST /api/schedule — Agent task
298
- ```bash
299
- curl -s -X POST http://localhost:8321/api/schedule \
300
- -H 'Content-Type: application/json' \
301
- -d '{"time": "2026-04-06T16:00:00-04:00", "taskType": "wake", "prompt": "Check PR #42 status and notify user.", "description": "PR #42 status check", "tier": "medium", "taskContext": {"scheduledBy": "dm_conversation"}}'
302
- ```
303
- Fields: `time` (required), `taskType` (`wake`), `prompt` (required — the agent instruction, ≤8000 chars), `description` (optional label, ≤200 chars), `tier` (`lite`/`medium`/`high`) **or** `model` (registered id like `claude-opus-4-8`, legacy alias `sonnet`/`opus`, or composite `<backendId>/<modelId>`) — mutually exclusive, `taskContext` (optional metadata). See the `schedule` skill body for the full surface and `/api/schedule/options` for the live model list.
304
-
305
- ### Manage pending items
306
- ```bash
307
- curl -s "http://localhost:8321/api/schedule?status=pending" # list
308
- curl -s -X PATCH http://localhost:8321/api/schedule/42 \
309
- -H 'Content-Type: application/json' -d '{"time": "2026-04-06T17:00:00-04:00"}' # edit
310
- curl -s -X DELETE http://localhost:8321/api/schedule/42 # cancel
311
- ```
312
- Editable: `time`, `description`, `message` (dm only), `tier` (or `model`, mutually exclusive — pass `null` to clear), `taskContext`. Only `pending` items.
313
-
314
- ### Time discipline
315
- - Absolute ISO 8601 with offset required — no relative times.
316
- - Do not schedule during quiet hours (default 22:00–08:00, configurable) unless critical.
317
- - Maximum 5 wake-ups per execution.
318
-
319
- ---
320
-
321
- ## Skills Management
322
-
323
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
324
-
325
- ```bash
326
- curl -s http://localhost:8321/api/skills # list all
327
- curl -s http://localhost:8321/api/skills/todo-digest # read one
328
- curl -s -X POST http://localhost:8321/api/skills \
329
- -H 'Content-Type: application/json' \
330
- -d '{"name": "todo-digest", "description": "Summarize today.md", "content": "# TODO Digest\n...", "allowedTools": ["Bash(curl *)", "Read"]}'
331
- curl -s -X PUT http://localhost:8321/api/skills/todo-digest \
332
- -H 'Content-Type: application/json' -d '{"description": "New description"}' # update
333
- curl -s -X DELETE http://localhost:8321/api/skills/todo-digest # delete
334
- ```
335
- Always `GET /api/skills` before creating (check name collisions). **Omit frontmatter** from `content` — the API injects it.
245
+ One-shot DMs / agent wake-ups (`/api/schedule`, `/api/schedule/dm`) and
246
+ user-authored Skills CRUD (`/api/skills`) work identically to direct
247
+ mode they are never proxied. Load the `schedule` skill for scheduling
248
+ and the `agent-create` skill for recurring work; this variant does not
249
+ mirror those surfaces.
@@ -14,10 +14,16 @@ Base URL: `http://localhost:8321`. All daemon calls via `curl -s` with
14
14
  > **Refusal directive — read first.** Google Calendar is in `native`
15
15
  > mode bound to Claude. Do **NOT** call any of:
16
16
  >
17
- > - `POST /api/integrations/google_calendar/exec` (returns `410` with
18
- > `X-Integration-Mode: native`)
19
- > - `POST /api/integrations/google_calendar/reconcile` (410)
20
17
  > - `/api/calendar/*` (route-prefix 410 in native mode)
18
+ > - `POST /api/integrations/google_calendar/exec`
19
+ > - `POST /api/integrations/google_calendar/reconcile`
20
+ >
21
+ > In native mode `POST /api/integrations/google_calendar/exec` returns
22
+ > **409 `mode_mismatch`** (the handler rejects non-delegated mode);
23
+ > `.../reconcile` is not mode-gated at all. Do not call either — use the
24
+ > native connector. The 410 + `X-Integration-Mode: native` refusal
25
+ > contract applies ONLY to the integration's own data routes
26
+ > (`/api/calendar/*`).
21
27
  >
22
28
  > Reach Google Calendar through the in-session Google Calendar
23
29
  > connector your harness exposes. Your tool menu lists every available
@@ -128,13 +134,13 @@ The suggest-time capability is read-only and exempt from the confirm dance.
128
134
  - All-day events use `YYYY-MM-DD` with no offset.
129
135
  - Be explicit which shape the destructive-confirm plan describes.
130
136
 
131
- ### Imminent-event reminders (hourly_check)
137
+ ### Imminent-event reminders (activity_scan)
132
138
 
133
139
  Native mode replaces the daemon-side
134
140
  `POST /api/integrations/google_calendar/reconcile` POST that delegated
135
141
  mode uses. In native mode, the agent itself drives the imminent-window
136
142
  fetch every hour and POSTs each materialised event to
137
- `/api/observations`. The hourly_check native variant's Step 0b spells
143
+ `/api/observations`. The activity_scan native variant's Step 0b spells
138
144
  out the exact shape; this skill describes the call surface.
139
145
 
140
146
  Free-busy queries are composed locally — the suggest-time capability
@@ -238,10 +244,10 @@ session's integration state.
238
244
 
239
245
  ## Persisting Calendar observations from native fetches
240
246
 
241
- When the hourly_check native flow's Step 0b fetches imminent-window
247
+ When the activity_scan native flow's Step 0b fetches imminent-window
242
248
  events, POST each materialised event to `/api/observations` so
243
249
  subsequent runs can dedup. The daemon computes `contentHash`
244
- server-side via `@personal-agent/shared/observations-hash.ts` — pass
250
+ server-side via `@aitne/shared/observations-hash` — pass
245
251
  the raw `payload`.
246
252
 
247
253
  **Batch when you have more than one event.** Use
@@ -268,7 +274,7 @@ curl -s -X POST http://localhost:8321/api/observations \
268
274
  window (§11.3.1) — stop and re-read `<integration_modes>`.
269
275
 
270
276
  The two-fetch pattern (imminent 15-min + 24-hour drift detection)
271
- documented in `routine.hourly_check.native.claude.md` is the canonical
277
+ documented in `routine.activity_scan.native.claude.md` is the canonical
272
278
  shape; this skill describes the per-call surface, not the orchestration.
273
279
 
274
280
  ---
@@ -284,7 +290,7 @@ schedule surface (scheduling is daemon-internal, not an integration).
284
290
 
285
291
  ## Skills Management — direct, unchanged
286
292
 
287
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`.
293
+ User-authored skills: `<contextDir>/policies/skills/{slug}/SKILL.md`.
288
294
  Built-in skills are read-only (403). Native-mode gating does not apply.
289
295
 
290
296
  ```bash
@@ -14,10 +14,16 @@ with `Content-Type: application/json` on POST/PATCH/PUT.
14
14
  > **Refusal directive — read first.** Google Calendar is in `native`
15
15
  > mode bound to Codex. Do **NOT** call any of:
16
16
  >
17
- > - `POST /api/integrations/google_calendar/exec` (410 with
18
- > `X-Integration-Mode: native`)
19
- > - `POST /api/integrations/google_calendar/reconcile` (410)
20
17
  > - `/api/calendar/*` (route-prefix 410)
18
+ > - `POST /api/integrations/google_calendar/exec`
19
+ > - `POST /api/integrations/google_calendar/reconcile`
20
+ >
21
+ > In native mode `POST /api/integrations/google_calendar/exec` returns
22
+ > **409 `mode_mismatch`** (the handler rejects non-delegated mode);
23
+ > `.../reconcile` is not mode-gated at all. Do not call either — use the
24
+ > native connector. The 410 + `X-Integration-Mode: native` refusal
25
+ > contract applies ONLY to the integration's own data routes
26
+ > (`/api/calendar/*`).
21
27
  >
22
28
  > Reach Google Calendar through the in-session Google Calendar
23
29
  > connector your harness exposes. Your tool menu lists every available
@@ -106,9 +112,9 @@ master-id PATCH shifts the whole series. Confirm scope before issuing.
106
112
  Same as Claude's native body — ISO 8601 with TZ offset for timed
107
113
  events; `YYYY-MM-DD` for all-day. Reject naked-ISO inputs.
108
114
 
109
- ### Imminent-event reminders (hourly_check)
115
+ ### Imminent-event reminders (activity_scan)
110
116
 
111
- The hourly_check native variant's Step 0b drives the imminent-window
117
+ The activity_scan native variant's Step 0b drives the imminent-window
112
118
  fetch each hour; this skill describes the per-call surface. POST each
113
119
  materialised event to `/api/observations` per the section at the end of
114
120
  this file.
@@ -14,10 +14,16 @@ Base URL: `http://localhost:8321`. All daemon calls via `curl -s` with
14
14
  > **Refusal directive — read first.** Google Calendar is in `native`
15
15
  > mode bound to Gemini. Do **NOT** call any of:
16
16
  >
17
- > - `POST /api/integrations/google_calendar/exec` (410 with
18
- > `X-Integration-Mode: native`)
19
- > - `POST /api/integrations/google_calendar/reconcile` (410)
20
17
  > - `/api/calendar/*` (route-prefix 410)
18
+ > - `POST /api/integrations/google_calendar/exec`
19
+ > - `POST /api/integrations/google_calendar/reconcile`
20
+ >
21
+ > In native mode `POST /api/integrations/google_calendar/exec` returns
22
+ > **409 `mode_mismatch`** (the handler rejects non-delegated mode);
23
+ > `.../reconcile` is not mode-gated at all. Do not call either — use the
24
+ > native connector. The 410 + `X-Integration-Mode: native` refusal
25
+ > contract applies ONLY to the integration's own data routes
26
+ > (`/api/calendar/*`).
21
27
  >
22
28
  > Reach Google Calendar through the in-session Google Calendar
23
29
  > connector your harness exposes (typically Gemini CLI's
@@ -110,9 +116,9 @@ master-id update shifts the whole series. Confirm scope.
110
116
  ISO 8601 with TZ offset for timed events; `YYYY-MM-DD` for all-day.
111
117
  Connectors typically reject naked-ISO inputs.
112
118
 
113
- ### Imminent-event reminders (hourly_check)
119
+ ### Imminent-event reminders (activity_scan)
114
120
 
115
- The hourly_check native variant's Step 0b drives the imminent-window
121
+ The activity_scan native variant's Step 0b drives the imminent-window
116
122
  fetch each hour; this skill describes the per-call surface. POST each
117
123
  materialised event to `/api/observations` per the section below.
118
124
 
@@ -0,0 +1,32 @@
1
+ ---
2
+ kind: reference
3
+ name: exec-errors
4
+ description: Delegated `/exec` error envelope — HTTP status, `error` code, retry guidance. Shared across the cross-backend SKILL.delegated.*.md Calendar variants.
5
+ ---
6
+
7
+ ### Error envelope
8
+
9
+ `/exec` extends the direct-mode envelope with delegated-mode fields.
10
+ Discriminator: `body.mode === "delegated"`.
11
+
12
+ | HTTP | `error` | retry? | What to do |
13
+ |---|---|---|---|
14
+ | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
15
+ | 409 | `mode_mismatch` | no | Calendar isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md` and stop. |
16
+ | 409 | `precondition` | no | Mode/backend flipped during the queue wait. Re-check state and re-plan. |
17
+ | 429 | `task_quota_exhausted` | no | Daily cap reached; wait or surface. |
18
+ | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Consider a simpler schema. |
19
+ | 502 | `tool_unavailable` | no | No connector tool fits the intent. Surface the gap. |
20
+ | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface `body.message` verbatim; retry only if clearly transient. |
21
+ | 502 | `auth_error` | no | Connector signed out. Tell the user to re-authenticate it. |
22
+ | 502 | `policy_violation` | no | Subprocess attempted a tool outside the per-task allowlist (anti-injection). |
23
+ | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump the cap or simplify. |
24
+ | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
25
+ | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Side effect is real — surface with the partial trace. |
26
+ | 503 | `delegated_proxy_busy` | yes | Daemon queue saturated. Backoff a few seconds, try once. |
27
+ | 503 | `task_mode_disabled` | no | Operator turned the kill switch off. Stop. |
28
+ | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once if intent was simple. |
29
+ | 500 | `subprocess_crashed` | no | Unhandled exception inside the subprocess. Surface and stop. |
30
+
31
+ Always preserve `body.message` verbatim when reporting to the user — it
32
+ carries the connector's own language.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  kind: reference
3
3
  name: skills-crud
4
- description: Dashboard-shaped CRUD for user-authored skills under ~/.personal-agent/skills/. Built-in skills are read-only (403).
4
+ description: Dashboard-shaped CRUD for user-authored skills under <contextDir>/policies/skills/. Built-in skills are read-only (403).
5
5
  ---
6
6
 
7
7
  ## Skills Management
8
8
 
9
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
9
+ User-authored skills: `<contextDir>/policies/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
10
10
 
11
11
  ```bash
12
12
  curl -s http://localhost:8321/api/skills # list all
@@ -22,6 +22,6 @@ Always `GET /api/skills` before creating (check name collisions). **Omit frontma
22
22
 
23
23
  The description is the **only** routing signal the SDK uses to pick a
24
24
  skill — keep it under 280 chars and make the trigger surface
25
- distinct from every other skill in the manifest. Slug grammar is
26
- strict: `[a-z0-9][a-z0-9-]*[a-z0-9]` or `[a-z0-9]` (single char),
27
- 1-64 chars total. PUT rejects collisions with built-in slugs.
25
+ distinct from every other skill in the manifest. Slug grammar:
26
+ `^[a-z0-9][a-z0-9-]*$` (1-64 chars; a trailing hyphen is allowed,
27
+ no alphanumeric terminal required). PUT rejects collisions with built-in slugs.
@@ -97,8 +97,9 @@ user's **external Obsidian vault**.
97
97
  > **external** Obsidian vault (user's personal knowledge base reached
98
98
  > via `/api/obsidian/*`), **not** the primary management store
99
99
  > reached via `/api/context/*`. The agent's own state files
100
- > (`state/today.md`, `plans/roadmap.md`, `projects/*`, `user/*`, `rules/*`,
101
- > `routines/*`, `agent/*`) live in the primary store and must
100
+ > (`state/today.md`, `plans/roadmap.md`, `plans/projects/*`, `identity/*`,
101
+ > `policies/*`, `policies/routines/*`, `journal/agent.md`) live in the
102
+ > primary store and must
102
103
  > **never** receive receipt attachments. See the
103
104
  > `external-services` skill's obsidian reference for the external
104
105
  > vault's full CRUD surface.
@@ -41,6 +41,7 @@ Response:
41
41
  {
42
42
  "id": 1,
43
43
  "providerMsgId": "18f...",
44
+ "accountId": "...",
44
45
  "attachmentId": "ANGj...",
45
46
  "filename": "receipt.pdf",
46
47
  "mimeType": "application/pdf",
@@ -55,6 +56,9 @@ Response:
55
56
  }
56
57
  ```
57
58
 
59
+ `accountId` identifies the source mail account; `POST /receipts/:id/download`
60
+ uses it to resolve the provider.
61
+
58
62
  ## GET /api/receipts/summary
59
63
 
60
64
  ```bash
@@ -68,8 +68,17 @@ curl -s "http://localhost:8321/api/travel-bookings/upcoming?limit=10"
68
68
 
69
69
  ## PATCH /api/travel-bookings/:id
70
70
 
71
+ Accepts `{"status": "..."}` and/or `{"destination": "..."}`. Valid
72
+ status values are `upcoming`, `completed`, `cancelled`.
73
+
71
74
  ```bash
75
+ # Update status
72
76
  curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
73
77
  -H "Content-Type: application/json" \
74
78
  -d '{"status": "completed"}'
79
+
80
+ # Correct a parsed destination
81
+ curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
82
+ -H "Content-Type: application/json" \
83
+ -d '{"destination": "San Francisco"}'
75
84
  ```
@@ -101,8 +101,7 @@ should set `cacheable: true` so a repeat invocation within 60s returns
101
101
  ~5ms from the in-memory LRU. The cache key includes the integration
102
102
  state version, so flipping `deniedTools` or `delegatedBackend` purges
103
103
  entries automatically. Cache hits still write a `delegated_task.exec`
104
- audit row with `cost_usd=0` and `detail.cacheHit=true` — accounting
105
- stays correct.
104
+ audit row with `cost_usd=0` and `detail.cacheHit=true`.
106
105
 
107
106
  Never set `cacheable: true` on:
108
107
  - destructive-confirm second calls (`allowDestructive: true`),
@@ -205,19 +204,12 @@ curl -s -X POST http://localhost:8321/api/integrations/gmail/exec \
205
204
  ## Default deny floor
206
205
 
207
206
  The setup wizard pre-populates `gmail.deniedTools` with the connector's
208
- destructive defaults (send / batch label mutate / etc.). `/exec`
209
- honors the deny list, and the response distinguishes two cases:
210
-
211
- - **Every connector tool is denied** `403 denied_tool`. There is no
212
- surface to plan against, so the daemon rejects the task up front
213
- without spawning the subprocess.
214
- - **The connector still has usable tools but the specific tool a planned
215
- task needs is denied (or no tool fits)** → `502 tool_unavailable`. The
216
- subprocess plans, finds no permitted tool for the intent, and reports
217
- the gap.
218
-
219
- In both cases, surface that to the user and ask whether to lift the
220
- relevant deny before retrying.
207
+ destructive defaults. `/exec` honors the deny list, distinguishing two
208
+ cases: if **every** connector tool is denied `403 denied_tool` (no
209
+ surface to plan against, rejected up front); if usable tools remain but
210
+ the specific tool a planned task needs is denied (or no tool fits)
211
+ `502 tool_unavailable`. In both cases, surface that to the user and ask
212
+ whether to lift the relevant deny before retrying.
221
213
 
222
214
  ## Decision rules
223
215
 
@@ -271,23 +263,19 @@ curl -s -X POST http://localhost:8321/api/notify \
271
263
  -d '{"message": "Sent reply to alice@example.com (Re: Proposal)"}'
272
264
  ```
273
265
 
274
- Do not call `/api/notify` for routine reads / drafts / searches. The
275
- default posture is autonomous; the user's `deniedTools` is the
276
- hard-stop, on-demand retrospective covers awareness, and `/api/notify`
277
- is the small hammer for "speak up if I'm about to do something
278
- unusual."
266
+ Do not call `/api/notify` for routine reads / drafts / searches.
279
267
 
280
268
  ## Cost / retrospective
281
269
 
282
270
  Every `/exec` writes one row to `agent_actions` with
283
- `action_type='delegated_task.exec'` (token + USD breakdown, parent
284
- `event_id` / `processKey` attached automatically via session env
285
- vars). When the user asks what you did:
271
+ `action_type='delegated_task.exec'` (token + USD breakdown). When the
272
+ user asks what you did:
286
273
 
287
274
  ```bash
288
275
  curl -s "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since=2026-04-25T00:00:00Z&limit=50"
289
276
  ```
290
277
 
291
278
  Summarise from the returned `actions` array — each row carries
292
- `detail.task` (the natural-language intent), cost, cache hit flag, and
293
- timestamp.
279
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
280
+ deliberately not persisted, so do not try to read intent prose from it),
281
+ cost, cache hit flag, and timestamp.
@@ -261,5 +261,6 @@ curl -sS "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since
261
261
  ```
262
262
 
263
263
  Summarise from the returned `actions` array — each row carries
264
- `detail.task` (the natural-language intent), cost, cache hit flag,
265
- and timestamp.
264
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
265
+ deliberately not persisted, so do not try to read intent prose from it),
266
+ cost, cache hit flag, and timestamp.
@@ -255,5 +255,6 @@ curl -sS "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since
255
255
  ```
256
256
 
257
257
  Summarise from the returned `actions` array — each row carries
258
- `detail.task` (the natural-language intent), cost, cache hit flag,
259
- and timestamp.
258
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
259
+ deliberately not persisted, so do not try to read intent prose from it),
260
+ cost, cache hit flag, and timestamp.
@@ -54,7 +54,7 @@ accordingly:
54
54
  user) registered on that backend. The daemon does not poll Outlook
55
55
  in this mode — mail observations only land when the agent fetches
56
56
  in-turn through the user's MCP during a DM that needs them. There
57
- is no proactive hourly_check fetch for `outlook_mail` (user-managed
57
+ is no proactive activity_scan fetch for `outlook_mail` (user-managed
58
58
  reactive-only contract; see
59
59
  `docs/design/appendices/native-integration-mode.md`).
60
60
  <!-- /mode:native:outlook_mail -->
@@ -99,16 +99,10 @@ includes dormant and unhealthy rows that every operation will reject.
99
99
  ### Send vs draft
100
100
  - **Prefer drafts.** Create via `POST /mail/:acct/drafts`. The user sends
101
101
  from the provider's web UI.
102
- - Direct send (`POST /mail/:acct/messages/send`) succeeds autonomously
103
- the daemon does not DM the owner before sending. (The user's
104
- `deniedTools` list applies to **delegated-mode connector tools**
105
- e.g. Codex's `send_email` and is enforced at the
106
- `/api/integrations/:key/exec` task-mode chokepoint via the per-task
107
- allowed-tools envelope. In direct mode, the `/api/mail/*` route
108
- handler has no equivalent deny check today, so a send call is what
109
- it appears to be: a send.) When you judge the user would want to
110
- know about a send immediately (e.g. a reply to a stranger), call
111
- `POST /api/notify` yourself.
102
+ - Direct send (`POST /mail/:acct/messages/send`) is autonomous no owner
103
+ DM, no deny gate (see api.md for the `deniedTools`-scope nuance). When
104
+ you judge the user would want to know about a send immediately (e.g. a
105
+ reply to a stranger), call `POST /api/notify` yourself.
112
106
  - Never include `bcc` unless the user explicitly asks for it.
113
107
 
114
108
  ### Replies — RFC-2822 headers are the source of truth
@@ -118,7 +112,9 @@ all four kinds.
118
112
 
119
113
  1. Fetch the thread metadata: `GET /api/mail/:acct/threads/:threadId?body=none`
120
114
  (returns `messages[]` in chronological order without raw HTML bodies).
121
- 2. From the last message, pull `rfc822MsgId` and `references`.
115
+ 2. From the last message, pull `rfc822MsgId` (thread message objects carry
116
+ no `references` field — you SUPPLY `references` in the reply block below,
117
+ you do not read it off the message).
122
118
  3. Build the `reply` block:
123
119
  ```json
124
120
  {
@@ -191,20 +187,16 @@ curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG/body?format=raw&chunk=
191
187
  ```
192
188
 
193
189
  ### When NOT to act
194
- - During `routine.hourly_check` this skill is **read-only** — no sending,
190
+ - During `routine.activity_scan` this skill is **read-only** — no sending,
195
191
  no draft edits, no tag changes, no trash / untrash / archive.
196
192
  - No bulk operations without user confirmation.
197
193
  - Trash / untrash / archive run autonomously when not on the user's
198
194
  deny list. The daemon does not DM the owner before the call. Single
199
195
  ops only; if you're about to trash 3+ messages at once, stop and ask
200
196
  the user — the agent's own judgment is the gate, not the daemon.
201
- - **Delegated mode**: this skill body is loaded only when `gmail.mode ===
202
- "direct"`. When Gmail is delegated, the materializer picks
203
- `SKILL.delegated.<sessionBackend>.md` (cross-backend) or skips the
204
- skill entirely (same-backend, native MCP). If you somehow reach
205
- `/api/mail/*` from this body while Gmail is delegated, the route
206
- returns `410 integration_delegated` — re-read `integrations.md` and
207
- use `POST /api/integrations/gmail/exec` (task mode) instead.
197
+ - **Delegated / native mode**: see §0 for routing. A `/api/mail/*` call
198
+ that hits a delegated/native gate returns `410` (`integration_delegated`
199
+ / `integration_native`) — re-read `integrations.md` and dispatch per §0.
208
200
 
209
201
  ## 3. Provider capability matrix
210
202