@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,7 +1,6 @@
1
1
  ---
2
2
  name: schedule
3
3
  description: Load when scheduling a future agent wake-up, pre-composed DM, recurring task, or de-duping against existing pending schedules.
4
- when_to_use: Owns `/api/schedule`, `/api/schedule/dm`, and `/api/recurring-schedules`. `external-services` defers here for all time-based work.
5
4
  allowed-tools:
6
5
  - Bash(curl *)
7
6
  - Read
@@ -32,50 +31,18 @@ user but compound into duplicate DMs/notifications at fire time.
32
31
  PATCH the existing item if it needs updating — never register a
33
32
  parallel second one).
34
33
  3. **Recurring check.** `GET /api/recurring-schedules?enabled=true` to
35
- confirm no recurring rule already covers this cadence (e.g. a daily
36
- 09:00 inbox triage). If covered, skip — the recurring instance will
37
- regenerate on its own.
34
+ confirm no recurring rule/Agent already covers this cadence (e.g. a
35
+ daily 09:00 inbox triage, or the morning briefing). If covered, skip.
36
+ (Recurring *work* is created as an Agent via the `agent-create` skill;
37
+ recurring *DMs* via `POST /api/recurring-schedules` `taskType:dm_session`.)
38
38
  4. **`confirm_dedup_key` check (mandatory for `confirm:` sub-flow rows
39
39
  only).** When scheduling a `dm_session` row with
40
- `taskContext.sub_flow="confirm"`, additionally filter
41
- `GET /api/schedule?status=pending,running` by
42
- `taskContext.confirm_dedup_key`. Skip if any match exists —
43
- regardless of `scheduledFor` distance or description match. The
44
- confirm sub-flow's chained-fire model (see `scheduled.dm.md`
45
- §"Confirmation follow-up" Step 3) and a hot-thread defer (Step 1
46
- check 1) both inherit the same dedup_key, so a successor or defer
47
- row legitimately occupies the queue with the same key — a second
48
- gate firing for the same topic MUST yield to it rather than
49
- double-asking.
50
-
51
- ```bash
52
- curl -s "http://localhost:8321/api/schedule?status=pending,running" \
53
- | jq --arg k "<gate>:<stable-topic>" \
54
- '[.items[] | select(.taskContext.confirm_dedup_key == $k)] | length'
55
- ```
56
-
57
- If the count is `≥ 1`, log to `## Agent Log` and proceed without
58
- scheduling:
59
- ```
60
- - HH:MM [confirm] skipped <dedup_key>: row already pending
61
- ```
62
-
63
- **`confirm_dedup_key` shape contract.** The key is
64
- `<gate>:<stable-topic>` — for example
65
- `create_project:la-pm-masters`,
66
- `roadmap_ambiguous:tokyo-trip-date`,
67
- `managed_task_dedup:<existing-task-id>`. The gate scope ensures
68
- two unrelated gates can't collide on the same topic name; the
69
- topic component MUST be deterministic from the topic itself
70
- (no timestamps, no message IDs, no random nonces) so re-fires of
71
- the same gate produce the same key and this pre-flight catches
72
- them.
73
-
74
- This rule layers on top of bullets 1-3, which catch the common
75
- recurring / Agent-Plan duplicates. Bullet 4 catches the case
76
- where two confirms target the same topic at different scheduled
77
- times (e.g. one queued for the morning briefing, another the
78
- gate would queue for `+4h`).
40
+ `taskContext.sub_flow="confirm"`, run the dedup pre-check + shape
41
+ contract documented in
42
+ `task-flows/_partials/confirm-subflow.md` (also included verbatim
43
+ by `scheduled.dm.md` and `message.received.dm{,_first}.md`). The
44
+ single source covers the `dedup_key` filter, the
45
+ `<gate>:<stable-topic>` shape, and cross-path cancellation.
79
46
 
80
47
  Log the skip to `## Agent Log`:
81
48
  `- HH:MM [schedule] skipped <subject>: duplicate of <planId|row>`.
@@ -88,11 +55,14 @@ If the request expresses an **ongoing management practice** with a
88
55
  recorded reason — "every morning, run my finance app and log the
89
56
  balance to a finance dossier", "from now on whenever X happens, do
90
57
  Y" — switch to the `management-policy` skill instead. It creates a
91
- `rules/policies/<slug>.md` that captures the WHY alongside the cadence
92
- (via `routines/custom/<slug>.md`) so the rule survives a context
93
- reset. Plain recurring schedules via `/api/recurring-schedules` are
94
- still right when the cadence is all that matters and there is no need
95
- to record intent.
58
+ `policies/management-captures/<slug>.md` that captures the WHY alongside the cadence
59
+ (via `policies/routines/custom/<slug>.md`) so the rule survives a context
60
+ reset. When the cadence is all that matters and there is no intent to
61
+ record: recurring autonomous **work** create a **recurring Agent** via
62
+ the `agent-create` skill (`POST /api/agents`); recurring scheduled
63
+ **DM / briefing** → `POST /api/recurring-schedules` with
64
+ `taskType: "dm_session"`. (Creating a recurring `agent.task` row directly
65
+ on `/api/recurring-schedules` is **410 Gone** — use an Agent.)
96
66
 
97
67
  ## DM vs Agent Task
98
68
 
@@ -105,11 +75,11 @@ to record intent.
105
75
 
106
76
  **Default to DM** when possible. Every agent wake-up costs money and context.
107
77
 
108
- ## Writing a Good Description (for agent tasks)
78
+ ## Writing a Good Prompt (for agent tasks)
109
79
 
110
- > **The wake-up agent has NO memory of why it was scheduled.** It receives only: `today.md`, a fresh 1-day calendar, `user/profile.md` + `rules/management.md`, and the `description` + `taskContext` fields you provide. Nothing else.
80
+ > **The wake-up agent has NO memory of why it was scheduled.** It receives only: `state/today.md`, a fresh 1-day calendar, `identity/profile.md` + `policies/management.md`, and the `prompt` + `taskContext` fields you provide. Nothing else. (`description` is just an optional list label — never the agent body.)
111
81
 
112
- Include all four elements:
82
+ Include all four elements in the `prompt`:
113
83
 
114
84
  | Element | What it answers |
115
85
  |---|---|
@@ -123,13 +93,13 @@ Include all four elements:
123
93
  **Bad:** `"Meeting prep"` — which meeting? when? what to prepare?
124
94
 
125
95
  ## Using `taskContext`
126
- Structured metadata for IDs, URLs, and correlation. Put long identifiers here so `description` stays under ~2 sentences:
96
+ Structured metadata for IDs, URLs, and correlation. Put long identifiers here so the `prompt` stays focused:
127
97
  ```json
128
98
  { "scheduledBy": "morning_routine", "prUrl": "https://github.com/user/repo/pull/42" }
129
99
  ```
130
100
 
131
101
  **`importance` convention.** This controls whether `agent_schedule`
132
- rows become `roadmap.md` `Scheduled:` entries:
102
+ rows become `plans/roadmap.md` `Scheduled:` entries:
133
103
 
134
104
  | Tier | Roadmap behavior | Use |
135
105
  |---|---|---|
@@ -144,9 +114,11 @@ month about ESTA for the LA trip"), either write/promote the roadmap
144
114
  item via the roadmap skill and let AAP schedule the reminder, or call
145
115
  `/api/schedule/dm` with `"importance":"strategic"`.
146
116
 
147
- ## Model selection
148
- - **`sonnet`** (default) — reminders, notifications, single-step tasks
149
- - **`opus`**multi-file analysis, cross-repo reasoning, decisions affecting user commitments
117
+ ## Tier / Model selection
118
+
119
+ Pick `tier` (`lite` / `medium` / `high`) by default backend-neutral cost knob. Pin `model` (registered id, alias, or `<backendId>/<modelId>`) only when the row must outlive a `/settings/models` re-route. Mutually exclusive — both set returns `schedule.tier_and_model_conflict`. Omit both to use the dispatcher's process-key default. Discovery, PATCH swap form, alias rewrite, and `/api/schedule/options` payload are in the reference below.
120
+
121
+ {{> ref:model-selection }}
150
122
 
151
123
  ## Time discipline
152
124
  - **Absolute time required** — resolve relative expressions via `<current_time>` into ISO 8601 with offset. E.g. "in 1 hour" at 15:30 EDT → `2026-04-06T16:30:00-04:00`.
@@ -181,15 +153,16 @@ Response: `{ "status":"scheduled", "scheduleId":"123", "scheduledFor":"..." }`.
181
153
  ```bash
182
154
  curl -s -X POST http://localhost:8321/api/schedule \
183
155
  -H 'Content-Type: application/json' \
184
- -d '{"time":"2026-04-06T16:00:00-04:00","taskType":"wake","description":"Check PR #42 status and notify user.","model":"sonnet","taskContext":{"scheduledBy":"dm_conversation"}}'
156
+ -d '{"time":"2026-04-06T16:00:00-04:00","taskType":"wake","prompt":"Hourly docker health check: run `docker ps --format` and DM if any container is in restart loop.","description":"Docker health check","tier":"lite","taskContext":{"scheduledBy":"docker_monitor"}}'
185
157
  ```
186
158
  | Field | Required | Description |
187
159
  |---|---|---|
188
160
  | `time` | Yes | ISO 8601 with timezone offset |
189
- | `taskType` | Yes | `wake` for scheduled tasks |
190
- | `description` | Yes | Self-contained (min 20 chars). See format above. Doubles as the agent body unless `prompt` overrides it. |
191
- | `prompt` | No | Optional override for the agent body (min 20 chars when set). When set, the dispatcher injects this not `description` into the task-flow template. Use when you want a short list-friendly `description` plus a longer, separate instruction for the agent. |
192
- | `model` | No | `sonnet` (default) or `opus` |
161
+ | `taskType` | Yes | Free-form provenance label for the row (no allowlist on the single endpoint). Use `wake` for an agent wake-up — the convention this skill follows. The closed set `wake`/`dm_session`/`check`/`dm` is enforced only on `/api/schedule/batch`; e.g. the dashboard's manual "+ New task" sends `custom`. The label does not change firing — the scheduler runs every non-`dm`/`dm_session`/`browser_task` row as a generic `scheduled.task`. |
162
+ | `prompt` | Yes | The agent's instruction at fire time — its ONLY context (the session has no memory). Self-contained: what + why + who + expected output. See format above. Max 8000 chars (~2000 tokens); move bulk reference material into a file the agent reads at fire time rather than inlining it. |
163
+ | `description` | No | Optional short label shown in the schedule list (max 200 chars). NOT the agent bodythat is `prompt`. Omit it and the list shows a `prompt` excerpt. |
164
+ | `tier` | No | `lite` / `medium` / `high`. Omit to use the dispatcher's process-key default (medium for `scheduled.task`). See "Tier / Model selection" above. Mutually exclusive with `model`. |
165
+ | `model` | No | Registered model id (`claude-opus-4-8`, `gpt-5.4`, …), legacy alias (`sonnet` / `opus`, auto-rewritten to `tier`), or composite `<backendId>/<modelId>`. See "Tier / Model selection" above. Mutually exclusive with `tier`. |
193
166
  | `taskContext` | No | Structured metadata object |
194
167
 
195
168
  Response: `{ "status":"scheduled", "scheduleId":"123", "scheduledFor":"YYYY-MM-DD HH:MM:SS" }`. `scheduledFor` is the normalized UTC SQLite timestamp the daemon actually stored — log this verbatim instead of re-formatting the input `time`. Rejects times in the past (> 1 min ago), same as `/api/schedule/dm`.
@@ -200,8 +173,7 @@ curl -s -X PATCH http://localhost:8321/api/schedule/42 \
200
173
  -H 'Content-Type: application/json' \
201
174
  -d '{"time":"2026-04-06T17:00:00-04:00"}'
202
175
  ```
203
- Fields: `time` (ISO 8601), `description` (min 20 chars, non-dm only), `prompt` (min 20 chars OR `null` to clear; non-dm only), `message` (dm only), `model`, `taskContext`. At least one required. Only `pending` items editable. `description`/`message` mutually exclusive; `prompt`/`message` mutually exclusive.
204
- Response: `{ "status":"updated", "id":42 }` / 404 / 409 (not pending).
176
+ Fields: `time` (ISO 8601), `prompt` (the agent instruction, ≤8000 chars, non-dm only, OR `null` to clear on a legacy row), `description` (optional label ≤200 chars, non-dm only), `message` (dm only), `tier` (`lite`/`medium`/`high` OR `null` to clear), `model` (registered id / alias / composite OR `null` to clear), `taskContext`. At least one required. Only `pending` items editable. `description`/`message` mutually exclusive; `prompt`/`message` mutually exclusive. Tier ↔ model swap form is in the model-selection reference above. Response: `{ "status":"updated", "id":42, "warnings":[] }` / 404 / 409 — surface `warnings[]` (e.g. `schedule.model_deprecated`) to the next turn.
205
177
 
206
178
  ### GET /api/schedule — List scheduled items
207
179
  ```bash
@@ -211,7 +183,7 @@ Param `status` (default `pending,running`): comma-separated `pending`, `running`
211
183
  Param `roadmapEligible=true`: return only rows that may become
212
184
  roadmap `Scheduled:` entries (`transient` / `low` excluded, `normal`
213
185
  only beyond 7 days, `strategic` included).
214
- Response: `{ "items":[{ "id","scheduledFor","taskType","description","prompt","status","model","taskContext","createdAt" }] }` `prompt` is `null` when no override is set. `taskContext` is the parsed JSON object (or `null` when none was stored); use it for sub-flow-aware filtering, e.g. `jq '.items[] | select(.taskContext.confirm_dedup_key == "create_project:la-pm-masters")'`.
186
+ Response: `{ "items":[{ "id","scheduledFor","taskType","description","prompt","status","model","backendId","tier","taskContext","createdAt" }] }`. `prompt` / `tier` / `model` / `backendId` are `null` when no override is set. `model` is a registered id verbatim and travels with `backendId` when set — the row carries either the `(model, backendId)` pin or `tier`, never both. Legacy alias inputs (`sonnet` / `opus`) are normalized to `tier` at write time. `taskContext` is the parsed JSON (or `null`); filter with `jq` e.g. `'.items[] | select(.taskContext.confirm_dedup_key == "create_project:la-pm-masters")'`.
215
187
 
216
188
  ### DELETE /api/schedule/:id — Cancel a pending item
217
189
  ```bash
@@ -219,51 +191,51 @@ curl -s -X DELETE http://localhost:8321/api/schedule/42
219
191
  ```
220
192
  Only cancels `pending` items. Response: `{ "status":"cancelled", "id":42 }` / 404 / 409.
221
193
 
194
+ ### POST /api/schedule/batch — Bulk register rich-context schedules
195
+
196
+ Morning-routine Stage A only. Single-row callers use `POST /api/schedule`
197
+ above. The required `taskContext.background` + `expected_output`
198
+ fields, the 50-row cap, the atomic / per-row commit modes, and the
199
+ success payload are in the batch reference below.
200
+
201
+ {{> ref:batch }}
202
+
222
203
  ---
223
204
 
224
- ## Recurring Schedules
225
- For tasks that repeat on a fixed pattern. Auto-regenerates the next occurrence after each execution.
205
+ ## Errors
226
206
 
227
- ### POST /api/recurring-schedules Create
228
- ```bash
229
- # Daily at 09:00
230
- curl -s -X POST http://localhost:8321/api/recurring-schedules \
231
- -H 'Content-Type: application/json' \
232
- -d '{"taskType":"wake","description":"Morning inbox triage — check pending observations and update today.md.","recurrenceRule":{"frequency":"daily","time":"09:00"}}'
233
- # Weekly Mon/Wed/Fri at 10:00
234
- curl -s -X POST http://localhost:8321/api/recurring-schedules \
235
- -H 'Content-Type: application/json' \
236
- -d '{"taskType":"wake","description":"Standup prep — review PRs, calendar, and blockers.","recurrenceRule":{"frequency":"weekly","time":"10:00","daysOfWeek":[1,3,5]}}'
237
- ```
238
- | Field | Required | Description |
239
- |---|---|---|
240
- | `taskType` | Yes | Task type for dispatch (e.g. `wake`) |
241
- | `description` | Yes | Self-contained (min 20 chars). Same rules as one-shot. Doubles as the agent body unless `prompt` overrides it. |
242
- | `prompt` | No | Optional override for the agent body (min 20 chars when set). Each materialized one-shot row inherits this from the recurring parent. |
243
- | `recurrenceRule` | Yes | `{ frequency, time, timezone?, daysOfWeek?, daysOfMonth? }` |
244
- | `model` | No | `sonnet` (default) or `opus` |
245
- | `taskContext` | No | Structured metadata object |
207
+ Every endpoint in this skill emits errors in the **agent-consumable
208
+ envelope** — read `errors[].hint`, fix the value at `errors[].field`,
209
+ and resubmit the same body. The full envelope shape and every
210
+ `schedule.*` code (request-shape, time-bound, row-content, taskContext,
211
+ model, batch) are in the errors reference below.
246
212
 
247
- **Recurrence rule:** `frequency`: `daily`/`weekly`/`monthly`. `time`: `HH:MM` local. `timezone`: IANA (auto-filled from daemon config). `daysOfWeek` (weekly): 0=Sun..6=Sat. `daysOfMonth` (monthly): 1-31 (31 clamps to month end).
213
+ {{> ref:errors }}
248
214
 
249
- Response: `{ "status":"created", "item":{ "id","recurrenceLabel","nextRunAt",... } }`
215
+ ---
250
216
 
251
- ### GET /api/recurring-schedules List
252
- ```bash
253
- curl -s "http://localhost:8321/api/recurring-schedules?enabled=true"
254
- ```
255
- Response: `{ "items":[{ "id","taskType","description","recurrenceRule","enabled","nextRunAt","recurrenceLabel" }] }`
217
+ ## Recurring: work Agent; DM → dm_session
256
218
 
257
- ### PATCH /api/recurring-schedules/:id Update
258
- ```bash
259
- curl -s -X PATCH http://localhost:8321/api/recurring-schedules/1 \
260
- -H 'Content-Type: application/json' \
261
- -d '{"recurrenceRule":{"frequency":"daily","time":"10:00"}}'
262
- ```
263
- Updatable: `recurrenceRule`, `description`, `prompt` (string sets an override, `null` clears), `model`, `taskContext`, `enabled`. Changing `recurrenceRule`/`enabled` auto-reschedules. Set `{"enabled":false}` to pause.
219
+ `/schedule` registers **one-shot** wake-ups and DMs. For repeating tasks:
264
220
 
265
- ### DELETE /api/recurring-schedules/:id Delete
266
- ```bash
267
- curl -s -X DELETE http://localhost:8321/api/recurring-schedules/1
268
- ```
269
- Deletes schedule and cancels pending instances. Response: `{ "status":"deleted", "id":1 }`
221
+ - **Recurring autonomous work** (daily inbox triage, weekly review, hourly
222
+ health check) is a **recurring Agent** — a durable, named identity with
223
+ metrics on `/agents`. Create it with the **`agent-create` skill**
224
+ (`POST /api/agents`). Creating a recurring `agent.task` row directly on
225
+ `POST /api/recurring-schedules` is **410 Gone** use an Agent.
226
+ - **Recurring scheduled DM / briefing** ("DM me a summary every morning")
227
+ stays on `POST /api/recurring-schedules` with `taskType: "dm_session"`
228
+ (its fire time can track quiet-hours; PATCH/DELETE edit it). The morning
229
+ briefing is one of these.
230
+
231
+ `GET /api/recurring-schedules` stays read-only for the dedup pre-check.
232
+
233
+ ### recurrenceRule grammar — the shared recurrence engine
234
+
235
+ The recurrence engine grammar (mapping table, frequency-vs-field matrix,
236
+ cadence-string discipline) is shared with the `managed-tasks` skill and
237
+ the `dm_session` recurring rule above. The reference is byte-identical
238
+ across both skills —
239
+ pinned by `skills-manifest.test.ts` so they cannot drift.
240
+
241
+ {{> ref:recurrence-rule }}
@@ -0,0 +1,93 @@
1
+ ---
2
+ kind: reference
3
+ name: batch
4
+ description: POST /api/schedule/batch — bulk register up to 50 rich-context schedules in one atomic transaction. Morning-routine Stage A is the primary caller.
5
+ ---
6
+
7
+ # POST /api/schedule/batch — Bulk register rich-context schedules
8
+
9
+ Used by the morning-routine Stage A to register every same-day
10
+ schedule in one atomic transaction. Each row's `taskContext` MUST
11
+ carry the context a future `scheduled.task` / `scheduled.dm` session
12
+ needs to produce high-quality output hours later — the daemon cannot
13
+ reconstruct this from the user-facing description.
14
+
15
+ If you are not the morning routine, you almost certainly want
16
+ `POST /api/schedule` (single-row) instead — batch's required
17
+ `taskContext.background` + `expected_output` fields are overkill for
18
+ one-off DM-handler reminders.
19
+
20
+ ## Example
21
+
22
+ ```bash
23
+ curl -s -X POST http://localhost:8321/api/schedule/batch \
24
+ -H 'Content-Type: application/json' \
25
+ -d '{
26
+ "rows": [
27
+ {
28
+ "scheduledFor": "2026-05-15T14:30:00-04:00",
29
+ "taskType": "wake",
30
+ "taskDescription": "Pre-brief the 15:00 standup with the two open Q2 risks.",
31
+ "taskContext": {
32
+ "background": "User flagged Q2 roadmap risks in yesterdays DM; standup needs the two open items front-loaded so the team aligns before 15:30.",
33
+ "expected_output": "DM with two bullet items + one suggested mitigation each, sent 30min before standup.",
34
+ "references": ["plans/projects/q2-roadmap.md#open-risks", "calendar:event:standup-2026-05-15"],
35
+ "tone": "concise"
36
+ }
37
+ }
38
+ ],
39
+ "atomic": true
40
+ }'
41
+ ```
42
+
43
+ ## Fields
44
+
45
+ | Field | Required | Description |
46
+ |---|---|---|
47
+ | `rows` | Yes | Array of row objects (max 50 per batch). Empty array is a documented no-op. |
48
+ | `rows[].scheduledFor` | Yes | ISO 8601 with timezone offset. Must be >= 1 minute in the future. |
49
+ | `rows[].taskType` | Yes | `wake` / `dm_session` / `check` / `dm`. |
50
+ | `rows[].taskDescription` | Yes | Self-contained (min 20 chars). Doubles as the agent body unless `taskPrompt` overrides. |
51
+ | `rows[].taskContext.background` | Yes | Why this task is being scheduled (min 30 chars). Anchor for the future session. |
52
+ | `rows[].taskContext.expected_output` | Yes | What the future session should produce (min 20 chars). |
53
+ | `rows[].taskContext.references` | No | Stable handles the future session can look up (project paths, calendar event ids). |
54
+ | `rows[].taskContext.tone` | No | Free-form tone hint for DM-shaped output. |
55
+ | `rows[].taskContext.tier_override` | No | `lite` / `medium` / `high` / `null`. **Legacy slot — prefer `rows[].tier` (top-level)**. When `tier` is omitted, this value is lifted into the row's `tier_override` column at insert time. |
56
+ | `rows[].tier` | No | `lite` / `medium` / `high`. Abstract cost knob — primary path. Wins over `taskContext.tier_override` when both are set. Mutually exclusive with `rows[].model` on the same row. |
57
+ | `rows[].taskContext.sub_flow` | No | Branches the task-flow rendering when the dispatcher needs a specialised sub-flow. |
58
+ | `rows[].taskPrompt` | No | Override for the agent body (min 20 chars when set). |
59
+ | `rows[].correlationId` | No | Defaults to the morning routine's correlation id when omitted. |
60
+ | `rows[].model` | No | Registered model id (`claude-opus-4-8`, `claude-sonnet-4-6`, `gpt-5.4`, `gemini-3.1-pro-preview`, …), legacy alias (`sonnet` / `opus` — auto-rewritten to `tier`), composite `<backendId>/<modelId>`, or `null`. Mutually exclusive with `rows[].tier`. Omit both to let `process_backend_config` decide. |
61
+ | `atomic` | No | `true` (default) wraps inserts in one transaction — any row error rolls back all. `false` commits successful rows individually. |
62
+
63
+ ## Success
64
+
65
+ 201:
66
+
67
+ ```json
68
+ { "ok": true, "rowsAttempted": 1, "rowsCommitted": 1, "ids": [101], "warnings": [] }
69
+ ```
70
+
71
+ `warnings[]` carries non-blocking advisories (per-row issues like
72
+ `schedule.model_deprecated` keep the rowIndex so the agent can map
73
+ warnings back to the offending row). Rows are still committed —
74
+ surface the warnings to the next turn so the LLM can refine without
75
+ re-POSTing.
76
+
77
+ ## Errors
78
+
79
+ Returns the standard agent-consumable envelope — see
80
+ `references/errors.md`. `rowsCommitted` tells you how much of the
81
+ batch landed; with `atomic:true` any error means `rowsCommitted === 0`.
82
+ Per-row `model_unknown` / `model_ambiguous` / `tier_and_model_conflict`
83
+ all reach this envelope with `rowIndex` set — fix the offending rows
84
+ and resubmit the same body.
85
+
86
+ ## When NOT to use batch
87
+
88
+ - One-off DM-handler reminders → use `POST /api/schedule` (single
89
+ row, no required `taskContext.background`).
90
+ - DM-tone scheduled messages → use `POST /api/schedule/dm` (no agent
91
+ invoked at fire time).
92
+ - More than 50 rows in a single horizon → chunk into multiple
93
+ `atomic:true` batches; do not raise the cap.
@@ -0,0 +1,217 @@
1
+ ---
2
+ kind: reference
3
+ name: errors
4
+ description: Agent-consumable error envelope shape + every `schedule.*` code emitted by /api/schedule and /api/schedule/batch.
5
+ ---
6
+
7
+ # Schedule error envelope + codes
8
+
9
+ Every endpoint in this skill emits errors in the
10
+ **agent-consumable envelope** so you can self-correct in the same
11
+ turn instead of retrying blindly:
12
+
13
+ ```jsonc
14
+ {
15
+ "ok": false,
16
+ "summary": "1 validation error. Fix the listed errors and retry.",
17
+ "errors": [
18
+ {
19
+ "rowIndex": 2, // null when not a batch row
20
+ "code": "schedule.task_context_field_missing", // stable machine code
21
+ "field": "rows[2].taskContext.background", // JSON-pointer-ish path
22
+ "received": "<missing>",
23
+ "expected": "string with >= 30 characters explaining why this task is being scheduled",
24
+ "constraint": { "type": "string", "minLength": 30, "required": true },
25
+ "validValues": null, // runtime-derived set, when applicable (see "validValues vs constraint.enum")
26
+ "hint": "Stage A must populate taskContext.background so the future session can produce high-quality output without re-deriving context. Example: ...",
27
+ "skillAnchor": "schedule#taskContext-required-fields",
28
+ "docsUrl": "agent-assets/skills/schedule/references/errors.md#task_context_field_missing",
29
+ "severity": "error"
30
+ }
31
+ ],
32
+ "warnings": [], // non-blocking advisories — see "Warnings channel"
33
+ "retryable": true,
34
+ "retryHint": "Fix the listed rows and POST the same body again. atomic=true (the default) means no rows were committed."
35
+ }
36
+ ```
37
+
38
+ When you see an error: read `errors[].hint`, fix the value at
39
+ `errors[].field`, and resubmit the same body. The morning-routine
40
+ task-flow gates batch retries on `rowsCommitted === rows.length`; do
41
+ not retry a row-level fix on a different field path.
42
+
43
+ ## Issue fields
44
+
45
+ | Field | Use |
46
+ |---|---|
47
+ | `code` | Stable namespaced identifier. Switch on this in skill prose, not on `expected` or `hint`. |
48
+ | `field` | JSON-pointer-ish path to the offending input (`rows[2].taskContext.background`). |
49
+ | `received` | Exact value the daemon saw. `'<missing>'` sentinel when the field was omitted. |
50
+ | `expected` | One-sentence summary of what would have been accepted. |
51
+ | `constraint` | Static, schema-level shape (`{type, minLength, enum: [...]}`). Fixed across deploys. |
52
+ | `validValues` | Runtime-derived list of acceptable values — populated when the answer is data the operator can change (model registry, IANA timezones, an integration's supported modes). Distinct from `constraint.enum`: never both on the same code. |
53
+ | `hint` | Concrete remediation guidance with an example. |
54
+ | `skillAnchor` | `<skill>#<slug>` reference for fuller context — `Read agent-assets/skills/<skill>/SKILL.md#<slug>`. |
55
+ | `docsUrl` | Repo-relative path to deeper "what to do" prose, including a fragment that lands on the code's heading in this file. |
56
+ | `severity` | `error` blocks the commit; `warning` is advisory only (also surfaced via `warnings[]` — see below). |
57
+
58
+ ### validValues vs constraint.enum
59
+
60
+ These two fields look alike but answer different questions:
61
+
62
+ - **`constraint.enum`** — schema-level static list (`["lite","medium","high"]`, `["hourly","daily","weekly","monthly"]`). Same on every deploy.
63
+ - **`validValues`** — runtime-derived list (the model registry snapshot, which evolves as new models are registered; the IANA timezone set; an integration's `supportedModes`). Filled by the route at error-time.
64
+
65
+ Use `validValues` when present — it reflects what the daemon will accept on this run, including any newly added entries. `constraint.enum` is the
66
+ specification-time guarantee. The two never appear together on the same code.
67
+
68
+ ## Warnings channel
69
+
70
+ Some inputs are syntactically valid but suspicious enough to flag —
71
+ deprecated model on a long-lived recurring rule, `daysOfMonth:[31]`
72
+ with the default `lastDayOfMonth` policy, etc. The daemon does **not**
73
+ reject these; the row is persisted and the response returns 200/201
74
+ with a `warnings: []` array using the same issue shape as `errors[]`:
75
+
76
+ ```jsonc
77
+ {
78
+ "status": "created",
79
+ "item": { "id": 42, "recurrenceRule": { ... }, "nextRunAt": "2026-05-31T12:00:00Z" },
80
+ "warnings": [
81
+ {
82
+ "rowIndex": null,
83
+ "code": "schedule.on_missing_day_unused",
84
+ "field": "recurrenceRule.onMissingDay",
85
+ "received": "lastDayOfMonth",
86
+ "expected": "onMissingDay only matters when daysOfMonth contains 29, 30, or 31",
87
+ "hint": "Drop onMissingDay or add 29/30/31 to daysOfMonth.",
88
+ "skillAnchor": "schedule#monthly-missing-day",
89
+ "severity": "warning"
90
+ }
91
+ ]
92
+ }
93
+ ```
94
+
95
+ Surface warnings to the next agent turn (e.g. include them in the
96
+ DM that confirms the schedule was created) so the LLM can refine on
97
+ the next call if the warning matters. **Don't treat warnings as
98
+ failures** — they are advisory, not blocking. `retryable` is computed
99
+ from `errors[]` only and ignores `warnings[]`.
100
+
101
+ When the same envelope contains both `errors` and `warnings`, the
102
+ errors path runs first: fix every entry in `errors[]`, then inspect
103
+ `warnings[]` on the retried response.
104
+
105
+ ## Codes the schedule endpoints can emit
106
+
107
+ ### Request-shape codes
108
+
109
+ Apply to `POST /api/schedule` and `POST /api/schedule/batch`.
110
+
111
+ <a id="request-shape"></a>
112
+
113
+ | Code | When | Fix |
114
+ |---|---|---|
115
+ | <a id="body_not_object"></a> `schedule.body_not_object` | Body is not a JSON object. | POST `{"rows":[…]}` for batch, or the row fields directly for single-row. |
116
+ | <a id="rows_field_missing"></a> `schedule.rows_field_missing` | Batch body is missing the `rows` array. | Wrap your row objects in a `rows` array. |
117
+ | <a id="rows_too_many"></a> `schedule.rows_too_many` | Batch contains > 50 rows. | Split into chunks of at most 50 rows. |
118
+ | <a id="batch_atomic_invalid"></a> `schedule.batch_atomic_invalid` | `atomic` is not a boolean. | Pass `true` / `false`, or omit (defaults to `true`). |
119
+
120
+ ### Time-bound codes
121
+
122
+ <a id="scheduledFor-bounds"></a>
123
+
124
+ | Code | When | Fix |
125
+ |---|---|---|
126
+ | <a id="scheduled_for_invalid"></a> `schedule.scheduled_for_invalid` | `scheduledFor` / `time` is not parseable by `Date()`. | Use ISO 8601 with timezone offset. Resolve relative times via `<current_time>`. |
127
+ | <a id="scheduled_for_in_past"></a> `schedule.scheduled_for_in_past` | `scheduledFor` is earlier than now (with a 1-minute grace). | Pick a future time. Inspect `<current_time>` and pick now+1min minimum. |
128
+
129
+ ### Row-content codes
130
+
131
+ <a id="taskType"></a>
132
+ <a id="description-shape"></a>
133
+
134
+ | Code | When | Fix |
135
+ |---|---|---|
136
+ | <a id="task_type_unknown"></a> `schedule.task_type_unknown` | **Batch only** (`/api/schedule/batch` rows): `taskType` is not one of the closed set `wake` / `dm_session` / `check` / `dm`. On the single `POST /api/schedule`, `taskType` is a free-form provenance label (no allowlist) — this code fires there only when `taskType` is missing or not a string. | Batch: pick one of the four. Single endpoint: send any non-empty string (`wake` is the convention for agent wake-ups). Use `/api/schedule/dm` for the precomposed-DM variant. |
137
+ | <a id="prompt_required"></a> `schedule.prompt_required` | `POST /api/schedule` (or a PATCH that sets it) with `prompt` missing or empty. | `prompt` is the wake-up agent's only instruction — write the full instruction there. `description` is just the optional list label, no longer the agent body. |
138
+ | <a id="prompt_too_long"></a> `schedule.prompt_too_long` | `prompt` / `taskPrompt` > 8000 chars. | Tighten the instruction (goal + key context + expected output); move bulk reference material into a file the agent reads at fire time instead of inlining it. |
139
+ | <a id="description_too_long"></a> `schedule.description_too_long` | `description` > 200 chars. | The description is the short list label — keep it under 200 chars and put the full instruction in `prompt`. |
140
+ | <a id="description_too_short"></a> `schedule.description_too_short` | `taskDescription` (batch) / recurring `description` < 20 chars. | Expand the body so the wake-up agent has enough context to act. (Does not apply to the single `/api/schedule` row, where `description` is an optional label.) |
141
+ | <a id="prompt_too_short"></a> `schedule.prompt_too_short` | Batch `taskPrompt` / recurring `prompt` is set but < 20 chars. | Either remove it (the description body is used) or expand it. (The single `/api/schedule` row requires `prompt`; see `schedule.prompt_required`.) |
142
+
143
+ ### taskContext required fields
144
+
145
+ <a id="taskContext-required-fields"></a>
146
+
147
+ For `POST /api/schedule/batch`, every row's `taskContext` must carry
148
+ `background` (>=30 chars) and `expected_output` (>=20 chars). The
149
+ future session firing at the scheduled time inherits these verbatim
150
+ — its output quality is bounded by the richness of what you write
151
+ here.
152
+
153
+ | Code | When | Fix |
154
+ |---|---|---|
155
+ | <a id="task_context_field_missing"></a> `schedule.task_context_field_missing` | `taskContext.background` or `taskContext.expected_output` is absent. | Populate both. `background` explains *why* this row exists; `expected_output` defines what "done" looks like. |
156
+ | <a id="task_context_field_too_short"></a> `schedule.task_context_field_too_short` | One of the required taskContext fields is below its min length. | Expand the string. Trivial values like "follow up" don't survive a 4-hour gap. |
157
+ | <a id="task_context_field_wrong_type"></a> `schedule.task_context_field_wrong_type` | A typed taskContext slot received the wrong type (e.g. `references` is a string instead of `string[]`). | Match the schema: references is `string[]`, tier_override is `null|"lite"|"medium"|"high"`, tone is a free string. |
158
+
159
+ ### Model selection
160
+
161
+ <a id="model-selection"></a>
162
+ <a id="tier-selection"></a>
163
+ <a id="tier-vs-model"></a>
164
+
165
+ `model` accepts a free-form token after SCHEDULE_API_REDESIGN_PLAN
166
+ §4.3: legacy aliases (`sonnet` / `opus` — rewritten to `tier` at
167
+ the route), full registered model ids (e.g. `claude-opus-4-8`,
168
+ `gpt-5.4`), or the composite `<backendId>/<modelId>` form when an
169
+ id appears under multiple backends. `tier` (`lite` | `medium` |
170
+ `high`) is the abstract cost knob and is mutually exclusive with
171
+ `model`. Prefer `tier` for new schedules — the dispatcher picks the
172
+ latest non-deprecated model per resolved process key automatically.
173
+
174
+ | Code | When | Fix |
175
+ |---|---|---|
176
+ | <a id="model_unknown"></a> `schedule.model_unknown` | `model` is not a registered alias / model id. | Inspect `validValues.aliases` and `validValues.models` on the response — these list every value the daemon will accept right now. Omit `model` to let `process_backend_config` decide. |
177
+ | <a id="model_ambiguous"></a> `schedule.model_ambiguous` | `model` matches more than one backend in the registry. | Resubmit using the composite `<backendId>/<modelId>` form (see `validValues.matches`). |
178
+ | <a id="model_deprecated"></a> `schedule.model_deprecated` (warning) | `model` is registered but flagged deprecated. | The row was still created. Switch to a non-deprecated id from `validValues.availableModels`, or use `tier` instead. |
179
+ | <a id="backend_id_unknown"></a> `schedule.backend_id_unknown` | Backend portion of the composite token is not `claude` / `codex` / `gemini` / `opencode`. | Use one of the four BackendId values. |
180
+ | <a id="tier_unknown"></a> `schedule.tier_unknown` | `tier` is not `lite` / `medium` / `high`. | Pick one of the three tiers or omit entirely. |
181
+ | <a id="tier_and_model_conflict"></a> `schedule.tier_and_model_conflict` | Both `tier` AND `model` set on the same row. | Pick exactly one: `tier` (recommended) OR `model`. On PATCH you can clear one and set the other in the same request (pass `null` to clear). |
182
+
183
+ ### Batch-shape codes
184
+
185
+ <a id="batch-shape"></a>
186
+
187
+ See the table under "Request-shape codes" above. `rowsAttempted` /
188
+ `rowsCommitted` in the envelope tell you how much of the batch
189
+ committed; with `atomic:true` (the default) every error means
190
+ `rowsCommitted === 0`.
191
+
192
+ ### Recurring-schedules (`/api/recurring-schedules`)
193
+
194
+ <a id="recurring-shape"></a>
195
+
196
+ POST and PATCH `/api/recurring-schedules` route every Zod validation
197
+ failure through `translateZodError` so each offending field surfaces
198
+ as its own code instead of collapsing onto one
199
+ `recurring_schedules.validation_error` issue. The codes below mirror
200
+ the per-frequency rules in `recurrence-rule.md`.
201
+
202
+ | Code | When | Fix |
203
+ |---|---|---|
204
+ | <a id="frequency_unknown"></a> `schedule.frequency_unknown` | `recurrenceRule.frequency` not in the enum. | Pick `hourly` / `daily` / `weekly` / `monthly`. |
205
+ | <a id="frequency_field_mismatch"></a> `schedule.frequency_field_mismatch` | Wrong fields for the chosen frequency (e.g. `time` on `hourly`, `daysOfWeek` on `daily`). | See `validValues.requiredFor` / `forbiddenFor` for the exact matrix. |
206
+ | <a id="interval_hours_out_of_range"></a> `schedule.interval_hours_out_of_range` | `intervalHours` outside `[1, 23]`. | Use 1..23; for daily switch frequency. |
207
+ | <a id="minute_of_hour_out_of_range"></a> `schedule.minute_of_hour_out_of_range` | `minuteOfHour` outside `[0, 59]`. | Pick 0..59 (default 0). |
208
+ | <a id="time_format_invalid"></a> `schedule.time_format_invalid` | `time` not `HH:MM` 24h. | Use the exact form `09:00` / `21:30`. |
209
+ | <a id="days_of_week_invalid"></a> `schedule.days_of_week_invalid` | `daysOfWeek` empty, duplicate, or out of `[0, 6]`. | 0=Sun..6=Sat, distinct entries only. |
210
+ | <a id="days_of_month_invalid"></a> `schedule.days_of_month_invalid` | `daysOfMonth` empty, duplicate, or out of `[1, 31]`. | 1..31, distinct entries only — use `onMissingDay` to control 29-31 behavior. |
211
+ | <a id="on_missing_day_unknown"></a> `schedule.on_missing_day_unknown` | `onMissingDay` not `skip` / `lastDayOfMonth`. | Pick one (default `lastDayOfMonth`). |
212
+ | <a id="on_missing_day_unused"></a> `schedule.on_missing_day_unused` (warning) | `onMissingDay` set but `daysOfMonth` has no entry in `[29, 30, 31]`. | Advisory — row is created. Either drop `onMissingDay` (no effect on a 1..28 set) or extend `daysOfMonth` to include 29/30/31 if you meant a month-end rule. |
213
+ | <a id="timezone_unknown"></a> `schedule.timezone_unknown` | `timezone` is not a valid IANA zone. | Use a real zone (`Asia/Tokyo`, `America/New_York`, `UTC`). |
214
+ | <a id="recurrence_rule_invalid"></a> `schedule.recurrence_rule_invalid` | `recurrenceRule` is structurally invalid in a way the traversal could not localise. | Inspect the response `field` path and resubmit a well-formed object. |
215
+ | <a id="recurring_id_invalid"></a> `schedule.recurring_id_invalid` | id segment not a positive integer. | Use the `item.id` returned by POST. |
216
+ | <a id="recurring_not_found"></a> `schedule.recurring_not_found` | No row with this id. | List `/api/recurring-schedules` to see current rows. |
217
+ | <a id="recurring_no_changes"></a> `schedule.recurring_no_changes` | PATCH body is empty. | Supply at least one of `description` / `prompt` / `recurrenceRule` / `model` / `tier` / `taskContext` / `enabled`. |