@aitne-sh/aitne 0.1.7 → 0.1.8

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 (222) hide show
  1. package/README.md +195 -829
  2. package/agent-assets/agent-profiles/_safety.md +49 -17
  3. package/agent-assets/agent-profiles/profile-importer.md +1 -1
  4. package/agent-assets/agent-profiles/routine.md +4 -3
  5. package/agent-assets/docs/concepts/agent-day.md +6 -1
  6. package/agent-assets/docs/concepts/auth-health.md +10 -1
  7. package/agent-assets/docs/concepts/backends-and-tiers.md +74 -40
  8. package/agent-assets/docs/concepts/costs-and-quotas.md +25 -5
  9. package/agent-assets/docs/concepts/delegated-mode.md +147 -68
  10. package/agent-assets/docs/concepts/memory-model.md +9 -4
  11. package/agent-assets/docs/concepts/observations.md +13 -1
  12. package/agent-assets/docs/concepts/process-keys.md +20 -5
  13. package/agent-assets/docs/concepts/routines.md +38 -20
  14. package/agent-assets/docs/concepts/safety-model.md +30 -13
  15. package/agent-assets/docs/concepts/skills.md +12 -7
  16. package/agent-assets/docs/features/integrations/calendar.md +1 -1
  17. package/agent-assets/docs/features/integrations/git.md +2 -2
  18. package/agent-assets/docs/features/integrations/github.md +9 -2
  19. package/agent-assets/docs/features/integrations/mail.md +1 -1
  20. package/agent-assets/docs/features/integrations/notion.md +34 -6
  21. package/agent-assets/docs/features/integrations/obsidian.md +7 -2
  22. package/agent-assets/docs/features/lifestyle/git.md +4 -7
  23. package/agent-assets/docs/features/lifestyle/receipts.md +17 -2
  24. package/agent-assets/docs/features/lifestyle/travel-bookings.md +15 -0
  25. package/agent-assets/docs/features/lifestyle/travel-time.md +7 -1
  26. package/agent-assets/docs/features/memory-files/agent-journal.md +2 -2
  27. package/agent-assets/docs/features/memory-files/projects.md +6 -0
  28. package/agent-assets/docs/features/memory-files/roadmap.md +5 -0
  29. package/agent-assets/docs/features/memory-files/today.md +1 -0
  30. package/agent-assets/docs/features/memory-files/user-profile.md +6 -0
  31. package/agent-assets/docs/features/messaging/bang-commands.md +20 -10
  32. package/agent-assets/docs/features/messaging/discord.md +12 -1
  33. package/agent-assets/docs/features/messaging/overview.md +10 -7
  34. package/agent-assets/docs/features/messaging/slack.md +13 -1
  35. package/agent-assets/docs/features/messaging/telegram.md +7 -1
  36. package/agent-assets/docs/features/messaging/whatsapp.md +12 -1
  37. package/agent-assets/docs/features/operations/activity-and-conversations.md +2 -2
  38. package/agent-assets/docs/features/operations/approvals.md +6 -0
  39. package/agent-assets/docs/features/operations/backend-routing.md +7 -0
  40. package/agent-assets/docs/features/operations/cost-tracking.md +6 -0
  41. package/agent-assets/docs/features/operations/notifications.md +6 -0
  42. package/agent-assets/docs/features/operations/schedule-approaching.md +22 -9
  43. package/agent-assets/docs/features/routines/custom-routines.md +10 -4
  44. package/agent-assets/docs/features/routines/evening-review.md +1 -1
  45. package/agent-assets/docs/features/routines/hourly-check.md +1 -1
  46. package/agent-assets/docs/features/routines/morning-routine.md +24 -15
  47. package/agent-assets/docs/features/routines/weekly-review.md +38 -12
  48. package/agent-assets/docs/features/wiki/commands.md +11 -0
  49. package/agent-assets/docs/features/wiki/overview.md +13 -3
  50. package/agent-assets/docs/getting-started/01-what-is-this.md +32 -11
  51. package/agent-assets/docs/getting-started/02-first-steps.md +17 -4
  52. package/agent-assets/docs/getting-started/03-what-can-this-do.md +21 -11
  53. package/agent-assets/docs/getting-started/04-first-day.md +14 -0
  54. package/agent-assets/docs/glossary.md +65 -12
  55. package/agent-assets/docs/guides/add-a-custom-routine.md +12 -0
  56. package/agent-assets/docs/guides/backup-and-restore.md +16 -2
  57. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +6 -0
  58. package/agent-assets/docs/guides/build-your-wiki.md +14 -0
  59. package/agent-assets/docs/guides/change-which-model-handles-x.md +7 -0
  60. package/agent-assets/docs/guides/connect-a-new-mail-account.md +16 -0
  61. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +6 -0
  62. package/agent-assets/docs/guides/import-knowledge-file.md +11 -0
  63. package/agent-assets/docs/guides/install-and-run.md +20 -4
  64. package/agent-assets/docs/guides/maintain-wiki-health.md +6 -0
  65. package/agent-assets/docs/guides/migrate-machines.md +13 -1
  66. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +9 -0
  67. package/agent-assets/docs/guides/pause-the-agent.md +12 -4
  68. package/agent-assets/docs/guides/reinstall-cleanly.md +19 -4
  69. package/agent-assets/docs/guides/setup-wizard.md +20 -9
  70. package/agent-assets/docs/guides/switch-default-backend.md +10 -1
  71. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +5 -0
  72. package/agent-assets/docs/reference/api.md +29 -1
  73. package/agent-assets/docs/reference/cli-commands.md +22 -3
  74. package/agent-assets/docs/reference/config.md +37 -5
  75. package/agent-assets/docs/reference/disallowed-tools.md +13 -0
  76. package/agent-assets/docs/reference/keyboard-shortcuts.md +13 -0
  77. package/agent-assets/docs/reference/process-keys.md +70 -20
  78. package/agent-assets/docs/reference/skills.md +27 -9
  79. package/agent-assets/docs/troubleshooting/auth-failed.md +7 -2
  80. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +13 -1
  81. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +10 -0
  82. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +11 -0
  83. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +9 -4
  84. package/agent-assets/docs/troubleshooting/observation-not-detected.md +12 -0
  85. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -1
  86. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +5 -0
  87. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +5 -0
  88. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +1 -1
  89. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +2 -2
  90. package/agent-assets/skills/agent-actions/SKILL.md +122 -0
  91. package/agent-assets/skills/attach/SKILL.md +1 -2
  92. package/agent-assets/skills/context/SKILL.md +36 -454
  93. package/agent-assets/skills/context/references/api.md +220 -0
  94. package/agent-assets/skills/context/references/required-frontmatter.md +73 -0
  95. package/agent-assets/skills/context/references/snapshot-files.md +103 -0
  96. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +1 -1
  97. package/agent-assets/skills/docs-search/SKILL.md +13 -13
  98. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +5 -7
  99. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +5 -7
  100. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +5 -7
  101. package/agent-assets/skills/external-services/SKILL.md +6 -259
  102. package/agent-assets/skills/external-services/SKILL.native.claude.md +1 -2
  103. package/agent-assets/skills/external-services/SKILL.native.codex.md +1 -2
  104. package/agent-assets/skills/external-services/SKILL.native.gemini.md +1 -2
  105. package/agent-assets/skills/external-services/references/calendar-apple.md +97 -0
  106. package/agent-assets/skills/external-services/references/calendar-google.md +72 -0
  107. package/agent-assets/skills/external-services/references/calendar-outlook.md +36 -0
  108. package/agent-assets/skills/external-services/references/github.md +17 -0
  109. package/agent-assets/skills/external-services/references/obsidian.md +49 -0
  110. package/agent-assets/skills/external-services/references/skills-crud.md +27 -0
  111. package/agent-assets/skills/gmail-lifestyle/SKILL.md +224 -0
  112. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +93 -0
  113. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +75 -0
  114. package/agent-assets/skills/gmail-lifestyle/references/travel-time-api.md +59 -0
  115. package/agent-assets/skills/mail/SKILL.delegated.claude.md +1 -1
  116. package/agent-assets/skills/mail/SKILL.delegated.codex.md +1 -1
  117. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +1 -1
  118. package/agent-assets/skills/mail/SKILL.md +9 -114
  119. package/agent-assets/skills/mail/SKILL.native.claude.md +1 -1
  120. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  121. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  122. package/agent-assets/skills/mail/references/api.md +108 -0
  123. package/agent-assets/skills/mail/references/examples.md +70 -0
  124. package/agent-assets/skills/mail/references/providers.md +8 -8
  125. package/agent-assets/skills/managed-tasks/SKILL.md +472 -0
  126. package/agent-assets/skills/managed-tasks/references/errors.md +70 -0
  127. package/agent-assets/skills/managed-tasks/references/output-path.md +75 -0
  128. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +86 -0
  129. package/agent-assets/skills/management-policy/SKILL.md +33 -105
  130. package/agent-assets/skills/management-policy/references/policy-workflow.md +101 -0
  131. package/agent-assets/skills/notify/SKILL.md +6 -78
  132. package/agent-assets/skills/notify/references/priority.md +60 -0
  133. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  134. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  135. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  136. package/agent-assets/skills/notion/SKILL.md +6 -10
  137. package/agent-assets/skills/notion/SKILL.native.claude.md +1 -2
  138. package/agent-assets/skills/notion/SKILL.native.codex.md +1 -2
  139. package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -2
  140. package/agent-assets/skills/observations/SKILL.md +1 -6
  141. package/agent-assets/skills/project-doc/SKILL.md +1 -5
  142. package/agent-assets/skills/reading/SKILL.md +2 -2
  143. package/agent-assets/skills/roadmap/SKILL.md +37 -135
  144. package/agent-assets/skills/roadmap/references/api.md +100 -0
  145. package/agent-assets/skills/roadmap/references/cross-check.md +73 -0
  146. package/agent-assets/skills/roadmap/references/migration.md +56 -0
  147. package/agent-assets/skills/roadmap/references/preparation-timeline.md +2 -2
  148. package/agent-assets/skills/schedule/SKILL.md +52 -88
  149. package/agent-assets/skills/schedule/references/batch.md +93 -0
  150. package/agent-assets/skills/schedule/references/errors.md +214 -0
  151. package/agent-assets/skills/schedule/references/model-selection.md +96 -0
  152. package/agent-assets/skills/schedule/references/recurrence-rule.md +86 -0
  153. package/agent-assets/skills/schedule/references/recurring.md +185 -0
  154. package/agent-assets/skills/scheduled-managed-task/SKILL.md +13 -15
  155. package/agent-assets/skills/today/SKILL.md +27 -57
  156. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +113 -0
  157. package/agent-assets/skills/user-interview/SKILL.md +12 -59
  158. package/agent-assets/skills/user-interview/references/op-briefing.md +51 -0
  159. package/agent-assets/skills/user-interview/references/op-morning.md +59 -0
  160. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  161. package/agent-assets/skills/user-profile/SKILL.md +43 -63
  162. package/agent-assets/skills/user-profile/references/character-preferences.md +83 -0
  163. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +28 -0
  164. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +0 -1
  165. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +0 -1
  166. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +0 -1
  167. package/agent-assets/skills/wiki/wiki-graduate/SKILL.md +0 -1
  168. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +0 -1
  169. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +0 -1
  170. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +0 -1
  171. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +0 -1
  172. package/agent-assets/system-prompts/routine-fetch-window.md +68 -0
  173. package/agent-assets/system-prompts/skill-index-instruction.md +26 -0
  174. package/agent-assets/task-flows/_partials/calendar-acquire.google_calendar.md +18 -11
  175. package/agent-assets/task-flows/_partials/calendar-acquire.outlook_calendar.md +16 -9
  176. package/agent-assets/task-flows/_partials/capture-user-info.md +24 -0
  177. package/agent-assets/task-flows/_partials/confirm-subflow.md +68 -0
  178. package/agent-assets/task-flows/_partials/dm-intent.long-horizon.md +35 -0
  179. package/agent-assets/task-flows/_partials/dm-intent.project.md +391 -0
  180. package/agent-assets/task-flows/_partials/mail-acquire.gmail.md +20 -11
  181. package/agent-assets/task-flows/_partials/mail-acquire.outlook_mail.md +17 -9
  182. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +18 -12
  183. package/agent-assets/task-flows/knowledge.import.md +1 -1
  184. package/agent-assets/task-flows/message.received.dm.md +13 -15
  185. package/agent-assets/task-flows/message.received.dm_first.md +10 -14
  186. package/agent-assets/task-flows/routine.custom.md +3 -1
  187. package/agent-assets/task-flows/routine.evening_review.md +39 -163
  188. package/agent-assets/task-flows/routine.fetch_window.md +17 -12
  189. package/agent-assets/task-flows/routine.hourly_check.md +16 -8
  190. package/agent-assets/task-flows/routine.hourly_check.triage.md +1 -1
  191. package/agent-assets/task-flows/routine.monthly_review.md +46 -4
  192. package/agent-assets/task-flows/routine.morning_routine_journal.md +113 -0
  193. package/agent-assets/task-flows/routine.morning_routine_today.md +673 -0
  194. package/agent-assets/task-flows/routine.roadmap_refresh.md +60 -15
  195. package/agent-assets/task-flows/routine.user_profile_sweep.md +9 -10
  196. package/agent-assets/task-flows/routine.weekly_review.md +285 -70
  197. package/agent-assets/task-flows/scheduled.dm.md +8 -8
  198. package/agent-assets/task-flows/scheduled.task.md +5 -5
  199. package/agent-assets/task-flows/setup.initial.md +165 -245
  200. package/agent-assets/task-flows/wiki.ingest_url.md +1 -1
  201. package/agent-assets/templates/_manifest.json +7 -7
  202. package/agent-assets/templates/dossiers/_index.md +1 -1
  203. package/agent-assets/templates/rules/journal-format.md +145 -38
  204. package/agent-assets/templates/user/expertise.md +4 -2
  205. package/agent-assets/templates/user/goals.md +4 -2
  206. package/agent-assets/templates/user/people.md +8 -2
  207. package/agent-assets/templates/user/personal.md +4 -2
  208. package/agent-assets/templates/user/work.md +4 -2
  209. package/bin/aitne.mjs +8 -1
  210. package/package.json +4 -4
  211. package/scripts/commands/doctor.mjs +52 -0
  212. package/scripts/commands/run-now.mjs +202 -0
  213. package/scripts/commands/verify.mjs +264 -0
  214. package/agent-assets/docs/features/routines/monthly-review.md +0 -65
  215. package/agent-assets/skills/management-task-modify/SKILL.md +0 -203
  216. package/agent-assets/skills/management-task-register/SKILL.md +0 -330
  217. package/agent-assets/skills/management-task-stop/SKILL.md +0 -166
  218. package/agent-assets/skills/receipts/SKILL.md +0 -134
  219. package/agent-assets/skills/travel/SKILL.md +0 -132
  220. package/agent-assets/skills/travel-time/SKILL.md +0 -158
  221. package/agent-assets/task-flows/routine.morning_routine.md +0 -322
  222. package/agent-assets/task-flows/routine.morning_routine_initial.md +0 -204
@@ -0,0 +1,60 @@
1
+ ---
2
+ kind: reference
3
+ name: priority
4
+ description: Notification priority levels — critical / high / normal / low — with quiet-hours behavior and per-level examples.
5
+ ---
6
+
7
+ # Notification priority levels
8
+
9
+ Pick the lowest priority that still preserves the user-visible
10
+ behavior the message needs. **Default to `normal`.**
11
+
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. |
18
+
19
+ ## Examples by level
20
+
21
+ ### `critical` — "3 am matters"
22
+
23
+ - `AWS console session was used from an IP not on your allowlist 5 min ago — review and rotate keys if not you.`
24
+ - `Backup job failed on the database for 3 consecutive runs — primary now 6 hours out of sync.`
25
+
26
+ If the user would not want the message to wake them, it is not `critical`.
27
+
28
+ ### `high` — "8 hours delay matters"
29
+
30
+ - `Design review at 14:00 was just moved up to 11:00 — you have a conflicting meeting.`
31
+ - `Submission deadline for the grant is 5 pm today — draft still has 3 unresolved comments.`
32
+ - `Inbound DM from Sarah (priority contact): "Can you call before noon?"`
33
+
34
+ If the next morning would still be soon enough, it is not `high`.
35
+
36
+ ### `normal` — the default
37
+
38
+ - `Standup starts in 15 minutes.`
39
+ - `Daily digest: 3 emails from boss, 1 asks for Q2 plan by EOD.`
40
+ - `Reminder you set yesterday for "call vet": now.`
41
+
42
+ ### `low` — opt-in informational
43
+
44
+ - `Calendar found a 30-min slot at 16:00 today if you want to schedule the writeup.`
45
+ - `Build #4291 on develop turned green (you asked to be notified).`
46
+
47
+ If the user did not opt in to receiving this category of update, do not
48
+ send `low`. Drop it to an Agent Log entry instead.
49
+
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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in cross-backend delegated mode (DM session is Claude Code; `delegatedBackend` is non-Claude). All Notion operations flow through `POST /api/integrations/notion/exec`; `/api/notion/*` write/read endpoints are not active in this configuration. The label-resolution endpoint `GET /api/notion/databases` remains available.
3
+ description: Load when the task touches Notion AND Notion is cross-backend delegated from a Claude DM session (`delegatedBackend` is non-Claude). All Notion operations flow through `POST /api/integrations/notion/exec`. `GET /api/notion/databases` remains available for label resolution.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in cross-backend delegated mode (DM session is Codex CLI; `delegatedBackend` is non-Codex). All Notion operations flow through `POST /api/integrations/notion/exec`; `/api/notion/*` write/read endpoints are not active in this configuration. The label-resolution endpoint `GET /api/notion/databases` remains available.
3
+ description: Load when the task touches Notion AND Notion is cross-backend delegated from a Codex CLI DM session (`delegatedBackend` is non-Codex). All Notion operations flow through `POST /api/integrations/notion/exec`. `GET /api/notion/databases` remains available for label resolution.
4
4
  ---
5
5
 
6
6
  # Notion (delegated, cross-backend)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in cross-backend delegated mode (DM session is Gemini CLI; `delegatedBackend` is non-Gemini). All Notion operations flow through `POST /api/integrations/notion/exec`; `/api/notion/*` write/read endpoints are not active in this configuration. The label-resolution endpoint `GET /api/notion/databases` remains available.
3
+ description: Load when the task touches Notion AND Notion is cross-backend delegated from a Gemini CLI DM session (`delegatedBackend` is non-Gemini). All Notion operations flow through `POST /api/integrations/notion/exec`. `GET /api/notion/databases` remains available for label resolution.
4
4
  ---
5
5
 
6
6
  # Notion (delegated, cross-backend)
@@ -3,17 +3,12 @@ name: notion
3
3
  description: Load when the user mentions Notion or the agent needs to read, query, search, create, update, or archive Notion pages and databases. Mail is in `mail`; Calendar / external Obsidian / GitHub in `external-services`; scheduling in `schedule`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
- - Bash(jq *)
7
6
  - Read
8
7
  ---
9
8
 
10
9
  # Notion API Reference
11
10
 
12
- Output language: follow `<output_language_policy>`. **Property names**
13
- defined in the user's Notion database are Policy A (the API contract —
14
- never translate them; pass them through verbatim). **Property values**
15
- and page body content the agent fills are Policy C (write in
16
- `<settings primary_language>`).
11
+ Output language: Notion property **names** are Policy A — never translate them; pass them through verbatim as the database defines them. Property **values** and page body content are Policy C (`<settings primary_language>`). See `<output_language_policy>`.
17
12
 
18
13
  Base URL: `http://localhost:8321`. All calls via `curl -s` with
19
14
  `Content-Type: application/json` on POST/PATCH/PUT. URL-encode spaces in paths.
@@ -85,8 +80,9 @@ Moves to trash (~30 days). Restore via `PATCH` with `{ "in_trash": false }`.
85
80
 
86
81
  - During `routine.hourly_check` this skill is **read-only** — no creates,
87
82
  property updates, content patches, or archives.
88
- - No bulk operations without user confirmation.
83
+ - No bulk operations without user confirmation. If you're about to update
84
+ 3+ pages at once, stop and ask the user first.
89
85
  - Writes are Autonomous; the daemon does not DM the owner. Single ops
90
- only — the agent's own judgment is the gate, not the daemon. If you're
91
- about to update 3+ pages at once, stop and ask the user. Call
92
- `POST /api/notify` when the user would want immediate awareness.
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.
@@ -1,9 +1,8 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Notion connector your harness exposes directly; the daemon does not proxy Notion. `/api/notion/databases` (label → UUID config dump) is the only daemon route still reachable.
3
+ description: Load when the task touches Notion AND Notion is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Notion connector directly; the daemon does not proxy Notion. `/api/notion/databases` (label → UUID dump) is the only daemon route still reachable.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
- - Bash(jq *)
7
6
  - Read
8
7
  ---
9
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in native mode bound to Codex (`nativeBackend === "codex"`). Use the in-session Notion connector your Codex harness exposes directly; the daemon does not proxy Notion. `/api/notion/databases` (label → UUID config dump) is the only daemon route still reachable.
3
+ description: Load when the task touches Notion AND Notion is in native mode bound to Codex (`nativeBackend === "codex"`). Use the Codex Notion connector directly; daemon does not proxy Notion. `/api/notion/databases` (label → UUID dump) is the only daemon route still reachable.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
- - Bash(jq *)
7
6
  - Read
8
7
  ---
9
8
 
@@ -1,9 +1,8 @@
1
1
  ---
2
2
  name: notion
3
- description: Load when the task touches Notion and Notion is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the in-session Notion connector your Gemini harness exposes directly; the daemon does not proxy Notion. `/api/notion/databases` (label → UUID config dump) is the only daemon route still reachable.
3
+ description: Load when the task touches Notion AND Notion is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the Gemini Notion connector directly; daemon does not proxy Notion. `/api/notion/databases` (label → UUID dump) is the only daemon route still reachable.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
- - Bash(jq *)
7
6
  - Read
8
7
  ---
9
8
 
@@ -8,12 +8,7 @@ allowed-tools:
8
8
 
9
9
  # Observations Review & Source Access
10
10
 
11
- Output language: follow `<output_language_policy>`. This skill routes
12
- observations into other Policy B destinations (`today.md`, `roadmap.md`,
13
- `projects/*.md`) — write-ups inherit the destination file's policy
14
- (English skeleton, body in `<settings primary_language>`) via the
15
- `today` / `roadmap` / `context` / `project-doc` skills you call to land
16
- the update.
11
+ Output language: write-ups inherit the destination file's policy via the `today` / `roadmap` / `context` / `project-doc` skills you call. See `<output_language_policy>`.
17
12
 
18
13
  ## Workflow
19
14
 
@@ -8,11 +8,7 @@ allowed-tools:
8
8
 
9
9
  # Project Doc
10
10
 
11
- Output language: follow `<output_language_policy>`. Project docs are
12
- Policy B — H2/H3 headers from `agent-assets/templates/projects/` and
13
- `agent-assets/templates/git/` are skeleton (English); body prose,
14
- bullets, and summaries are written in `<settings primary_language>`.
15
- Preserve user-customized headers verbatim.
11
+ Output language: project docs are Policy B — see `<output_language_policy>`. Template H2/H3 headers stay English skeleton; body prose, bullets, and summaries are in `<settings primary_language>`. Preserve user-customized headers verbatim.
16
12
 
17
13
  Use this skill for Git-backed context documents under the unified
18
14
  repositories layout (see
@@ -185,8 +185,8 @@ Currently reading: 3
185
185
  New highlights: 34
186
186
 
187
187
  ### Completed This Month
188
- 1. "Deep Work" by Cal Newport — ★★★★★
189
- 2. "Atomic Habits" by James Clear — ★★★★
188
+ 1. "Deep Work" by Cal Newport — rating: 5/5
189
+ 2. "Atomic Habits" by James Clear — rating: 4/5
190
190
 
191
191
  ### Currently Reading
192
192
  - "Thinking, Fast and Slow" by Daniel Kahneman (47 highlights)
@@ -8,12 +8,7 @@ allowed-tools:
8
8
 
9
9
  # roadmap.md Guide
10
10
 
11
- Output language: follow `<output_language_policy>`. roadmap.md is
12
- Policy B — the section headers (`## Annual Goals`, `## Quarterly Focus`,
13
- `## Long-term Plans`, `## Agent Action Plan`, `## Recurring`) are
14
- skeleton and stay English; items, narrative, and preparation-timeline
15
- prose underneath are written in `<settings primary_language>`. Preserve
16
- user-customized headers verbatim.
11
+ Output language: roadmap.md is Policy B — see `<output_language_policy>`. Section headers stay English skeleton; items, narrative, and preparation-timeline prose are in `<settings primary_language>`. Preserve user-customized headers verbatim.
17
12
 
18
13
  `roadmap.md` is the single source of truth for **long-horizon user
19
14
  intent** — everything that does not belong in `today.md`. It aggregates
@@ -86,7 +81,7 @@ Destination: <resolved location or "unknown — pending check">
86
81
  ```
87
82
  ### Scheduled: <description> (task #<id>) <!-- id: rm-YYYYMMDD-abcdef -->
88
83
  Source: scheduled.task — wake-up YYYY-MM-DD HH:MM
89
- Status: pending | running | completed | failed
84
+ Status: pending | running | completed | failed
90
85
 
91
86
  **Preparation Timeline:** (optional — only when the agent judges prep is useful)
92
87
  - ...
@@ -157,153 +152,60 @@ must carry a daemon-minted HTML comment ID:
157
152
 
158
153
  ## travel_bookings cross-check
159
154
 
160
- Before generating a new entry or a `[check]` line for accommodation or
161
- flights:
155
+ Before generating a new event entry or a `[check]` prep line for
156
+ accommodation or flights, match against the user's actual booked
157
+ travel via `GET /api/travel-bookings/upcoming`. Match rules,
158
+ flip-to-completed grammar, and the no-match fallback are in the
159
+ cross-check reference below.
162
160
 
163
- ```
164
- curl -s 'http://localhost:8321/api/travel-bookings/upcoming?limit=50'
165
- ```
166
-
167
- If a matching booking exists, mark the corresponding prep line with the
168
- completed-row grammar above and include the confirmation number in
169
- Agent Notes.
161
+ {{> ref:cross-check }}
170
162
 
171
163
  ## Long-horizon DM-intent detection
172
164
 
173
- Referenced from `message.received.dm` and `message.received.dm_first`.
174
- Identify user messages that describe a commitment or plan beyond the
175
- current day so the DM handler can route them into roadmap.
176
-
177
- **Signals (positive):**
178
- - Explicit forward-looking verb + horizon phrase:
179
- *"going to X next month"*, *"planning to do Y this summer"*,
180
- *"want to Z this quarter"*
181
- - Specific future date 48h out
182
- - Concrete object (destination, deliverable, learning target,
183
- reservation)
184
-
185
- **Not signals:**
186
- - Speculative language (*"maybe"*, *"someday"*, *"might"*, *"perhaps"*,
187
- *"thinking about"*) without a concrete anchor
188
- - Current-week commitments (those belong in `today.md`)
189
- - Opinions, preferences, taste statements
190
- (those belong in `user/*.md` via the `user-profile` skill)
191
-
192
- **Routing after detection:**
193
- - Dated ≥ 48h out → Agent Action Plan event entry (Preparation
194
- Timeline grows once destination / details resolve).
195
- - Undated horizon ("this summer", "this quarter") →
196
- `## Long-term Plans` line with a horizon-tag.
197
- - Ambiguous → keep in `agent-journal.md` as a candidate line and
198
- surface via the next morning routine for user confirmation
199
- (dry-run mode).
165
+ DM-driven long-horizon writes are dispatched from
166
+ `message.received.dm.md` / `message.received.dm_first.md` Step 4 via
167
+ the `_partials/dm-intent.long-horizon.md` task-flow partial that
168
+ partial carries the signal/non-signal enumeration and the
169
+ post-detection routing rules (Agent Action Plan vs Long-term Plans vs
170
+ agent-journal candidate line).
171
+
172
+ **This skill is the writer.** Entry-shape recipes, stable identity,
173
+ preparation timeline taxonomy, destination extraction, retention, and
174
+ the cross-request write lock all live below — the partial dispatches,
175
+ this skill executes the writes.
200
176
 
201
177
  ## Section auto-ensure PATCH recipe
202
178
 
203
- Legacy roadmaps created before the `## Long-term Plans` section was
204
- introduced may be missing it. Before the first PATCH to that section:
179
+ Legacy roadmaps may be missing `## Long-term Plans`. The PATCH-driven
180
+ recovery recipe GET-inspect, insert after `## Quarterly Focus`,
181
+ then PATCH the target section — is in the migration reference below.
205
182
 
206
- 1. `curl -s http://localhost:8321/api/context/roadmap` and inspect the
207
- body for `## Long-term Plans`.
208
- 2. If absent, insert it after `## Quarterly Focus`:
209
- ```bash
210
- curl -s -X PATCH http://localhost:8321/api/context/roadmap \
211
- -H 'Content-Type: application/json' \
212
- -d '{"section": "quarterly_focus", "mode": "append", "content": "\n## Long-term Plans\n"}'
213
- ```
214
- 3. Then PATCH `long_term_plans` normally.
183
+ Full-file PUT writers (e.g. `routine.roadmap_refresh`) do not need
184
+ this recipe they always emit the full section schema.
215
185
 
216
- Full-file PUT writers (e.g. `routine.roadmap_refresh`) do not need this
217
- recipe — they always emit the full section schema.
186
+ {{> ref:migration }}
218
187
 
219
188
  ## Retention (RFC-D preview)
220
189
 
221
190
  - **Agent Action Plan event entries** — kept while the event's header
222
- date is within `[today - 7d, today + 180d]`. Older ✓'d entries roll
223
- off into `daily/` history.
191
+ date is within `[today - 7d, today + 180d]`. Older entries whose
192
+ Preparation Timeline rows are all `completed` roll off into `daily/`
193
+ history.
224
194
  - **`Scheduled:` entries** — kept while the Wake-up date is within
225
- `[today - 1d, today + 180d]`. On completion, Status flips to ✓ and
226
- the entry persists one extra day for the journal.
195
+ `[today - 1d, today + 180d]`. On completion, Status flips to
196
+ `completed` and the entry persists one extra day for the journal.
227
197
  - **Long-term Plans** — entries without date movement for 90 days are
228
198
  marked `[stale]` by Evening Review. 180 days without user
229
199
  confirmation → DM; no reply in 7 days → remove.
230
200
 
231
- ## Cross-request write lock
232
-
233
- Roadmap writes serialize via an optional exclusive lock so a
234
- mid-session refresh is not interleaved with a DM handler PATCH.
235
-
236
- **Lock endpoint pathsget the order right:**
237
-
238
- | Operation | Method | Path |
239
- |---|---|---|
240
- | Acquire | `POST` | `/api/context/lock/roadmap` |
241
- | Release | `DELETE` | `/api/context/lock/roadmap` |
242
-
243
- **Common mistakes (NOT registered):**
244
-
245
- - `POST /api/context/roadmap/lock` — order reversed
246
- - `POST /api/context/roadmap/write-lock` — order reversed and wrong noun
247
- - `POST /api/context/lock/roadmap-write` — wrong noun
248
-
249
- Any of these return `404 {"error":"unknown_route", ...}` with a hint
250
- pointing at the correct path — re-read the table above and resend. The
251
- correct lock endpoints are Autonomous-tier, so no bearer token is
252
- required; if you see `401 {"error":"unauthorized"}` from a path you
253
- believe is correct, the path is still wrong.
254
-
255
- - If `<roadmap_write_lock_id>` is in your context, include
256
- `X-Lock-Id: <roadmap_write_lock_id>` on every PUT / PATCH to
257
- `/api/context/roadmap`.
258
- - Dispatcher auto-acquires the lock for `routine.roadmap_refresh`.
259
- - Flows that need to write roadmap outside that routine (DM handler,
260
- evening sweeper) can acquire via
261
- `POST /api/context/lock/roadmap` and release via
262
- `DELETE /api/context/lock/roadmap` with `{ "lockId": "..." }`.
263
- - If another session holds the lock, PUT / PATCH returns **409
264
- `roadmap_write_lock_held`** — back off 30 s and retry up to 3 times.
265
-
266
- ## roadmap.md API
267
-
268
- Body submission follows `_safety.md` "Daemon-API body submission":
269
- small POST / PATCH bodies use inline `-d '{...}'`; the full-file PUT
270
- runs multi-KB and uses the stdin heredoc `-d @- <<'JSON'` shape.
271
- Include `X-Lock-Id: <roadmap_write_lock_id>` on every PUT / PATCH
272
- when that tag is in your context.
273
-
274
- ```bash
275
- # Read
276
- curl -s http://localhost:8321/api/context/roadmap
277
-
278
- # Mint a new stable entry id
279
- curl -s -X POST http://localhost:8321/api/context/roadmap/id \
280
- -H 'Content-Type: application/json' \
281
- -H 'X-Lock-Id: <roadmap_write_lock_id>' \
282
- -d '{"creationDate":"YYYY-MM-DD"}'
283
-
284
- # Full replace (roadmap refresh) — multi-KB body, use heredoc.
285
- curl -s -X PUT http://localhost:8321/api/context/roadmap \
286
- -H 'Content-Type: application/json' \
287
- -H 'X-Lock-Id: <roadmap_write_lock_id>' \
288
- -d @- <<'JSON'
289
- {"content":"# Roadmap\n> Last synced: 2026-04-23\n\n## Annual Goals\n- ...\n\n## Quarterly Focus\n- ...\n\n## Long-term Plans\n- [2026-Q3] ... <!-- id: rm-20260419-b8e7d4 -->\n\n## Agent Action Plan\n\n## Recurring\n- Every Friday: weekly review\n"}
290
- JSON
291
-
292
- # Section PATCH
293
- curl -s -X PATCH http://localhost:8321/api/context/roadmap \
294
- -H 'Content-Type: application/json' \
295
- -H 'X-Lock-Id: <roadmap_write_lock_id>' \
296
- -d '{"section":"long_term_plans","mode":"append","content":"- [2026-Q3] ...\n"}'
297
- ```
201
+ ## API surface
202
+
203
+ Generic GET / PUT / PATCH / DELETE lives in the **context** skill's
204
+ `references/api.md`. The roadmap-specific layer lock endpoints
205
+ (with the path-name gotchas), ID mint, the duplicate-id retry recipe,
206
+ and the transition guard is in the reference below.
298
207
 
299
- Snapshotting, mtime updates, and path validation are handled by the
300
- context API — see the `context` skill for the full endpoint reference.
301
- For roadmap writes, the API also validates ID uniqueness and runs a
302
- transition guard: if an entry ID survives from previous → next content,
303
- every previous `✓ completed ...` row for that ID must still exist
304
- byte-for-byte. If an entry ID disappears entirely, removal is accepted
305
- only when the retention window permits it or the operator bypass header
306
- is used.
208
+ {{> ref:api }}
307
209
 
308
210
  ## Roadmap section schema (auto-curated)
309
211
 
@@ -0,0 +1,100 @@
1
+ ---
2
+ kind: reference
3
+ name: api
4
+ description: roadmap.md-specific layering on top of /api/context/* — lock endpoints, ID-mint, transition guard, duplicate-id retry recipe.
5
+ ---
6
+
7
+ # roadmap.md API — specific rules
8
+
9
+ The generic GET / PUT / PATCH surface lives in the **context** skill's
10
+ `references/api.md`. The rules below are the roadmap-specific layer.
11
+
12
+ ## Lock — `roadmap_write_lock_id`
13
+
14
+ | Action | Verb | Path |
15
+ |---|---|---|
16
+ | Acquire | `POST` | `/api/context/lock/roadmap` |
17
+ | Release | `DELETE` | `/api/context/lock/roadmap` (body `{"lockId":"…"}`) |
18
+
19
+ The dispatcher auto-acquires this lock for `routine.roadmap_refresh`
20
+ and exposes the id via `<roadmap_write_lock_id>` in the prompt
21
+ context. Other flows (DM handler, evening sweeper) may acquire and
22
+ release manually.
23
+
24
+ Include `X-Lock-Id: <roadmap_write_lock_id>` on every PUT / PATCH to
25
+ `/api/context/roadmap` when the tag is in your context. Other
26
+ sessions get `409 roadmap_write_lock_held` while the lock is held —
27
+ back off 30 s and retry up to 3 times.
28
+
29
+ ### Path-name gotchas
30
+
31
+ These return `404 {"error":"unknown_route", …}` with a hint pointing
32
+ at the correct path:
33
+
34
+ - `POST /api/context/roadmap/lock` — order reversed
35
+ - `POST /api/context/roadmap/write-lock` — order reversed and wrong noun
36
+ - `POST /api/context/lock/roadmap-write` — wrong noun
37
+
38
+ A `401 {"error":"unauthorized"}` from a path you believe is correct
39
+ means the path is still wrong (the lock endpoints are Autonomous-tier
40
+ so no bearer token is required).
41
+
42
+ ## ID mint — `POST /api/context/roadmap/id`
43
+
44
+ ```bash
45
+ curl -s -X POST http://localhost:8321/api/context/roadmap/id \
46
+ -H 'Content-Type: application/json' \
47
+ -H 'X-Lock-Id: <roadmap_write_lock_id>' \
48
+ -d '{"creationDate":"YYYY-MM-DD"}'
49
+ ```
50
+
51
+ Returns `{"id":"rm-YYYYMMDD-<6hex>"}`. Use the returned value as the
52
+ `<!-- id: ... -->` HTML comment on a new entry. Never invent the
53
+ 6-hex suffix in prose.
54
+
55
+ When promoting a Long-term Plans line into Agent Action Plan, transfer
56
+ the existing id to the new `###` heading and remove the original line
57
+ — do NOT mint a fresh id (the journal trail would break).
58
+
59
+ ## ID uniqueness + transition guard
60
+
61
+ The roadmap API validates two invariants on every PUT / PATCH:
62
+
63
+ 1. **Uniqueness.** Every `<!-- id: rm-* -->` is unique within the
64
+ file. Duplicate ids return:
65
+
66
+ ```json
67
+ {"error":"validation_error","message":"duplicate roadmap id rm-YYYYMMDD-abcdef","path":"roadmap.md"}
68
+ ```
69
+
70
+ Recovery: re-GET `roadmap`, mint a fresh id **for the colliding
71
+ new entry only**, retry the PUT / PATCH once. If the same error
72
+ fires twice, abort and surface the message to the user — something
73
+ in the pipeline is double-emitting.
74
+
75
+ 2. **Transition guard.** If an entry id survives from previous → next
76
+ content, every prior `completed …` row for that id must still
77
+ exist byte-for-byte. Removing or rewording a historical completed
78
+ row returns:
79
+
80
+ ```json
81
+ {"error":"validation_error","message":"transition_guard: completed row for rm-… changed","path":"roadmap.md"}
82
+ ```
83
+
84
+ This is intentional: completed prep rows are the audit trail for
85
+ what the agent actually did. Edit only forward-looking rows.
86
+
87
+ If an entry id disappears entirely between previous → next, removal
88
+ is accepted only when:
89
+
90
+ - The entry's retention window has elapsed (see §"Retention" in the
91
+ skill body), OR
92
+ - The operator passes the `X-Operator-Bypass: 1` header (dashboard
93
+ flows only; never set this from an agent curl).
94
+
95
+ ## Body submission
96
+
97
+ - Full PUT body is multi-KB → use the heredoc shape
98
+ (`-d @- <<'JSON'`) per `_safety.md` "Daemon-API body submission".
99
+ - Section PATCH bodies are small → inline `-d '{...}'`.
100
+ - ID-mint POST is small → inline `-d '{"creationDate":"…"}'`.
@@ -0,0 +1,73 @@
1
+ ---
2
+ kind: reference
3
+ name: cross-check
4
+ description: Travel-bookings cross-check — match new roadmap event entries against /api/travel-bookings/upcoming before minting a [check] prep line.
5
+ ---
6
+
7
+ # Travel-bookings cross-check
8
+
9
+ Before generating a new event entry — or a `[check] <date>: Confirm
10
+ …` line in an existing entry's Preparation Timeline — for
11
+ **accommodation** or **flights**, look up the user's actual booked
12
+ travel. If a matching booking already exists, the prep line is
13
+ redundant; mark it `completed` and surface the confirmation number in
14
+ Agent Notes instead.
15
+
16
+ ## Query
17
+
18
+ ```bash
19
+ curl -s 'http://localhost:8321/api/travel-bookings/upcoming?limit=50'
20
+ ```
21
+
22
+ Response shape (one row per booking):
23
+
24
+ ```json
25
+ {
26
+ "bookings": [
27
+ {
28
+ "kind": "flight" | "hotel" | "rail" | "other",
29
+ "depart_at": "ISO8601 with tz",
30
+ "return_at": "ISO8601 with tz | null",
31
+ "destination": "city / airport / property name",
32
+ "confirmation_number": "<string>",
33
+ "source": "gmail" | "manual" | "ical"
34
+ }
35
+ ]
36
+ }
37
+ ```
38
+
39
+ ## Match rules
40
+
41
+ A booking matches a roadmap event entry when **either**:
42
+
43
+ - The booking's `destination` substring-matches the event entry's
44
+ `Destination:` field (case-insensitive, after stripping common
45
+ prefixes / suffixes — "Paris" matches "Paris, FR" and "Paris CDG").
46
+ - The booking's `depart_at` date falls within the event entry's
47
+ `YYYY-MM-DD ~ MM-DD` header range (inclusive on both ends).
48
+
49
+ When a match is found:
50
+
51
+ 1. Locate the matching `[check]` row in the event entry's Preparation
52
+ Timeline.
53
+ 2. Flip it to the completed-row grammar (`completed: <prep>
54
+ <YYYY-MM-DD> confirmation #<conf>`), preserving the original
55
+ `[tag]` and date.
56
+ 3. Append a line to the entry's `**Agent Notes:**` block:
57
+ `- Booking confirmed (<kind>) — #<confirmation_number>`.
58
+
59
+ ## When no match exists
60
+
61
+ The `[check] <event_date - 28d>: Confirm <…> for <title>` line stays
62
+ in the Preparation Timeline. The morning routine will surface it as
63
+ an Agent Plan row when its date is within `today + 7d`.
64
+
65
+ ## When NOT to run this cross-check
66
+
67
+ - Inside the morning routine when it is rebuilding `## Agent Action
68
+ Plan` from scratch — the routine already has the bookings table
69
+ loaded in its pre-pass and runs the match itself.
70
+ - For non-travel entries (work projects, deadlines, study sessions).
71
+ Travel-bookings is a travel-specific source of truth.
72
+ - When `/api/travel-bookings/upcoming` returns an empty list — skip
73
+ the match step entirely.
@@ -0,0 +1,56 @@
1
+ ---
2
+ kind: reference
3
+ name: migration
4
+ description: Section auto-ensure recipe for legacy roadmaps missing ## Long-term Plans. PATCH-driven; full-file PUT writers (refresh routine) do not need this.
5
+ ---
6
+
7
+ # Section auto-ensure — legacy `roadmap.md` files
8
+
9
+ Roadmaps created before the `## Long-term Plans` section was
10
+ introduced may be missing that header. A direct
11
+ `PATCH section=long_term_plans` against such a file returns
12
+ `400 section_not_found`. This reference is the one-time recovery
13
+ recipe DM handlers and the evening sweeper run before their first
14
+ write to `long_term_plans`.
15
+
16
+ ## When to run
17
+
18
+ Run this **only** if you are about to PATCH `long_term_plans` and the
19
+ file's body is unknown to you. Full-file PUT writers
20
+ (`routine.roadmap_refresh`) always emit the full section schema, so
21
+ they never trigger `section_not_found` and never need this recipe.
22
+
23
+ ## Steps
24
+
25
+ ```bash
26
+ # 1. Read the file
27
+ curl -s http://localhost:8321/api/context/roadmap
28
+
29
+ # 2. Inspect the body for "## Long-term Plans". If present, skip the
30
+ # insert and go straight to the normal PATCH below.
31
+
32
+ # 3. Absent → insert it after "## Quarterly Focus":
33
+ curl -s -X PATCH http://localhost:8321/api/context/roadmap \
34
+ -H 'Content-Type: application/json' \
35
+ -H 'X-Lock-Id: <roadmap_write_lock_id>' \
36
+ -d '{"section": "quarterly_focus", "mode": "append", "content": "\n## Long-term Plans\n"}'
37
+
38
+ # 4. Then PATCH long_term_plans normally
39
+ curl -s -X PATCH http://localhost:8321/api/context/roadmap \
40
+ -H 'Content-Type: application/json' \
41
+ -H 'X-Lock-Id: <roadmap_write_lock_id>' \
42
+ -d '{"section": "long_term_plans", "mode": "append", "content": "- [undated] …"}'
43
+ ```
44
+
45
+ ## Don'ts
46
+
47
+ - Do NOT insert `## Long-term Plans` blindly without GET-ing first;
48
+ appending it twice produces a malformed file (the PATCH route does
49
+ not deduplicate H2 headers).
50
+ - Do NOT use this recipe to insert `## Agent Action Plan` or other
51
+ agent-writable sections. The roadmap refresh routine owns the
52
+ per-section schema; section-by-section insertion from DM is not
53
+ supported.
54
+ - Do NOT skip the `X-Lock-Id` header when the
55
+ `<roadmap_write_lock_id>` tag is in your context — PATCH without it
56
+ returns `409 roadmap_write_lock_held` during a held-lock window.