@aitne-sh/aitne 0.1.9 → 0.1.11

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 (218) hide show
  1. package/README.md +41 -11
  2. package/agent-assets/agent-profiles/background-task.md +53 -0
  3. package/agent-assets/agent-profiles/conversational.md +1 -0
  4. package/agent-assets/agent-profiles/routine-fetch-window.md +14 -75
  5. package/agent-assets/agent-profiles/routine.md +1 -1
  6. package/agent-assets/agents/{hourly-check → activity-scan}/agent.md +22 -17
  7. package/agent-assets/agents/monthly-review/agent.md +6 -5
  8. package/agent-assets/docs/concepts/agent-day.md +6 -7
  9. package/agent-assets/docs/concepts/auth-health.md +23 -20
  10. package/agent-assets/docs/concepts/backends-and-tiers.md +13 -9
  11. package/agent-assets/docs/concepts/costs-and-quotas.md +14 -12
  12. package/agent-assets/docs/concepts/delegated-mode.md +18 -17
  13. package/agent-assets/docs/concepts/memory-model.md +16 -9
  14. package/agent-assets/docs/concepts/observations.md +24 -20
  15. package/agent-assets/docs/concepts/process-keys.md +10 -9
  16. package/agent-assets/docs/concepts/routines.md +34 -31
  17. package/agent-assets/docs/concepts/safety-and-execution.md +11 -7
  18. package/agent-assets/docs/concepts/safety-model.md +39 -25
  19. package/agent-assets/docs/concepts/skills.md +12 -10
  20. package/agent-assets/docs/features/integrations/browser-history.md +23 -18
  21. package/agent-assets/docs/features/integrations/calendar.md +28 -17
  22. package/agent-assets/docs/features/integrations/git.md +13 -11
  23. package/agent-assets/docs/features/integrations/github.md +22 -14
  24. package/agent-assets/docs/features/integrations/mail.md +25 -22
  25. package/agent-assets/docs/features/integrations/notion.md +35 -11
  26. package/agent-assets/docs/features/integrations/obsidian.md +8 -8
  27. package/agent-assets/docs/features/lifestyle/git.md +27 -23
  28. package/agent-assets/docs/features/lifestyle/reading.md +20 -11
  29. package/agent-assets/docs/features/lifestyle/receipts.md +11 -10
  30. package/agent-assets/docs/features/lifestyle/travel-bookings.md +4 -3
  31. package/agent-assets/docs/features/memory-files/agent-journal.md +53 -26
  32. package/agent-assets/docs/features/memory-files/agent-lessons.md +178 -0
  33. package/agent-assets/docs/features/memory-files/projects.md +11 -8
  34. package/agent-assets/docs/features/memory-files/roadmap.md +17 -14
  35. package/agent-assets/docs/features/memory-files/schedule.md +6 -3
  36. package/agent-assets/docs/features/memory-files/today.md +10 -7
  37. package/agent-assets/docs/features/memory-files/user-profile.md +14 -9
  38. package/agent-assets/docs/features/messaging/bang-commands.md +21 -6
  39. package/agent-assets/docs/features/messaging/overview.md +17 -14
  40. package/agent-assets/docs/features/messaging/telegram.md +10 -9
  41. package/agent-assets/docs/features/operations/activity-and-conversations.md +6 -5
  42. package/agent-assets/docs/features/operations/approvals.md +6 -5
  43. package/agent-assets/docs/features/operations/browser-tasks.md +184 -0
  44. package/agent-assets/docs/features/operations/cost-tracking.md +11 -1
  45. package/agent-assets/docs/features/operations/managed-chromium.md +4 -2
  46. package/agent-assets/docs/features/operations/notifications.md +11 -1
  47. package/agent-assets/docs/features/operations/quiet-hours.md +41 -11
  48. package/agent-assets/docs/features/operations/schedule-approaching.md +2 -2
  49. package/agent-assets/docs/features/routines/activity-scan.md +220 -0
  50. package/agent-assets/docs/features/routines/custom-routines.md +82 -134
  51. package/agent-assets/docs/features/routines/evening-review.md +23 -13
  52. package/agent-assets/docs/features/routines/morning-routine.md +7 -5
  53. package/agent-assets/docs/features/routines/weekly-review.md +24 -3
  54. package/agent-assets/docs/features/wiki/commands.md +4 -4
  55. package/agent-assets/docs/features/wiki/cost-and-approval.md +4 -3
  56. package/agent-assets/docs/features/wiki/dashboard.md +7 -6
  57. package/agent-assets/docs/features/wiki/overview.md +3 -3
  58. package/agent-assets/docs/features/wiki/search.md +5 -5
  59. package/agent-assets/docs/features/wiki/workspaces.md +2 -2
  60. package/agent-assets/docs/getting-started/01-what-is-this.md +3 -3
  61. package/agent-assets/docs/getting-started/02-first-steps.md +5 -3
  62. package/agent-assets/docs/getting-started/04-first-day.md +27 -30
  63. package/agent-assets/docs/glossary.md +8 -8
  64. package/agent-assets/docs/guides/add-a-custom-routine.md +122 -68
  65. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +2 -2
  66. package/agent-assets/docs/guides/connect-a-new-mail-account.md +4 -2
  67. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +5 -4
  68. package/agent-assets/docs/guides/install-and-run.md +2 -2
  69. package/agent-assets/docs/guides/maintain-wiki-health.md +2 -2
  70. package/agent-assets/docs/guides/pause-the-agent.md +27 -21
  71. package/agent-assets/docs/guides/reinstall-cleanly.md +2 -0
  72. package/agent-assets/docs/guides/setup-wizard.md +12 -6
  73. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +6 -6
  74. package/agent-assets/docs/reference/api.md +26 -5
  75. package/agent-assets/docs/reference/cli-commands.md +3 -3
  76. package/agent-assets/docs/reference/config.md +51 -24
  77. package/agent-assets/docs/reference/disallowed-tools.md +6 -4
  78. package/agent-assets/docs/reference/keyboard-shortcuts.md +2 -2
  79. package/agent-assets/docs/reference/knowledge-layout.md +25 -12
  80. package/agent-assets/docs/reference/process-keys.md +9 -9
  81. package/agent-assets/docs/reference/skills.md +10 -6
  82. package/agent-assets/docs/troubleshooting/auth-failed.md +9 -8
  83. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +16 -9
  84. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +2 -2
  85. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +32 -16
  86. package/agent-assets/docs/troubleshooting/observation-not-detected.md +26 -24
  87. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -6
  88. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +3 -3
  89. package/agent-assets/skills/agent-actions/SKILL.md +23 -39
  90. package/agent-assets/skills/agent-create/SKILL.md +26 -6
  91. package/agent-assets/skills/attach/SKILL.md +8 -27
  92. package/agent-assets/skills/background-task/SKILL.md +184 -0
  93. package/agent-assets/skills/background-task-reply/SKILL.md +100 -0
  94. package/agent-assets/skills/browser-history/SKILL.md +60 -29
  95. package/agent-assets/skills/browser-history-respond/SKILL.md +6 -1
  96. package/agent-assets/skills/browser-task/SKILL.md +33 -31
  97. package/agent-assets/skills/context/SKILL.md +26 -34
  98. package/agent-assets/skills/context/curation.json +12 -12
  99. package/agent-assets/skills/context/references/api.md +22 -20
  100. package/agent-assets/skills/context/references/required-frontmatter.md +10 -9
  101. package/agent-assets/skills/context/references/snapshot-files.md +16 -15
  102. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +5 -5
  103. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
  104. package/agent-assets/skills/docs-search/SKILL.md +19 -31
  105. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +8 -95
  106. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +8 -94
  107. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +8 -94
  108. package/agent-assets/skills/external-services/SKILL.native.claude.md +15 -9
  109. package/agent-assets/skills/external-services/SKILL.native.codex.md +11 -5
  110. package/agent-assets/skills/external-services/SKILL.native.gemini.md +11 -5
  111. package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
  112. package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
  113. package/agent-assets/skills/gmail-lifestyle/SKILL.md +3 -2
  114. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
  115. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
  116. package/agent-assets/skills/mail/SKILL.delegated.claude.md +13 -25
  117. package/agent-assets/skills/mail/SKILL.delegated.codex.md +3 -2
  118. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +3 -2
  119. package/agent-assets/skills/mail/SKILL.md +12 -20
  120. package/agent-assets/skills/mail/SKILL.native.claude.md +24 -16
  121. package/agent-assets/skills/mail/SKILL.native.codex.md +16 -9
  122. package/agent-assets/skills/mail/SKILL.native.gemini.md +12 -6
  123. package/agent-assets/skills/mail/references/api.md +6 -1
  124. package/agent-assets/skills/mail/references/examples.md +2 -1
  125. package/agent-assets/skills/managed-tasks/SKILL.md +44 -77
  126. package/agent-assets/skills/managed-tasks/references/errors.md +25 -14
  127. package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
  128. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +26 -16
  129. package/agent-assets/skills/management-policy/SKILL.md +36 -28
  130. package/agent-assets/skills/management-policy/curation.json +1 -1
  131. package/agent-assets/skills/management-policy/references/policy-workflow.md +30 -18
  132. package/agent-assets/skills/notify/SKILL.md +16 -13
  133. package/agent-assets/skills/notify/references/priority.md +42 -26
  134. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  135. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  136. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  137. package/agent-assets/skills/notion/SKILL.md +18 -18
  138. package/agent-assets/skills/notion/SKILL.native.claude.md +4 -4
  139. package/agent-assets/skills/notion/SKILL.native.codex.md +3 -3
  140. package/agent-assets/skills/notion/SKILL.native.gemini.md +3 -3
  141. package/agent-assets/skills/observations/SKILL.md +9 -24
  142. package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
  143. package/agent-assets/skills/project-doc/SKILL.md +9 -6
  144. package/agent-assets/skills/project-doc/curation.json +3 -3
  145. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +2 -2
  146. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  147. package/agent-assets/skills/reading/SKILL.md +8 -42
  148. package/agent-assets/skills/reading/references/reading-taste.md +5 -5
  149. package/agent-assets/skills/roadmap/SKILL.md +3 -19
  150. package/agent-assets/skills/roadmap/references/api.md +23 -8
  151. package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
  152. package/agent-assets/skills/roadmap/references/migration.md +8 -6
  153. package/agent-assets/skills/roadmap/references/retention.md +18 -0
  154. package/agent-assets/skills/schedule/SKILL.md +20 -28
  155. package/agent-assets/skills/schedule/references/importance.md +23 -0
  156. package/agent-assets/skills/schedule/references/recurrence-rule.md +26 -16
  157. package/agent-assets/skills/scheduled-managed-task/SKILL.md +46 -46
  158. package/agent-assets/skills/today/SKILL.md +38 -81
  159. package/agent-assets/skills/today/references/agent-plan-lifecycle.md +9 -4
  160. package/agent-assets/skills/today/references/agent-plan-revision.md +28 -0
  161. package/agent-assets/skills/today/references/today-skeleton.md +66 -0
  162. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
  163. package/agent-assets/skills/today/seeds/section-shape.seed.json +6 -6
  164. package/agent-assets/skills/user-interview/SKILL.md +15 -90
  165. package/agent-assets/skills/user-interview/references/op-briefing.md +1 -1
  166. package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
  167. package/agent-assets/skills/user-interview/references/op-morning.md +2 -2
  168. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  169. package/agent-assets/skills/user-profile/SKILL.md +16 -26
  170. package/agent-assets/skills/user-profile/curation.json +3 -3
  171. package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
  172. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
  173. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +5 -4
  174. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
  175. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
  176. package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
  177. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
  178. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
  179. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
  180. package/agent-assets/system-prompts/routine-research-cluster-update.md +71 -0
  181. package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
  182. package/agent-assets/task-flows/_partials/notion-acquire.notion.md +47 -21
  183. package/agent-assets/task-flows/background_task.md +81 -0
  184. package/agent-assets/task-flows/git.local_ahead.stale.md +1 -1
  185. package/agent-assets/task-flows/git.push.detected.md +1 -1
  186. package/agent-assets/task-flows/git.tag.created.md +1 -1
  187. package/agent-assets/task-flows/github.assigned.md +1 -1
  188. package/agent-assets/task-flows/github.pull_request.review_requested.md +2 -2
  189. package/agent-assets/task-flows/github.security_alert.md +1 -1
  190. package/agent-assets/task-flows/message.received.dm.md +11 -3
  191. package/agent-assets/task-flows/message.received.dm_first.md +8 -2
  192. package/agent-assets/task-flows/{routine.hourly_check.md → routine.activity_scan.md} +31 -23
  193. package/agent-assets/task-flows/{routine.hourly_check.triage.md → routine.activity_scan.triage.md} +3 -3
  194. package/agent-assets/task-flows/routine.evening_review.md +80 -0
  195. package/agent-assets/task-flows/routine.monthly_review.md +81 -8
  196. package/agent-assets/task-flows/routine.research_cluster_update.md +33 -19
  197. package/agent-assets/task-flows/routine.roadmap_refresh.md +2 -2
  198. package/agent-assets/task-flows/routine.today_refresh.md +1 -1
  199. package/agent-assets/task-flows/routine.weekly_review.md +124 -4
  200. package/agent-assets/task-flows/schedule.approaching.md +2 -2
  201. package/agent-assets/task-flows/scheduled.dm.md +77 -1
  202. package/agent-assets/task-flows/scheduled.task.md +7 -1
  203. package/agent-assets/task-flows/wiki.trace.md +1 -1
  204. package/agent-assets/templates/_manifest.json +2 -2
  205. package/agent-assets/templates/knowledge/dossiers/_index.md +1 -1
  206. package/agent-assets/templates/knowledge/dossiers/{hourly.md → activity-scan.md} +1 -1
  207. package/agent-assets/templates/policies/journal-format.md +1 -1
  208. package/agent-assets/templates/policies/mcp.md +1 -1
  209. package/agent-assets/templates/policies/routines/_index.md +1 -1
  210. package/agent-assets/templates/policies/routines/{hourly.md → activity-scan.md} +5 -5
  211. package/bin/aitne.mjs +45 -11
  212. package/package.json +6 -5
  213. package/scripts/commands/doctor.mjs +11 -2
  214. package/scripts/lib/process-identity.d.mts +46 -0
  215. package/scripts/lib/process-identity.mjs +193 -0
  216. package/scripts/lib/read-api-token.mjs +1 -1
  217. package/scripts/start.mjs +14 -4
  218. package/agent-assets/docs/features/routines/hourly-check.md +0 -205
@@ -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 activity scan or morning routine review.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -56,30 +56,17 @@ The daemon pre-summarizes every observation with a per-source LLM call (lite tie
56
56
  | `summaryStale === true` | Treat as if `summary_status !== 'done'` — fall back to legacy fetch-on-doubt | Summary aged out (>6h since observed_at); content may have drifted under it |
57
57
  | `summary_status !== 'done'` (pending/skipped/failed/null) | Fall back to legacy fetch-on-doubt below | Summarizer disabled, lagging, or crashed |
58
58
 
59
- **Hard rule:** never fetch raw content when `novelty_score < 2`, unless a different observation in the same batch references the same path/ref OR `summaryStale === true`. This is the primary lever for hourly_check cost reduction.
59
+ **Hard rule:** never fetch raw content when `novelty_score < 2`, unless a different observation in the same batch references the same path/ref OR `summaryStale === true`. This is the primary lever for activity_scan cost reduction.
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
 
80
67
  ## Observation Review Logging
81
68
 
82
- Hourly check and Morning Routine review pending observations in aggregate. Even when nothing is surfaced, the review must remain auditable.
69
+ Activity scan and Morning Routine review pending observations in aggregate. Even when nothing is surfaced, the review must remain auditable.
83
70
 
84
71
  ### observations → Agent Log
85
72
 
@@ -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
 
@@ -113,7 +100,7 @@ Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "o
113
100
 
114
101
  Record an agent-queued observation (only `actor: "agent"` or `"system"`
115
102
  accepted — user-authored observations arrive through the vault / mail
116
- watchers, never this route). Used by `routine.hourly_check` to queue
103
+ watchers, never this route). Used by `routine.activity_scan` to queue
117
104
  `roadmap_candidate` signals the next `routine.roadmap_refresh` consumes.
118
105
 
119
106
  ```bash
@@ -146,7 +133,7 @@ cardinality mismatch without weakening either hook.
146
133
  > `too-complex` gate and cascade to a denied curl / wasted retry /
147
134
  > `budget-cap`. The tool input is the same `{"observations":[…]}` envelope
148
135
  > and the response is identical. The curl form below is the fallback for
149
- > sessions without the MCP tool (the hourly check, Codex/Gemini).
136
+ > sessions without the MCP tool (the activity scan, Codex/Gemini).
150
137
 
151
138
  ```bash
152
139
  curl -s -X POST http://localhost:8321/api/observations/batch \
@@ -228,15 +215,13 @@ you to.**
228
215
 
229
216
  #### Common mistakes — do not retry these, they will keep failing
230
217
 
218
+ The live `issues[]` array names any other malformed field; these are the highest-frequency ones.
219
+
231
220
  | Wrong call | Why it fails | Correct shape |
232
221
  |---|---|---|
233
- | `POST /api/observations -d 'limit=30'` | Body is a query string. POST records, GET fetches. | `GET /api/observations?limit=30&pending=true` |
234
222
  | `POST /api/observations/14/consume` | Per-id path returns 405 `use_bulk_endpoint`. | `POST /api/observations/consume -d '{"ids":[14],"correlationId":"..."}'` |
235
- | `GET /api/observations/consume` | Consume is POST-only; GET returns 405. | `POST /api/observations/consume -d '{"ids":[...],"correlationId":"..."}'` |
236
- | `PATCH /api/observations` | No PATCH route — auth middleware returns 401. | `POST /api/observations/consume` (or `POST /api/observations` for new rows). |
237
223
  | `-d '{"ids":[14],"correlation_id":"..."}'` | snake_case. Field must be camelCase. | `-d '{"ids":[14],"correlationId":"..."}'` |
238
224
  | `-d '{"ids":["14"],"correlationId":"..."}'` | Stringified ids. Use integers. | `-d '{"ids":[14],"correlationId":"..."}'` |
239
- | `-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"`. |
240
225
 
241
226
  ### GET /api/observations/stats
242
227
 
@@ -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.
@@ -15,13 +15,16 @@ repositories layout (see
15
15
  `docs/design/appendices/unified-repositories.md` §4.5):
16
16
 
17
17
  - **Git-managed repositories** (any classification) write to
18
- `git/<slug>/overview.md` plus per-day `git/<slug>/journal/<YYYY-MM-DD>.md`.
18
+ `knowledge/repos/<slug>/overview.md` plus per-day
19
+ `journal/repos/<slug>/<YYYY-MM-DD>.md`.
19
20
  - **Non-git project pages** (manual projects without a backing repo)
20
- still live at `projects/<slug>.md` per the original layout.
21
+ still live at `plans/projects/<slug>.md` per the original layout.
21
22
 
22
23
  The pre-cutover paths `projects/<slug>.md` (for git-backed projects)
23
- and `git-repos/<slug>.md` are **retired** every git-managed repo
24
- now lives under `git/<slug>/`. Classification (`project` vs `repo-only`)
24
+ and `git-repos/<slug>.md` are **retired**; the `git/<slug>/` spelling is
25
+ a deprecated alias the daemon still normalizes for one release. Every
26
+ git-managed repo now lives under `knowledge/repos/<slug>/` (overview)
27
+ plus `journal/repos/<slug>/` (daily journal). Classification (`project` vs `repo-only`)
25
28
  no longer changes the path; it controls which sections the overview
26
29
  carries (project keeps `## Lifecycle Phases`, repo-only stays light).
27
30
 
@@ -40,7 +43,7 @@ carries (project keeps `## Lifecycle Phases`, repo-only stays light).
40
43
  - Preserve user prose, manual notes, and existing headings. Compress
41
44
  old Git history instead of deleting meaningful context.
42
45
 
43
- ## Overview file shape (`git/<slug>/overview.md`)
46
+ ## Overview file shape (`knowledge/repos/<slug>/overview.md`)
44
47
 
45
48
  - Frontmatter: `type: git-project`, `repository_id`, `slug`,
46
49
  `github_repo` (or null), `local_path`, `classification`, `category`,
@@ -53,7 +56,7 @@ carries (project keeps `## Lifecycle Phases`, repo-only stays light).
53
56
  - `## Open Threads` (manual prose; preserved verbatim)
54
57
  - `## Daily Activity Log` (rolling 30-day window)
55
58
 
56
- ## Journal file shape (`git/<slug>/journal/<YYYY-MM-DD>.md`)
59
+ ## Journal file shape (`journal/repos/<slug>/<YYYY-MM-DD>.md`)
57
60
 
58
61
  - Frontmatter: `type: git-journal`, `repository_id`, `date`,
59
62
  `commit_count`, `pr_events`, `workflow_events`.
@@ -6,8 +6,8 @@
6
6
  "kind": "knowledge_layout",
7
7
  "anchor": "<!-- CURATION:knowledge_layout id=\"project-shape\" -->",
8
8
  "human_label": "Project / git-repo file shape",
9
- "description": "Required sections in git/<slug>/overview.md (git-managed repos) and projects/*.md (non-git manual projects), and what each section holds",
10
- "scope_paths": ["projects/*.md", "git/*/overview.md"]
9
+ "description": "Required sections in knowledge/repos/<slug>/overview.md (git-managed repos) and plans/projects/*.md (non-git manual projects), and what each section holds",
10
+ "scope_paths": ["plans/projects/*.md", "knowledge/repos/*/overview.md"]
11
11
  },
12
12
  {
13
13
  "id": "slug-grammar",
@@ -15,7 +15,7 @@
15
15
  "anchor": "<!-- CURATION:convention_notes id=\"slug-grammar\" -->",
16
16
  "human_label": "Project slug grammar",
17
17
  "description": "Slug format, length cap, reserved stems",
18
- "scope_paths": ["projects/*.md", "git/*/overview.md"]
18
+ "scope_paths": ["plans/projects/*.md", "knowledge/repos/*/overview.md"]
19
19
  }
20
20
  ]
21
21
  }
@@ -2,7 +2,7 @@
2
2
  "kind": "knowledge_layout",
3
3
  "files": [
4
4
  {
5
- "path": "projects/*.md",
5
+ "path": "plans/projects/*.md",
6
6
  "purpose": "Per-project context document for Git-backed projects",
7
7
  "sections": [
8
8
  { "heading": "## Overview", "contains": "one-paragraph description of the project and its current state" },
@@ -14,7 +14,7 @@
14
14
  ]
15
15
  },
16
16
  {
17
- "path": "git/*/overview.md",
17
+ "path": "knowledge/repos/*/overview.md",
18
18
  "purpose": "Per-repository overview for every git-managed repo (replaces the retired git-repos/*.md layout)",
19
19
  "sections": [
20
20
  { "heading": "## Summary", "contains": "one-paragraph description of the repo and its current state" },
@@ -3,12 +3,12 @@
3
3
  "notes": [
4
4
  {
5
5
  "topic": "Slug format",
6
- "rule": "Project and repo slugs are kebab-case, lowercase letters with hyphens between words.",
7
- "example": "plans/projects/cost-explorer.md, git/personal-agent/overview.md"
6
+ "rule": "Project and repo slugs are lowercase; deriveSlug sanitizes to [a-z0-9._-], so digits, dots, underscores, and hyphens all survive (e.g. v1.2.3).",
7
+ "example": "plans/projects/cost-explorer.md, knowledge/repos/personal-agent/overview.md"
8
8
  },
9
9
  {
10
10
  "topic": "Slug length",
11
- "rule": "Slugs are 32 characters or fewer, including the hyphens but excluding the .md suffix.",
11
+ "rule": "Slugs are 60 characters or fewer (SLUG_MAX), including the hyphens but excluding the .md suffix.",
12
12
  "example": "plans/projects/personal-agent-skills.md is at the upper bound"
13
13
  },
14
14
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: reading
3
- description: Load when the user mentions a book or highlight, weekly/monthly reviews need reading progress, or routines need to refresh the reading-taste profile (`user/reading-taste.md`) and propose new book candidates. Owns the taste-profile schema and recommendation rules.
3
+ description: Load when the user mentions a book or highlight, weekly/monthly reviews need reading progress, or routines need to refresh the reading-taste profile (`identity/reading-taste.md`) and propose new book candidates. Owns the taste-profile schema and recommendation rules.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -12,8 +12,7 @@ allowed-tools:
12
12
 
13
13
  The daemon stores books and reading highlights imported from Kindle
14
14
  (My Clippings.txt and the "Export Notebook" email pipeline) and manual
15
- entries. Data lives in `books` and `reading_highlights` tables. All
16
- display text in `reading-taste.md` must be English (project convention).
15
+ entries. Data lives in `books` and `reading_highlights` tables.
17
16
 
18
17
  ## When to Use
19
18
 
@@ -93,30 +92,9 @@ curl -s "http://localhost:8321/api/books?limit=200&offset=200"
93
92
  | `limit` | number | 50 | Page size (1–200) |
94
93
  | `offset` | number | 0 | Rows to skip. Use with `limit` to paginate beyond the 200 cap |
95
94
 
96
- Response:
97
- ```json
98
- {
99
- "books": [
100
- {
101
- "id": 1,
102
- "title": "Thinking, Fast and Slow",
103
- "author": "Daniel Kahneman",
104
- "source": "kindle",
105
- "status": "reading",
106
- "startedAt": null,
107
- "completedAt": null,
108
- "rating": null,
109
- "notes": null,
110
- "highlightCount": 47,
111
- "createdAt": "2026-04-01T10:00:00Z"
112
- }
113
- ],
114
- "total": 1,
115
- "limit": 50,
116
- "offset": 0,
117
- "hasMore": false
118
- }
119
- ```
95
+ Response: `{ books: [...], total, limit, offset, hasMore }`. Each
96
+ book carries `id`, `title`, `author`, `source`, `status`, `rating`,
97
+ `highlightCount` (plus `startedAt`/`completedAt`/`notes`/`createdAt`).
120
98
 
121
99
  When iterating the entire library, keep calling with `offset += limit`
122
100
  until `hasMore === false`.
@@ -137,20 +115,8 @@ Reading statistics.
137
115
  curl -s "http://localhost:8321/api/books/summary?months=12"
138
116
  ```
139
117
 
140
- Response:
141
- ```json
142
- {
143
- "byStatus": [
144
- { "status": "reading", "count": 3 },
145
- { "status": "completed", "count": 12 }
146
- ],
147
- "monthlyCompleted": [
148
- { "month": "2026-04", "count": 1 },
149
- { "month": "2026-03", "count": 2 }
150
- ],
151
- "totalHighlights": 234
152
- }
153
- ```
118
+ Response: `{ byStatus: [{status, count}], monthlyCompleted:
119
+ [{month, count}], totalHighlights }`.
154
120
 
155
121
  ### PATCH /api/books/:id
156
122
 
@@ -205,6 +171,6 @@ New highlights: 34
205
171
 
206
172
  ---
207
173
 
208
- ## Reading Taste Profile (`user/reading-taste.md`)
174
+ ## Reading Taste Profile (`identity/reading-taste.md`)
209
175
 
210
176
  {{> ref:reading-taste }}
@@ -6,7 +6,7 @@ parent_skill: reading
6
6
  This file captures what the user reads and *why* — topics they return to,
7
7
  how they think, values that keep surfacing in their highlights, and a
8
8
  rolling list of candidate books. It is dictionary-like (same layer as
9
- other `user/*.md` files) and is consumed on-demand — never injected
9
+ other `identity/*.md` files) and is consumed on-demand — never injected
10
10
  into every session. Do not notify the user about taste updates.
11
11
 
12
12
  ### When to refresh
@@ -26,7 +26,7 @@ The file carries a dedicated frontmatter line `Highlights at last sweep: N`
26
26
  holding the `totalHighlights` value from `GET /api/books/summary` at the
27
27
  time of the last successful write. To decide whether to refresh:
28
28
 
29
- 1. `GET /api/context/user/reading-taste` — if 404, treat as
29
+ 1. `GET /api/context/identity/reading-taste` — if 404, treat as
30
30
  `N = 0` and proceed (first sweep).
31
31
  2. `GET /api/books/summary` — read `totalHighlights` as `M`.
32
32
  3. If `M - N < 10`, skip the sweep (log one bullet under agent-journal
@@ -62,7 +62,7 @@ The refresh-trigger check (previous section) uses `totalHighlights` from
62
62
 
63
63
  ### Required file schema
64
64
 
65
- First refresh writes the whole file via `PUT /api/context/user/reading-taste`.
65
+ First refresh writes the whole file via `PUT /api/context/identity/reading-taste`.
66
66
  Subsequent refreshes use `PATCH` per section (but the metadata lines must
67
67
  be updated via a full-file `PUT`). Required structure:
68
68
 
@@ -126,7 +126,7 @@ updated: YYYY-MM-DD
126
126
  Replace a single section (snake_case the heading):
127
127
 
128
128
  ```bash
129
- curl -s -X PATCH http://localhost:8321/api/context/user/reading-taste \
129
+ curl -s -X PATCH http://localhost:8321/api/context/identity/reading-taste \
130
130
  -H 'Content-Type: application/json' \
131
131
  -d '{"section": "topics_of_interest", "mode": "replace", "content": "- cognitive biases\n- systems design"}'
132
132
  ```
@@ -134,7 +134,7 @@ curl -s -X PATCH http://localhost:8321/api/context/user/reading-taste \
134
134
  Replace the full file (first time, or after a major reset):
135
135
 
136
136
  ```bash
137
- curl -s -X PUT http://localhost:8321/api/context/user/reading-taste \
137
+ curl -s -X PUT http://localhost:8321/api/context/identity/reading-taste \
138
138
  -H 'Content-Type: application/json' \
139
139
  -d '{"content": "---\ntype: user\nowner: shared\nupdated: 2026-04-21\n---\n# Reading Taste\n> Last updated: 2026-04-16 09:00\n> Sampled: 87 highlights across 8 books (window: last 12 weeks)\n> Highlights at last sweep: 245\n\n## Topics of Interest\n- ...\n..."}'
140
140
  ```
@@ -93,16 +93,9 @@ Status: pending | running | completed | failed
93
93
  - [<horizon-tag>] <intent> — Source: <dm|mail|observation|reading|dashboard|manual> <YYYY-MM-DD> — Review: <YYYY-MM-DD|[noreview]> — ReviewCount: <0-3> <!-- id: rm-YYYYMMDD-abcdef -->
94
94
  ```
95
95
 
96
- Horizon-tag grammar (validated by the context API):
97
- - `YYYY-MM` → month-granular
98
- - `YYYY-Qn` → calendar quarter
99
- - `YYYY spring|summer|autumn|winter`
100
- - `undated` → no horizon yet
101
-
102
- Examples:
96
+ One worked example (full horizon-tag grammar + more examples are in
97
+ the horizon-tags reference):
103
98
  - `- [2026-05] LA trip candidate — Source: dm 2026-04-19 — Review: 2026-04-20 — ReviewCount: 0 <!-- id: rm-20260419-a3f1c2 -->`
104
- - `- [2026-Q3] US study prep — Source: dm 2026-04-19 — Review: 2026-05-17 — ReviewCount: 0 <!-- id: rm-20260419-b8e7d4 -->`
105
- - `- [undated] Eventually learn Spanish — Source: dm 2026-04-19 — Review: [noreview] — ReviewCount: 3 <!-- id: rm-20260419-0d4c9a -->`
106
99
 
107
100
  ## Stable entry identity
108
101
 
@@ -187,16 +180,7 @@ this recipe — they always emit the full section schema.
187
180
 
188
181
  ## Retention (RFC-D preview)
189
182
 
190
- - **Agent Action Plan event entries** — kept while the event's header
191
- date is within `[today - 7d, today + 180d]`. Older entries whose
192
- Preparation Timeline rows are all `completed` roll off into `daily/`
193
- history.
194
- - **`Scheduled:` entries** — kept while the Wake-up date is within
195
- `[today - 1d, today + 180d]`. On completion, Status flips to
196
- `completed` and the entry persists one extra day for the journal.
197
- - **Long-term Plans** — entries without date movement for 90 days are
198
- marked `[stale]` by Evening Review. 180 days without user
199
- confirmation → DM; no reply in 7 days → remove.
183
+ {{> ref:retention }}
200
184
 
201
185
  ## API surface
202
186
 
@@ -64,7 +64,7 @@ The roadmap API validates two invariants on every PUT / PATCH:
64
64
  file. Duplicate ids return:
65
65
 
66
66
  ```json
67
- {"error":"validation_error","message":"duplicate roadmap id rm-YYYYMMDD-abcdef","path":"plans/roadmap.md"}
67
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Duplicate roadmap entry id `rm-YYYYMMDD-abcdef` (first seen on line N).","path":"roadmap.md"}
68
68
  ```
69
69
 
70
70
  Recovery: re-GET `roadmap`, mint a fresh id **for the colliding
@@ -74,11 +74,12 @@ The roadmap API validates two invariants on every PUT / PATCH:
74
74
 
75
75
  2. **Transition guard.** If an entry id survives from previous → next
76
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:
77
+ exist byte-for-byte. If a completed prep row that existed before is
78
+ gone — dropped or reworded, since a reword no longer matches
79
+ byte-for-byte — the write returns:
79
80
 
80
81
  ```json
81
- {"error":"validation_error","message":"transition_guard: completed row for rm-… changed","path":"plans/roadmap.md"}
82
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Completed Preparation Timeline row for entry `rm-…` was dropped.","path":"roadmap.md"}
82
83
  ```
83
84
 
84
85
  This is intentional: completed prep rows are the audit trail for
@@ -87,10 +88,24 @@ The roadmap API validates two invariants on every PUT / PATCH:
87
88
  If an entry id disappears entirely between previous → next, removal
88
89
  is accepted only when:
89
90
 
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).
91
+ - The entry's retention window has elapsed (see the **retention**
92
+ reference loaded by the skill body), OR
93
+ - The operator passes the `X-Roadmap-Validation: off` header
94
+ (dashboard flows only; never set this from an agent curl).
95
+
96
+ A removal before the retention window permits it returns:
97
+
98
+ ```json
99
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Roadmap entry `rm-…` was removed before its retention window permits removal.","path":"roadmap.md"}
100
+ ```
101
+
102
+ Do not blind-retry this — wait out the window or use the operator
103
+ bypass from a dashboard flow.
104
+
105
+ `X-Roadmap-Validation: off` is roadmap-scoped — it only takes effect
106
+ when `path = plans/roadmap` — and it disables **all** roadmap content
107
+ validation: the transition guard, the duplicate-id check, **and** the
108
+ retention window. It is not a retention-only escape hatch.
94
109
 
95
110
  ## Body submission
96
111
 
@@ -3,6 +3,17 @@ kind: reference
3
3
  parent_skill: roadmap
4
4
  ---
5
5
 
6
+ Horizon-tag grammar (validated by the context API):
7
+ - `YYYY-MM` → month-granular
8
+ - `YYYY-Qn` → calendar quarter
9
+ - `YYYY spring|summer|autumn|winter`
10
+ - `undated` → no horizon yet
11
+
12
+ Worked examples:
13
+ - `- [2026-05] LA trip candidate — Source: dm 2026-04-19 — Review: 2026-04-20 — ReviewCount: 0 <!-- id: rm-20260419-a3f1c2 -->`
14
+ - `- [2026-Q3] US study prep — Source: dm 2026-04-19 — Review: 2026-05-17 — ReviewCount: 0 <!-- id: rm-20260419-b8e7d4 -->`
15
+ - `- [undated] Eventually learn Spanish — Source: dm 2026-04-19 — Review: [noreview] — ReviewCount: 3 <!-- id: rm-20260419-0d4c9a -->`
16
+
6
17
  `Review:` is the date when Evening Review should re-evaluate whether the
7
18
  line is ready to become an Agent Action Plan entry. Date math uses the
8
19
  configured user timezone, not UTC midnight.
@@ -7,15 +7,15 @@ description: Section auto-ensure recipe for legacy roadmaps missing ## Long-term
7
7
  # Section auto-ensure — legacy `plans/roadmap.md` files
8
8
 
9
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
10
+ introduced may be missing that header. A PATCH targeting the
11
+ `Long-term Plans` section against such a file returns
12
12
  `400 section_not_found`. This reference is the one-time recovery
13
13
  recipe DM handlers and the evening sweeper run before their first
14
- write to `long_term_plans`.
14
+ write to the `Long-term Plans` section.
15
15
 
16
16
  ## When to run
17
17
 
18
- Run this **only** if you are about to PATCH `long_term_plans` and the
18
+ Run this **only** if you are about to PATCH the `Long-term Plans` section and the
19
19
  file's body is unknown to you. Full-file PUT writers
20
20
  (`routine.roadmap_refresh`) always emit the full section schema, so
21
21
  they never trigger `section_not_found` and never need this recipe.
@@ -35,11 +35,13 @@ curl -s -X PATCH http://localhost:8321/api/context/plans/roadmap \
35
35
  -H 'X-Lock-Id: <roadmap_write_lock_id>' \
36
36
  -d '{"section": "quarterly_focus", "mode": "append", "content": "\n## Long-term Plans\n"}'
37
37
 
38
- # 4. Then PATCH long_term_plans normally
38
+ # 4. Then PATCH the Long-term Plans section normally (note: section value
39
+ # "long-term plans" normalizes to match the "## Long-term Plans" header;
40
+ # the underscore form "long_term_plans" does NOT match)
39
41
  curl -s -X PATCH http://localhost:8321/api/context/plans/roadmap \
40
42
  -H 'Content-Type: application/json' \
41
43
  -H 'X-Lock-Id: <roadmap_write_lock_id>' \
42
- -d '{"section": "long_term_plans", "mode": "append", "content": "- [undated] …"}'
44
+ -d '{"section": "long-term plans", "mode": "append", "content": "- [undated] …"}'
43
45
  ```
44
46
 
45
47
  ## Don'ts
@@ -0,0 +1,18 @@
1
+ ---
2
+ kind: reference
3
+ name: retention
4
+ description: Roadmap retention windows (RFC-D preview) — when Agent Action Plan entries, Scheduled rows, and Long-term Plans roll off. Governs removal acceptance in the transition guard.
5
+ ---
6
+
7
+ # Retention (RFC-D preview)
8
+
9
+ - **Agent Action Plan event entries** — kept while the event's header
10
+ date is within `[today - 7d, today + 180d]`. Older entries whose
11
+ Preparation Timeline rows are all `completed` roll off into `daily/`
12
+ history.
13
+ - **`Scheduled:` entries** — kept while the Wake-up date is within
14
+ `[today - 1d, today + 180d]`. On completion, Status flips to
15
+ `completed` and the entry persists one extra day for the journal.
16
+ - **Long-term Plans** — entries without date movement for 90 days are
17
+ marked `[stale]` by Evening Review. 180 days without user
18
+ confirmation → DM; no reply in 7 days → remove.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: schedule
3
- description: Load when scheduling a future agent wake-up, pre-composed DM, recurring task, or de-duping against existing pending schedules.
3
+ description: Schedule future agent wake-ups, pre-composed DMs, or recurring tasks via /api/schedule. Use when registering a timed follow-up, a one-off reminder, or de-duping against pending schedules.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -33,8 +33,7 @@ user but compound into duplicate DMs/notifications at fire time.
33
33
  3. **Recurring check.** `GET /api/recurring-schedules?enabled=true` to
34
34
  confirm no recurring rule/Agent already covers this cadence (e.g. a
35
35
  daily 09:00 inbox triage, or the morning briefing). If covered, skip.
36
- (Recurring *work* is created as an Agent via the `agent-create` skill;
37
- recurring *DMs* via `POST /api/recurring-schedules` `taskType:dm_session`.)
36
+ (How recurring work/DMs are created see "Recurring" below.)
38
37
  4. **`confirm_dedup_key` check (mandatory for `confirm:` sub-flow rows
39
38
  only).** When scheduling a `dm_session` row with
40
39
  `taskContext.sub_flow="confirm"`, run the dedup pre-check + shape
@@ -56,13 +55,9 @@ recorded reason — "every morning, run my finance app and log the
56
55
  balance to a finance dossier", "from now on whenever X happens, do
57
56
  Y" — switch to the `management-policy` skill instead. It creates a
58
57
  `policies/management-captures/<slug>.md` that captures the WHY alongside the cadence
59
- (via `policies/routines/custom/<slug>.md`) so the rule survives a context
60
- reset. When the cadence is all that matters and there is no intent to
61
- record: recurring autonomous **work** create a **recurring Agent** via
62
- the `agent-create` skill (`POST /api/agents`); recurring scheduled
63
- **DM / briefing** → `POST /api/recurring-schedules` with
64
- `taskType: "dm_session"`. (Creating a recurring `agent.task` row directly
65
- on `/api/recurring-schedules` is **410 Gone** — use an Agent.)
58
+ (scheduled via a linked recurring Agent, `POST /api/agents`) so the rule
59
+ survives a context reset. When the cadence is all that matters and there is no intent to
60
+ record, create the recurring work/DM per the "Recurring" section below.
66
61
 
67
62
  ## DM vs Agent Task
68
63
 
@@ -77,7 +72,7 @@ on `/api/recurring-schedules` is **410 Gone** — use an Agent.)
77
72
 
78
73
  ## Writing a Good Prompt (for agent tasks)
79
74
 
80
- > **The wake-up agent has NO memory of why it was scheduled.** It receives only: `state/today.md`, a fresh 1-day calendar, `identity/profile.md` + `policies/management.md`, and the `prompt` + `taskContext` fields you provide. Nothing else. (`description` is just an optional list label — never the agent body.)
75
+ > **The wake-up agent has NO memory of why it was scheduled.** A `scheduled.task` session is self-contained: it receives only `state/today.md` (which carries the day's schedule and state) plus the `prompt` + `taskContext` you provide — **NOT** `identity/profile.md` or `policies/management.md` (the `scheduled.task` injection policy opts those out). Nothing else. (`description` is just an optional list label — never the agent body.)
81
76
 
82
77
  Include all four elements in the `prompt`:
83
78
 
@@ -98,21 +93,9 @@ Structured metadata for IDs, URLs, and correlation. Put long identifiers here so
98
93
  { "scheduledBy": "morning_routine", "prUrl": "https://github.com/user/repo/pull/42" }
99
94
  ```
100
95
 
101
- **`importance` convention.** This controls whether `agent_schedule`
102
- rows become `plans/roadmap.md` `Scheduled:` entries:
96
+ **`importance`** controls whether a row becomes a `plans/roadmap.md` `Scheduled:` entry. Default `transient` for `/api/schedule/dm`, `normal` for `/api/schedule`; use `strategic` only for roadmap-shaped long-prep reminders. Tier table + defaults in the reference below.
103
97
 
104
- | Tier | Roadmap behavior | Use |
105
- |---|---|---|
106
- | `transient` | Never in roadmap; surfaces in today.md only on the day it fires | Default for `/api/schedule/dm`; short pings like "call mom next Tuesday" |
107
- | `normal` | In roadmap only when scheduled more than 7 days out | Default for `/api/schedule`; ordinary user-facing follow-ups |
108
- | `strategic` | In roadmap regardless of horizon | Long-prep commitments such as ESTA / travel / deadline reminders |
109
- | `low` | Never in roadmap | Internal ticks already visible elsewhere, e.g. Agent Plan rows, recurring-schedule instances, morning retries |
110
-
111
- For direct DMs, omit `importance` for ordinary one-off pings. If the
112
- reminder is clearly tied to a long-prep commitment ("remind me in a
113
- month about ESTA for the LA trip"), either write/promote the roadmap
114
- item via the roadmap skill and let AAP schedule the reminder, or call
115
- `/api/schedule/dm` with `"importance":"strategic"`.
98
+ {{> ref:importance }}
116
99
 
117
100
  ## Tier / Model selection
118
101
 
@@ -129,6 +112,15 @@ Pick `tier` (`lite` / `medium` / `high`) by default — backend-neutral cost kno
129
112
  - **Max 5 wake-ups per execution.** Consolidate into a single briefing task if more.
130
113
  - **Morning Routine batches all day's wake-ups at once.** Other events schedule only immediate needs.
131
114
 
115
+ ## Lock-step on PATCH / DELETE
116
+
117
+ Agent Plan rows and schedule entries move together in both directions.
118
+ When a schedule you PATCH or DELETE backs an `## Agent Plan` row in
119
+ <today>, update that row in the same turn — today skill §"Agent Plan
120
+ revision — cancel / amend" (flip + `(cancelled: <reason>)`, or re-time
121
+ the row) — and append the Agent Log line. A schedule edit without the
122
+ row edit leaves a plan that lies.
123
+
132
124
  ---
133
125
 
134
126
  ## API Reference
@@ -158,7 +150,7 @@ curl -s -X POST http://localhost:8321/api/schedule \
158
150
  | Field | Required | Description |
159
151
  |---|---|---|
160
152
  | `time` | Yes | ISO 8601 with timezone offset |
161
- | `taskType` | Yes | Free-form provenance label for the row (no allowlist on the single endpoint). Use `wake` for an agent wake-up — the convention this skill follows. The closed set `wake`/`dm_session`/`check`/`dm` is enforced only on `/api/schedule/batch`; e.g. the dashboard's manual "+ New task" sends `custom`. The label does not change firing — the scheduler runs every non-`dm`/`dm_session`/`browser_task` row as a generic `scheduled.task`. |
153
+ | `taskType` | Yes | Free-form provenance label; use `wake` for agent wake-ups. The closed set `wake`/`dm_session`/`check`/`dm` is enforced only on `/api/schedule/batch`. The label doesn't change firing — every non-`dm`/`dm_session`/`browser_task` row runs as a generic `scheduled.task`. |
162
154
  | `prompt` | Yes | The agent's instruction at fire time — its ONLY context (the session has no memory). Self-contained: what + why + who + expected output. See format above. Max 8000 chars (~2000 tokens); move bulk reference material into a file the agent reads at fire time rather than inlining it. |
163
155
  | `description` | No | Optional short label shown in the schedule list (max 200 chars). NOT the agent body — that is `prompt`. Omit it and the list shows a `prompt` excerpt. |
164
156
  | `tier` | No | `lite` / `medium` / `high`. Omit to use the dispatcher's process-key default (medium for `scheduled.task`). See "Tier / Model selection" above. Mutually exclusive with `model`. |
@@ -179,11 +171,11 @@ Fields: `time` (ISO 8601), `prompt` (the agent instruction, ≤8000 chars, non-d
179
171
  ```bash
180
172
  curl -s "http://localhost:8321/api/schedule?status=pending"
181
173
  ```
182
- Param `status` (default `pending,running`): comma-separated `pending`, `running`, `completed`, `failed`.
174
+ Param `status` (default `pending,running`): comma-separated `pending`, `running`, `completed`, `failed`, `skipped`. DELETE/cancel does not remove a row — it moves it to `status='skipped'`, so re-listing a cancelled item requires `status=skipped`.
183
175
  Param `roadmapEligible=true`: return only rows that may become
184
176
  roadmap `Scheduled:` entries (`transient` / `low` excluded, `normal`
185
177
  only beyond 7 days, `strategic` included).
186
- Response: `{ "items":[{ "id","scheduledFor","taskType","description","prompt","status","model","backendId","tier","taskContext","createdAt" }] }`. `prompt` / `tier` / `model` / `backendId` are `null` when no override is set. `model` is a registered id verbatim and travels with `backendId` when set — the row carries either the `(model, backendId)` pin or `tier`, never both. Legacy alias inputs (`sonnet` / `opus`) are normalized to `tier` at write time. `taskContext` is the parsed JSON (or `null`); filter with `jq` e.g. `'.items[] | select(.taskContext.confirm_dedup_key == "create_project:la-pm-masters")'`.
178
+ Response: `{ "items":[{ "id","scheduledFor","taskType","description","prompt","status","model","backendId","tier","taskContext","createdAt" }] }`. `prompt` / `tier` / `model` / `backendId` are `null` when no override is set. `model` is a registered id verbatim and travels with `backendId` when set — the row carries either the `(model, backendId)` pin or `tier`, never both. Legacy alias inputs (`sonnet` / `opus`) are normalized to `tier` at write time. `taskContext` is the parsed JSON (always an object — `{}` when unset); filter with `jq` e.g. `'.items[] | select(.taskContext.confirm_dedup_key == "create_project:la-pm-masters")'`.
187
179
 
188
180
  ### DELETE /api/schedule/:id — Cancel a pending item
189
181
  ```bash