@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
@@ -13,7 +13,7 @@ steps `N-1 … 1` in reverse before reporting the failure to the user.
13
13
 
14
14
  ```bash
15
15
  # Optional — only if the policy accumulates data into a new topic.
16
- curl -sS -X PUT http://localhost:8321/api/context/dossiers/<topic> \
16
+ curl -sS -X PUT http://localhost:8321/api/context/knowledge/dossiers/<topic> \
17
17
  -H 'Content-Type: application/json' \
18
18
  -d @- <<'JSON'
19
19
  {"content":"---\ntype: dossier\nowner: agent\nupdated: 2026-04-24\n---\n# <Topic>\n\n## Daily Log\n"}
@@ -27,7 +27,7 @@ when the rest of the flow rolls back.
27
27
  ## 5.2 Create the custom routine (only if scheduling is needed)
28
28
 
29
29
  ```bash
30
- curl -sS -X PUT http://localhost:8321/api/context/routines/custom/<slug> \
30
+ curl -sS -X PUT http://localhost:8321/api/context/policies/routines/custom/<slug> \
31
31
  -H 'Content-Type: application/json' \
32
32
  -d @- <<'JSON'
33
33
  {"content":"---\ntype: rule\nslug: <slug>\nprocess_key: routine.custom.<slug>\ncron: \"0 7 * * *\"\nbackend_tier: light\nmax_budget_usd: 0.20\nenabled: true\n---\n# <Title>\n\n## Checks\n\n### <step label>\n**Action**: …\n"}
@@ -52,7 +52,7 @@ line, write a short summary in `origin` and put the verbatim quote in
52
52
  a body section called `## Captured From`.
53
53
 
54
54
  ```bash
55
- curl -sS -X PUT http://localhost:8321/api/context/rules/policies/<slug> \
55
+ curl -sS -X PUT http://localhost:8321/api/context/policies/management-captures/<slug> \
56
56
  -H 'Content-Type: application/json' \
57
57
  -d @- <<'JSON'
58
58
  {"content":"---\ntype: rule\nkind: policy\nowner: agent\nupdated: 2026-04-24\nslug: <slug>\nstatus: active\ncreated_at: 2026-04-24\ncreated_via: dm\norigin: \"User DM 2026-04-24T14:30Z: <one-line summary or short quote>\"\nlinked:\n routine: <slug>\n dossier: <topic>\ntemplate_version: 1\n---\n# <Title>\n\n## Why\n<one short paragraph>\n\n## How\n1. …\n\n## Source of Truth\n- Authoritative: …\n- Local cache: dossiers/<topic>.md\n\n## Captured From\n> <verbatim DM quote, only when too long for the origin line>\n\n## Notes\n- …\n"}
@@ -62,7 +62,7 @@ JSON
62
62
  The global FS-watch reconciler picks this up within ~1 s and the
63
63
  policy appears in `context-index.md` automatically. The policy-index
64
64
  reconciler also fires on the same FS event (chained off the same
65
- debounce), so `rules/policies/_index.md` and `rules/management.md`'s
65
+ debounce), so `policies/management-captures/_index.md` and `policies/management.md`'s
66
66
  `## Active Policies` section refresh within ~10 s — no manual PATCH
67
67
  needed.
68
68
 
@@ -76,14 +76,13 @@ reconciler can resolve them.
76
76
 
77
77
  ## 5.4 _(no manual step required)_
78
78
 
79
- `rules/policies/_index.md` is auto-maintained by the daemon's
80
- policy-index reconciler it re-renders within ~10 s of step 5.3's
81
- write. Same for the `## Active Policies` section in
82
- `rules/management.md`. **Do not PATCH or PUT either path manually**;
83
- doing so just races the reconciler and creates snapshot churn.
79
+ Both `policies/management-captures/_index.md` and the `## Active Policies`
80
+ section in `policies/management.md` are reconciler-owned and re-render
81
+ within ~10 s of step 5.3's write (see SKILL.md body intro no manual
82
+ PATCH/PUT).
84
83
 
85
84
  If you need to confirm the index is up to date before replying to the
86
- user, GET `rules/policies/_index` after a short wait. The
85
+ user, GET `policies/management-captures/_index` after a short wait. The
87
86
  reconciler's last-run record lives at `runtime_state` key
88
87
  `reconciler.policy_index.last_run` for diagnostics.
89
88
 
@@ -91,8 +90,8 @@ reconciler's last-run record lives at `runtime_state` key
91
90
 
92
91
  | Failure at | Roll back |
93
92
  |---|---|
94
- | 5.2 | undo 5.1 (`DELETE` the dossier file you just created only if you created it; do not delete a pre-existing dossier) |
95
- | 5.3 | undo 5.2 (PUT routines file back to `enabled: false` and the next reconcile clears the cron job; or `DELETE` if you created it new), then undo 5.1 as above |
93
+ | 5.2 | undo 5.1 the dossier path does **not** accept `DELETE` (`knowledge/dossiers/*` is PUT/PATCH only; a `DELETE` returns `403 context.write_forbidden`). If you created it new, PUT it to empty content / `status: removed`; an empty dossier is harmless (per 5.1). Leave a pre-existing dossier untouched. |
94
+ | 5.3 | undo 5.2 (PUT routines file back to `enabled: false` and the next reconcile clears the cron job; or `DELETE` if you created it new — `policies/routines/custom/*` is DELETE-whitelisted), then undo 5.1 as above |
96
95
  | 5.4 | none required — there is no manual 5.4. If the reconciler does not pick the change up within ~30 s, surface the diagnostics record (`runtime_state` key above) to the user rather than rolling back. |
97
96
 
98
97
  If any rollback step itself fails, **report the partial state to the
@@ -2,7 +2,7 @@
2
2
  "kind": "knowledge_layout",
3
3
  "files": [
4
4
  {
5
- "path": "rules/policies/*.md",
5
+ "path": "policies/management-captures/*.md",
6
6
  "purpose": "Durable management policy capturing why a recurring rule exists, how it runs, and where data lands",
7
7
  "sections": [
8
8
  { "heading": "## Why", "contains": "one short paragraph stating the motivation behind the policy" },
@@ -41,14 +41,13 @@ language-agnostic** — it applies whatever language the agent uses
41
41
  with the user.
42
42
 
43
43
  Anti-examples (non-exhaustive — the positive rule above is
44
- load-bearing, not this list): "Good morning!", "Evening check-in —",
45
- "Morning briefing —", "Summary:", "Done.", "Sent.", "OK.", "Here's
46
- your day:", "Heads-up —", "FYI:", "Quick update:". Near-synonyms of
47
- these in any language also fail the positive rule.
44
+ load-bearing, not this list): "Good morning!", "Summary:", "Done.",
45
+ "Heads-up —". Near-synonyms of these in any language also fail the
46
+ positive rule.
48
47
 
49
48
  ### No internal mechanism names
50
49
 
51
- Never mention `today.md`, `user/profile.md`, `roadmap.md`, `## Agent
50
+ Never mention `state/today.md`, `identity/profile.md`, `plans/roadmap.md`, `## Agent
52
51
  Plan`, `## Agent Log`, `## Handoff`, `did-not-fire`, "Morning
53
52
  Routine", "Evening Review", "scheduled.task", "scheduled.dm",
54
53
  "dm_session", "sub_flow", or any other internal mechanism in
@@ -56,9 +55,8 @@ user-visible text. Those go in Agent Log only.
56
55
 
57
56
  ### No filler timing commentary
58
57
 
59
- Forbidden — "Just a heads-up", "Still about N hours to go", "About N
60
- hours left", "FYI". If timing matters, the deadline / event time
61
- itself carries it.
58
+ Forbidden — "Just a heads-up", "About N hours left", "FYI". If timing
59
+ matters, the deadline / event time itself carries it.
62
60
 
63
61
  ### No table-of-contents readback
64
62
 
@@ -71,7 +69,7 @@ rule above bars *introducing* such enumeration in any other surface.)
71
69
  ### Language and style
72
70
 
73
71
  Output language: follow `<output_language_policy>`. Tone: follow
74
- `user/profile.md` Communication Style and the Character block in your
72
+ `identity/profile.md` Communication Style and the Character block in your
75
73
  system prompt. Keep technical terms in original form.
76
74
 
77
75
  ### Compactness
@@ -91,21 +89,21 @@ Notify when **all three** are true: (1) **actionable** or requires awareness, (2
91
89
  `[cal] ... — reminder sent` referencing the same item within the
92
90
  last 4 hours. If the injected log is truncated (`[...N earlier
93
91
  entries omitted ...]` marker) and you can't rule out a prior
94
- notification, `GET /api/context/today` for the full log before
92
+ notification, `GET /api/context/state/today` for the full log before
95
93
  firing. Duplicate notifications are the #1 cause of noise.
96
94
  - **A pending Agent Plan row / scheduled DM is already set to fire
97
95
  for this item within the next 2 hours** — let the planned channel
98
96
  deliver; don't pre-empt it.
99
- - **Quiet hours (default 22:00-08:00, configurable)** unless `critical` schedule for after instead
100
- - **Rate-limited (429)** — do NOT retry; log skip to Agent Log. If time-critical, upgrade priority at next opportunity
97
+ - **Already delivered this item** — `/api/notify` sends immediately and a `200 {status:"sent"}` is proof of delivery, so do NOT re-post on a 200. Self-throttle via `<today>` `## Agent Log` before firing and log the skip rather than re-posting. (No endpoint quiet-hours or rate cap gates this for you — noise control is your job.)
101
98
  - **Routine file changes** or **agent internal state** — use Agent Log instead
102
99
  - **When in doubt — prefer silence**
103
100
 
104
101
  ## Priority
105
102
 
106
103
  **Default to `normal`.** Reserve `high` for 8h-delay-matters. Reserve
107
- `critical` for 3am-matters. Full per-level table, examples, and
108
- rate-limit caps are in the priority reference below.
104
+ `critical` for 3am-matters. `priority` is metadata recorded in the
105
+ notification log it does not gate delivery on this endpoint. Full
106
+ per-level table and examples are in the priority reference below.
109
107
 
110
108
  {{> ref:priority }}
111
109
 
@@ -120,5 +118,5 @@ curl -s -X POST http://localhost:8321/api/notify \
120
118
  -H 'Content-Type: application/json' \
121
119
  -d '{"message": "Design review starts in 15 minutes.", "priority": "normal"}'
122
120
  ```
123
- Fields: `message` (required, markdown), `priority` (optional: critical/high/normal/low), `platform` (optional, override target).
124
- Response: `{ "status": "sent", "notificationId": "..." }`. Risk tier: `Autonomous` — the agent decides when to notify; recorded in `notification_log` for the on-demand retrospective.
121
+ Fields: `message` (required, markdown), `priority` (optional: critical/high/normal/low), `platform` (optional, override target) OR `platforms` (optional, array of targets) — mutually exclusive, not both.
122
+ Response: `200 { "status": "sent", "notificationId": "...", "dispatchId": "..." }` = delivered to ≥1 channel; a total delivery failure returns HTTP 500 (not a silent 200-drop). Risk tier: `Autonomous` — the agent decides when to notify; recorded in `notification_log` for the on-demand retrospective.
@@ -1,20 +1,24 @@
1
1
  ---
2
2
  kind: reference
3
3
  name: priority
4
- description: Notification priority levels — critical / high / normal / low — with quiet-hours behavior and per-level examples.
4
+ description: Notification priority levels — critical / high / normal / low — as metadata you set, with per-level usage examples.
5
5
  ---
6
6
 
7
7
  # Notification priority levels
8
8
 
9
- Pick the lowest priority that still preserves the user-visible
10
- behavior the message needs. **Default to `normal`.**
9
+ `priority` is a metadata field you set on the `/api/notify` call. It
10
+ travels into `notification_log` and helps the user (and the
11
+ retrospective) gauge how urgent each message was. It does NOT gate
12
+ delivery on this endpoint — `/api/notify` sends immediately regardless
13
+ of level. Pick the lowest priority that still honestly describes the
14
+ message. **Default to `normal`.**
11
15
 
12
- | Priority | Quiet-hours | Use for |
13
- |---|---|---|
14
- | `critical` | Bypasses | Security alerts (credential leak, account lockout), data-loss risk (about to overwrite without backup, irreversible deletion in flight), system errors blocking the user from working. Wakes the user. |
15
- | `high` | Bypasses | Hard deadlines firing in the next 8 hours, urgent inbound messages from people the user has flagged as priority, "meeting starting now". User wants to see this even during quiet hours but not at 3 am. |
16
- | `normal` | Respects (dropped during quiet hours) | Regular reminders (`15 min until standup`), digest-style summaries, single-recipient FYIs the user opted into. **Default.** |
17
- | `low` | Respects (dropped during quiet hours) | Background updates, observational FYIs the user did not explicitly ask for, optional context. Often better as an Agent Log entry instead of a notification at all. |
16
+ | Priority | Use for |
17
+ |---|---|
18
+ | `critical` | Security alerts (credential leak, account lockout), data-loss risk (about to overwrite without backup, irreversible deletion in flight), system errors blocking the user from working. The "wake the user at 3 am" tier. |
19
+ | `high` | Hard deadlines firing in the next 8 hours, urgent inbound messages from people the user has flagged as priority, "meeting starting now". Important but not 3 am. |
20
+ | `normal` | Regular reminders (`15 min until standup`), digest-style summaries, single-recipient FYIs the user opted into. **Default.** |
21
+ | `low` | Background updates, observational FYIs the user did not explicitly ask for, optional context. Often better as an Agent Log entry instead of a notification at all. |
18
22
 
19
23
  ## Examples by level
20
24
 
@@ -47,14 +51,18 @@ If the next morning would still be soon enough, it is not `high`.
47
51
  If the user did not opt in to receiving this category of update, do not
48
52
  send `low`. Drop it to an Agent Log entry instead.
49
53
 
50
- ## Rate-limit defaults
51
-
52
- 3/hour, 12/day across all priorities (`critical` bypasses both caps).
53
- The agent CANNOT query `notification_log` directly (Approve-tier). Use
54
- `<today>` `## Agent Log` as the authoritative dedup source (look for
55
- `notify sent` / `DM sent` lines).
56
-
57
- A 429 response is final for this attempt — do NOT retry. Log `notify
58
- skipped (rate_limited)` to Agent Log. If the message is time-critical
59
- and the next opportunity arises, upgrade to `high` (or `critical` if
60
- the situation has escalated) rather than re-sending at the same level.
54
+ ## Delivery semantics
55
+
56
+ `/api/notify` delivers immediately there is no quiet-hours gate, no
57
+ per-priority suppression, and no rate cap on this endpoint. A `200
58
+ {status:"sent"}` means the message was delivered to at least one
59
+ channel; a total delivery failure THROWS and surfaces as HTTP 500 (not
60
+ a silent 200-drop). So `"sent"` IS proof of delivery — do NOT re-post
61
+ the same item on a 200.
62
+
63
+ Noise control is YOUR job, not the endpoint's. The agent CANNOT query
64
+ `notification_log` directly (Approve-tier), so use `<today>` `## Agent
65
+ Log` as the authoritative dedup source (look for `notify sent` / `DM
66
+ sent` lines) and self-throttle before firing. Don't re-send the same
67
+ item at the same level; if the situation has genuinely escalated, raise
68
+ the priority metadata to reflect that.
@@ -29,7 +29,7 @@ delegated mode:
29
29
 
30
30
  ```bash
31
31
  curl -s http://localhost:8321/api/notion/databases
32
- # → { databases: { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
32
+ # → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
33
33
  ```
34
34
 
35
35
  Resolve label → UUID here BEFORE the `/exec` call so your `task`
@@ -53,7 +53,7 @@ The daemon:
53
53
  tool against the per-task allowed-tools envelope, validates the
54
54
  final JSON against your `outputSchema`, returns it.
55
55
 
56
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
56
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
57
57
  `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
58
58
  for genuinely larger intents.
59
59
 
@@ -26,7 +26,7 @@ delegated mode:
26
26
 
27
27
  ```bash
28
28
  curl -sS http://localhost:8321/api/notion/databases
29
- # → { databases: { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
29
+ # → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
30
30
  ```
31
31
 
32
32
  Resolve label → UUID here BEFORE the `/exec` call so your `task`
@@ -48,7 +48,7 @@ The daemon:
48
48
  tool against the per-task allowed-tools envelope, validates the
49
49
  final JSON against your `outputSchema`, returns it.
50
50
 
51
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
51
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
52
52
  `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
53
53
  for genuinely larger intents.
54
54
 
@@ -26,7 +26,7 @@ delegated mode:
26
26
 
27
27
  ```bash
28
28
  curl -sS http://localhost:8321/api/notion/databases
29
- # → { databases: { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
29
+ # → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
30
30
  ```
31
31
 
32
32
  Resolve label → UUID here BEFORE the `/exec` call so your `task`
@@ -48,7 +48,7 @@ The daemon:
48
48
  tool against the per-task allowed-tools envelope, validates the
49
49
  final JSON against your `outputSchema`, returns it.
50
50
 
51
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
51
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
52
52
  `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
53
53
  for genuinely larger intents.
54
54
 
@@ -14,11 +14,10 @@ Base URL: `http://localhost:8321`. All calls via `curl -s` with
14
14
  `Content-Type: application/json` on POST/PATCH/PUT. URL-encode spaces in paths.
15
15
 
16
16
  Full CRUD over Notion pages plus workspace search. Reads and writes are
17
- Autonomous; writes are still serialized per-process and pre-marked
18
- `notion:<pageId>` for write attribution. The daemon does not DM the
19
- owner before a write — the user's `deniedTools` setting is the gate.
20
- Call `POST /api/notify` yourself when you judge the user would
21
- want immediate awareness.
17
+ Autonomous; writes are serialized per-process and pre-marked
18
+ `notion:<pageId>` for attribution. The daemon does not DM the owner before
19
+ a write — the `deniedTools` setting is the gate. Call `POST /api/notify`
20
+ yourself when you judge the user would want immediate awareness.
22
21
 
23
22
  **Parent shorthand**: `parent` accepts a label string (`"tasks"`),
24
23
  `{ database: "tasks" }`, `{ data_source_id }`, `{ database_id }`, or
@@ -34,8 +33,10 @@ curl -s "http://localhost:8321/api/notion/search?q=launch+plan" # se
34
33
  curl -s http://localhost:8321/api/notion/pages/abc123... # retrieve page
35
34
  ```
36
35
 
37
- Pagination: `page_size` (1–100, default 20) + `start_cursor` from response's
38
- `next_cursor`. Check `has_more` to know if more pages exist.
36
+ Query also accepts `sorts` (URL-encoded JSON) alongside `filter`, and
37
+ `in_trash=true` to query trashed rows. Pagination: `page_size` (1–100,
38
+ default 20) + `start_cursor` from response's `next_cursor`; check
39
+ `has_more` to know if more pages exist.
39
40
 
40
41
  ## Create a page (write — Autonomous)
41
42
 
@@ -55,12 +56,13 @@ curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123... \
55
56
 
56
57
  ## Update page content (write — Autonomous)
57
58
 
58
- **Concurrency warning**: Notion v5 has no etags. If another client edits
59
- between GET and PATCH, `oldStr` may fail silently. For high-risk edits,
60
- prefer `mode=replace_all`.
59
+ **Concurrency**: Notion v5 has no etags if another client edits between
60
+ GET and PATCH, `oldStr` may fail silently; for high-risk edits prefer
61
+ `mode=replace_all`.
61
62
 
62
63
  Modes: `append`, `replace_all`, `update` (find-and-replace via
63
- `updates: [{oldStr, newStr}]`).
64
+ `updates: [{oldStr, newStr}]`), `replace_range` (in-place swap of a line
65
+ range; requires `content` + `contentRange`, optional `allowDeleting`).
64
66
 
65
67
  ```bash
66
68
  curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123.../content \
@@ -80,9 +82,7 @@ Moves to trash (~30 days). Restore via `PATCH` with `{ "in_trash": false }`.
80
82
 
81
83
  - During `routine.hourly_check` this skill is **read-only** — no creates,
82
84
  property updates, content patches, or archives.
83
- - No bulk operations without user confirmation. If you're about to update
84
- 3+ pages at once, stop and ask the user first.
85
- - Writes are Autonomous; the daemon does not DM the owner. Single ops
86
- only the agent's own judgment is the gate, not the daemon. The
87
- message-discipline contract for any `POST /api/notify` call you issue
88
- here is in the `notify` skill — do not invent ad-hoc phrasing rules.
85
+ - No bulk operations without user confirmation: about to touch 3+ pages,
86
+ stop and ask first. Single ops only.
87
+ - For any `POST /api/notify` call you issue, the message-discipline
88
+ contract lives in the `notify` skill do not invent ad-hoc phrasing.
@@ -11,12 +11,16 @@ allowed-tools:
11
11
  > **Refusal directive — read first.** Notion is in `native` mode bound
12
12
  > to Claude. Do **NOT** call any of:
13
13
  >
14
- > - `POST /api/integrations/notion/exec` (returns `410` with
15
- > `X-Integration-Mode: native`)
16
- > - `POST /api/integrations/notion/reconcile` (410)
17
- > - `/api/notion/query`, `/api/notion/search`, `/api/notion/pages`,
18
- > `/api/notion/pages/<id>/content` (each route-prefix 410 in native
14
+ > - `POST /api/integrations/notion/exec` (returns `409 mode_mismatch`
15
+ > in native mode — this route is NOT route-gated and carries no
16
+ > `X-Integration-Mode` header; `/exec` only succeeds in `delegated`
19
17
  > mode)
18
+ > - `POST /api/integrations/notion/reconcile` (not route-gated either;
19
+ > an LLM-issued notion reconcile returns `400 validation_error` on the
20
+ > window-key allowlist, which is calendar-only)
21
+ > - `/api/notion/query`, `/api/notion/search`, `/api/notion/pages`,
22
+ > `/api/notion/pages/<id>/content` (each route-prefix returns `410`
23
+ > with `X-Integration-Mode: native` — these ARE route-gated)
20
24
  >
21
25
  > Reach Notion through the in-session Notion connector your harness
22
26
  > exposes. Your tool menu lists every available tool at session start
@@ -38,7 +42,7 @@ connector arguments carry concrete UUIDs.
38
42
 
39
43
  ```bash
40
44
  curl -s http://localhost:8321/api/notion/databases
41
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
45
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
42
46
  ```
43
47
 
44
48
  This route is **not** part of the absolute deny set and is intentionally
@@ -150,7 +154,7 @@ instead).
150
154
  When `routine.hourly_check.native.claude.md`'s Step 0c fetches recent
151
155
  Notion edits, POST each materialised page to `/api/observations`. The
152
156
  daemon computes `contentHash` server-side via
153
- `@personal-agent/shared/observations-hash.ts`; pass `payload` verbatim.
157
+ `@aitne/shared/observations-hash.ts`; pass `payload` verbatim.
154
158
 
155
159
  **Batch when you have more than one page.** Use
156
160
  `POST /api/observations/batch` with up to 200 items in one
@@ -11,11 +11,16 @@ allowed-tools:
11
11
  > **Refusal directive — read first.** Notion is in `native` mode bound
12
12
  > to Codex. Do **NOT** call any of:
13
13
  >
14
- > - `POST /api/integrations/notion/exec` (returns `410` with
15
- > `X-Integration-Mode: native`)
16
- > - `POST /api/integrations/notion/reconcile` (410)
14
+ > - `POST /api/integrations/notion/exec` (returns `409 mode_mismatch`
15
+ > in native mode — this route is NOT route-gated and carries no
16
+ > `X-Integration-Mode` header; `/exec` only succeeds in `delegated`
17
+ > mode)
18
+ > - `POST /api/integrations/notion/reconcile` (not route-gated either;
19
+ > an LLM-issued notion reconcile returns `400 validation_error` on the
20
+ > window-key allowlist, which is calendar-only)
17
21
  > - `/api/notion/query`, `/api/notion/search`, `/api/notion/pages`,
18
- > `/api/notion/pages/<id>/content` (each route-prefix 410)
22
+ > `/api/notion/pages/<id>/content` (each route-prefix returns `410`
23
+ > with `X-Integration-Mode: native` — these ARE route-gated)
19
24
  >
20
25
  > Reach Notion through the in-session Notion connector your harness
21
26
  > exposes. Your tool menu lists every available tool at session start
@@ -31,7 +36,7 @@ the `<integration-routing-table>` block in the session preamble.
31
36
 
32
37
  ```bash
33
38
  curl -s http://localhost:8321/api/notion/databases
34
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
39
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
35
40
  ```
36
41
 
37
42
  Resolve label → UUID before any Notion call so the connector arguments
@@ -11,11 +11,16 @@ allowed-tools:
11
11
  > **Refusal directive — read first.** Notion is in `native` mode bound
12
12
  > to Gemini. Do **NOT** call any of:
13
13
  >
14
- > - `POST /api/integrations/notion/exec` (returns `410` with
15
- > `X-Integration-Mode: native`)
16
- > - `POST /api/integrations/notion/reconcile` (410)
14
+ > - `POST /api/integrations/notion/exec` (returns `409 mode_mismatch`
15
+ > in native mode — this route is NOT route-gated and carries no
16
+ > `X-Integration-Mode` header; `/exec` only succeeds in `delegated`
17
+ > mode)
18
+ > - `POST /api/integrations/notion/reconcile` (not route-gated either;
19
+ > an LLM-issued notion reconcile returns `400 validation_error` on the
20
+ > window-key allowlist, which is calendar-only)
17
21
  > - `/api/notion/query`, `/api/notion/search`, `/api/notion/pages`,
18
- > `/api/notion/pages/<id>/content` (each route-prefix 410)
22
+ > `/api/notion/pages/<id>/content` (each route-prefix returns `410`
23
+ > with `X-Integration-Mode: native` — these ARE route-gated)
19
24
  >
20
25
  > Reach Notion through the in-session Notion connector your harness
21
26
  > exposes (typically a user-installed Notion MCP server registered
@@ -41,7 +46,7 @@ the `<integration-routing-table>` block in the session preamble.
41
46
 
42
47
  ```bash
43
48
  curl -s http://localhost:8321/api/notion/databases
44
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
49
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
45
50
  ```
46
51
 
47
52
  Resolve label → UUID before any Notion call.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: observations
3
- description: Load when a session needs to drain the pending-observations queue or inspect raw external-source state (Obsidian edits, new git commits, Notion updates) and optionally mark entries consumed.
3
+ description: Drain the pending-observations queue and inspect raw external-source state (Obsidian edits, new git commits, Notion updates), marking processed entries consumed. Use during hourly check or morning routine review.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -17,8 +17,8 @@ Output language: write-ups inherit the destination file's policy via the `today`
17
17
  2. Group related observations before acting.
18
18
  3. For each group, apply the **fetch decision** (below) — `summary_text` + `novelty_score` are pre-computed by the daemon's per-observation summarizer; only `novelty_score >= 2` warrants full content fetch.
19
19
  4. Decide actionability:
20
- - Update `today.md` for TODOs, blockers, decisions, or deadlines
21
- - Update `roadmap.md` or `projects/*.md` only for material project-state changes
20
+ - Update `state/today.md` for TODOs, blockers, decisions, or deadlines
21
+ - Update `plans/roadmap.md` or `projects/*.md` only for material project-state changes
22
22
  - Schedule a wake-up if the observation implies a future reminder
23
23
  5. Apply the smallest meaningful set of context updates.
24
24
  6. Mark processed observations consumed via the bulk endpoint
@@ -60,20 +60,7 @@ The daemon pre-summarizes every observation with a per-source LLM call (lite tie
60
60
 
61
61
  ### Legacy fetch-on-doubt (used when `summary_status !== 'done'`)
62
62
 
63
- Before fetching, ask: **"If I fetch this, will my next action actually differ from what I'd do now?"** No → don't fetch. Yes fetch. Fetching for "verification" wastes tokens; fetching to resolve ambiguity is what these endpoints exist for.
64
-
65
- | Situation | Action | Why |
66
- |---|---|---|
67
- | Preview contains TODO, deadline, or concrete task reference | **Act on preview** | You have what you need |
68
- | Preview is truncated on a relevant section | **Fetch full** | Missing load-bearing content |
69
- | Preview is empty or says `(file read failed)` | **Fetch full** | Preview is broken, not empty |
70
- | Change type is `deleted` | **Log only — no fetch** | Nothing to read |
71
- | Journal/diary entry with no task markers visible | **Skip entirely** | Usually no action needed |
72
- | Active project file with ambiguous preview | **Fetch full** | Active project justifies cost |
73
- | Clear commit message + small/routine diff | **Act on preview** | Common refactors, renames |
74
- | Generic commit message ("update","fix","wip") + multi-file | **Fetch full diff** | Vague message requires actual change |
75
-
76
- **Availability:** Obsidian → 503 when app not running (fall back to preview); Git → 400 for repos not in `PA_GIT_REPOS`; Notion → empty for unconfigured DBs.
63
+ When the summarizer hasn't run (`summary_status !== 'done'`) or its summary aged out (`summaryStale === true`), fall back to the fetch-on-doubt heuristic table: {{> ref:fetch-fallback }}
77
64
 
78
65
  ---
79
66
 
@@ -105,7 +92,7 @@ Params: `pending` (bool, default true), `actor` (user/agent/system/unknown), `li
105
92
 
106
93
  The `source` filter is a prefix match: `source=obsidian` returns rows from both the primary management vault (`obsidian:primary`) and the external note vault (`obsidian:external`). Narrow to one side with the namespaced form when the distinction matters — typically `obsidian:primary` refers to the agent's own files and most user-actionable edits come from `obsidian:external`.
107
94
 
108
- Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "observedAt", "payload", "consumedAt?", "consumedBy?", "summaryText?", "noveltyScore?", "summaryStatus?", "summaryAt?", "summaryStale" }], "limit", "offset", "pending" }`
95
+ Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "observedAt", "payload", "consumedAt?", "consumedBy?", "summaryText?", "noveltyScore?", "summaryStatus?", "summaryAt?", "summaryBackend?", "summaryStale" }], "limit", "offset", "pending" }`
109
96
 
110
97
  `summaryText` / `noveltyScore` are populated asynchronously by the per-observation summarizer (cost-reduction-structural §A). When `summaryStatus !== 'done'` the row may have been skipped (deny-list, agent-actor) or the summarizer hasn't caught up yet — fall back to the legacy fetch-on-doubt rules in that case. `summaryStale === true` flags summaries older than 6 h relative to `observedAt`; treat them the same way as a missing summary.
111
98
 
@@ -138,6 +125,16 @@ that caps each curl invocation at one HTTP request and strips heredoc
138
125
  bodies before URL validation. The batch endpoint resolves the
139
126
  cardinality mismatch without weakening either hook.
140
127
 
128
+ > **If `mcp__aitne-observations__submit_observations` is in your allowed
129
+ > tools (the `routine.fetch_window` pre-pass on Claude), submit the batch
130
+ > through that MCP tool instead of the curl below.** The structured
131
+ > transport never goes through the SDK bash preflight, so Unicode-bearing
132
+ > payloads (NBSP/ZWS in subjects, U+3000 in titles) can't trip its
133
+ > `too-complex` gate and cascade to a denied curl / wasted retry /
134
+ > `budget-cap`. The tool input is the same `{"observations":[…]}` envelope
135
+ > and the response is identical. The curl form below is the fallback for
136
+ > sessions without the MCP tool (the hourly check, Codex/Gemini).
137
+
141
138
  ```bash
142
139
  curl -s -X POST http://localhost:8321/api/observations/batch \
143
140
  -H 'Content-Type: application/json' \
@@ -190,8 +187,8 @@ Hard limits:
190
187
  ### POST /api/observations/consume
191
188
 
192
189
  Marks one or more observations consumed. **Bulk-only** — there is no
193
- per-id endpoint (`POST /api/observations/<id>/consume` returns 404).
194
- Always use this shape, even for a single id.
190
+ per-id endpoint (`POST /api/observations/<id>/consume` returns 405
191
+ `use_bulk_endpoint`). Always use this shape, even for a single id.
195
192
 
196
193
  Copy the `correlationId` value verbatim from the
197
194
  `<event_correlation_id>…</event_correlation_id>` tag in your turn
@@ -218,19 +215,19 @@ you to.**
218
215
 
219
216
  #### Common mistakes — do not retry these, they will keep failing
220
217
 
218
+ The live `issues[]` array names any other malformed field; these are the highest-frequency ones.
219
+
221
220
  | Wrong call | Why it fails | Correct shape |
222
221
  |---|---|---|
223
- | `POST /api/observations -d 'limit=30'` | Body is a query string. POST records, GET fetches. | `GET /api/observations?limit=30&pending=true` |
224
222
  | `POST /api/observations/14/consume` | Per-id path returns 405 `use_bulk_endpoint`. | `POST /api/observations/consume -d '{"ids":[14],"correlationId":"..."}'` |
225
- | `GET /api/observations/consume` | Consume is POST-only; GET returns 405. | `POST /api/observations/consume -d '{"ids":[...],"correlationId":"..."}'` |
226
- | `PATCH /api/observations` | No PATCH route — auth middleware returns 401. | `POST /api/observations/consume` (or `POST /api/observations` for new rows). |
227
223
  | `-d '{"ids":[14],"correlation_id":"..."}'` | snake_case. Field must be camelCase. | `-d '{"ids":[14],"correlationId":"..."}'` |
228
224
  | `-d '{"ids":["14"],"correlationId":"..."}'` | Stringified ids. Use integers. | `-d '{"ids":[14],"correlationId":"..."}'` |
229
- | `-d '{"ids":[14],"correlationId":"<event_correlation_id>"}'` | Pasted the angle-bracket placeholder. | Paste the actual id, e.g. `"hourly-2026-04-23T15:00:00Z-7af3"`. |
230
225
 
231
226
  ### GET /api/observations/stats
232
227
 
233
- `curl -s http://localhost:8321/api/observations/stats` → `{ "total", "pending", "bySource": {...}, "byActor": {...} }`
228
+ `curl -s http://localhost:8321/api/observations/stats` → `{ "totalPending", "oldestPendingObservedAt", "bySource": [{ "source", "pendingCount", "oldestObservedAt" }], "summaryStatusCounts": {...}, "noveltyDistribution": [...] }`
229
+
230
+ `totalPending` is the single count of unconsumed observations (no separate `total` / `pending` keys). `bySource` is an **array** of per-source rows, not a map. There is no `byActor`. `summaryStatusCounts` / `noveltyDistribution` are summarizer-health telemetry.
234
231
 
235
232
  ---
236
233
 
@@ -267,7 +264,10 @@ current state.
267
264
 
268
265
  <!-- mode:direct:notion -->
269
266
  ```bash
270
- curl -s "http://localhost:8321/api/notion/query?databaseId=xxx"
267
+ # ?database= takes a database LABEL (default "tasks"), not a UUID.
268
+ # An unrecognized label returns 404 notion.database_not_found with the
269
+ # list of valid labels; an absent param silently uses "tasks".
270
+ curl -s "http://localhost:8321/api/notion/query?database=tasks"
271
271
  ```
272
272
  <!-- /mode:direct:notion -->
273
273
  <!-- mode:delegated-same:notion -->
@@ -331,8 +331,9 @@ names and the canonical search / fetch call shapes. Resolve
331
331
  `<databaseId>` first via the un-gated config dump
332
332
  (`curl -s http://localhost:8321/api/notion/databases`) and pass the
333
333
  UUID to the connector's data-source / search tool. Do NOT call
334
- `/api/notion/*` (410) or `/api/integrations/notion/exec` (also 410
335
- in native mode).
334
+ `/api/notion/*` (410) or `/api/integrations/notion/exec` (returns 409
335
+ `mode_mismatch` in native mode — the `/exec` path is not route-gated,
336
+ so it is the handler, not the 410 gate, that rejects it).
336
337
  <!-- /mode:native:notion -->
337
338
  <!-- mode:disabled:notion -->
338
339
  Notion is disabled — there is no live source. Treat the observation
@@ -0,0 +1,22 @@
1
+ ---
2
+ kind: reference
3
+ name: fetch-fallback
4
+ description: Legacy fetch-on-doubt rules — used only when summary_status !== 'done' (summarizer disabled/lagging/crashed) or summaryStale === true.
5
+ ---
6
+
7
+ # Legacy fetch-on-doubt (used when `summary_status !== 'done'`)
8
+
9
+ Before fetching, ask: **"If I fetch this, will my next action actually differ from what I'd do now?"** No → don't fetch. Yes → fetch. Fetching for "verification" wastes tokens; fetching to resolve ambiguity is what these endpoints exist for.
10
+
11
+ | Situation | Action | Why |
12
+ |---|---|---|
13
+ | Preview contains TODO, deadline, or concrete task reference | **Act on preview** | You have what you need |
14
+ | Preview is truncated on a relevant section | **Fetch full** | Missing load-bearing content |
15
+ | Preview is empty or says `(file read failed)` | **Fetch full** | Preview is broken, not empty |
16
+ | Change type is `deleted` | **Log only — no fetch** | Nothing to read |
17
+ | Journal/diary entry with no task markers visible | **Skip entirely** | Usually no action needed |
18
+ | Active project file with ambiguous preview | **Fetch full** | Active project justifies cost |
19
+ | Clear commit message + small/routine diff | **Act on preview** | Common refactors, renames |
20
+ | Generic commit message ("update","fix","wip") + multi-file | **Fetch full diff** | Vague message requires actual change |
21
+
22
+ **Availability:** Obsidian → 503 when app not running (fall back to preview); Git → 400 for repos not in `PA_GIT_REPOS`; Notion → empty for unconfigured DBs.