@aitne-sh/aitne 0.1.8 → 0.1.10

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 (308) hide show
  1. package/README.md +251 -164
  2. package/agent-assets/agent-profiles/_safety.md +3 -3
  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 +2 -2
  6. package/agent-assets/agent-profiles/routine-fetch-window.md +30 -19
  7. package/agent-assets/agents/context-index-reconcile/agent.md +52 -0
  8. package/agent-assets/agents/evening-review/agent.md +53 -0
  9. package/agent-assets/agents/hourly-check/agent.md +62 -0
  10. package/agent-assets/agents/monthly-review/agent.md +55 -0
  11. package/agent-assets/agents/morning-routine/agent.md +78 -0
  12. package/agent-assets/agents/roadmap-maintenance/agent.md +52 -0
  13. package/agent-assets/agents/skill-curation/agent.md +52 -0
  14. package/agent-assets/agents/user-profile-sweep-evening/agent.md +48 -0
  15. package/agent-assets/agents/user-profile-sweep-morning/agent.md +53 -0
  16. package/agent-assets/agents/weekly-review/agent.md +51 -0
  17. package/agent-assets/docs/concepts/agent-day.md +13 -11
  18. package/agent-assets/docs/concepts/auth-health.md +47 -10
  19. package/agent-assets/docs/concepts/backends-and-tiers.md +66 -31
  20. package/agent-assets/docs/concepts/costs-and-quotas.md +51 -15
  21. package/agent-assets/docs/concepts/delegated-mode.md +56 -17
  22. package/agent-assets/docs/concepts/memory-model.md +77 -34
  23. package/agent-assets/docs/concepts/observations.md +49 -11
  24. package/agent-assets/docs/concepts/process-keys.md +56 -22
  25. package/agent-assets/docs/concepts/routines.md +60 -33
  26. package/agent-assets/docs/concepts/safety-and-execution.md +50 -21
  27. package/agent-assets/docs/concepts/safety-model.md +61 -50
  28. package/agent-assets/docs/concepts/skills.md +34 -18
  29. package/agent-assets/docs/features/integrations/browser-history.md +196 -0
  30. package/agent-assets/docs/features/integrations/calendar.md +39 -29
  31. package/agent-assets/docs/features/integrations/git.md +18 -7
  32. package/agent-assets/docs/features/integrations/github.md +84 -33
  33. package/agent-assets/docs/features/integrations/mail.md +61 -17
  34. package/agent-assets/docs/features/integrations/notion.md +18 -6
  35. package/agent-assets/docs/features/integrations/obsidian.md +28 -5
  36. package/agent-assets/docs/features/lifestyle/git.md +44 -40
  37. package/agent-assets/docs/features/lifestyle/reading.md +57 -22
  38. package/agent-assets/docs/features/lifestyle/receipts.md +51 -21
  39. package/agent-assets/docs/features/lifestyle/travel-bookings.md +77 -14
  40. package/agent-assets/docs/features/memory-files/agent-journal.md +132 -53
  41. package/agent-assets/docs/features/memory-files/agent-lessons.md +177 -0
  42. package/agent-assets/docs/features/memory-files/projects.md +73 -17
  43. package/agent-assets/docs/features/memory-files/roadmap.md +54 -11
  44. package/agent-assets/docs/features/memory-files/schedule.md +113 -70
  45. package/agent-assets/docs/features/memory-files/today.md +46 -21
  46. package/agent-assets/docs/features/memory-files/user-profile.md +63 -33
  47. package/agent-assets/docs/features/messaging/bang-commands.md +113 -36
  48. package/agent-assets/docs/features/messaging/dashboard-chat.md +43 -21
  49. package/agent-assets/docs/features/messaging/discord.md +35 -4
  50. package/agent-assets/docs/features/messaging/overview.md +37 -19
  51. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +94 -27
  52. package/agent-assets/docs/features/messaging/slack.md +67 -14
  53. package/agent-assets/docs/features/messaging/telegram.md +22 -8
  54. package/agent-assets/docs/features/messaging/whatsapp.md +71 -17
  55. package/agent-assets/docs/features/operations/activity-and-conversations.md +45 -15
  56. package/agent-assets/docs/features/operations/approvals.md +49 -16
  57. package/agent-assets/docs/features/operations/backend-routing.md +68 -16
  58. package/agent-assets/docs/features/operations/cost-tracking.md +84 -17
  59. package/agent-assets/docs/features/operations/managed-chromium.md +222 -0
  60. package/agent-assets/docs/features/operations/notifications.md +52 -11
  61. package/agent-assets/docs/features/operations/quiet-hours.md +64 -40
  62. package/agent-assets/docs/features/operations/schedule-approaching.md +54 -24
  63. package/agent-assets/docs/features/routines/custom-routines.md +98 -26
  64. package/agent-assets/docs/features/routines/evening-review.md +82 -21
  65. package/agent-assets/docs/features/routines/hourly-check.md +149 -29
  66. package/agent-assets/docs/features/routines/morning-routine.md +54 -35
  67. package/agent-assets/docs/features/routines/weekly-review.md +46 -21
  68. package/agent-assets/docs/features/wiki/commands.md +26 -16
  69. package/agent-assets/docs/features/wiki/cost-and-approval.md +241 -0
  70. package/agent-assets/docs/features/wiki/dashboard.md +256 -0
  71. package/agent-assets/docs/features/wiki/overview.md +70 -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 +34 -23
  75. package/agent-assets/docs/getting-started/02-first-steps.md +17 -10
  76. package/agent-assets/docs/getting-started/03-what-can-this-do.md +25 -14
  77. package/agent-assets/docs/getting-started/04-first-day.md +39 -21
  78. package/agent-assets/docs/glossary.md +235 -24
  79. package/agent-assets/docs/guides/add-a-custom-routine.md +63 -23
  80. package/agent-assets/docs/guides/backup-and-restore.md +80 -16
  81. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +57 -26
  82. package/agent-assets/docs/guides/build-your-wiki.md +22 -9
  83. package/agent-assets/docs/guides/change-which-model-handles-x.md +64 -10
  84. package/agent-assets/docs/guides/connect-a-new-mail-account.md +66 -15
  85. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +32 -14
  86. package/agent-assets/docs/guides/import-knowledge-file.md +50 -40
  87. package/agent-assets/docs/guides/install-and-run.md +49 -20
  88. package/agent-assets/docs/guides/maintain-wiki-health.md +35 -10
  89. package/agent-assets/docs/guides/migrate-machines.md +74 -18
  90. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +111 -60
  91. package/agent-assets/docs/guides/pause-the-agent.md +69 -24
  92. package/agent-assets/docs/guides/reinstall-cleanly.md +88 -18
  93. package/agent-assets/docs/guides/setup-wizard.md +116 -54
  94. package/agent-assets/docs/guides/switch-default-backend.md +62 -16
  95. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +30 -14
  96. package/agent-assets/docs/reference/api.md +153 -32
  97. package/agent-assets/docs/reference/cli-commands.md +39 -18
  98. package/agent-assets/docs/reference/config.md +241 -49
  99. package/agent-assets/docs/reference/disallowed-tools.md +34 -13
  100. package/agent-assets/docs/reference/keyboard-shortcuts.md +34 -10
  101. package/agent-assets/docs/reference/knowledge-layout.md +629 -0
  102. package/agent-assets/docs/reference/process-keys.md +62 -6
  103. package/agent-assets/docs/reference/skills.md +41 -14
  104. package/agent-assets/docs/troubleshooting/auth-failed.md +51 -21
  105. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +97 -28
  106. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +86 -22
  107. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +68 -24
  108. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +80 -20
  109. package/agent-assets/docs/troubleshooting/observation-not-detected.md +73 -21
  110. package/agent-assets/docs/troubleshooting/quota-exhausted.md +33 -8
  111. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +126 -54
  112. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +29 -12
  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 +1 -1
  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 +25 -41
  119. package/agent-assets/skills/agent-create/SKILL.md +158 -0
  120. package/agent-assets/skills/attach/SKILL.md +10 -29
  121. package/agent-assets/skills/browser-history/SKILL.md +211 -0
  122. package/agent-assets/skills/browser-history-respond/SKILL.md +111 -0
  123. package/agent-assets/skills/browser-task/SKILL.md +164 -0
  124. package/agent-assets/skills/context/SKILL.md +35 -44
  125. package/agent-assets/skills/context/curation.json +14 -14
  126. package/agent-assets/skills/context/references/api.md +52 -40
  127. package/agent-assets/skills/context/references/required-frontmatter.md +13 -12
  128. package/agent-assets/skills/context/references/snapshot-files.md +18 -17
  129. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +8 -8
  130. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
  131. package/agent-assets/skills/docs-search/SKILL.md +23 -34
  132. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +17 -114
  133. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +17 -113
  134. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +17 -113
  135. package/agent-assets/skills/external-services/SKILL.md +3 -3
  136. package/agent-assets/skills/external-services/SKILL.native.claude.md +7 -7
  137. package/agent-assets/skills/external-services/SKILL.native.codex.md +7 -7
  138. package/agent-assets/skills/external-services/SKILL.native.gemini.md +4 -4
  139. package/agent-assets/skills/external-services/references/calendar-apple.md +2 -2
  140. package/agent-assets/skills/external-services/references/calendar-outlook.md +1 -1
  141. package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
  142. package/agent-assets/skills/external-services/references/obsidian.md +2 -2
  143. package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
  144. package/agent-assets/skills/gmail-lifestyle/SKILL.md +11 -83
  145. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
  146. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
  147. package/agent-assets/skills/mail/SKILL.delegated.claude.md +15 -18
  148. package/agent-assets/skills/mail/SKILL.delegated.codex.md +11 -6
  149. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +11 -6
  150. package/agent-assets/skills/mail/SKILL.md +10 -18
  151. package/agent-assets/skills/mail/SKILL.native.claude.md +8 -7
  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 +10 -3
  155. package/agent-assets/skills/mail/references/examples.md +2 -1
  156. package/agent-assets/skills/mail/references/providers.md +1 -1
  157. package/agent-assets/skills/managed-tasks/SKILL.md +48 -81
  158. package/agent-assets/skills/managed-tasks/references/errors.md +33 -19
  159. package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
  160. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +7 -5
  161. package/agent-assets/skills/management-policy/SKILL.md +42 -42
  162. package/agent-assets/skills/management-policy/curation.json +1 -1
  163. package/agent-assets/skills/management-policy/references/policy-workflow.md +11 -12
  164. package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +1 -1
  165. package/agent-assets/skills/notify/SKILL.md +14 -16
  166. package/agent-assets/skills/notify/references/priority.md +28 -20
  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 +17 -17
  171. package/agent-assets/skills/notion/SKILL.native.claude.md +11 -7
  172. package/agent-assets/skills/notion/SKILL.native.codex.md +10 -5
  173. package/agent-assets/skills/notion/SKILL.native.gemini.md +10 -5
  174. package/agent-assets/skills/observations/SKILL.md +29 -28
  175. package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
  176. package/agent-assets/skills/project-doc/SKILL.md +10 -7
  177. package/agent-assets/skills/project-doc/curation.json +3 -3
  178. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +8 -5
  179. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +5 -5
  180. package/agent-assets/skills/reading/SKILL.md +18 -42
  181. package/agent-assets/skills/reading/references/reading-taste.md +7 -7
  182. package/agent-assets/skills/roadmap/SKILL.md +8 -24
  183. package/agent-assets/skills/roadmap/curation.json +1 -1
  184. package/agent-assets/skills/roadmap/references/api.md +21 -11
  185. package/agent-assets/skills/roadmap/references/cross-check.md +15 -8
  186. package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
  187. package/agent-assets/skills/roadmap/references/migration.md +12 -10
  188. package/agent-assets/skills/roadmap/references/retention.md +18 -0
  189. package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +1 -1
  190. package/agent-assets/skills/schedule/SKILL.md +41 -50
  191. package/agent-assets/skills/schedule/references/batch.md +2 -2
  192. package/agent-assets/skills/schedule/references/errors.md +7 -4
  193. package/agent-assets/skills/schedule/references/importance.md +23 -0
  194. package/agent-assets/skills/schedule/references/model-selection.md +3 -3
  195. package/agent-assets/skills/schedule/references/recurrence-rule.md +7 -5
  196. package/agent-assets/skills/scheduled-managed-task/SKILL.md +77 -70
  197. package/agent-assets/skills/today/SKILL.md +24 -83
  198. package/agent-assets/skills/today/curation.json +3 -3
  199. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +6 -5
  200. package/agent-assets/skills/today/references/today-skeleton.md +66 -0
  201. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
  202. package/agent-assets/skills/today/seeds/section-shape.seed.json +7 -7
  203. package/agent-assets/skills/user-interview/SKILL.md +21 -93
  204. package/agent-assets/skills/user-interview/references/op-briefing.md +3 -3
  205. package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
  206. package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
  207. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +9 -1
  208. package/agent-assets/skills/user-profile/SKILL.md +29 -39
  209. package/agent-assets/skills/user-profile/curation.json +4 -4
  210. package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
  211. package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +8 -8
  212. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +6 -6
  213. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
  214. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +9 -8
  215. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
  216. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
  217. package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
  218. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
  219. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
  220. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
  221. package/agent-assets/system-prompts/routine-fetch-window.md +22 -12
  222. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +4 -2
  223. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +4 -2
  224. package/agent-assets/task-flows/_partials/capture-user-info.md +2 -2
  225. package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +1 -1
  226. package/agent-assets/task-flows/_partials/dm-intent.project.md +9 -9
  227. package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
  228. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +3 -2
  229. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +10 -5
  230. package/agent-assets/task-flows/browser_task.md +84 -0
  231. package/agent-assets/task-flows/github.assigned.md +1 -1
  232. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  233. package/agent-assets/task-flows/github.workflow_run.failed.md +2 -2
  234. package/agent-assets/task-flows/knowledge.import.md +14 -14
  235. package/agent-assets/task-flows/message.received.dm.md +13 -4
  236. package/agent-assets/task-flows/message.received.dm_first.md +7 -3
  237. package/agent-assets/task-flows/routine.custom.md +3 -3
  238. package/agent-assets/task-flows/routine.evening_review.md +88 -8
  239. package/agent-assets/task-flows/routine.fetch_window.md +2 -2
  240. package/agent-assets/task-flows/routine.hourly_check.md +16 -12
  241. package/agent-assets/task-flows/routine.monthly_review.md +93 -21
  242. package/agent-assets/task-flows/routine.morning_routine_journal.md +119 -97
  243. package/agent-assets/task-flows/routine.morning_routine_today.md +43 -43
  244. package/agent-assets/task-flows/routine.research_cluster_update.md +35 -0
  245. package/agent-assets/task-flows/routine.research_dispatch.md +38 -0
  246. package/agent-assets/task-flows/routine.research_offer_dm.md +125 -0
  247. package/agent-assets/task-flows/routine.research_wiki_summary.md +53 -0
  248. package/agent-assets/task-flows/routine.roadmap_refresh.md +10 -10
  249. package/agent-assets/task-flows/routine.today_refresh.md +4 -4
  250. package/agent-assets/task-flows/routine.user_profile_sweep.md +10 -10
  251. package/agent-assets/task-flows/routine.weekly_review.md +114 -24
  252. package/agent-assets/task-flows/schedule.approaching.md +0 -1
  253. package/agent-assets/task-flows/scheduled.dm.md +5 -5
  254. package/agent-assets/task-flows/scheduled.task.md +4 -4
  255. package/agent-assets/task-flows/setup.initial.md +21 -21
  256. package/agent-assets/task-flows/setup.update.md +2 -2
  257. package/agent-assets/task-flows/wiki.trace.md +1 -1
  258. package/agent-assets/templates/README.md +27 -20
  259. package/agent-assets/templates/_index.md +42 -26
  260. package/agent-assets/templates/_manifest.json +34 -99
  261. package/agent-assets/templates/{user → identity}/_index.md +1 -1
  262. package/agent-assets/templates/{user → identity}/profile.md +2 -2
  263. package/agent-assets/templates/{dossiers → knowledge/dossiers}/_index.md +1 -1
  264. package/agent-assets/templates/{projects → plans/projects}/_active.base +1 -1
  265. package/agent-assets/templates/policies/_index.md +21 -0
  266. package/agent-assets/templates/{rules → policies}/journal-export.md +1 -1
  267. package/agent-assets/templates/{rules → policies}/journal-format.md +5 -5
  268. package/agent-assets/templates/{rules/policies → policies/management-captures}/_index.md +2 -2
  269. package/agent-assets/templates/{rules → policies}/management.md +3 -3
  270. package/agent-assets/templates/{rules → policies}/mcp.md +1 -1
  271. package/agent-assets/templates/{rules → policies}/redaction.md +1 -1
  272. package/agent-assets/templates/{routines → policies/routines}/_index.md +1 -1
  273. package/agent-assets/templates/{routines → policies/routines}/evening.md +2 -2
  274. package/agent-assets/templates/{routines → policies/routines}/hourly.md +1 -1
  275. package/agent-assets/templates/{routines → policies/routines}/monthly.md +2 -2
  276. package/bin/aitne.mjs +58 -15
  277. package/package.json +5 -4
  278. package/scripts/commands/doctor.mjs +25 -10
  279. package/scripts/commands/run-now.mjs +6 -21
  280. package/scripts/lib/ports.d.mts +27 -0
  281. package/scripts/lib/ports.mjs +36 -0
  282. package/scripts/lib/process-identity.d.mts +46 -0
  283. package/scripts/lib/process-identity.mjs +193 -0
  284. package/scripts/lib/read-api-token.mjs +176 -0
  285. package/scripts/start.mjs +16 -5
  286. package/agent-assets/docs/features/lifestyle/travel-time.md +0 -58
  287. package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +0 -59
  288. package/agent-assets/skills/schedule/references/recurring.md +0 -185
  289. package/agent-assets/templates/context-index.md +0 -42
  290. package/agent-assets/templates/rules/_index.md +0 -19
  291. /package/agent-assets/templates/{user → identity}/expertise.md +0 -0
  292. /package/agent-assets/templates/{user → identity}/goals.md +0 -0
  293. /package/agent-assets/templates/{user → identity}/people.md +0 -0
  294. /package/agent-assets/templates/{user → identity}/personal.md +0 -0
  295. /package/agent-assets/templates/{user → identity}/work.md +0 -0
  296. /package/agent-assets/templates/{agent/journal.md → journal/agent.md} +0 -0
  297. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/evening.md +0 -0
  298. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/hourly.md +0 -0
  299. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/monthly.md +0 -0
  300. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/morning.md +0 -0
  301. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/roadmap.md +0 -0
  302. /package/agent-assets/templates/{dossiers → knowledge/dossiers}/weekly.md +0 -0
  303. /package/agent-assets/templates/{projects → plans/projects}/_index.md +0 -0
  304. /package/agent-assets/templates/{roadmap.md → plans/roadmap.md} +0 -0
  305. /package/agent-assets/templates/{routines → policies/routines}/morning.md +0 -0
  306. /package/agent-assets/templates/{routines → policies/routines}/weekly.md +0 -0
  307. /package/agent-assets/templates/{agent → state}/profile-questions.md +0 -0
  308. /package/agent-assets/templates/{today.md → state/today.md} +0 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: schedule
3
- description: Load when scheduling a future agent wake-up, pre-composed DM, recurring task, or de-duping against existing pending schedules.
3
+ description: Schedule future agent wake-ups, pre-composed DMs, or recurring tasks via /api/schedule. Use when registering a timed follow-up, a one-off reminder, or de-duping against pending schedules.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -31,9 +31,9 @@ user but compound into duplicate DMs/notifications at fire time.
31
31
  PATCH the existing item if it needs updating — never register a
32
32
  parallel second one).
33
33
  3. **Recurring check.** `GET /api/recurring-schedules?enabled=true` to
34
- confirm no recurring rule already covers this cadence (e.g. a daily
35
- 09:00 inbox triage). If covered, skip — the recurring instance will
36
- 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
+ (How recurring work/DMs are created — see "Recurring" below.)
37
37
  4. **`confirm_dedup_key` check (mandatory for `confirm:` sub-flow rows
38
38
  only).** When scheduling a `dm_session` row with
39
39
  `taskContext.sub_flow="confirm"`, run the dedup pre-check + shape
@@ -54,11 +54,10 @@ If the request expresses an **ongoing management practice** with a
54
54
  recorded reason — "every morning, run my finance app and log the
55
55
  balance to a finance dossier", "from now on whenever X happens, do
56
56
  Y" — switch to the `management-policy` skill instead. It creates a
57
- `rules/policies/<slug>.md` that captures the WHY alongside the cadence
58
- (via `routines/custom/<slug>.md`) so the rule survives a context
59
- reset. Plain recurring schedules via `/api/recurring-schedules` are
60
- still right when the cadence is all that matters and there is no need
61
- to record intent.
57
+ `policies/management-captures/<slug>.md` that captures the WHY alongside the cadence
58
+ (via `policies/routines/custom/<slug>.md`) so the rule survives a context
59
+ reset. When the cadence is all that matters and there is no intent to
60
+ record, create the recurring work/DM per the "Recurring" section below.
62
61
 
63
62
  ## DM vs Agent Task
64
63
 
@@ -71,11 +70,11 @@ to record intent.
71
70
 
72
71
  **Default to DM** when possible. Every agent wake-up costs money and context.
73
72
 
74
- ## Writing a Good Description (for agent tasks)
73
+ ## Writing a Good Prompt (for agent tasks)
75
74
 
76
- > **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.
75
+ > **The wake-up agent has NO memory of why it was scheduled.** A `scheduled.task` session is self-contained: it receives only `state/today.md` (which carries the day's schedule and state) plus the `prompt` + `taskContext` you provide — **NOT** `identity/profile.md` or `policies/management.md` (the `scheduled.task` injection policy opts those out). Nothing else. (`description` is just an optional list label — never the agent body.)
77
76
 
78
- Include all four elements:
77
+ Include all four elements in the `prompt`:
79
78
 
80
79
  | Element | What it answers |
81
80
  |---|---|
@@ -89,26 +88,14 @@ Include all four elements:
89
88
  **Bad:** `"Meeting prep"` — which meeting? when? what to prepare?
90
89
 
91
90
  ## Using `taskContext`
92
- Structured metadata for IDs, URLs, and correlation. Put long identifiers here so `description` stays under ~2 sentences:
91
+ Structured metadata for IDs, URLs, and correlation. Put long identifiers here so the `prompt` stays focused:
93
92
  ```json
94
93
  { "scheduledBy": "morning_routine", "prUrl": "https://github.com/user/repo/pull/42" }
95
94
  ```
96
95
 
97
- **`importance` convention.** This controls whether `agent_schedule`
98
- rows become `roadmap.md` `Scheduled:` entries:
96
+ **`importance`** controls whether a row becomes a `plans/roadmap.md` `Scheduled:` entry. Default `transient` for `/api/schedule/dm`, `normal` for `/api/schedule`; use `strategic` only for roadmap-shaped long-prep reminders. Tier table + defaults in the reference below.
99
97
 
100
- | Tier | Roadmap behavior | Use |
101
- |---|---|---|
102
- | `transient` | Never in roadmap; surfaces in today.md only on the day it fires | Default for `/api/schedule/dm`; short pings like "call mom next Tuesday" |
103
- | `normal` | In roadmap only when scheduled more than 7 days out | Default for `/api/schedule`; ordinary user-facing follow-ups |
104
- | `strategic` | In roadmap regardless of horizon | Long-prep commitments such as ESTA / travel / deadline reminders |
105
- | `low` | Never in roadmap | Internal ticks already visible elsewhere, e.g. Agent Plan rows, recurring-schedule instances, morning retries |
106
-
107
- For direct DMs, omit `importance` for ordinary one-off pings. If the
108
- reminder is clearly tied to a long-prep commitment ("remind me in a
109
- month about ESTA for the LA trip"), either write/promote the roadmap
110
- item via the roadmap skill and let AAP schedule the reminder, or call
111
- `/api/schedule/dm` with `"importance":"strategic"`.
98
+ {{> ref:importance }}
112
99
 
113
100
  ## Tier / Model selection
114
101
 
@@ -149,16 +136,16 @@ Response: `{ "status":"scheduled", "scheduleId":"123", "scheduledFor":"..." }`.
149
136
  ```bash
150
137
  curl -s -X POST http://localhost:8321/api/schedule \
151
138
  -H 'Content-Type: application/json' \
152
- -d '{"time":"2026-04-06T16:00:00-04:00","taskType":"wake","description":"Hourly docker health check: run `docker ps --format` and DM if any container is in restart loop.","tier":"lite","taskContext":{"scheduledBy":"docker_monitor"}}'
139
+ -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"}}'
153
140
  ```
154
141
  | Field | Required | Description |
155
142
  |---|---|---|
156
143
  | `time` | Yes | ISO 8601 with timezone offset |
157
- | `taskType` | Yes | `wake` for scheduled tasks |
158
- | `description` | Yes | Self-contained (min 20 chars). See format above. Doubles as the agent body unless `prompt` overrides it. |
159
- | `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. |
144
+ | `taskType` | Yes | Free-form provenance label; use `wake` for agent wake-ups. The closed set `wake`/`dm_session`/`check`/`dm` is enforced only on `/api/schedule/batch`. The label doesn't change firing — every non-`dm`/`dm_session`/`browser_task` row runs as a generic `scheduled.task`. |
145
+ | `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. |
146
+ | `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. |
160
147
  | `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`. |
161
- | `model` | No | Registered model id (`claude-opus-4-7`, `gpt-5.4`, …), legacy alias (`sonnet` / `opus`, auto-rewritten to `tier`), or composite `<backendId>/<modelId>`. See "Tier / Model selection" above. Mutually exclusive with `tier`. |
148
+ | `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`. |
162
149
  | `taskContext` | No | Structured metadata object |
163
150
 
164
151
  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`.
@@ -169,17 +156,17 @@ curl -s -X PATCH http://localhost:8321/api/schedule/42 \
169
156
  -H 'Content-Type: application/json' \
170
157
  -d '{"time":"2026-04-06T17:00:00-04:00"}'
171
158
  ```
172
- 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), `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.
159
+ 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.
173
160
 
174
161
  ### GET /api/schedule — List scheduled items
175
162
  ```bash
176
163
  curl -s "http://localhost:8321/api/schedule?status=pending"
177
164
  ```
178
- Param `status` (default `pending,running`): comma-separated `pending`, `running`, `completed`, `failed`.
165
+ Param `status` (default `pending,running`): comma-separated `pending`, `running`, `completed`, `failed`, `skipped`. DELETE/cancel does not remove a row — it moves it to `status='skipped'`, so re-listing a cancelled item requires `status=skipped`.
179
166
  Param `roadmapEligible=true`: return only rows that may become
180
167
  roadmap `Scheduled:` entries (`transient` / `low` excluded, `normal`
181
168
  only beyond 7 days, `strategic` included).
182
- 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")'`.
169
+ 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 (always an object — `{}` when unset); filter with `jq` e.g. `'.items[] | select(.taskContext.confirm_dedup_key == "create_project:la-pm-masters")'`.
183
170
 
184
171
  ### DELETE /api/schedule/:id — Cancel a pending item
185
172
  ```bash
@@ -210,24 +197,28 @@ model, batch) are in the errors reference below.
210
197
 
211
198
  ---
212
199
 
213
- ## Recurring Schedules
200
+ ## Recurring: work → Agent; DM → dm_session
201
+
202
+ `/schedule` registers **one-shot** wake-ups and DMs. For repeating tasks:
214
203
 
215
- For tasks that repeat on a fixed pattern. The daemon auto-regenerates
216
- the next one-shot occurrence after each execution. **Hourly / daily /
217
- weekly / monthly** cadences are supported; the recurring reference
218
- below documents the full shape, the hourly + monthly missing-day
219
- recipes, pause-vs-delete trade-off, and PATCH / GET / DELETE surface.
204
+ - **Recurring autonomous work** (daily inbox triage, weekly review, hourly
205
+ health check) is a **recurring Agent** a durable, named identity with
206
+ metrics on `/agents`. Create it with the **`agent-create` skill**
207
+ (`POST /api/agents`). Creating a recurring `agent.task` row directly on
208
+ `POST /api/recurring-schedules` is **410 Gone** use an Agent.
209
+ - **Recurring scheduled DM / briefing** ("DM me a summary every morning")
210
+ stays on `POST /api/recurring-schedules` with `taskType: "dm_session"`
211
+ (its fire time can track quiet-hours; PATCH/DELETE edit it). The morning
212
+ briefing is one of these.
220
213
 
221
- {{> ref:recurring }}
214
+ `GET /api/recurring-schedules` stays read-only for the dedup pre-check.
222
215
 
223
- ### recurrenceRule grammar — engine vs consumer
216
+ ### recurrenceRule grammar — the shared recurrence engine
224
217
 
225
- The full engine grammar (mapping table, frequency-vs-field matrix,
226
- cadence-string-must-match-recurrenceRule discipline) is shared with
227
- the `managed-tasks` skill. The reference is byte-identical across
228
- both skills — pinned by `skills-manifest.test.ts` so they cannot
229
- drift. Schedule callers may use any of the four frequencies the
230
- engine accepts; the `managed-tasks` consumer chooses to refuse
231
- sub-daily for app-fetch correctness and that constraint lives there.
218
+ The recurrence engine grammar (mapping table, frequency-vs-field matrix,
219
+ cadence-string discipline) is shared with the `managed-tasks` skill and
220
+ the `dm_session` recurring rule above. The reference is byte-identical
221
+ across both skills —
222
+ pinned by `skills-manifest.test.ts` so they cannot drift.
232
223
 
233
224
  {{> ref:recurrence-rule }}
@@ -31,7 +31,7 @@ curl -s -X POST http://localhost:8321/api/schedule/batch \
31
31
  "taskContext": {
32
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
33
  "expected_output": "DM with two bullet items + one suggested mitigation each, sent 30min before standup.",
34
- "references": ["projects/q2-roadmap.md#open-risks", "calendar:event:standup-2026-05-15"],
34
+ "references": ["plans/projects/q2-roadmap.md#open-risks", "calendar:event:standup-2026-05-15"],
35
35
  "tone": "concise"
36
36
  }
37
37
  }
@@ -57,7 +57,7 @@ curl -s -X POST http://localhost:8321/api/schedule/batch \
57
57
  | `rows[].taskContext.sub_flow` | No | Branches the task-flow rendering when the dispatcher needs a specialised sub-flow. |
58
58
  | `rows[].taskPrompt` | No | Override for the agent body (min 20 chars when set). |
59
59
  | `rows[].correlationId` | No | Defaults to the morning routine's correlation id when omitted. |
60
- | `rows[].model` | No | Registered model id (`claude-opus-4-7`, `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. |
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
61
  | `atomic` | No | `true` (default) wraps inserts in one transaction — any row error rolls back all. `false` commits successful rows individually. |
62
62
 
63
63
  ## Success
@@ -133,9 +133,12 @@ Apply to `POST /api/schedule` and `POST /api/schedule/batch`.
133
133
 
134
134
  | Code | When | Fix |
135
135
  |---|---|---|
136
- | <a id="task_type_unknown"></a> `schedule.task_type_unknown` | `taskType` is not `wake` / `dm_session` / `check` / `dm`. | Pick the matching type. Use `/api/schedule/dm` for the precomposed-DM variant. |
137
- | <a id="description_too_short"></a> `schedule.description_too_short` | `description` / `taskDescription` < 20 chars. | Expand the description so the wake-up agent has enough context to act. |
138
- | <a id="prompt_too_short"></a> `schedule.prompt_too_short` | `prompt` / `taskPrompt` is set but < 20 chars. | Either remove it (description doubles as the body) or expand it. |
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`.) |
139
142
 
140
143
  ### taskContext required fields
141
144
 
@@ -161,7 +164,7 @@ here.
161
164
 
162
165
  `model` accepts a free-form token after SCHEDULE_API_REDESIGN_PLAN
163
166
  §4.3: legacy aliases (`sonnet` / `opus` — rewritten to `tier` at
164
- the route), full registered model ids (e.g. `claude-opus-4-7`,
167
+ the route), full registered model ids (e.g. `claude-opus-4-8`,
165
168
  `gpt-5.4`), or the composite `<backendId>/<modelId>` form when an
166
169
  id appears under multiple backends. `tier` (`lite` | `medium` |
167
170
  `high`) is the abstract cost knob and is mutually exclusive with
@@ -0,0 +1,23 @@
1
+ ---
2
+ kind: reference
3
+ name: importance
4
+ description: The `importance` tier convention for `agent_schedule` rows — which tiers surface in `plans/roadmap.md` `Scheduled:` entries, defaults per endpoint, and when to use `strategic`.
5
+ ---
6
+
7
+ # `importance` convention
8
+
9
+ This controls whether `agent_schedule` rows become `plans/roadmap.md`
10
+ `Scheduled:` entries:
11
+
12
+ | Tier | Roadmap behavior | Use |
13
+ |---|---|---|
14
+ | `transient` | Never in roadmap; surfaces in today.md only on the day it fires | Default for `/api/schedule/dm`; short pings like "call mom next Tuesday" |
15
+ | `normal` | In roadmap only when scheduled more than 7 days out | Default for `/api/schedule`; ordinary user-facing follow-ups |
16
+ | `strategic` | In roadmap regardless of horizon | Long-prep commitments such as ESTA / travel / deadline reminders |
17
+ | `low` | Never in roadmap | Internal ticks already visible elsewhere, e.g. Agent Plan rows, recurring-schedule instances, morning retries |
18
+
19
+ For direct DMs, omit `importance` for ordinary one-off pings. If the
20
+ reminder is clearly tied to a long-prep commitment ("remind me in a
21
+ month about ESTA for the LA trip"), either write/promote the roadmap
22
+ item via the roadmap skill and let AAP schedule the reminder, or call
23
+ `/api/schedule/dm` with `"importance":"strategic"`.
@@ -25,7 +25,7 @@ even after `/settings/models` re-routes the process key). The two are
25
25
  route to `tier:"medium"` / `tier:"high"`; the alias is not stored
26
26
  verbatim.
27
27
  - **Registered model ids** — any id from `MODEL_REGISTRY` across the
28
- four backends. Examples: `claude-opus-4-7`, `claude-sonnet-4-6`,
28
+ four backends. Examples: `claude-opus-4-8`, `claude-sonnet-4-6`,
29
29
  `claude-haiku-4-5-20251001`, `gpt-5.4`, `gemini-3.1-pro-preview`.
30
30
  The row persists `(model, backend_id)` together so the dispatcher
31
31
  honors the pin at fire time.
@@ -33,7 +33,7 @@ even after `/settings/models` re-routes the process key). The two are
33
33
  registry that has the same model id under multiple backends (today
34
34
  unreachable but accepted). The prefix MUST be one of `claude` /
35
35
  `codex` / `gemini` / `opencode`; opencode model ids like
36
- `anthropic/claude-opus-4-7` are NOT composites and fall through to
36
+ `anthropic/claude-opus-4-8` are NOT composites and fall through to
37
37
  the cross-backend scan.
38
38
 
39
39
  Unknown / ambiguous / deprecated model tokens surface through the
@@ -76,7 +76,7 @@ Response shape:
76
76
  "tiers": ["lite", "medium", "high"],
77
77
  "modelAliases": { "sonnet": "medium", "opus": "high" },
78
78
  "models": {
79
- "claude": [{ "id": "claude-opus-4-7", "tier": "high", "deprecated": false }, ...],
79
+ "claude": [{ "id": "claude-opus-4-8", "tier": "high", "deprecated": false }, ...],
80
80
  "codex": [...],
81
81
  "gemini": [...],
82
82
  "opencode": [...]
@@ -8,10 +8,12 @@ description: recurrenceRule grammar — hourly / daily / weekly / monthly. Engin
8
8
 
9
9
  The daemon's recurrence engine accepts four frequencies: `hourly`,
10
10
  `daily`, `weekly`, `monthly`. Each frequency requires its own set of
11
- fields and rejects fields that don't apply — the daemon's Zod
12
- refinements return a `schedule.frequency_field_mismatch` issue (with
13
- the offending field path) when the shape disagrees with the chosen
14
- frequency. Pre-validate to save a round-trip.
11
+ fields and rejects fields that don't apply — the daemon rejects a
12
+ mismatched shape with an HTTP 400 validation error naming the
13
+ frequency/field conflict. The recurring-schedules endpoint (the
14
+ `schedule` skill) surfaces it as a `schedule.frequency_field_mismatch`
15
+ issue with a field path; the managed-tasks endpoint surfaces it as a
16
+ `managed_tasks.validation_error`. Pre-validate to save a round-trip.
15
17
 
16
18
  Times are `HH:MM` 24-hour local; `timezone` is IANA (auto-fills from
17
19
  daemon config when omitted, but explicit is safer so a roaming laptop
@@ -76,7 +78,7 @@ Same template applies to "every 5 minutes", "every 30 minutes",
76
78
  ## Cadence string vs structured rule
77
79
 
78
80
  Always send both `cadence` (human-readable, rendered in
79
- `rules/management.md` §B) and `recurrenceRule` (structured, what the
81
+ `policies/management.md` §B) and `recurrenceRule` (structured, what the
80
82
  scheduler executes). They must agree — if they drift, the rendered
81
83
  file misleads the user about what the scheduler will actually do.
82
84
 
@@ -175,39 +175,52 @@ runs. The (`section`, `mode`, `content`, `cutoff`, `maxEntries`)
175
175
  shape is the contract today — see `contextPatchSchema` in
176
176
  `packages/shared/src/schemas.ts`.
177
177
 
178
- **Source-id capture (write the `external_id` into the body lines):**
179
- the entity-mirror watcher (P5) reparses the file's frontmatter on
180
- change, so the dedup contract in §7.6 hinges on the upstream id
181
- landing in **frontmatter**, not just the body. Until the entity-mirror
182
- reconciler ships AND the context API gains a `frontmatter*` patch
183
- mode for `<domain>/<type-plural>/*` files, do this:
184
-
185
- 1. Always include `- external_id: <id>` on its own line in the
186
- appended `## <App> Notes` body so a future reconciler-rebuild can
187
- recover the binding from prose.
188
- 2. Track the binding in the §B "Recently changed" path — the
189
- `agent_actions.management_task.run_recorded` row's `detail` is
190
- structured and survives even when the file body doesn't reflect
191
- the binding cleanly.
192
-
193
- > **Implementation gap to flag** (Phase 5 / extended Phase 3): the
194
- > context PATCH route does not currently:
195
- > - allow writes under `<domain>/<type-plural>/*` (no entry in
196
- > `CONTEXT_WRITE_PERMISSIONS`), so this PATCH returns `403
197
- > forbidden` until the whitelist is widened, and
198
- > - expose a `frontmatterMerge` mode for deep-merging
199
- > `frontmatter.sources.<app>`.
200
- > Both are required by design 21 §10.4 step 4b and must land before
201
- > this Step 5a goes from "designed" to "operational". Until then,
202
- > Step 5b's audit row is the durable trace of the run — surface that
203
- > in the activity-view rather than relying on the entity body.
204
-
205
- If the entity file does not previously exist, today's API requires a
206
- PUT with full content (the `<domain>/<type-plural>/*` write path is
207
- gated by the same whitelist note above). When the gap closes, the
208
- first PATCH must include a complete frontmatter block — `type`,
209
- `domain`, `slug`, `title`, `created`, `sources` or the daemon
210
- returns 422 against `EntitySchema`.
178
+ **Source-id capture deep-merge into frontmatter (`mode:"frontmatterMerge"`):**
179
+ the §7.6 dedup contract hinges on the upstream id landing in **frontmatter**
180
+ (`sources.<app>.external_id`) the canonical signal the entity-mirror watcher
181
+ reparses and `GET /api/entities?source=…&external_id=…` queries not just the
182
+ body. The context PATCH route exposes `mode:"frontmatterMerge"` for exactly this
183
+ (design 21 §10.4 step 4b): it deep-merges a partial frontmatter object into the
184
+ file's existing YAML (nested objects merge key-by-key; scalars/arrays replace),
185
+ so a new `<app>` source is linked without clobbering other apps' ids, other
186
+ frontmatter keys, or the body:
187
+
188
+ ```bash
189
+ curl -sS -X PATCH "http://localhost:8321/api/context/work/meetings/2026-12-04-foo-1on1" \
190
+ -H 'Content-Type: application/json' \
191
+ -d @- <<'JSON'
192
+ {
193
+ "mode": "frontmatterMerge",
194
+ "frontmatter": {
195
+ "sources": { "zoom": { "external_id": "zm_xyz789" } },
196
+ "last_synced_at": "2026-12-04T09:00:00Z"
197
+ }
198
+ }
199
+ JSON
200
+ ```
201
+
202
+ `frontmatterMerge` requires a non-empty `frontmatter` object and takes no
203
+ `section` (it never touches the body). Append the human-readable
204
+ `## <App> Notes` section in a separate `mode:"append"` / `"append_to_file"`
205
+ PATCH. Also keep Step 5b's audit row as the durable structured trace of the run.
206
+
207
+ > **Write path:** the bare `<domain>/<type-plural>/<slug>` path is alias-rewritten
208
+ > to `knowledge/entities/<domain>/<type-plural>/<slug>` by `context-vault-aliases.ts`,
209
+ > which **is** whitelisted in `CONTEXT_WRITE_PERMISSIONS` for `PUT`/`PATCH`
210
+ > (autonomous tier), so both the frontmatterMerge and the body-append PATCH
211
+ > succeed on an existing entity file. (Recognised domains: `work`, `travel`,
212
+ > `finance`, `personal`, `health`, `learning`.)
213
+
214
+ If the entity file does not previously exist, PATCH returns
215
+ `404 context.path_not_found` — today's API requires a PUT with full
216
+ content to create it first (the `<domain>/<type-plural>/*` write path
217
+ is whitelisted for both PUT and PATCH; only the file-existence rule
218
+ forces the PUT-first ordering). There is **no API-side entity
219
+ validation**: the creating PUT succeeds even with incomplete
220
+ frontmatter, but always write a complete block — `type`, `domain`,
221
+ `slug`, `title`, `created`, `sources` — because the entity-mirror
222
+ watcher parses loosely and silently skips rows it can't read, leaving
223
+ the §7.6 dedup lookup blind.
211
224
 
212
225
  ### Step 5b — Update the row
213
226
 
@@ -259,19 +272,16 @@ an em-dash; the user can also set the path explicitly via the
259
272
 
260
273
  ### Step 6 — Three-strikes notify
261
274
 
262
- The design (§10.4 step 6) places the 3-strikes notify on the daemon
263
- side: the `/run-result` route should auto-enqueue a `POST /api/notify`
264
- when the post-update `consecutive_failures` crosses the threshold,
265
- keeping the agent out of the user-paging loop and centralizing the
266
- threshold (`managementFailureNotifyThreshold`, default 3).
275
+ The daemon emits **no** 3-strikes notify: `updateManagedTaskRunResult`
276
+ is a bare UPDATE and the `/run-result` route only records the run and
277
+ re-renders it never calls `sendNotification`. (The similarly-named
278
+ `failureNotifyThreshold` param is metrics-only a dashboard
279
+ "failing_now" gauge not a daemon-side notify mechanism.)
267
280
 
268
- **Implementation status:** the daemon does NOT currently emit this
269
- notify `/api/managed-tasks/:id/run-result` records the run and
270
- re-renders the file but stops there. Until the daemon closes the
271
- gap, **this skill is the safety net**: after Step 5b's failure-path
272
- PATCH, if the post-update `consecutive_failures` you computed is ≥ 3
273
- AND was < 3 before this run (i.e. the *crossing*, not every
274
- subsequent failure), call:
281
+ **This skill is the sole notifier** the safety net for failing
282
+ managed tasks. After Step 5b's failure-path PATCH, if the post-update
283
+ `consecutive_failures` you computed is 3 AND was < 3 before this run
284
+ (i.e. the *crossing*, not every subsequent failure), call:
275
285
 
276
286
  ```bash
277
287
  curl -sS -X POST http://localhost:8321/api/notify \
@@ -296,19 +306,18 @@ agent keeps trying, but doesn't disappear silently.
296
306
  `scheduled.task` flow's "Output contract — your final text becomes a
297
307
  DM" applies (`scheduled.task.md`). For managed-task runs the default
298
308
  is **empty final text**: bookkeeping is invisible by design. The user
299
- sees the change reflected in `_activity/<source>.md` (auto-built) and
309
+ sees the change reflected in `state/activity/<source>.md` (auto-built) and
300
310
  `<domain>/_index.md`, not in a chat ping per fire.
301
311
 
302
- Exceptions:
312
+ Exceptions (final text stays empty in all cases — these only govern
313
+ whether a `/api/notify` fires):
303
314
 
304
315
  - The `notify` skill's awareness gate fired *during* this run — e.g.
305
316
  the new datum is a meeting starting in 15 min. Then call
306
- `/api/notify` and keep the final text empty (a follow-up "Sent"
307
- line is duplicate noise per `scheduled.task.md`).
308
- - `last_result='failed: ...'` with `consecutive_failures < 3` final
309
- text empty; the activity view records it; the user is not paged.
310
- - `last_result='failed: ...'` at the threshold crossing — Step 6 fired
311
- the `/api/notify`; final text empty.
317
+ `/api/notify` (a follow-up "Sent" line is duplicate noise per
318
+ `scheduled.task.md`).
319
+ - A failure: notify only on the Step 6 threshold crossing; below it,
320
+ the activity view records the failure and the user is not paged.
312
321
 
313
322
  NEVER write a `## Agent Plan` row for a managed-task run — managed
314
323
  tasks are not the same as Agent Plan rows. The Agent Plan loop close
@@ -322,13 +331,15 @@ A scheduled fire that crashes mid-run leaves the row's
322
331
  `last_run_at` un-updated. The next slot picks up the same `since`
323
332
  window and re-fetches the same data — the entity-mirror's
324
333
  `(source_key, external_id)` lookup makes this a **merge**, not a
325
- duplicate. The PATCH body is content-additive: a section appended
326
- twice with the same content is harmless because Step 5a's
327
- `frontmatterMerge` is deep, and the section-append mode is
328
- "add this block as-is" (the daemon de-duplicates exact-string-match
329
- sections with the same heading on append). For sources without a
330
- stable `external_id`, use Step 4.2's date+title window at the cost
331
- of occasional dedup misses, never duplicates by construction.
334
+ duplicate at the file level, and Step 5a's `frontmatterMerge` is deep,
335
+ so re-writing the same frontmatter is idempotent. **Body
336
+ section-appends are NOT de-duplicated** `mode:"append"` concatenates
337
+ unconditionally, so re-appending the same block on a replay WILL
338
+ duplicate it. Guard against that: on a re-run, `GET` the section first
339
+ and skip any block already present (or carry the structured fields in
340
+ frontmatter, which merges). For sources without a stable `external_id`,
341
+ use Step 4.2's date+title window — at the cost of occasional dedup
342
+ misses, never duplicates by construction.
332
343
 
333
344
  ## Caps
334
345
 
@@ -342,20 +353,16 @@ appended `## <App> Notes` body, not as a separate DM.
342
353
 
343
354
  | HTTP | `error` | What to do |
344
355
  |---|---|---|
345
- | 400 (`/api/managed-tasks/:id/run-result`) | `invalid_id` / `validation_error` | Body shape drift re-check field names exactly match `last_run_at` / `last_result` / `consecutive_failures` |
346
- | 403 (`/api/context/<domain>/<type-plural>/...`) | `forbidden` | Entity-domain write paths are not yet whitelisted (Phase 5 gap, §Step 5a). Skip the entity merge for this run, still record run-result, and surface a one-line warning in `last_result`. |
356
+ | 400 (`/api/managed-tasks/:id` or `:id/run-result`) | `invalid_id` / `validation_error` | All managed-task body validation is 400 (never 422). Re-check field names exactly match `last_run_at` / `last_result` / `consecutive_failures`; for the user-facing PATCH, drop the offending field (typically `output_path`) and retry once with the rest |
357
+ | 404 (`/api/context/<domain>/<type-plural>/...`) | `context.path_not_found` | The entity file does not exist yet PATCH cannot create it. Create it first with a PUT carrying full content + complete frontmatter (§Step 5a), then the merge succeeds. (Entity-domain write paths ARE whitelisted for PUT/PATCH; the prior 403 claim is obsolete.) |
347
358
  | 404 (`/api/managed-tasks/:id`) | `not_found` | Row was stopped mid-run. End the session quietly. |
348
- | 422 (`/api/context/...`) | `validation_error` | Frontmatter incomplete or malformed; populate all required fields and retry once |
349
- | 422 (`/api/managed-tasks/:id`) | `validation_error` | Path / body shape rejected; drop the offending field (typically `output_path`) and retry once with the rest |
350
359
  | 5xx | `internal_error` | Record `last_result='failed: <body.message>'` via Step 5b's failure form and end the session |
351
360
 
352
361
  ## What this skill does NOT do
353
362
 
354
- - Does NOT post `/api/notify` for routine successes (silent by design).
355
- - Does NOT post `/api/notify` for routine failures (final text empty).
356
- The exception is the 3-strikes crossing — see Step 6: until the
357
- daemon owns the threshold notify, the agent emits one DM at the
358
- 3rd consecutive failure, then stays silent until success or stop.
363
+ - Does NOT post `/api/notify` for routine successes or failures
364
+ (silent by design). The sole exception is the 3-strikes crossing
365
+ see Step 6.
359
366
  - Does NOT touch the §B row's `app` or `cadence` — those are
360
367
  user-mutable only via the `managed-tasks` skill `## Modify` flow.
361
368
  - Does NOT INSERT `agent_schedule` rows. The cron scheduler does.
@@ -379,7 +386,7 @@ appended `## <App> Notes` body, not as a separate DM.
379
386
  | `GET /api/entities?source=` | Step 4 bias hint (list-by-source-key) |
380
387
  | `GET /api/entities?domain=&type=&date=&q=` | Step 4.2 (tier-2 fuzzy) |
381
388
  | `GET /api/entities/by-path?path=` | Step 4 (verify before merging) |
382
- | `PATCH /api/context/<domain>/<type-plural>/<slug>` | Step 5a (gated by entity-domain write whitelistPhase 5 gap) |
389
+ | `PATCH /api/context/<domain>/<type-plural>/<slug>` | Step 5a (whitelisted PUT/PATCH; PATCH requires the file to exist PUT-create first if 404) |
383
390
  | `PATCH /api/managed-tasks/:id/run-result` | Step 5b (internal — last_run_at / last_result / consecutive_failures) |
384
391
  | `PATCH /api/managed-tasks/:id` | Step 5b output-path back-fill only |
385
392
  | `POST /api/notify` | Step 6 (only on the 3-failures-in-a-row crossing edge) |