@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.
- package/README.md +36 -6
- package/agent-assets/docs/concepts/agent-day.md +2 -2
- package/agent-assets/docs/concepts/costs-and-quotas.md +4 -3
- package/agent-assets/docs/concepts/delegated-mode.md +5 -5
- package/agent-assets/docs/concepts/memory-model.md +6 -3
- package/agent-assets/docs/concepts/safety-model.md +19 -16
- package/agent-assets/docs/concepts/skills.md +2 -2
- package/agent-assets/docs/features/integrations/browser-history.md +9 -8
- package/agent-assets/docs/features/integrations/calendar.md +4 -4
- package/agent-assets/docs/features/integrations/mail.md +3 -2
- package/agent-assets/docs/features/lifestyle/git.md +3 -3
- package/agent-assets/docs/features/lifestyle/reading.md +15 -8
- package/agent-assets/docs/features/lifestyle/travel-bookings.md +4 -3
- package/agent-assets/docs/features/memory-files/agent-journal.md +30 -12
- package/agent-assets/docs/features/memory-files/agent-lessons.md +177 -0
- package/agent-assets/docs/features/memory-files/projects.md +6 -4
- package/agent-assets/docs/features/memory-files/roadmap.md +17 -14
- package/agent-assets/docs/features/messaging/overview.md +5 -5
- package/agent-assets/docs/features/messaging/telegram.md +10 -9
- package/agent-assets/docs/features/operations/activity-and-conversations.md +5 -4
- package/agent-assets/docs/features/operations/approvals.md +6 -5
- package/agent-assets/docs/features/operations/managed-chromium.md +3 -2
- package/agent-assets/docs/features/operations/quiet-hours.md +4 -3
- package/agent-assets/docs/features/routines/custom-routines.md +11 -7
- package/agent-assets/docs/features/routines/evening-review.md +10 -2
- package/agent-assets/docs/features/routines/morning-routine.md +4 -3
- package/agent-assets/docs/features/routines/weekly-review.md +6 -0
- package/agent-assets/docs/features/wiki/commands.md +4 -4
- package/agent-assets/docs/features/wiki/cost-and-approval.md +4 -3
- package/agent-assets/docs/features/wiki/dashboard.md +7 -6
- package/agent-assets/docs/features/wiki/overview.md +3 -3
- package/agent-assets/docs/features/wiki/search.md +5 -5
- package/agent-assets/docs/features/wiki/workspaces.md +2 -2
- package/agent-assets/docs/getting-started/02-first-steps.md +5 -3
- package/agent-assets/docs/getting-started/04-first-day.md +2 -2
- package/agent-assets/docs/glossary.md +4 -4
- package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +2 -2
- package/agent-assets/docs/guides/connect-a-new-mail-account.md +4 -2
- package/agent-assets/docs/guides/explore-with-trace-and-connect.md +5 -4
- package/agent-assets/docs/guides/install-and-run.md +2 -2
- package/agent-assets/docs/guides/maintain-wiki-health.md +2 -2
- package/agent-assets/docs/guides/pause-the-agent.md +9 -5
- package/agent-assets/docs/guides/setup-wizard.md +8 -5
- package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +6 -6
- package/agent-assets/docs/reference/api.md +15 -5
- package/agent-assets/docs/reference/cli-commands.md +3 -3
- package/agent-assets/docs/reference/config.md +21 -4
- package/agent-assets/docs/reference/disallowed-tools.md +6 -4
- package/agent-assets/docs/reference/knowledge-layout.md +11 -2
- package/agent-assets/docs/reference/process-keys.md +2 -2
- package/agent-assets/docs/reference/skills.md +5 -4
- package/agent-assets/docs/troubleshooting/auth-failed.md +9 -8
- package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +16 -9
- package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +2 -2
- package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -6
- package/agent-assets/skills/agent-actions/SKILL.md +23 -39
- package/agent-assets/skills/agent-create/SKILL.md +15 -6
- package/agent-assets/skills/attach/SKILL.md +8 -27
- package/agent-assets/skills/browser-history/SKILL.md +29 -16
- package/agent-assets/skills/browser-history-respond/SKILL.md +6 -1
- package/agent-assets/skills/browser-task/SKILL.md +22 -27
- package/agent-assets/skills/context/SKILL.md +23 -32
- package/agent-assets/skills/context/curation.json +12 -12
- package/agent-assets/skills/context/references/api.md +17 -17
- package/agent-assets/skills/context/references/required-frontmatter.md +10 -9
- package/agent-assets/skills/context/references/snapshot-files.md +12 -11
- package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +5 -5
- package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
- package/agent-assets/skills/docs-search/SKILL.md +19 -31
- package/agent-assets/skills/external-services/SKILL.delegated.claude.md +8 -95
- package/agent-assets/skills/external-services/SKILL.delegated.codex.md +8 -94
- package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +8 -94
- package/agent-assets/skills/external-services/SKILL.native.claude.md +2 -2
- package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
- package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
- package/agent-assets/skills/gmail-lifestyle/SKILL.md +3 -2
- package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
- package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
- package/agent-assets/skills/mail/SKILL.delegated.claude.md +13 -25
- package/agent-assets/skills/mail/SKILL.delegated.codex.md +3 -2
- package/agent-assets/skills/mail/SKILL.delegated.gemini.md +3 -2
- package/agent-assets/skills/mail/SKILL.md +10 -18
- package/agent-assets/skills/mail/SKILL.native.claude.md +8 -7
- package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
- package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
- package/agent-assets/skills/mail/references/api.md +6 -1
- package/agent-assets/skills/mail/references/examples.md +2 -1
- package/agent-assets/skills/managed-tasks/SKILL.md +44 -77
- package/agent-assets/skills/managed-tasks/references/errors.md +25 -14
- package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
- package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +6 -4
- package/agent-assets/skills/management-policy/SKILL.md +10 -11
- package/agent-assets/skills/management-policy/references/policy-workflow.md +4 -5
- package/agent-assets/skills/notify/SKILL.md +11 -13
- package/agent-assets/skills/notify/references/priority.md +28 -25
- package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
- package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
- package/agent-assets/skills/notion/SKILL.md +17 -17
- package/agent-assets/skills/notion/SKILL.native.claude.md +1 -1
- package/agent-assets/skills/notion/SKILL.native.codex.md +1 -1
- package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -1
- package/agent-assets/skills/observations/SKILL.md +5 -20
- package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
- package/agent-assets/skills/project-doc/SKILL.md +9 -6
- package/agent-assets/skills/project-doc/curation.json +3 -3
- package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +2 -2
- package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
- package/agent-assets/skills/reading/SKILL.md +8 -42
- package/agent-assets/skills/reading/references/reading-taste.md +5 -5
- package/agent-assets/skills/roadmap/SKILL.md +3 -19
- package/agent-assets/skills/roadmap/references/api.md +16 -6
- package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
- package/agent-assets/skills/roadmap/references/migration.md +8 -6
- package/agent-assets/skills/roadmap/references/retention.md +18 -0
- package/agent-assets/skills/schedule/SKILL.md +9 -26
- package/agent-assets/skills/schedule/references/importance.md +23 -0
- package/agent-assets/skills/schedule/references/recurrence-rule.md +6 -4
- package/agent-assets/skills/scheduled-managed-task/SKILL.md +34 -37
- package/agent-assets/skills/today/SKILL.md +20 -79
- package/agent-assets/skills/today/references/today-skeleton.md +66 -0
- package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
- package/agent-assets/skills/today/seeds/section-shape.seed.json +6 -6
- package/agent-assets/skills/user-interview/SKILL.md +15 -90
- package/agent-assets/skills/user-interview/references/op-briefing.md +1 -1
- package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
- package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
- package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
- package/agent-assets/skills/user-profile/SKILL.md +16 -26
- package/agent-assets/skills/user-profile/curation.json +3 -3
- package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
- package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
- package/agent-assets/skills/wiki/wiki-compile/SKILL.md +5 -4
- package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
- package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
- package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
- package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
- package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
- package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
- package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
- package/agent-assets/task-flows/message.received.dm.md +4 -0
- package/agent-assets/task-flows/message.received.dm_first.md +4 -0
- package/agent-assets/task-flows/routine.evening_review.md +80 -0
- package/agent-assets/task-flows/routine.monthly_review.md +72 -0
- package/agent-assets/task-flows/routine.weekly_review.md +21 -0
- package/agent-assets/task-flows/wiki.trace.md +1 -1
- package/bin/aitne.mjs +45 -11
- package/package.json +4 -4
- package/scripts/commands/doctor.mjs +11 -2
- package/scripts/lib/process-identity.d.mts +46 -0
- package/scripts/lib/process-identity.mjs +193 -0
- package/scripts/lib/read-api-token.mjs +1 -1
- package/scripts/start.mjs +14 -4
|
@@ -123,35 +123,18 @@ a paraphrase. The user is the one who can fix auth / quota / install.
|
|
|
123
123
|
|
|
124
124
|
### Step 4a — Decide `output_path` (LLM judgment)
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
best fits the data shape:
|
|
139
|
-
|
|
140
|
-
| Probe sample shape | Likely `<domain>/<type-plural>/` |
|
|
141
|
-
|---|---|
|
|
142
|
-
| Recording with attendees + duration | `work/meetings/` |
|
|
143
|
-
| PDF / image with monetary amount | `finance/receipts/` |
|
|
144
|
-
| Travel itinerary / booking | `travel/trips/` |
|
|
145
|
-
| Long-form note / article | `<domain>/notes/` (pick by content topic) |
|
|
146
|
-
| Book metadata / progress | `learning/books/` |
|
|
147
|
-
|
|
148
|
-
3. If the data shape is genuinely ambiguous (zero rows), set
|
|
149
|
-
`output_path: null` — the first scheduled run will populate it
|
|
150
|
-
from real data.
|
|
151
|
-
|
|
152
|
-
The full `output_path` grammar (allowed domain / type values,
|
|
153
|
-
trailing-slash rule, `..` rejection, 422 envelope) is in the
|
|
154
|
-
reference below.
|
|
126
|
+
Infer the primary L2 directory the recurring fetch will write into:
|
|
127
|
+
|
|
128
|
+
1. Reuse an existing path if the source already lives somewhere —
|
|
129
|
+
`curl -s "http://localhost:8321/api/entities?source=<app>&limit=5" | jq -r '.items[].path'`;
|
|
130
|
+
if 1+ rows agree on `<domain>/<type-plural>`, that path wins.
|
|
131
|
+
2. Else pick by the probe sample's data shape (mapping table in the
|
|
132
|
+
reference below).
|
|
133
|
+
3. Else omit the field (`output_path: null`) — the first scheduled run
|
|
134
|
+
back-fills it.
|
|
135
|
+
|
|
136
|
+
The full grammar (allowed domain / type values, trailing-slash rule,
|
|
137
|
+
`..` rejection, 400 rejection shape, data-shape mapping) is below.
|
|
155
138
|
|
|
156
139
|
{{> ref:output-path }}
|
|
157
140
|
|
|
@@ -206,15 +189,10 @@ cadence)` collides at the uniqueness check and returns `409
|
|
|
206
189
|
duplicate` with the existing `mt_id` — DM the user pointing at it
|
|
207
190
|
instead of registering twice.
|
|
208
191
|
|
|
209
|
-
**Server-side
|
|
210
|
-
|
|
211
|
-
`
|
|
212
|
-
|
|
213
|
-
transaction rolls back and you get a 5xx — surface the body verbatim.
|
|
214
|
-
|
|
215
|
-
**File render**: post-transaction the daemon re-renders
|
|
216
|
-
`policies/management.md` from DB (locked, snapshotted into
|
|
217
|
-
`md_file_snapshots`). You do NOT touch the file.
|
|
192
|
+
**Server-side**: the daemon runs the atomic tx (allocate `mt_<n>`,
|
|
193
|
+
INSERT the FK-linked `recurring_schedules` + `managed_tasks`, audit),
|
|
194
|
+
re-renders `policies/management.md`, and snapshots it — you do not
|
|
195
|
+
touch the file. On a DB failure you get a 5xx; surface the body.
|
|
218
196
|
|
|
219
197
|
### Step 7 — Confirm to user
|
|
220
198
|
|
|
@@ -305,10 +283,8 @@ rename has its own dedicated route
|
|
|
305
283
|
disambiguator already routes app-change requests to "stop + re-register"
|
|
306
284
|
for safety.
|
|
307
285
|
|
|
308
|
-
Server-side
|
|
309
|
-
|
|
310
|
-
`policies/management.md` → INSERT one `agent_actions` row
|
|
311
|
-
(`action_type='management_task.modified', detail={changed, from, to}`).
|
|
286
|
+
**Server-side**: the daemon runs the atomic tx + re-renders the file
|
|
287
|
+
+ audits — you do not touch the file.
|
|
312
288
|
|
|
313
289
|
`mt_id`, `last_run_at`, `last_result`, and `consecutive_failures`
|
|
314
290
|
are preserved across PATCH — history is continuous. A cadence change
|
|
@@ -374,16 +350,13 @@ so they can make an informed call.
|
|
|
374
350
|
curl -sS -X DELETE http://localhost:8321/api/managed-tasks/mt_42
|
|
375
351
|
```
|
|
376
352
|
|
|
377
|
-
Server-side
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
rows → re-render `policies/management.md` → INSERT one `agent_actions`
|
|
381
|
-
row (`action_type='management_task.deleted'`).
|
|
353
|
+
**Server-side**: the daemon runs the atomic tx (snapshot the row,
|
|
354
|
+
DELETE `managed_tasks` cascading to `recurring_schedules`, cancel
|
|
355
|
+
pending fires, audit) + re-renders the file — you do not touch it.
|
|
382
356
|
|
|
383
|
-
The pre-delete row snapshot
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
audit / debug contexts only, never in the user-facing DM.
|
|
357
|
+
The pre-delete row snapshot (`agent_actions.detail.original_row`)
|
|
358
|
+
plus the `md_file_snapshots` row is the recovery surface — for
|
|
359
|
+
audit / debug only, never the user-facing DM.
|
|
387
360
|
|
|
388
361
|
### Step 4 — Confirm to user
|
|
389
362
|
|
|
@@ -407,11 +380,11 @@ modifying the schedule:
|
|
|
407
380
|
curl -sS -X POST http://localhost:8321/api/managed-tasks/mt_42/run-now
|
|
408
381
|
```
|
|
409
382
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
as a scheduled fire
|
|
413
|
-
|
|
414
|
-
|
|
383
|
+
Success is `202 {status:"queued", mt_id, scheduled_row_id}` — the
|
|
384
|
+
route enqueues a one-shot `agent_schedule` row that runs the same
|
|
385
|
+
task-flow as a scheduled fire; the next regular firing is unaffected.
|
|
386
|
+
There is no in-flight guard, so the fire always enqueues — do not
|
|
387
|
+
fire it in a loop yourself.
|
|
415
388
|
|
|
416
389
|
Confirm to user with one DM after the fire enqueues:
|
|
417
390
|
|
|
@@ -422,10 +395,10 @@ Confirm to user with one DM after the fire enqueues:
|
|
|
422
395
|
|
|
423
396
|
## Error envelope
|
|
424
397
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
(`validation_error`, `duplicate`,
|
|
428
|
-
`
|
|
398
|
+
Every error is the daemon envelope
|
|
399
|
+
(`{ok:false, summary, errors:[…], retryable, error?}`). Verbs (POST /
|
|
400
|
+
PATCH / DELETE / run-now), codes (`validation_error`, `duplicate`,
|
|
401
|
+
`cap_reached`, `invalid_id`, `not_found`, `internal_error`), and the
|
|
429
402
|
Idempotency-Key contract are in the errors reference below.
|
|
430
403
|
|
|
431
404
|
{{> ref:errors }}
|
|
@@ -434,26 +407,20 @@ Idempotency-Key contract are in the errors reference below.
|
|
|
434
407
|
|
|
435
408
|
## What this skill does NOT do
|
|
436
409
|
|
|
437
|
-
- Does NOT
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
`/api/managed-tasks` keeps the FK pair consistent.
|
|
443
|
-
- Does NOT pause / disable a task — there is no soft-pause; stop +
|
|
444
|
-
re-register if the user wants a hiatus.
|
|
445
|
-
- Does NOT mutate `app` through PATCH — that is a different
|
|
446
|
-
commitment, stop + re-register.
|
|
447
|
-
- Does NOT touch §A (SoT bindings) — use `PUT /api/sot-bindings`.
|
|
448
|
-
Does NOT touch §C (Active Policies) — owned by `management-policy`.
|
|
410
|
+
- Does NOT PUT `policies/management.md` (or INSERT `recurring_schedules`)
|
|
411
|
+
directly — the only legal write is the `/api/managed-tasks` chokepoint;
|
|
412
|
+
the daemon owns the file write and the FK pair.
|
|
413
|
+
- Does NOT mutate `app` through PATCH — a different connector is a
|
|
414
|
+
different commitment; stop + re-register.
|
|
449
415
|
- Does NOT silently re-register on retry — use `Idempotency-Key`
|
|
450
416
|
per-DM; conflicts surface the existing `mt_id`.
|
|
451
|
-
- Does NOT register a task
|
|
452
|
-
|
|
453
|
-
- Does NOT delete entity files produced by past runs on stop
|
|
454
|
-
|
|
417
|
+
- Does NOT register a task with no probe-passing connector — probe
|
|
418
|
+
failure is a hard stop.
|
|
419
|
+
- Does NOT delete entity files produced by past runs on stop — those
|
|
420
|
+
stay where written; the DELETE only removes the row + its recurring
|
|
421
|
+
schedule.
|
|
455
422
|
- Does NOT bulk-stop without per-row confirmation. "Stop all gmail
|
|
456
|
-
tasks" is
|
|
423
|
+
tasks" is one DM round-trip per row.
|
|
457
424
|
|
|
458
425
|
## API surface
|
|
459
426
|
|
|
@@ -1,24 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
kind: reference
|
|
3
3
|
name: errors
|
|
4
|
-
description: /api/managed-tasks error envelope — POST / PATCH / DELETE codes (validation_error, duplicate, cap_reached, invalid_id, not_found, internal_error).
|
|
4
|
+
description: /api/managed-tasks error envelope — {ok:false, summary, errors[], retryable} plus POST / PATCH / DELETE codes (validation_error, duplicate, cap_reached, invalid_id, not_found, internal_error).
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# /api/managed-tasks error envelope
|
|
8
8
|
|
|
9
|
-
Every
|
|
9
|
+
Every error response is the standard daemon envelope:
|
|
10
10
|
|
|
11
11
|
```jsonc
|
|
12
12
|
{
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
13
|
+
"ok": false,
|
|
14
|
+
"summary": "<one-line human text — surface verbatim>",
|
|
15
|
+
"errors": [ { "code": "managed_tasks.validation_error", "field": "body", "hint": "..." } ],
|
|
16
|
+
"retryable": false,
|
|
17
|
+
"error": "<legacy machine-code alias — present on single-issue envelopes>"
|
|
17
18
|
}
|
|
18
19
|
```
|
|
19
20
|
|
|
20
|
-
`
|
|
21
|
-
|
|
21
|
+
`summary`, `errors[]`, and `retryable` are ALWAYS present. Each
|
|
22
|
+
`errors[]` issue carries `code` / `field` / `hint`. The top-level
|
|
23
|
+
`error` is a legacy alias for the single issue's code. Legacy aliases
|
|
24
|
+
appear only on specific codes: `item` (the existing row) on `409
|
|
25
|
+
duplicate`, `message` on duplicate / cap, and `details` (the raw
|
|
26
|
+
ZodError) on `validation_error`. Per-verb tables below name the issue
|
|
27
|
+
`code`; surface `body.summary` or the issue `hint`, not a paraphrase.
|
|
28
|
+
|
|
29
|
+
The daemon does NOT emit `cron_too_tight`. Note: the recurrence schema
|
|
22
30
|
DOES accept `hourly` (the engine supports `hourly`/`daily`/`weekly`/
|
|
23
31
|
`monthly`), so a sub-daily POST is NOT rejected server-side — it
|
|
24
32
|
succeeds (201). The daily-or-coarser floor for managed tasks is a
|
|
@@ -32,7 +40,7 @@ structured field, so there is no partial-cadence shape to reject).
|
|
|
32
40
|
|
|
33
41
|
| HTTP | `error` | When | What to do |
|
|
34
42
|
|---|---|---|---|
|
|
35
|
-
| 400 | `validation_error` | Body fails Zod (frequency unknown, time malformed, etc.) | Pick the offending field from `
|
|
43
|
+
| 400 | `validation_error` | Body fails Zod (frequency unknown, time malformed, etc.) | Pick the offending field from `body.summary` / the issue `hint` (`details` is a serialized ZodError object, not an array) and ask the user to clarify. |
|
|
36
44
|
| 409 | `duplicate` | An existing row has the same `(app_normalized, cadence)` | DM `Already managed as <body.item.id>` and stop. The body's `item` is the existing row. |
|
|
37
45
|
| 409 | `cap_reached` | §B already at the active-task cap (default 100) | Surface `body.message` (carries the cap value); user must stop something first. |
|
|
38
46
|
| 5xx | `internal_error` | DB / cascade failure | DM "Couldn't register; daemon error. Try again, or check `aitne logs`." |
|
|
@@ -42,9 +50,9 @@ structured field, so there is no partial-cadence shape to reject).
|
|
|
42
50
|
| HTTP | `error` | When | What to do |
|
|
43
51
|
|---|---|---|---|
|
|
44
52
|
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | User typed the id wrong — ask them to repeat. |
|
|
45
|
-
| 400 | `validation_error` | Body fails Zod (empty body, recurrenceRule.daysOfWeek on a `daily`, etc.) | Pin the failing
|
|
53
|
+
| 400 | `validation_error` | Body fails Zod (empty body, recurrenceRule.daysOfWeek on a `daily`, etc.) | Pin the failing field from `body.summary` / the issue `hint` (`details` is a serialized ZodError object, not an array) and ask for a fix. |
|
|
46
54
|
| 404 | `not_found` | No row for `:id` | DM "I don't have an `mt_<id>` to modify"; offer to register one. |
|
|
47
|
-
| 5xx | `internal_error` | DB / cascade failure | Surface `body.
|
|
55
|
+
| 5xx | `internal_error` | DB / cascade failure | Surface `body.summary`; advise `aitne logs`. |
|
|
48
56
|
|
|
49
57
|
## DELETE /api/managed-tasks/:id
|
|
50
58
|
|
|
@@ -52,16 +60,19 @@ structured field, so there is no partial-cadence shape to reject).
|
|
|
52
60
|
|---|---|---|---|
|
|
53
61
|
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | Ask the user to repeat. |
|
|
54
62
|
| 404 | `not_found` | No row for `:id` | DM "No managed task with that id"; if you used a fuzzy match, re-list candidates. |
|
|
55
|
-
| 5xx | `internal_error` | DB / cascade failure | Surface `body.
|
|
63
|
+
| 5xx | `internal_error` | DB / cascade failure | Surface `body.summary`; advise `aitne logs`. |
|
|
56
64
|
|
|
57
65
|
## POST /api/managed-tasks/:id/run-now
|
|
58
66
|
|
|
67
|
+
Success is `202 {status:"queued", mt_id, scheduled_row_id}` — the
|
|
68
|
+
route has no concurrency guard, so a fire enqueues unconditionally
|
|
69
|
+
(there is no `already_running` code). Errors:
|
|
70
|
+
|
|
59
71
|
| HTTP | `error` | When | What to do |
|
|
60
72
|
|---|---|---|---|
|
|
61
73
|
| 400 | `invalid_id` | `:id` didn't match `^mt_[1-9]\d*$` | Ask the user to repeat. |
|
|
62
74
|
| 404 | `not_found` | No row for `:id` | Cannot run a stopped task. |
|
|
63
|
-
|
|
|
64
|
-
| 5xx | `internal_error` | Dispatcher / cascade failure | Surface `body.message`. |
|
|
75
|
+
| 5xx | `internal_error` | Dispatcher / cascade failure | Surface the issue `hint`. |
|
|
65
76
|
|
|
66
77
|
## Idempotency on POST
|
|
67
78
|
|
|
@@ -8,8 +8,10 @@ description: output_path grammar — `<domain>/<type-plural>/` only, trailing sl
|
|
|
8
8
|
|
|
9
9
|
The `output_path` field on `/api/managed-tasks` is the L2 directory
|
|
10
10
|
under the primary context vault where the recurring fetch will write
|
|
11
|
-
entity files. The
|
|
12
|
-
|
|
11
|
+
entity files. The full grammar (domain/type enum, two segments, no
|
|
12
|
+
`..`) is enforced by a Zod `.refine` PRE-insert, so a bad value is
|
|
13
|
+
rejected with **HTTP 400**. The SQL CHECK constraint only guarantees
|
|
14
|
+
the trailing slash (`output_path LIKE '%/'`).
|
|
13
15
|
|
|
14
16
|
## Format
|
|
15
17
|
|
|
@@ -28,9 +30,24 @@ at INSERT / UPDATE time.
|
|
|
28
30
|
| `<type-plural>` | `meetings`, `trips`, `receipts`, `projects`, `books`, `notes` |
|
|
29
31
|
|
|
30
32
|
Not every domain × type combination is meaningful in practice — pick
|
|
31
|
-
the pair whose semantic prior best fits the fetch's data shape
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
the pair whose semantic prior best fits the fetch's data shape.
|
|
34
|
+
|
|
35
|
+
## Data shape → path mapping
|
|
36
|
+
|
|
37
|
+
When no existing entity path is found for the source (see Register
|
|
38
|
+
Step 4a), pick the `(domain, type)` pair whose semantic prior best
|
|
39
|
+
fits the probe sample:
|
|
40
|
+
|
|
41
|
+
| Probe sample shape | Likely `<domain>/<type-plural>/` |
|
|
42
|
+
|---|---|
|
|
43
|
+
| Recording with attendees + duration | `work/meetings/` |
|
|
44
|
+
| PDF / image with monetary amount | `finance/receipts/` |
|
|
45
|
+
| Travel itinerary / booking | `travel/trips/` |
|
|
46
|
+
| Long-form note / article | `<domain>/notes/` (pick by content topic) |
|
|
47
|
+
| Book metadata / progress | `learning/books/` |
|
|
48
|
+
|
|
49
|
+
If the data shape is genuinely ambiguous (zero rows), omit the field
|
|
50
|
+
(`output_path: null`) — the first scheduled run populates it.
|
|
34
51
|
|
|
35
52
|
## Examples
|
|
36
53
|
|
|
@@ -61,15 +78,14 @@ re-register.
|
|
|
61
78
|
To clear an existing `output_path` back to "first run decides", send
|
|
62
79
|
`{"output_path": null}` in the PATCH.
|
|
63
80
|
|
|
64
|
-
##
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
that failed. Do not retry the same value.
|
|
81
|
+
## Rejection
|
|
82
|
+
|
|
83
|
+
A bad `output_path` fails Zod and the route returns **HTTP 400** with
|
|
84
|
+
the generic `managed_tasks.validation_error` issue — there is no
|
|
85
|
+
top-level `field` and no per-`output_path` `message`. The raw
|
|
86
|
+
ZodError lives under `legacyFields.details`, but it is a serialized
|
|
87
|
+
ZodError object (`{name:"ZodError", message:"<stringified issues>"}`),
|
|
88
|
+
NOT an array — there is no `details[].path` to read. The offending
|
|
89
|
+
field (`output_path`) is named in `body.summary` and the issue `hint`;
|
|
90
|
+
the raw issues are inside the stringified `details.message`. Surface
|
|
91
|
+
`body.summary` or the issue `hint`. Do not retry the same value.
|
|
@@ -8,10 +8,12 @@ description: recurrenceRule grammar — hourly / daily / weekly / monthly. Engin
|
|
|
8
8
|
|
|
9
9
|
The daemon's recurrence engine accepts four frequencies: `hourly`,
|
|
10
10
|
`daily`, `weekly`, `monthly`. Each frequency requires its own set of
|
|
11
|
-
fields and rejects fields that don't apply — the daemon
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
fields and rejects fields that don't apply — the daemon rejects a
|
|
12
|
+
mismatched shape with an HTTP 400 validation error naming the
|
|
13
|
+
frequency/field conflict. The recurring-schedules endpoint (the
|
|
14
|
+
`schedule` skill) surfaces it as a `schedule.frequency_field_mismatch`
|
|
15
|
+
issue with a field path; the managed-tasks endpoint surfaces it as a
|
|
16
|
+
`managed_tasks.validation_error`. Pre-validate to save a round-trip.
|
|
15
17
|
|
|
16
18
|
Times are `HH:MM` 24-hour local; `timezone` is IANA (auto-fills from
|
|
17
19
|
daemon config when omitted, but explicit is safer so a roaming laptop
|
|
@@ -69,8 +69,8 @@ curl -s "http://localhost:8321/api/context/list/policies"
|
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
If the listing and `_index.md` rows disagree, **prefer the listing**
|
|
72
|
-
and trust the next reconcile pass to refresh the index.
|
|
73
|
-
|
|
72
|
+
and trust the next reconcile pass to refresh the index (`_index.md` is
|
|
73
|
+
reconciler-owned — see body intro).
|
|
74
74
|
|
|
75
75
|
### Step 2 — Detect similarity
|
|
76
76
|
|
|
@@ -156,9 +156,8 @@ the active policies first and ask.
|
|
|
156
156
|
frontmatter `enabled: false`, PUT back. The reload hook flips the
|
|
157
157
|
cron job off automatically.
|
|
158
158
|
|
|
159
|
-
The policy-index reconciler
|
|
160
|
-
|
|
161
|
-
~10 s. Do not PATCH them manually.
|
|
159
|
+
The policy-index reconciler re-renders both `_index.md` and the
|
|
160
|
+
management.md section within ~10 s (reconciler-owned — see body intro).
|
|
162
161
|
|
|
163
162
|
If step 2 fails after step 1 succeeded, **attempt to roll back step 1**
|
|
164
163
|
(`status` back to `active`). If the rollback itself fails, report the
|
|
@@ -190,8 +189,6 @@ is intentionally not whitelisted (see MANAGEMENT-POLICY-CAPTURE-PLAN
|
|
|
190
189
|
- Does NOT create rows in the `recurring_schedules` DB table — defer to
|
|
191
190
|
`policies/routines/custom/` for cron, which gives the user a visible MD file
|
|
192
191
|
to edit.
|
|
193
|
-
- Does NOT migrate existing custom routines into policy files
|
|
194
|
-
retroactively. Migration is a separate one-time operation.
|
|
195
192
|
|
|
196
193
|
## Cross-skill pointers
|
|
197
194
|
|
|
@@ -223,11 +220,13 @@ skill targets these paths:
|
|
|
223
220
|
- `DELETE /api/context/policies/routines/custom/<slug>` (remove only)
|
|
224
221
|
|
|
225
222
|
`policies/management-captures/_index.md` and the `## Active Policies` section in
|
|
226
|
-
`policies/management.md` are
|
|
227
|
-
|
|
223
|
+
`policies/management.md` are reconciler-owned (see body intro) — NOT in
|
|
224
|
+
the agent's write surface for this skill.
|
|
228
225
|
|
|
229
|
-
Frontmatter validation enforces `
|
|
230
|
-
|
|
226
|
+
Frontmatter validation enforces `type: rule`, `kind: policy`,
|
|
227
|
+
`owner: agent`, `status`, `created_at` (YYYY-MM-DD), `origin`,
|
|
228
|
+
`updated` (ISO), an H1, and the slug rules in Step 4 — see 5.3 for the
|
|
229
|
+
full required set. Malformed writes return 422 with the failing
|
|
231
230
|
field — surface that text to the user verbatim rather than retrying
|
|
232
231
|
blindly.
|
|
233
232
|
|
|
@@ -76,11 +76,10 @@ reconciler can resolve them.
|
|
|
76
76
|
|
|
77
77
|
## 5.4 _(no manual step required)_
|
|
78
78
|
|
|
79
|
-
`policies/management-captures/_index.md`
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
doing so just races the reconciler and creates snapshot churn.
|
|
79
|
+
Both `policies/management-captures/_index.md` and the `## Active Policies`
|
|
80
|
+
section in `policies/management.md` are reconciler-owned and re-render
|
|
81
|
+
within ~10 s of step 5.3's write (see SKILL.md body intro — no manual
|
|
82
|
+
PATCH/PUT).
|
|
84
83
|
|
|
85
84
|
If you need to confirm the index is up to date before replying to the
|
|
86
85
|
user, GET `policies/management-captures/_index` after a short wait. The
|
|
@@ -41,10 +41,9 @@ language-agnostic** — it applies whatever language the agent uses
|
|
|
41
41
|
with the user.
|
|
42
42
|
|
|
43
43
|
Anti-examples (non-exhaustive — the positive rule above is
|
|
44
|
-
load-bearing, not this list): "Good morning!", "
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
these in any language also fail the positive rule.
|
|
44
|
+
load-bearing, not this list): "Good morning!", "Summary:", "Done.",
|
|
45
|
+
"Heads-up —". Near-synonyms of these in any language also fail the
|
|
46
|
+
positive rule.
|
|
48
47
|
|
|
49
48
|
### No internal mechanism names
|
|
50
49
|
|
|
@@ -56,9 +55,8 @@ user-visible text. Those go in Agent Log only.
|
|
|
56
55
|
|
|
57
56
|
### No filler timing commentary
|
|
58
57
|
|
|
59
|
-
Forbidden — "Just a heads-up", "
|
|
60
|
-
|
|
61
|
-
itself carries it.
|
|
58
|
+
Forbidden — "Just a heads-up", "About N hours left", "FYI". If timing
|
|
59
|
+
matters, the deadline / event time itself carries it.
|
|
62
60
|
|
|
63
61
|
### No table-of-contents readback
|
|
64
62
|
|
|
@@ -96,16 +94,16 @@ Notify when **all three** are true: (1) **actionable** or requires awareness, (2
|
|
|
96
94
|
- **A pending Agent Plan row / scheduled DM is already set to fire
|
|
97
95
|
for this item within the next 2 hours** — let the planned channel
|
|
98
96
|
deliver; don't pre-empt it.
|
|
99
|
-
- **
|
|
100
|
-
- **Over the rate-limit caps (3/hour, 12/day; `critical` bypasses both)** — do NOT spam-retry. The endpoint does NOT signal this: `/api/notify` returns `200 {status:"sent"}` even when quiet-hours or the rate-limit silently drops the message, so a `"sent"` response is not proof of delivery. Self-throttle by checking `<today>` `## Agent Log` before firing; if you suspect suppression, log the skip rather than re-posting. If time-critical, upgrade priority at next opportunity
|
|
97
|
+
- **Already delivered this item** — `/api/notify` sends immediately and a `200 {status:"sent"}` is proof of delivery, so do NOT re-post on a 200. Self-throttle via `<today>` `## Agent Log` before firing and log the skip rather than re-posting. (No endpoint quiet-hours or rate cap gates this for you — noise control is your job.)
|
|
101
98
|
- **Routine file changes** or **agent internal state** — use Agent Log instead
|
|
102
99
|
- **When in doubt — prefer silence**
|
|
103
100
|
|
|
104
101
|
## Priority
|
|
105
102
|
|
|
106
103
|
**Default to `normal`.** Reserve `high` for 8h-delay-matters. Reserve
|
|
107
|
-
`critical` for 3am-matters.
|
|
108
|
-
|
|
104
|
+
`critical` for 3am-matters. `priority` is metadata recorded in the
|
|
105
|
+
notification log — it does not gate delivery on this endpoint. Full
|
|
106
|
+
per-level table and examples are in the priority reference below.
|
|
109
107
|
|
|
110
108
|
{{> ref:priority }}
|
|
111
109
|
|
|
@@ -120,5 +118,5 @@ curl -s -X POST http://localhost:8321/api/notify \
|
|
|
120
118
|
-H 'Content-Type: application/json' \
|
|
121
119
|
-d '{"message": "Design review starts in 15 minutes.", "priority": "normal"}'
|
|
122
120
|
```
|
|
123
|
-
Fields: `message` (required, markdown), `priority` (optional: critical/high/normal/low), `platform` (optional, override target).
|
|
124
|
-
Response: `{ "status": "sent", "notificationId": "..." }
|
|
121
|
+
Fields: `message` (required, markdown), `priority` (optional: critical/high/normal/low), `platform` (optional, override target) OR `platforms` (optional, array of targets) — mutually exclusive, not both.
|
|
122
|
+
Response: `200 { "status": "sent", "notificationId": "...", "dispatchId": "..." }` = delivered to ≥1 channel; a total delivery failure returns HTTP 500 (not a silent 200-drop). Risk tier: `Autonomous` — the agent decides when to notify; recorded in `notification_log` for the on-demand retrospective.
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
kind: reference
|
|
3
3
|
name: priority
|
|
4
|
-
description: Notification priority levels — critical / high / normal / low —
|
|
4
|
+
description: Notification priority levels — critical / high / normal / low — as metadata you set, with per-level usage examples.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Notification priority levels
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
`priority` is a metadata field you set on the `/api/notify` call. It
|
|
10
|
+
travels into `notification_log` and helps the user (and the
|
|
11
|
+
retrospective) gauge how urgent each message was. It does NOT gate
|
|
12
|
+
delivery on this endpoint — `/api/notify` sends immediately regardless
|
|
13
|
+
of level. Pick the lowest priority that still honestly describes the
|
|
14
|
+
message. **Default to `normal`.**
|
|
11
15
|
|
|
12
|
-
| Priority |
|
|
13
|
-
|
|
14
|
-
| `critical` |
|
|
15
|
-
| `high` |
|
|
16
|
-
| `normal` |
|
|
17
|
-
| `low` |
|
|
16
|
+
| Priority | Use for |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `critical` | Security alerts (credential leak, account lockout), data-loss risk (about to overwrite without backup, irreversible deletion in flight), system errors blocking the user from working. The "wake the user at 3 am" tier. |
|
|
19
|
+
| `high` | Hard deadlines firing in the next 8 hours, urgent inbound messages from people the user has flagged as priority, "meeting starting now". Important but not 3 am. |
|
|
20
|
+
| `normal` | Regular reminders (`15 min until standup`), digest-style summaries, single-recipient FYIs the user opted into. **Default.** |
|
|
21
|
+
| `low` | Background updates, observational FYIs the user did not explicitly ask for, optional context. Often better as an Agent Log entry instead of a notification at all. |
|
|
18
22
|
|
|
19
23
|
## Examples by level
|
|
20
24
|
|
|
@@ -47,19 +51,18 @@ If the next morning would still be soon enough, it is not `high`.
|
|
|
47
51
|
If the user did not opt in to receiving this category of update, do not
|
|
48
52
|
send `low`. Drop it to an Agent Log entry instead.
|
|
49
53
|
|
|
50
|
-
##
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
rather than re-sending at the same level.
|
|
54
|
+
## Delivery semantics
|
|
55
|
+
|
|
56
|
+
`/api/notify` delivers immediately — there is no quiet-hours gate, no
|
|
57
|
+
per-priority suppression, and no rate cap on this endpoint. A `200
|
|
58
|
+
{status:"sent"}` means the message was delivered to at least one
|
|
59
|
+
channel; a total delivery failure THROWS and surfaces as HTTP 500 (not
|
|
60
|
+
a silent 200-drop). So `"sent"` IS proof of delivery — do NOT re-post
|
|
61
|
+
the same item on a 200.
|
|
62
|
+
|
|
63
|
+
Noise control is YOUR job, not the endpoint's. The agent CANNOT query
|
|
64
|
+
`notification_log` directly (Approve-tier), so use `<today>` `## Agent
|
|
65
|
+
Log` as the authoritative dedup source (look for `notify sent` / `DM
|
|
66
|
+
sent` lines) and self-throttle before firing. Don't re-send the same
|
|
67
|
+
item at the same level; if the situation has genuinely escalated, raise
|
|
68
|
+
the priority metadata to reflect that.
|
|
@@ -29,7 +29,7 @@ delegated mode:
|
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
31
|
curl -s http://localhost:8321/api/notion/databases
|
|
32
|
-
# → { databases: { "
|
|
32
|
+
# → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Resolve label → UUID here BEFORE the `/exec` call so your `task`
|
|
@@ -26,7 +26,7 @@ delegated mode:
|
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
curl -sS http://localhost:8321/api/notion/databases
|
|
29
|
-
# → { databases: { "
|
|
29
|
+
# → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Resolve label → UUID here BEFORE the `/exec` call so your `task`
|
|
@@ -26,7 +26,7 @@ delegated mode:
|
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
curl -sS http://localhost:8321/api/notion/databases
|
|
29
|
-
# → { databases: { "
|
|
29
|
+
# → { databases: [ { "label": "<label>", "id": "<uuid>" }, ... ] }
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Resolve label → UUID here BEFORE the `/exec` call so your `task`
|