@aitne-sh/aitne 0.1.9 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/README.md +36 -6
  2. package/agent-assets/docs/concepts/agent-day.md +2 -2
  3. package/agent-assets/docs/concepts/costs-and-quotas.md +4 -3
  4. package/agent-assets/docs/concepts/delegated-mode.md +5 -5
  5. package/agent-assets/docs/concepts/memory-model.md +6 -3
  6. package/agent-assets/docs/concepts/safety-model.md +19 -16
  7. package/agent-assets/docs/concepts/skills.md +2 -2
  8. package/agent-assets/docs/features/integrations/browser-history.md +9 -8
  9. package/agent-assets/docs/features/integrations/calendar.md +4 -4
  10. package/agent-assets/docs/features/integrations/mail.md +3 -2
  11. package/agent-assets/docs/features/lifestyle/git.md +3 -3
  12. package/agent-assets/docs/features/lifestyle/reading.md +15 -8
  13. package/agent-assets/docs/features/lifestyle/travel-bookings.md +4 -3
  14. package/agent-assets/docs/features/memory-files/agent-journal.md +30 -12
  15. package/agent-assets/docs/features/memory-files/agent-lessons.md +177 -0
  16. package/agent-assets/docs/features/memory-files/projects.md +6 -4
  17. package/agent-assets/docs/features/memory-files/roadmap.md +17 -14
  18. package/agent-assets/docs/features/messaging/overview.md +5 -5
  19. package/agent-assets/docs/features/messaging/telegram.md +10 -9
  20. package/agent-assets/docs/features/operations/activity-and-conversations.md +5 -4
  21. package/agent-assets/docs/features/operations/approvals.md +6 -5
  22. package/agent-assets/docs/features/operations/managed-chromium.md +3 -2
  23. package/agent-assets/docs/features/operations/quiet-hours.md +4 -3
  24. package/agent-assets/docs/features/routines/custom-routines.md +11 -7
  25. package/agent-assets/docs/features/routines/evening-review.md +10 -2
  26. package/agent-assets/docs/features/routines/morning-routine.md +4 -3
  27. package/agent-assets/docs/features/routines/weekly-review.md +6 -0
  28. package/agent-assets/docs/features/wiki/commands.md +4 -4
  29. package/agent-assets/docs/features/wiki/cost-and-approval.md +4 -3
  30. package/agent-assets/docs/features/wiki/dashboard.md +7 -6
  31. package/agent-assets/docs/features/wiki/overview.md +3 -3
  32. package/agent-assets/docs/features/wiki/search.md +5 -5
  33. package/agent-assets/docs/features/wiki/workspaces.md +2 -2
  34. package/agent-assets/docs/getting-started/02-first-steps.md +5 -3
  35. package/agent-assets/docs/getting-started/04-first-day.md +2 -2
  36. package/agent-assets/docs/glossary.md +4 -4
  37. package/agent-assets/docs/guides/budget-and-cost-for-wiki.md +2 -2
  38. package/agent-assets/docs/guides/connect-a-new-mail-account.md +4 -2
  39. package/agent-assets/docs/guides/explore-with-trace-and-connect.md +5 -4
  40. package/agent-assets/docs/guides/install-and-run.md +2 -2
  41. package/agent-assets/docs/guides/maintain-wiki-health.md +2 -2
  42. package/agent-assets/docs/guides/pause-the-agent.md +9 -5
  43. package/agent-assets/docs/guides/setup-wizard.md +8 -5
  44. package/agent-assets/docs/guides/use-an-existing-obsidian-vault.md +6 -6
  45. package/agent-assets/docs/reference/api.md +15 -5
  46. package/agent-assets/docs/reference/cli-commands.md +3 -3
  47. package/agent-assets/docs/reference/config.md +21 -4
  48. package/agent-assets/docs/reference/disallowed-tools.md +6 -4
  49. package/agent-assets/docs/reference/knowledge-layout.md +11 -2
  50. package/agent-assets/docs/reference/process-keys.md +2 -2
  51. package/agent-assets/docs/reference/skills.md +5 -4
  52. package/agent-assets/docs/troubleshooting/auth-failed.md +9 -8
  53. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +16 -9
  54. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +2 -2
  55. package/agent-assets/docs/troubleshooting/quota-exhausted.md +7 -6
  56. package/agent-assets/skills/agent-actions/SKILL.md +23 -39
  57. package/agent-assets/skills/agent-create/SKILL.md +15 -6
  58. package/agent-assets/skills/attach/SKILL.md +8 -27
  59. package/agent-assets/skills/browser-history/SKILL.md +29 -16
  60. package/agent-assets/skills/browser-history-respond/SKILL.md +6 -1
  61. package/agent-assets/skills/browser-task/SKILL.md +22 -27
  62. package/agent-assets/skills/context/SKILL.md +23 -32
  63. package/agent-assets/skills/context/curation.json +12 -12
  64. package/agent-assets/skills/context/references/api.md +17 -17
  65. package/agent-assets/skills/context/references/required-frontmatter.md +10 -9
  66. package/agent-assets/skills/context/references/snapshot-files.md +12 -11
  67. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +5 -5
  68. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +3 -3
  69. package/agent-assets/skills/docs-search/SKILL.md +19 -31
  70. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +8 -95
  71. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +8 -94
  72. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +8 -94
  73. package/agent-assets/skills/external-services/SKILL.native.claude.md +2 -2
  74. package/agent-assets/skills/external-services/references/exec-errors.md +32 -0
  75. package/agent-assets/skills/external-services/references/skills-crud.md +5 -5
  76. package/agent-assets/skills/gmail-lifestyle/SKILL.md +3 -2
  77. package/agent-assets/skills/gmail-lifestyle/references/receipts-api.md +4 -0
  78. package/agent-assets/skills/gmail-lifestyle/references/travel-bookings-api.md +9 -0
  79. package/agent-assets/skills/mail/SKILL.delegated.claude.md +13 -25
  80. package/agent-assets/skills/mail/SKILL.delegated.codex.md +3 -2
  81. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +3 -2
  82. package/agent-assets/skills/mail/SKILL.md +10 -18
  83. package/agent-assets/skills/mail/SKILL.native.claude.md +8 -7
  84. package/agent-assets/skills/mail/SKILL.native.codex.md +1 -1
  85. package/agent-assets/skills/mail/SKILL.native.gemini.md +1 -1
  86. package/agent-assets/skills/mail/references/api.md +6 -1
  87. package/agent-assets/skills/mail/references/examples.md +2 -1
  88. package/agent-assets/skills/managed-tasks/SKILL.md +44 -77
  89. package/agent-assets/skills/managed-tasks/references/errors.md +25 -14
  90. package/agent-assets/skills/managed-tasks/references/output-path.md +33 -17
  91. package/agent-assets/skills/managed-tasks/references/recurrence-rule.md +6 -4
  92. package/agent-assets/skills/management-policy/SKILL.md +10 -11
  93. package/agent-assets/skills/management-policy/references/policy-workflow.md +4 -5
  94. package/agent-assets/skills/notify/SKILL.md +11 -13
  95. package/agent-assets/skills/notify/references/priority.md +28 -25
  96. package/agent-assets/skills/notion/SKILL.delegated.claude.md +1 -1
  97. package/agent-assets/skills/notion/SKILL.delegated.codex.md +1 -1
  98. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +1 -1
  99. package/agent-assets/skills/notion/SKILL.md +17 -17
  100. package/agent-assets/skills/notion/SKILL.native.claude.md +1 -1
  101. package/agent-assets/skills/notion/SKILL.native.codex.md +1 -1
  102. package/agent-assets/skills/notion/SKILL.native.gemini.md +1 -1
  103. package/agent-assets/skills/observations/SKILL.md +5 -20
  104. package/agent-assets/skills/observations/references/fetch-fallback.md +22 -0
  105. package/agent-assets/skills/project-doc/SKILL.md +9 -6
  106. package/agent-assets/skills/project-doc/curation.json +3 -3
  107. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +2 -2
  108. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +3 -3
  109. package/agent-assets/skills/reading/SKILL.md +8 -42
  110. package/agent-assets/skills/reading/references/reading-taste.md +5 -5
  111. package/agent-assets/skills/roadmap/SKILL.md +3 -19
  112. package/agent-assets/skills/roadmap/references/api.md +16 -6
  113. package/agent-assets/skills/roadmap/references/horizon-tags.md +11 -0
  114. package/agent-assets/skills/roadmap/references/migration.md +8 -6
  115. package/agent-assets/skills/roadmap/references/retention.md +18 -0
  116. package/agent-assets/skills/schedule/SKILL.md +9 -26
  117. package/agent-assets/skills/schedule/references/importance.md +23 -0
  118. package/agent-assets/skills/schedule/references/recurrence-rule.md +6 -4
  119. package/agent-assets/skills/scheduled-managed-task/SKILL.md +34 -37
  120. package/agent-assets/skills/today/SKILL.md +20 -79
  121. package/agent-assets/skills/today/references/today-skeleton.md +66 -0
  122. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +1 -1
  123. package/agent-assets/skills/today/seeds/section-shape.seed.json +6 -6
  124. package/agent-assets/skills/user-interview/SKILL.md +15 -90
  125. package/agent-assets/skills/user-interview/references/op-briefing.md +1 -1
  126. package/agent-assets/skills/user-interview/references/op-dm-handler.md +88 -0
  127. package/agent-assets/skills/user-interview/references/op-morning.md +1 -1
  128. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +1 -1
  129. package/agent-assets/skills/user-profile/SKILL.md +16 -26
  130. package/agent-assets/skills/user-profile/curation.json +3 -3
  131. package/agent-assets/skills/user-profile/references/character-preferences.md +3 -3
  132. package/agent-assets/skills/wiki/wiki-ask/SKILL.md +1 -1
  133. package/agent-assets/skills/wiki/wiki-compile/SKILL.md +5 -4
  134. package/agent-assets/skills/wiki/wiki-connect/SKILL.md +32 -5
  135. package/agent-assets/skills/wiki/wiki-ingest/SKILL.md +6 -50
  136. package/agent-assets/skills/wiki/wiki-ingest/references/curl-errors.md +58 -0
  137. package/agent-assets/skills/wiki/wiki-lint/SKILL.md +20 -14
  138. package/agent-assets/skills/wiki/wiki-trace/SKILL.md +10 -5
  139. package/agent-assets/skills/wiki/wiki-vault-rules/SKILL.md +2 -0
  140. package/agent-assets/task-flows/_partials/feedback-capture.md +30 -0
  141. package/agent-assets/task-flows/message.received.dm.md +4 -0
  142. package/agent-assets/task-flows/message.received.dm_first.md +4 -0
  143. package/agent-assets/task-flows/routine.evening_review.md +80 -0
  144. package/agent-assets/task-flows/routine.monthly_review.md +72 -0
  145. package/agent-assets/task-flows/routine.weekly_review.md +21 -0
  146. package/agent-assets/task-flows/wiki.trace.md +1 -1
  147. package/bin/aitne.mjs +45 -11
  148. package/package.json +4 -4
  149. package/scripts/commands/doctor.mjs +11 -2
  150. package/scripts/lib/process-identity.d.mts +46 -0
  151. package/scripts/lib/process-identity.mjs +193 -0
  152. package/scripts/lib/read-api-token.mjs +1 -1
  153. package/scripts/start.mjs +14 -4
@@ -14,11 +14,10 @@ Base URL: `http://localhost:8321`. All calls via `curl -s` with
14
14
  `Content-Type: application/json` on POST/PATCH/PUT. URL-encode spaces in paths.
15
15
 
16
16
  Full CRUD over Notion pages plus workspace search. Reads and writes are
17
- Autonomous; writes are still serialized per-process and pre-marked
18
- `notion:<pageId>` for write attribution. The daemon does not DM the
19
- owner before a write — the user's `deniedTools` setting is the gate.
20
- Call `POST /api/notify` yourself when you judge the user would
21
- want immediate awareness.
17
+ Autonomous; writes are serialized per-process and pre-marked
18
+ `notion:<pageId>` for attribution. The daemon does not DM the owner before
19
+ a write — the `deniedTools` setting is the gate. Call `POST /api/notify`
20
+ yourself when you judge the user would want immediate awareness.
22
21
 
23
22
  **Parent shorthand**: `parent` accepts a label string (`"tasks"`),
24
23
  `{ database: "tasks" }`, `{ data_source_id }`, `{ database_id }`, or
@@ -34,8 +33,10 @@ curl -s "http://localhost:8321/api/notion/search?q=launch+plan" # se
34
33
  curl -s http://localhost:8321/api/notion/pages/abc123... # retrieve page
35
34
  ```
36
35
 
37
- Pagination: `page_size` (1–100, default 20) + `start_cursor` from response's
38
- `next_cursor`. Check `has_more` to know if more pages exist.
36
+ Query also accepts `sorts` (URL-encoded JSON) alongside `filter`, and
37
+ `in_trash=true` to query trashed rows. Pagination: `page_size` (1–100,
38
+ default 20) + `start_cursor` from response's `next_cursor`; check
39
+ `has_more` to know if more pages exist.
39
40
 
40
41
  ## Create a page (write — Autonomous)
41
42
 
@@ -55,12 +56,13 @@ curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123... \
55
56
 
56
57
  ## Update page content (write — Autonomous)
57
58
 
58
- **Concurrency warning**: Notion v5 has no etags. If another client edits
59
- between GET and PATCH, `oldStr` may fail silently. For high-risk edits,
60
- prefer `mode=replace_all`.
59
+ **Concurrency**: Notion v5 has no etags if another client edits between
60
+ GET and PATCH, `oldStr` may fail silently; for high-risk edits prefer
61
+ `mode=replace_all`.
61
62
 
62
63
  Modes: `append`, `replace_all`, `update` (find-and-replace via
63
- `updates: [{oldStr, newStr}]`).
64
+ `updates: [{oldStr, newStr}]`), `replace_range` (in-place swap of a line
65
+ range; requires `content` + `contentRange`, optional `allowDeleting`).
64
66
 
65
67
  ```bash
66
68
  curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123.../content \
@@ -80,9 +82,7 @@ Moves to trash (~30 days). Restore via `PATCH` with `{ "in_trash": false }`.
80
82
 
81
83
  - During `routine.hourly_check` this skill is **read-only** — no creates,
82
84
  property updates, content patches, or archives.
83
- - No bulk operations without user confirmation. If you're about to update
84
- 3+ pages at once, stop and ask the user first.
85
- - Writes are Autonomous; the daemon does not DM the owner. Single ops
86
- only the agent's own judgment is the gate, not the daemon. The
87
- message-discipline contract for any `POST /api/notify` call you issue
88
- here is in the `notify` skill — do not invent ad-hoc phrasing rules.
85
+ - No bulk operations without user confirmation: about to touch 3+ pages,
86
+ stop and ask first. Single ops only.
87
+ - For any `POST /api/notify` call you issue, the message-discipline
88
+ contract lives in the `notify` skill do not invent ad-hoc phrasing.
@@ -42,7 +42,7 @@ connector arguments carry concrete UUIDs.
42
42
 
43
43
  ```bash
44
44
  curl -s http://localhost:8321/api/notion/databases
45
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
45
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
46
46
  ```
47
47
 
48
48
  This route is **not** part of the absolute deny set and is intentionally
@@ -36,7 +36,7 @@ the `<integration-routing-table>` block in the session preamble.
36
36
 
37
37
  ```bash
38
38
  curl -s http://localhost:8321/api/notion/databases
39
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
39
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
40
40
  ```
41
41
 
42
42
  Resolve label → UUID before any Notion call so the connector arguments
@@ -46,7 +46,7 @@ the `<integration-routing-table>` block in the session preamble.
46
46
 
47
47
  ```bash
48
48
  curl -s http://localhost:8321/api/notion/databases
49
- # → { "databases": { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
49
+ # → { "databases": [ { "label": "<label>", "id": "<uuid>" }, ... ] }
50
50
  ```
51
51
 
52
52
  Resolve label → UUID before any Notion call.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: observations
3
- description: Load when a session needs to drain the pending-observations queue or inspect raw external-source state (Obsidian edits, new git commits, Notion updates) and optionally mark entries consumed.
3
+ description: Drain the pending-observations queue and inspect raw external-source state (Obsidian edits, new git commits, Notion updates), marking processed entries consumed. Use during hourly check or morning routine review.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -60,20 +60,7 @@ The daemon pre-summarizes every observation with a per-source LLM call (lite tie
60
60
 
61
61
  ### Legacy fetch-on-doubt (used when `summary_status !== 'done'`)
62
62
 
63
- Before fetching, ask: **"If I fetch this, will my next action actually differ from what I'd do now?"** No → don't fetch. Yes fetch. Fetching for "verification" wastes tokens; fetching to resolve ambiguity is what these endpoints exist for.
64
-
65
- | Situation | Action | Why |
66
- |---|---|---|
67
- | Preview contains TODO, deadline, or concrete task reference | **Act on preview** | You have what you need |
68
- | Preview is truncated on a relevant section | **Fetch full** | Missing load-bearing content |
69
- | Preview is empty or says `(file read failed)` | **Fetch full** | Preview is broken, not empty |
70
- | Change type is `deleted` | **Log only — no fetch** | Nothing to read |
71
- | Journal/diary entry with no task markers visible | **Skip entirely** | Usually no action needed |
72
- | Active project file with ambiguous preview | **Fetch full** | Active project justifies cost |
73
- | Clear commit message + small/routine diff | **Act on preview** | Common refactors, renames |
74
- | Generic commit message ("update","fix","wip") + multi-file | **Fetch full diff** | Vague message requires actual change |
75
-
76
- **Availability:** Obsidian → 503 when app not running (fall back to preview); Git → 400 for repos not in `PA_GIT_REPOS`; Notion → empty for unconfigured DBs.
63
+ When the summarizer hasn't run (`summary_status !== 'done'`) or its summary aged out (`summaryStale === true`), fall back to the fetch-on-doubt heuristic table: {{> ref:fetch-fallback }}
77
64
 
78
65
  ---
79
66
 
@@ -105,7 +92,7 @@ Params: `pending` (bool, default true), `actor` (user/agent/system/unknown), `li
105
92
 
106
93
  The `source` filter is a prefix match: `source=obsidian` returns rows from both the primary management vault (`obsidian:primary`) and the external note vault (`obsidian:external`). Narrow to one side with the namespaced form when the distinction matters — typically `obsidian:primary` refers to the agent's own files and most user-actionable edits come from `obsidian:external`.
107
94
 
108
- Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "observedAt", "payload", "consumedAt?", "consumedBy?", "summaryText?", "noveltyScore?", "summaryStatus?", "summaryAt?", "summaryStale" }], "limit", "offset", "pending" }`
95
+ Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "observedAt", "payload", "consumedAt?", "consumedBy?", "summaryText?", "noveltyScore?", "summaryStatus?", "summaryAt?", "summaryBackend?", "summaryStale" }], "limit", "offset", "pending" }`
109
96
 
110
97
  `summaryText` / `noveltyScore` are populated asynchronously by the per-observation summarizer (cost-reduction-structural §A). When `summaryStatus !== 'done'` the row may have been skipped (deny-list, agent-actor) or the summarizer hasn't caught up yet — fall back to the legacy fetch-on-doubt rules in that case. `summaryStale === true` flags summaries older than 6 h relative to `observedAt`; treat them the same way as a missing summary.
111
98
 
@@ -228,15 +215,13 @@ you to.**
228
215
 
229
216
  #### Common mistakes — do not retry these, they will keep failing
230
217
 
218
+ The live `issues[]` array names any other malformed field; these are the highest-frequency ones.
219
+
231
220
  | Wrong call | Why it fails | Correct shape |
232
221
  |---|---|---|
233
- | `POST /api/observations -d 'limit=30'` | Body is a query string. POST records, GET fetches. | `GET /api/observations?limit=30&pending=true` |
234
222
  | `POST /api/observations/14/consume` | Per-id path returns 405 `use_bulk_endpoint`. | `POST /api/observations/consume -d '{"ids":[14],"correlationId":"..."}'` |
235
- | `GET /api/observations/consume` | Consume is POST-only; GET returns 405. | `POST /api/observations/consume -d '{"ids":[...],"correlationId":"..."}'` |
236
- | `PATCH /api/observations` | No PATCH route — auth middleware returns 401. | `POST /api/observations/consume` (or `POST /api/observations` for new rows). |
237
223
  | `-d '{"ids":[14],"correlation_id":"..."}'` | snake_case. Field must be camelCase. | `-d '{"ids":[14],"correlationId":"..."}'` |
238
224
  | `-d '{"ids":["14"],"correlationId":"..."}'` | Stringified ids. Use integers. | `-d '{"ids":[14],"correlationId":"..."}'` |
239
- | `-d '{"ids":[14],"correlationId":"<event_correlation_id>"}'` | Pasted the angle-bracket placeholder. | Paste the actual id, e.g. `"hourly-2026-04-23T15:00:00Z-7af3"`. |
240
225
 
241
226
  ### GET /api/observations/stats
242
227
 
@@ -0,0 +1,22 @@
1
+ ---
2
+ kind: reference
3
+ name: fetch-fallback
4
+ description: Legacy fetch-on-doubt rules — used only when summary_status !== 'done' (summarizer disabled/lagging/crashed) or summaryStale === true.
5
+ ---
6
+
7
+ # Legacy fetch-on-doubt (used when `summary_status !== 'done'`)
8
+
9
+ Before fetching, ask: **"If I fetch this, will my next action actually differ from what I'd do now?"** No → don't fetch. Yes → fetch. Fetching for "verification" wastes tokens; fetching to resolve ambiguity is what these endpoints exist for.
10
+
11
+ | Situation | Action | Why |
12
+ |---|---|---|
13
+ | Preview contains TODO, deadline, or concrete task reference | **Act on preview** | You have what you need |
14
+ | Preview is truncated on a relevant section | **Fetch full** | Missing load-bearing content |
15
+ | Preview is empty or says `(file read failed)` | **Fetch full** | Preview is broken, not empty |
16
+ | Change type is `deleted` | **Log only — no fetch** | Nothing to read |
17
+ | Journal/diary entry with no task markers visible | **Skip entirely** | Usually no action needed |
18
+ | Active project file with ambiguous preview | **Fetch full** | Active project justifies cost |
19
+ | Clear commit message + small/routine diff | **Act on preview** | Common refactors, renames |
20
+ | Generic commit message ("update","fix","wip") + multi-file | **Fetch full diff** | Vague message requires actual change |
21
+
22
+ **Availability:** Obsidian → 503 when app not running (fall back to preview); Git → 400 for repos not in `PA_GIT_REPOS`; Notion → empty for unconfigured DBs.
@@ -15,13 +15,16 @@ repositories layout (see
15
15
  `docs/design/appendices/unified-repositories.md` §4.5):
16
16
 
17
17
  - **Git-managed repositories** (any classification) write to
18
- `git/<slug>/overview.md` plus per-day `git/<slug>/journal/<YYYY-MM-DD>.md`.
18
+ `knowledge/repos/<slug>/overview.md` plus per-day
19
+ `journal/repos/<slug>/<YYYY-MM-DD>.md`.
19
20
  - **Non-git project pages** (manual projects without a backing repo)
20
- still live at `projects/<slug>.md` per the original layout.
21
+ still live at `plans/projects/<slug>.md` per the original layout.
21
22
 
22
23
  The pre-cutover paths `projects/<slug>.md` (for git-backed projects)
23
- and `git-repos/<slug>.md` are **retired** every git-managed repo
24
- now lives under `git/<slug>/`. Classification (`project` vs `repo-only`)
24
+ and `git-repos/<slug>.md` are **retired**; the `git/<slug>/` spelling is
25
+ a deprecated alias the daemon still normalizes for one release. Every
26
+ git-managed repo now lives under `knowledge/repos/<slug>/` (overview)
27
+ plus `journal/repos/<slug>/` (daily journal). Classification (`project` vs `repo-only`)
25
28
  no longer changes the path; it controls which sections the overview
26
29
  carries (project keeps `## Lifecycle Phases`, repo-only stays light).
27
30
 
@@ -40,7 +43,7 @@ carries (project keeps `## Lifecycle Phases`, repo-only stays light).
40
43
  - Preserve user prose, manual notes, and existing headings. Compress
41
44
  old Git history instead of deleting meaningful context.
42
45
 
43
- ## Overview file shape (`git/<slug>/overview.md`)
46
+ ## Overview file shape (`knowledge/repos/<slug>/overview.md`)
44
47
 
45
48
  - Frontmatter: `type: git-project`, `repository_id`, `slug`,
46
49
  `github_repo` (or null), `local_path`, `classification`, `category`,
@@ -53,7 +56,7 @@ carries (project keeps `## Lifecycle Phases`, repo-only stays light).
53
56
  - `## Open Threads` (manual prose; preserved verbatim)
54
57
  - `## Daily Activity Log` (rolling 30-day window)
55
58
 
56
- ## Journal file shape (`git/<slug>/journal/<YYYY-MM-DD>.md`)
59
+ ## Journal file shape (`journal/repos/<slug>/<YYYY-MM-DD>.md`)
57
60
 
58
61
  - Frontmatter: `type: git-journal`, `repository_id`, `date`,
59
62
  `commit_count`, `pr_events`, `workflow_events`.
@@ -6,8 +6,8 @@
6
6
  "kind": "knowledge_layout",
7
7
  "anchor": "<!-- CURATION:knowledge_layout id=\"project-shape\" -->",
8
8
  "human_label": "Project / git-repo file shape",
9
- "description": "Required sections in git/<slug>/overview.md (git-managed repos) and projects/*.md (non-git manual projects), and what each section holds",
10
- "scope_paths": ["projects/*.md", "git/*/overview.md"]
9
+ "description": "Required sections in knowledge/repos/<slug>/overview.md (git-managed repos) and plans/projects/*.md (non-git manual projects), and what each section holds",
10
+ "scope_paths": ["plans/projects/*.md", "knowledge/repos/*/overview.md"]
11
11
  },
12
12
  {
13
13
  "id": "slug-grammar",
@@ -15,7 +15,7 @@
15
15
  "anchor": "<!-- CURATION:convention_notes id=\"slug-grammar\" -->",
16
16
  "human_label": "Project slug grammar",
17
17
  "description": "Slug format, length cap, reserved stems",
18
- "scope_paths": ["projects/*.md", "git/*/overview.md"]
18
+ "scope_paths": ["plans/projects/*.md", "knowledge/repos/*/overview.md"]
19
19
  }
20
20
  ]
21
21
  }
@@ -2,7 +2,7 @@
2
2
  "kind": "knowledge_layout",
3
3
  "files": [
4
4
  {
5
- "path": "projects/*.md",
5
+ "path": "plans/projects/*.md",
6
6
  "purpose": "Per-project context document for Git-backed projects",
7
7
  "sections": [
8
8
  { "heading": "## Overview", "contains": "one-paragraph description of the project and its current state" },
@@ -14,7 +14,7 @@
14
14
  ]
15
15
  },
16
16
  {
17
- "path": "git/*/overview.md",
17
+ "path": "knowledge/repos/*/overview.md",
18
18
  "purpose": "Per-repository overview for every git-managed repo (replaces the retired git-repos/*.md layout)",
19
19
  "sections": [
20
20
  { "heading": "## Summary", "contains": "one-paragraph description of the repo and its current state" },
@@ -3,12 +3,12 @@
3
3
  "notes": [
4
4
  {
5
5
  "topic": "Slug format",
6
- "rule": "Project and repo slugs are kebab-case, lowercase letters with hyphens between words.",
7
- "example": "plans/projects/cost-explorer.md, git/personal-agent/overview.md"
6
+ "rule": "Project and repo slugs are lowercase; deriveSlug sanitizes to [a-z0-9._-], so digits, dots, underscores, and hyphens all survive (e.g. v1.2.3).",
7
+ "example": "plans/projects/cost-explorer.md, knowledge/repos/personal-agent/overview.md"
8
8
  },
9
9
  {
10
10
  "topic": "Slug length",
11
- "rule": "Slugs are 32 characters or fewer, including the hyphens but excluding the .md suffix.",
11
+ "rule": "Slugs are 60 characters or fewer (SLUG_MAX), including the hyphens but excluding the .md suffix.",
12
12
  "example": "plans/projects/personal-agent-skills.md is at the upper bound"
13
13
  },
14
14
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: reading
3
- description: Load when the user mentions a book or highlight, weekly/monthly reviews need reading progress, or routines need to refresh the reading-taste profile (`user/reading-taste.md`) and propose new book candidates. Owns the taste-profile schema and recommendation rules.
3
+ description: Load when the user mentions a book or highlight, weekly/monthly reviews need reading progress, or routines need to refresh the reading-taste profile (`identity/reading-taste.md`) and propose new book candidates. Owns the taste-profile schema and recommendation rules.
4
4
  allowed-tools:
5
5
  - Bash(curl *)
6
6
  - Read
@@ -12,8 +12,7 @@ allowed-tools:
12
12
 
13
13
  The daemon stores books and reading highlights imported from Kindle
14
14
  (My Clippings.txt and the "Export Notebook" email pipeline) and manual
15
- entries. Data lives in `books` and `reading_highlights` tables. All
16
- display text in `reading-taste.md` must be English (project convention).
15
+ entries. Data lives in `books` and `reading_highlights` tables.
17
16
 
18
17
  ## When to Use
19
18
 
@@ -93,30 +92,9 @@ curl -s "http://localhost:8321/api/books?limit=200&offset=200"
93
92
  | `limit` | number | 50 | Page size (1–200) |
94
93
  | `offset` | number | 0 | Rows to skip. Use with `limit` to paginate beyond the 200 cap |
95
94
 
96
- Response:
97
- ```json
98
- {
99
- "books": [
100
- {
101
- "id": 1,
102
- "title": "Thinking, Fast and Slow",
103
- "author": "Daniel Kahneman",
104
- "source": "kindle",
105
- "status": "reading",
106
- "startedAt": null,
107
- "completedAt": null,
108
- "rating": null,
109
- "notes": null,
110
- "highlightCount": 47,
111
- "createdAt": "2026-04-01T10:00:00Z"
112
- }
113
- ],
114
- "total": 1,
115
- "limit": 50,
116
- "offset": 0,
117
- "hasMore": false
118
- }
119
- ```
95
+ Response: `{ books: [...], total, limit, offset, hasMore }`. Each
96
+ book carries `id`, `title`, `author`, `source`, `status`, `rating`,
97
+ `highlightCount` (plus `startedAt`/`completedAt`/`notes`/`createdAt`).
120
98
 
121
99
  When iterating the entire library, keep calling with `offset += limit`
122
100
  until `hasMore === false`.
@@ -137,20 +115,8 @@ Reading statistics.
137
115
  curl -s "http://localhost:8321/api/books/summary?months=12"
138
116
  ```
139
117
 
140
- Response:
141
- ```json
142
- {
143
- "byStatus": [
144
- { "status": "reading", "count": 3 },
145
- { "status": "completed", "count": 12 }
146
- ],
147
- "monthlyCompleted": [
148
- { "month": "2026-04", "count": 1 },
149
- { "month": "2026-03", "count": 2 }
150
- ],
151
- "totalHighlights": 234
152
- }
153
- ```
118
+ Response: `{ byStatus: [{status, count}], monthlyCompleted:
119
+ [{month, count}], totalHighlights }`.
154
120
 
155
121
  ### PATCH /api/books/:id
156
122
 
@@ -205,6 +171,6 @@ New highlights: 34
205
171
 
206
172
  ---
207
173
 
208
- ## Reading Taste Profile (`user/reading-taste.md`)
174
+ ## Reading Taste Profile (`identity/reading-taste.md`)
209
175
 
210
176
  {{> ref:reading-taste }}
@@ -6,7 +6,7 @@ parent_skill: reading
6
6
  This file captures what the user reads and *why* — topics they return to,
7
7
  how they think, values that keep surfacing in their highlights, and a
8
8
  rolling list of candidate books. It is dictionary-like (same layer as
9
- other `user/*.md` files) and is consumed on-demand — never injected
9
+ other `identity/*.md` files) and is consumed on-demand — never injected
10
10
  into every session. Do not notify the user about taste updates.
11
11
 
12
12
  ### When to refresh
@@ -26,7 +26,7 @@ The file carries a dedicated frontmatter line `Highlights at last sweep: N`
26
26
  holding the `totalHighlights` value from `GET /api/books/summary` at the
27
27
  time of the last successful write. To decide whether to refresh:
28
28
 
29
- 1. `GET /api/context/user/reading-taste` — if 404, treat as
29
+ 1. `GET /api/context/identity/reading-taste` — if 404, treat as
30
30
  `N = 0` and proceed (first sweep).
31
31
  2. `GET /api/books/summary` — read `totalHighlights` as `M`.
32
32
  3. If `M - N < 10`, skip the sweep (log one bullet under agent-journal
@@ -62,7 +62,7 @@ The refresh-trigger check (previous section) uses `totalHighlights` from
62
62
 
63
63
  ### Required file schema
64
64
 
65
- First refresh writes the whole file via `PUT /api/context/user/reading-taste`.
65
+ First refresh writes the whole file via `PUT /api/context/identity/reading-taste`.
66
66
  Subsequent refreshes use `PATCH` per section (but the metadata lines must
67
67
  be updated via a full-file `PUT`). Required structure:
68
68
 
@@ -126,7 +126,7 @@ updated: YYYY-MM-DD
126
126
  Replace a single section (snake_case the heading):
127
127
 
128
128
  ```bash
129
- curl -s -X PATCH http://localhost:8321/api/context/user/reading-taste \
129
+ curl -s -X PATCH http://localhost:8321/api/context/identity/reading-taste \
130
130
  -H 'Content-Type: application/json' \
131
131
  -d '{"section": "topics_of_interest", "mode": "replace", "content": "- cognitive biases\n- systems design"}'
132
132
  ```
@@ -134,7 +134,7 @@ curl -s -X PATCH http://localhost:8321/api/context/user/reading-taste \
134
134
  Replace the full file (first time, or after a major reset):
135
135
 
136
136
  ```bash
137
- curl -s -X PUT http://localhost:8321/api/context/user/reading-taste \
137
+ curl -s -X PUT http://localhost:8321/api/context/identity/reading-taste \
138
138
  -H 'Content-Type: application/json' \
139
139
  -d '{"content": "---\ntype: user\nowner: shared\nupdated: 2026-04-21\n---\n# Reading Taste\n> Last updated: 2026-04-16 09:00\n> Sampled: 87 highlights across 8 books (window: last 12 weeks)\n> Highlights at last sweep: 245\n\n## Topics of Interest\n- ...\n..."}'
140
140
  ```
@@ -93,16 +93,9 @@ Status: pending | running | completed | failed
93
93
  - [<horizon-tag>] <intent> — Source: <dm|mail|observation|reading|dashboard|manual> <YYYY-MM-DD> — Review: <YYYY-MM-DD|[noreview]> — ReviewCount: <0-3> <!-- id: rm-YYYYMMDD-abcdef -->
94
94
  ```
95
95
 
96
- Horizon-tag grammar (validated by the context API):
97
- - `YYYY-MM` → month-granular
98
- - `YYYY-Qn` → calendar quarter
99
- - `YYYY spring|summer|autumn|winter`
100
- - `undated` → no horizon yet
101
-
102
- Examples:
96
+ One worked example (full horizon-tag grammar + more examples are in
97
+ the horizon-tags reference):
103
98
  - `- [2026-05] LA trip candidate — Source: dm 2026-04-19 — Review: 2026-04-20 — ReviewCount: 0 <!-- id: rm-20260419-a3f1c2 -->`
104
- - `- [2026-Q3] US study prep — Source: dm 2026-04-19 — Review: 2026-05-17 — ReviewCount: 0 <!-- id: rm-20260419-b8e7d4 -->`
105
- - `- [undated] Eventually learn Spanish — Source: dm 2026-04-19 — Review: [noreview] — ReviewCount: 3 <!-- id: rm-20260419-0d4c9a -->`
106
99
 
107
100
  ## Stable entry identity
108
101
 
@@ -187,16 +180,7 @@ this recipe — they always emit the full section schema.
187
180
 
188
181
  ## Retention (RFC-D preview)
189
182
 
190
- - **Agent Action Plan event entries** — kept while the event's header
191
- date is within `[today - 7d, today + 180d]`. Older entries whose
192
- Preparation Timeline rows are all `completed` roll off into `daily/`
193
- history.
194
- - **`Scheduled:` entries** — kept while the Wake-up date is within
195
- `[today - 1d, today + 180d]`. On completion, Status flips to
196
- `completed` and the entry persists one extra day for the journal.
197
- - **Long-term Plans** — entries without date movement for 90 days are
198
- marked `[stale]` by Evening Review. 180 days without user
199
- confirmation → DM; no reply in 7 days → remove.
183
+ {{> ref:retention }}
200
184
 
201
185
  ## API surface
202
186
 
@@ -64,7 +64,7 @@ The roadmap API validates two invariants on every PUT / PATCH:
64
64
  file. Duplicate ids return:
65
65
 
66
66
  ```json
67
- {"error":"validation_error","message":"duplicate roadmap id rm-YYYYMMDD-abcdef","path":"plans/roadmap.md"}
67
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Duplicate roadmap entry id `rm-YYYYMMDD-abcdef` (first seen on line N).","path":"roadmap.md"}
68
68
  ```
69
69
 
70
70
  Recovery: re-GET `roadmap`, mint a fresh id **for the colliding
@@ -74,11 +74,12 @@ The roadmap API validates two invariants on every PUT / PATCH:
74
74
 
75
75
  2. **Transition guard.** If an entry id survives from previous → next
76
76
  content, every prior `completed …` row for that id must still
77
- exist byte-for-byte. Removing or rewording a historical completed
78
- row returns:
77
+ exist byte-for-byte. If a completed prep row that existed before is
78
+ gone — dropped or reworded, since a reword no longer matches
79
+ byte-for-byte — the write returns:
79
80
 
80
81
  ```json
81
- {"error":"validation_error","message":"transition_guard: completed row for rm-… changed","path":"plans/roadmap.md"}
82
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Completed Preparation Timeline row for entry `rm-…` was dropped.","path":"roadmap.md"}
82
83
  ```
83
84
 
84
85
  This is intentional: completed prep rows are the audit trail for
@@ -87,11 +88,20 @@ The roadmap API validates two invariants on every PUT / PATCH:
87
88
  If an entry id disappears entirely between previous → next, removal
88
89
  is accepted only when:
89
90
 
90
- - The entry's retention window has elapsed (see §"Retention" in the
91
- skill body), OR
91
+ - The entry's retention window has elapsed (see the **retention**
92
+ reference loaded by the skill body), OR
92
93
  - The operator passes the `X-Operator-Bypass: 1` header (dashboard
93
94
  flows only; never set this from an agent curl).
94
95
 
96
+ A removal before the retention window permits it returns:
97
+
98
+ ```json
99
+ {"ok":false,"errors":[{"code":"context.content_validation_failed"}],"error":"validation_error","message":"Roadmap entry `rm-…` was removed before its retention window permits removal.","path":"roadmap.md"}
100
+ ```
101
+
102
+ Do not blind-retry this — wait out the window or use the operator
103
+ bypass from a dashboard flow.
104
+
95
105
  ## Body submission
96
106
 
97
107
  - Full PUT body is multi-KB → use the heredoc shape
@@ -3,6 +3,17 @@ kind: reference
3
3
  parent_skill: roadmap
4
4
  ---
5
5
 
6
+ Horizon-tag grammar (validated by the context API):
7
+ - `YYYY-MM` → month-granular
8
+ - `YYYY-Qn` → calendar quarter
9
+ - `YYYY spring|summer|autumn|winter`
10
+ - `undated` → no horizon yet
11
+
12
+ Worked examples:
13
+ - `- [2026-05] LA trip candidate — Source: dm 2026-04-19 — Review: 2026-04-20 — ReviewCount: 0 <!-- id: rm-20260419-a3f1c2 -->`
14
+ - `- [2026-Q3] US study prep — Source: dm 2026-04-19 — Review: 2026-05-17 — ReviewCount: 0 <!-- id: rm-20260419-b8e7d4 -->`
15
+ - `- [undated] Eventually learn Spanish — Source: dm 2026-04-19 — Review: [noreview] — ReviewCount: 3 <!-- id: rm-20260419-0d4c9a -->`
16
+
6
17
  `Review:` is the date when Evening Review should re-evaluate whether the
7
18
  line is ready to become an Agent Action Plan entry. Date math uses the
8
19
  configured user timezone, not UTC midnight.
@@ -7,15 +7,15 @@ description: Section auto-ensure recipe for legacy roadmaps missing ## Long-term
7
7
  # Section auto-ensure — legacy `plans/roadmap.md` files
8
8
 
9
9
  Roadmaps created before the `## Long-term Plans` section was
10
- introduced may be missing that header. A direct
11
- `PATCH section=long_term_plans` against such a file returns
10
+ introduced may be missing that header. A PATCH targeting the
11
+ `Long-term Plans` section against such a file returns
12
12
  `400 section_not_found`. This reference is the one-time recovery
13
13
  recipe DM handlers and the evening sweeper run before their first
14
- write to `long_term_plans`.
14
+ write to the `Long-term Plans` section.
15
15
 
16
16
  ## When to run
17
17
 
18
- Run this **only** if you are about to PATCH `long_term_plans` and the
18
+ Run this **only** if you are about to PATCH the `Long-term Plans` section and the
19
19
  file's body is unknown to you. Full-file PUT writers
20
20
  (`routine.roadmap_refresh`) always emit the full section schema, so
21
21
  they never trigger `section_not_found` and never need this recipe.
@@ -35,11 +35,13 @@ curl -s -X PATCH http://localhost:8321/api/context/plans/roadmap \
35
35
  -H 'X-Lock-Id: <roadmap_write_lock_id>' \
36
36
  -d '{"section": "quarterly_focus", "mode": "append", "content": "\n## Long-term Plans\n"}'
37
37
 
38
- # 4. Then PATCH long_term_plans normally
38
+ # 4. Then PATCH the Long-term Plans section normally (note: section value
39
+ # "long-term plans" normalizes to match the "## Long-term Plans" header;
40
+ # the underscore form "long_term_plans" does NOT match)
39
41
  curl -s -X PATCH http://localhost:8321/api/context/plans/roadmap \
40
42
  -H 'Content-Type: application/json' \
41
43
  -H 'X-Lock-Id: <roadmap_write_lock_id>' \
42
- -d '{"section": "long_term_plans", "mode": "append", "content": "- [undated] …"}'
44
+ -d '{"section": "long-term plans", "mode": "append", "content": "- [undated] …"}'
43
45
  ```
44
46
 
45
47
  ## Don'ts
@@ -0,0 +1,18 @@
1
+ ---
2
+ kind: reference
3
+ name: retention
4
+ description: Roadmap retention windows (RFC-D preview) — when Agent Action Plan entries, Scheduled rows, and Long-term Plans roll off. Governs removal acceptance in the transition guard.
5
+ ---
6
+
7
+ # Retention (RFC-D preview)
8
+
9
+ - **Agent Action Plan event entries** — kept while the event's header
10
+ date is within `[today - 7d, today + 180d]`. Older entries whose
11
+ Preparation Timeline rows are all `completed` roll off into `daily/`
12
+ history.
13
+ - **`Scheduled:` entries** — kept while the Wake-up date is within
14
+ `[today - 1d, today + 180d]`. On completion, Status flips to
15
+ `completed` and the entry persists one extra day for the journal.
16
+ - **Long-term Plans** — entries without date movement for 90 days are
17
+ marked `[stale]` by Evening Review. 180 days without user
18
+ confirmation → DM; no reply in 7 days → remove.