@aitne-sh/aitne 0.1.11 → 0.1.13

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 (151) hide show
  1. package/README.md +4 -0
  2. package/agent-assets/agent-profiles/background-task.md +8 -1
  3. package/agent-assets/agent-profiles/routine-fetch-window.md +11 -0
  4. package/agent-assets/agents/evening-review/agent.md +6 -2
  5. package/agent-assets/agents/lesson-maintenance/agent.md +56 -0
  6. package/agent-assets/agents/morning-routine/agent.md +10 -6
  7. package/agent-assets/agents/source-librarian/agent.md +51 -0
  8. package/agent-assets/docs/concepts/agent-day.md +15 -15
  9. package/agent-assets/docs/concepts/auth-health.md +10 -7
  10. package/agent-assets/docs/concepts/backends-and-tiers.md +34 -23
  11. package/agent-assets/docs/concepts/costs-and-quotas.md +10 -10
  12. package/agent-assets/docs/concepts/delegated-mode.md +18 -18
  13. package/agent-assets/docs/concepts/memory-model.md +25 -24
  14. package/agent-assets/docs/concepts/observations.md +27 -19
  15. package/agent-assets/docs/concepts/process-keys.md +25 -26
  16. package/agent-assets/docs/concepts/routines.md +18 -17
  17. package/agent-assets/docs/concepts/safety-and-execution.md +20 -17
  18. package/agent-assets/docs/concepts/safety-model.md +16 -15
  19. package/agent-assets/docs/concepts/skills.md +7 -4
  20. package/agent-assets/docs/features/integrations/browser-history.md +52 -47
  21. package/agent-assets/docs/features/integrations/calendar.md +7 -7
  22. package/agent-assets/docs/features/integrations/git.md +15 -13
  23. package/agent-assets/docs/features/integrations/github.md +12 -10
  24. package/agent-assets/docs/features/integrations/mail.md +47 -45
  25. package/agent-assets/docs/features/integrations/notion.md +15 -11
  26. package/agent-assets/docs/features/integrations/obsidian.md +27 -23
  27. package/agent-assets/docs/features/lifestyle/git.md +7 -8
  28. package/agent-assets/docs/features/lifestyle/reading.md +11 -8
  29. package/agent-assets/docs/features/lifestyle/receipts.md +21 -22
  30. package/agent-assets/docs/features/lifestyle/travel-bookings.md +9 -9
  31. package/agent-assets/docs/features/memory-files/agent-journal.md +12 -10
  32. package/agent-assets/docs/features/memory-files/agent-lessons.md +46 -21
  33. package/agent-assets/docs/features/memory-files/projects.md +13 -14
  34. package/agent-assets/docs/features/memory-files/roadmap.md +16 -15
  35. package/agent-assets/docs/features/memory-files/schedule.md +10 -10
  36. package/agent-assets/docs/features/memory-files/today.md +18 -18
  37. package/agent-assets/docs/features/memory-files/user-profile.md +17 -17
  38. package/agent-assets/docs/features/messaging/bang-commands.md +15 -15
  39. package/agent-assets/docs/features/messaging/dashboard-chat.md +8 -7
  40. package/agent-assets/docs/features/messaging/discord.md +7 -5
  41. package/agent-assets/docs/features/messaging/overview.md +14 -14
  42. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +12 -12
  43. package/agent-assets/docs/features/messaging/slack.md +9 -8
  44. package/agent-assets/docs/features/messaging/telegram.md +7 -7
  45. package/agent-assets/docs/features/messaging/whatsapp.md +6 -6
  46. package/agent-assets/docs/features/operations/activity-and-conversations.md +9 -9
  47. package/agent-assets/docs/features/operations/approvals.md +13 -12
  48. package/agent-assets/docs/features/operations/backend-routing.md +38 -37
  49. package/agent-assets/docs/features/operations/browser-tasks.md +63 -57
  50. package/agent-assets/docs/features/operations/cost-tracking.md +5 -5
  51. package/agent-assets/docs/features/operations/managed-chromium.md +23 -22
  52. package/agent-assets/docs/features/operations/notifications.md +15 -15
  53. package/agent-assets/docs/features/operations/quiet-hours.md +14 -15
  54. package/agent-assets/docs/features/operations/schedule-approaching.md +16 -14
  55. package/agent-assets/docs/features/routines/activity-scan.md +14 -11
  56. package/agent-assets/docs/features/routines/custom-routines.md +9 -7
  57. package/agent-assets/docs/features/routines/evening-review.md +6 -7
  58. package/agent-assets/docs/features/routines/morning-routine.md +23 -22
  59. package/agent-assets/docs/features/routines/weekly-review.md +57 -51
  60. package/agent-assets/docs/features/wiki/commands.md +28 -22
  61. package/agent-assets/docs/features/wiki/cost-and-approval.md +28 -23
  62. package/agent-assets/docs/features/wiki/dashboard.md +22 -24
  63. package/agent-assets/docs/features/wiki/overview.md +17 -25
  64. package/agent-assets/docs/features/wiki/search.md +15 -17
  65. package/agent-assets/docs/features/wiki/workspaces.md +55 -56
  66. package/agent-assets/docs/getting-started/01-what-is-this.md +4 -5
  67. package/agent-assets/docs/getting-started/02-first-steps.md +12 -13
  68. package/agent-assets/docs/getting-started/03-what-can-this-do.md +7 -7
  69. package/agent-assets/docs/getting-started/04-first-day.md +4 -5
  70. package/agent-assets/docs/glossary.md +21 -19
  71. package/agent-assets/docs/guides/add-a-custom-routine.md +17 -12
  72. package/agent-assets/docs/guides/backup-and-restore.md +19 -16
  73. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +57 -62
  74. package/agent-assets/docs/guides/build-your-wiki.md +11 -12
  75. package/agent-assets/docs/guides/change-which-model-handles-x.md +30 -28
  76. package/agent-assets/docs/guides/connect-a-new-mail-account.md +30 -29
  77. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +30 -32
  78. package/agent-assets/docs/guides/import-knowledge-file.md +9 -10
  79. package/agent-assets/docs/guides/install-and-run.md +9 -10
  80. package/agent-assets/docs/guides/maintain-wiki-health.md +10 -10
  81. package/agent-assets/docs/guides/migrate-machines.md +16 -14
  82. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +12 -13
  83. package/agent-assets/docs/guides/pause-the-agent.md +25 -25
  84. package/agent-assets/docs/guides/reinstall-cleanly.md +13 -12
  85. package/agent-assets/docs/guides/setup-wizard.md +10 -12
  86. package/agent-assets/docs/guides/switch-default-backend.md +9 -9
  87. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +9 -11
  88. package/agent-assets/docs/pages/activity.md +76 -0
  89. package/agent-assets/docs/pages/agents.md +78 -0
  90. package/agent-assets/docs/pages/analytics.md +70 -0
  91. package/agent-assets/docs/pages/browser.md +73 -0
  92. package/agent-assets/docs/pages/chat.md +67 -0
  93. package/agent-assets/docs/pages/connections.md +78 -0
  94. package/agent-assets/docs/pages/git.md +73 -0
  95. package/agent-assets/docs/pages/knowledge.md +75 -0
  96. package/agent-assets/docs/pages/overview.md +90 -0
  97. package/agent-assets/docs/pages/reading.md +65 -0
  98. package/agent-assets/docs/pages/settings.md +77 -0
  99. package/agent-assets/docs/pages/tasks.md +74 -0
  100. package/agent-assets/docs/pages/wiki.md +73 -0
  101. package/agent-assets/docs/reference/api.md +18 -17
  102. package/agent-assets/docs/reference/cli-commands.md +13 -10
  103. package/agent-assets/docs/reference/config.md +40 -35
  104. package/agent-assets/docs/reference/disallowed-tools.md +18 -17
  105. package/agent-assets/docs/reference/keyboard-shortcuts.md +6 -8
  106. package/agent-assets/docs/reference/knowledge-layout.md +10 -10
  107. package/agent-assets/docs/reference/process-keys.md +20 -22
  108. package/agent-assets/docs/reference/skills.md +18 -16
  109. package/agent-assets/docs/troubleshooting/auth-failed.md +13 -11
  110. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +10 -10
  111. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +26 -24
  112. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +8 -9
  113. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +19 -18
  114. package/agent-assets/docs/troubleshooting/observation-not-detected.md +14 -15
  115. package/agent-assets/docs/troubleshooting/quota-exhausted.md +28 -26
  116. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +35 -34
  117. package/agent-assets/docs/troubleshooting/wiki-write-failed.md +21 -24
  118. package/agent-assets/playbooks/markdown-note.md +43 -0
  119. package/agent-assets/playbooks/monitoring.md +29 -0
  120. package/agent-assets/playbooks/research.md +47 -0
  121. package/agent-assets/skills/agent-create/SKILL.md +71 -32
  122. package/agent-assets/skills/agent-create/references/prompt-frame-extended.md +132 -0
  123. package/agent-assets/skills/agent-create/references/prompt-frame.md +125 -0
  124. package/agent-assets/skills/background-task/SKILL.md +13 -8
  125. package/agent-assets/skills/background-task-reply/SKILL.md +2 -2
  126. package/agent-assets/skills/board/SKILL.md +92 -0
  127. package/agent-assets/skills/browser-history/SKILL.md +3 -3
  128. package/agent-assets/skills/browser-history-respond/SKILL.md +3 -3
  129. package/agent-assets/skills/browser-task/SKILL.md +4 -2
  130. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +2 -1
  131. package/agent-assets/skills/schedule/SKILL.md +21 -18
  132. package/agent-assets/skills/schedule/references/batch.md +1 -1
  133. package/agent-assets/skills/schedule/references/model-selection.md +1 -1
  134. package/agent-assets/skills/schedule/references/prompt-frame.md +125 -0
  135. package/agent-assets/skills/sources/SKILL.md +68 -0
  136. package/agent-assets/skills/sources/curation.json +21 -0
  137. package/agent-assets/skills/sources/seeds/filing-rules.seed.json +25 -0
  138. package/agent-assets/skills/sources/seeds/source-collections.seed.json +20 -0
  139. package/agent-assets/skills/task/SKILL.md +82 -0
  140. package/agent-assets/task-flows/background_task.md +29 -3
  141. package/agent-assets/task-flows/message.received.dm.md +1 -1
  142. package/agent-assets/task-flows/routine.activity_scan.md +17 -2
  143. package/agent-assets/task-flows/routine.evening_review.md +72 -11
  144. package/agent-assets/task-flows/routine.fetch_window.md +21 -0
  145. package/agent-assets/task-flows/routine.monthly_review.md +3 -1
  146. package/agent-assets/task-flows/routine.morning_routine_today.md +26 -7
  147. package/agent-assets/task-flows/routine.source_maintenance.md +50 -0
  148. package/agent-assets/task-flows/scheduled.dm.md +29 -16
  149. package/agent-assets/templates/_manifest.json +1 -0
  150. package/agent-assets/templates/knowledge/sources/_index.md +19 -0
  151. package/package.json +4 -4
@@ -8,6 +8,7 @@
8
8
  { "path": "journal/monthly/*.md", "purpose": "monthly review snapshots (YYYY-MM)", "sections": [{ "heading": "## Theme", "contains": "the month's overall theme" }] },
9
9
  { "path": "policies/*.md", "purpose": "user-controlled policy files", "sections": [{ "heading": "## Why", "contains": "rationale for the rule" }, { "heading": "## How", "contains": "concrete rule shape" }] },
10
10
  { "path": "identity/*.md", "purpose": "user identity and preferences dictionary", "sections": [{ "heading": "## Identity", "contains": "name role tz" }] },
11
- { "path": "journal/agent.md", "purpose": "agent-owned weekly + monthly self-critique", "sections": [{ "heading": "## Weekly", "contains": "what worked, what slipped, improvements" }] }
11
+ { "path": "journal/agent.md", "purpose": "agent-owned weekly + monthly self-critique", "sections": [{ "heading": "## Weekly", "contains": "what worked, what slipped, improvements" }] },
12
+ { "path": "knowledge/sources/*/*.md", "purpose": "source-document cards: summaries of user-sent files (PDF/PPTX/docs) stored in the source library; write via the sources skill", "sections": [{ "heading": "# <Title>", "contains": "summary + source_id frontmatter + project link" }] }
12
13
  ]
13
14
  }
@@ -25,15 +25,14 @@ user but compound into duplicate DMs/notifications at fire time.
25
25
  1. **Agent Plan check.** Scan `<today>` `## Agent Plan` for a row with
26
26
  HH:MM within ±15 min of your target AND an overlapping subject. If
27
27
  present, the plan is already in place — do NOT add a second one.
28
- 2. **Pending schedule check.** `GET /api/schedule?status=pending,running`
29
- and look for an item whose `scheduledFor` is within ±15 min of your
30
- target with a matching `description` subject. If found, skip (or
31
- PATCH the existing item if it needs updating — never register a
32
- parallel second one).
33
- 3. **Recurring check.** `GET /api/recurring-schedules?enabled=true` to
34
- confirm no recurring rule/Agent already covers this cadence (e.g. a
35
- daily 09:00 inbox triage, or the morning briefing). If covered, skip.
36
- (How recurring work/DMs are created — see "Recurring" below.)
28
+ 2. **Pending schedule check.** In a live owner DM pending one-off rows
29
+ appear in `<scheduled_reminders>` dedup there and cancel/PATCH any
30
+ the conversation made moot. Else `GET
31
+ /api/schedule?status=pending,running` for one within ±15 min with a
32
+ matching `description`; if found, skip or PATCH.
33
+ 3. **Recurring check.** `GET /api/recurring-schedules?enabled=true&includeClaimed=true`
34
+ confirm no recurring rule/Agent covers this cadence (a `claimedByAgentSlug`
35
+ row is Agent-owned and counts). If covered, skip (see "Recurring" below).
37
36
  4. **`confirm_dedup_key` check (mandatory for `confirm:` sub-flow rows
38
37
  only).** When scheduling a `dm_session` row with
39
38
  `taskContext.sub_flow="confirm"`, run the dedup pre-check + shape
@@ -74,14 +73,16 @@ record, create the recurring work/DM per the "Recurring" section below.
74
73
 
75
74
  > **The wake-up agent has NO memory of why it was scheduled.** A `scheduled.task` session is self-contained: it receives only `state/today.md` (which carries the day's schedule and state) plus the `prompt` + `taskContext` you provide — **NOT** `identity/profile.md` or `policies/management.md` (the `scheduled.task` injection policy opts those out). Nothing else. (`description` is just an optional list label — never the agent body.)
76
75
 
77
- Include all four elements in the `prompt`:
76
+ Author the `prompt` with the **core frame** below. A one-shot task rarely needs the
77
+ extended (operational) sections; if a one-shot *does* mutate code or state, add two
78
+ sections on top of the core frame — `# Scope` (WHERE it may act: the editable
79
+ surface, and what it must not touch) and `# Verification` (which checks confirm the
80
+ change is good, and "don't claim success unless they passed").
78
81
 
79
- | Element | What it answers |
80
- |---|---|
81
- | **What** | Specific verb + object (notify, check, update, prepare) |
82
- | **Why** | The trigger or reason (meeting approaching, deadline, user request) |
83
- | **Who/What** | Concrete names, IDs, URLs, filenames |
84
- | **Expected output** | What "success" looks like (notification sent, file updated) |
82
+ {{> ref:prompt-frame }}
83
+
84
+ For a simple one-shot a timed reminder the frame collapses to one tight,
85
+ self-contained brief:
85
86
 
86
87
  **Good:** `"15-minute reminder for the 14:00 design review. Attendees: Sarah, Mike. Agenda: API v2 breaking changes. Prepare the meeting-note template and notify the user via Slack."`
87
88
 
@@ -165,7 +166,7 @@ curl -s -X PATCH http://localhost:8321/api/schedule/42 \
165
166
  -H 'Content-Type: application/json' \
166
167
  -d '{"time":"2026-04-06T17:00:00-04:00"}'
167
168
  ```
168
- Fields: `time` (ISO 8601), `prompt` (the agent instruction, ≤8000 chars, non-dm only, OR `null` to clear on a legacy row), `description` (optional label ≤200 chars, non-dm only), `message` (dm only), `tier` (`lite`/`medium`/`high` OR `null` to clear), `model` (registered id / alias / composite OR `null` to clear), `taskContext`. At least one required. Only `pending` items editable. `description`/`message` mutually exclusive; `prompt`/`message` mutually exclusive. Tier ↔ model swap form is in the model-selection reference above. Response: `{ "status":"updated", "id":42, "warnings":[] }` / 404 / 409 — surface `warnings[]` (e.g. `schedule.model_deprecated`) to the next turn.
169
+ Fields: `time` (ISO 8601), `prompt` (the agent instruction, ≤8000 chars, non-dm only cannot be cleared; a row must always carry a non-empty prompt), `description` (optional label ≤200 chars, non-dm only), `message` (dm only), `tier` (`lite`/`medium`/`high` OR `null` to clear), `model` (registered id / alias / composite OR `null` to clear), `taskContext`. At least one required. Only `pending` items editable. `description`/`message` mutually exclusive; `prompt`/`message` mutually exclusive. Tier ↔ model swap form is in the model-selection reference above. Response: `{ "status":"updated", "id":42, "warnings":[] }` / 404 / 409 — surface `warnings[]` (e.g. `schedule.model_deprecated`) to the next turn.
169
170
 
170
171
  ### GET /api/schedule — List scheduled items
171
172
  ```bash
@@ -220,7 +221,9 @@ model, batch) are in the errors reference below.
220
221
  (its fire time can track quiet-hours; PATCH/DELETE edit it). The morning
221
222
  briefing is one of these.
222
223
 
223
- `GET /api/recurring-schedules` stays read-only for the dedup pre-check.
224
+ `GET /api/recurring-schedules` stays read-only for the dedup pre-check; `includeClaimed=true`
225
+ keeps Agent-claimed (`claimedByAgentSlug`) + trigger-owned (`claimedByTriggerId`) rows visible.
226
+ Writes on claimed rows: **409** → `/api/agents/<slug>`; trigger-owned → `/api/triggers/<id>`.
224
227
 
225
228
  ### recurrenceRule grammar — the shared recurrence engine
226
229
 
@@ -57,7 +57,7 @@ curl -s -X POST http://localhost:8321/api/schedule/batch \
57
57
  | `rows[].taskContext.sub_flow` | No | Branches the task-flow rendering when the dispatcher needs a specialised sub-flow. |
58
58
  | `rows[].taskPrompt` | No | Override for the agent body (min 20 chars when set). |
59
59
  | `rows[].correlationId` | No | Defaults to the morning routine's correlation id when omitted. |
60
- | `rows[].model` | No | Registered model id (`claude-opus-4-8`, `claude-sonnet-4-6`, `gpt-5.4`, `gemini-3.1-pro-preview`, …), legacy alias (`sonnet` / `opus` — auto-rewritten to `tier`), composite `<backendId>/<modelId>`, or `null`. Mutually exclusive with `rows[].tier`. Omit both to let `process_backend_config` decide. |
60
+ | `rows[].model` | No | Registered model id (`claude-opus-4-8`, `claude-sonnet-5`, `gpt-5.4`, `gemini-3.1-pro-preview`, …), legacy alias (`sonnet` / `opus` — auto-rewritten to `tier`), composite `<backendId>/<modelId>`, or `null`. Mutually exclusive with `rows[].tier`. Omit both to let `process_backend_config` decide. |
61
61
  | `atomic` | No | `true` (default) wraps inserts in one transaction — any row error rolls back all. `false` commits successful rows individually. |
62
62
 
63
63
  ## Success
@@ -25,7 +25,7 @@ even after `/settings/models` re-routes the process key). The two are
25
25
  route to `tier:"medium"` / `tier:"high"`; the alias is not stored
26
26
  verbatim.
27
27
  - **Registered model ids** — any id from `MODEL_REGISTRY` across the
28
- four backends. Examples: `claude-opus-4-8`, `claude-sonnet-4-6`,
28
+ four backends. Examples: `claude-opus-4-8`, `claude-sonnet-5`,
29
29
  `claude-haiku-4-5-20251001`, `gpt-5.4`, `gemini-3.1-pro-preview`.
30
30
  The row persists `(model, backend_id)` together so the dispatcher
31
31
  honors the pin at fire time.
@@ -0,0 +1,125 @@
1
+ ---
2
+ kind: reference
3
+ name: prompt-frame
4
+ description: The canonical core prompt frame (# Role / # Important / # Instruction / # Output), the operating-playbook references, and the clarify-back gate the DM agent uses to author a deployed agent's prompt. Shared byte-identical between agent-create and schedule.
5
+ ---
6
+
7
+ ### The core frame
8
+
9
+ Author the deployed agent's prompt as this Markdown skeleton. It is classic,
10
+ model-agnostic structure and reads identically under every backend. Keep it well
11
+ under the 8000-char cap — durable methodology lives in the playbooks (below), not
12
+ inlined here.
13
+
14
+ ```markdown
15
+ # Role
16
+ You are <agent identity>. Every <cadence> you <the single outcome this agent exists for>.
17
+
18
+ # Important
19
+ - <hard constraints & rules to uphold>
20
+ - Preconditions: read <inputs> first; if <precondition> is missing, <fallback> and do not guess.
21
+ - Do NOT <the things that would make the output wrong or unsafe>.
22
+ - <playbook reference — name the methodology you'll follow, e.g. "Follow the research playbook.">
23
+
24
+ # Instruction
25
+ 1. <ordered, concrete step — specific verb + endpoint / filename / decision rule>
26
+ 2. <step — include a worked EXAMPLE wherever a step is non-obvious>
27
+ e.g. "Classify each item actionable-today / FYI / ignore — 'PR review requested' → actionable-today; a newsletter → ignore."
28
+ 3. ...
29
+
30
+ # Output
31
+ - <format & destination: which file / section, frontmatter, append-vs-new-file, when/whether to DM>
32
+ - <if writing a note, say "follow the markdown-note playbook for structure">
33
+ - (Omit this section only when the task produces no durable artifact and no DM.)
34
+ ```
35
+
36
+ Rules that make the difference between a sharp agent and a drifting one:
37
+
38
+ - **`# Instruction` steps must include concrete examples.** A step the agent could
39
+ read two ways needs a worked example pinning the intended one. Vague steps are
40
+ the #1 cause of a drifting agent.
41
+ - **`# Important` is the guardrail section** — preconditions, fallbacks, the
42
+ explicit "do NOT" list, and the playbook reference all live here. Don't scatter
43
+ guardrails across the other sections.
44
+ - **The deployed agent has no memory of this conversation.** Everything it needs is
45
+ in the prompt or in a playbook it is told to follow — nothing else carries over.
46
+
47
+ Migrating from the old four-element skeleton:
48
+
49
+ | Old element | New home |
50
+ |---|---|
51
+ | Goal | `# Role` (identity + the single outcome) |
52
+ | Requirements / preconditions | `# Important` (preconditions + fallbacks) |
53
+ | Process | `# Instruction` (ordered steps, **with examples**) |
54
+ | Expected output | `# Output` |
55
+ | guardrails / "what NOT to do" | `# Important` |
56
+
57
+ ### Operating playbooks (never inline the full text)
58
+
59
+ Durable methodology lives in the operating playbooks, kept central so a single
60
+ update reaches every agent. Do NOT paste a playbook's full content into the prompt
61
+ — that copy would silently go stale. How the methodology reaches the run depends
62
+ on the path:
63
+
64
+ - **Recurring Agent** (agent definition): name the playbook in `# Important` AND
65
+ declare its slug in the top-level `playbooks:` field. The daemon then injects the
66
+ full methodology into every run — the single, guaranteed copy in the prompt.
67
+ - **One-off task** (`/schedule`): there is no `playbooks:` field and no injection.
68
+ Fold the handful of steps you actually need straight into `# Instruction`; a
69
+ run-once task has no staleness concern, so inlining is the right call here.
70
+
71
+ | If the agent's job is… | Name this playbook in `# Important` | Also |
72
+ |---|---|---|
73
+ | Research a topic and report | "Follow the **research** playbook." | + markdown-note if it writes a note |
74
+ | Watch something and report changes | "Follow the **monitoring** playbook." | + markdown-note for the rolling note |
75
+ | Produce / update a free-form topic note | "Follow the **markdown-note** playbook." | — |
76
+
77
+ The markdown-note playbook governs *free-form topic notes only* — never the
78
+ structured context-vault files (today.md, journal, roadmap), which keep their own
79
+ schemas.
80
+
81
+ ### Clarify-back before you deploy
82
+
83
+ If a required slot for the agent's archetype is unknown from the conversation, ask
84
+ the user **one consolidated question** before creating the agent — never guess. (The
85
+ runtime drops an ambiguous task rather than salvaging it, so ambiguity has to be
86
+ resolved now.) Batch all missing slots into a single message and pair each with a
87
+ sensible **default** the user can accept in one tap. Ask only *missing, required*
88
+ slots — don't interrogate.
89
+
90
+ | Archetype | Required slots (ask only if unknown) | Sensible default |
91
+ |---|---|---|
92
+ | **Research** | topic/scope; what you mainly want (a decision? situational awareness? specific sub-questions?); depth (how many angles/sources); output destination (Obsidian note? DM? both); cadence + time | medium depth (3–5 angles); Obsidian note + short DM digest |
93
+ | **Monitoring / digest** | what to watch; what counts as a noteworthy change; where to record; notify threshold (always vs only-on-change) | notify only on material change; record to a rolling note |
94
+ | **Any task writing a note** | destination path; title pattern; append-to-existing vs new-file-per-run | new dated file under the topic folder |
95
+
96
+ ### Worked example — a content agent
97
+
98
+ **Good** (research → note; core frame + playbook references):
99
+
100
+ ```markdown
101
+ # Role
102
+ You are the user's AI-news researcher. Every morning you produce a verified digest
103
+ of the most important AI developments from the last 24h.
104
+
105
+ # Important
106
+ - Read context/research/ai-news.md for what you already reported; don't repeat it.
107
+ - Follow the **research** playbook for method + source verification, and the
108
+ **markdown-note** playbook for the note's shape.
109
+ - Do NOT include a claim backed by a single source without marking it "(single source)".
110
+
111
+ # Instruction
112
+ 1. Pick 3–5 distinct angles not already covered in the existing note.
113
+ 2. For each angle, find 2–4 authoritative sources with WebSearch; open the top 1–2
114
+ in full if the agent has page-fetch access (a standard scheduled agent does not).
115
+ e.g. for "model releases" prefer the lab's own post over a news aggregator.
116
+ 3. Cross-check every material claim against ≥ 2 sources before including it.
117
+
118
+ # Output
119
+ - Write context/research/ai-news/<YYYY-MM-DD>-digest.md per the markdown-note playbook.
120
+ - DM the user the 2–4 sentence "what matters" summary + the note path.
121
+ ```
122
+
123
+ **Bad:** `"Research the latest AI news every morning and send me a summary."` — no
124
+ preconditions, no method, no source bar, no output contract; the agent improvises
125
+ differently (and shallowly) every day.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: sources
3
+ description: Load to manage the durable source library (user-sent PDFs/PPTX/docs) — list unfiled sources, file them as knowledge/sources/ cards, promote images, or send a stored source back. SKIP for delivering files you generated this turn (attach) or general vault edits (context).
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Bash(unzip *)
7
+ - Read
8
+ - Write
9
+ ---
10
+
11
+ # Source library
12
+
13
+ Document attachments the user sends (PDF, PPTX, DOCX, XLSX, ODT) are captured automatically into a durable library the moment they arrive — they survive chat pruning. Each source is a ledger row (`src_…` id) plus the original bytes. Your job is the *organization* layer: write a markdown **card** for each source under `knowledge/sources/<collection>/`, link it to projects, and keep the collections tidy.
14
+
15
+ - **Bash is limited to `curl` and `unzip`, literal arguments only.** No `$VAR` / `$(...)` / pipes / chained commands — anything else is silently denied. Pre-compute values and write literals.
16
+ - Cards are written via the `context` API (this skill shows the calls); the library API below only records metadata and bindings.
17
+
18
+ ## API (all on `http://localhost:8321`)
19
+
20
+ | Verb | Purpose |
21
+ |---|---|
22
+ | `GET /api/sources?status=unfiled` | List sources awaiting filing (also `filed`, `archived`; `limit`/`offset`). |
23
+ | `GET /api/sources/<id>` | One source's metadata (filename, mime, size, caption, provenance, cardPath). |
24
+ | `GET /api/sources/<id>/file` | The original bytes. Save to the workdir: `curl -s -o ./src-deck.pdf http://localhost:8321/api/sources/<id>/file` |
25
+ | `POST /api/sources/promote` | Capture a chat attachment the auto-capture skipped (images, audio): `{"attachmentId":"<uuid>","caption":"…"}`. Returns the `src_…` id (`deduped:true` if already stored). |
26
+ | `PATCH /api/sources/<id>` | Record the filing: `{"cardPath":"knowledge/sources/<collection>/<slug>.md"}` (implies `status:"filed"`). Also `{"status":"archived"}` for junk, `{"caption":"…"}`. |
27
+ | `POST /api/sources/<id>/export` | Copy the original binary into the user's external Obsidian vault: `{"target":"obsidian"}`. Lands at `sources/<file>` with a companion note embedding it (`{"note":false}` to skip). 409 if no external vault is configured. For **Notion**, there is no binary path — create a page from the card markdown via `POST /api/notion/pages` instead. |
28
+
29
+ Errors use the standard agent-error envelope; `404 sources.not_found` means a stale id — re-list. Never DELETE a source; archive instead (deletion is owner-only).
30
+
31
+ ## Filing a source (the core loop)
32
+
33
+ 1. `GET /api/sources?status=unfiled` — pick a source.
34
+ 2. Understand it. PDFs: fetch the bytes to the workdir and `Read` the file directly. PPTX/DOCX are zip archives of XML — best-effort text peek with `unzip -p ./src-deck.pptx ppt/slides/slide1.xml` (one file per call, no pipes; read the text between the XML tags in the output). If `unzip` is unavailable on this platform, fall back to filename + caption — they often suffice.
35
+ 3. Choose a collection per the taxonomy below (create a new one only when nothing fits).
36
+ 4. Write the card:
37
+
38
+ ```bash
39
+ curl -s -X PUT http://localhost:8321/api/context/knowledge/sources/acme-launch/pitch-deck.md \
40
+ -H "Content-Type: application/json" \
41
+ -d '{"content":"---\ntype: source\nowner: agent\nupdated: 2026-07-01\nsource_id: src_1234\nmime: application/pdf\nreceived: 2026-07-01\nprovenance: user_telegram\n---\n# Acme launch pitch deck\n\nOne-paragraph summary of what the document contains and why the user sent it.\n\nProject: [[acme-launch]]\n"}'
42
+ ```
43
+
44
+ 5. Bind it: `curl -s -X PATCH http://localhost:8321/api/sources/src_1234 -H "Content-Type: application/json" -d '{"cardPath":"knowledge/sources/acme-launch/pitch-deck.md"}'`
45
+ 6. If the source belongs to a project, add a `- [[knowledge/sources/acme-launch/pitch-deck|Pitch deck]]` line under a `## Sources` heading in `plans/projects/<slug>.md` (PATCH, append mode).
46
+ 7. Keep `knowledge/sources/_index.md` current: one line per collection with a one-phrase scope.
47
+
48
+ ## Reorganizing
49
+
50
+ Move a card = PUT the card at the new path, DELETE the old path (`curl -X DELETE http://localhost:8321/api/context/knowledge/sources/old/card.md`), then PATCH the source's `cardPath`. Deletes are snapshotted — recoverable. Merge singleton collections into broader ones; split collections past ~15 cards.
51
+
52
+ ## Sending a source back to the user
53
+
54
+ Fetch the bytes to the workdir, then deliver through the outbound endpoint (see the `attach` skill for limits):
55
+
56
+ ```bash
57
+ curl -s -o ./src-deck.pdf http://localhost:8321/api/sources/src_1234/file
58
+ curl -s -X POST http://localhost:8321/api/chat/outbound-attachments \
59
+ -H "X-Filename: pitch-deck.pdf" -F "file=@./src-deck.pdf"
60
+ ```
61
+
62
+ ## Collection taxonomy (auto-curated)
63
+
64
+ <!-- CURATION:knowledge_layout id="source-collections" -->
65
+
66
+ ## Filing conventions (auto-curated)
67
+
68
+ <!-- CURATION:convention_notes id="filing-rules" -->
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 1,
3
+ "sections": [
4
+ {
5
+ "id": "source-collections",
6
+ "kind": "knowledge_layout",
7
+ "anchor": "<!-- CURATION:knowledge_layout id=\"source-collections\" -->",
8
+ "human_label": "Source collection taxonomy",
9
+ "description": "Current collections under knowledge/sources/ and what belongs in each",
10
+ "scope_paths": ["knowledge/sources/**"]
11
+ },
12
+ {
13
+ "id": "filing-rules",
14
+ "kind": "convention_notes",
15
+ "anchor": "<!-- CURATION:convention_notes id=\"filing-rules\" -->",
16
+ "human_label": "Source filing conventions",
17
+ "description": "Card slug grammar, card body shape, and project cross-linking rules",
18
+ "scope_paths": ["knowledge/sources/**"]
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "kind": "convention_notes",
3
+ "notes": [
4
+ {
5
+ "topic": "Card slug",
6
+ "rule": "Lowercase [a-z0-9._-], descriptive of the document content, not the filename (strip dates/version noise unless meaningful).",
7
+ "example": "knowledge/sources/acme-launch/pitch-deck.md for 'Acme_Pitch_FINAL_v3 (2).pdf'"
8
+ },
9
+ {
10
+ "topic": "One card per source",
11
+ "rule": "Exactly one card per src_ id; on dedup (same file re-sent) update the existing card's `updated:` instead of writing a second card.",
12
+ "example": "receive_count > 1 on GET /api/sources/<id> means the user re-sent the same bytes"
13
+ },
14
+ {
15
+ "topic": "Collection choice",
16
+ "rule": "Prefer a collection matching an active project slug; use a topical collection for project-less documents; reserve `inbox` for the genuinely unclassifiable.",
17
+ "example": "a tax PDF with no project goes to knowledge/sources/finance/, not inbox"
18
+ },
19
+ {
20
+ "topic": "Project cross-link",
21
+ "rule": "When a source supports a project, the project file gets a `## Sources` bullet linking the card — the card alone is not discoverable from the project side.",
22
+ "example": "plans/projects/acme-launch.md gains: - [[knowledge/sources/acme-launch/pitch-deck|Pitch deck]]"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "kind": "knowledge_layout",
3
+ "files": [
4
+ {
5
+ "path": "knowledge/sources/_index.md",
6
+ "purpose": "Directory of collections — one line per collection with its one-phrase scope",
7
+ "sections": [
8
+ { "heading": "## Collections", "contains": "bullet list: - [[<collection>]] — what belongs there" }
9
+ ]
10
+ },
11
+ {
12
+ "path": "knowledge/sources/*/*.md",
13
+ "purpose": "One card per stored source document; collections usually mirror an active project slug from plans/projects/",
14
+ "sections": [
15
+ { "heading": "# <Title>", "contains": "H1 naming the document in plain words" },
16
+ { "heading": "(body)", "contains": "one-paragraph summary, why the user sent it, and a Project: [[<slug>]] link when one applies" }
17
+ ]
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: task
3
+ description: Unified write facade for tracked work — create/edit/delete any task through one path. POST /api/tasks {kind: reminder|dm|agent|app_fetch|background}; PATCH/DELETE /api/tasks/<ref>. Forwards to the hardened owners (dedup, cascade, dm_session split intact).
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ ---
7
+
8
+ # Task — one path to create, edit, or delete any tracked work
9
+
10
+ Instead of choosing among six creation skills, route every write through
11
+ `/api/tasks`. The facade **forwards** your request to the existing hardened
12
+ owner endpoint by `kind` (create) or ref prefix (edit/delete) — it never
13
+ re-implements them, so each owner's dedup, FK cascade, validation, the
14
+ `dm_session` recurring split, and auth tier all still apply unchanged.
15
+
16
+ Pair it with the **`board`** skill (read inventory + blast-radius).
17
+
18
+ ## Create — `POST /api/tasks`
19
+
20
+ Send `{ "kind": "...", ...ownerFields }`. The facade strips `kind` and forwards
21
+ the rest to the owner, so **provide the owner's own fields** (it does not rename
22
+ them). Pick the kind:
23
+
24
+ | `kind` | Routes to | Provide | Detailed authoring skill |
25
+ |---|---|---|---|
26
+ | `reminder` | `POST /api/schedule/dm` | `time` (ISO8601), `message` | `schedule` |
27
+ | `dm` | `POST /api/recurring-schedules` | `description` (≥20), `recurrenceRule`, `prompt?` (task_type is pinned to `dm_session`) | `schedule` |
28
+ | `agent` | `POST /api/agents` | `slug`, `name`, `schedule` (`{kind:"recurring",recurrence}` or `{kind:"cron",expression}`), `prompt?` | `agent-create` |
29
+ | `app_fetch` | `POST /api/managed-tasks` | `intent`, `app`, `cadence`, `recurrenceRule`, `output_path?` (send an `Idempotency-Key` header) | `managed-tasks` |
30
+ | `background` | `POST /api/background-task` | `brief`, `title?`, `notificationPolicy?` | `background-task` |
31
+
32
+ ```bash
33
+ curl --silent --fail -X POST -H 'Content-Type: application/json' \
34
+ -d '{"kind":"reminder","time":"2026-07-01T15:00:00+09:00","message":"call the dentist"}' \
35
+ http://localhost:8321/api/tasks
36
+ ```
37
+
38
+ For anything beyond the simple case — authoring a full recurring Agent, an
39
+ app-fetch where dedup / output-path shape matter, a self-contained background
40
+ brief — open the **detailed skill** in the last column for its field rules, then
41
+ either POST through that skill directly or mirror its body here. The facade is
42
+ the front door; the specialised skills are the manual.
43
+
44
+ ## Edit / delete — `PATCH` / `DELETE /api/tasks/<ref>`
45
+
46
+ Address the row by its typed `ref` from the board (`rs:<id>`, `mt_<n>`,
47
+ `agent:<slug>`, `as:<id>`, `trigger:<id>`). PATCH forwards your patch body to
48
+ the owning edit endpoint; DELETE forwards to the owning delete (cascade
49
+ preserved). A `trigger:` write routes to `/api/triggers/<id>` (Approve tier;
50
+ `401` = needs the dashboard's authorization; no facade create kind) and its
51
+ delete removes the paired recurring schedule too.
52
+
53
+ ```bash
54
+ curl --silent --fail -X PATCH -H 'Content-Type: application/json' \
55
+ -d '{"enabled":false}' http://localhost:8321/api/tasks/rs:42
56
+
57
+ curl --silent --fail -X DELETE http://localhost:8321/api/tasks/mt_3
58
+ ```
59
+
60
+ ## Response envelope
61
+
62
+ Every dispatch returns the owner's HTTP status with
63
+ `{ ok, dispatchedTo, kind, result }` — `result` is the owner's own body
64
+ (e.g. `{ status:"created", item }`). Read `result` for ids and warnings.
65
+
66
+ ## Hard rules
67
+
68
+ 1. **Localhost only.** `http://localhost:8321/api/tasks*`.
69
+ 2. **A `dm` create is always a `dm_session` row.** You cannot create recurring
70
+ autonomous *work* through `kind:"dm"` — that is `kind:"agent"`. The facade
71
+ enforces this (it never opens the 410'd recurring agent-task door, and never
72
+ stamps an agent id onto a schedule).
73
+ 3. **Editing/deleting an Agent is privileged.** `agent:<slug>` routes to
74
+ `/api/agents`, which may require the dashboard's authorization — a `401` means
75
+ it needs human approval, exactly as editing the Agent directly does. Built-in
76
+ Agents are undeletable (`409`); stopping one needs the stop-warning ack.
77
+ 4. **Fulfillers are read-only here.** `bt:` / `bx:` / `cluster:` refs return
78
+ `422` — manage them on their own surfaces; never resume a force-failed browser
79
+ task or surface a pending `!~` confirm token.
80
+ 5. **Preview destructive changes first.** For a delete/modify the user may not
81
+ fully grasp, run `GET /api/tasks/impact?ref=<ref>` (the `board` skill) and
82
+ confirm the blast radius before acting.
@@ -44,8 +44,8 @@ notification policy. Read it carefully and satisfy it end to end.
44
44
 
45
45
  ## Finishing — the artifact (read this carefully)
46
46
 
47
- `finish(result, draft, notify, significance?)` is the only thing the
48
- owner ever sees the effect of. Each field has a distinct job:
47
+ `finish(result, draft, notify, verification, significance?)` is the only
48
+ thing the owner ever sees the effect of. Each field has a distinct job:
49
49
 
50
50
  - **`result`** — the FULL, verbatim outcome: every finding, number, URL,
51
51
  id, quote. This is persisted unchanged and is what a precise follow-up
@@ -67,15 +67,41 @@ owner ever sees the effect of. Each field has a distinct job:
67
67
  the brief. If the criteria are not met, `notify = false`.
68
68
  - `silent` → `notify = false`.
69
69
  - When you are on `always` and unsure, prefer `true`.
70
+ - **`verification`** *(required)* — your self-verification checklist: 1–10
71
+ `{requirement, met, evidence}` items (see "Self-verification before
72
+ finish" below). Any `met=false` automatically appends a gap disclosure
73
+ to your `draft` and records the completion as `completed_with_gaps` —
74
+ you do not need to (and cannot) hide a gap.
70
75
  - **`significance`** *(optional)* — one line on why notify is true/false
71
76
  ("2 repos red" / "no criteria met"). Used for the audit + the
72
77
  filed-results digest.
73
78
 
79
+ ## Self-verification before finish
80
+
81
+ Before calling `finish`, verify your own result against the brief:
82
+
83
+ 1. **Derive a checklist** from the brief's **Expected output** section
84
+ (fallback: the Objective) — 1–10 concrete requirements, each stated in
85
+ ≤300 chars.
86
+ 2. **Verify each item against your ACTUAL result**, not your intent.
87
+ `evidence` must point at something real in `result` ("table has one
88
+ row per repo, all 6 listed"), never a restatement of the requirement.
89
+ 3. **If a requirement is unmet and you have turn budget left, attempt the
90
+ repair FIRST** — go back, gather what is missing, then re-verify.
91
+ 4. Finish with `met=false` only when you genuinely cannot fix it (source
92
+ unavailable, out of scope, budget exhausted). Say what is missing and
93
+ why in `evidence`.
94
+
95
+ Never claim `met=true` your evidence does not support: any unmet item is
96
+ disclosed to the owner automatically, but a false "met" is a silent lie
97
+ the owner will act on.
98
+
74
99
  ## Typical loop
75
100
 
76
101
  ```
77
102
  1. (optional) read_memory(...) # pull owner context you need
78
103
  2. WebSearch / WebFetch / reason # do the actual work
79
104
  3. (only if blocked) ask_user(...) # then STOP this turn
80
- 4. finish(result=<full>, draft=<summary>, notify=<policy eval>, significance=<one line>)
105
+ 4. self-verify vs the brief's Expected output; repair gaps if budget remains
106
+ 5. finish(result=<full>, draft=<summary>, notify=<policy eval>, verification=<checklist>, significance=<one line>)
81
107
  ```
@@ -160,7 +160,7 @@ Schedules go through this daemon — never through any cloud-hosted scheduled-ag
160
160
 
161
161
  **Default schedules** (morning briefing, etc.) are stored as `recurring_schedules` rows. When the user asks to disable / change time / skip today / re-enable — e.g. "turn off morning briefing", "move it to 7:30", "skip today's briefing":
162
162
 
163
- 1. `GET /api/recurring-schedules` — locate the row by matching `task_context.sub_flow` (e.g. `morning_briefing`).
163
+ 1. `GET /api/recurring-schedules?includeClaimed=true` — locate the row by matching `task_context.sub_flow` (e.g. `morning_briefing`). If the matched row carries `claimedByAgentSlug`, it is an Agent's cadence satellite — apply the change via `PATCH /api/agents/<slug>` instead of the row (a direct PATCH/DELETE is 409).
164
164
  2. Apply the change:
165
165
  - **Disable** → `PATCH /api/recurring-schedules/:id` `{"enabled": false}`, then `DELETE /api/schedule/:id` for any pending instance scheduled for today.
166
166
  - **Change time** → `PATCH /api/recurring-schedules/:id` with `{"recurrenceRule": {...}, "taskContext": {"sub_flow": "<unchanged>", "pin_to_quiet_hours_end": false}}`. Setting `pin_to_quiet_hours_end: false` is mandatory — without it, the next quiet-hours change overwrites the user's pinned time.
@@ -94,6 +94,19 @@ emits it. The block tells you *why* you were spawned — pull the
94
94
  `<fetch_report status="failed">` block in your prompt tells you
95
95
  which integration is lossy; treat its observations as potentially
96
96
  stale and lean on whatever rows the previous tick left.
97
+ - `reason: agent_chronic_failure` → an enabled agent keeps failing
98
+ its runs; the `<system_health>` block lists which. See "System
99
+ health" below.
100
+
101
+ ### System health
102
+ A `<system_health>` block (when present) lists enabled agents whose
103
+ recent runs all failed. An entry there qualifies as a positive notify
104
+ trigger under Step 9 rule (c) — a silent, repeated failure the user
105
+ will not discover on their own. The Step 9 dedup pre-check still
106
+ applies: if the same agent's failure was already surfaced today, log
107
+ only. When notifying, name the agent, suggest checking
108
+ `/agents/<slug>` on the dashboard, or offer to have it disabled ("say
109
+ 'disable it'").
97
110
 
98
111
  ### Pre-summarized observations (cost-reduction-structural §A)
99
112
  Every observation arrives with `summary_text` (≤120 chars) and
@@ -159,8 +172,10 @@ This rule applies regardless of integration mode (direct, same-backend delegated
159
172
  skip (log `skipped: already in User Tasks`).
160
173
  - For schedule registrations, also query:
161
174
  `GET /api/schedule?status=pending,running` AND
162
- `GET /api/recurring-schedules?enabled=true`.
163
- If a pending/recurring item covers the same trigger → skip.
175
+ `GET /api/recurring-schedules?enabled=true&includeClaimed=true`
176
+ (rows with `claimedByAgentSlug` are Agent-managed but still count
177
+ as coverage). If a pending/recurring item covers the same
178
+ trigger → skip.
164
179
 
165
180
  Only after dedup clears, route the observation:
166
181
  - New TODO for the user → append to ## User Tasks with the row shape in the