@aitne-sh/aitne 0.1.0

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 (249) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +464 -0
  3. package/agent-assets/agent-profiles/_safety.md +26 -0
  4. package/agent-assets/agent-profiles/conversational.md +33 -0
  5. package/agent-assets/agent-profiles/docs-qa.md +24 -0
  6. package/agent-assets/agent-profiles/observer.md +28 -0
  7. package/agent-assets/agent-profiles/profile-importer.md +63 -0
  8. package/agent-assets/agent-profiles/proxy.md +28 -0
  9. package/agent-assets/agent-profiles/routine.md +16 -0
  10. package/agent-assets/agent-profiles/task.md +18 -0
  11. package/agent-assets/docs/concepts/agent-day.md +88 -0
  12. package/agent-assets/docs/concepts/auth-health.md +75 -0
  13. package/agent-assets/docs/concepts/backends-and-tiers.md +126 -0
  14. package/agent-assets/docs/concepts/costs-and-quotas.md +103 -0
  15. package/agent-assets/docs/concepts/delegated-mode.md +223 -0
  16. package/agent-assets/docs/concepts/memory-model.md +118 -0
  17. package/agent-assets/docs/concepts/observations.md +80 -0
  18. package/agent-assets/docs/concepts/process-keys.md +89 -0
  19. package/agent-assets/docs/concepts/routines.md +108 -0
  20. package/agent-assets/docs/concepts/safety-and-execution.md +109 -0
  21. package/agent-assets/docs/concepts/safety-model.md +279 -0
  22. package/agent-assets/docs/concepts/skills.md +100 -0
  23. package/agent-assets/docs/features/integrations/calendar.md +92 -0
  24. package/agent-assets/docs/features/integrations/git.md +95 -0
  25. package/agent-assets/docs/features/integrations/github.md +170 -0
  26. package/agent-assets/docs/features/integrations/mail.md +106 -0
  27. package/agent-assets/docs/features/integrations/notion.md +69 -0
  28. package/agent-assets/docs/features/integrations/obsidian.md +71 -0
  29. package/agent-assets/docs/features/lifestyle/git.md +178 -0
  30. package/agent-assets/docs/features/lifestyle/reading.md +93 -0
  31. package/agent-assets/docs/features/lifestyle/receipts.md +71 -0
  32. package/agent-assets/docs/features/lifestyle/travel-bookings.md +44 -0
  33. package/agent-assets/docs/features/lifestyle/travel-time.md +52 -0
  34. package/agent-assets/docs/features/memory-files/agent-journal.md +105 -0
  35. package/agent-assets/docs/features/memory-files/projects.md +56 -0
  36. package/agent-assets/docs/features/memory-files/roadmap.md +61 -0
  37. package/agent-assets/docs/features/memory-files/schedule.md +112 -0
  38. package/agent-assets/docs/features/memory-files/today.md +73 -0
  39. package/agent-assets/docs/features/memory-files/user-profile.md +81 -0
  40. package/agent-assets/docs/features/messaging/dashboard-chat.md +93 -0
  41. package/agent-assets/docs/features/messaging/discord.md +50 -0
  42. package/agent-assets/docs/features/messaging/overview.md +111 -0
  43. package/agent-assets/docs/features/messaging/pairing-and-magic-phrase.md +69 -0
  44. package/agent-assets/docs/features/messaging/slack.md +51 -0
  45. package/agent-assets/docs/features/messaging/telegram.md +63 -0
  46. package/agent-assets/docs/features/messaging/whatsapp.md +48 -0
  47. package/agent-assets/docs/features/operations/activity-and-conversations.md +105 -0
  48. package/agent-assets/docs/features/operations/approvals.md +58 -0
  49. package/agent-assets/docs/features/operations/backend-routing.md +62 -0
  50. package/agent-assets/docs/features/operations/cost-tracking.md +59 -0
  51. package/agent-assets/docs/features/operations/notifications.md +69 -0
  52. package/agent-assets/docs/features/operations/quiet-hours.md +106 -0
  53. package/agent-assets/docs/features/operations/schedule-approaching.md +60 -0
  54. package/agent-assets/docs/features/routines/custom-routines.md +101 -0
  55. package/agent-assets/docs/features/routines/evening-review.md +81 -0
  56. package/agent-assets/docs/features/routines/hourly-check.md +85 -0
  57. package/agent-assets/docs/features/routines/monthly-review.md +65 -0
  58. package/agent-assets/docs/features/routines/morning-routine.md +123 -0
  59. package/agent-assets/docs/features/routines/weekly-review.md +70 -0
  60. package/agent-assets/docs/getting-started/01-what-is-this.md +192 -0
  61. package/agent-assets/docs/getting-started/02-first-steps.md +80 -0
  62. package/agent-assets/docs/getting-started/03-what-can-this-do.md +110 -0
  63. package/agent-assets/docs/getting-started/04-first-day.md +287 -0
  64. package/agent-assets/docs/glossary.md +116 -0
  65. package/agent-assets/docs/guides/add-a-custom-routine.md +71 -0
  66. package/agent-assets/docs/guides/backup-and-restore.md +54 -0
  67. package/agent-assets/docs/guides/change-which-model-handles-x.md +47 -0
  68. package/agent-assets/docs/guides/connect-a-new-mail-account.md +59 -0
  69. package/agent-assets/docs/guides/import-knowledge-file.md +275 -0
  70. package/agent-assets/docs/guides/install-and-run.md +72 -0
  71. package/agent-assets/docs/guides/migrate-machines.md +52 -0
  72. package/agent-assets/docs/guides/pause-the-agent.md +65 -0
  73. package/agent-assets/docs/guides/reinstall-cleanly.md +52 -0
  74. package/agent-assets/docs/guides/setup-wizard.md +107 -0
  75. package/agent-assets/docs/guides/switch-default-backend.md +60 -0
  76. package/agent-assets/docs/reference/api.md +51 -0
  77. package/agent-assets/docs/reference/cli-commands.md +121 -0
  78. package/agent-assets/docs/reference/config.md +74 -0
  79. package/agent-assets/docs/reference/disallowed-tools.md +76 -0
  80. package/agent-assets/docs/reference/keyboard-shortcuts.md +39 -0
  81. package/agent-assets/docs/reference/process-keys.md +59 -0
  82. package/agent-assets/docs/reference/skills.md +50 -0
  83. package/agent-assets/docs/troubleshooting/auth-failed.md +57 -0
  84. package/agent-assets/docs/troubleshooting/dashboard-shows-degraded.md +55 -0
  85. package/agent-assets/docs/troubleshooting/fallback-keeps-firing.md +54 -0
  86. package/agent-assets/docs/troubleshooting/messaging-not-pairing.md +53 -0
  87. package/agent-assets/docs/troubleshooting/morning-routine-didnt-run.md +75 -0
  88. package/agent-assets/docs/troubleshooting/observation-not-detected.md +57 -0
  89. package/agent-assets/docs/troubleshooting/quota-exhausted.md +57 -0
  90. package/agent-assets/optimizer-skills/drift-analysis/SKILL.md +75 -0
  91. package/agent-assets/optimizer-skills/knowledge-map/SKILL.md +71 -0
  92. package/agent-assets/optimizer-skills/skill-curation/SKILL.md +108 -0
  93. package/agent-assets/project-doc-templates/git-repo.md +21 -0
  94. package/agent-assets/project-doc-templates/project.md +38 -0
  95. package/agent-assets/skills/attach/SKILL.md +104 -0
  96. package/agent-assets/skills/context/SKILL.md +257 -0
  97. package/agent-assets/skills/context/curation.json +37 -0
  98. package/agent-assets/skills/context/seeds/file-responsibilities.seed.json +13 -0
  99. package/agent-assets/skills/context/seeds/frontmatter-requirements.seed.json +40 -0
  100. package/agent-assets/skills/docs-search/SKILL.md +176 -0
  101. package/agent-assets/skills/external-services/SKILL.delegated.claude.md +369 -0
  102. package/agent-assets/skills/external-services/SKILL.delegated.codex.md +349 -0
  103. package/agent-assets/skills/external-services/SKILL.delegated.gemini.md +347 -0
  104. package/agent-assets/skills/external-services/SKILL.md +371 -0
  105. package/agent-assets/skills/mail/SKILL.delegated.claude.md +284 -0
  106. package/agent-assets/skills/mail/SKILL.delegated.codex.md +261 -0
  107. package/agent-assets/skills/mail/SKILL.delegated.gemini.md +255 -0
  108. package/agent-assets/skills/mail/SKILL.md +313 -0
  109. package/agent-assets/skills/mail/references/errors.md +17 -0
  110. package/agent-assets/skills/mail/references/providers.md +40 -0
  111. package/agent-assets/skills/mail/references/query-grammar.md +24 -0
  112. package/agent-assets/skills/management-policy/SKILL.md +307 -0
  113. package/agent-assets/skills/management-policy/curation.json +13 -0
  114. package/agent-assets/skills/management-policy/seeds/policy-file-shape.seed.json +16 -0
  115. package/agent-assets/skills/management-task-modify/SKILL.md +202 -0
  116. package/agent-assets/skills/management-task-register/SKILL.md +330 -0
  117. package/agent-assets/skills/management-task-stop/SKILL.md +166 -0
  118. package/agent-assets/skills/notify/SKILL.md +196 -0
  119. package/agent-assets/skills/notion/SKILL.delegated.claude.md +254 -0
  120. package/agent-assets/skills/notion/SKILL.delegated.codex.md +195 -0
  121. package/agent-assets/skills/notion/SKILL.delegated.gemini.md +194 -0
  122. package/agent-assets/skills/notion/SKILL.md +86 -0
  123. package/agent-assets/skills/observations/SKILL.md +234 -0
  124. package/agent-assets/skills/observations/curation.json +13 -0
  125. package/agent-assets/skills/observations/seeds/source-namespacing.seed.json +20 -0
  126. package/agent-assets/skills/project-doc/SKILL.md +86 -0
  127. package/agent-assets/skills/project-doc/curation.json +21 -0
  128. package/agent-assets/skills/project-doc/seeds/project-shape.seed.json +25 -0
  129. package/agent-assets/skills/project-doc/seeds/slug-grammar.seed.json +20 -0
  130. package/agent-assets/skills/reading/SKILL.md +198 -0
  131. package/agent-assets/skills/reading/references/reading-taste.md +197 -0
  132. package/agent-assets/skills/receipts/SKILL.md +134 -0
  133. package/agent-assets/skills/roadmap/SKILL.md +276 -0
  134. package/agent-assets/skills/roadmap/curation.json +13 -0
  135. package/agent-assets/skills/roadmap/references/horizon-tags.md +40 -0
  136. package/agent-assets/skills/roadmap/references/preparation-timeline.md +47 -0
  137. package/agent-assets/skills/roadmap/seeds/entry-types.seed.json +16 -0
  138. package/agent-assets/skills/schedule/SKILL.md +228 -0
  139. package/agent-assets/skills/scheduled-managed-task/SKILL.md +392 -0
  140. package/agent-assets/skills/today/SKILL.md +198 -0
  141. package/agent-assets/skills/today/curation.json +21 -0
  142. package/agent-assets/skills/today/seeds/agent-notes-flavors.seed.json +17 -0
  143. package/agent-assets/skills/today/seeds/section-shape.seed.json +17 -0
  144. package/agent-assets/skills/travel/SKILL.md +132 -0
  145. package/agent-assets/skills/travel-time/SKILL.md +149 -0
  146. package/agent-assets/skills/user-interview/SKILL.md +323 -0
  147. package/agent-assets/skills/user-interview/references/sweep-and-fallback.md +94 -0
  148. package/agent-assets/skills/user-profile/SKILL.md +210 -0
  149. package/agent-assets/skills/user-profile/curation.json +29 -0
  150. package/agent-assets/skills/user-profile/seeds/learned-context-format.seed.json +14 -0
  151. package/agent-assets/skills/user-profile/seeds/routing-table.seed.json +53 -0
  152. package/agent-assets/skills/user-profile/seeds/topic-files.seed.json +27 -0
  153. package/agent-assets/task-flows/dashboard.docs_qa.md +43 -0
  154. package/agent-assets/task-flows/default.md +11 -0
  155. package/agent-assets/task-flows/git.branch.created.md +25 -0
  156. package/agent-assets/task-flows/git.lifecycle.poll.md +52 -0
  157. package/agent-assets/task-flows/git.local_ahead.stale.md +34 -0
  158. package/agent-assets/task-flows/git.merge_to_default.md +30 -0
  159. package/agent-assets/task-flows/git.project.refresh_architecture.md +100 -0
  160. package/agent-assets/task-flows/git.project.retemplate.md +73 -0
  161. package/agent-assets/task-flows/git.push.detected.md +32 -0
  162. package/agent-assets/task-flows/git.push.force_pushed.md +36 -0
  163. package/agent-assets/task-flows/git.tag.created.md +24 -0
  164. package/agent-assets/task-flows/github.assigned.md +43 -0
  165. package/agent-assets/task-flows/github.pull_request.review_requested.md +57 -0
  166. package/agent-assets/task-flows/github.security_alert.md +45 -0
  167. package/agent-assets/task-flows/github.workflow_run.failed.md +57 -0
  168. package/agent-assets/task-flows/knowledge.import.md +161 -0
  169. package/agent-assets/task-flows/message.received.dm.md +142 -0
  170. package/agent-assets/task-flows/message.received.dm_first.md +117 -0
  171. package/agent-assets/task-flows/message.received.md +14 -0
  172. package/agent-assets/task-flows/routine.custom.md +38 -0
  173. package/agent-assets/task-flows/routine.evening_review.md +323 -0
  174. package/agent-assets/task-flows/routine.hourly_check.delegated.claude.md +405 -0
  175. package/agent-assets/task-flows/routine.hourly_check.delegated.codex.md +400 -0
  176. package/agent-assets/task-flows/routine.hourly_check.delegated.gemini.md +404 -0
  177. package/agent-assets/task-flows/routine.hourly_check.md +184 -0
  178. package/agent-assets/task-flows/routine.hourly_check.triage.md +93 -0
  179. package/agent-assets/task-flows/routine.monthly_review.md +250 -0
  180. package/agent-assets/task-flows/routine.morning_routine.md +300 -0
  181. package/agent-assets/task-flows/routine.morning_routine_initial.md +184 -0
  182. package/agent-assets/task-flows/routine.roadmap_refresh.md +275 -0
  183. package/agent-assets/task-flows/routine.today_refresh.md +172 -0
  184. package/agent-assets/task-flows/routine.user_profile_sweep.md +242 -0
  185. package/agent-assets/task-flows/routine.weekly_review.md +247 -0
  186. package/agent-assets/task-flows/schedule.approaching.md +124 -0
  187. package/agent-assets/task-flows/scheduled.dm.md +391 -0
  188. package/agent-assets/task-flows/scheduled.task.md +141 -0
  189. package/agent-assets/task-flows/setup.initial.md +277 -0
  190. package/agent-assets/task-flows/setup.update.md +53 -0
  191. package/agent-assets/templates/README.md +85 -0
  192. package/agent-assets/templates/_index.md +39 -0
  193. package/agent-assets/templates/_manifest.json +103 -0
  194. package/agent-assets/templates/agent/journal.md +10 -0
  195. package/agent-assets/templates/agent/profile-questions.md +74 -0
  196. package/agent-assets/templates/context-index.md +42 -0
  197. package/agent-assets/templates/dossiers/_index.md +22 -0
  198. package/agent-assets/templates/dossiers/evening.md +23 -0
  199. package/agent-assets/templates/dossiers/hourly.md +23 -0
  200. package/agent-assets/templates/dossiers/monthly.md +23 -0
  201. package/agent-assets/templates/dossiers/morning.md +23 -0
  202. package/agent-assets/templates/dossiers/roadmap.md +23 -0
  203. package/agent-assets/templates/dossiers/weekly.md +23 -0
  204. package/agent-assets/templates/projects/_active.base +14 -0
  205. package/agent-assets/templates/projects/_index.md +29 -0
  206. package/agent-assets/templates/roadmap.md +15 -0
  207. package/agent-assets/templates/routines/_index.md +20 -0
  208. package/agent-assets/templates/routines/evening.md +22 -0
  209. package/agent-assets/templates/routines/hourly.md +30 -0
  210. package/agent-assets/templates/routines/monthly.md +25 -0
  211. package/agent-assets/templates/routines/morning.md +26 -0
  212. package/agent-assets/templates/routines/weekly.md +23 -0
  213. package/agent-assets/templates/rules/_index.md +19 -0
  214. package/agent-assets/templates/rules/journal-export.md +41 -0
  215. package/agent-assets/templates/rules/journal-format.md +61 -0
  216. package/agent-assets/templates/rules/management.md +48 -0
  217. package/agent-assets/templates/rules/mcp.md +40 -0
  218. package/agent-assets/templates/rules/policies/_index.md +22 -0
  219. package/agent-assets/templates/rules/redaction.md +30 -0
  220. package/agent-assets/templates/today.md +13 -0
  221. package/agent-assets/templates/user/_index.md +16 -0
  222. package/agent-assets/templates/user/expertise.md +7 -0
  223. package/agent-assets/templates/user/goals.md +7 -0
  224. package/agent-assets/templates/user/people.md +7 -0
  225. package/agent-assets/templates/user/personal.md +7 -0
  226. package/agent-assets/templates/user/profile.md +28 -0
  227. package/agent-assets/templates/user/work.md +7 -0
  228. package/bin/aitne.mjs +1096 -0
  229. package/package.json +78 -0
  230. package/personal-agent.mjs +39 -0
  231. package/scripts/browser.mjs +99 -0
  232. package/scripts/check-redaction-coverage.mjs +109 -0
  233. package/scripts/commands/audit.mjs +309 -0
  234. package/scripts/commands/doctor.mjs +437 -0
  235. package/scripts/commands/open.mjs +40 -0
  236. package/scripts/commands/setup.mjs +21 -0
  237. package/scripts/commands/uninstall.mjs +114 -0
  238. package/scripts/commands/update.mjs +96 -0
  239. package/scripts/commands/version.mjs +62 -0
  240. package/scripts/commands.md +0 -0
  241. package/scripts/lib/sqlite-loader.mjs +49 -0
  242. package/scripts/message-discipline-digest.mjs +535 -0
  243. package/scripts/poc/google-connector-inheritance/REPORT.md +197 -0
  244. package/scripts/poc/google-connector-inheritance/claude-sdk-probe.mjs +79 -0
  245. package/scripts/remint-roadmap-ids.mjs +257 -0
  246. package/scripts/rm-paths.mjs +22 -0
  247. package/scripts/run-node.mjs +223 -0
  248. package/scripts/smoke-obsidian-api.mjs +166 -0
  249. package/scripts/start.mjs +160 -0
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: notion
3
+ description: Load when the task touches Notion and Notion is in cross-backend delegated mode (DM session is Gemini CLI; `delegatedBackend` is non-Gemini). All Notion operations flow through `POST /api/integrations/notion/exec`; `/api/notion/*` write/read endpoints are not active in this configuration. The label-resolution endpoint `GET /api/notion/databases` remains available.
4
+ ---
5
+
6
+ # Notion (delegated, cross-backend)
7
+
8
+ Your DM session runs on Gemini CLI. Notion access has been delegated
9
+ to a *different* backend (Claude or Codex) whose Notion connector is
10
+ signed in. **You describe Notion intent in natural language; the
11
+ daemon picks the tool.** Tool name divergence between Claude
12
+ (`notion-search`, `notion-create-pages`), Codex (`search`,
13
+ `notion_create_pages`) and any custom Notion MCP server is invisible
14
+ to you.
15
+
16
+ To check which backend currently owns Notion, read
17
+ `~/.personal-agent/integrations.md`. The `/exec` body below is
18
+ backend-agnostic.
19
+
20
+ ## 1. Label resolution (still direct)
21
+
22
+ Database UUIDs are unstable; the user's labels (e.g. `"projects"`,
23
+ `"meeting-notes"`) map to UUIDs through the daemon's settings store.
24
+ This route is NOT proxied — it returns the configured map even in
25
+ delegated mode:
26
+
27
+ ```bash
28
+ curl -sS http://localhost:8321/api/notion/databases
29
+ # → { databases: { "<label>": { "id": "<uuid>", "title": "..." }, ... } }
30
+ ```
31
+
32
+ Resolve label → UUID here BEFORE the `/exec` call so your `task`
33
+ prose carries a concrete data-source URL or UUID.
34
+
35
+ ## 2. The single call shape
36
+
37
+ ```bash
38
+ curl -sS -X POST http://localhost:8321/api/integrations/notion/exec \
39
+ -H 'Content-Type: application/json' \
40
+ -d '{"task": "<natural-language intent>", "outputSchema": { ... }, "cacheable": true}'
41
+ ```
42
+
43
+ The daemon:
44
+
45
+ 1. Verifies Notion is in `mode="delegated"`. If not, you get
46
+ `409 mode_mismatch` — re-read `integrations.md` and stop.
47
+ 2. Spawns the delegatedBackend in a tempdir, lets it pick the right
48
+ tool against the per-task allowed-tools envelope, validates the
49
+ final JSON against your `outputSchema`, returns it.
50
+
51
+ `outputSchema` is **required** (4 KB cap). Defaults: `maxToolCalls=7`,
52
+ `maxBudgetUsd=0.05`, `timeoutMs=60000`. Bump up to 15 / 0.50 / 300000
53
+ for genuinely larger intents.
54
+
55
+ ## 3. Worked examples
56
+
57
+ ### Search + structured listing (read)
58
+
59
+ ```bash
60
+ curl -sS -X POST http://localhost:8321/api/integrations/notion/exec \
61
+ -H 'Content-Type: application/json' \
62
+ -d '{
63
+ "task": "List the top-level pages in the Tasks database (data source <UUID>). For each page return the title, status (if a Status property exists), and last-edited timestamp. Sort by last-edited descending.",
64
+ "outputSchema": {
65
+ "type": "object",
66
+ "required": ["pages"],
67
+ "properties": {
68
+ "pages": {
69
+ "type": "array",
70
+ "items": {
71
+ "type": "object",
72
+ "required": ["id", "title", "lastEditedAt"],
73
+ "properties": {
74
+ "id": {"type": "string"},
75
+ "title": {"type": "string"},
76
+ "status": {"type": "string"},
77
+ "lastEditedAt": {"type": "string", "format": "date-time"}
78
+ }
79
+ }
80
+ }
81
+ }
82
+ },
83
+ "maxToolCalls": 5,
84
+ "cacheable": true
85
+ }'
86
+ ```
87
+
88
+ ### Create a page (destructive — confirmation required)
89
+
90
+ ```bash
91
+ curl -sS -X POST http://localhost:8321/api/integrations/notion/exec \
92
+ -H 'Content-Type: application/json' \
93
+ -d '{
94
+ "task": "Create a new page under the Projects database (data source <UUID>) titled \"Migration plan — May\". Body: <BODY>. Properties: Status=\"Active\", Owner=<USER_ID>.",
95
+ "outputSchema": {
96
+ "type": "object",
97
+ "required": ["pageId", "url"],
98
+ "properties": {
99
+ "pageId": {"type": "string"},
100
+ "url": {"type": "string"}
101
+ }
102
+ },
103
+ "allowDestructive": true
104
+ }'
105
+ ```
106
+
107
+ ## 4. Destructive-confirm two-step (`allowDestructive`)
108
+
109
+ Default is `false`. The subprocess will not run create / update /
110
+ delete / move / duplicate / comment — instead it returns:
111
+
112
+ ```jsonc
113
+ {
114
+ "needsConfirmation": true,
115
+ "confirmationPlan": "I will create a new page titled \"Migration plan — May\" under the Projects database with status \"Active\"."
116
+ }
117
+ ```
118
+
119
+ Surface the plan to the user verbatim. On their explicit OK, re-issue
120
+ the **same `task` verbatim** with `allowDestructive: true`. Never set
121
+ `cacheable: true` on the second call.
122
+
123
+ ## 5. `cacheable: true` for read-only Notion lookups
124
+
125
+ 60s TTL — well-suited to follow-up reads on the same page tree. Skip
126
+ caching when the user explicitly asked about a recent edit, and never
127
+ on writes or the destructive-confirm second call.
128
+
129
+ ## 6. Decision rules
130
+
131
+ ### Page archive — workaround only
132
+
133
+ Neither hosted connector exposes a page-archive tool. Phrase the
134
+ intent as one of:
135
+
136
+ 1. **Property workaround**: "Set Status = Archived on page <UUID>."
137
+ 2. **Move to a Trash page**: "Move page <UUID> under the top-level
138
+ Trash page (creating Trash if it doesn't exist)."
139
+
140
+ ### Schema admin — Approve-tier intent
141
+
142
+ Database / view / data-source mutations change workspace structure.
143
+ Surface what you'd do before invoking, and ask the user.
144
+
145
+ ### Mass-update — ask first
146
+
147
+ If the intent would touch more than ~10 pages, summarize the plan and
148
+ ask before executing.
149
+
150
+ ### Structured database filtering
151
+
152
+ Phrase property-equality intents as the WHERE clause; the subprocess
153
+ picks the right primitive whichever connector is active.
154
+
155
+ ## 7. Error envelope
156
+
157
+ | HTTP | `error` | retry? | What to do |
158
+ |---|---|---|---|
159
+ | 400 | `validation_error` / `schema_too_large` | no | Fix the request body. |
160
+ | 409 | `mode_mismatch` | no | Notion isn't delegated. Re-read `integrations.md` and stop. |
161
+ | 409 | `precondition` | no | Mode/backend flipped during the queue wait. Re-check state. |
162
+ | 429 | `task_quota_exhausted` | no | Daily cap reached. Wait or surface. |
163
+ | 502 | `parse_error` / `schema_violation` | no (daemon already retried once) | Simplify schema. |
164
+ | 502 | `tool_unavailable` | no | No connector tool fits. Surface the gap. |
165
+ | 502 | `tool_failed` | maybe | Connector tool returned an error. Surface verbatim. |
166
+ | 502 | `auth_error` | no | Connector signed out. Re-authenticate. |
167
+ | 502 | `policy_violation` | no | Subprocess attempted an out-of-allowlist tool (anti-injection). |
168
+ | 502 | `loop_aborted` | no | `maxToolCalls` exceeded. Bump or simplify. |
169
+ | 502 | `budget_exhausted` | no | `maxBudgetUsd` exceeded. Caller can raise the cap. |
170
+ | 502 | `post_write_format_failure` | no | Write succeeded; formatting failed. Surface with partial trace. |
171
+ | 503 | `delegated_proxy_busy` | yes | Queue saturated. Backoff and retry once. |
172
+ | 503 | `task_mode_disabled` | no | Operator killed it. Stop. |
173
+ | 504 | `timeout` | yes (1×) | Wall-clock fired. Retry once. |
174
+ | 500 | `subprocess_crashed` | no | Daemon-side defect. Surface and stop. |
175
+
176
+ Always preserve `body.message` verbatim when reporting to the user.
177
+
178
+ ## 8. Owner notification (opt-in)
179
+
180
+ ```bash
181
+ curl -sS -X POST http://localhost:8321/api/notify \
182
+ -H 'Content-Type: application/json' \
183
+ -d '{"message": "Archived 7 stale pages under the <db> database."}'
184
+ ```
185
+
186
+ Do not call `/api/notify` for routine reads or single-page edits.
187
+
188
+ ## 9. Cost attribution
189
+
190
+ Every `/exec` writes one row to `agent_actions` with
191
+ `action_type='delegated_task.exec'`, full token + USD breakdown, and
192
+ the parent `event_id` / `processKey`. Retrospective calls
193
+ (`GET /api/agent/actions?kind=delegated_task.exec`) surface exactly
194
+ what was spent.
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: notion
3
+ description: Load when the user mentions Notion or the agent needs to read, query, search, create, update, or archive Notion pages and databases. Mail is in `mail`; Calendar / external Obsidian / GitHub in `external-services`; scheduling in `schedule`.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Bash(jq *)
7
+ - Read
8
+ ---
9
+
10
+ # Notion API Reference
11
+
12
+ Base URL: `http://localhost:8321`. All calls via `curl -s` with
13
+ `Content-Type: application/json` on POST/PATCH/PUT. URL-encode spaces in paths.
14
+
15
+ Full CRUD over Notion pages plus workspace search. Reads and writes are
16
+ Autonomous; writes are still serialized per-process and pre-marked
17
+ `notion:<pageId>` for write attribution. The daemon does not DM the
18
+ owner before a write — the user's `deniedTools` setting is the gate.
19
+ Call `POST /api/notify` yourself when you judge the user would
20
+ want immediate awareness.
21
+
22
+ **Parent shorthand**: `parent` accepts a label string (`"tasks"`),
23
+ `{ database: "tasks" }`, `{ data_source_id }`, `{ database_id }`, or
24
+ `{ page_id }`. Resolve labels via `GET /api/notion/databases` first.
25
+
26
+ ## Read operations
27
+
28
+ ```bash
29
+ curl -s http://localhost:8321/api/notion/databases # list configured DBs
30
+ curl -s "http://localhost:8321/api/notion/query?database=tasks" # query a database
31
+ curl -s "http://localhost:8321/api/notion/query?database=tasks&filter=..." # filtered (URL-encoded JSON)
32
+ curl -s "http://localhost:8321/api/notion/search?q=launch+plan" # search workspace
33
+ curl -s http://localhost:8321/api/notion/pages/abc123... # retrieve page
34
+ ```
35
+
36
+ Pagination: `page_size` (1–100, default 20) + `start_cursor` from response's
37
+ `next_cursor`. Check `has_more` to know if more pages exist.
38
+
39
+ ## Create a page (write — Autonomous)
40
+
41
+ ```bash
42
+ curl -s -X POST http://localhost:8321/api/notion/pages \
43
+ -H 'Content-Type: application/json' \
44
+ -d '{"parent": "tasks", "properties": {"Name": {"title": [{"text": {"content": "Review roadmap"}}]}, "Status": {"status": {"name": "Todo"}}}, "markdown": "## Context\n\nDetails."}'
45
+ ```
46
+
47
+ ## Update page properties (write — Autonomous)
48
+
49
+ ```bash
50
+ curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123... \
51
+ -H 'Content-Type: application/json' \
52
+ -d '{"properties": {"Done": {"checkbox": true}, "Status": {"status": {"name": "Done"}}}}'
53
+ ```
54
+
55
+ ## Update page content (write — Autonomous)
56
+
57
+ **Concurrency warning**: Notion v5 has no etags. If another client edits
58
+ between GET and PATCH, `oldStr` may fail silently. For high-risk edits,
59
+ prefer `mode=replace_all`.
60
+
61
+ Modes: `append`, `replace_all`, `update` (find-and-replace via
62
+ `updates: [{oldStr, newStr}]`).
63
+
64
+ ```bash
65
+ curl -s -X PATCH http://localhost:8321/api/notion/pages/abc123.../content \
66
+ -H 'Content-Type: application/json' \
67
+ -d '{"mode": "append", "content": "\n## Follow-ups\n- Call vendor"}'
68
+ ```
69
+
70
+ ## Archive a page (write — Autonomous)
71
+
72
+ ```bash
73
+ curl -s -X DELETE http://localhost:8321/api/notion/pages/abc123...
74
+ ```
75
+
76
+ Moves to trash (~30 days). Restore via `PATCH` with `{ "in_trash": false }`.
77
+
78
+ ## When NOT to act
79
+
80
+ - During `routine.hourly_check` this skill is **read-only** — no creates,
81
+ property updates, content patches, or archives.
82
+ - No bulk operations without user confirmation.
83
+ - Writes are Autonomous; the daemon does not DM the owner. Single ops
84
+ only — the agent's own judgment is the gate, not the daemon. If you're
85
+ about to update 3+ pages at once, stop and ask the user. Call
86
+ `POST /api/notify` when the user would want immediate awareness.
@@ -0,0 +1,234 @@
1
+ ---
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.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Read
7
+ ---
8
+
9
+ # Observations Review & Source Access
10
+
11
+ ## Workflow
12
+
13
+ 1. Fetch pending user-originated observations:
14
+ `curl -s "http://localhost:8321/api/observations?pending=true&actor=user&limit=20"`
15
+ 2. Group related observations before acting.
16
+ 3. For each group, apply the **fetch decision** (below) — `summary_text` + `novelty_score` are pre-computed by the daemon's per-observation summarizer; only `novelty_score >= 2` warrants full content fetch.
17
+ 4. Decide actionability:
18
+ - Update `today.md` for TODOs, blockers, decisions, or deadlines
19
+ - Update `roadmap.md` or `projects/*.md` only for material project-state changes
20
+ - Schedule a wake-up if the observation implies a future reminder
21
+ 5. Apply the smallest meaningful set of context updates.
22
+ 6. Mark processed observations consumed:
23
+ `curl -s -X POST http://localhost:8321/api/observations/consume -H 'Content-Type: application/json' -d '{"ids":[1,2],"correlationId":"<event-correlation-id>"}'`
24
+
25
+ ## Skip Criteria
26
+
27
+ - Journal-only edits with no actionable follow-up
28
+ - Formatting-only churn / auto-generated files / index refreshes
29
+ - Agent-originated changes (already filtered via `actor=user`)
30
+
31
+ ## Actionable Criteria
32
+
33
+ - New TODO/FIXME items or explicit deadlines affecting current work
34
+ - Meeting notes with decisions or blockers
35
+ - Project milestones or status changes worth reflecting in roadmap/projects
36
+
37
+ **Cost:** Prefer one grouped patch over many small writes. If all noise, just log that you reviewed.
38
+
39
+ ---
40
+
41
+ ## Fetch Decision Guide
42
+
43
+ The daemon pre-summarizes every observation with a per-source LLM call (lite tier) and writes `summary_text` (≤120 chars) + `novelty_score` (0–3) onto the row. Use those signals as your primary input — fetch full content **only** when the score warrants it.
44
+
45
+ ### Tiered consumption (cost-reduction-structural §A)
46
+
47
+ | `summary_status` / `novelty_score` | Action | Notes |
48
+ |---|---|---|
49
+ | `summary_status === 'done'` AND `novelty_score >= 2` AND `summaryStale === false` | **Fetch full** if needed; route to today.md / projects / roadmap | High-signal — usually justifies the round-trip |
50
+ | `summary_status === 'done'` AND `novelty_score === 1` AND `summaryStale === false` | **Use `summary_text` only** | Minor — no fetch unless cross-referenced by another observation in the same batch |
51
+ | `summary_status === 'done'` AND `novelty_score === 0` AND `summaryStale === false` | **Silently consume** | Noise — log only when aggregating |
52
+ | `summaryStale === true` | Treat as if `summary_status !== 'done'` — fall back to legacy fetch-on-doubt | Summary aged out (>6h since observed_at); content may have drifted under it |
53
+ | `summary_status !== 'done'` (pending/skipped/failed/null) | Fall back to legacy fetch-on-doubt below | Summarizer disabled, lagging, or crashed |
54
+
55
+ **Hard rule:** never fetch raw content when `novelty_score < 2`, unless a different observation in the same batch references the same path/ref OR `summaryStale === true`. This is the primary lever for hourly_check cost reduction.
56
+
57
+ ### Legacy fetch-on-doubt (used when `summary_status !== 'done'`)
58
+
59
+ 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.
60
+
61
+ | Situation | Action | Why |
62
+ |---|---|---|
63
+ | Preview contains TODO, deadline, or concrete task reference | **Act on preview** | You have what you need |
64
+ | Preview is truncated on a relevant section | **Fetch full** | Missing load-bearing content |
65
+ | Preview is empty or says `(file read failed)` | **Fetch full** | Preview is broken, not empty |
66
+ | Change type is `deleted` | **Log only — no fetch** | Nothing to read |
67
+ | Journal/diary entry with no task markers visible | **Skip entirely** | Usually no action needed |
68
+ | Active project file with ambiguous preview | **Fetch full** | Active project justifies cost |
69
+ | Clear commit message + small/routine diff | **Act on preview** | Common refactors, renames |
70
+ | Generic commit message ("update","fix","wip") + multi-file | **Fetch full diff** | Vague message requires actual change |
71
+
72
+ **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.
73
+
74
+ ---
75
+
76
+ ## Observation Review Logging
77
+
78
+ Hourly check and Morning Routine review pending observations in aggregate. Even when nothing is surfaced, the review must remain auditable.
79
+
80
+ ### observations → Agent Log
81
+
82
+ Section: `agent_log` · Mode: `append` · Format: `- HH:MM [observations] summary_of_review`
83
+
84
+ Examples:
85
+ - `- 09:35 [observations] reviewed 6 pending changes, added 2 tasks from Obsidian, skipped 4 as non-actionable`
86
+ - `- 16:08 [observations] reviewed 5 changes, no actionable updates`
87
+
88
+ Skip reasons: `skipped (personal journal)`, `skipped (auto-generated)`, `skipped (no actionable content)`, `skipped (routine note)`.
89
+
90
+ ---
91
+
92
+ ## API Reference — Observations
93
+
94
+ ### GET /api/observations
95
+
96
+ ```bash
97
+ curl -s "http://localhost:8321/api/observations?pending=true&actor=user&limit=20"
98
+ ```
99
+
100
+ Params: `pending` (bool, default true), `actor` (user/agent/system/unknown), `limit` (1-100, default 20), `offset`, `source` (prefix match — e.g. `obsidian`, `obsidian:primary`, `obsidian:external`, `git`, `calendar`), `since` (ISO 8601).
101
+
102
+ 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`.
103
+
104
+ Response: `{ "observations": [{ "id", "source", "ref", "changeType", "actor", "observedAt", "payload", "consumedAt?", "consumedBy?", "summaryText?", "noveltyScore?", "summaryStatus?", "summaryAt?", "summaryStale" }], "limit", "offset", "pending" }`
105
+
106
+ `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.
107
+
108
+ ### POST /api/observations
109
+
110
+ Record an agent-queued observation (only `actor: "agent"` or `"system"`
111
+ accepted — user-authored observations arrive through the vault / mail
112
+ watchers, never this route). Used by `routine.hourly_check` to queue
113
+ `roadmap_candidate` signals the next `routine.roadmap_refresh` consumes.
114
+
115
+ ```bash
116
+ curl -s -X POST http://localhost:8321/api/observations \
117
+ -H 'Content-Type: application/json' \
118
+ -d '{"source":"roadmap_candidate:travel","ref":"trip-portland-2026-summer","changeType":"created","actor":"agent","payload":{"note":"DM mentioned Portland trip this summer"}}'
119
+ ```
120
+
121
+ `(source, ref)` is the idempotency key — re-posting the same pair while
122
+ the prior row is still pending **updates** the payload rather than
123
+ creating a duplicate. Subkind suffixes after the colon are by
124
+ convention (`roadmap_candidate:calendar`, `roadmap_candidate:vault`,
125
+ etc.) and are picked up by the prefix match on the GET route.
126
+
127
+ ### POST /api/observations/consume
128
+
129
+ ```bash
130
+ curl -s -X POST http://localhost:8321/api/observations/consume \
131
+ -H 'Content-Type: application/json' \
132
+ -d '{"ids": [1, 2, 3], "correlationId": "<event_correlation_id>"}'
133
+ ```
134
+
135
+ Response: `{ "consumed": 3 }`
136
+
137
+ ### GET /api/observations/stats
138
+
139
+ `curl -s http://localhost:8321/api/observations/stats` → `{ "total", "pending", "bySource": {...}, "byActor": {...} }`
140
+
141
+ ---
142
+
143
+ ## External Source Read Endpoints
144
+
145
+ Use when the fetch decision says to retrieve full content. These access the
146
+ **external** Obsidian vault, Git repos, and Notion — not the agent's primary
147
+ management vault. Primary-vault reads and writes go through `/api/context/*`
148
+ (see the `context` skill).
149
+
150
+ ### Obsidian (external vault)
151
+
152
+ ```bash
153
+ curl -s http://localhost:8321/api/obsidian/status
154
+ curl -s "http://localhost:8321/api/obsidian/search?q=meeting+notes&limit=10"
155
+ curl -s http://localhost:8321/api/obsidian/notes/Daily%20Notes/2026-04-06 # URL-encode spaces, omit .md
156
+ ```
157
+
158
+ ### Git
159
+
160
+ Only repos in `PA_GIT_REPOS`. Use `repoPath` from event data.
161
+
162
+ ```bash
163
+ curl -s "http://localhost:8321/api/git/log?repo=/path/to/repo&count=5"
164
+ curl -s "http://localhost:8321/api/git/diff?repo=/path/to/repo&ref=HEAD~3..HEAD"
165
+ curl -s "http://localhost:8321/api/git/show?repo=/path/to/repo&hash=abc1234"
166
+ ```
167
+
168
+ ### Notion
169
+
170
+ The wire surface depends on Notion's integration mode (read
171
+ `<integration_modes>` injected above). Pick the branch that matches the
172
+ current state.
173
+
174
+ <!-- mode:direct:notion -->
175
+ ```bash
176
+ curl -s "http://localhost:8321/api/notion/query?databaseId=xxx"
177
+ ```
178
+ <!-- /mode:direct:notion -->
179
+ <!-- mode:delegated-same:notion -->
180
+ The `/api/notion/query|search|pages` routes return 410 in delegated
181
+ mode. Use your session backend's native Notion MCP tool — the
182
+ connector is signed in directly on this backend, no daemon proxy is
183
+ involved. Resolve `<databaseId>` first by reading the un-gated
184
+ `/api/notion/databases` config dump
185
+ (`curl -s http://localhost:8321/api/notion/databases`) and then pass
186
+ the UUID to the connector's data-source / search tool:
187
+
188
+ | session backend | structured filter (data-source query) | listing fallback (no filter support) | workspace search |
189
+ |-----------------|----------------------------------------------------|----------------------------------------------|-------------------------|
190
+ | claude | n/a — connector has no filtered query | `mcp__claude_ai_Notion__notion-fetch` | `mcp__claude_ai_Notion__notion-search` |
191
+ | codex | `mcp__codex_apps__notion._notion_query_data_sources` | `mcp__codex_apps__notion._fetch` | `mcp__codex_apps__notion._search` |
192
+ | gemini | n/a — connector has no filtered query | `mcp_notion_notion-fetch` | `mcp_notion_notion-search` |
193
+
194
+ For Claude / Gemini sessions: call the listing tool against the data
195
+ source and post-filter in this skill (the structured-filter capability
196
+ is Codex-only). For Codex sessions: pass the SQLite-style `WHERE`
197
+ clause directly to `_notion_query_data_sources`. See the `notion`
198
+ skill body for full property-naming and write-tier conventions.
199
+ <!-- /mode:delegated-same:notion -->
200
+ <!-- mode:delegated-cross:notion -->
201
+ The `/api/notion/query|search|pages` routes return 410 in delegated
202
+ mode and your own backend's native Notion connector (if signed in)
203
+ reads a different workspace than the user's delegated one. Call the
204
+ daemon's `/exec` task endpoint with a natural-language intent — the
205
+ daemon spawns the delegated backend's subprocess and lets it pick
206
+ the right connector primitive whichever backend currently owns
207
+ Notion. Resolve `<databaseId>` first via
208
+ `curl -s http://localhost:8321/api/notion/databases` (the config-dump
209
+ path is un-gated), then:
210
+
211
+ ```bash
212
+ curl -s -X POST http://localhost:8321/api/integrations/notion/exec \
213
+ -H 'Content-Type: application/json' \
214
+ -d '{
215
+ "task": "Fetch the most recent <N> pages in the <DB-LABEL> database (data source <UUID>). For each return id, title, lastEditedAt, and any Status property.",
216
+ "outputSchema": { "type": "object", "required": ["pages"], "properties": { "pages": { "type": "array", "items": { "type": "object", "required": ["id","title","lastEditedAt"] } } } },
217
+ "maxToolCalls": 5,
218
+ "cacheable": true
219
+ }'
220
+ ```
221
+
222
+ Do NOT call `/api/notion/{query,search,pages}` directly (returns
223
+ 410), and do NOT fall back to your own backend's native Notion MCP
224
+ tools — that connector reads a different workspace than the user's
225
+ delegated one.
226
+ <!-- /mode:delegated-cross:notion -->
227
+ <!-- mode:disabled:notion -->
228
+ Notion is disabled — there is no live source. Treat the observation
229
+ as preview-only and proceed without a Notion fetch.
230
+ <!-- /mode:disabled:notion -->
231
+
232
+ ## Source namespacing (auto-curated)
233
+
234
+ <!-- CURATION:convention_notes id="source-namespacing" -->
@@ -0,0 +1,13 @@
1
+ {
2
+ "version": 1,
3
+ "sections": [
4
+ {
5
+ "id": "source-namespacing",
6
+ "kind": "convention_notes",
7
+ "anchor": "<!-- CURATION:convention_notes id=\"source-namespacing\" -->",
8
+ "human_label": "Observation source namespacing",
9
+ "description": "Source string conventions: prefix grammar, sub-kind suffixes, idempotency key shape",
10
+ "scope_paths": ["agent-journal.md"]
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "kind": "convention_notes",
3
+ "notes": [
4
+ {
5
+ "topic": "Source prefix",
6
+ "rule": "Observation source strings carry a kind prefix followed by an optional colon-separated sub-kind: kind[:sub_kind][:detail].",
7
+ "example": "obsidian:primary, obsidian:external, roadmap_candidate:travel"
8
+ },
9
+ {
10
+ "topic": "Obsidian split",
11
+ "rule": "obsidian:primary covers the agent's own management vault; obsidian:external covers user note vaults watched separately.",
12
+ "example": "source=obsidian matches both via the prefix filter on GET /api/observations"
13
+ },
14
+ {
15
+ "topic": "Idempotency key",
16
+ "rule": "The pair (source, ref) is the idempotency key on POST /api/observations and a re-post of the same pair updates the pending row instead of duplicating it.",
17
+ "example": "source=roadmap_candidate:travel ref=trip-portland-2026-summer"
18
+ }
19
+ ]
20
+ }
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: project-doc
3
+ description: Create and maintain Git-backed project and repository context documents through the daemon context API only.
4
+ allowed-tools:
5
+ - Bash(curl *)
6
+ - Bash(git -C *)
7
+ ---
8
+
9
+ # Project Doc
10
+
11
+ Use this skill for Git-backed context documents under the unified
12
+ repositories layout (see
13
+ `docs/design/appendices/unified-repositories.md` §4.5):
14
+
15
+ - **Git-managed repositories** (any classification) write to
16
+ `git/<slug>/overview.md` plus per-day `git/<slug>/journal/<YYYY-MM-DD>.md`.
17
+ - **Non-git project pages** (manual projects without a backing repo)
18
+ still live at `projects/<slug>.md` per the original layout.
19
+
20
+ The pre-cutover paths `projects/<slug>.md` (for git-backed projects)
21
+ and `git-repos/<slug>.md` are **retired** — every git-managed repo
22
+ now lives under `git/<slug>/`. Classification (`project` vs `repo-only`)
23
+ no longer changes the path; it controls which sections the overview
24
+ carries (project keeps `## Lifecycle Phases`, repo-only stays light).
25
+
26
+ ## Hard rules
27
+
28
+ - Write only through `/api/context/*`. Never edit files directly on disk.
29
+ - Do not modify `today.md`, `roadmap.md`, `user/*`, `rules/*`, or
30
+ unrelated context files.
31
+ - Preserve valid frontmatter. The overview file uses `type: git-project`,
32
+ the journal file uses `type: git-journal`. Both carry an ISO `updated`
33
+ date.
34
+ - Use `GET /api/context/<path>` before updating an existing overview.
35
+ Use `PUT /api/context/<path>` for initialization or full-document
36
+ updates. Use `PATCH` only when appending to a section without touching
37
+ frontmatter.
38
+ - Preserve user prose, manual notes, and existing headings. Compress
39
+ old Git history instead of deleting meaningful context.
40
+
41
+ ## Overview file shape (`git/<slug>/overview.md`)
42
+
43
+ - Frontmatter: `type: git-project`, `repository_id`, `slug`,
44
+ `github_repo` (or null), `local_path`, `classification`, `category`,
45
+ `created`, `updated`.
46
+ - `# <display name>`
47
+ - `## Summary`
48
+ - `## Architecture`
49
+ - `## Notable Changes`
50
+ - `## Lifecycle Phases` (project classification only)
51
+ - `## Open Threads` (manual prose; preserved verbatim)
52
+ - `## Daily Activity Log` (rolling 30-day window)
53
+
54
+ ## Journal file shape (`git/<slug>/journal/<YYYY-MM-DD>.md`)
55
+
56
+ - Frontmatter: `type: git-journal`, `repository_id`, `date`,
57
+ `commit_count`, `pr_events`, `workflow_events`.
58
+ - `# <date> — <slug>`
59
+ - `## Commits`
60
+ - `## PR / Workflow Events`
61
+ - `## Files Changed`
62
+
63
+ ## Placeholder substitution
64
+
65
+ When the template carries placeholders, replace every one before
66
+ writing:
67
+
68
+ - `{updated}` / `{created}`: current ISO date, `YYYY-MM-DD`.
69
+ - `{slug}`: `task_context.slug` (deterministic, sanitized).
70
+ - `{repository_id}`: `task_context.repositoryId`.
71
+ - `{local_path}`: `task_context.localPath`.
72
+ - `{github_repo}`: `task_context.githubRepo` or `null`.
73
+ - `{classification}`, `{category}`: values from `task_context`.
74
+ - `{display_name}`: pretty-printed slug or `task_context.displayName` if
75
+ the row has one.
76
+ - `{date}`, `{commit_count}`, `{pr_events}`, `{workflow_events}`,
77
+ `{commits_list}`, `{pr_workflow_summary}`, `{files_summary}`: derived
78
+ from Git evidence collected for the journal day.
79
+
80
+ ## Project / git-project file shape (auto-curated)
81
+
82
+ <!-- CURATION:knowledge_layout id="project-shape" -->
83
+
84
+ ## Slug grammar (auto-curated)
85
+
86
+ <!-- CURATION:convention_notes id="slug-grammar" -->
@@ -0,0 +1,21 @@
1
+ {
2
+ "version": 1,
3
+ "sections": [
4
+ {
5
+ "id": "project-shape",
6
+ "kind": "knowledge_layout",
7
+ "anchor": "<!-- CURATION:knowledge_layout id=\"project-shape\" -->",
8
+ "human_label": "Project / git-repo file shape",
9
+ "description": "Required sections in projects/*.md and git-repos/*.md, and what each section holds",
10
+ "scope_paths": ["projects/*.md", "git-repos/*.md"]
11
+ },
12
+ {
13
+ "id": "slug-grammar",
14
+ "kind": "convention_notes",
15
+ "anchor": "<!-- CURATION:convention_notes id=\"slug-grammar\" -->",
16
+ "human_label": "Project slug grammar",
17
+ "description": "Slug format, length cap, reserved stems",
18
+ "scope_paths": ["projects/*.md", "git-repos/*.md"]
19
+ }
20
+ ]
21
+ }