@aitne-sh/aitne 0.1.0

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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +464 -0
  3. package/agent-assets/agent-profiles/_safety.md +26 -0
  4. package/agent-assets/agent-profiles/conversational.md +33 -0
  5. package/agent-assets/agent-profiles/docs-qa.md +24 -0
  6. package/agent-assets/agent-profiles/observer.md +28 -0
  7. package/agent-assets/agent-profiles/profile-importer.md +63 -0
  8. package/agent-assets/agent-profiles/proxy.md +28 -0
  9. package/agent-assets/agent-profiles/routine.md +16 -0
  10. package/agent-assets/agent-profiles/task.md +18 -0
  11. package/agent-assets/docs/concepts/agent-day.md +88 -0
  12. package/agent-assets/docs/concepts/auth-health.md +75 -0
  13. package/agent-assets/docs/concepts/backends-and-tiers.md +126 -0
  14. package/agent-assets/docs/concepts/costs-and-quotas.md +103 -0
  15. package/agent-assets/docs/concepts/delegated-mode.md +223 -0
  16. package/agent-assets/docs/concepts/memory-model.md +118 -0
  17. package/agent-assets/docs/concepts/observations.md +80 -0
  18. package/agent-assets/docs/concepts/process-keys.md +89 -0
  19. package/agent-assets/docs/concepts/routines.md +108 -0
  20. package/agent-assets/docs/concepts/safety-and-execution.md +109 -0
  21. package/agent-assets/docs/concepts/safety-model.md +279 -0
  22. package/agent-assets/docs/concepts/skills.md +100 -0
  23. package/agent-assets/docs/features/integrations/calendar.md +92 -0
  24. package/agent-assets/docs/features/integrations/git.md +95 -0
  25. package/agent-assets/docs/features/integrations/github.md +170 -0
  26. package/agent-assets/docs/features/integrations/mail.md +106 -0
  27. package/agent-assets/docs/features/integrations/notion.md +69 -0
  28. package/agent-assets/docs/features/integrations/obsidian.md +71 -0
  29. package/agent-assets/docs/features/lifestyle/git.md +178 -0
  30. package/agent-assets/docs/features/lifestyle/reading.md +93 -0
  31. package/agent-assets/docs/features/lifestyle/receipts.md +71 -0
  32. package/agent-assets/docs/features/lifestyle/travel-bookings.md +44 -0
  33. package/agent-assets/docs/features/lifestyle/travel-time.md +52 -0
  34. package/agent-assets/docs/features/memory-files/agent-journal.md +105 -0
  35. package/agent-assets/docs/features/memory-files/projects.md +56 -0
  36. package/agent-assets/docs/features/memory-files/roadmap.md +61 -0
  37. package/agent-assets/docs/features/memory-files/schedule.md +112 -0
  38. package/agent-assets/docs/features/memory-files/today.md +73 -0
  39. package/agent-assets/docs/features/memory-files/user-profile.md +81 -0
  40. package/agent-assets/docs/features/messaging/dashboard-chat.md +93 -0
  41. package/agent-assets/docs/features/messaging/discord.md +50 -0
  42. package/agent-assets/docs/features/messaging/overview.md +111 -0
  43. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +69 -0
  44. package/agent-assets/docs/features/messaging/slack.md +51 -0
  45. package/agent-assets/docs/features/messaging/telegram.md +63 -0
  46. package/agent-assets/docs/features/messaging/whatsapp.md +48 -0
  47. package/agent-assets/docs/features/operations/activity-and-conversations.md +105 -0
  48. package/agent-assets/docs/features/operations/approvals.md +58 -0
  49. package/agent-assets/docs/features/operations/backend-routing.md +62 -0
  50. package/agent-assets/docs/features/operations/cost-tracking.md +59 -0
  51. package/agent-assets/docs/features/operations/notifications.md +69 -0
  52. package/agent-assets/docs/features/operations/quiet-hours.md +106 -0
  53. package/agent-assets/docs/features/operations/schedule-approaching.md +60 -0
  54. package/agent-assets/docs/features/routines/custom-routines.md +101 -0
  55. package/agent-assets/docs/features/routines/evening-review.md +81 -0
  56. package/agent-assets/docs/features/routines/hourly-check.md +85 -0
  57. package/agent-assets/docs/features/routines/monthly-review.md +65 -0
  58. package/agent-assets/docs/features/routines/morning-routine.md +123 -0
  59. package/agent-assets/docs/features/routines/weekly-review.md +70 -0
  60. package/agent-assets/docs/getting-started/01-what-is-this.md +192 -0
  61. package/agent-assets/docs/getting-started/02-first-steps.md +80 -0
  62. package/agent-assets/docs/getting-started/03-what-can-this-do.md +110 -0
  63. package/agent-assets/docs/getting-started/04-first-day.md +287 -0
  64. package/agent-assets/docs/glossary.md +116 -0
  65. package/agent-assets/docs/guides/add-a-custom-routine.md +71 -0
  66. package/agent-assets/docs/guides/backup-and-restore.md +54 -0
  67. package/agent-assets/docs/guides/change-which-model-handles-x.md +47 -0
  68. package/agent-assets/docs/guides/connect-a-new-mail-account.md +59 -0
  69. package/agent-assets/docs/guides/import-knowledge-file.md +275 -0
  70. package/agent-assets/docs/guides/install-and-run.md +72 -0
  71. package/agent-assets/docs/guides/migrate-machines.md +52 -0
  72. package/agent-assets/docs/guides/pause-the-agent.md +65 -0
  73. package/agent-assets/docs/guides/reinstall-cleanly.md +52 -0
  74. package/agent-assets/docs/guides/setup-wizard.md +107 -0
  75. package/agent-assets/docs/guides/switch-default-backend.md +60 -0
  76. package/agent-assets/docs/reference/api.md +51 -0
  77. package/agent-assets/docs/reference/cli-commands.md +121 -0
  78. package/agent-assets/docs/reference/config.md +74 -0
  79. package/agent-assets/docs/reference/disallowed-tools.md +76 -0
  80. package/agent-assets/docs/reference/keyboard-shortcuts.md +39 -0
  81. package/agent-assets/docs/reference/process-keys.md +59 -0
  82. package/agent-assets/docs/reference/skills.md +50 -0
  83. package/agent-assets/docs/troubleshooting/auth-failed.md +57 -0
  84. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +55 -0
  85. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +54 -0
  86. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +53 -0
  87. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +75 -0
  88. package/agent-assets/docs/troubleshooting/observation-not-detected.md +57 -0
  89. package/agent-assets/docs/troubleshooting/quota-exhausted.md +57 -0
  90. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +75 -0
  91. package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +71 -0
  92. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +108 -0
  93. package/agent-assets/project-doc-templates/git-repo.md +21 -0
  94. package/agent-assets/project-doc-templates/project.md +38 -0
  95. package/agent-assets/skills/attach/SKILL.md +104 -0
  96. package/agent-assets/skills/context/SKILL.md +257 -0
  97. package/agent-assets/skills/context/curation.json +37 -0
  98. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +13 -0
  99. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +40 -0
  100. package/agent-assets/skills/docs-search/SKILL.md +176 -0
  101. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +369 -0
  102. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +349 -0
  103. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +347 -0
  104. package/agent-assets/skills/external-services/SKILL.md +371 -0
  105. package/agent-assets/skills/mail/SKILL.delegated.claude.md +284 -0
  106. package/agent-assets/skills/mail/SKILL.delegated.codex.md +261 -0
  107. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +255 -0
  108. package/agent-assets/skills/mail/SKILL.md +313 -0
  109. package/agent-assets/skills/mail/references/errors.md +17 -0
  110. package/agent-assets/skills/mail/references/providers.md +40 -0
  111. package/agent-assets/skills/mail/references/query-grammar.md +24 -0
  112. package/agent-assets/skills/management-policy/SKILL.md +307 -0
  113. package/agent-assets/skills/management-policy/curation.json +13 -0
  114. package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +16 -0
  115. package/agent-assets/skills/management-task-modify/SKILL.md +202 -0
  116. package/agent-assets/skills/management-task-register/SKILL.md +330 -0
  117. package/agent-assets/skills/management-task-stop/SKILL.md +166 -0
  118. package/agent-assets/skills/notify/SKILL.md +196 -0
  119. package/agent-assets/skills/notion/SKILL.delegated.claude.md +254 -0
  120. package/agent-assets/skills/notion/SKILL.delegated.codex.md +195 -0
  121. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +194 -0
  122. package/agent-assets/skills/notion/SKILL.md +86 -0
  123. package/agent-assets/skills/observations/SKILL.md +234 -0
  124. package/agent-assets/skills/observations/curation.json +13 -0
  125. package/agent-assets/skills/observations/seeds/source-namespacing.seed.json +20 -0
  126. package/agent-assets/skills/project-doc/SKILL.md +86 -0
  127. package/agent-assets/skills/project-doc/curation.json +21 -0
  128. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +25 -0
  129. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +20 -0
  130. package/agent-assets/skills/reading/SKILL.md +198 -0
  131. package/agent-assets/skills/reading/references/reading-taste.md +197 -0
  132. package/agent-assets/skills/receipts/SKILL.md +134 -0
  133. package/agent-assets/skills/roadmap/SKILL.md +276 -0
  134. package/agent-assets/skills/roadmap/curation.json +13 -0
  135. package/agent-assets/skills/roadmap/references/horizon-tags.md +40 -0
  136. package/agent-assets/skills/roadmap/references/preparation-timeline.md +47 -0
  137. package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +16 -0
  138. package/agent-assets/skills/schedule/SKILL.md +228 -0
  139. package/agent-assets/skills/scheduled-managed-task/SKILL.md +392 -0
  140. package/agent-assets/skills/today/SKILL.md +198 -0
  141. package/agent-assets/skills/today/curation.json +21 -0
  142. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +17 -0
  143. package/agent-assets/skills/today/seeds/section-shape.seed.json +17 -0
  144. package/agent-assets/skills/travel/SKILL.md +132 -0
  145. package/agent-assets/skills/travel-time/SKILL.md +149 -0
  146. package/agent-assets/skills/user-interview/SKILL.md +323 -0
  147. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +94 -0
  148. package/agent-assets/skills/user-profile/SKILL.md +210 -0
  149. package/agent-assets/skills/user-profile/curation.json +29 -0
  150. package/agent-assets/skills/user-profile/seeds/learned-context-format.seed.json +14 -0
  151. package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +53 -0
  152. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +27 -0
  153. package/agent-assets/task-flows/dashboard.docs_qa.md +43 -0
  154. package/agent-assets/task-flows/default.md +11 -0
  155. package/agent-assets/task-flows/git.branch.created.md +25 -0
  156. package/agent-assets/task-flows/git.lifecycle.poll.md +52 -0
  157. package/agent-assets/task-flows/git.local_ahead.stale.md +34 -0
  158. package/agent-assets/task-flows/git.merge_to_default.md +30 -0
  159. package/agent-assets/task-flows/git.project.refresh_architecture.md +100 -0
  160. package/agent-assets/task-flows/git.project.retemplate.md +73 -0
  161. package/agent-assets/task-flows/git.push.detected.md +32 -0
  162. package/agent-assets/task-flows/git.push.force_pushed.md +36 -0
  163. package/agent-assets/task-flows/git.tag.created.md +24 -0
  164. package/agent-assets/task-flows/github.assigned.md +43 -0
  165. package/agent-assets/task-flows/github.pull_request.review_requested.md +57 -0
  166. package/agent-assets/task-flows/github.security_alert.md +45 -0
  167. package/agent-assets/task-flows/github.workflow_run.failed.md +57 -0
  168. package/agent-assets/task-flows/knowledge.import.md +161 -0
  169. package/agent-assets/task-flows/message.received.dm.md +142 -0
  170. package/agent-assets/task-flows/message.received.dm_first.md +117 -0
  171. package/agent-assets/task-flows/message.received.md +14 -0
  172. package/agent-assets/task-flows/routine.custom.md +38 -0
  173. package/agent-assets/task-flows/routine.evening_review.md +323 -0
  174. package/agent-assets/task-flows/routine.hourly_check.delegated.claude.md +405 -0
  175. package/agent-assets/task-flows/routine.hourly_check.delegated.codex.md +400 -0
  176. package/agent-assets/task-flows/routine.hourly_check.delegated.gemini.md +404 -0
  177. package/agent-assets/task-flows/routine.hourly_check.md +184 -0
  178. package/agent-assets/task-flows/routine.hourly_check.triage.md +93 -0
  179. package/agent-assets/task-flows/routine.monthly_review.md +250 -0
  180. package/agent-assets/task-flows/routine.morning_routine.md +300 -0
  181. package/agent-assets/task-flows/routine.morning_routine_initial.md +184 -0
  182. package/agent-assets/task-flows/routine.roadmap_refresh.md +275 -0
  183. package/agent-assets/task-flows/routine.today_refresh.md +172 -0
  184. package/agent-assets/task-flows/routine.user_profile_sweep.md +242 -0
  185. package/agent-assets/task-flows/routine.weekly_review.md +247 -0
  186. package/agent-assets/task-flows/schedule.approaching.md +124 -0
  187. package/agent-assets/task-flows/scheduled.dm.md +391 -0
  188. package/agent-assets/task-flows/scheduled.task.md +141 -0
  189. package/agent-assets/task-flows/setup.initial.md +277 -0
  190. package/agent-assets/task-flows/setup.update.md +53 -0
  191. package/agent-assets/templates/README.md +85 -0
  192. package/agent-assets/templates/_index.md +39 -0
  193. package/agent-assets/templates/_manifest.json +103 -0
  194. package/agent-assets/templates/agent/journal.md +10 -0
  195. package/agent-assets/templates/agent/profile-questions.md +74 -0
  196. package/agent-assets/templates/context-index.md +42 -0
  197. package/agent-assets/templates/dossiers/_index.md +22 -0
  198. package/agent-assets/templates/dossiers/evening.md +23 -0
  199. package/agent-assets/templates/dossiers/hourly.md +23 -0
  200. package/agent-assets/templates/dossiers/monthly.md +23 -0
  201. package/agent-assets/templates/dossiers/morning.md +23 -0
  202. package/agent-assets/templates/dossiers/roadmap.md +23 -0
  203. package/agent-assets/templates/dossiers/weekly.md +23 -0
  204. package/agent-assets/templates/projects/_active.base +14 -0
  205. package/agent-assets/templates/projects/_index.md +29 -0
  206. package/agent-assets/templates/roadmap.md +15 -0
  207. package/agent-assets/templates/routines/_index.md +20 -0
  208. package/agent-assets/templates/routines/evening.md +22 -0
  209. package/agent-assets/templates/routines/hourly.md +30 -0
  210. package/agent-assets/templates/routines/monthly.md +25 -0
  211. package/agent-assets/templates/routines/morning.md +26 -0
  212. package/agent-assets/templates/routines/weekly.md +23 -0
  213. package/agent-assets/templates/rules/_index.md +19 -0
  214. package/agent-assets/templates/rules/journal-export.md +41 -0
  215. package/agent-assets/templates/rules/journal-format.md +61 -0
  216. package/agent-assets/templates/rules/management.md +48 -0
  217. package/agent-assets/templates/rules/mcp.md +40 -0
  218. package/agent-assets/templates/rules/policies/_index.md +22 -0
  219. package/agent-assets/templates/rules/redaction.md +30 -0
  220. package/agent-assets/templates/today.md +13 -0
  221. package/agent-assets/templates/user/_index.md +16 -0
  222. package/agent-assets/templates/user/expertise.md +7 -0
  223. package/agent-assets/templates/user/goals.md +7 -0
  224. package/agent-assets/templates/user/people.md +7 -0
  225. package/agent-assets/templates/user/personal.md +7 -0
  226. package/agent-assets/templates/user/profile.md +28 -0
  227. package/agent-assets/templates/user/work.md +7 -0
  228. package/bin/aitne.mjs +1096 -0
  229. package/package.json +78 -0
  230. package/personal-agent.mjs +39 -0
  231. package/scripts/browser.mjs +99 -0
  232. package/scripts/check-redaction-coverage.mjs +109 -0
  233. package/scripts/commands/audit.mjs +309 -0
  234. package/scripts/commands/doctor.mjs +437 -0
  235. package/scripts/commands/open.mjs +40 -0
  236. package/scripts/commands/setup.mjs +21 -0
  237. package/scripts/commands/uninstall.mjs +114 -0
  238. package/scripts/commands/update.mjs +96 -0
  239. package/scripts/commands/version.mjs +62 -0
  240. package/scripts/commands.md +0 -0
  241. package/scripts/lib/sqlite-loader.mjs +49 -0
  242. package/scripts/message-discipline-digest.mjs +535 -0
  243. package/scripts/poc/google-connector-inheritance/REPORT.md +197 -0
  244. package/scripts/poc/google-connector-inheritance/claude-sdk-probe.mjs +79 -0
  245. package/scripts/remint-roadmap-ids.mjs +257 -0
  246. package/scripts/rm-paths.mjs +22 -0
  247. package/scripts/run-node.mjs +223 -0
  248. package/scripts/smoke-obsidian-api.mjs +166 -0
  249. package/scripts/start.mjs +160 -0
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: travel
3
+ description: Load when the user asks about an upcoming trip or reservation, morning routines need to surface travel within the next 7 days, or reviews need a travel overview — flight, hotel, restaurant, train, and bus bookings detected by the Gmail observer.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Read
7
+ ---
8
+
9
+ # Travel & Booking Tracker
10
+
11
+ The daemon's Gmail observer detects booking confirmation emails from airlines,
12
+ hotels, OTAs, restaurant reservation platforms, and rail services. Data is
13
+ stored in the `travel_bookings` SQLite table.
14
+
15
+ ## When to Use
16
+
17
+ - **Morning routine**: include upcoming travel/bookings in today.md.
18
+ - **Evening review**: report newly detected bookings.
19
+ - **User asks about trips/reservations**: query bookings and summarize.
20
+ - **Pre-trip reminders**: surface upcoming travel day before departure.
21
+
22
+ ## Workflow
23
+
24
+ 1. Fetch upcoming bookings from `/api/travel-bookings/upcoming`.
25
+ 2. For morning routine, highlight bookings within the next 7 days.
26
+ 3. For evening review, check for newly detected bookings (today's createdAt).
27
+
28
+ ---
29
+
30
+ ## API Reference
31
+
32
+ Base URL: `http://localhost:8321`
33
+
34
+ ### GET /api/travel-bookings
35
+
36
+ List travel bookings with optional filters.
37
+
38
+ ```bash
39
+ # All bookings
40
+ curl -s "http://localhost:8321/api/travel-bookings?limit=20"
41
+
42
+ # Filter by type
43
+ curl -s "http://localhost:8321/api/travel-bookings?type=flight"
44
+
45
+ # Upcoming only
46
+ curl -s "http://localhost:8321/api/travel-bookings?status=upcoming"
47
+
48
+ # Date range
49
+ curl -s "http://localhost:8321/api/travel-bookings?from=2026-04-01&to=2026-05-01"
50
+ ```
51
+
52
+ | Param | Type | Default | Description |
53
+ |-------|------|---------|-------------|
54
+ | `type` | string | — | flight, hotel, restaurant, train, bus, other |
55
+ | `status` | string | all | upcoming, completed, cancelled, all |
56
+ | `from` | ISO date | — | Bookings with start_date on or after |
57
+ | `to` | ISO date | — | Bookings with start_date before |
58
+ | `limit` | number | 50 | Max results (1–200) |
59
+
60
+ Response:
61
+ ```json
62
+ {
63
+ "bookings": [
64
+ {
65
+ "id": 1,
66
+ "type": "flight",
67
+ "provider": "United",
68
+ "destination": null,
69
+ "startDate": "2026-05-15T10:30:00Z",
70
+ "endDate": null,
71
+ "confirmationNumber": "ABC123",
72
+ "amount": 350,
73
+ "currency": "USD",
74
+ "status": "upcoming",
75
+ "gmailMessageId": "18f...",
76
+ "createdAt": "2026-04-12T10:00:00Z"
77
+ }
78
+ ],
79
+ "total": 1
80
+ }
81
+ ```
82
+
83
+ ### GET /api/travel-bookings/upcoming
84
+
85
+ Convenience endpoint for upcoming bookings sorted by start date.
86
+
87
+ ```bash
88
+ curl -s "http://localhost:8321/api/travel-bookings/upcoming?limit=10"
89
+ ```
90
+
91
+ ### PATCH /api/travel-bookings/:id
92
+
93
+ Update booking status or destination.
94
+
95
+ ```bash
96
+ curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
97
+ -H "Content-Type: application/json" \
98
+ -d '{"status": "completed"}'
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Formatting Guide
104
+
105
+ ### Morning routine — today.md
106
+
107
+ ```
108
+ ## Travel & Reservations
109
+ Upcoming flight: United to SFO (May 15) — confirmation ABC123
110
+ Hotel: Marriott SF (May 15-17) — confirmation XYZ789
111
+ Restaurant: OpenTable reservation tonight 19:00
112
+ ```
113
+
114
+ Omit section if no upcoming bookings within 7 days.
115
+
116
+ ### Evening review
117
+
118
+ ```
119
+ ## New Bookings Detected
120
+ - United flight: May 15, confirmation ABC123, $350
121
+ ```
122
+
123
+ ### Booking type display names
124
+
125
+ | type value | Display name |
126
+ |------------|-------------|
127
+ | flight | Flight |
128
+ | hotel | Hotel |
129
+ | restaurant | Restaurant |
130
+ | train | Train |
131
+ | bus | Bus |
132
+ | other | Reservation |
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: travel-time
3
+ description: Load when a calendar event needs a departure time, the user asks about commute / transit duration, or a reminder includes "leave by HH:MM".
4
+ when_to_use: Backed by Google Maps Directions — requires `googleMapsApiKey` in the daemon secret store; falls back gracefully when missing.
5
+ allowed-tools:
6
+ - Bash(curl *)
7
+ - Read
8
+ ---
9
+
10
+ # Travel Time & Commute Optimizer
11
+
12
+ Uses the Google Maps Directions API to estimate travel time between locations.
13
+ Integrates with the calendar to compute departure times for events with
14
+ location fields.
15
+
16
+ **Prerequisite**: Google Maps API key must be configured in the daemon's
17
+ secret store (`googleMapsApiKey`). The API key needs the Directions API
18
+ enabled.
19
+
20
+ ## When to Use
21
+
22
+ - **Morning routine**: check today's calendar events with locations,
23
+ compute departure times, add to today.md.
24
+ - **User asks about commute/travel time**: query specific routes.
25
+ - **Pre-event reminders**: DM departure time suggestions.
26
+
27
+ ## Workflow
28
+
29
+ 1. Fetch today's calendar events. The right call depends on the current
30
+ Google Calendar mode (read `<integration_modes>` injected at session
31
+ start):
32
+ <!-- mode:direct:google_calendar -->
33
+ Direct mode → `GET /api/calendar/events?date=today&days=1`
34
+ (see the `external-services` skill).
35
+ <!-- /mode:direct:google_calendar -->
36
+ <!-- mode:delegated-same:google_calendar -->
37
+ Same-backend delegated → use this session backend's native Calendar
38
+ list-events MCP tool. `/api/calendar/events` returns 410.
39
+ <!-- /mode:delegated-same:google_calendar -->
40
+ <!-- mode:delegated-cross:google_calendar -->
41
+ Cross-backend delegated → `POST /api/integrations/google_calendar/exec`
42
+ with a natural-language `task` + `outputSchema` (see the
43
+ `external-services` skill — cross-backend variant for worked
44
+ examples).
45
+ <!-- /mode:delegated-cross:google_calendar -->
46
+ <!-- mode:disabled:google_calendar -->
47
+ Disabled → skip this skill; there is no calendar to source events from.
48
+ <!-- /mode:disabled:google_calendar -->
49
+ 2. For events with a `location` field, call `/api/travel-time` or
50
+ `/api/travel-time/for-event/:eventId` to get travel duration.
51
+ 3. Include departure time recommendations in today.md or DM.
52
+
53
+ ---
54
+
55
+ ## API Reference
56
+
57
+ Base URL: `http://localhost:8321`
58
+
59
+ ### GET /api/travel-time
60
+
61
+ Estimate travel time between two locations.
62
+
63
+ ```bash
64
+ # Transit (default)
65
+ curl -s "http://localhost:8321/api/travel-time?origin=Grand+Central&destination=Times+Square"
66
+
67
+ # Driving with arrival time
68
+ curl -s "http://localhost:8321/api/travel-time?origin=Brooklyn&destination=Newark&mode=driving&arrival=2026-04-12T14:00:00-04:00"
69
+ ```
70
+
71
+ | Param | Type | Default | Description |
72
+ |-------|------|---------|-------------|
73
+ | `origin` | string | (required) | Origin address or place name |
74
+ | `destination` | string | (required) | Destination address or place name |
75
+ | `mode` | string | transit | driving, transit, walking, bicycling |
76
+ | `arrival` | ISO 8601 | — | Desired arrival time (computes departure time) |
77
+
78
+ Response:
79
+ ```json
80
+ {
81
+ "origin": "Grand Central Terminal, NY",
82
+ "destination": "Times Square, NY",
83
+ "mode": "transit",
84
+ "durationSeconds": 1380,
85
+ "durationText": "23 mins",
86
+ "distanceMeters": 8500,
87
+ "distanceText": "8.5 km",
88
+ "departBy": "2026-04-12T13:34:00.000Z"
89
+ }
90
+ ```
91
+
92
+ ### GET /api/travel-time/for-event/:eventId
93
+
94
+ Estimate travel time for a specific calendar event.
95
+
96
+ ```bash
97
+ curl -s "http://localhost:8321/api/travel-time/for-event/abc123?origin=Home&mode=transit"
98
+ ```
99
+
100
+ | Param | Type | Default | Description |
101
+ |-------|------|---------|-------------|
102
+ | `origin` | string | (required) | Your starting location |
103
+ | `mode` | string | transit | Travel mode |
104
+
105
+ Response:
106
+ ```json
107
+ {
108
+ "event": {
109
+ "id": "abc123",
110
+ "summary": "Team meeting",
111
+ "location": "WeWork Times Square",
112
+ "start": "2026-04-12T14:00:00-04:00"
113
+ },
114
+ "travelTime": {
115
+ "origin": "Home, NY",
116
+ "destination": "WeWork Times Square, NY",
117
+ "mode": "transit",
118
+ "durationSeconds": 2400,
119
+ "durationText": "40 mins",
120
+ "distanceMeters": 15000,
121
+ "distanceText": "15 km",
122
+ "departBy": "2026-04-12T13:16:00.000Z"
123
+ }
124
+ }
125
+ ```
126
+
127
+ ---
128
+
129
+ ## Formatting Guide
130
+
131
+ ### Morning routine — today.md
132
+
133
+ ```
134
+ ## Commute & Travel
135
+ 14:00 Team meeting @ WeWork Times Square — depart by 13:15 (transit, 40 min)
136
+ 18:30 Dinner @ Restaurant ABC — depart by 18:00 (transit, 25 min)
137
+ ```
138
+
139
+ Only include events that have a `location` field.
140
+ Omit section if no events with locations today.
141
+
142
+ ### Mode display names
143
+
144
+ | mode | Display |
145
+ |------|---------|
146
+ | transit | Transit |
147
+ | driving | Driving |
148
+ | walking | Walking |
149
+ | bicycling | Bicycle |
@@ -0,0 +1,323 @@
1
+ ---
2
+ name: user-interview
3
+ description: Read or modify the profile-interview queue at agent/profile-questions.md. Pick a question (latent), weave a latent question into a natural reply, tick when the user answers, fallback-promote stale rows, or reconcile against user/*.md. Never sends cold standalone DMs.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Read
7
+ ---
8
+
9
+ # Profile Interview Queue Skill
10
+
11
+ The agent has a slow-pace queue of profile facts to learn (name,
12
+ timezone, location, work, hobbies, …). Questions are NOT pushed at the
13
+ user as cold scheduled DMs. They wait in **latent** state until a
14
+ natural opportunity arrives (a topically-related inbound DM, or the
15
+ morning briefing). This skill is how every callsite touches that queue.
16
+
17
+ ## Source-of-truth file
18
+
19
+ **`agent/profile-questions.md`** — agent-internal markdown. Three
20
+ top-level sections: `## Pending`, `## In Progress`, `## Answered`.
21
+ Never auto-injected into prompts; load only when this skill is in use.
22
+
23
+ ```bash
24
+ curl -s http://localhost:8321/api/context/agent/profile-questions
25
+ ```
26
+
27
+ ### Pending row format
28
+
29
+ ```
30
+ - [ ] (PRIO) <id> :: <target_path[ ## Section]> [:: match=<anchor>] :: <ask-hint in English> [<!-- last_attempted=YYYY-MM-DD -->]
31
+ ```
32
+
33
+ | Field | Meaning |
34
+ |---|---|
35
+ | `PRIO` | `HIGH` / `MID` / `LOW` — selection priority |
36
+ | `<id>` | snake_case unique. Doubles as the correlation id in any scheduled DM description (`profile_interview:<id> — <hint>`) |
37
+ | `target_path` | which user file the answer should land in, e.g. `user/profile.md` |
38
+ | `## Section` | optional — narrows to a section within the target file |
39
+ | `match=<anchor>` | optional — bullet key (English, like `Name`, `Timezone`, `Sleep`, `Working hours`). Required when multiple rows share a section, or when setup pre-seeds the section with an unrelated bullet |
40
+ | `ask-hint` | English brief of WHAT to ask. Render the actual DM in the user's `primary_language` at delivery time |
41
+ | `last_attempted=...` | optional inline HTML comment maintained by the evening sweep — selector deprioritises rows whose comment is < 7 days old |
42
+
43
+ ### In Progress entry format
44
+
45
+ ```
46
+ - <id> :: state=<state> :: since=<YYYY-MM-DD> [:: scheduled_at=<ISO>] [:: asked_at=<ISO>]
47
+ ```
48
+
49
+ `since=` is the agent-day date the entry was first added (set by the
50
+ morning routine when picking the question). Load-bearing: the evening
51
+ sweep's latent-fallback promotion (Operation 5B) computes
52
+ `today − since` to decide whether ≥ 3 days have elapsed without an
53
+ opportunity. Without it the sweep cannot tell a day-1 latent row from a
54
+ day-3 one. `since=` is preserved across `state=latent → asked → resolved`
55
+ transitions; only the state field flips.
56
+
57
+ State machine:
58
+
59
+ ```
60
+ Pending
61
+ └── morning routine Step 7.5 ──▶ latent
62
+
63
+ ┌─ DM-handler topic match ┘
64
+ │ / briefing piggyback
65
+
66
+ asked ──── user replies ────▶ resolved (Pending row [x])
67
+
68
+ └─ scheduled (fallback) ── fires DM ─┐
69
+ ▲ │
70
+ │ 3 days latent + active user │
71
+ └─────────────────────────────────┘
72
+ ```
73
+
74
+ - The DM-handler queue-flip MUST gate on `state=asked` only. An
75
+ unrelated 09:00 DM cannot close out a 14:00 question that has not
76
+ been asked yet.
77
+
78
+ ### Answered entry format
79
+
80
+ Append-only log:
81
+
82
+ ```
83
+ - [x] YYYY-MM-DD → <id> (<source>)
84
+ ```
85
+
86
+ Sources:
87
+ - `(DM)` — user answered in chat (load-bearing: never untick)
88
+ - `(import:<source>)` — profile import migration (never untick)
89
+ - `(reconciled:skeleton|morning|opportunity|fire-time|sweep)` — heuristic / LLM closure
90
+
91
+ ## "Section is filled" check (Layers 2/3/5)
92
+
93
+ Before scheduling or asking, every callsite SHOULD verify the target
94
+ slot is genuinely empty:
95
+
96
+ ```bash
97
+ curl -s "http://localhost:8321/api/profile-questions/slot-filled?path=user/profile.md&section=Identity&anchor=Name"
98
+ # → {"filled":true|false,"sectionPresent":true|false,"fileExists":true|false,...}
99
+ ```
100
+
101
+ This wraps the canonical TS helper. Use it — do NOT re-derive the rule
102
+ in prose. URL-encode `section` and `anchor` if they contain spaces.
103
+
104
+ ## Operation 1 — Pick a question (morning routine Step 7.5)
105
+
106
+ ```
107
+ 1. GET agent/profile-questions.md.
108
+ 2. Skip the entire step if any of:
109
+ - ## In Progress is non-empty.
110
+ - ## Pending is empty.
111
+ - User has not sent a DM in the last 24h.
112
+ - Day-type focus for [personal] on line 2 of <today> is `off`.
113
+ - The current run is the initial morning routine
114
+ (`routine.morning_routine_initial`) — it lands during setup; piling
115
+ on a question is bad UX.
116
+ 3. Walk Pending rows in priority order (HIGH → MID → LOW, then file
117
+ order). For each candidate:
118
+ a. If the row carries `<!-- last_attempted=YYYY-MM-DD -->` and that
119
+ date is within the last 7 days, skip — cooldown.
120
+ b. Call /api/profile-questions/slot-filled for the row's target. If
121
+ the slot turns out to be filled (Layer 2 catches drift since
122
+ last sweep), tick the row [x] (read-rebuild + replace) and
123
+ append `- [x] <today> → <id> (reconciled:morning)` to ## Answered.
124
+ Continue to the next candidate.
125
+ c. Otherwise, this is the chosen row. Stop walking.
126
+ 4. Append a single line to today.md ## Agent Notes (latent-question
127
+ flavor, see "Today.md surfacing" below):
128
+ `- Profile question (latent): <id> — wait for natural opportunity`
129
+ 5. Append to ## In Progress in the queue file (PATCH replace, read-rebuild):
130
+ `- <id> :: state=latent :: since=<today>`
131
+ The `since=` date is load-bearing — the evening sweep needs it to
132
+ compute the 3-day fallback threshold.
133
+ 6. Do NOT POST /api/schedule for this row. Latent rows are NOT
134
+ scheduled DMs — they wait for an opportunity.
135
+ ```
136
+
137
+ ## Operation 2 — Latent opportunity check (DM handler)
138
+
139
+ Run this AFTER the standard "Capture user info" block in
140
+ `message.received.dm.md` / `message.received.dm_first.md`, BEFORE
141
+ composing the reply.
142
+
143
+ ```
144
+ 1. GET agent/profile-questions.md ## In Progress.
145
+ 2. If no entry has state=latent, skip — return to the normal reply path.
146
+ 2.5 Slot-filled pre-check (MANDATORY before any weaving decision).
147
+ GET /api/profile-questions/slot-filled?path=<target>&section=<section?>&anchor=<anchor?>
148
+ for the latent row's target. If `filled: true`, the slot was filled
149
+ between morning routine and now (the user may have volunteered the
150
+ answer in a previous DM, or the sweep that runs at 17:50 hasn't
151
+ caught up yet). Resolve the row instead of weaving:
152
+ - Tick the matching ## Pending row [ ] → [x] (read-rebuild + replace).
153
+ - Remove the entry from ## In Progress.
154
+ - Append `- [x] <today> → <id> (reconciled:opportunity)` to ## Answered.
155
+ - Remove the matching `Profile question (latent): <id>` line from
156
+ today.md ## Agent Notes.
157
+ Return to the normal reply path — DO NOT weave a question. The user
158
+ has effectively already answered it.
159
+ 3. Otherwise (slot still empty), judge whether the inbound DM is a
160
+ natural moment to ask the question. The criteria:
161
+ - Topic match. The user's message touches the question's domain
162
+ (work questions when the user mentions a meeting, code, deadline;
163
+ personal questions when the user discusses lifestyle, hobbies,
164
+ weekend plans; identity / location questions when the user makes
165
+ a general greeting on day 1 or asks for time/weather).
166
+ - Length appropriateness. Your reply will be more than a one-liner;
167
+ there is room to weave a question without making the message look
168
+ forced.
169
+ - Mood appropriateness. The user is not venting / in crisis / asking
170
+ a single short factual question.
171
+ 4. If yes:
172
+ a. Compose the reply with the question woven in NATURALLY. Do NOT
173
+ make a separate paragraph or "By the way, …" preamble. The
174
+ question should feel like a side comment, not an interview cue.
175
+ b. After the reply is ready (final assistant text already includes
176
+ the question), issue **two PATCH replaces** (separate calls —
177
+ they target different files):
178
+ - `PATCH /api/context/agent/profile-questions` section=in_progress
179
+ — flip the entry to
180
+ `state=asked :: since=<unchanged> :: asked_at=<current_time>`
181
+ (preserve the original `since=` date).
182
+ - `PATCH /api/context/today` section=agent_notes — replace the
183
+ parenthetical from `(latent)` to `(asked HH:MM)` and append
184
+ `(asked HH:MM)` to the same line; preserve every other Agent
185
+ Notes line byte-for-byte.
186
+ 5. If no, leave the latent entry untouched. Return to the normal reply
187
+ path. The opportunity will come (or the evening sweep will eventually
188
+ promote to a fallback scheduled DM if it doesn't).
189
+ ```
190
+
191
+ ## Operation 3 — Latent piggyback (morning briefing composition)
192
+
193
+ Mirror of Operation 2, run inside the `## Morning briefing` sub-flow of
194
+ `scheduled.dm.md`. The briefing is already an outgoing DM the agent
195
+ composes; it is one of the few naturally-occurring opportunities to
196
+ slip in a question.
197
+
198
+ ```
199
+ 1. GET agent/profile-questions.md ## In Progress.
200
+ 2. If no entry has state=latent, skip.
201
+ 2.5 Slot-filled pre-check (MANDATORY). Same recipe as Operation 2 step 2.5:
202
+ GET /api/profile-questions/slot-filled. If `filled: true`, resolve
203
+ the row (tick Pending, remove In Progress, append
204
+ `- [x] <today> → <id> (reconciled:opportunity)` to Answered, remove
205
+ the matching `Profile question (latent):` line from today.md ## Agent Notes) and
206
+ skip the piggyback — DO NOT weave the question.
207
+ 3. Decide whether the briefing's main content overlaps with the
208
+ question's domain (work questions when the day is calendar-heavy
209
+ with work meetings; personal questions when the day is light /
210
+ personal). If yes, weave one question into the briefing as a closing
211
+ side note. Same naturalness rules as Operation 2 — no preamble, no
212
+ separate paragraph.
213
+ 4. After composing, issue two PATCH replaces (separate calls):
214
+ - `PATCH /api/context/agent/profile-questions` section=in_progress —
215
+ flip the entry to
216
+ `state=asked :: since=<unchanged> :: asked_at=<current_time>`.
217
+ - `PATCH /api/context/today` section=agent_notes — flip the matching
218
+ `Profile question (latent):` line by changing the parenthetical to
219
+ `(asked HH:MM)`.
220
+ ```
221
+
222
+ ## Operation 4 — Capture the answer (DM handler queue reconcile)
223
+
224
+ Run this AFTER "Capture user info" and Operation 2's opportunity check,
225
+ BEFORE composing the reply text.
226
+
227
+ ```
228
+ 1. GET agent/profile-questions.md ## In Progress.
229
+ 2. If an entry has state=asked AND (now − asked_at) < 24h:
230
+ a. Tick the matching ## Pending row [ ] → [x] via PATCH replace
231
+ (read-rebuild full Pending body, change just that one line).
232
+ b. Remove the entry from ## In Progress (PATCH replace).
233
+ c. Append `- [x] <today> → <id> (DM)` to ## Answered.
234
+ d. Remove the matching today.md ## Agent Notes line — match by
235
+ the `Profile question (` prefix and the `: <id>` id segment;
236
+ works for both `(asked HH:MM)` and `(latent)` parenthetical
237
+ states (PATCH replace, read-rebuild — preserve every other line
238
+ byte-for-byte). Without this the line lingers in today.md
239
+ until tomorrow's PUT-replace and confuses the user.
240
+ 3. If state=latent or state=scheduled, leave the entry alone — this
241
+ inbound DM is by definition unrelated to a question the user has
242
+ not been asked.
243
+ ```
244
+
245
+ The "one DM after fire = one tick" rule is intentional. Trying to detect
246
+ "did the user ACTUALLY answer?" is unreliable and would re-ask forever
247
+ on partial answers. The 7-day `last_attempted` cooldown means an
248
+ unresolved fact will surface again later through the natural-volunteering
249
+ path or the next opportunity.
250
+
251
+ {{> ref:sweep-and-fallback }}
252
+
253
+ ## Today.md surfacing — Agent Notes flavor
254
+
255
+ A latent question is mirrored to today.md ## Agent Notes for visibility.
256
+ This is informational only — Agent Plan keeps its strict HH:MM-+-schedule
257
+ contract; latent rows do NOT belong there.
258
+
259
+ ```
260
+ - Profile question (latent): <id> — wait for natural opportunity
261
+ - Profile question (asked HH:MM): <id> # after Operation 2/3/6
262
+ ```
263
+
264
+ The morning routine writes the `(latent)` line. The DM handler /
265
+ morning briefing flips the parenthetical to `(asked HH:MM)` when the
266
+ question is woven into a reply. The evening sweep's stale recovery
267
+ removes the line entirely if the user did not reply within 24h.
268
+
269
+ ## Anchor convention — load-bearing
270
+
271
+ The heuristic anchor lookup matches against bullet keys written by the
272
+ **user-profile** skill: English label keys, any-language values:
273
+
274
+ ```
275
+ - Name: Alex
276
+ - Timezone: America/New_York
277
+ - Working hours: Weekdays 09:00–18:00
278
+ - Sleep: 23:00–07:00
279
+ ```
280
+
281
+ Anchors in `agent/profile-questions.md` MUST match these English keys —
282
+ not the user's primary-language phrasing. If a future `user-profile`
283
+ schema change introduces non-English keys, Layers 1–3 silently miss
284
+ those bullets and the system degrades to Layer-4-only protection
285
+ (≤ 24h staleness). Cross-reference: `agent-assets/skills/user-profile/SKILL.md`
286
+ §"File schema" + `setup.initial.md` (canonical bullet examples).
287
+
288
+ ## Rules
289
+
290
+ - Never ask via cold standalone DM if a natural opportunity is plausible.
291
+ - Never weave a question that is unrelated to the current conversation
292
+ topic — better to wait.
293
+ - Never ask twice the same agent-day.
294
+ - Never tick a row whose target section is genuinely placeholder-only.
295
+ - Never write to ## Pending from any callsite other than skeleton seeding,
296
+ Layer 4 untick (sweep), and Phase 2 evening-review extension.
297
+ - Never ask the user identity-class confirmations (name, timezone,
298
+ primary_language) twice — these have explicit setup paths; if they
299
+ are still empty after setup, the queue may ask once.
300
+
301
+ ## API quick reference
302
+
303
+ ```bash
304
+ # Read the queue
305
+ curl -s http://localhost:8321/api/context/agent/profile-questions
306
+
307
+ # Slot-filled probe
308
+ curl -s "http://localhost:8321/api/profile-questions/slot-filled?path=user/profile.md&section=Identity&anchor=Name"
309
+
310
+ # Section-level edit (queue file uses the standard context API)
311
+ curl -s -X PATCH http://localhost:8321/api/context/agent/profile-questions \
312
+ -H 'Content-Type: application/json' \
313
+ -d '{"section": "in_progress", "mode": "replace", "content": "- name :: state=latent"}'
314
+
315
+ # Fallback DM scheduling (Operation 5B only)
316
+ curl -s -X POST http://localhost:8321/api/schedule \
317
+ -H 'Content-Type: application/json' \
318
+ -d '{"time":"<ISO>","taskType":"dm_session","description":"profile_interview:<id> — <hint>","model":"sonnet","taskContext":{"scheduledBy":"user_profile_sweep_fallback","queueId":"<id>","importance":"low"}}'
319
+ ```
320
+
321
+ The PATCH `section` argument is snake_case of the heading: `pending`,
322
+ `in_progress`, `answered`. Read-before-write applies to every PATCH
323
+ replace.