@aitne-sh/aitne 0.1.11 → 0.1.12

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 (33) hide show
  1. package/README.md +4 -0
  2. package/agent-assets/agents/morning-routine/agent.md +3 -4
  3. package/agent-assets/docs/concepts/backends-and-tiers.md +13 -10
  4. package/agent-assets/docs/features/messaging/dashboard-chat.md +1 -1
  5. package/agent-assets/docs/features/routines/morning-routine.md +1 -1
  6. package/agent-assets/docs/features/wiki/commands.md +1 -1
  7. package/agent-assets/docs/features/wiki/dashboard.md +1 -1
  8. package/agent-assets/docs/getting-started/01-what-is-this.md +1 -1
  9. package/agent-assets/docs/glossary.md +4 -3
  10. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +5 -3
  11. package/agent-assets/docs/guides/change-which-model-handles-x.md +1 -1
  12. package/agent-assets/docs/guides/multiple-wikis-for-multiple-domains.md +1 -1
  13. package/agent-assets/docs/guides/setup-wizard.md +1 -1
  14. package/agent-assets/docs/troubleshooting/wiki-ingest-full-blocked.md +1 -1
  15. package/agent-assets/playbooks/markdown-note.md +43 -0
  16. package/agent-assets/playbooks/monitoring.md +29 -0
  17. package/agent-assets/playbooks/research.md +47 -0
  18. package/agent-assets/skills/agent-create/SKILL.md +35 -30
  19. package/agent-assets/skills/agent-create/references/prompt-frame-extended.md +132 -0
  20. package/agent-assets/skills/agent-create/references/prompt-frame.md +125 -0
  21. package/agent-assets/skills/background-task/SKILL.md +4 -4
  22. package/agent-assets/skills/background-task-reply/SKILL.md +2 -2
  23. package/agent-assets/skills/board/SKILL.md +93 -0
  24. package/agent-assets/skills/browser-history/SKILL.md +3 -3
  25. package/agent-assets/skills/browser-history-respond/SKILL.md +3 -3
  26. package/agent-assets/skills/browser-task/SKILL.md +2 -2
  27. package/agent-assets/skills/schedule/SKILL.md +15 -13
  28. package/agent-assets/skills/schedule/references/batch.md +1 -1
  29. package/agent-assets/skills/schedule/references/model-selection.md +1 -1
  30. package/agent-assets/skills/schedule/references/prompt-frame.md +125 -0
  31. package/agent-assets/skills/task/SKILL.md +79 -0
  32. package/agent-assets/task-flows/scheduled.dm.md +21 -13
  33. package/package.json +4 -4
@@ -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.
@@ -90,7 +90,7 @@ Clarifications are answered with the **`background-task-reply`** skill.
90
90
 
91
91
  ## Hard rules
92
92
 
93
- 1. **Localhost only.** `http://127.0.0.1:8321/api/background-task/*`.
93
+ 1. **Localhost only.** `http://localhost:8321/api/background-task/*`.
94
94
  2. **POST, ack, end the turn. NEVER poll for completion.** After a
95
95
  successful POST, reply once and stop. Do NOT GET `/:id` in a loop or
96
96
  "wait and check". Ending your turn has zero effect on the detached
@@ -110,7 +110,7 @@ Clarifications are answered with the **`background-task-reply`** skill.
110
110
  ```bash
111
111
  curl --silent --fail -X POST -H 'Content-Type: application/json' \
112
112
  -d '{"brief":"Audit these repos for a red main-branch CI build: aitne/daemon, aitne/web. \"Failing\" = the latest default-branch run concluded failure. Summary in English. Only notify if at least one repo is red. Output: one line per failing repo with the job.","title":"CI audit","notificationPolicy":"if_significant"}' \
113
- http://127.0.0.1:8321/api/background-task
113
+ http://localhost:8321/api/background-task
114
114
  ```
115
115
 
116
116
  Body:
@@ -149,7 +149,7 @@ detail it didn't include ("what exactly did it find on repo X?", "show me
149
149
  the numbers"), do a **single** read and answer from the verbatim `report`:
150
150
 
151
151
  ```bash
152
- curl --silent --fail http://127.0.0.1:8321/api/background-task/<taskId>
152
+ curl --silent --fail http://localhost:8321/api/background-task/<taskId>
153
153
  ```
154
154
 
155
155
  `report` is the full, unparaphrased result. Quote from it; don't invent
@@ -162,7 +162,7 @@ A `silent` / unmet-`if_significant` result is filed (`notify=false`), not
162
162
  pushed. When the user asks whether a backgrounded task ran:
163
163
 
164
164
  ```bash
165
- curl --silent --fail "http://127.0.0.1:8321/api/background-task?state=completed&notify=false&sinceHours=168"
165
+ curl --silent --fail "http://localhost:8321/api/background-task?state=completed&notify=false&sinceHours=168"
166
166
  ```
167
167
 
168
168
  Each row carries `title`, `significance`, and `report`. Summarize
@@ -65,7 +65,7 @@ user-visible text** (token hygiene). The GET is the authoritative source.
65
65
  ```bash
66
66
  curl --silent --fail -X POST -H 'Content-Type: application/json' \
67
67
  -d '{"clarificationId":"<uuid>","answer":"api first"}' \
68
- http://127.0.0.1:8321/api/background-task/<taskId>/clarify
68
+ http://localhost:8321/api/background-task/<taskId>/clarify
69
69
  ```
70
70
 
71
71
  - `answer` (1..8192) — the owner's reply, verbatim and faithful. Do not
@@ -96,5 +96,5 @@ Status codes — handle each, don't retry blindly:
96
96
 
97
97
  ## Localhost only
98
98
 
99
- `http://127.0.0.1:8321/api/background-task/*`. JSON body in single quotes
99
+ `http://localhost:8321/api/background-task/*`. JSON body in single quotes
100
100
  (project convention) so the daemon hooks classify the payload as data.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: board
3
+ description: Read-only Task Board — list everything in motion (recurring DMs, Agents, app-fetch, reminders, background/browser/research) via GET /api/tasks, and preview a delete's blast radius via GET /api/tasks/impact. For writes use the `task` skill.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Read
7
+ ---
8
+
9
+ # Task Board — see everything in motion
10
+
11
+ One place to answer two questions the user actually asks:
12
+
13
+ 1. **"What do I have running / set up?"** — a single inventory across every
14
+ creation path (recurring DMs, Agents, app-fetch managed tasks, pending
15
+ one-off reminders, and in-flight background / browser / research work).
16
+ 2. **"What breaks if I delete / change X?"** — the blast radius, with each
17
+ affected row labelled by its real cascade.
18
+
19
+ The board is **read-only and computed on demand** — it stores nothing and
20
+ mirrors nothing. It does **not** replace the proactive reminder surface: pending
21
+ one-off reminders are already injected into your DM context every turn, so use
22
+ the board when the user *asks* to look, not as a standing checklist.
23
+
24
+ ## When to use
25
+
26
+ - The user asks what's scheduled / running / set up ("show me my agents",
27
+ "what's running", "do I still have that Zoom sweep?").
28
+ - Before a delete/modify, to tell the user the impact ("if I stop the digest,
29
+ what goes with it?").
30
+ - To resolve a vague reference ("turn off the morning thing") to a concrete
31
+ `ref` you can then act on with the `task` skill.
32
+
33
+ ## Inventory — `GET /api/tasks`
34
+
35
+ ```bash
36
+ curl --silent --fail http://localhost:8321/api/tasks
37
+ ```
38
+
39
+ Returns `{ items, total, generatedAt }`. Each item:
40
+
41
+ | Field | Meaning |
42
+ |---|---|
43
+ | `ref` | typed handle — `rs:<id>` (recurring DM), `mt_<n>` (app-fetch), `agent:<slug>`, `as:<id>` (one-off reminder), `bt:<id>` (background), `bx:<id>` (browser), `cluster:<slug>` (research) |
44
+ | `title` | human label — passed through verbatim from the owning row |
45
+ | `kind` | `dm` / `agent` / `app_fetch` / `reminder` / `background` / `browser` / `research` |
46
+ | `status` | `active` / `paused` / `pending` / a fulfiller state (`running`, `awaiting_user`, …) |
47
+ | `cadence` | human schedule label, or null for one-shot work |
48
+ | `fulfilledBy` | typed ref of the row that actually executes (for `app_fetch`, its `rs:` schedule) |
49
+ | `origin` | `system` / `user` / `agent` |
50
+ | `lastResult`, `lastRunAt`, `nextRunAt` | at-a-glance health, when the owner tracks them |
51
+
52
+ Summarise naturally; don't read the JSON back verbatim. The `kind` / `status`
53
+ / `cadence` labels are a fixed English vocabulary; `title` is passed through
54
+ verbatim from the owning row.
55
+
56
+ ## Blast radius — `GET /api/tasks/impact?ref=<ref>`
57
+
58
+ ```bash
59
+ curl --silent --fail "http://localhost:8321/api/tasks/impact?ref=mt_3"
60
+ ```
61
+
62
+ Returns `{ ref, found, summary, nodes }`. Each node is a row a delete/modify
63
+ would touch, with its real cascade semantics:
64
+
65
+ - `is_a_cascade` — a 1:1 wrapper deleted **with** the target (a managed task and
66
+ its recurring schedule die together).
67
+ - `set_null_satellite` — an Agent or automation trigger that **references** the
68
+ schedule and **survives** its deletion.
69
+ - `owner_paired_schedule` — an Agent's **own** recurring schedule (shown when the
70
+ target is `agent:<slug>`): disabled with the Agent, removed only on hard-delete.
71
+ - `no_action_unlinked` — pending fires that are unlinked/skipped, not deleted.
72
+ - `self` — the target row itself.
73
+
74
+ `found:false` (still `200`) means the ref resolves to no live row. Lead with the
75
+ `summary`, then list what survives vs what's removed so the user can decide.
76
+
77
+ ## Writes go through the `task` skill
78
+
79
+ This skill never creates, edits, or deletes. When the user wants to act on a
80
+ board item, hand the resolved `ref` (or a `kind` for a new item) to the **`task`**
81
+ skill, which routes the write to the hardened owner endpoint. Detailed authoring
82
+ (a full recurring Agent, an app-fetch with dedup) still belongs to the
83
+ specialised skills (`agent-create`, `managed-tasks`, `schedule`,
84
+ `background-task`) — `task` is the single front door to them.
85
+
86
+ ## Hard rules
87
+
88
+ 1. **Localhost only.** `http://localhost:8321/api/tasks*`.
89
+ 2. **Read-only.** This skill issues only GETs. Never mutate from here.
90
+ 3. **Never reactivate a muted/concluded research cluster** by listing it — the
91
+ board only surfaces active/dormant clusters and `impact` never changes status.
92
+ 4. **Never read or relay a browser-task final-confirm token.** The board surfaces
93
+ only safe fields (`status`/`ref`); a pending `!~xxxxxxxx` token is never shown.
@@ -15,7 +15,7 @@ their own destination policy — see the cluster-update flow below.
15
15
  ## Hard rules
16
16
 
17
17
  1. **Localhost only.** Every request goes to
18
- `http://127.0.0.1:8321/api/browser-history/*` (or `localhost`).
18
+ `http://localhost:8321/api/browser-history/*`.
19
19
  A curl to any other host is a contract violation and the daemon's
20
20
  absolute-block layer will reject it.
21
21
  2. **No raw SQLite.** Never invoke `sqlite3`, never `Read` a path under
@@ -75,7 +75,7 @@ so do NOT add an auth header to it.)
75
75
 
76
76
  ```bash
77
77
  curl --silent --show-error \
78
- http://127.0.0.1:8321/api/browser-history/research-clusters
78
+ http://localhost:8321/api/browser-history/research-clusters
79
79
  ```
80
80
 
81
81
  Use `--silent --show-error` (not `--fail`): the agent's `curl` runs
@@ -94,7 +94,7 @@ curl --silent --show-error \
94
94
  -X POST \
95
95
  -H 'Content-Type: application/json' \
96
96
  -d '{"kind":"research_assist"}' \
97
- http://127.0.0.1:8321/api/browser-history/offers/quantum-mechanics/accept
97
+ http://localhost:8321/api/browser-history/offers/quantum-mechanics/accept
98
98
  ```
99
99
 
100
100
  ## Flow: routine.research_cluster_update
@@ -87,15 +87,15 @@ pre-summarise.
87
87
 
88
88
  ```bash
89
89
  curl --silent --fail \
90
- http://127.0.0.1:8321/api/browser-history/offers/pending
90
+ http://localhost:8321/api/browser-history/offers/pending
91
91
 
92
92
  curl --silent --fail -X POST \
93
93
  -H 'Content-Type: application/json' \
94
94
  -d '{"kind":"research_assist"}' \
95
- http://127.0.0.1:8321/api/browser-history/offers/<slug>/accept
95
+ http://localhost:8321/api/browser-history/offers/<slug>/accept
96
96
 
97
97
  curl --silent --fail -X POST \
98
- http://127.0.0.1:8321/api/browser-history/offers/<slug>/decline
98
+ http://localhost:8321/api/browser-history/offers/<slug>/decline
99
99
  ```
100
100
 
101
101
  JSON body in single quotes (project convention) so the daemon hooks
@@ -21,7 +21,7 @@ B-4 purchase tokens, or workflow approvals — those live under
21
21
 
22
22
  ## Hard rules
23
23
 
24
- 1. **Localhost only.** `http://127.0.0.1:8321/api/browser-task/*`.
24
+ 1. **Localhost only.** `http://localhost:8321/api/browser-task/*`.
25
25
  2. **POST, ack, end the turn. NEVER poll for completion.** After a
26
26
  successful POST, reply once ("Started — I'll report back when it's
27
27
  done.") and stop. Do not GET `/:id` in a loop, "wait and check", or
@@ -64,7 +64,7 @@ B-4 purchase tokens, or workflow approvals — those live under
64
64
  ```bash
65
65
  curl --silent --fail -X POST -H 'Content-Type: application/json' \
66
66
  -d '{"description":"Post \"Hello world\" to twitter.com"}' \
67
- http://127.0.0.1:8321/api/browser-task
67
+ http://localhost:8321/api/browser-task
68
68
  ```
69
69
 
70
70
  Body:
@@ -25,11 +25,11 @@ 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).
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
33
  3. **Recurring check.** `GET /api/recurring-schedules?enabled=true` to
34
34
  confirm no recurring rule/Agent already covers this cadence (e.g. a
35
35
  daily 09:00 inbox triage, or the morning briefing). If covered, skip.
@@ -74,14 +74,16 @@ record, create the recurring work/DM per the "Recurring" section below.
74
74
 
75
75
  > **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
76
 
77
- Include all four elements in the `prompt`:
77
+ Author the `prompt` with the **core frame** below. A one-shot task rarely needs the
78
+ extended (operational) sections; if a one-shot *does* mutate code or state, add two
79
+ sections on top of the core frame — `# Scope` (WHERE it may act: the editable
80
+ surface, and what it must not touch) and `# Verification` (which checks confirm the
81
+ change is good, and "don't claim success unless they passed").
78
82
 
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) |
83
+ {{> ref:prompt-frame }}
84
+
85
+ For a simple one-shot a timed reminder the frame collapses to one tight,
86
+ self-contained brief:
85
87
 
86
88
  **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
89
 
@@ -165,7 +167,7 @@ curl -s -X PATCH http://localhost:8321/api/schedule/42 \
165
167
  -H 'Content-Type: application/json' \
166
168
  -d '{"time":"2026-04-06T17:00:00-04:00"}'
167
169
  ```
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.
170
+ 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
171
 
170
172
  ### GET /api/schedule — List scheduled items
171
173
  ```bash
@@ -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,79 @@
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>`). PATCH forwards your patch body to the owning edit
48
+ endpoint; DELETE forwards to the owning delete (cascade preserved).
49
+
50
+ ```bash
51
+ curl --silent --fail -X PATCH -H 'Content-Type: application/json' \
52
+ -d '{"enabled":false}' http://localhost:8321/api/tasks/rs:42
53
+
54
+ curl --silent --fail -X DELETE http://localhost:8321/api/tasks/mt_3
55
+ ```
56
+
57
+ ## Response envelope
58
+
59
+ Every dispatch returns the owner's HTTP status with
60
+ `{ ok, dispatchedTo, kind, result }` — `result` is the owner's own body
61
+ (e.g. `{ status:"created", item }`). Read `result` for ids and warnings.
62
+
63
+ ## Hard rules
64
+
65
+ 1. **Localhost only.** `http://localhost:8321/api/tasks*`.
66
+ 2. **A `dm` create is always a `dm_session` row.** You cannot create recurring
67
+ autonomous *work* through `kind:"dm"` — that is `kind:"agent"`. The facade
68
+ enforces this (it never opens the 410'd recurring agent-task door, and never
69
+ stamps an agent id onto a schedule).
70
+ 3. **Editing/deleting an Agent is privileged.** `agent:<slug>` routes to
71
+ `/api/agents`, which may require the dashboard's authorization — a `401` means
72
+ it needs human approval, exactly as editing the Agent directly does. Built-in
73
+ Agents are undeletable (`409`); stopping one needs the stop-warning ack.
74
+ 4. **Fulfillers are read-only here.** `bt:` / `bx:` / `cluster:` refs return
75
+ `422` — manage them on their own surfaces; never resume a force-failed browser
76
+ task or surface a pending `!~` confirm token.
77
+ 5. **Preview destructive changes first.** For a delete/modify the user may not
78
+ fully grasp, run `GET /api/tasks/impact?ref=<ref>` (the `board` skill) and
79
+ confirm the blast radius before acting.