@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
@@ -52,6 +52,9 @@ curl -s -X POST http://localhost:8321/api/agents \
52
52
  "timezone": "Asia/Tokyo"
53
53
  },
54
54
  "backend": { "tier": "medium" },
55
+ "success_criteria": [
56
+ { "id": "triage-note", "kind": "file_exists", "target": "notes/inbox-triage-{date}.md" }
57
+ ],
55
58
  "prompt": "<the detailed agent definition — see below>"
56
59
  }'
57
60
  ```
@@ -100,8 +103,22 @@ Fields:
100
103
  the standalone control that works). `process_key` defaults to `agent.task`;
101
104
  omit unless you know you need another. (Pinning a backend *engine* without a
102
105
  `model` is a known no-op — prefer `tier`.)
106
+ - **`playbooks`** — optional array of operating-playbook slugs to inject into the
107
+ Agent's prompt at fire time: `research`, `markdown-note`, `monitoring`. Declaring
108
+ one makes the daemon inject that playbook's full methodology into every run — a
109
+ hard guarantee, and the only way the methodology reaches the Agent (there is no
110
+ separate skill copy). **Declare every playbook you name in the prompt's
111
+ `# Important`** — a bare mention is not injected on its own. An unknown slug is
112
+ rejected as `invalid_definition` on field `playbooks`.
113
+ - **`success_criteria`** — optional array of deterministic post-run checks; their
114
+ hit rate is the Agent's dashboard quality metric. **Derive 1–3 from the prompt's
115
+ `# Output` contract** (see "Success criteria" below); omitting them when the
116
+ prompt has an `# Output` section returns a `no_success_criteria` warning.
103
117
  - **`prompt`** — the Agent's instructions (the Markdown body). **This is the most
104
- important field. Write it in detail.**
118
+ important field. Write it in detail.** An empty or stub body (`"placeholder"`,
119
+ `"TODO"`, …) is rejected as `invalid_definition` on field `prompt` — the Agent
120
+ would skip every run as ambiguous. Never create now to fill the prompt in
121
+ later; clarify the task with the user first.
105
122
 
106
123
  ## Writing the `prompt` — the Agent has NO memory of why it exists
107
124
 
@@ -110,48 +127,69 @@ Fields:
110
127
  > management rules). It does NOT remember this conversation or why you created
111
128
  > it. An under-specified prompt produces a vague, drifting Agent.
112
129
 
113
- Write the prompt as a self-contained brief covering all four:
130
+ Author every Agent prompt with the **canonical frame** below, and resolve any
131
+ missing required slot with the user *before* you `POST /api/agents` (clarify-back).
114
132
 
115
- | Element | What it must answer |
116
- |---|---|
117
- | **Requirements / preconditions** | What must be true / what inputs to read first (files, APIs, accounts). What to do if a precondition is missing. |
118
- | **Goal** | The single outcome this Agent exists to produce, stated concretely. |
119
- | **Process** | The ordered steps to run each firing — specific verbs, endpoints, filenames, decision rules. |
120
- | **Expected output** | What "done" looks like: which file/section is written, whether/when to DM the user, what NOT to do. |
133
+ {{> ref:prompt-frame }}
121
134
 
122
- **Good prompt (excerpt):**
123
- ```
124
- ## Goal
125
- Each morning, surface inbox items that need the user's decision today.
126
-
127
- ## Requirements
128
- - Read state/today.md for the day's agenda before triaging.
129
- - Mail access via the mail skill endpoints; if mail is unreachable, log the gap
130
- to the Agent Log and exit without DMing.
131
-
132
- ## Process
133
- 1. GET unread mail from the last 24h.
134
- 2. Classify: actionable-today / FYI / ignore (rules: …).
135
- 3. Append a "## Inbox triage" section to state/today.md with the actionable set.
136
- 4. DM the user ONLY if ≥1 item is time-sensitive today.
137
-
138
- ## Output
139
- - today.md updated with the triage section.
140
- - At most one DM, sent only for time-sensitive items.
135
+ ### Declare the playbooks you reference
136
+
137
+ Whenever the prompt's `# Important` names a playbook, ALSO list its slug in the
138
+ top-level `playbooks` field so the daemon injects that methodology into every
139
+ firing as a hard guarantee — not just a by-reference skill the Agent might skip:
140
+
141
+ ```json
142
+ "playbooks": ["research", "markdown-note"]
141
143
  ```
142
144
 
143
- **Bad prompt:** `"Triage my inbox."` no requirements, no steps, no output
144
- contract; the Agent will improvise differently every day.
145
+ Valid slugs: `research`, `markdown-note`, `monitoring`. If you name a playbook in
146
+ the prompt but forget to declare it, the create response returns a `warnings[]`
147
+ entry (`playbook_referenced_not_declared`) — read it and add the missing slug.
148
+
149
+ ### Operational (state-mutating) Agents — extend the frame
150
+
151
+ Most Agents are content / knowledge agents (research, monitoring, note) and the
152
+ core frame above is the right shape. When the Agent instead **mutates code, files,
153
+ or system state** — the general-purpose archetype — extend the frame with scope,
154
+ a run-time autonomy boundary, and a verification receipt:
145
155
 
146
- The Expected-output decision feeds one schedule field: if the output contract
156
+ {{> ref:prompt-frame-extended }}
157
+
158
+ The `# Output` decision feeds one schedule field: if the output contract
147
159
  includes DMing the user, also set `schedule.defer_in_quiet_hours: true` so a
148
160
  firing inside quiet hours waits for the window's end instead of producing a
149
161
  message that would be held anyway.
150
162
 
163
+ ## Success criteria — derive them from `# Output`
164
+
165
+ `success_criteria` are deterministic checks the daemon evaluates after every
166
+ firing; their hit rate is the Agent's dashboard quality metric — without them
167
+ the Agent has **no quality signal**. Derive 1–3 mechanically from the `# Output`
168
+ contract at creation time:
169
+
170
+ - Writes a dated note → `{ "id": "note-exists", "kind": "file_exists",
171
+ "target": "notes/<name>-{date}.md" }`. Targets are vault-relative; `{date}`
172
+ (the agent-day, resolved at eval time) is the only placeholder.
173
+ - Populates a note with N sections → `{ "id": "sections-filled",
174
+ "kind": "file_section_count", "target": "…", "heading_level": 2, "min": N }` —
175
+ counts headings of exactly `heading_level`.
176
+ - DMs the user → `{ "id": "dm-delivered", "kind": "notification_log",
177
+ "notification_type": "agent", "delivered_within_minutes": M }` — size `M` to
178
+ the run (30–60 typical). Caveat: matching is install-wide within the window
179
+ (ANY delivered `"agent"` notification counts, not just this Agent's), so
180
+ prefer the file-based kinds whenever the output also lands in a file.
181
+
182
+ `id` values must be unique within the Agent (duplicates are rejected as
183
+ `invalid_definition` on `success_criteria[i].id`).
184
+
151
185
  ## Responses & errors
152
186
 
153
187
  - `201 { "status": "created", "slug": "…" }` — the Agent is live; its recurring
154
- schedule is paired and it will fire on the next matching tick.
188
+ schedule is paired and it will fire on the next matching tick. The response may
189
+ also carry `warnings[]` (non-blocking authoring lint — e.g. a missing
190
+ `# Instruction` section, a playbook you named but didn't declare, or an
191
+ `# Output` contract with no `success_criteria`); the Agent is still created,
192
+ but fix the flagged issues and re-save its `agent.md`.
155
193
  - `400 one_shot_not_supported` — the schedule was not `cron`/`recurring`. Use the
156
194
  `schedule` skill for one-time tasks.
157
195
  - `400 invalid_recurrence` — a `kind:"recurring"` schedule carried a malformed
@@ -163,7 +201,8 @@ message that would be held anyway.
163
201
  `issues[]` (each `{ field, message }`); the post-write cross-check (loader
164
202
  rejects the freshly written file) returns `slug` + a single `detail` string
165
203
  (or `null`). Read `issues[]` if present, else fall back to `detail`, fix the
166
- reported field(s), and resubmit.
204
+ reported field(s), and resubmit. An empty/placeholder `prompt` also lands
205
+ here — get the real task from the user, never retry with another stub.
167
206
 
168
207
  Read `Read`-only files you reference in the prompt to confirm they exist before
169
208
  creating the Agent.
@@ -0,0 +1,132 @@
1
+ ---
2
+ kind: reference
3
+ name: prompt-frame-extended
4
+ description: The extended prompt frame for operational / state-mutating agents (code, files, system state) — adds Goal / Context / Inputs / Scope / Execution Mode / Requirements / Constraints / Verification and a structured Output receipt on top of the core frame, plus the operational clarify-back slot.
5
+ ---
6
+
7
+ ### When to reach for the extended frame
8
+
9
+ Use it when the agent **mutates code, files, or system state**, or runs a
10
+ multi-step engineering-flavored task (the *general-purpose* agents). Content /
11
+ knowledge agents (research, monitoring, note) stay on the **core** frame — their
12
+ verification and output shape come from the playbooks, so they never carry the
13
+ sections below. Forcing this scaffolding onto a content agent is empty boilerplate
14
+ that dilutes the real instruction and eats the 8000-char cap.
15
+
16
+ Add these on top of the core `# Role` / `# Important` / `# Instruction`:
17
+
18
+ ```markdown
19
+ # Goal # the outcome this agent exists to produce (fold into # Role if one line)
20
+ # Context # background, why it matters, the spec / state to read first
21
+ # Inputs # concrete artifacts: files, paths, URLs, repos, prior-run note, error logs
22
+ # Role
23
+ Act as a careful <engineer / researcher / reviewer / editor>.
24
+ Prioritize <correctness / minimal change / source-backed claims / maintainability>.
25
+ # Scope # WHERE it may act
26
+ Do: - <in-scope actions / the editable surface>
27
+ Do not: - <areas, files, or data it must not touch>
28
+ # Execution Mode # WHEN to act vs escalate
29
+ Proceed autonomously after reading the relevant context.
30
+ Escalate instead of acting when an action is outward-facing or irreversible
31
+ (send / publish / pay / delete), a data / schema migration, a broad refactor, or
32
+ the requirements are materially contradictory.
33
+ On escalation: if the user is reachable, DM a concise approval request and defer the
34
+ action; if running unattended, record the proposed action + reason and skip it.
35
+ # Requirements # success conditions
36
+ - <condition 1> ...
37
+ # Constraints # behavioral prohibitions not already in Scope / Execution Mode
38
+ - No speculative changes; preserve behavior outside the requested scope; no new
39
+ dependencies unless clearly necessary; do not remove existing tests / validation.
40
+ # Verification
41
+ - Run the checks relevant to what changed: code → tests / typecheck / lint;
42
+ research → cross-check each claim against ≥ 2 sources.
43
+ - Don't claim verification unless the checks passed; if they can't be run, say why.
44
+ # Output # structured receipt for the user to review
45
+ 1. Summary of what was done
46
+ 2. Files changed / sources used
47
+ 3. Checks run + results
48
+ 4. Assumptions made
49
+ 5. Remaining risks / follow-ups
50
+ ```
51
+
52
+ Three rules keep the extended frame from sprawling (over-specification — the same
53
+ prohibition restated three times — is its main failure mode):
54
+
55
+ - **One prohibition, one section** — spatial → `# Scope`, risk / timing →
56
+ `# Execution Mode`, behavioral → `# Constraints`. Never restate "don't touch
57
+ unrelated files" in all three.
58
+ - **Fold short sections up** — an empty `# Goal` / `# Context` / `# Constraints` is
59
+ omitted, not left as a stub (`# Goal` folds into `# Role` when it's one line).
60
+ - **Content archetypes stay on the core frame** — never give a research / note
61
+ agent `# Verification` or receipt scaffolding.
62
+
63
+ #### `# Execution Mode` — the run-time autonomy boundary
64
+
65
+ Clarify-back (below, and in the core frame) resolves ambiguity at **authoring**
66
+ time, with the user present. `# Execution Mode` governs the **deployed** agent at
67
+ **run** time, usually with no user present — the gap where an agent that hits a risk
68
+ boundary mid-run has no instruction. Encode the product's posture: act on the safe,
69
+ reversible majority; on the risky minority **defer + flag** (DM an approval request,
70
+ hold the action) when the user is reachable, or **record + skip** when unattended.
71
+ Never guess, never block waiting.
72
+
73
+ ### Clarify-back — the operational slot
74
+
75
+ On top of the content-archetype slots in the core frame, an operational agent has
76
+ its own required slots:
77
+
78
+ | Archetype | Required slots (ask only if unknown) | Sensible default |
79
+ |---|---|---|
80
+ | **General / operational** (code, files, system state) | editable surface / scope; what "done" means (success criteria); may it act autonomously or propose-then-confirm; which checks to run | propose-then-confirm for irreversible / outward actions; run the repo's standard checks; deliver as a branch / PR or draft, not a direct commit / send |
81
+
82
+ ### Worked example — an operational agent
83
+
84
+ A recurring "keep the repo green" agent, extended frame end-to-end:
85
+
86
+ ```markdown
87
+ # Goal
88
+ Keep <repo> free of lint and type errors introduced during the day.
89
+
90
+ # Context
91
+ CI runs lint + typecheck on every PR; errors on `develop` block everyone. You run
92
+ nightly to catch and fix what slipped in.
93
+
94
+ # Inputs
95
+ - Repo: <org/repo>, branch `develop`.
96
+ - Commands: `pnpm lint`, `pnpm typecheck` (project root).
97
+
98
+ # Role
99
+ Act as a careful engineer. Prioritize minimal, behavior-preserving changes.
100
+
101
+ # Scope
102
+ Do: fix lint / type errors in app source under `packages/`.
103
+ Do not: touch test fixtures, generated files, or `*.config.*`; change runtime behavior.
104
+
105
+ # Execution Mode
106
+ Proceed autonomously for mechanical fixes. Escalate (open a draft PR + DM, do not
107
+ merge) if a fix needs a behavior change, touches a public API, or the error count is
108
+ > 30 (likely a systemic cause to confirm first). Running unattended: never merge —
109
+ always deliver as a PR for review.
110
+
111
+ # Requirements
112
+ - `pnpm lint` and `pnpm typecheck` both pass after your changes.
113
+ - One PR titled `nightly: lint+type sweep <YYYY-MM-DD>`.
114
+
115
+ # Constraints
116
+ - No new dependencies; no disabling of rules to silence errors; do not remove tests.
117
+
118
+ # Verification
119
+ - Run `pnpm lint` and `pnpm typecheck`; include the final output in the receipt.
120
+ - If either still fails, leave those errors unfixed and list them — don't claim green.
121
+
122
+ # Output
123
+ 1. Summary of what was fixed.
124
+ 2. Files changed (+ the PR link).
125
+ 3. `pnpm lint` / `pnpm typecheck` results.
126
+ 4. Assumptions made.
127
+ 5. Remaining errors / follow-ups.
128
+ ```
129
+
130
+ **Bad:** `"Keep the repo green nightly."` — no scope (which files?), no autonomy
131
+ boundary (merge or PR?), no verification contract. An agent with write access and
132
+ no `# Scope` / `# Execution Mode` is how unattended automation does damage.
@@ -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.
@@ -54,8 +54,9 @@ Resolve ambiguity with the user now, then encode all of:
54
54
  reads right if it's sent directly.
55
55
  - **Notification policy + criteria** — see below; for `if_significant` the
56
56
  criteria MUST be written into the brief in concrete terms.
57
- - **Expected output** — what a good `result` contains (a per-repo table, a
58
- ranked list, a one-paragraph verdict).
57
+ - **Expected output** — 1–5 concretely verifiable requirements (a per-repo
58
+ table, a ranked list, a one-paragraph verdict). The worker verifies its
59
+ result against these line-by-line before finishing.
59
60
 
60
61
  The worker can read owner memory itself to fill in preferences, so you need
61
62
  only supply the *task-specific* inputs above. **Promoting an inline task?**
@@ -83,14 +84,14 @@ in the daily digest and the user can pull it (see "Filed results" below).
83
84
  |---|---|---|
84
85
  | POST | `/api/background-task` | Create + dispatch, or schedule (`scheduleAt`). |
85
86
  | GET | `/api/background-task?state=...` | List (also `notify`, `sinceHours` for the filed pull). |
86
- | GET | `/api/background-task/:id` | The artifact — verbatim `report`, `draft`, `notify`, clarifications. |
87
+ | GET | `/api/background-task/:id` | The artifact — verbatim `report`, `draft`, `notify`, `verification`, clarifications. |
87
88
  | POST | `/api/background-task/:id/cancel` | Force-stop. |
88
89
 
89
90
  Clarifications are answered with the **`background-task-reply`** skill.
90
91
 
91
92
  ## Hard rules
92
93
 
93
- 1. **Localhost only.** `http://127.0.0.1:8321/api/background-task/*`.
94
+ 1. **Localhost only.** `http://localhost:8321/api/background-task/*`.
94
95
  2. **POST, ack, end the turn. NEVER poll for completion.** After a
95
96
  successful POST, reply once and stop. Do NOT GET `/:id` in a loop or
96
97
  "wait and check". Ending your turn has zero effect on the detached
@@ -110,7 +111,7 @@ Clarifications are answered with the **`background-task-reply`** skill.
110
111
  ```bash
111
112
  curl --silent --fail -X POST -H 'Content-Type: application/json' \
112
113
  -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
114
+ http://localhost:8321/api/background-task
114
115
  ```
115
116
 
116
117
  Body:
@@ -130,6 +131,8 @@ Body:
130
131
  The eventual *result delivery* is what respects quiet hours, not the run.
131
132
  `202` with `{ taskId, status:"scheduled", scheduledFor, scheduleRowId }`.
132
133
  A time more than 60s in the past is rejected `400`.
134
+ - `origin` — Task Board provenance: `"user"` when the user asked for this
135
+ work, `"agent"` (default) for your own initiative.
133
136
 
134
137
  Immediate response carries `taskId` and `status`. Then ack once and stop
135
138
  (Hard rule 2).
@@ -149,12 +152,14 @@ detail it didn't include ("what exactly did it find on repo X?", "show me
149
152
  the numbers"), do a **single** read and answer from the verbatim `report`:
150
153
 
151
154
  ```bash
152
- curl --silent --fail http://127.0.0.1:8321/api/background-task/<taskId>
155
+ curl --silent --fail http://localhost:8321/api/background-task/<taskId>
153
156
  ```
154
157
 
155
158
  `report` is the full, unparaphrased result. Quote from it; don't invent
156
159
  detail. If you lack the `taskId`, list `state=completed` and match by
157
- `title`.
160
+ `title`. The worker's `verification` checklist rides along — on
161
+ `outcomeDetail` `completed_with_gaps` it shows which requirements fell
162
+ short.
158
163
 
159
164
  ## Filed results — the "did that monitor ever run?" pull
160
165
 
@@ -162,7 +167,7 @@ A `silent` / unmet-`if_significant` result is filed (`notify=false`), not
162
167
  pushed. When the user asks whether a backgrounded task ran:
163
168
 
164
169
  ```bash
165
- curl --silent --fail "http://127.0.0.1:8321/api/background-task?state=completed&notify=false&sinceHours=168"
170
+ curl --silent --fail "http://localhost:8321/api/background-task?state=completed&notify=false&sinceHours=168"
166
171
  ```
167
172
 
168
173
  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,92 @@
1
+ ---
2
+ name: board
3
+ description: Read-only Task Board — list everything in motion (recurring DMs, Agents, app-fetch, automation triggers, reminders, background/browser work) 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, automation
15
+ triggers, pending one-off reminders, and in-flight background / browser
16
+ work).
17
+ 2. **"What breaks if I delete / change X?"** — the blast radius, with each
18
+ affected row labelled by its real cascade.
19
+
20
+ The board is **read-only and computed on demand** — it stores nothing and
21
+ mirrors nothing. It does **not** replace the proactive reminder surface: pending
22
+ one-off reminders are already injected into your DM context every turn, so use
23
+ the board when the user *asks* to look, not as a standing checklist.
24
+
25
+ ## When to use
26
+
27
+ - The user asks what's scheduled / running / set up ("show me my agents",
28
+ "what's running", "do I still have that Zoom sweep?").
29
+ - Before a delete/modify, to tell the user the impact ("if I stop the digest,
30
+ what goes with it?").
31
+ - To resolve a vague reference ("turn off the morning thing") to a concrete
32
+ `ref` you can then act on with the `task` skill.
33
+
34
+ ## Inventory — `GET /api/tasks`
35
+
36
+ ```bash
37
+ curl --silent --fail http://localhost:8321/api/tasks
38
+ ```
39
+
40
+ Returns `{ items, total, generatedAt }`. Each item:
41
+
42
+ | Field | Meaning |
43
+ |---|---|
44
+ | `ref` | typed handle — `rs:<id>` (recurring DM), `mt_<n>` (app-fetch), `agent:<slug>`, `trigger:<id>` (automation trigger), `as:<id>` (one-off reminder), `bt:<id>` (background), `bx:<id>` (browser) |
45
+ | `title` | human label — passed through verbatim from the owning row |
46
+ | `kind` | `dm` / `agent` / `app_fetch` / `trigger` / `reminder` / `background` / `browser` |
47
+ | `status` | `active` / `paused` / `pending` / `running` (incl. an Agent with a turn in flight) / a fulfiller state (`awaiting_user`, …) |
48
+ | `cadence` | human schedule label, or null for one-shot work |
49
+ | `fulfilledBy` | typed ref of the row that actually executes (for `app_fetch`, its `rs:` schedule) |
50
+ | `origin` | `system` / `user` / `agent` |
51
+ | `lastResult`, `lastRunAt`, `nextRunAt` | at-a-glance health, when the owner tracks them |
52
+
53
+ Summarise naturally; don't read the JSON back verbatim. The `kind` / `status`
54
+ / `cadence` labels are a fixed English vocabulary; `title` is passed through
55
+ verbatim from the owning row.
56
+
57
+ ## Blast radius — `GET /api/tasks/impact?ref=<ref>`
58
+
59
+ ```bash
60
+ curl --silent --fail "http://localhost:8321/api/tasks/impact?ref=mt_3"
61
+ ```
62
+
63
+ Returns `{ ref, found, summary, nodes }`. Each node is a row a delete/modify
64
+ would touch, with its real cascade semantics:
65
+
66
+ - `is_a_cascade` — a 1:1 wrapper deleted **with** the target (a managed task and
67
+ its recurring schedule die together).
68
+ - `set_null_satellite` — an Agent or automation trigger that **references** the
69
+ schedule and **survives** its deletion.
70
+ - `owner_paired_schedule` — an Agent's **own** recurring schedule (shown when the
71
+ target is `agent:<slug>`): disabled with the Agent, removed only on hard-delete.
72
+ - `no_action_unlinked` — pending fires that are unlinked/skipped, not deleted.
73
+ - `self` — the target row itself.
74
+
75
+ `found:false` (still `200`) means the ref resolves to no live row. Lead with the
76
+ `summary`, then list what survives vs what's removed so the user can decide.
77
+
78
+ ## Writes go through the `task` skill
79
+
80
+ This skill never creates, edits, or deletes. When the user wants to act on a
81
+ board item, hand the resolved `ref` (or a `kind` for a new item) to the **`task`**
82
+ skill, which routes the write to the hardened owner endpoint. Detailed authoring
83
+ (a full recurring Agent, an app-fetch with dedup) still belongs to the
84
+ specialised skills (`agent-create`, `managed-tasks`, `schedule`,
85
+ `background-task`) — `task` is the single front door to them.
86
+
87
+ ## Hard rules
88
+
89
+ 1. **Localhost only.** `http://localhost:8321/api/tasks*`.
90
+ 2. **Read-only.** This skill issues only GETs. Never mutate from here.
91
+ 3. **Never read or relay a browser-task final-confirm token.** The board surfaces
92
+ 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:
@@ -81,6 +81,8 @@ Body:
81
81
  pre-generated id you use for status GETs).
82
82
  - `requireFinalConfirm` (default `true`) — keep `true` unless the user
83
83
  explicitly asks to skip the gate for a reversible flow.
84
+ - `origin` — Task Board provenance: `"user"` when the user asked for this
85
+ work, `"agent"` (default) for your own initiative.
84
86
 
85
87
  Immediate response carries `taskId`, `status`, and `queueState`; then ack
86
88
  once and stop (Hard rule 2). If `queueState.waitingForSlot === true`, the