@aitne-sh/aitne 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +36 -6
  2. package/agent-assets/docs/concepts/agent-day.md +2 -2
  3. package/agent-assets/docs/concepts/costs-and-quotas.md +4 -3
  4. package/agent-assets/docs/concepts/delegated-mode.md +5 -5
  5. package/agent-assets/docs/concepts/memory-model.md +6 -3
  6. package/agent-assets/docs/concepts/safety-model.md +19 -16
  7. package/agent-assets/docs/concepts/skills.md +2 -2
  8. package/agent-assets/docs/features/integrations/browser-history.md +9 -8
  9. package/agent-assets/docs/features/integrations/calendar.md +4 -4
  10. package/agent-assets/docs/features/integrations/mail.md +3 -2
  11. package/agent-assets/docs/features/lifestyle/git.md +3 -3
  12. package/agent-assets/docs/features/lifestyle/reading.md +15 -8
  13. package/agent-assets/docs/features/lifestyle/travel-bookings.md +4 -3
  14. package/agent-assets/docs/features/memory-files/agent-journal.md +30 -12
  15. package/agent-assets/docs/features/memory-files/agent-lessons.md +177 -0
  16. package/agent-assets/docs/features/memory-files/projects.md +6 -4
  17. package/agent-assets/docs/features/memory-files/roadmap.md +17 -14
  18. package/agent-assets/docs/features/messaging/overview.md +5 -5
  19. package/agent-assets/docs/features/messaging/telegram.md +10 -9
  20. package/agent-assets/docs/features/operations/activity-and-conversations.md +5 -4
  21. package/agent-assets/docs/features/operations/approvals.md +6 -5
  22. package/agent-assets/docs/features/operations/managed-chromium.md +3 -2
  23. package/agent-assets/docs/features/operations/quiet-hours.md +4 -3
  24. package/agent-assets/docs/features/routines/custom-routines.md +11 -7
  25. package/agent-assets/docs/features/routines/evening-review.md +10 -2
  26. package/agent-assets/docs/features/routines/morning-routine.md +4 -3
  27. package/agent-assets/docs/features/routines/weekly-review.md +6 -0
  28. package/agent-assets/docs/features/wiki/commands.md +4 -4
  29. package/agent-assets/docs/features/wiki/cost-and-approval.md +4 -3
  30. package/agent-assets/docs/features/wiki/dashboard.md +7 -6
  31. package/agent-assets/docs/features/wiki/overview.md +3 -3
  32. package/agent-assets/docs/features/wiki/search.md +5 -5
  33. package/agent-assets/docs/features/wiki/workspaces.md +2 -2
  34. package/agent-assets/docs/getting-started/02-first-steps.md +5 -3
  35. package/agent-assets/docs/getting-started/04-first-day.md +2 -2
  36. package/agent-assets/docs/glossary.md +4 -4
  37. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +2 -2
  38. package/agent-assets/docs/guides/connect-a-new-mail-account.md +4 -2
  39. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +5 -4
  40. package/agent-assets/docs/guides/install-and-run.md +2 -2
  41. package/agent-assets/docs/guides/maintain-wiki-health.md +2 -2
  42. package/agent-assets/docs/guides/pause-the-agent.md +9 -5
  43. package/agent-assets/docs/guides/setup-wizard.md +8 -5
  44. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +6 -6
  45. package/agent-assets/docs/reference/api.md +15 -5
  46. package/agent-assets/docs/reference/cli-commands.md +3 -3
  47. package/agent-assets/docs/reference/config.md +21 -4
  48. package/agent-assets/docs/reference/disallowed-tools.md +6 -4
  49. package/agent-assets/docs/reference/knowledge-layout.md +11 -2
  50. package/agent-assets/docs/reference/process-keys.md +2 -2
  51. package/agent-assets/docs/reference/skills.md +5 -4
  52. package/agent-assets/docs/troubleshooting/auth-failed.md +9 -8
  53. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +16 -9
  54. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +2 -2
  55. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -6
  56. package/agent-assets/skills/agent-actions/SKILL.md +23 -39
  57. package/agent-assets/skills/agent-create/SKILL.md +15 -6
  58. package/agent-assets/skills/attach/SKILL.md +8 -27
  59. package/agent-assets/skills/browser-history/SKILL.md +29 -16
  60. package/agent-assets/skills/browser-history-respond/SKILL.md +6 -1
  61. package/agent-assets/skills/browser-task/SKILL.md +22 -27
  62. package/agent-assets/skills/context/SKILL.md +23 -32
  63. package/agent-assets/skills/context/curation.json +12 -12
  64. package/agent-assets/skills/context/references/api.md +17 -17
  65. package/agent-assets/skills/context/references/required-frontmatter.md +10 -9
  66. package/agent-assets/skills/context/references/snapshot-files.md +12 -11
  67. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +5 -5
  68. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
  69. package/agent-assets/skills/docs-search/SKILL.md +19 -31
  70. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +8 -95
  71. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +8 -94
  72. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +8 -94
  73. package/agent-assets/skills/external-services/SKILL.native.claude.md +2 -2
  74. package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
  75. package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
  76. package/agent-assets/skills/gmail-lifestyle/SKILL.md +3 -2
  77. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
  78. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
  79. package/agent-assets/skills/mail/SKILL.delegated.claude.md +13 -25
  80. package/agent-assets/skills/mail/SKILL.delegated.codex.md +3 -2
  81. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +3 -2
  82. package/agent-assets/skills/mail/SKILL.md +10 -18
  83. package/agent-assets/skills/mail/SKILL.native.claude.md +8 -7
  84. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  85. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  86. package/agent-assets/skills/mail/references/api.md +6 -1
  87. package/agent-assets/skills/mail/references/examples.md +2 -1
  88. package/agent-assets/skills/managed-tasks/SKILL.md +44 -77
  89. package/agent-assets/skills/managed-tasks/references/errors.md +25 -14
  90. package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
  91. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +6 -4
  92. package/agent-assets/skills/management-policy/SKILL.md +10 -11
  93. package/agent-assets/skills/management-policy/references/policy-workflow.md +4 -5
  94. package/agent-assets/skills/notify/SKILL.md +11 -13
  95. package/agent-assets/skills/notify/references/priority.md +28 -25
  96. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  97. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  98. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  99. package/agent-assets/skills/notion/SKILL.md +17 -17
  100. package/agent-assets/skills/notion/SKILL.native.claude.md +1 -1
  101. package/agent-assets/skills/notion/SKILL.native.codex.md +1 -1
  102. package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -1
  103. package/agent-assets/skills/observations/SKILL.md +5 -20
  104. package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
  105. package/agent-assets/skills/project-doc/SKILL.md +9 -6
  106. package/agent-assets/skills/project-doc/curation.json +3 -3
  107. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +2 -2
  108. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  109. package/agent-assets/skills/reading/SKILL.md +8 -42
  110. package/agent-assets/skills/reading/references/reading-taste.md +5 -5
  111. package/agent-assets/skills/roadmap/SKILL.md +3 -19
  112. package/agent-assets/skills/roadmap/references/api.md +16 -6
  113. package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
  114. package/agent-assets/skills/roadmap/references/migration.md +8 -6
  115. package/agent-assets/skills/roadmap/references/retention.md +18 -0
  116. package/agent-assets/skills/schedule/SKILL.md +9 -26
  117. package/agent-assets/skills/schedule/references/importance.md +23 -0
  118. package/agent-assets/skills/schedule/references/recurrence-rule.md +6 -4
  119. package/agent-assets/skills/scheduled-managed-task/SKILL.md +34 -37
  120. package/agent-assets/skills/today/SKILL.md +20 -79
  121. package/agent-assets/skills/today/references/today-skeleton.md +66 -0
  122. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
  123. package/agent-assets/skills/today/seeds/section-shape.seed.json +6 -6
  124. package/agent-assets/skills/user-interview/SKILL.md +15 -90
  125. package/agent-assets/skills/user-interview/references/op-briefing.md +1 -1
  126. package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
  127. package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
  128. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  129. package/agent-assets/skills/user-profile/SKILL.md +16 -26
  130. package/agent-assets/skills/user-profile/curation.json +3 -3
  131. package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
  132. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
  133. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +5 -4
  134. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
  135. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
  136. package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
  137. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
  138. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
  139. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
  140. package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
  141. package/agent-assets/task-flows/message.received.dm.md +4 -0
  142. package/agent-assets/task-flows/message.received.dm_first.md +4 -0
  143. package/agent-assets/task-flows/routine.evening_review.md +80 -0
  144. package/agent-assets/task-flows/routine.monthly_review.md +72 -0
  145. package/agent-assets/task-flows/routine.weekly_review.md +21 -0
  146. package/agent-assets/task-flows/wiki.trace.md +1 -1
  147. package/bin/aitne.mjs +45 -11
  148. package/package.json +4 -4
  149. package/scripts/commands/doctor.mjs +11 -2
  150. package/scripts/lib/process-identity.d.mts +46 -0
  151. package/scripts/lib/process-identity.mjs +193 -0
  152. package/scripts/lib/read-api-token.mjs +1 -1
  153. package/scripts/start.mjs +14 -4
@@ -122,7 +122,7 @@ curl -sS -X POST http://localhost:8321/api/integrations/google_calendar/exec \
122
122
  }'
123
123
  ```
124
124
 
125
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
125
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
126
126
  `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
127
127
  for genuinely larger intents.
128
128
 
@@ -157,31 +157,7 @@ destructive-confirm second call.
157
157
  know about, call `POST /api/notify` with a one-line summary. The
158
158
  daemon does NOT auto-notify — it's an explicit choice.
159
159
 
160
- ### Error envelope
161
-
162
- `/exec` extends the direct-mode envelope with delegated-mode fields.
163
- Discriminator: `body.mode === "delegated"`.
164
-
165
- | HTTP | `error` | retry? | What to do |
166
- |---|---|---|---|
167
- | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
168
- | 409 | `mode_mismatch` | no | Calendar isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md`. |
169
- | 409 | `precondition` | no | Mode/backend flipped during queue wait. Re-check state. |
170
- | 429 | `task_quota_exhausted` | no | Daily cap reached. Wait or surface. |
171
- | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Simplify schema. |
172
- | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
173
- | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface verbatim. |
174
- | 502 | `auth_error` | no | Connector signed out. Re-authenticate. |
175
- | 502 | `policy_violation` | no | Subprocess attempted an out-of-allowlist tool (anti-injection). |
176
- | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump or simplify. |
177
- | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
178
- | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Surface with partial trace. |
179
- | 503 | `delegated_proxy_busy` | yes | Queue saturated. Backoff and retry once. |
180
- | 503 | `task_mode_disabled` | no | Operator killed it. Stop. |
181
- | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once. |
182
- | 500 | `subprocess_crashed` | no | Daemon-side defect. Surface and stop. |
183
-
184
- Always preserve `body.message` verbatim when reporting to the user.
160
+ {{> ref:exec-errors }}
185
161
  <!-- /service:calendar -->
186
162
 
187
163
  ---
@@ -266,72 +242,10 @@ existing rows (dedup). → Full guide: load the `agent-create` or `schedule` ski
266
242
 
267
243
  ---
268
244
 
269
- ## One-Shot Scheduling
245
+ ## Scheduling & Skills CRUD
270
246
 
271
- Schedule a future DM or agent task. Use `<current_time>` to resolve relative times into absolute ISO 8601 with offset.
272
-
273
- ### DM vs Agent Task
274
-
275
- | Criterion | `/api/schedule/dm` (free) | `/api/schedule` (~$0.03) |
276
- |---|---|---|
277
- | Message text knowable now? | Yes | No — needs lookup/decision at execution |
278
- | Needs API data at execution? | No | Yes |
279
- | Multi-step action? | No | Yes |
280
- | Conditional on state that may change? | No | Yes |
281
-
282
- **Default to DM** — every agent wake-up costs money and context.
283
-
284
- ### Context-loss warning
285
-
286
- > The wake-up agent has NO memory of why it was scheduled — the `description` field is its only context.
287
-
288
- Include: **What** (verb + object), **Why** (trigger/reason), **Who/What** (names, IDs, URLs), **Expected output** (what success looks like).
289
-
290
- Bad: `"Meeting prep"` — which meeting? when? what to prepare? The wake-up agent will skip ambiguous descriptions.
291
-
292
- ### POST /api/schedule/dm — Pre-composed DM
293
- ```bash
294
- curl -s -X POST http://localhost:8321/api/schedule/dm \
295
- -H 'Content-Type: application/json' \
296
- -d '{"time": "2026-04-06T16:00:00-04:00", "message": "Reminder: Design review in 30 min.", "platform": "slack"}'
297
- ```
298
-
299
- ### POST /api/schedule — Agent task
300
- ```bash
301
- curl -s -X POST http://localhost:8321/api/schedule \
302
- -H 'Content-Type: application/json' \
303
- -d '{"time": "2026-04-06T16:00:00-04:00", "taskType": "wake", "prompt": "Check PR #42 status and notify user.", "description": "PR #42 status check", "tier": "medium", "taskContext": {"scheduledBy": "dm_conversation"}}'
304
- ```
305
- Fields: `time` (required), `taskType` (`wake`), `prompt` (required — the agent instruction, ≤8000 chars), `description` (optional label, ≤200 chars), `tier` (`lite`/`medium`/`high`) **or** `model` (registered id like `claude-opus-4-8`, legacy alias `sonnet`/`opus`, or composite `<backendId>/<modelId>`) — mutually exclusive, `taskContext` (optional metadata). See the `schedule` skill body for the full surface and `/api/schedule/options` for the live model list.
306
-
307
- ### Manage pending items
308
- ```bash
309
- curl -s "http://localhost:8321/api/schedule?status=pending" # list
310
- curl -s -X PATCH http://localhost:8321/api/schedule/42 \
311
- -H 'Content-Type: application/json' -d '{"time": "2026-04-06T17:00:00-04:00"}' # edit
312
- curl -s -X DELETE http://localhost:8321/api/schedule/42 # cancel
313
- ```
314
- Editable: `time`, `description`, `message` (dm only), `tier` (or `model`, mutually exclusive — pass `null` to clear), `taskContext`. Only `pending` items.
315
-
316
- ### Time discipline
317
- - Absolute ISO 8601 with offset required — no relative times.
318
- - Do not schedule during quiet hours (default 22:00–08:00, configurable) unless critical.
319
- - Maximum 5 wake-ups per execution.
320
-
321
- ---
322
-
323
- ## Skills Management
324
-
325
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
326
-
327
- ```bash
328
- curl -s http://localhost:8321/api/skills # list all
329
- curl -s http://localhost:8321/api/skills/todo-digest # read one
330
- curl -s -X POST http://localhost:8321/api/skills \
331
- -H 'Content-Type: application/json' \
332
- -d '{"name": "todo-digest", "description": "Summarize today.md", "content": "# TODO Digest\n...", "allowedTools": ["Bash(curl *)", "Read"]}'
333
- curl -s -X PUT http://localhost:8321/api/skills/todo-digest \
334
- -H 'Content-Type: application/json' -d '{"description": "New description"}' # update
335
- curl -s -X DELETE http://localhost:8321/api/skills/todo-digest # delete
336
- ```
337
- Always `GET /api/skills` before creating (check name collisions). **Omit frontmatter** from `content` — the API injects it.
247
+ One-shot DMs / agent wake-ups (`/api/schedule`, `/api/schedule/dm`) and
248
+ user-authored Skills CRUD (`/api/skills`) work identically to direct
249
+ mode they are never proxied. Load the `schedule` skill for scheduling
250
+ and the `agent-create` skill for recurring work; this variant does not
251
+ mirror those surfaces.
@@ -121,7 +121,7 @@ curl -sS -X POST http://localhost:8321/api/integrations/google_calendar/exec \
121
121
  }'
122
122
  ```
123
123
 
124
- `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
124
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=8`,
125
125
  `maxBudgetUsd=0.05`, `timeoutMs=60000`.
126
126
 
127
127
  ### Destructive-confirm two-step (`allowDestructive`)
@@ -155,31 +155,7 @@ destructive-confirm second call.
155
155
  know about, call `POST /api/notify` with a one-line summary. The
156
156
  daemon does NOT auto-notify — it's an explicit choice.
157
157
 
158
- ### Error envelope
159
-
160
- `/exec` extends the direct-mode envelope with delegated-mode fields.
161
- Discriminator: `body.mode === "delegated"`.
162
-
163
- | HTTP | `error` | retry? | What to do |
164
- |---|---|---|---|
165
- | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
166
- | 409 | `mode_mismatch` | no | Calendar isn't delegated. Re-read `integrations.md`. |
167
- | 409 | `precondition` | no | Mode/backend flipped during queue wait. Re-check state. |
168
- | 429 | `task_quota_exhausted` | no | Daily cap reached. Wait or surface. |
169
- | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Simplify schema. |
170
- | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
171
- | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface verbatim. |
172
- | 502 | `auth_error` | no | Connector signed out. Re-authenticate. |
173
- | 502 | `policy_violation` | no | Subprocess attempted an out-of-allowlist tool (anti-injection). |
174
- | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump or simplify. |
175
- | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
176
- | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Surface with partial trace. |
177
- | 503 | `delegated_proxy_busy` | yes | Queue saturated. Backoff and retry once. |
178
- | 503 | `task_mode_disabled` | no | Operator killed it. Stop. |
179
- | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once. |
180
- | 500 | `subprocess_crashed` | no | Daemon-side defect. Surface and stop. |
181
-
182
- Always preserve `body.message` verbatim when reporting to the user.
158
+ {{> ref:exec-errors }}
183
159
  <!-- /service:calendar -->
184
160
 
185
161
  ---
@@ -264,72 +240,10 @@ existing rows (dedup). → Full guide: load the `agent-create` or `schedule` ski
264
240
 
265
241
  ---
266
242
 
267
- ## One-Shot Scheduling
243
+ ## Scheduling & Skills CRUD
268
244
 
269
- Schedule a future DM or agent task. Use `<current_time>` to resolve relative times into absolute ISO 8601 with offset.
270
-
271
- ### DM vs Agent Task
272
-
273
- | Criterion | `/api/schedule/dm` (free) | `/api/schedule` (~$0.03) |
274
- |---|---|---|
275
- | Message text knowable now? | Yes | No — needs lookup/decision at execution |
276
- | Needs API data at execution? | No | Yes |
277
- | Multi-step action? | No | Yes |
278
- | Conditional on state that may change? | No | Yes |
279
-
280
- **Default to DM** — every agent wake-up costs money and context.
281
-
282
- ### Context-loss warning
283
-
284
- > The wake-up agent has NO memory of why it was scheduled — the `description` field is its only context.
285
-
286
- Include: **What** (verb + object), **Why** (trigger/reason), **Who/What** (names, IDs, URLs), **Expected output** (what success looks like).
287
-
288
- Bad: `"Meeting prep"` — which meeting? when? what to prepare? The wake-up agent will skip ambiguous descriptions.
289
-
290
- ### POST /api/schedule/dm — Pre-composed DM
291
- ```bash
292
- curl -s -X POST http://localhost:8321/api/schedule/dm \
293
- -H 'Content-Type: application/json' \
294
- -d '{"time": "2026-04-06T16:00:00-04:00", "message": "Reminder: Design review in 30 min.", "platform": "slack"}'
295
- ```
296
-
297
- ### POST /api/schedule — Agent task
298
- ```bash
299
- curl -s -X POST http://localhost:8321/api/schedule \
300
- -H 'Content-Type: application/json' \
301
- -d '{"time": "2026-04-06T16:00:00-04:00", "taskType": "wake", "prompt": "Check PR #42 status and notify user.", "description": "PR #42 status check", "tier": "medium", "taskContext": {"scheduledBy": "dm_conversation"}}'
302
- ```
303
- Fields: `time` (required), `taskType` (`wake`), `prompt` (required — the agent instruction, ≤8000 chars), `description` (optional label, ≤200 chars), `tier` (`lite`/`medium`/`high`) **or** `model` (registered id like `claude-opus-4-8`, legacy alias `sonnet`/`opus`, or composite `<backendId>/<modelId>`) — mutually exclusive, `taskContext` (optional metadata). See the `schedule` skill body for the full surface and `/api/schedule/options` for the live model list.
304
-
305
- ### Manage pending items
306
- ```bash
307
- curl -s "http://localhost:8321/api/schedule?status=pending" # list
308
- curl -s -X PATCH http://localhost:8321/api/schedule/42 \
309
- -H 'Content-Type: application/json' -d '{"time": "2026-04-06T17:00:00-04:00"}' # edit
310
- curl -s -X DELETE http://localhost:8321/api/schedule/42 # cancel
311
- ```
312
- Editable: `time`, `description`, `message` (dm only), `tier` (or `model`, mutually exclusive — pass `null` to clear), `taskContext`. Only `pending` items.
313
-
314
- ### Time discipline
315
- - Absolute ISO 8601 with offset required — no relative times.
316
- - Do not schedule during quiet hours (default 22:00–08:00, configurable) unless critical.
317
- - Maximum 5 wake-ups per execution.
318
-
319
- ---
320
-
321
- ## Skills Management
322
-
323
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
324
-
325
- ```bash
326
- curl -s http://localhost:8321/api/skills # list all
327
- curl -s http://localhost:8321/api/skills/todo-digest # read one
328
- curl -s -X POST http://localhost:8321/api/skills \
329
- -H 'Content-Type: application/json' \
330
- -d '{"name": "todo-digest", "description": "Summarize today.md", "content": "# TODO Digest\n...", "allowedTools": ["Bash(curl *)", "Read"]}'
331
- curl -s -X PUT http://localhost:8321/api/skills/todo-digest \
332
- -H 'Content-Type: application/json' -d '{"description": "New description"}' # update
333
- curl -s -X DELETE http://localhost:8321/api/skills/todo-digest # delete
334
- ```
335
- Always `GET /api/skills` before creating (check name collisions). **Omit frontmatter** from `content` — the API injects it.
245
+ One-shot DMs / agent wake-ups (`/api/schedule`, `/api/schedule/dm`) and
246
+ user-authored Skills CRUD (`/api/skills`) work identically to direct
247
+ mode they are never proxied. Load the `schedule` skill for scheduling
248
+ and the `agent-create` skill for recurring work; this variant does not
249
+ mirror those surfaces.
@@ -241,7 +241,7 @@ session's integration state.
241
241
  When the hourly_check native flow's Step 0b fetches imminent-window
242
242
  events, POST each materialised event to `/api/observations` so
243
243
  subsequent runs can dedup. The daemon computes `contentHash`
244
- server-side via `@personal-agent/shared/observations-hash.ts` — pass
244
+ server-side via `@aitne/shared/observations-hash` — pass
245
245
  the raw `payload`.
246
246
 
247
247
  **Batch when you have more than one event.** Use
@@ -284,7 +284,7 @@ schedule surface (scheduling is daemon-internal, not an integration).
284
284
 
285
285
  ## Skills Management — direct, unchanged
286
286
 
287
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`.
287
+ User-authored skills: `<contextDir>/policies/skills/{slug}/SKILL.md`.
288
288
  Built-in skills are read-only (403). Native-mode gating does not apply.
289
289
 
290
290
  ```bash
@@ -0,0 +1,32 @@
1
+ ---
2
+ kind: reference
3
+ name: exec-errors
4
+ description: Delegated `/exec` error envelope — HTTP status, `error` code, retry guidance. Shared across the cross-backend SKILL.delegated.*.md Calendar variants.
5
+ ---
6
+
7
+ ### Error envelope
8
+
9
+ `/exec` extends the direct-mode envelope with delegated-mode fields.
10
+ Discriminator: `body.mode === "delegated"`.
11
+
12
+ | HTTP | `error` | retry? | What to do |
13
+ |---|---|---|---|
14
+ | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
15
+ | 409 | `mode_mismatch` | no | Calendar isn't delegated, OR your DM backend matches `delegatedBackend`. Re-read `integrations.md` and stop. |
16
+ | 409 | `precondition` | no | Mode/backend flipped during the queue wait. Re-check state and re-plan. |
17
+ | 429 | `task_quota_exhausted` | no | Daily cap reached; wait or surface. |
18
+ | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Consider a simpler schema. |
19
+ | 502 | `tool_unavailable` | no | No connector tool fits the intent. Surface the gap. |
20
+ | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface `body.message` verbatim; retry only if clearly transient. |
21
+ | 502 | `auth_error` | no | Connector signed out. Tell the user to re-authenticate it. |
22
+ | 502 | `policy_violation` | no | Subprocess attempted a tool outside the per-task allowlist (anti-injection). |
23
+ | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump the cap or simplify. |
24
+ | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
25
+ | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Side effect is real — surface with the partial trace. |
26
+ | 503 | `delegated_proxy_busy` | yes | Daemon queue saturated. Backoff a few seconds, try once. |
27
+ | 503 | `task_mode_disabled` | no | Operator turned the kill switch off. Stop. |
28
+ | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once if intent was simple. |
29
+ | 500 | `subprocess_crashed` | no | Unhandled exception inside the subprocess. Surface and stop. |
30
+
31
+ Always preserve `body.message` verbatim when reporting to the user — it
32
+ carries the connector's own language.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  kind: reference
3
3
  name: skills-crud
4
- description: Dashboard-shaped CRUD for user-authored skills under ~/.personal-agent/skills/. Built-in skills are read-only (403).
4
+ description: Dashboard-shaped CRUD for user-authored skills under <contextDir>/policies/skills/. Built-in skills are read-only (403).
5
5
  ---
6
6
 
7
7
  ## Skills Management
8
8
 
9
- User-authored skills: `~/.personal-agent/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
9
+ User-authored skills: `<contextDir>/policies/skills/{slug}/SKILL.md`. Built-in skills are read-only (403). Slug: lowercase kebab-case `[a-z0-9][a-z0-9-]*`, 1–64 chars.
10
10
 
11
11
  ```bash
12
12
  curl -s http://localhost:8321/api/skills # list all
@@ -22,6 +22,6 @@ Always `GET /api/skills` before creating (check name collisions). **Omit frontma
22
22
 
23
23
  The description is the **only** routing signal the SDK uses to pick a
24
24
  skill — keep it under 280 chars and make the trigger surface
25
- distinct from every other skill in the manifest. Slug grammar is
26
- strict: `[a-z0-9][a-z0-9-]*[a-z0-9]` or `[a-z0-9]` (single char),
27
- 1-64 chars total. PUT rejects collisions with built-in slugs.
25
+ distinct from every other skill in the manifest. Slug grammar:
26
+ `^[a-z0-9][a-z0-9-]*$` (1-64 chars; a trailing hyphen is allowed,
27
+ no alphanumeric terminal required). PUT rejects collisions with built-in slugs.
@@ -97,8 +97,9 @@ user's **external Obsidian vault**.
97
97
  > **external** Obsidian vault (user's personal knowledge base reached
98
98
  > via `/api/obsidian/*`), **not** the primary management store
99
99
  > reached via `/api/context/*`. The agent's own state files
100
- > (`state/today.md`, `plans/roadmap.md`, `projects/*`, `user/*`, `rules/*`,
101
- > `routines/*`, `agent/*`) live in the primary store and must
100
+ > (`state/today.md`, `plans/roadmap.md`, `plans/projects/*`, `identity/*`,
101
+ > `policies/*`, `policies/routines/*`, `journal/agent.md`) live in the
102
+ > primary store and must
102
103
  > **never** receive receipt attachments. See the
103
104
  > `external-services` skill's obsidian reference for the external
104
105
  > vault's full CRUD surface.
@@ -41,6 +41,7 @@ Response:
41
41
  {
42
42
  "id": 1,
43
43
  "providerMsgId": "18f...",
44
+ "accountId": "...",
44
45
  "attachmentId": "ANGj...",
45
46
  "filename": "receipt.pdf",
46
47
  "mimeType": "application/pdf",
@@ -55,6 +56,9 @@ Response:
55
56
  }
56
57
  ```
57
58
 
59
+ `accountId` identifies the source mail account; `POST /receipts/:id/download`
60
+ uses it to resolve the provider.
61
+
58
62
  ## GET /api/receipts/summary
59
63
 
60
64
  ```bash
@@ -68,8 +68,17 @@ curl -s "http://localhost:8321/api/travel-bookings/upcoming?limit=10"
68
68
 
69
69
  ## PATCH /api/travel-bookings/:id
70
70
 
71
+ Accepts `{"status": "..."}` and/or `{"destination": "..."}`. Valid
72
+ status values are `upcoming`, `completed`, `cancelled`.
73
+
71
74
  ```bash
75
+ # Update status
72
76
  curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
73
77
  -H "Content-Type: application/json" \
74
78
  -d '{"status": "completed"}'
79
+
80
+ # Correct a parsed destination
81
+ curl -s -X PATCH "http://localhost:8321/api/travel-bookings/1" \
82
+ -H "Content-Type: application/json" \
83
+ -d '{"destination": "San Francisco"}'
75
84
  ```
@@ -101,8 +101,7 @@ should set `cacheable: true` so a repeat invocation within 60s returns
101
101
  ~5ms from the in-memory LRU. The cache key includes the integration
102
102
  state version, so flipping `deniedTools` or `delegatedBackend` purges
103
103
  entries automatically. Cache hits still write a `delegated_task.exec`
104
- audit row with `cost_usd=0` and `detail.cacheHit=true` — accounting
105
- stays correct.
104
+ audit row with `cost_usd=0` and `detail.cacheHit=true`.
106
105
 
107
106
  Never set `cacheable: true` on:
108
107
  - destructive-confirm second calls (`allowDestructive: true`),
@@ -205,19 +204,12 @@ curl -s -X POST http://localhost:8321/api/integrations/gmail/exec \
205
204
  ## Default deny floor
206
205
 
207
206
  The setup wizard pre-populates `gmail.deniedTools` with the connector's
208
- destructive defaults (send / batch label mutate / etc.). `/exec`
209
- honors the deny list, and the response distinguishes two cases:
210
-
211
- - **Every connector tool is denied** `403 denied_tool`. There is no
212
- surface to plan against, so the daemon rejects the task up front
213
- without spawning the subprocess.
214
- - **The connector still has usable tools but the specific tool a planned
215
- task needs is denied (or no tool fits)** → `502 tool_unavailable`. The
216
- subprocess plans, finds no permitted tool for the intent, and reports
217
- the gap.
218
-
219
- In both cases, surface that to the user and ask whether to lift the
220
- relevant deny before retrying.
207
+ destructive defaults. `/exec` honors the deny list, distinguishing two
208
+ cases: if **every** connector tool is denied `403 denied_tool` (no
209
+ surface to plan against, rejected up front); if usable tools remain but
210
+ the specific tool a planned task needs is denied (or no tool fits)
211
+ `502 tool_unavailable`. In both cases, surface that to the user and ask
212
+ whether to lift the relevant deny before retrying.
221
213
 
222
214
  ## Decision rules
223
215
 
@@ -271,23 +263,19 @@ curl -s -X POST http://localhost:8321/api/notify \
271
263
  -d '{"message": "Sent reply to alice@example.com (Re: Proposal)"}'
272
264
  ```
273
265
 
274
- Do not call `/api/notify` for routine reads / drafts / searches. The
275
- default posture is autonomous; the user's `deniedTools` is the
276
- hard-stop, on-demand retrospective covers awareness, and `/api/notify`
277
- is the small hammer for "speak up if I'm about to do something
278
- unusual."
266
+ Do not call `/api/notify` for routine reads / drafts / searches.
279
267
 
280
268
  ## Cost / retrospective
281
269
 
282
270
  Every `/exec` writes one row to `agent_actions` with
283
- `action_type='delegated_task.exec'` (token + USD breakdown, parent
284
- `event_id` / `processKey` attached automatically via session env
285
- vars). When the user asks what you did:
271
+ `action_type='delegated_task.exec'` (token + USD breakdown). When the
272
+ user asks what you did:
286
273
 
287
274
  ```bash
288
275
  curl -s "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since=2026-04-25T00:00:00Z&limit=50"
289
276
  ```
290
277
 
291
278
  Summarise from the returned `actions` array — each row carries
292
- `detail.task` (the natural-language intent), cost, cache hit flag, and
293
- timestamp.
279
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
280
+ deliberately not persisted, so do not try to read intent prose from it),
281
+ cost, cache hit flag, and timestamp.
@@ -261,5 +261,6 @@ curl -sS "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since
261
261
  ```
262
262
 
263
263
  Summarise from the returned `actions` array — each row carries
264
- `detail.task` (the natural-language intent), cost, cache hit flag,
265
- and timestamp.
264
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
265
+ deliberately not persisted, so do not try to read intent prose from it),
266
+ cost, cache hit flag, and timestamp.
@@ -255,5 +255,6 @@ curl -sS "http://localhost:8321/api/agent/actions?kind=delegated_task.exec&since
255
255
  ```
256
256
 
257
257
  Summarise from the returned `actions` array — each row carries
258
- `detail.task` (the natural-language intent), cost, cache hit flag,
259
- and timestamp.
258
+ `detail.taskHash` (a hash, NOT the task text the verbatim intent is
259
+ deliberately not persisted, so do not try to read intent prose from it),
260
+ cost, cache hit flag, and timestamp.
@@ -99,16 +99,10 @@ includes dormant and unhealthy rows that every operation will reject.
99
99
  ### Send vs draft
100
100
  - **Prefer drafts.** Create via `POST /mail/:acct/drafts`. The user sends
101
101
  from the provider's web UI.
102
- - Direct send (`POST /mail/:acct/messages/send`) succeeds autonomously
103
- the daemon does not DM the owner before sending. (The user's
104
- `deniedTools` list applies to **delegated-mode connector tools**
105
- e.g. Codex's `send_email` and is enforced at the
106
- `/api/integrations/:key/exec` task-mode chokepoint via the per-task
107
- allowed-tools envelope. In direct mode, the `/api/mail/*` route
108
- handler has no equivalent deny check today, so a send call is what
109
- it appears to be: a send.) When you judge the user would want to
110
- know about a send immediately (e.g. a reply to a stranger), call
111
- `POST /api/notify` yourself.
102
+ - Direct send (`POST /mail/:acct/messages/send`) is autonomous no owner
103
+ DM, no deny gate (see api.md for the `deniedTools`-scope nuance). When
104
+ you judge the user would want to know about a send immediately (e.g. a
105
+ reply to a stranger), call `POST /api/notify` yourself.
112
106
  - Never include `bcc` unless the user explicitly asks for it.
113
107
 
114
108
  ### Replies — RFC-2822 headers are the source of truth
@@ -118,7 +112,9 @@ all four kinds.
118
112
 
119
113
  1. Fetch the thread metadata: `GET /api/mail/:acct/threads/:threadId?body=none`
120
114
  (returns `messages[]` in chronological order without raw HTML bodies).
121
- 2. From the last message, pull `rfc822MsgId` and `references`.
115
+ 2. From the last message, pull `rfc822MsgId` (thread message objects carry
116
+ no `references` field — you SUPPLY `references` in the reply block below,
117
+ you do not read it off the message).
122
118
  3. Build the `reply` block:
123
119
  ```json
124
120
  {
@@ -198,13 +194,9 @@ curl -s "http://localhost:8321/api/mail/ACCT/messages/MSG/body?format=raw&chunk=
198
194
  deny list. The daemon does not DM the owner before the call. Single
199
195
  ops only; if you're about to trash 3+ messages at once, stop and ask
200
196
  the user — the agent's own judgment is the gate, not the daemon.
201
- - **Delegated mode**: this skill body is loaded only when `gmail.mode ===
202
- "direct"`. When Gmail is delegated, the materializer picks
203
- `SKILL.delegated.<sessionBackend>.md` (cross-backend) or skips the
204
- skill entirely (same-backend, native MCP). If you somehow reach
205
- `/api/mail/*` from this body while Gmail is delegated, the route
206
- returns `410 integration_delegated` — re-read `integrations.md` and
207
- use `POST /api/integrations/gmail/exec` (task mode) instead.
197
+ - **Delegated / native mode**: see §0 for routing. A `/api/mail/*` call
198
+ that hits a delegated/native gate returns `410` (`integration_delegated`
199
+ / `integration_native`) — re-read `integrations.md` and dispatch per §0.
208
200
 
209
201
  ## 3. Provider capability matrix
210
202
 
@@ -102,7 +102,7 @@ When you fetch Gmail data during a routine (e.g. `routine.hourly_check`'s
102
102
  Step 0a), POST each materialised thread to the daemon's
103
103
  `/api/observations` endpoint so subsequent runs can dedup. The daemon
104
104
  computes `contentHash` server-side via
105
- `@personal-agent/shared/observations-hash.ts` — pass the raw `payload`
105
+ `@aitne/shared/observations-hash` — pass the raw `payload`
106
106
  verbatim; do **not** compute the hash yourself (LLM-side hashes drift
107
107
  between runs and from the delegated-sync-worker's hash, breaking
108
108
  `delegated → native` flip dedup).
@@ -159,9 +159,10 @@ window (§11.3.1) with HTTP 409; on 409 stop and re-read
159
159
 
160
160
  ## Cost / audit
161
161
 
162
- Every native MCP call lands one `agent_actions` row of type `mcp_call`
163
- with `provider="claude"`, the tool name, `inputTokens` /
164
- `outputTokens`, and the parent `event_id` / `processKey` attached. The
165
- cost dashboard's `nativeAttribution` column (§14.4) joins those rows
166
- to the integration registry by `toolNamespace` prefix so the operator
167
- can see the spend shift after a flip.
162
+ Every native MCP call is logged to the `mcp_tool_calls` table
163
+ (`server_id`, `tool_name`, `event_type`, `session_id`, `ok` / `error`,
164
+ `called_at`, `duration_ms`) NOT to `agent_actions`, and with no
165
+ per-call token or provider columns. The operator's cost view attributes
166
+ native spend by server / namespace from those rows so it can see the
167
+ shift after a flip. You do not query this yourself — just call the
168
+ connector and POST observations.
@@ -112,7 +112,7 @@ and RFC-2822 reply chain shape are unchanged for non-Gmail accounts.
112
112
 
113
113
  POST each materialised Gmail thread fetched in a routine to
114
114
  `/api/observations`. The daemon computes `contentHash` server-side via
115
- `@personal-agent/shared/observations-hash.ts`; pass `payload` verbatim.
115
+ `@aitne/shared/observations-hash`; pass `payload` verbatim.
116
116
 
117
117
  **Batch when you have more than one thread.** Use
118
118
  `POST /api/observations/batch` with up to 200 items in a single
@@ -119,7 +119,7 @@ for non-Gmail accounts.
119
119
 
120
120
  POST each materialised Gmail message fetched in a routine to
121
121
  `/api/observations`. The daemon computes `contentHash` server-side via
122
- the shared util in `@personal-agent/shared/observations-hash.ts`; pass
122
+ the shared util in `@aitne/shared/observations-hash`; pass
123
123
  `payload` verbatim.
124
124
 
125
125
  **Batch when you have more than one message.** Use
@@ -84,7 +84,12 @@ curl -s "http://localhost:8321/api/mail/ACCT/drafts"
84
84
  curl -s "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
85
85
  curl -sX POST "http://localhost:8321/api/mail/ACCT/drafts" -d '{...}'
86
86
  curl -sX PATCH "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID" -d '{...}'
87
- # PATCH response: { status, id, warnings? }
87
+ # PATCH response: { status, id, previousId?, warnings? }
88
+ # - `previousId` is an optional field in the shape, but NO current provider
89
+ # ever populates it: Gmail and Outlook/Graph updates are atomic (id
90
+ # preserved, previousId unset) and IMAP draft-update is unimplemented
91
+ # (PATCH /drafts/:id on an IMAP account returns 501 not_implemented — see
92
+ # providers.md). Treat the returned `id` as stable.
88
93
  # - On Outlook, `warnings: ["reply_threading_immutable_after_create"]` if
89
94
  # `reply` was supplied — reply headers are fixed at createDraft time.
90
95
  curl -sX DELETE "http://localhost:8321/api/mail/ACCT/drafts/DRAFT_ID"
@@ -21,7 +21,8 @@ curl -s "http://localhost:8321/api/mail/search?q=from:alice+proposal&limit=5"
21
21
 
22
22
  # 2. Fetch the thread.
23
23
  curl -s "http://localhost:8321/api/mail/acct-1/threads/THREAD_ID"
24
- # → last message has rfc822MsgId, references[], providerMsgId.
24
+ # → last message has rfc822MsgId, providerMsgId (no references[] on the
25
+ # message — you SUPPLY references in the reply block below).
25
26
 
26
27
  # 3. Create a draft threaded to it. Drafts are Autonomous tier.
27
28
  curl -sX POST "http://localhost:8321/api/mail/acct-1/drafts" \