@aitne-sh/aitne 0.1.7 → 0.1.9

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 (317) hide show
  1. package/README.md +256 -833
  2. package/agent-assets/agent-profiles/_safety.md +52 -20
  3. package/agent-assets/agent-profiles/browser-task.md +108 -0
  4. package/agent-assets/agent-profiles/conversational.md +3 -3
  5. package/agent-assets/agent-profiles/profile-importer.md +3 -3
  6. package/agent-assets/agent-profiles/routine-fetch-window.md +30 -19
  7. package/agent-assets/agent-profiles/routine.md +4 -3
  8. package/agent-assets/agents/context-index-reconcile/agent.md +52 -0
  9. package/agent-assets/agents/evening-review/agent.md +53 -0
  10. package/agent-assets/agents/hourly-check/agent.md +62 -0
  11. package/agent-assets/agents/monthly-review/agent.md +55 -0
  12. package/agent-assets/agents/morning-routine/agent.md +78 -0
  13. package/agent-assets/agents/roadmap-maintenance/agent.md +52 -0
  14. package/agent-assets/agents/skill-curation/agent.md +52 -0
  15. package/agent-assets/agents/user-profile-sweep-evening/agent.md +48 -0
  16. package/agent-assets/agents/user-profile-sweep-morning/agent.md +53 -0
  17. package/agent-assets/agents/weekly-review/agent.md +51 -0
  18. package/agent-assets/docs/concepts/agent-day.md +18 -11
  19. package/agent-assets/docs/concepts/auth-health.md +56 -10
  20. package/agent-assets/docs/concepts/backends-and-tiers.md +110 -41
  21. package/agent-assets/docs/concepts/costs-and-quotas.md +74 -19
  22. package/agent-assets/docs/concepts/delegated-mode.md +193 -75
  23. package/agent-assets/docs/concepts/memory-model.md +79 -34
  24. package/agent-assets/docs/concepts/observations.md +61 -11
  25. package/agent-assets/docs/concepts/process-keys.md +66 -17
  26. package/agent-assets/docs/concepts/routines.md +77 -32
  27. package/agent-assets/docs/concepts/safety-and-execution.md +50 -21
  28. package/agent-assets/docs/concepts/safety-model.md +62 -37
  29. package/agent-assets/docs/concepts/skills.md +38 -17
  30. package/agent-assets/docs/features/integrations/browser-history.md +195 -0
  31. package/agent-assets/docs/features/integrations/calendar.md +40 -30
  32. package/agent-assets/docs/features/integrations/git.md +20 -9
  33. package/agent-assets/docs/features/integrations/github.md +93 -35
  34. package/agent-assets/docs/features/integrations/mail.md +60 -17
  35. package/agent-assets/docs/features/integrations/notion.md +51 -11
  36. package/agent-assets/docs/features/integrations/obsidian.md +35 -7
  37. package/agent-assets/docs/features/lifestyle/git.md +45 -44
  38. package/agent-assets/docs/features/lifestyle/reading.md +50 -22
  39. package/agent-assets/docs/features/lifestyle/receipts.md +66 -21
  40. package/agent-assets/docs/features/lifestyle/travel-bookings.md +91 -14
  41. package/agent-assets/docs/features/memory-files/agent-journal.md +111 -50
  42. package/agent-assets/docs/features/memory-files/projects.md +75 -15
  43. package/agent-assets/docs/features/memory-files/roadmap.md +55 -10
  44. package/agent-assets/docs/features/memory-files/schedule.md +113 -70
  45. package/agent-assets/docs/features/memory-files/today.md +47 -21
  46. package/agent-assets/docs/features/memory-files/user-profile.md +67 -31
  47. package/agent-assets/docs/features/messaging/bang-commands.md +115 -28
  48. package/agent-assets/docs/features/messaging/dashboard-chat.md +43 -21
  49. package/agent-assets/docs/features/messaging/discord.md +46 -4
  50. package/agent-assets/docs/features/messaging/overview.md +40 -19
  51. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +94 -27
  52. package/agent-assets/docs/features/messaging/slack.md +79 -14
  53. package/agent-assets/docs/features/messaging/telegram.md +25 -6
  54. package/agent-assets/docs/features/messaging/whatsapp.md +79 -14
  55. package/agent-assets/docs/features/operations/activity-and-conversations.md +45 -16
  56. package/agent-assets/docs/features/operations/approvals.md +53 -15
  57. package/agent-assets/docs/features/operations/backend-routing.md +75 -16
  58. package/agent-assets/docs/features/operations/cost-tracking.md +90 -17
  59. package/agent-assets/docs/features/operations/managed-chromium.md +221 -0
  60. package/agent-assets/docs/features/operations/notifications.md +58 -11
  61. package/agent-assets/docs/features/operations/quiet-hours.md +63 -40
  62. package/agent-assets/docs/features/operations/schedule-approaching.md +59 -16
  63. package/agent-assets/docs/features/routines/custom-routines.md +97 -23
  64. package/agent-assets/docs/features/routines/evening-review.md +75 -22
  65. package/agent-assets/docs/features/routines/hourly-check.md +150 -30
  66. package/agent-assets/docs/features/routines/morning-routine.md +60 -33
  67. package/agent-assets/docs/features/routines/weekly-review.md +65 -20
  68. package/agent-assets/docs/features/wiki/commands.md +37 -16
  69. package/agent-assets/docs/features/wiki/cost-and-approval.md +240 -0
  70. package/agent-assets/docs/features/wiki/dashboard.md +255 -0
  71. package/agent-assets/docs/features/wiki/overview.md +80 -12
  72. package/agent-assets/docs/features/wiki/search.md +248 -0
  73. package/agent-assets/docs/features/wiki/workspaces.md +254 -0
  74. package/agent-assets/docs/getting-started/01-what-is-this.md +64 -32
  75. package/agent-assets/docs/getting-started/02-first-steps.md +28 -10
  76. package/agent-assets/docs/getting-started/03-what-can-this-do.md +42 -21
  77. package/agent-assets/docs/getting-started/04-first-day.md +52 -20
  78. package/agent-assets/docs/glossary.md +285 -21
  79. package/agent-assets/docs/guides/add-a-custom-routine.md +74 -22
  80. package/agent-assets/docs/guides/backup-and-restore.md +92 -14
  81. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +62 -25
  82. package/agent-assets/docs/guides/build-your-wiki.md +33 -6
  83. package/agent-assets/docs/guides/change-which-model-handles-x.md +70 -9
  84. package/agent-assets/docs/guides/connect-a-new-mail-account.md +80 -15
  85. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +32 -9
  86. package/agent-assets/docs/guides/import-knowledge-file.md +60 -39
  87. package/agent-assets/docs/guides/install-and-run.md +64 -19
  88. package/agent-assets/docs/guides/maintain-wiki-health.md +41 -10
  89. package/agent-assets/docs/guides/migrate-machines.md +86 -18
  90. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +119 -59
  91. package/agent-assets/docs/guides/pause-the-agent.md +71 -22
  92. package/agent-assets/docs/guides/reinstall-cleanly.md +102 -17
  93. package/agent-assets/docs/guides/setup-wizard.md +126 -56
  94. package/agent-assets/docs/guides/switch-default-backend.md +72 -17
  95. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +31 -10
  96. package/agent-assets/docs/reference/api.md +162 -23
  97. package/agent-assets/docs/reference/cli-commands.md +55 -15
  98. package/agent-assets/docs/reference/config.md +246 -39
  99. package/agent-assets/docs/reference/disallowed-tools.md +42 -10
  100. package/agent-assets/docs/reference/keyboard-shortcuts.md +47 -10
  101. package/agent-assets/docs/reference/knowledge-layout.md +620 -0
  102. package/agent-assets/docs/reference/process-keys.md +126 -20
  103. package/agent-assets/docs/reference/skills.md +62 -18
  104. package/agent-assets/docs/troubleshooting/auth-failed.md +53 -19
  105. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +96 -22
  106. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +94 -20
  107. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +77 -22
  108. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +87 -22
  109. package/agent-assets/docs/troubleshooting/observation-not-detected.md +85 -21
  110. package/agent-assets/docs/troubleshooting/quota-exhausted.md +36 -6
  111. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +128 -51
  112. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +33 -11
  113. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
  114. package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +1 -1
  115. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
  116. package/agent-assets/sandbox/linux/aitne-chromium.apparmor +91 -0
  117. package/agent-assets/sandbox/macos/aitne-chromium.sb +156 -0
  118. package/agent-assets/skills/agent-actions/SKILL.md +122 -0
  119. package/agent-assets/skills/agent-create/SKILL.md +149 -0
  120. package/agent-assets/skills/attach/SKILL.md +3 -4
  121. package/agent-assets/skills/browser-history/SKILL.md +198 -0
  122. package/agent-assets/skills/browser-history-respond/SKILL.md +106 -0
  123. package/agent-assets/skills/browser-task/SKILL.md +169 -0
  124. package/agent-assets/skills/context/SKILL.md +45 -463
  125. package/agent-assets/skills/context/curation.json +2 -2
  126. package/agent-assets/skills/context/references/api.md +232 -0
  127. package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
  128. package/agent-assets/skills/context/references/snapshot-files.md +103 -0
  129. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +4 -4
  130. package/agent-assets/skills/docs-search/SKILL.md +17 -16
  131. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +14 -26
  132. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +14 -26
  133. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +14 -26
  134. package/agent-assets/skills/external-services/SKILL.md +9 -262
  135. package/agent-assets/skills/external-services/SKILL.native.claude.md +6 -7
  136. package/agent-assets/skills/external-services/SKILL.native.codex.md +8 -9
  137. package/agent-assets/skills/external-services/SKILL.native.gemini.md +5 -6
  138. package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
  139. package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
  140. package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
  141. package/agent-assets/skills/external-services/references/github.md +17 -0
  142. package/agent-assets/skills/external-services/references/obsidian.md +49 -0
  143. package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
  144. package/agent-assets/skills/gmail-lifestyle/SKILL.md +151 -0
  145. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
  146. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
  147. package/agent-assets/skills/mail/SKILL.delegated.claude.md +15 -6
  148. package/agent-assets/skills/mail/SKILL.delegated.codex.md +9 -5
  149. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +9 -5
  150. package/agent-assets/skills/mail/SKILL.md +9 -114
  151. package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
  152. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  153. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  154. package/agent-assets/skills/mail/references/api.md +110 -0
  155. package/agent-assets/skills/mail/references/examples.md +70 -0
  156. package/agent-assets/skills/mail/references/providers.md +8 -8
  157. package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
  158. package/agent-assets/skills/managed-tasks/references/errors.md +73 -0
  159. package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
  160. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
  161. package/agent-assets/skills/management-policy/SKILL.md +54 -125
  162. package/agent-assets/skills/management-policy/curation.json +1 -1
  163. package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
  164. package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +1 -1
  165. package/agent-assets/skills/notify/SKILL.md +10 -82
  166. package/agent-assets/skills/notify/references/priority.md +65 -0
  167. package/agent-assets/skills/notion/SKILL.delegated.claude.md +2 -2
  168. package/agent-assets/skills/notion/SKILL.delegated.codex.md +2 -2
  169. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +2 -2
  170. package/agent-assets/skills/notion/SKILL.md +6 -10
  171. package/agent-assets/skills/notion/SKILL.native.claude.md +11 -8
  172. package/agent-assets/skills/notion/SKILL.native.codex.md +10 -6
  173. package/agent-assets/skills/notion/SKILL.native.gemini.md +10 -6
  174. package/agent-assets/skills/observations/SKILL.md +25 -14
  175. package/agent-assets/skills/project-doc/SKILL.md +2 -6
  176. package/agent-assets/skills/project-doc/curation.json +3 -3
  177. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +7 -4
  178. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  179. package/agent-assets/skills/reading/SKILL.md +12 -2
  180. package/agent-assets/skills/reading/references/reading-taste.md +2 -2
  181. package/agent-assets/skills/roadmap/SKILL.md +43 -141
  182. package/agent-assets/skills/roadmap/curation.json +1 -1
  183. package/agent-assets/skills/roadmap/references/api.md +100 -0
  184. package/agent-assets/skills/roadmap/references/cross-check.md +80 -0
  185. package/agent-assets/skills/roadmap/references/migration.md +56 -0
  186. package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
  187. package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +1 -1
  188. package/agent-assets/skills/schedule/SKILL.md +76 -104
  189. package/agent-assets/skills/schedule/references/batch.md +93 -0
  190. package/agent-assets/skills/schedule/references/errors.md +217 -0
  191. package/agent-assets/skills/schedule/references/model-selection.md +96 -0
  192. package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
  193. package/agent-assets/skills/scheduled-managed-task/SKILL.md +59 -51
  194. package/agent-assets/skills/today/SKILL.md +32 -62
  195. package/agent-assets/skills/today/curation.json +3 -3
  196. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +114 -0
  197. package/agent-assets/skills/today/seeds/section-shape.seed.json +1 -1
  198. package/agent-assets/skills/user-interview/SKILL.md +23 -67
  199. package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
  200. package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
  201. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +9 -1
  202. package/agent-assets/skills/user-profile/SKILL.md +54 -74
  203. package/agent-assets/skills/user-profile/curation.json +2 -2
  204. package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
  205. package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +8 -8
  206. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +30 -2
  207. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
  208. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +4 -5
  209. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
  210. package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
  211. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
  212. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
  213. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
  214. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
  215. package/agent-assets/system-prompts/routine-fetch-window.md +78 -0
  216. package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
  217. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +20 -11
  218. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +18 -9
  219. package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
  220. package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
  221. package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
  222. package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
  223. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
  224. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +18 -9
  225. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +26 -15
  226. package/agent-assets/task-flows/browser_task.md +84 -0
  227. package/agent-assets/task-flows/github.assigned.md +1 -1
  228. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  229. package/agent-assets/task-flows/github.workflow_run.failed.md +2 -2
  230. package/agent-assets/task-flows/knowledge.import.md +15 -15
  231. package/agent-assets/task-flows/message.received.dm.md +20 -17
  232. package/agent-assets/task-flows/message.received.dm_first.md +11 -15
  233. package/agent-assets/task-flows/routine.custom.md +6 -4
  234. package/agent-assets/task-flows/routine.evening_review.md +46 -170
  235. package/agent-assets/task-flows/routine.fetch_window.md +19 -14
  236. package/agent-assets/task-flows/routine.hourly_check.md +27 -15
  237. package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
  238. package/agent-assets/task-flows/routine.monthly_review.md +67 -25
  239. package/agent-assets/task-flows/routine.morning_routine_journal.md +135 -0
  240. package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
  241. package/agent-assets/task-flows/routine.research_cluster_update.md +35 -0
  242. package/agent-assets/task-flows/routine.research_dispatch.md +38 -0
  243. package/agent-assets/task-flows/routine.research_offer_dm.md +125 -0
  244. package/agent-assets/task-flows/routine.research_wiki_summary.md +53 -0
  245. package/agent-assets/task-flows/routine.roadmap_refresh.md +68 -23
  246. package/agent-assets/task-flows/routine.today_refresh.md +4 -4
  247. package/agent-assets/task-flows/routine.user_profile_sweep.md +19 -20
  248. package/agent-assets/task-flows/routine.weekly_review.md +370 -86
  249. package/agent-assets/task-flows/schedule.approaching.md +0 -1
  250. package/agent-assets/task-flows/scheduled.dm.md +13 -13
  251. package/agent-assets/task-flows/scheduled.task.md +9 -9
  252. package/agent-assets/task-flows/setup.initial.md +171 -251
  253. package/agent-assets/task-flows/setup.update.md +2 -2
  254. package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
  255. package/agent-assets/templates/README.md +27 -20
  256. package/agent-assets/templates/_index.md +42 -26
  257. package/agent-assets/templates/_manifest.json +34 -99
  258. package/agent-assets/templates/{user → identity}/_index.md +1 -1
  259. package/agent-assets/templates/identity/expertise.md +9 -0
  260. package/agent-assets/templates/identity/goals.md +9 -0
  261. package/agent-assets/templates/identity/people.md +13 -0
  262. package/agent-assets/templates/identity/personal.md +9 -0
  263. package/agent-assets/templates/{user → identity}/profile.md +2 -2
  264. package/agent-assets/templates/identity/work.md +9 -0
  265. package/agent-assets/templates/{dossiers → knowledge/dossiers}/_index.md +2 -2
  266. package/agent-assets/templates/{projects → plans/projects}/_active.base +1 -1
  267. package/agent-assets/templates/policies/_index.md +21 -0
  268. package/agent-assets/templates/{rules → policies}/journal-export.md +1 -1
  269. package/agent-assets/templates/policies/journal-format.md +168 -0
  270. package/agent-assets/templates/{rules/policies → policies/management-captures}/_index.md +2 -2
  271. package/agent-assets/templates/{rules → policies}/management.md +3 -3
  272. package/agent-assets/templates/{rules → policies}/mcp.md +1 -1
  273. package/agent-assets/templates/{rules → policies}/redaction.md +1 -1
  274. package/agent-assets/templates/{routines → policies/routines}/_index.md +1 -1
  275. package/agent-assets/templates/{routines → policies/routines}/evening.md +2 -2
  276. package/agent-assets/templates/{routines → policies/routines}/hourly.md +1 -1
  277. package/agent-assets/templates/{routines → policies/routines}/monthly.md +2 -2
  278. package/bin/aitne.mjs +21 -5
  279. package/package.json +5 -4
  280. package/scripts/commands/doctor.mjs +63 -5
  281. package/scripts/commands/run-now.mjs +187 -0
  282. package/scripts/commands/verify.mjs +264 -0
  283. package/scripts/lib/ports.d.mts +27 -0
  284. package/scripts/lib/ports.mjs +36 -0
  285. package/scripts/lib/read-api-token.mjs +176 -0
  286. package/scripts/start.mjs +2 -1
  287. package/agent-assets/docs/features/lifestyle/travel-time.md +0 -52
  288. package/agent-assets/docs/features/routines/monthly-review.md +0 -65
  289. package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
  290. package/agent-assets/skills/management-task-register/SKILL.md +0 -330
  291. package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
  292. package/agent-assets/skills/receipts/SKILL.md +0 -134
  293. package/agent-assets/skills/travel/SKILL.md +0 -132
  294. package/agent-assets/skills/travel-time/SKILL.md +0 -158
  295. package/agent-assets/task-flows/routine.morning_routine.md +0 -322
  296. package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
  297. package/agent-assets/templates/context-index.md +0 -42
  298. package/agent-assets/templates/rules/_index.md +0 -19
  299. package/agent-assets/templates/rules/journal-format.md +0 -61
  300. package/agent-assets/templates/user/expertise.md +0 -7
  301. package/agent-assets/templates/user/goals.md +0 -7
  302. package/agent-assets/templates/user/people.md +0 -7
  303. package/agent-assets/templates/user/personal.md +0 -7
  304. package/agent-assets/templates/user/work.md +0 -7
  305. /package/agent-assets/templates/{agent/journal.md → journal/agent.md} +0 -0
  306. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/evening.md +0 -0
  307. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/hourly.md +0 -0
  308. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/monthly.md +0 -0
  309. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/morning.md +0 -0
  310. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/roadmap.md +0 -0
  311. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/weekly.md +0 -0
  312. /package/agent-assets/templates/{projects → plans/projects}/_index.md +0 -0
  313. /package/agent-assets/templates/{roadmap.md → plans/roadmap.md} +0 -0
  314. /package/agent-assets/templates/{routines → policies/routines}/morning.md +0 -0
  315. /package/agent-assets/templates/{routines → policies/routines}/weekly.md +0 -0
  316. /package/agent-assets/templates/{agent → state}/profile-questions.md +0 -0
  317. /package/agent-assets/templates/{today.md → state/today.md} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Claude Code; `delegatedBackend` is non-Claude). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Claude DM session (`delegatedBackend` is non-Claude). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -90,7 +90,7 @@ Response shape on success:
90
90
  `outputSchema` is **required** — the subprocess emits exactly one JSON
91
91
  object as its final message and the daemon validates it. Schemas
92
92
  larger than 4 KB are rejected (`schema_too_large`). Caps default to
93
- `maxToolCalls=7`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them via
93
+ `maxToolCalls=8`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them via
94
94
  the request body up to the hard caps (15 / 0.50 / 300000) when a task
95
95
  genuinely needs more.
96
96
 
@@ -206,10 +206,18 @@ curl -s -X POST http://localhost:8321/api/integrations/gmail/exec \
206
206
 
207
207
  The setup wizard pre-populates `gmail.deniedTools` with the connector's
208
208
  destructive defaults (send / batch label mutate / etc.). `/exec`
209
- honors the deny list: a task that requires a denied tool surfaces as
210
- `tool_unavailable` (not 403) — the subprocess reports the gap and the
211
- daemon returns 502. Surface that to the user and ask whether to lift
212
- the deny before retrying.
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.
213
221
 
214
222
  ## Decision rules
215
223
 
@@ -236,6 +244,7 @@ Discriminator: `body.mode === "delegated"`.
236
244
  | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
237
245
  | 409 | `mode_mismatch` | no | Gmail isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md` and stop. |
238
246
  | 409 | `precondition` | no | Mode/backend was flipped while the call queued. Re-read `integrations.md` and re-plan. |
247
+ | 403 | `denied_tool` | no | Every tool in the connector is denied — task mode has no surface to plan against. Surface to the user and ask whether to lift the deny. |
239
248
  | 429 | `task_quota_exhausted` | no | Daily cap reached; wait or surface. |
240
249
  | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Consider a simpler schema. |
241
250
  | 502 | `tool_unavailable` | no | No connector tool fits the intent. Surface the gap to the user. |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Codex; `delegatedBackend` is non-Codex). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Codex CLI DM session (`delegatedBackend` is non-Codex). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  ---
5
5
 
6
6
  # Mail (delegated, cross-backend)
@@ -85,7 +85,7 @@ Response shape on success:
85
85
  `outputSchema` is **required** — the subprocess emits exactly one JSON
86
86
  object as its final message and the daemon validates it. Schemas
87
87
  larger than 4 KB are rejected (`schema_too_large`). Caps default to
88
- `maxToolCalls=7`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them
88
+ `maxToolCalls=8`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them
89
89
  via the request body up to the hard caps (15 / 0.50 / 300000) when a
90
90
  task genuinely needs more.
91
91
 
@@ -193,9 +193,12 @@ curl -sS -X POST http://localhost:8321/api/integrations/gmail/exec \
193
193
  ## Default deny floor
194
194
 
195
195
  The setup wizard pre-populates `gmail.deniedTools` with the connector's
196
- destructive defaults. `/exec` honors the deny list: a task that
197
- requires a denied tool surfaces as `tool_unavailable` — surface that
198
- to the user and ask whether to lift the deny before retrying.
196
+ destructive defaults. `/exec` honors the deny list, distinguishing two
197
+ cases: if **every** connector tool is denied `403 denied_tool` (no
198
+ surface to plan against, rejected up front); if usable tools remain but
199
+ the specific tool a planned task needs is denied (or no tool fits) →
200
+ `502 tool_unavailable`. In both cases, surface that to the user and ask
201
+ whether to lift the relevant deny before retrying.
199
202
 
200
203
  ## Decision rules
201
204
 
@@ -218,6 +221,7 @@ Discriminator: `body.mode === "delegated"`.
218
221
  | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
219
222
  | 409 | `mode_mismatch` | no | Gmail isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md` and stop. |
220
223
  | 409 | `precondition` | no | Mode/backend was flipped during queue wait. Re-read `integrations.md` and re-plan. |
224
+ | 403 | `denied_tool` | no | Every tool in the connector is denied — no surface to plan against. Surface to the user and ask whether to lift the deny. |
221
225
  | 429 | `task_quota_exhausted` | no | Daily cap reached; wait or surface. |
222
226
  | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Consider a simpler schema. |
223
227
  | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Gemini; `delegatedBackend` is non-Gemini). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Gemini CLI DM session (`delegatedBackend` is non-Gemini). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  ---
5
5
 
6
6
  # Mail (delegated, cross-backend)
@@ -83,7 +83,7 @@ Response shape on success:
83
83
  `outputSchema` is **required** — the subprocess emits exactly one JSON
84
84
  object as its final message and the daemon validates it. Schemas
85
85
  larger than 4 KB are rejected (`schema_too_large`). Caps default to
86
- `maxToolCalls=7`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them
86
+ `maxToolCalls=8`, `maxBudgetUsd=0.05`, `timeoutMs=60000` — bump them
87
87
  via the request body up to the hard caps (15 / 0.50 / 300000) when a
88
88
  task genuinely needs more.
89
89
 
@@ -187,9 +187,12 @@ curl -sS -X POST http://localhost:8321/api/integrations/gmail/exec \
187
187
  ## Default deny floor
188
188
 
189
189
  The setup wizard pre-populates `gmail.deniedTools` with the connector's
190
- destructive defaults. `/exec` honors the deny list: a task that
191
- requires a denied tool surfaces as `tool_unavailable` — surface that
192
- to the user and ask whether to lift the deny before retrying.
190
+ destructive defaults. `/exec` honors the deny list, distinguishing two
191
+ cases: if **every** connector tool is denied `403 denied_tool` (no
192
+ surface to plan against, rejected up front); if usable tools remain but
193
+ the specific tool a planned task needs is denied (or no tool fits) →
194
+ `502 tool_unavailable`. In both cases, surface that to the user and ask
195
+ whether to lift the relevant deny before retrying.
193
196
 
194
197
  ## Decision rules
195
198
 
@@ -212,6 +215,7 @@ Discriminator: `body.mode === "delegated"`.
212
215
  | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
213
216
  | 409 | `mode_mismatch` | no | Gmail isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md` and stop. |
214
217
  | 409 | `precondition` | no | Mode/backend was flipped during queue wait. Re-read `integrations.md` and re-plan. |
218
+ | 403 | `denied_tool` | no | Every tool in the connector is denied — no surface to plan against. Surface to the user and ask whether to lift the deny. |
215
219
  | 429 | `task_quota_exhausted` | no | Daily cap reached; wait or surface. |
216
220
  | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Consider a simpler schema. |
217
221
  | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
@@ -220,122 +220,17 @@ curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG/body?format=raw&chunk=
220
220
 
221
221
  ## 6. Worked examples
222
222
 
223
- ### Reply with context
224
- ```bash
225
- # 1. Find the thread start local.
226
- curl -s "http://localhost:8321/api/mail/search?q=from:alice+proposal&limit=5"
227
- # → pick the hit, note accountId + providerMsgId.
228
-
229
- # 2. Fetch the thread.
230
- curl -s "http://localhost:8321/api/mail/acct-1/threads/THREAD_ID"
231
- # → last message has rfc822MsgId, references[], providerMsgId.
232
-
233
- # 3. Create a draft threaded to it. Drafts are Autonomous tier.
234
- curl -sX POST "http://localhost:8321/api/mail/acct-1/drafts" \
235
- -H "Content-Type: application/json" \
236
- -d '{
237
- "to": ["alice@example.com"],
238
- "subject": "Re: Proposal",
239
- "textBody": "Thanks Alice — ...",
240
- "reply": {
241
- "inReplyToRfc822Id": "<abc@mail.example.com>",
242
- "references": ["<root@mail.example.com>", "<abc@mail.example.com>"],
243
- "providerThreadId": "THREAD_ID",
244
- "parentProviderMsgId": "PARENT_MSG_ID"
245
- }
246
- }'
247
- ```
223
+ Three direct-mode worked examples — reply with context, file a
224
+ message (read + tag + archive), cross-account search → pick account
225
+ send are in the examples reference below. The delegated /
226
+ native variants of this skill carry their own examples.
248
227
 
249
- ### File a message (read + tag + archive)
250
- ```bash
251
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/read" \
252
- -d '{"read": true}'
253
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/tags" \
254
- -d '{"add": ["followup"], "remove": []}'
255
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/archive"
256
- ```
257
- On IMAP, confirm `followup` is in `GET /mail/:acct/tags` `.userDefined`
258
- first — unknown keywords get dropped.
259
-
260
- ### Cross-account search → pick account → send
261
- ```bash
262
- # Find recipient's earlier emails across all accounts.
263
- curl -s "http://localhost:8321/api/mail/search?q=from:bob@acme.com&limit=10"
264
- # → hits carry accountId. Use whichever account received the earlier thread
265
- # so the reply comes from a familiar address.
266
-
267
- curl -sX POST "http://localhost:8321/api/mail/acct-2/messages/send" \
268
- -H "Content-Type: application/json" \
269
- -d '{"to": ["bob@acme.com"], "subject": "...", "textBody": "..."}'
270
- ```
228
+ {{> ref:examples }}
271
229
 
272
230
  ## 7. API reference
273
231
 
274
- Base URL `http://localhost:8321`. `ACCT` = accountId from `accounts.md`.
275
-
276
- ### Accounts
277
- ```bash
278
- curl -s "http://localhost:8321/api/mail/accounts?active=1"
279
- # → { accounts: [{ id, kind, email, label?, authStatus, idleEnabled, active, createdAt }, ...] }
280
- ```
281
-
282
- ### Search (local FTS5, cross-account)
283
- ```bash
284
- curl -s "http://localhost:8321/api/mail/search?q=...&limit=50&accountId=ACCT"
285
- # → { results: [{ accountId, providerMsgId, subject, snippet, receivedAtUtc,
286
- # from: { email } | null, isRead }], count, query }
287
- ```
288
-
289
- ### Read
290
- ```bash
291
- # List / search via the provider.
292
- curl -s "http://localhost:8321/api/mail/ACCT/messages?q=is:unread&limit=20"
293
- # → { messages: [{ providerMsgId, threadId, from, subject, snippet,
294
- # receivedAtUtc, isRead, flags, hasAttachment }] }
295
-
296
- curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG_ID"
297
- # → { message: { ..., body: { text, html }, attachments: [...] } }
298
-
299
- curl -s "http://localhost:8321/api/mail/ACCT/threads/THREAD_ID"
300
- # → { thread: { threadId, messages: [...], status: "full"|"partial", missingAncestors? } }
301
-
302
- curl -s "http://localhost:8321/api/mail/ACCT/folders"
303
- curl -s "http://localhost:8321/api/mail/ACCT/tags"
304
- ```
305
-
306
- ### Send / draft
307
- ```bash
308
- # Direct send — Autonomous; rejected with 403 when the user has denied
309
- # the send tool. Call /api/notify yourself if the user should know.
310
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/send" \
311
- -H "Content-Type: application/json" \
312
- -d '{"to": [...], "subject": "...", "textBody": "...", "reply"?: {...}}'
313
- # → { result: { id, isDraft: false, rfc822MsgId?, warnings? } }
314
-
315
- # Draft CRUD — Autonomous tier.
316
- curl -s "http://localhost:8321/api/mail/ACCT/drafts"
317
- curl -s "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
318
- curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts" -d '{...}'
319
- curl -sX PATCH "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID" -d '{...}'
320
- # PATCH response: { status, id, warnings? }
321
- # - On Outlook, `warnings: ["reply_threading_immutable_after_create"]` if
322
- # `reply` was supplied — reply headers are fixed at createDraft time.
323
- curl -sX DELETE "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
324
- curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID/send"
325
- ```
232
+ Direct-mode `/api/mail/*` surface accounts, search, read,
233
+ send / draft, modify / move, health — is in the api reference below.
234
+ `ACCT` is the `accountId` resolved per §1.
326
235
 
327
- ### Modify / move
328
- ```bash
329
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/read" -d '{"read": true}'
330
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/tags" -d '{"add": ["Starred"], "remove": []}'
331
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/trash"
332
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/untrash"
333
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/archive"
334
- ```
335
-
336
- ### Health
337
- ```bash
338
- curl -s "http://localhost:8321/api/mail/ACCT/health"
339
- # → { accountId, lastPollAtUtc, lastError, lastErrorAtUtc,
340
- # consecutiveErrorCount, idleFallbackUntilUtc }
341
- ```
236
+ {{> ref:api }}
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Gmail connector your harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Gmail connector directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Codex (`nativeBackend === "codex"`). Use the in-session Gmail connector your Codex harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Codex (`nativeBackend === "codex"`). Use the Gmail connector your Codex harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the in-session Gmail connector your Gemini harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the Gmail connector your Gemini harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -0,0 +1,110 @@
1
+ ---
2
+ kind: reference
3
+ name: api
4
+ description: Direct-mode /api/mail/* reference — accounts, search, read, send/draft, modify/move, health. ACCT is the accountId resolved from accounts.md.
5
+ ---
6
+
7
+ # /api/mail/* — Direct-mode reference
8
+
9
+ Base URL `http://localhost:8321`. `ACCT` = `accountId` from
10
+ `accounts.md` (resolved per §1 of the skill body).
11
+
12
+ Cross-cutting rules (apply to every endpoint below):
13
+
14
+ - The per-account `/api/mail/:acct/*` gate returns `410` for the
15
+ account's `kind` when Gmail / Outlook are in delegated or native
16
+ mode. Re-check `integrations.md` and switch to the matching
17
+ delegated / native skill body instead — do not retry through
18
+ `/api/mail/*`.
19
+ - The trash / untrash / archive / send endpoints are Autonomous but
20
+ still respect the user's `deniedTools` for delegated-mode
21
+ connector tools (no equivalent gate in direct mode today).
22
+
23
+ ## Accounts
24
+
25
+ ```bash
26
+ curl -s "http://localhost:8321/api/mail/accounts?active=1"
27
+ # → { accounts: [{ id, kind, email, label?, authStatus, idleEnabled, active, createdAt }, ...] }
28
+ ```
29
+
30
+ Always pass `?active=1` for recovery from a stale `accounts.md` —
31
+ the unfiltered form returns dormant / unhealthy rows that every
32
+ operation will reject.
33
+
34
+ ## Search (local FTS5, cross-account)
35
+
36
+ ```bash
37
+ curl -s "http://localhost:8321/api/mail/search?q=...&limit=50&accountId=ACCT"
38
+ # → { results: [{ accountId, providerMsgId, subject, snippet, receivedAtUtc,
39
+ # from: { email } | null, isRead }], count, query }
40
+ ```
41
+
42
+ `accountId` is optional — omit to search across every active account.
43
+ The local index is zero provider round-trips, so prefer it for "find
44
+ emails about X / from Y / last month" queries before falling back to
45
+ per-account provider search.
46
+
47
+ ## Read
48
+
49
+ ```bash
50
+ # List / search via the provider.
51
+ curl -s "http://localhost:8321/api/mail/ACCT/messages?q=is:unread&limit=20"
52
+ # → { messages: [{ providerMsgId, threadId, from, subject, snippet,
53
+ # receivedAtUtc, isRead, flags, hasAttachment }] }
54
+
55
+ curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG_ID"
56
+ # → { message: { ..., body: { text, html }, attachments: [...] } }
57
+
58
+ curl -s "http://localhost:8321/api/mail/ACCT/threads/THREAD_ID"
59
+ # → { thread: { threadId, messages: [...], status: "full"|"partial", missingAncestors? } }
60
+
61
+ curl -s "http://localhost:8321/api/mail/ACCT/folders"
62
+ curl -s "http://localhost:8321/api/mail/ACCT/tags"
63
+ ```
64
+
65
+ For body understanding on large messages, use the extracted-body
66
+ endpoint (`/messages/MSG/body?format=extracted&maxChars=…&chunk=…`)
67
+ documented in §"Reading message bodies — use extracted chunks" of the
68
+ skill body.
69
+
70
+ ## Send / draft
71
+
72
+ ```bash
73
+ # Direct send — Autonomous. Direct mode has NO deny-tool gate: this
74
+ # route validates the body and sends unconditionally (no 403/denied_tool
75
+ # path; `deniedTools` only applies to delegated-mode connector tools).
76
+ # Call /api/notify yourself if the user should know.
77
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/send" \
78
+ -H "Content-Type: application/json" \
79
+ -d '{"to": [...], "subject": "...", "textBody": "...", "reply"?: {...}}'
80
+ # → { result: { id, isDraft: false, rfc822MsgId?, warnings? } }
81
+
82
+ # Draft CRUD — Autonomous tier.
83
+ curl -s "http://localhost:8321/api/mail/ACCT/drafts"
84
+ curl -s "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
85
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts" -d '{...}'
86
+ curl -sX PATCH "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID" -d '{...}'
87
+ # PATCH response: { status, id, warnings? }
88
+ # - On Outlook, `warnings: ["reply_threading_immutable_after_create"]` if
89
+ # `reply` was supplied — reply headers are fixed at createDraft time.
90
+ curl -sX DELETE "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
91
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID/send"
92
+ ```
93
+
94
+ ## Modify / move
95
+
96
+ ```bash
97
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/read" -d '{"read": true}'
98
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/tags" -d '{"add": ["Starred"], "remove": []}'
99
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/trash"
100
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/untrash"
101
+ curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/archive"
102
+ ```
103
+
104
+ ## Health
105
+
106
+ ```bash
107
+ curl -s "http://localhost:8321/api/mail/ACCT/health"
108
+ # → { accountId, lastPollAtUtc, lastError, lastErrorAtUtc,
109
+ # consecutiveErrorCount, idleFallbackUntilUtc }
110
+ ```
@@ -0,0 +1,70 @@
1
+ ---
2
+ kind: reference
3
+ name: examples
4
+ description: Worked examples for direct-mode mail — reply with context, file a message (read + tag + archive), cross-account search → pick account → send.
5
+ ---
6
+
7
+ # Worked examples (direct mode)
8
+
9
+ These examples target the direct-mode `/api/mail/*` surface. The
10
+ delegated and native variants of this skill carry their own examples
11
+ in their own bodies (Gmail via `/api/integrations/gmail/exec`,
12
+ Outlook via the user's MCP). Use this reference only for
13
+ direct-mode accounts.
14
+
15
+ ## Reply with context
16
+
17
+ ```bash
18
+ # 1. Find the thread — start local.
19
+ curl -s "http://localhost:8321/api/mail/search?q=from:alice+proposal&limit=5"
20
+ # → pick the hit, note accountId + providerMsgId.
21
+
22
+ # 2. Fetch the thread.
23
+ curl -s "http://localhost:8321/api/mail/acct-1/threads/THREAD_ID"
24
+ # → last message has rfc822MsgId, references[], providerMsgId.
25
+
26
+ # 3. Create a draft threaded to it. Drafts are Autonomous tier.
27
+ curl -sX POST "http://localhost:8321/api/mail/acct-1/drafts" \
28
+ -H "Content-Type: application/json" \
29
+ -d '{
30
+ "to": ["alice@example.com"],
31
+ "subject": "Re: Proposal",
32
+ "textBody": "Thanks Alice — ...",
33
+ "reply": {
34
+ "inReplyToRfc822Id": "<abc@mail.example.com>",
35
+ "references": ["<root@mail.example.com>", "<abc@mail.example.com>"],
36
+ "providerThreadId": "THREAD_ID",
37
+ "parentProviderMsgId": "PARENT_MSG_ID"
38
+ }
39
+ }'
40
+ ```
41
+
42
+ ## File a message (read + tag + archive)
43
+
44
+ ```bash
45
+ curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/read" \
46
+ -d '{"read": true}'
47
+ curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/tags" \
48
+ -d '{"add": ["followup"], "remove": []}'
49
+ curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/archive"
50
+ ```
51
+
52
+ On IMAP, confirm `followup` is in `GET /mail/:acct/tags` `.userDefined`
53
+ first — unknown keywords get dropped.
54
+
55
+ ## Cross-account search → pick account → send
56
+
57
+ ```bash
58
+ # Find recipient's earlier emails across all accounts.
59
+ curl -s "http://localhost:8321/api/mail/search?q=from:bob@acme.com&limit=10"
60
+ # → hits carry accountId. Use whichever account received the earlier thread
61
+ # so the reply comes from a familiar address.
62
+
63
+ curl -sX POST "http://localhost:8321/api/mail/acct-2/messages/send" \
64
+ -H "Content-Type: application/json" \
65
+ -d '{"to": ["bob@acme.com"], "subject": "...", "textBody": "..."}'
66
+ ```
67
+
68
+ Prefer drafts when the message goes to someone the user has not
69
+ recently corresponded with — the §"Send vs draft" rule in the skill
70
+ body applies whether or not you came from a cross-account search.
@@ -9,14 +9,14 @@ on this kind — do NOT retry; tell the user and fall back.
9
9
 
10
10
  | Operation | Gmail | Outlook | Yahoo / iCloud (IMAP) |
11
11
  |---|---|---|---|
12
- | Read, search, list folders | | | (ASCII; non-ASCII degrades — see §4) |
13
- | Direct send (`POST /messages/send`) | | | |
14
- | `markRead` / `tags` / `trash` | | | |
15
- | `archive` / `untrash` | | | |
16
- | Thread read (`GET /threads/:id`) | | | ⚠️ client-walked; `status: "partial"` possible |
17
- | Draft read (`GET /drafts`, `GET /drafts/:id`) | | | |
18
- | Draft write (`POST`/`PATCH`/`DELETE /drafts`, `POST /drafts/:id/send`) | | | **501** — direct `/messages/send` only |
19
- | Attachment download (via `/receipts/:id/file`) | | 501 | 501 |
12
+ | Read, search, list folders | yes | yes | yes (ASCII; non-ASCII degrades — see §4) |
13
+ | Direct send (`POST /messages/send`) | yes | yes | yes |
14
+ | `markRead` / `tags` / `trash` | yes | yes | yes |
15
+ | `archive` / `untrash` | yes | yes | yes |
16
+ | Thread read (`GET /threads/:id`) | yes | yes | partial (client-walked; `status: "partial"` possible) |
17
+ | Draft read (`GET /drafts`, `GET /drafts/:id`) | yes | yes | yes |
18
+ | Draft write (`POST`/`PATCH`/`DELETE /drafts`, `POST /drafts/:id/send`) | yes | yes | no **501** — direct `/messages/send` only |
19
+ | Attachment download (via `POST /api/receipts/:id/download`) | yes | no 501 | no 501 |
20
20
 
21
21
  **IMAP drafts** (Yahoo / iCloud): every draft *write* returns 501. To
22
22
  queue outbound mail for a non-Gmail IMAP user, send directly via