@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,224 @@
1
+ ---
2
+ name: gmail-lifestyle
3
+ description: Load when the user mentions receipts / expenses / flights / hotels / trains / commute / travel time / a booking — Gmail-observer-derived travel bookings, calendar-event commute calculations, and receipt save-to-external-vault all live here.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Read
7
+ ---
8
+
9
+ # Gmail Lifestyle — travel bookings, commute, receipts
10
+
11
+ This skill merges three closely-related surfaces that all depend on
12
+ data the daemon's **Gmail observer** has scanned: travel bookings,
13
+ commute / travel-time calculations over calendar events, and receipt
14
+ attachments saved into the user's external Obsidian vault.
15
+
16
+ It is conditionally loaded — see the manifest predicate
17
+ `gmailLifestyleActive(db)` / `gmailLifestyleActiveForDm(db, msg)`
18
+ in `packages/daemon/src/core/skills-manifest.ts`. Routines load it
19
+ when there is fresh-or-pending data; DM events also load it on
20
+ trigger phrases (`receipt`, `expense`, `flight`, `train`,
21
+ `commute`, `travel time`, plus the user's primary-language
22
+ equivalents — the predicate handles both the structured triggers
23
+ and the message-text triggers).
24
+
25
+ Output language: Policy C for user-facing summaries — see
26
+ `<output_language_policy>`. Path patterns and external API field
27
+ names stay verbatim.
28
+
29
+ ---
30
+
31
+ ## Travel bookings
32
+
33
+ The daemon's Gmail observer detects booking confirmation emails from
34
+ airlines, hotels, OTAs, restaurant reservation platforms, and rail
35
+ services. Data is stored in the `travel_bookings` SQLite table.
36
+
37
+ ### When to use
38
+
39
+ - **Morning routine** — surface upcoming travel / bookings within the
40
+ next 7 days inside today.md `## Travel & Reservations`.
41
+ - **Evening review** — report newly detected bookings (today's
42
+ `createdAt`).
43
+ - **User asks about trips / reservations** — query bookings and
44
+ summarize.
45
+ - **Pre-trip reminders** — surface upcoming travel the day before
46
+ departure.
47
+
48
+ ### Workflow
49
+
50
+ 1. Fetch upcoming bookings from `/api/travel-bookings/upcoming`.
51
+ 2. For morning routine, highlight bookings within the next 7 days.
52
+ 3. For evening review, check for newly detected bookings (today's
53
+ `createdAt`).
54
+
55
+ ### API
56
+
57
+ Full `/api/travel-bookings` reference (GET filter + upcoming +
58
+ PATCH status) is in the dedicated reference below.
59
+
60
+ {{> ref:travel-bookings-api }}
61
+
62
+ ### Formatting
63
+
64
+ Morning routine — today.md:
65
+
66
+ ```
67
+ ## Travel & Reservations
68
+ Upcoming flight: United to SFO (May 15) — confirmation ABC123
69
+ Hotel: Marriott SF (May 15-17) — confirmation XYZ789
70
+ Restaurant: OpenTable reservation tonight 19:00
71
+ ```
72
+
73
+ Omit the section when no upcoming bookings within 7 days.
74
+
75
+ Evening review:
76
+
77
+ ```
78
+ ## New Bookings Detected
79
+ - United flight: May 15, confirmation ABC123, $350
80
+ ```
81
+
82
+ Booking type display names: flight → Flight, hotel → Hotel,
83
+ restaurant → Restaurant, train → Train, bus → Bus, other →
84
+ Reservation.
85
+
86
+ ---
87
+
88
+ ## Travel time / commute
89
+
90
+ Uses the Google Maps Directions API to estimate travel time between
91
+ locations. Computes departure times for calendar events with a
92
+ `location` field.
93
+
94
+ **Prerequisite**: `googleMapsApiKey` configured in the daemon's
95
+ secret store, with the Directions API enabled.
96
+
97
+ ### When to use
98
+
99
+ - **Morning routine** — for today's calendar events with a location,
100
+ compute departure times and add to today.md `## Commute & Travel`.
101
+ - **User asks about commute / travel time** — query specific routes.
102
+ - **Pre-event reminders** — DM departure-time suggestions.
103
+
104
+ ### Sourcing today's events
105
+
106
+ The right fetch path depends on Google Calendar's current mode
107
+ (read `<integration_modes>` injected at session start):
108
+
109
+ <!-- mode:direct:google_calendar -->
110
+ Direct mode → `GET /api/calendar/events?date=today&days=1`
111
+ (see the `external-services` skill).
112
+ <!-- /mode:direct:google_calendar -->
113
+ <!-- mode:delegated-same:google_calendar -->
114
+ Same-backend delegated → use this session backend's native Calendar
115
+ list-events MCP tool. `/api/calendar/events` returns 410.
116
+ <!-- /mode:delegated-same:google_calendar -->
117
+ <!-- mode:delegated-cross:google_calendar -->
118
+ Cross-backend delegated → `POST /api/integrations/google_calendar/exec`
119
+ with a natural-language `task` + `outputSchema` (see the
120
+ `external-services` skill — cross-backend variant for worked
121
+ examples).
122
+ <!-- /mode:delegated-cross:google_calendar -->
123
+ <!-- mode:native:google_calendar -->
124
+ Native mode → use this session backend's native Calendar list-events
125
+ MCP tool (same call shape as `delegated-same`). The materialized
126
+ `external-services` skill body (`SKILL.native.<session-backend>.md`)
127
+ lists the per-backend tool names. The daemon does not proxy in
128
+ native mode; `/api/calendar/events` returns 410 and
129
+ `/api/integrations/google_calendar/exec` returns 410 too.
130
+ <!-- /mode:native:google_calendar -->
131
+ <!-- mode:disabled:google_calendar -->
132
+ Disabled → skip this section; there is no calendar to source events
133
+ from.
134
+ <!-- /mode:disabled:google_calendar -->
135
+
136
+ ### API
137
+
138
+ Full `/api/travel-time` reference (point-to-point + for-event) is in
139
+ the dedicated reference below.
140
+
141
+ {{> ref:travel-time-api }}
142
+
143
+ ### Formatting — today.md
144
+
145
+ ```
146
+ ## Commute & Travel
147
+ 14:00 Team meeting @ WeWork Times Square — depart by 13:15 (transit, 40 min)
148
+ 18:30 Dinner @ Restaurant ABC — depart by 18:00 (transit, 25 min)
149
+ ```
150
+
151
+ Only include events that have a `location` field. Omit the section
152
+ when no events have locations today.
153
+
154
+ Mode display names: transit → Transit, driving → Driving, walking →
155
+ Walking, bicycling → Bicycle.
156
+
157
+ ---
158
+
159
+ ## Receipts
160
+
161
+ The daemon's Gmail observer scans travel-booking emails for PDF /
162
+ image attachments and can retain previously detected generic
163
+ documents. Attachment metadata is stored in the `receipts` SQLite
164
+ table. Actual files are downloaded on demand and can be saved to the
165
+ user's **external Obsidian vault**.
166
+
167
+ ### Primary vault vs external vault — read first
168
+
169
+ > **WARNING — do not confuse vaults.** Receipts save into the
170
+ > **external** Obsidian vault (user's personal knowledge base reached
171
+ > via `/api/obsidian/*`), **not** the primary management store
172
+ > reached via `/api/context/*`. The agent's own state files
173
+ > (`today.md`, `roadmap.md`, `projects/*`, `user/*`, `rules/*`,
174
+ > `routines/*`, `agent/*`) live in the primary store and must
175
+ > **never** receive receipt attachments. See the
176
+ > `external-services` skill's obsidian reference for the external
177
+ > vault's full CRUD surface.
178
+
179
+ `receipts.obsidianPath` is a path **inside the external vault**.
180
+
181
+ ### When to use
182
+
183
+ - **User asks about receipts** — list detected receipts, check save
184
+ status.
185
+ - **Tax preparation season** — generate annual receipt list, save
186
+ unsaved receipts.
187
+ - **Monthly / yearly review** — report on receipt-collection
188
+ completeness.
189
+
190
+ ### Workflow
191
+
192
+ 1. Fetch the receipt list from `/api/receipts`.
193
+ 2. To save a receipt to the external Obsidian vault:
194
+ a. Download via `POST /api/receipts/:id/download` (binary stream).
195
+ b. Save to the vault via `POST /api/obsidian/notes` (see the
196
+ `external-services` obsidian reference for path conventions).
197
+ c. Update the receipt record with the vault-relative path via
198
+ `PATCH /api/receipts/:id` `{"obsidianPath": "..."}`.
199
+ 3. For tax preparation, filter by date range and category.
200
+
201
+ ### API
202
+
203
+ Full `/api/receipts` reference (GET filter + summary + download +
204
+ PATCH) plus the external-vault save convention
205
+ (`receipts/YYYY/MM/<merchant>-<date>.<ext>`) is in the dedicated
206
+ reference below.
207
+
208
+ {{> ref:receipts-api }}
209
+
210
+ ---
211
+
212
+ ## When NOT to act
213
+
214
+ - If the predicate gates above are false (no fresh bookings, no
215
+ unsaved receipts, no trigger phrase), this skill is not loaded —
216
+ the manifest layer handles that decision. If you see this body
217
+ anyway, it means the predicate matched something concrete; do not
218
+ guess that the user wants travel / commute / receipt work without
219
+ evidence in the conversation or the DB.
220
+ - Do not write receipts to `/api/context/*` — that targets the
221
+ primary management vault. See the §"Primary vault vs external
222
+ vault" warning above.
223
+ - Bulk receipt operations (save-all, reclassify-all) need explicit
224
+ user confirmation; surface the count and criteria first.
@@ -0,0 +1,93 @@
1
+ ---
2
+ kind: reference
3
+ name: receipts-api
4
+ description: /api/receipts reference — list / filter, download, save-to-external-Obsidian-vault, reclassify, and summary endpoints for Gmail-observer-flagged attachments.
5
+ ---
6
+
7
+ # `/api/receipts` reference
8
+
9
+ The daemon's Gmail observer scans travel-booking emails for PDF /
10
+ image attachments and can retain previously detected generic
11
+ documents. Attachment metadata is stored in the `receipts` SQLite
12
+ table. Actual files are downloaded on demand and saved to the user's
13
+ **external Obsidian vault** (NOT the primary management vault — see
14
+ the `## Receipts` section of the parent skill for the vault-routing
15
+ warning).
16
+
17
+ ## GET /api/receipts
18
+
19
+ ```bash
20
+ # All receipts
21
+ curl -s "http://localhost:8321/api/receipts?limit=50"
22
+
23
+ # Unsaved receipts only
24
+ curl -s "http://localhost:8321/api/receipts?saved=false"
25
+
26
+ # Filter by category
27
+ curl -s "http://localhost:8321/api/receipts?category=document"
28
+ ```
29
+
30
+ | Param | Type | Default | Description |
31
+ |-------|------|---------|-------------|
32
+ | `category` | string | — | document, travel |
33
+ | `saved` | boolean | — | true = saved to Obsidian, false = not yet saved |
34
+ | `limit` | number | 50 | Max results (1–200) |
35
+
36
+ Response:
37
+
38
+ ```json
39
+ {
40
+ "receipts": [
41
+ {
42
+ "id": 1,
43
+ "providerMsgId": "18f...",
44
+ "attachmentId": "ANGj...",
45
+ "filename": "receipt.pdf",
46
+ "mimeType": "application/pdf",
47
+ "sizeBytes": 45000,
48
+ "category": "document",
49
+ "obsidianPath": null,
50
+ "savedAt": null,
51
+ "createdAt": "2026-04-12T10:00:00Z"
52
+ }
53
+ ],
54
+ "total": 1
55
+ }
56
+ ```
57
+
58
+ ## GET /api/receipts/summary
59
+
60
+ ```bash
61
+ curl -s "http://localhost:8321/api/receipts/summary"
62
+ ```
63
+
64
+ Returns counts: `{ total, saved, unsaved, byCategory: [{ category, count }] }`.
65
+
66
+ ## POST /api/receipts/:id/download
67
+
68
+ ```bash
69
+ curl -s -X POST "http://localhost:8321/api/receipts/1/download" -o receipt.pdf
70
+ ```
71
+
72
+ Binary stream of the original attachment.
73
+
74
+ ## PATCH /api/receipts/:id
75
+
76
+ ```bash
77
+ # Mark as saved to external Obsidian vault
78
+ curl -s -X PATCH "http://localhost:8321/api/receipts/1" \
79
+ -H "Content-Type: application/json" \
80
+ -d '{"obsidianPath": "receipts/2026/04/amazon-receipt.pdf"}'
81
+
82
+ # Reclassify a receipt
83
+ curl -s -X PATCH "http://localhost:8321/api/receipts/1" \
84
+ -H "Content-Type: application/json" \
85
+ -d '{"category": "travel"}'
86
+ ```
87
+
88
+ ## External-vault save convention
89
+
90
+ Save receipts to `receipts/YYYY/MM/<merchant>-<date>.<ext>` inside
91
+ the external Obsidian vault.
92
+
93
+ Example: `receipts/2026/04/amazon-2026-04-12.pdf`.
@@ -0,0 +1,75 @@
1
+ ---
2
+ kind: reference
3
+ name: travel-bookings-api
4
+ description: /api/travel-bookings reference — filter / upcoming / PATCH status for Gmail-observer-detected flight, hotel, train, restaurant, and bus reservations.
5
+ ---
6
+
7
+ # `/api/travel-bookings` reference
8
+
9
+ The daemon's Gmail observer detects booking confirmation emails from
10
+ airlines, hotels, OTAs, restaurant reservation platforms, and rail
11
+ services. Data is stored in the `travel_bookings` SQLite table.
12
+
13
+ ## GET /api/travel-bookings
14
+
15
+ ```bash
16
+ # All bookings
17
+ curl -s "http://localhost:8321/api/travel-bookings?limit=20"
18
+
19
+ # Filter by type
20
+ curl -s "http://localhost:8321/api/travel-bookings?type=flight"
21
+
22
+ # Upcoming only
23
+ curl -s "http://localhost:8321/api/travel-bookings?status=upcoming"
24
+
25
+ # Date range
26
+ curl -s "http://localhost:8321/api/travel-bookings?from=2026-04-01&to=2026-05-01"
27
+ ```
28
+
29
+ | Param | Type | Default | Description |
30
+ |-------|------|---------|-------------|
31
+ | `type` | string | — | flight, hotel, restaurant, train, bus, other |
32
+ | `status` | string | all | upcoming, completed, cancelled, all |
33
+ | `from` | ISO date | — | Bookings with start_date on or after |
34
+ | `to` | ISO date | — | Bookings with start_date before |
35
+ | `limit` | number | 50 | Max results (1–200) |
36
+
37
+ Response:
38
+
39
+ ```json
40
+ {
41
+ "bookings": [
42
+ {
43
+ "id": 1,
44
+ "type": "flight",
45
+ "provider": "United",
46
+ "destination": null,
47
+ "startDate": "2026-05-15T10:30:00Z",
48
+ "endDate": null,
49
+ "confirmationNumber": "ABC123",
50
+ "amount": 350,
51
+ "currency": "USD",
52
+ "status": "upcoming",
53
+ "providerMsgId": "18f...",
54
+ "createdAt": "2026-04-12T10:00:00Z"
55
+ }
56
+ ],
57
+ "total": 1
58
+ }
59
+ ```
60
+
61
+ ## GET /api/travel-bookings/upcoming
62
+
63
+ Convenience endpoint, sorted by start date.
64
+
65
+ ```bash
66
+ curl -s "http://localhost:8321/api/travel-bookings/upcoming?limit=10"
67
+ ```
68
+
69
+ ## PATCH /api/travel-bookings/:id
70
+
71
+ ```bash
72
+ curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
73
+ -H "Content-Type: application/json" \
74
+ -d '{"status": "completed"}'
75
+ ```
@@ -0,0 +1,59 @@
1
+ ---
2
+ kind: reference
3
+ name: travel-time-api
4
+ description: /api/travel-time reference — Google Maps Directions wrapper. Estimate door-to-door duration and compute departure time for a calendar event with location.
5
+ ---
6
+
7
+ # `/api/travel-time` reference
8
+
9
+ Uses the Google Maps Directions API. Prerequisite: `googleMapsApiKey`
10
+ configured in the daemon's secret store, with the Directions API
11
+ enabled.
12
+
13
+ ## GET /api/travel-time
14
+
15
+ Estimate travel time between two locations.
16
+
17
+ ```bash
18
+ # Transit (default)
19
+ curl -s "http://localhost:8321/api/travel-time?origin=Grand+Central&destination=Times+Square"
20
+
21
+ # Driving with arrival time
22
+ curl -s "http://localhost:8321/api/travel-time?origin=Brooklyn&destination=Newark&mode=driving&arrival=2026-04-12T14:00:00-04:00"
23
+ ```
24
+
25
+ | Param | Type | Default | Description |
26
+ |-------|------|---------|-------------|
27
+ | `origin` | string | (required) | Origin address or place name |
28
+ | `destination` | string | (required) | Destination address or place name |
29
+ | `mode` | string | transit | driving, transit, walking, bicycling |
30
+ | `arrival` | ISO 8601 | — | Desired arrival time (computes departure time) |
31
+
32
+ Response:
33
+
34
+ ```json
35
+ {
36
+ "origin": "Grand Central Terminal, NY",
37
+ "destination": "Times Square, NY",
38
+ "mode": "transit",
39
+ "durationSeconds": 1380,
40
+ "durationText": "23 mins",
41
+ "distanceMeters": 8500,
42
+ "distanceText": "8.5 km",
43
+ "departBy": "2026-04-12T13:34:00.000Z"
44
+ }
45
+ ```
46
+
47
+ ## GET /api/travel-time/for-event/:eventId
48
+
49
+ ```bash
50
+ curl -s "http://localhost:8321/api/travel-time/for-event/abc123?origin=Home&mode=transit"
51
+ ```
52
+
53
+ | Param | Type | Default | Description |
54
+ |-------|------|---------|-------------|
55
+ | `origin` | string | (required) | Your starting location |
56
+ | `mode` | string | transit | Travel mode |
57
+
58
+ Response includes both `event` and `travelTime` blocks; see the route
59
+ implementation for full shape.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Claude Code; `delegatedBackend` is non-Claude). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Claude DM session (`delegatedBackend` is non-Claude). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Codex; `delegatedBackend` is non-Codex). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Codex CLI DM session (`delegatedBackend` is non-Codex). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  ---
5
5
 
6
6
  # Mail (delegated, cross-backend)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in cross-backend delegated mode (DM session is Gemini; `delegatedBackend` is non-Gemini). Gmail accounts route through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct-mode `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is cross-backend delegated from a Gemini CLI DM session (`delegatedBackend` is non-Gemini). Gmail routes through `POST /api/integrations/gmail/exec`; non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  ---
5
5
 
6
6
  # Mail (delegated, cross-backend)
@@ -220,122 +220,17 @@ curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG/body?format=raw&chunk=
220
220
 
221
221
  ## 6. Worked examples
222
222
 
223
- ### Reply with context
224
- ```bash
225
- # 1. Find the thread start local.
226
- curl -s "http://localhost:8321/api/mail/search?q=from:alice+proposal&limit=5"
227
- # → pick the hit, note accountId + providerMsgId.
228
-
229
- # 2. Fetch the thread.
230
- curl -s "http://localhost:8321/api/mail/acct-1/threads/THREAD_ID"
231
- # → last message has rfc822MsgId, references[], providerMsgId.
232
-
233
- # 3. Create a draft threaded to it. Drafts are Autonomous tier.
234
- curl -sX POST "http://localhost:8321/api/mail/acct-1/drafts" \
235
- -H "Content-Type: application/json" \
236
- -d '{
237
- "to": ["alice@example.com"],
238
- "subject": "Re: Proposal",
239
- "textBody": "Thanks Alice — ...",
240
- "reply": {
241
- "inReplyToRfc822Id": "<abc@mail.example.com>",
242
- "references": ["<root@mail.example.com>", "<abc@mail.example.com>"],
243
- "providerThreadId": "THREAD_ID",
244
- "parentProviderMsgId": "PARENT_MSG_ID"
245
- }
246
- }'
247
- ```
223
+ Three direct-mode worked examples — reply with context, file a
224
+ message (read + tag + archive), cross-account search → pick account
225
+ send are in the examples reference below. The delegated /
226
+ native variants of this skill carry their own examples.
248
227
 
249
- ### File a message (read + tag + archive)
250
- ```bash
251
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/read" \
252
- -d '{"read": true}'
253
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/tags" \
254
- -d '{"add": ["followup"], "remove": []}'
255
- curl -sX POST "http://localhost:8321/api/mail/acct-1/messages/MSG/archive"
256
- ```
257
- On IMAP, confirm `followup` is in `GET /mail/:acct/tags` `.userDefined`
258
- first — unknown keywords get dropped.
259
-
260
- ### Cross-account search → pick account → send
261
- ```bash
262
- # Find recipient's earlier emails across all accounts.
263
- curl -s "http://localhost:8321/api/mail/search?q=from:bob@acme.com&limit=10"
264
- # → hits carry accountId. Use whichever account received the earlier thread
265
- # so the reply comes from a familiar address.
266
-
267
- curl -sX POST "http://localhost:8321/api/mail/acct-2/messages/send" \
268
- -H "Content-Type: application/json" \
269
- -d '{"to": ["bob@acme.com"], "subject": "...", "textBody": "..."}'
270
- ```
228
+ {{> ref:examples }}
271
229
 
272
230
  ## 7. API reference
273
231
 
274
- Base URL `http://localhost:8321`. `ACCT` = accountId from `accounts.md`.
275
-
276
- ### Accounts
277
- ```bash
278
- curl -s "http://localhost:8321/api/mail/accounts?active=1"
279
- # → { accounts: [{ id, kind, email, label?, authStatus, idleEnabled, active, createdAt }, ...] }
280
- ```
281
-
282
- ### Search (local FTS5, cross-account)
283
- ```bash
284
- curl -s "http://localhost:8321/api/mail/search?q=...&limit=50&accountId=ACCT"
285
- # → { results: [{ accountId, providerMsgId, subject, snippet, receivedAtUtc,
286
- # from: { email } | null, isRead }], count, query }
287
- ```
288
-
289
- ### Read
290
- ```bash
291
- # List / search via the provider.
292
- curl -s "http://localhost:8321/api/mail/ACCT/messages?q=is:unread&limit=20"
293
- # → { messages: [{ providerMsgId, threadId, from, subject, snippet,
294
- # receivedAtUtc, isRead, flags, hasAttachment }] }
295
-
296
- curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG_ID"
297
- # → { message: { ..., body: { text, html }, attachments: [...] } }
298
-
299
- curl -s "http://localhost:8321/api/mail/ACCT/threads/THREAD_ID"
300
- # → { thread: { threadId, messages: [...], status: "full"|"partial", missingAncestors? } }
301
-
302
- curl -s "http://localhost:8321/api/mail/ACCT/folders"
303
- curl -s "http://localhost:8321/api/mail/ACCT/tags"
304
- ```
305
-
306
- ### Send / draft
307
- ```bash
308
- # Direct send — Autonomous; rejected with 403 when the user has denied
309
- # the send tool. Call /api/notify yourself if the user should know.
310
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/send" \
311
- -H "Content-Type: application/json" \
312
- -d '{"to": [...], "subject": "...", "textBody": "...", "reply"?: {...}}'
313
- # → { result: { id, isDraft: false, rfc822MsgId?, warnings? } }
314
-
315
- # Draft CRUD — Autonomous tier.
316
- curl -s "http://localhost:8321/api/mail/ACCT/drafts"
317
- curl -s "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
318
- curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts" -d '{...}'
319
- curl -sX PATCH "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID" -d '{...}'
320
- # PATCH response: { status, id, warnings? }
321
- # - On Outlook, `warnings: ["reply_threading_immutable_after_create"]` if
322
- # `reply` was supplied — reply headers are fixed at createDraft time.
323
- curl -sX DELETE "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
324
- curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID/send"
325
- ```
232
+ Direct-mode `/api/mail/*` surface accounts, search, read,
233
+ send / draft, modify / move, health — is in the api reference below.
234
+ `ACCT` is the `accountId` resolved per §1.
326
235
 
327
- ### Modify / move
328
- ```bash
329
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/read" -d '{"read": true}'
330
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/tags" -d '{"add": ["Starred"], "remove": []}'
331
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/trash"
332
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/untrash"
333
- curl -sX POST "http://localhost:8321/api/mail/ACCT/messages/MSG_ID/archive"
334
- ```
335
-
336
- ### Health
337
- ```bash
338
- curl -s "http://localhost:8321/api/mail/ACCT/health"
339
- # → { accountId, lastPollAtUtc, lastError, lastErrorAtUtc,
340
- # consecutiveErrorCount, idleFallbackUntilUtc }
341
- ```
236
+ {{> ref:api }}
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Gmail connector your harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Claude (`nativeBackend === "claude"`). Use the in-session Gmail connector directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Codex (`nativeBackend === "codex"`). Use the in-session Gmail connector your Codex harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Codex (`nativeBackend === "codex"`). Use the Gmail connector your Codex harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: mail
3
- description: Load when the task touches Gmail and Gmail is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the in-session Gmail connector your Gemini harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep the direct `/api/mail/*` surface.
3
+ description: Load when the task touches Gmail AND Gmail is in native mode bound to Gemini (`nativeBackend === "gemini"`). Use the Gmail connector your Gemini harness exposes directly; the daemon does not proxy Gmail. Non-Gmail accounts (IMAP/Outlook/iCloud/Yahoo) keep `/api/mail/*`.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read