session-orchestrator 3.23.0 → 4.0.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 (393) hide show
  1. package/.agents/skills/architecture/SKILL.md +18 -0
  2. package/.agents/skills/autopilot/SKILL.md +17 -0
  3. package/.agents/skills/bootstrap/SKILL.md +20 -0
  4. package/.agents/skills/brainstorm/SKILL.md +22 -0
  5. package/.agents/skills/claude-md-drift-check/SKILL.md +15 -0
  6. package/.agents/skills/convergence-monitoring/SKILL.md +22 -0
  7. package/.agents/skills/debug/SKILL.md +22 -0
  8. package/.agents/skills/discovery/SKILL.md +20 -0
  9. package/.agents/skills/dispatcher/SKILL.md +15 -0
  10. package/.agents/skills/docs-orchestrator/SKILL.md +18 -0
  11. package/.agents/skills/ecosystem-health/SKILL.md +20 -0
  12. package/.agents/skills/eli5/SKILL.md +20 -0
  13. package/.agents/skills/eval/SKILL.md +21 -0
  14. package/.agents/skills/evolve/SKILL.md +21 -0
  15. package/.agents/skills/frontmatter-guard/SKILL.md +15 -0
  16. package/.agents/skills/gitlab-ops/SKILL.md +20 -0
  17. package/.agents/skills/gitlab-portfolio/SKILL.md +15 -0
  18. package/.agents/skills/grill/SKILL.md +22 -0
  19. package/.agents/skills/hook-development/SKILL.md +15 -0
  20. package/.agents/skills/mcp-builder/SKILL.md +15 -0
  21. package/.agents/skills/memory-cleanup/SKILL.md +21 -0
  22. package/.agents/skills/mode-selector/SKILL.md +17 -0
  23. package/.agents/skills/npm-publish/SKILL.md +16 -0
  24. package/.agents/skills/peekaboo-driver/SKILL.md +18 -0
  25. package/.agents/skills/persona-panel/SKILL.md +17 -0
  26. package/.agents/skills/plan/SKILL.md +20 -0
  27. package/.agents/skills/playwright-driver/SKILL.md +20 -0
  28. package/.agents/skills/quality-gates/SKILL.md +20 -0
  29. package/.agents/skills/reconcile/SKILL.md +21 -0
  30. package/.agents/skills/remote-offload/SKILL.md +20 -0
  31. package/.agents/skills/repo-audit/SKILL.md +16 -0
  32. package/.agents/skills/session-end/SKILL.md +20 -0
  33. package/.agents/skills/session-plan/SKILL.md +20 -0
  34. package/.agents/skills/session-start/SKILL.md +20 -0
  35. package/.agents/skills/spinout/SKILL.md +16 -0
  36. package/.agents/skills/sunset-review/SKILL.md +16 -0
  37. package/.agents/skills/test-runner/SKILL.md +20 -0
  38. package/.agents/skills/tmux-layout/SKILL.md +21 -0
  39. package/.agents/skills/using-orchestrator/SKILL.md +17 -0
  40. package/.agents/skills/vault-mirror/SKILL.md +15 -0
  41. package/.agents/skills/vault-sync/SKILL.md +15 -0
  42. package/.agents/skills/wave-executor/SKILL.md +20 -0
  43. package/.agents/skills/write-executable-plan/SKILL.md +22 -0
  44. package/.claude-plugin/marketplace.json +1 -1
  45. package/.claude-plugin/plugin.json +1 -1
  46. package/.codex-plugin/plugin.json +1 -1
  47. package/.cursor/commands/autopilot.md +2 -2
  48. package/.cursor/commands/bootstrap.md +1 -1
  49. package/.cursor/commands/brainstorm.md +1 -1
  50. package/.cursor/commands/debug.md +1 -1
  51. package/.cursor/commands/discovery.md +1 -1
  52. package/.cursor/commands/dispatcher.md +2 -2
  53. package/.cursor/commands/eli5.md +2 -2
  54. package/.cursor/commands/eval.md +2 -2
  55. package/.cursor/commands/evolve.md +1 -1
  56. package/.cursor/commands/go.md +1 -1
  57. package/.cursor/commands/grill.md +2 -2
  58. package/.cursor/commands/memory-cleanup.md +2 -2
  59. package/.cursor/commands/persona-panel.md +1 -1
  60. package/.cursor/commands/plan.md +1 -1
  61. package/.cursor/commands/portfolio.md +1 -1
  62. package/.cursor/commands/reconcile.md +2 -2
  63. package/.cursor/commands/release.md +2 -2
  64. package/.cursor/commands/session.md +2 -2
  65. package/.cursor/commands/spinout.md +2 -2
  66. package/.cursor/commands/sunset-review.md +2 -2
  67. package/.cursor/commands/templates-ack.md +2 -2
  68. package/.cursor/commands/test.md +2 -2
  69. package/.cursor/skills/brainstorm/SKILL.md +1 -1
  70. package/.cursor/skills/eval/SKILL.md +1 -1
  71. package/.cursor/skills/quality-gates/SKILL.md +1 -1
  72. package/.cursor/skills/remote-offload/SKILL.md +13 -0
  73. package/.orchestrator/policy/blocked-commands.json +121 -0
  74. package/.orchestrator/policy/ecosystem.schema.json +66 -0
  75. package/.orchestrator/policy/quality-gates.example.json +16 -0
  76. package/.orchestrator/policy/quality-gates.schema.json +38 -0
  77. package/.orchestrator/policy/templates-policy.json +27 -0
  78. package/.orchestrator/policy/test-profiles.json +47 -0
  79. package/AGENTS.md +225 -0
  80. package/CHANGELOG.md +1401 -0
  81. package/NOTICE +11 -6
  82. package/README.md +127 -92
  83. package/agents/db-specialist.md +0 -1
  84. package/agents/eval-judge.md +1 -1
  85. package/agents/skill-applied-judge.md +1 -1
  86. package/assets/wave-lifecycle.svg +98 -0
  87. package/commands/release.md +6 -3
  88. package/commands/session.md +18 -3
  89. package/docs/README.md +4 -0
  90. package/{agents/AGENTS.md → docs/agent-authoring.md} +19 -26
  91. package/docs/baseline.md +67 -0
  92. package/docs/ci-setup.md +249 -48
  93. package/docs/codex-setup.md +66 -22
  94. package/docs/components.md +37 -16
  95. package/docs/cursor-setup.md +6 -2
  96. package/docs/events-schema.md +51 -10
  97. package/docs/instruction-delivery.md +62 -0
  98. package/{agents/memory-proposal-collector.md → docs/memory-proposal-flow.md} +1 -8
  99. package/docs/migration-v4.md +341 -0
  100. package/docs/pi-setup.md +6 -1
  101. package/docs/plugin-architecture-v3.md +1 -1
  102. package/docs/rule-authoring.md +85 -19
  103. package/docs/scope-collision-guard.md +8 -8
  104. package/docs/session-config-reference.md +120 -61
  105. package/docs/session-config-template.md +40 -33
  106. package/docs/telemetry/telemetry-claims.md +11 -10
  107. package/docs/telemetry.md +187 -4
  108. package/docs/vault-docs-architecture.md +50 -11
  109. package/hooks/_lib/atomic-json.mjs +111 -0
  110. package/hooks/_lib/hook-import-set.json +1487 -0
  111. package/hooks/_lib/subagent-paths.mjs +143 -0
  112. package/hooks/_lib/subagent-transcript.mjs +562 -0
  113. package/hooks/config-protection.mjs +2 -2
  114. package/hooks/cwd-change-restore.mjs +11 -31
  115. package/hooks/enforce-commands.mjs +69 -0
  116. package/hooks/enforce-scope.mjs +35 -6
  117. package/hooks/hooks-codex.json +1 -1
  118. package/hooks/hooks-cursor.json +10 -0
  119. package/hooks/hooks-pi.json +5 -0
  120. package/hooks/hooks.json +6 -1
  121. package/hooks/loop-guard.mjs +3 -3
  122. package/hooks/on-session-end.mjs +280 -14
  123. package/hooks/on-session-start.mjs +153 -4
  124. package/hooks/on-stop.mjs +371 -17
  125. package/hooks/operator-steer.mjs +2 -2
  126. package/hooks/post-bash-write-verify.mjs +189 -4
  127. package/hooks/post-edit-import-probe.mjs +344 -0
  128. package/hooks/post-subagent-discovery-validator.mjs +278 -392
  129. package/hooks/post-tool-batch-wave-signal.mjs +272 -44
  130. package/hooks/post-tool-failure-corrective-context.mjs +11 -34
  131. package/hooks/post-tooluse-frontend-slop.mjs +3 -3
  132. package/hooks/pre-bash-destructive-guard.mjs +39 -13
  133. package/hooks/pre-bash-memory-propose-audit.mjs +13 -7
  134. package/hooks/skill-invocation-telemetry.mjs +17 -5
  135. package/hooks/subagent-telemetry.mjs +24 -30
  136. package/monitors/monitors.json +3 -3
  137. package/package.json +9 -1
  138. package/pi/prompts/session.md +2 -2
  139. package/plugin.json +27 -0
  140. package/scripts/autopilot.mjs +26 -12
  141. package/scripts/backfill-abandoned-sessions.mjs +130 -15
  142. package/scripts/backfill-learnings-from-vault.mjs +9 -3
  143. package/scripts/dialectic-deriver.mjs +73 -8
  144. package/scripts/emit-event.mjs +10 -2
  145. package/scripts/export-hw-learnings.mjs +113 -1
  146. package/scripts/generate-agents-skills.mjs +378 -0
  147. package/scripts/generate-cursor-adapter.mjs +45 -8
  148. package/scripts/generate-hook-import-set.mjs +249 -0
  149. package/scripts/lib/agent-status.mjs +13 -2
  150. package/scripts/lib/auq/parse.mjs +5 -29
  151. package/scripts/lib/auto-dialectic.mjs +68 -0
  152. package/scripts/lib/auto-dream.mjs +38 -36
  153. package/scripts/lib/autonomy/suitability.mjs +6 -0
  154. package/scripts/lib/autopilot/loop.mjs +2 -2
  155. package/scripts/lib/autopilot/worktree-pipeline.mjs +82 -6
  156. package/scripts/lib/build-live-signals.mjs +25 -22
  157. package/scripts/lib/ci-status-banner.mjs +220 -75
  158. package/scripts/lib/codex/plugin-contract.mjs +82 -6
  159. package/scripts/lib/cold-start-detector.mjs +23 -14
  160. package/scripts/lib/config/auto-dream.mjs +2 -1
  161. package/scripts/lib/config/block-header.mjs +63 -0
  162. package/scripts/lib/config/block-preprocess.mjs +177 -0
  163. package/scripts/lib/config/broken-window.mjs +2 -1
  164. package/scripts/lib/config/cold-start.mjs +2 -1
  165. package/scripts/lib/config/config-protection.mjs +22 -2
  166. package/scripts/lib/config/context-coverage.mjs +2 -1
  167. package/scripts/lib/config/cross-repo.mjs +2 -1
  168. package/scripts/lib/config/custom-phases.mjs +2 -1
  169. package/scripts/lib/config/dialectic.mjs +2 -1
  170. package/scripts/lib/config/discovery-validator.mjs +9 -3
  171. package/scripts/lib/config/dispatcher-autonomy-capture.mjs +24 -1
  172. package/scripts/lib/config/dispatcher-autonomy.mjs +2 -1
  173. package/scripts/lib/config/docs-orchestrator.mjs +2 -1
  174. package/scripts/lib/config/docs-staleness.mjs +2 -1
  175. package/scripts/lib/config/drift-check.mjs +2 -1
  176. package/scripts/lib/config/eval.mjs +2 -1
  177. package/scripts/lib/config/events-rotation.mjs +2 -1
  178. package/scripts/lib/config/evolve.mjs +8 -2
  179. package/scripts/lib/config/frontend-slop-hook.mjs +7 -3
  180. package/scripts/lib/config/gitlab-portfolio.mjs +2 -1
  181. package/scripts/lib/config/handover-gate.mjs +2 -1
  182. package/scripts/lib/config/health-endpoints.mjs +388 -0
  183. package/scripts/lib/config/issue-budget.mjs +2 -1
  184. package/scripts/lib/config/loop-guard.mjs +2 -1
  185. package/scripts/lib/config/memory.mjs +2 -1
  186. package/scripts/lib/config/moc-staleness.mjs +2 -1
  187. package/scripts/lib/config/persona-gate-wave.mjs +2 -1
  188. package/scripts/lib/config/private-config-dir.mjs +67 -0
  189. package/scripts/lib/config/reconcile.mjs +2 -1
  190. package/scripts/lib/config/remote-hosts.mjs +234 -0
  191. package/scripts/lib/config/section-extractor.mjs +7 -1
  192. package/scripts/lib/config/skill-evolution.mjs +2 -1
  193. package/scripts/lib/config/slopcheck.mjs +2 -1
  194. package/scripts/lib/config/state-md-lock.mjs +2 -1
  195. package/scripts/lib/config/templates-first.mjs +2 -1
  196. package/scripts/lib/config/test.mjs +2 -1
  197. package/scripts/lib/config/vault-integration.mjs +7 -1
  198. package/scripts/lib/config/vault-mirror-quality.mjs +2 -1
  199. package/scripts/lib/config/vault-staleness.mjs +2 -1
  200. package/scripts/lib/config/vault-sync.mjs +2 -1
  201. package/scripts/lib/config/verification-auto-fix.mjs +2 -1
  202. package/scripts/lib/config/wave-reviewers.mjs +2 -1
  203. package/scripts/lib/config/worktree-orphans.mjs +2 -1
  204. package/scripts/lib/config.mjs +31 -3
  205. package/scripts/lib/convergence-monitor.mjs +82 -16
  206. package/scripts/lib/dispatcher/enumerate.mjs +2 -17
  207. package/scripts/lib/dispatcher/rank.mjs +124 -48
  208. package/scripts/lib/ecosystem-health.mjs +16 -2
  209. package/scripts/lib/eval/engine.mjs +9 -1
  210. package/scripts/lib/eval/session-resolve.mjs +23 -4
  211. package/scripts/lib/events-schema.mjs +48 -0
  212. package/scripts/lib/events.mjs +256 -7
  213. package/scripts/lib/evolve/autonomy-verdict.mjs +9 -4
  214. package/scripts/lib/evolve/autopilot-effectiveness.mjs +18 -1
  215. package/scripts/lib/frontmatter-guard.mjs +131 -13
  216. package/scripts/lib/gates/gate-full.mjs +26 -0
  217. package/scripts/lib/gates/gate-helpers.mjs +76 -0
  218. package/scripts/lib/gitlab-portfolio/cli.mjs +3 -15
  219. package/scripts/lib/hardware-pattern-detector.mjs +18 -1
  220. package/scripts/lib/harness-audit/categories/category1.mjs +17 -6
  221. package/scripts/lib/harness-audit/categories/category4.mjs +31 -11
  222. package/scripts/lib/host-identity.mjs +50 -11
  223. package/scripts/lib/instruction-budget-guard.mjs +171 -5
  224. package/scripts/lib/learnings/evolve-telemetry.mjs +178 -0
  225. package/scripts/lib/learnings/io.mjs +60 -6
  226. package/scripts/lib/memory-banner.mjs +20 -8
  227. package/scripts/lib/memory-proposals/store.mjs +30 -22
  228. package/scripts/lib/owner-config-banner.mjs +43 -6
  229. package/scripts/lib/owner-config-loader.mjs +21 -10
  230. package/scripts/lib/owner-interview.mjs +3 -3
  231. package/scripts/lib/owner-yaml.mjs +207 -14
  232. package/scripts/lib/peer-discovery.mjs +20 -2
  233. package/scripts/lib/platform.mjs +108 -15
  234. package/scripts/lib/plugin-update-banner.mjs +406 -0
  235. package/scripts/lib/project-hygiene.mjs +38 -2
  236. package/scripts/lib/qg-command-drift-banner.mjs +50 -12
  237. package/scripts/lib/quality-gate.mjs +133 -44
  238. package/scripts/lib/reconcile/emitter.mjs +68 -6
  239. package/scripts/lib/reconcile/engine.mjs +249 -9
  240. package/scripts/lib/reconcile/idempotency.mjs +37 -4
  241. package/scripts/lib/reconcile/writer.mjs +40 -18
  242. package/scripts/lib/scope-gate.mjs +36 -0
  243. package/scripts/lib/session-close-backfill.mjs +125 -18
  244. package/scripts/lib/session-discovery.mjs +57 -3
  245. package/scripts/lib/session-end/phase-skip.mjs +2 -2
  246. package/scripts/lib/session-id.mjs +12 -23
  247. package/scripts/lib/session-identity/own-session.mjs +187 -11
  248. package/scripts/lib/session-lock-shape.mjs +43 -0
  249. package/scripts/lib/session-lock.mjs +5 -10
  250. package/scripts/lib/session-registry.mjs +25 -9
  251. package/scripts/lib/session-schema/constants.mjs +36 -2
  252. package/scripts/lib/session-schema/validator.mjs +38 -4
  253. package/scripts/lib/session-start-probes.mjs +18 -1
  254. package/scripts/lib/session-transition.mjs +1 -1
  255. package/scripts/lib/sessions-canonical.mjs +446 -0
  256. package/scripts/lib/sessions-staleness-banner.mjs +18 -11
  257. package/scripts/lib/skill-health/join.mjs +17 -4
  258. package/scripts/lib/state-md.mjs +78 -0
  259. package/scripts/lib/sunset/walker.mjs +6 -0
  260. package/scripts/lib/telemetry/schema.mjs +255 -17
  261. package/scripts/lib/telemetry/sync.mjs +417 -24
  262. package/scripts/lib/tmux-layout/telemetry.mjs +14 -2
  263. package/scripts/lib/validate/check-agents-skills.mjs +327 -0
  264. package/scripts/lib/validate/check-agents.mjs +3 -3
  265. package/scripts/lib/validate/check-cursor-adapter.mjs +234 -72
  266. package/scripts/lib/validate/check-doc-cli-commands.mjs +9 -33
  267. package/scripts/lib/validate/check-hooks-emit-event-guard.mjs +370 -0
  268. package/scripts/lib/validate/check-hooks-symmetry.mjs +45 -16
  269. package/scripts/lib/validate/check-owner-leakage.mjs +281 -20
  270. package/scripts/lib/validate/check-skill-links.mjs +163 -0
  271. package/scripts/lib/validate/check-skill-script-paths.mjs +455 -0
  272. package/scripts/lib/validate/check-untracked-test-deps.mjs +10 -0
  273. package/scripts/lib/validate/check-unwired-features.mjs +0 -9
  274. package/scripts/lib/validate/check-validator-registration.mjs +254 -0
  275. package/scripts/lib/validate/check-vcs-repo-flag.mjs +6 -28
  276. package/scripts/lib/validate/enumerate-repo-files.mjs +317 -0
  277. package/scripts/lib/validate/markdown-fences.mjs +196 -0
  278. package/scripts/lib/vault-backfill/template.mjs +63 -6
  279. package/scripts/lib/vault-mirror/process.mjs +165 -42
  280. package/scripts/lib/vault-mirror/telemetry.mjs +2 -2
  281. package/scripts/lib/vault-status/board-lock.mjs +185 -0
  282. package/scripts/lib/vault-status/board-writer.mjs +174 -135
  283. package/scripts/lib/vault-status/narrative-mirror.mjs +129 -37
  284. package/scripts/lib/wave-executor/dispatch-common.mjs +164 -0
  285. package/scripts/lib/wave-executor/foreign-dispatch.mjs +7 -142
  286. package/scripts/lib/wave-executor/remote-dispatch.mjs +502 -0
  287. package/scripts/lib/wave-resource-gate.mjs +133 -7
  288. package/scripts/lib/wave-sizing.mjs +4 -1
  289. package/scripts/lib/wave-transcript-tail.mjs +142 -8
  290. package/scripts/materialize-wave-scope.mjs +32 -9
  291. package/scripts/memory-propose.mjs +146 -8
  292. package/scripts/migrate-cold-start-seed.mjs +4 -1
  293. package/scripts/parse-config.mjs +60 -3
  294. package/scripts/promote-vault-strict.mjs +4 -15
  295. package/scripts/release.mjs +337 -29
  296. package/scripts/repair-invalid-sessions.mjs +3 -3
  297. package/scripts/run-quality-gate.mjs +128 -11
  298. package/scripts/site-numbers.mjs +36 -4
  299. package/scripts/sweep-expired-learnings.mjs +90 -0
  300. package/scripts/sync-vault-schema.mjs +3 -1
  301. package/scripts/telemetry.mjs +2 -2
  302. package/scripts/validate-plugin.mjs +187 -0
  303. package/scripts/validate-wave-scope.mjs +28 -8
  304. package/scripts/vault-consolidate.mjs +3 -11
  305. package/scripts/vault-integration-watcher.mjs +2 -4
  306. package/scripts/vault-mirror.mjs +111 -26
  307. package/scripts/wave-scope-binding.mjs +215 -0
  308. package/skills/_shared/instruction-file-resolution.md +10 -0
  309. package/skills/_shared/parallel-aware-auq.md +31 -2
  310. package/skills/_shared/parallel-aware-preamble.md +18 -4
  311. package/skills/_shared/platform-tools.md +1 -1
  312. package/skills/_shared/state-ownership.md +1 -1
  313. package/skills/architecture/SKILL.md +7 -5
  314. package/skills/{domain-model/SKILL.md → architecture/references/domain-model.md} +9 -9
  315. package/skills/autopilot/SKILL.md +4 -18
  316. package/skills/claude-md-drift-check/SKILL.md +5 -1
  317. package/skills/claude-md-drift-check/checker.mjs +62 -2
  318. package/skills/convergence-monitoring/SIGNALS.md +55 -0
  319. package/skills/discovery/probes/vault-staleness.mjs +37 -13
  320. package/skills/discovery/probes-arch.md +20 -18
  321. package/skills/dispatcher/SKILL.md +3 -2
  322. package/skills/ecosystem-health/SKILL.md +4 -1
  323. package/skills/ecosystem-health/wizard.md +5 -0
  324. package/skills/evolve/SKILL.md +87 -11
  325. package/skills/frontmatter-guard/SKILL.md +11 -5
  326. package/skills/npm-publish/SKILL.md +1 -1
  327. package/skills/reconcile/SKILL.md +38 -2
  328. package/skills/remote-offload/SKILL.md +89 -0
  329. package/skills/session-end/SKILL.md +18 -905
  330. package/skills/session-end/phase-3-6-tail.md +19 -9
  331. package/skills/session-end/plan-verification.md +221 -155
  332. package/skills/session-end/references/phase-2-quality-gate.md +93 -0
  333. package/skills/session-end/references/phase-3-documentation-updates.md +229 -0
  334. package/skills/session-end/references/phase-4a-worktree-cleanup.md +120 -0
  335. package/skills/session-end/references/phase-4b-worktree-orphan-sweep.md +58 -0
  336. package/skills/session-end/references/phase-5-issue-cleanup.md +104 -0
  337. package/skills/session-end/references/session-summary-template.md +62 -0
  338. package/skills/session-plan/SKILL.md +49 -0
  339. package/skills/session-start/SKILL.md +41 -900
  340. package/skills/session-start/phase-8-5-express-path.md +1 -1
  341. package/skills/session-start/references/phase-1-1-dispatcher-autonomy-capture.md +55 -0
  342. package/skills/session-start/references/phase-1-2-session-lock.md +140 -0
  343. package/skills/session-start/references/phase-1-5-session-continuity.md +254 -0
  344. package/skills/session-start/references/phase-1-7-vault-status-board.md +53 -0
  345. package/skills/session-start/references/phase-2-7-portfolio-snapshot.md +75 -0
  346. package/skills/session-start/references/phase-4-ssot-environment-check.md +155 -0
  347. package/skills/session-start/references/phase-6-5-forced-reads.md +75 -0
  348. package/skills/session-start/references/phase-6-6-project-intelligence.md +81 -0
  349. package/skills/session-start/references/phase-6-7-memory-banner-telemetry-consent.md +103 -0
  350. package/skills/vault-sync/validator.mjs +21 -27
  351. package/skills/wave-executor/SKILL.md +16 -2
  352. package/skills/wave-executor/references/wave-loop-dispatch.md +612 -0
  353. package/skills/wave-executor/references/wave-loop-review.md +570 -0
  354. package/skills/wave-executor/references/wave-loop-scope-manifest.md +162 -0
  355. package/skills/wave-executor/wave-loop.md +14 -1271
  356. package/templates/_shared/journey-manifest.md +10 -6
  357. package/.cursor/commands/autopilot-multi.md +0 -14
  358. package/.cursor/commands/contract-version-bump.md +0 -14
  359. package/.cursor/commands/journey-audit.md +0 -14
  360. package/.cursor/skills/contract-version-bump/SKILL.md +0 -12
  361. package/.cursor/skills/daily/SKILL.md +0 -12
  362. package/.cursor/skills/domain-model/SKILL.md +0 -13
  363. package/.cursor/skills/journey-audit/SKILL.md +0 -13
  364. package/.cursor/skills/skill-creator/SKILL.md +0 -13
  365. package/.cursor/skills/ubiquitous-language/SKILL.md +0 -13
  366. package/commands/autopilot-multi.md +0 -74
  367. package/commands/contract-version-bump.md +0 -28
  368. package/commands/journey-audit.md +0 -43
  369. package/pi/prompts/autopilot-multi.md +0 -12
  370. package/pi/prompts/contract-version-bump.md +0 -12
  371. package/pi/prompts/journey-audit.md +0 -12
  372. package/scripts/autopilot-multi.mjs +0 -885
  373. package/scripts/backfill-learnings-expires.mjs +0 -196
  374. package/scripts/backfill-learnings.mjs +0 -203
  375. package/scripts/fleet-instruction-scan.mjs +0 -141
  376. package/scripts/lib/autopilot/dep-graph.mjs +0 -417
  377. package/scripts/lib/autopilot/multi-killswitch.mjs +0 -184
  378. package/scripts/lib/webhook-url.mjs +0 -105
  379. package/scripts/lifecycle-sim-v6.mjs +0 -347
  380. package/scripts/migrate-learnings-jsonl.mjs +0 -189
  381. package/scripts/migrate-subagents-jsonl.mjs +0 -196
  382. package/scripts/upload-social-preview.mjs +0 -316
  383. package/skills/_shared/model-selection.md +0 -64
  384. package/skills/contract-version-bump/SKILL.md +0 -219
  385. package/skills/daily/SKILL.md +0 -222
  386. package/skills/daily/generate.sh +0 -92
  387. package/skills/daily/templates/daily.md.tpl +0 -36
  388. package/skills/journey-audit/SKILL.md +0 -269
  389. package/skills/skill-creator/SKILL.md +0 -168
  390. package/skills/ubiquitous-language/SKILL.md +0 -97
  391. package/skills/vault-sync/package-lock.json +0 -40
  392. /package/skills/{domain-model → architecture/references}/ADR-FORMAT.md +0 -0
  393. /package/skills/{domain-model → architecture/references}/CONTEXT-FORMAT.md +0 -0
@@ -1,219 +0,0 @@
1
- ---
2
- name: contract-version-bump
3
- user-invocable: true
4
- tags: [contracts, versioning, schema, changelog, governance]
5
- model: sonnet
6
- model-preference: sonnet
7
- model-preference-codex: gpt-5.4-mini
8
- model-preference-cursor: claude-sonnet-4-6
9
- args-schema:
10
- - flag: --contract <path>
11
- description: "Path to the contract file being bumped (JSON Schema, API spec, config schema). Inferred from conversation context if omitted."
12
- description: >
13
- Use this skill when changing a machine-readable contract — a JSON Schema, an API spec, or a
14
- config schema — and bumping its version: tightening a constraint, adding/removing/renaming a
15
- field, introducing a breaking change, raising an API version, or writing the changelog entry
16
- for a schema change. Trigger on "change the schema", "tighten this constraint", "bump the
17
- schema version", "breaking change to the API", "new API version", "changelog entry for a
18
- schema change". Runs six phases — classify against the contract's OWN versioning rule (not
19
- generic semver instinct), find every version literal and vendored copy, check consumer
20
- compatibility for new keywords, apply consistently, write the changelog entry, and report
21
- downstream drift — codifying three non-obvious traps hit in a real case (GitLab issue #17,
22
- `aiat-enablement` repo, 2026-07-25).
23
- ---
24
-
25
- # Contract Version Bump
26
-
27
- > Project-instruction file resolution: `CLAUDE.md` and `AGENTS.md` (Codex CLI) are transparent
28
- > aliases — see [skills/_shared/instruction-file-resolution.md](../_shared/instruction-file-resolution.md).
29
- > Every reference to `CLAUDE.md` in this skill resolves via that precedence rule.
30
-
31
- A version bump on a machine-readable contract (JSON Schema, OpenAPI/API spec, config schema) is
32
- not just "increment the number." Three failure modes recur and are each individually
33
- non-obvious enough that a careful agent still misses them without a checklist: the contract's
34
- own versioning rule may not even cover the change you're making; version literals live in more
35
- places than you remember; and a schema keyword that no consumer evaluates is worse than no
36
- constraint at all, because it *looks* enforced. This skill runs six phases to close all three.
37
-
38
- **Reference case:** `aiat-enablement` repo, GitLab issue #17 (2026-07-25). A JSON Schema contract
39
- (`docs/spec/estate.schema.json`, draft/2020-12) had six fields tightened with new `pattern`
40
- constraints; `schema_version` moved `0.1.0` → `0.1.1`. All three traps below happened in that
41
- one change. Where cited, "the reference case" means this.
42
-
43
- ## Phase 1: Classify against the CONTRACT'S OWN versioning rule
44
-
45
- Do not classify Patch/Minor/Major from generic semver instinct. Read the contract's own
46
- versioning-rules section (in its prose spec, README, or a `## Versioning` block near the schema)
47
- and ask explicitly: **does this rule even define the change class you're making?**
48
-
49
- ```bash
50
- # Does the spec define rules for Patch changes at all? (substitute Minor/Major as needed)
51
- grep -n "^#.*[Vv]ersion" docs/spec/<contract>.md
52
- grep -c "Patch" docs/spec/<contract>.md
53
- ```
54
-
55
- If the clause you need is missing, **authoring that clause is part of this change**, not a
56
- side quest — write it with an explicit justification for why the new class exists and why your
57
- change belongs in it, then proceed. If the clause exists but classifies your change as a stricter
58
- tier than you assumed (e.g. a "just tightening a pattern" edit is actually forbidden under an
59
- additive-only Minor rule), the rule wins — either recategorize the change or amend the rule
60
- first, but never bump the number past what the contract's own rule permits.
61
-
62
- Reference case: `docs/spec/estate-yaml-v0.md` defined only Minor (additive-only) and Major
63
- (needs a migration step). `grep -c "Patch" docs/spec/estate-yaml-v0.md` returned `0`. A
64
- constraint tightening is not additive, so under the existing rule alone it was forbidden. The
65
- Patch clause had to be authored — with a written justification (no production consumers yet
66
- validate against this vorproduktions-schema, so no migration burden exists) — before the bump
67
- was legitimate.
68
-
69
- ## Phase 2: Find every version literal and copy — mechanically, not from memory
70
-
71
- Never trust "I updated it everywhere I remember." Grep for the literal.
72
-
73
- ```bash
74
- # 1. Every occurrence of the current version string in this repo
75
- grep -rn "<current-version>" --include=*.json --include=*.md --include=*.yaml --include=*.yml .
76
-
77
- # 2. The field/key that carries the version, wherever it's mentioned in prose
78
- # (field-catalog tables, example fixtures, README snippets)
79
- grep -rln "schema_version\|apiVersion\|<version-field-name>" docs/ examples/ 2>/dev/null
80
-
81
- # 3. Vendored copies in sibling repos — check every path under the instruction
82
- # file's `cross-repos:` list. Match by basename, not by path: a vendored copy
83
- # is rarely at an identical relative path.
84
- # CLAUDE.md and AGENTS.md are transparent aliases — resolve whichever exists.
85
- INSTR=$([ -f CLAUDE.md ] && echo CLAUDE.md || echo AGENTS.md)
86
- for repo in $(yq '.["cross-repos"][]' "$INSTR" 2>/dev/null || grep -A20 '^cross-repos:' "$INSTR" | grep ' - ' | sed 's/^ *- *//'); do
87
- find "$repo" -iname "$(basename <contract-file>)" 2>/dev/null
88
- done
89
- ```
90
-
91
- For every location found, decide explicitly: **does it get bumped, or is it exempt?** Exemptions
92
- are legitimate (a dated SSOT snapshot like a PRD is allowed to stay frozen at the version it was
93
- approved under) but the exemption must be written down next to the literal that was skipped, or
94
- the next diff will read as silent divergence.
95
-
96
- Reference case: `schema_version` lived in five places — the schema file itself
97
- (`docs/spec/estate.schema.json`), the field-catalog table in the prose spec
98
- (`docs/spec/estate-yaml-v0.md`), an example fixture (`docs/spec/examples/estate.example.yaml`), a
99
- **vendored copy in a different repo** (`aiat-poc-infra/scripts/estate/estate.schema.json`), and
100
- the PRD (`docs/prd/2026-07-25-aiat-enablement.md`, Anhang D.1). The PRD was deliberately *not*
101
- bumped — but that decision was written into the spec's "Anmerkungen zu diesem Dokument" section
102
- explicitly, precisely so it would never be mistaken for an oversight.
103
-
104
- ## Phase 3: Check consumer compatibility for every new/changed keyword
105
-
106
- For each keyword you are adding or changing (`pattern`, `maxLength`, `enum`, `format`,
107
- `additionalProperties`, a new required field, a new `apiVersion` value, …), find every known
108
- consumer of the contract and ask: **does this consumer actually evaluate this keyword, or does
109
- it silently ignore what it doesn't recognize?**
110
-
111
- - A full-featured library (ajv, `jsonschema`, an OpenAPI-generated client) generally implements
112
- the standard vocabulary — trust it, but confirm the vocabulary/draft version matches (e.g. a
113
- draft-07 validator will not enforce 2020-12-only keywords).
114
- - A hand-written parser/interpreter (a bash+heredoc validator, a custom regex-based checker, a
115
- bespoke deserializer) is the risk case. Grep its source for the keyword name:
116
-
117
- ```bash
118
- grep -n "maxLength\|minLength\|pattern\|format\|enum" <consumer-script-or-module>
119
- ```
120
-
121
- If the keyword is absent from the consumer's implementation, you have three options — pick one
122
- and write it down, never leave it implicit:
123
- 1. **Extend the consumer** to support the keyword (preferred when the consumer is yours to change).
124
- 2. **Fold the constraint into a keyword the consumer already supports** (e.g. encode a length
125
- limit inside a `pattern` instead of a separate `maxLength`).
126
- 3. **Accept the gap and document it as a known limitation** in the spec, naming the consumer —
127
- only when neither of the above is feasible right now.
128
-
129
- A constraint a consumer silently ignores is worse than no constraint: it looks enforced in the
130
- schema, so nobody double-checks the actual runtime behavior, and invalid data passes through
131
- undetected.
132
-
133
- Reference case: `maxLength: 63` was the natural way to express S3 bucket-name limits. The
134
- downstream validator (`aiat-poc-infra/scripts/estate/validate-estate-yaml.sh`) is a hand-written
135
- JSON-Schema mini-interpreter that does not implement `maxLength` — it would have parsed the
136
- schema, not recognized the keyword, and silently done nothing, so a 200-character bucket name
137
- would still validate green. Decision: extend the consumer (option 1) rather than relying only on
138
- the `pattern`'s implicit length ceiling — the `maxLength` branch was added to the interpreter in
139
- the same session, on branch `feature/estate-yaml-format-tightening-17`, and proven by a mutation
140
- test (disable the branch → the `[MAXLENGTH]` assertion goes red while `[PATTERN]` still fires).
141
-
142
- That mutation test is itself the lesson: because the bucket `pattern`
143
- (`^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$`) already bounds total length via its quantifier, an
144
- over-length value trips BOTH rules. A fixture alone could not prove the new `maxLength` code was
145
- load-bearing — only disabling that code and watching the specific assertion fail could. When a
146
- new keyword overlaps an existing constraint, prove it in isolation or you have not proven it.
147
-
148
- ## Phase 4: Apply consistently
149
-
150
- Bump the version literal and the constraint change together, everywhere Phase 2 found a
151
- non-exempt occurrence. For each exemption identified in Phase 2, write the reason next to it
152
- (a spec's "Anmerkungen"/decisions section, a code comment, a linked issue) — an exemption without
153
- a written reason is indistinguishable from a bug the next time someone diffs the two documents.
154
-
155
- ## Phase 5: Write the changelog entry
156
-
157
- Follow [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) conventions already in use in
158
- this repo's `CHANGELOG.md` — add the entry under the repo's convention for in-progress work
159
- (commonly an `## [Unreleased]` section; check the top of the file for the existing pattern before
160
- inventing a new one). What goes in the entry depends on the classification from Phase 1:
161
-
162
- - **Patch (constraint tightening on an existing field):** name every field that changed, the old
163
- constraint and the new one. **State explicitly that this can reject previously-valid documents
164
- for consumers, even though the version number alone does not signal a breaking change** — the
165
- version-number tier and the actual blast radius for a consumer are two different axes; do not
166
- let the reader infer breaking-ness from the tier alone.
167
- - **Minor (additive field(s)):** name the new field(s) and confirm the change is additive-only —
168
- no existing field's meaning, requiredness, or name changed.
169
- - **Major (breaking structural change):** name the field(s)/structure that changed and link the
170
- migration step (e.g. `migrations/<contract>/`) a consumer must run.
171
-
172
- ## Phase 6: Report downstream drift
173
-
174
- List every vendored copy or dependent repo found in Phase 2 that this change did **not** update.
175
- For each: name the repo/path, why it wasn't updated now (e.g. "follow-up MR pending, tracked
176
- separately"), and the tracking issue if one exists. Never let a known-stale copy pass silently —
177
- surface it as explicit follow-up work, even if fixing it is out of scope for this change.
178
-
179
- ---
180
-
181
- ## Checklist
182
-
183
- - [ ] Read the contract's own versioning-rule section. Does it define the change class you're
184
- making? If not, write the clause first (with justification), before touching the version.
185
- - [ ] Classify Patch / Minor / Major against that rule — not generic semver instinct.
186
- - [ ] `grep -rn` the current version literal across this repo (schema, prose spec, examples/fixtures).
187
- - [ ] Search every repo in the instruction file's `cross-repos:` list (`CLAUDE.md`, or `AGENTS.md`
188
- on Codex CLI) for a vendored copy (basename match).
189
- - [ ] For every new/changed keyword, grep each known consumer's source for that keyword name.
190
- Decide: extend / fold into a supported keyword / document the gap — pick one, write it down.
191
- - [ ] Apply the bump + constraint change to every non-exempt literal found in Phase 2.
192
- - [ ] Write the reason next to every exemption (a document deliberately NOT bumped).
193
- - [ ] Write the changelog entry — name the fields, old vs. new constraint, and call out breaking
194
- risk for consumers explicitly, independent of the version tier.
195
- - [ ] List every dependent repo/copy left un-synced, with a tracking issue.
196
-
197
- ## Anti-Patterns
198
-
199
- 1. **Silent contract violation.** Bumping a version for a change class the contract's own rule
200
- doesn't cover — or actively forbids — without amending the rule first. *Reference case:* the
201
- spec defined only Minor (additive) and Major (needs migration); a constraint tightening isn't
202
- additive, so it was forbidden under the existing rule until a Patch clause was authored with
203
- an explicit justification.
204
- 2. **Literal drift from memory.** Updating the version "everywhere I remember" instead of
205
- grepping mechanically. *Reference case:* the version literal lived in five places, including a
206
- vendored copy in a *different* repo (`aiat-poc-infra`) that a memory-based sweep would not
207
- have found; one location (the PRD) was correctly left un-bumped, but only because that
208
- exemption was written down explicitly instead of left silent.
209
- 3. **Ignored keyword, worse than no keyword.** Adding a schema keyword without checking whether
210
- every known consumer evaluates it. *Reference case:* `maxLength: 63` would have been silently
211
- skipped by a hand-written validator that doesn't implement it — the schema would have *looked*
212
- enforced while the runtime check let arbitrarily long values through.
213
-
214
- ## When this does not apply
215
-
216
- Pure documentation-only edits to a contract (typo fixes, added examples, clarified descriptions)
217
- that change no validated field, constraint, or version-relevant semantics do not need a version
218
- bump or this skill — but if you're unsure whether a wording change is validation-relevant, treat
219
- it as a change and run Phase 1.
@@ -1,222 +0,0 @@
1
- ---
2
- name: daily
3
- user-invocable: true
4
- tags: [vault, daily, obsidian, pkm]
5
- model: haiku
6
- model-preference: sonnet
7
- model-preference-codex: gpt-5.4-mini
8
- model-preference-cursor: claude-sonnet-4-6
9
- description: >
10
- Use this skill when creating today's daily note in the Meta-Vault (03-daily/YYYY-MM-DD.md) with valid
11
- vaultFrontmatterSchema-compliant YAML frontmatter. Idempotent: re-running on the
12
- same day opens the existing note instead of overwriting. Use when starting a work
13
- day, capturing scratch notes, or bootstrapping the inbox flow.
14
- ---
15
-
16
- # Daily Skill
17
-
18
- ## Status
19
-
20
- IMPLEMENTED 2026-04-13.
21
-
22
- ## Purpose
23
-
24
- Bootstraps today's daily note in the Meta-Vault so the user can start capturing
25
- thoughts, scratch work, and "done today" items without yak-shaving YAML
26
- frontmatter each morning. The daily note is the anchor of the PKM workflow: it
27
- is where the inbox flow starts, where daily momentum is tracked, and where
28
- evening reflections land. Every daily note carries the same frontmatter shape
29
- (validated by `vaultFrontmatterSchema`), which makes Dataview queries and the
30
- vault-sync validator trivial.
31
-
32
- ## Prerequisites
33
-
34
- - Must be invoked from inside a Meta-Vault root (cwd contains `03-daily/`) OR
35
- with `VAULT_DIR` resolved to the vault path (see Resolution Order below).
36
- - `03-daily/` must already exist — the skill fails fast if it does not.
37
- - `bash` + `sed` + `date` (always available on macOS/Linux).
38
-
39
- ### VAULT_DIR Resolution Order
40
-
41
- 1. `vault-integration.vault-dir` in Session Config (highest precedence)
42
- 2. `VAULT_DIR` environment variable
43
- 3. `$PWD` (fallback when neither is set)
44
-
45
- Claude must read Session Config and export `VAULT_DIR` before calling
46
- `generate.sh`. The canonical pattern (mirrors `session-end` and `evolve`):
47
-
48
- ```bash
49
- CONFIG=$(cat .orchestrator/session-config.yaml | yq -o json)
50
- VM_DIR=$(echo "$CONFIG" | jq -r '."vault-integration"."vault-dir" // empty')
51
- : "${VM_DIR:=$VAULT_DIR}"
52
- VAULT_DIR="$VM_DIR" bash /path/to/skills/daily/generate.sh
53
- ```
54
-
55
- `generate.sh` itself reads only `VAULT_DIR` (pure bash, no Config parser).
56
-
57
- ## Algorithm
58
-
59
- 1. **Resolve `VAULT_DIR`.** Check `vault-integration.vault-dir` in Session
60
- Config first; fall back to the `VAULT_DIR` env var; then `$PWD`. The
61
- config field takes precedence — see Prerequisites for the canonical
62
- resolution snippet. `generate.sh` then validates: template exists (exit 2
63
- if not), vault dir exists (exit 3 if not), `03-daily/` exists (exit 4 if
64
- not).
65
- 2. **Compute today's date.** `date +%Y-%m-%d` — ISO 8601 date-only, respecting
66
- the system timezone (the user is in Vienna, so `Europe/Vienna` via system TZ).
67
- 3. **Target path.** `$VAULT_DIR/03-daily/YYYY-MM-DD.md`.
68
- 4. **Idempotency check.** If the target already exists, print
69
- `Daily note already exists: <path>` and exit 0. Never overwrite.
70
- 5. **Render template.** Read `templates/daily.md.tpl` (next to this SKILL.md)
71
- and substitute `{{date}}`, `{{id}}`, `{{created}}`, `{{updated}}`,
72
- `{{title}}`, `{{weekday}}` via `sed`. The template is literal markdown; the
73
- only shell interpolation happens in the `sed` substitutions.
74
- 6. **Write to target path.** Uses `sed … > "$TARGET.tmp" && mv "$TARGET.tmp"
75
- "$TARGET"` to avoid leaving a half-written file on disk if sed fails.
76
- 7. **Validate** (recommended but not automatic in `generate.sh`). Callers
77
- should run the vault-sync validator over the vault in hard mode to confirm
78
- schema compliance:
79
- ```bash
80
- VAULT_DIR="$VAULT_DIR" bash ../vault-sync/validator.sh --mode hard
81
- ```
82
- The BATS test suite runs this check on every run — see
83
- `tests/daily.bats`. If validation ever fails, the template has drifted from
84
- the canonical Zod schema; fix the template, do not downgrade the gate.
85
- 8. **Print success.** `Created daily note: <path>` on stdout, exit 0.
86
-
87
- ## Implementation
88
-
89
- The deterministic path is implemented in `generate.sh` (pure bash). An
90
- LLM-driven fallback is unnecessary: daily-note creation is a 100%
91
- mechanical transform and a shell script is faster, cheaper, and more
92
- reliable than an LLM round-trip. Recommended invocation:
93
-
94
- ```bash
95
- # Resolve vault dir from Session Config first, env var as fallback:
96
- CONFIG=$(cat .orchestrator/session-config.yaml | yq -o json)
97
- VM_DIR=$(echo "$CONFIG" | jq -r '."vault-integration"."vault-dir" // empty')
98
- : "${VM_DIR:=$VAULT_DIR}"
99
- VAULT_DIR="$VM_DIR" bash ~/Projects/session-orchestrator/skills/daily/generate.sh
100
- ```
101
-
102
- Or, if `VAULT_DIR` is already set in the environment and Session Config has
103
- no `vault-integration.vault-dir` override:
104
-
105
- ```bash
106
- VAULT_DIR=~/Projects/vault bash ~/Projects/session-orchestrator/skills/daily/generate.sh
107
- ```
108
-
109
- Or, if the user's cwd is already the vault:
110
-
111
- ```bash
112
- cd ~/Projects/vault && bash ~/Projects/session-orchestrator/skills/daily/generate.sh
113
- ```
114
-
115
- ## Template Placeholders
116
-
117
- | Placeholder | Example | Format |
118
- | ------------- | ------------------ | ---------------------------------------------------------- |
119
- | `{{date}}` | `2026-04-13` | ISO 8601 date (`YYYY-MM-DD`), also used inside the `id` |
120
- | `{{created}}` | `2026-04-13` | ISO 8601 date (`YYYY-MM-DD`) — matches `isoDateRegex` |
121
- | `{{updated}}` | `2026-04-13` | ISO 8601 date (`YYYY-MM-DD`) — matches `isoDateRegex` |
122
- | `{{title}}` | `Daily 2026-04-13` | Human-readable heading, `Daily YYYY-MM-DD` |
123
- | `{{weekday}}` | `Montag` | Full German weekday name (lookup table keyed on `date +%u`) |
124
-
125
- Note: `{{id}}` is **not** a separate placeholder — the template inlines
126
- `id: daily-{{date}}` so there is only one date substitution. This keeps
127
- template rendering to a single `sed` pass and prevents drift between `id`
128
- and filename.
129
-
130
- The German weekday is computed via a hardcoded lookup (1=Montag,
131
- 2=Dienstag, ..., 7=Sonntag) rather than `LC_TIME=de_DE.UTF-8 date +%A`
132
- because not every macOS install has the `de_DE.UTF-8` locale compiled.
133
-
134
- ## Integration with vault-sync
135
-
136
- The template **must** stay in sync with `vaultFrontmatterSchema`. The canonical
137
- schema lives at:
138
-
139
- ```
140
- ~/Projects/projects-baseline/packages/zod-schemas/src/vault-frontmatter.ts
141
- ```
142
-
143
- Required fields produced by the template: `id`, `type`, `created`, `updated`.
144
- Optional-but-useful fields: `title`, `tags`, `status`. The `type` is hardcoded
145
- to `daily` (one of the valid values in `vaultNoteTypeSchema`). The `id` is
146
- `daily-YYYY-MM-DD` which is kebab-case and 16 chars — passes
147
- `slugRegex.min(2).max(128)`.
148
-
149
- The BATS suite runs the vault-sync validator end-to-end (`bats tests/daily.bats`
150
- → test 8), so any drift between the template and the schema breaks the build
151
- of this skill, not of the vault that consumes it.
152
-
153
- ## Idempotency Guarantee
154
-
155
- Running `generate.sh` twice on the same day is a no-op when the existing
156
- file is valid:
157
-
158
- 1. The first run creates `$VAULT_DIR/03-daily/YYYY-MM-DD.md`.
159
- 2. The second run finds the file, confirms it is non-empty and starts with
160
- `---\n` (valid YAML frontmatter opener), prints
161
- `Daily note already exists: <path>`, and exits 0.
162
-
163
- If the existing file is 0 bytes or lacks the `---\n` opener (e.g. a previous
164
- run crashed between the `$TARGET.tmp` write and the `mv`), the corrupt file
165
- is removed and the note is re-created cleanly.
166
-
167
- The file is **never** re-rendered when intact. This matters because the user
168
- edits the daily note throughout the day (ticking checkboxes, filling in the
169
- Scratch section, etc.) and re-invoking `/daily` from anywhere — a later
170
- session, a different tool, a keybind — must not destroy that work.
171
-
172
- Verified by `tests/daily.bats` test 5: hash-compares the file before and after
173
- a second `generate.sh` invocation.
174
-
175
- ## Anti-Patterns
176
-
177
- - **DO NOT overwrite existing daily notes.** Re-running `/daily` is routine;
178
- losing the day's scratch notes is catastrophic. The idempotency check is
179
- load-bearing.
180
- - **DO NOT hardcode the vault path.** `VAULT_DIR` is the contract. Hardcoding
181
- `~/Projects/vault` breaks tests, breaks any future multi-vault setup, and
182
- couples this skill to one user's machine.
183
- - **DO NOT skip the post-write validation step.** If the BATS suite stops
184
- running the vault-sync validator, template drift will quietly ship invalid
185
- frontmatter into the vault and only be caught at the next session-end gate.
186
- - **DO NOT use `LC_TIME` for the weekday.** The locale is not guaranteed to
187
- exist. Use the hardcoded lookup table.
188
- - **DO NOT add `sed`-unsafe characters to the template.** The placeholders use
189
- `|` as the sed delimiter; if you add a `|` to any substituted value, sed
190
- will break. Keep substitutions plain.
191
-
192
- ## Exit codes
193
-
194
- | Code | Meaning |
195
- |------|---------|
196
- | 0 | Success (created) or idempotent skip (already exists and valid) |
197
- | 1 | Unexpected runtime failure (`set -e` caught an unhandled error) |
198
- | 2 | Infra error: template file not found at `$SCRIPT_DIR/templates/daily.md.tpl` |
199
- | 3 | Config error: `VAULT_DIR` does not exist as a directory |
200
- | 4 | Vault structure error: `$VAULT_DIR/03-daily/` directory is missing |
201
-
202
- ## Files
203
-
204
- - `SKILL.md` — this file.
205
- - `generate.sh` — the POSIX bash implementation of the algorithm above.
206
- - `templates/daily.md.tpl` — the daily-note template with `{{placeholder}}`
207
- markers.
208
- - `tests/daily.bats` — 8 BATS test cases covering creation, substitution,
209
- idempotency, missing-dir errors, and end-to-end schema validation via
210
- vault-sync.
211
-
212
- ## Testing
213
-
214
- From the skill directory:
215
-
216
- ```bash
217
- bats tests/daily.bats
218
- ```
219
-
220
- Expected: `8/8 passing`. Test 8 runs the vault-sync validator over a fixture
221
- vault that contains only the freshly-generated daily note, proving end-to-end
222
- schema compliance.
@@ -1,92 +0,0 @@
1
- #!/usr/bin/env bash
2
- # generate.sh — Create today's daily note in the Meta-Vault.
3
- #
4
- # Usage:
5
- # bash generate.sh
6
- # VAULT_DIR=/path/to/vault bash generate.sh
7
- #
8
- # Behavior:
9
- # - Resolves VAULT_DIR from env, else $PWD. Must contain 03-daily/.
10
- # - Computes today's date via `date +%Y-%m-%d` (Europe/Vienna via system TZ).
11
- # - Target path: $VAULT_DIR/03-daily/YYYY-MM-DD.md
12
- # - If target exists → idempotent no-op (exit 0).
13
- # - Otherwise substitutes placeholders into templates/daily.md.tpl and writes.
14
- #
15
- # Exit codes:
16
- # 0 — created OR already-exists (idempotent)
17
- # 1 — unexpected runtime failure (set -e)
18
- # 2 — infra error: template file missing
19
- # 3 — config error: VAULT_DIR does not exist
20
- # 4 — vault structure error: 03-daily/ missing
21
-
22
- set -euo pipefail
23
-
24
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25
- TEMPLATE="${SCRIPT_DIR}/templates/daily.md.tpl"
26
-
27
- # ── Resolve VAULT_DIR ──────────────────────────────────────────────────────
28
- : "${VAULT_DIR:=$PWD}"
29
-
30
- if [[ ! -f "$TEMPLATE" ]]; then
31
- echo "error: template not found: $TEMPLATE" >&2
32
- exit 2
33
- fi
34
-
35
- if [[ ! -d "$VAULT_DIR" ]]; then
36
- echo "error: VAULT_DIR does not exist: $VAULT_DIR" >&2
37
- exit 3
38
- fi
39
-
40
- DAILY_DIR="$VAULT_DIR/03-daily"
41
- if [[ ! -d "$DAILY_DIR" ]]; then
42
- echo "error: 03-daily/ not found in vault: $DAILY_DIR" >&2
43
- echo "hint: run this skill from inside the Meta-Vault, or set VAULT_DIR." >&2
44
- exit 4
45
- fi
46
-
47
- # ── Compute date / weekday ─────────────────────────────────────────────────
48
- DATE="$(date +%Y-%m-%d)"
49
- DOW="$(date +%u)" # 1=Mon .. 7=Sun
50
-
51
- # Hardcoded German weekday lookup (locale-independent for reliability).
52
- case "$DOW" in
53
- 1) WEEKDAY="Montag" ;;
54
- 2) WEEKDAY="Dienstag" ;;
55
- 3) WEEKDAY="Mittwoch" ;;
56
- 4) WEEKDAY="Donnerstag" ;;
57
- 5) WEEKDAY="Freitag" ;;
58
- 6) WEEKDAY="Samstag" ;;
59
- 7) WEEKDAY="Sonntag" ;;
60
- *) WEEKDAY="Unknown" ;;
61
- esac
62
-
63
- TARGET="$DAILY_DIR/${DATE}.md"
64
-
65
- # ── Idempotency check ──────────────────────────────────────────────────────
66
- if [[ -f "$TARGET" ]]; then
67
- # corrupt file guard: 0-byte or missing YAML frontmatter opener → re-create
68
- if [[ ! -s "$TARGET" ]] || [[ "$(head -c 3 "$TARGET")" != "---" ]]; then
69
- rm -f "$TARGET"
70
- else
71
- echo "Daily note already exists: $TARGET"
72
- exit 0
73
- fi
74
- fi
75
-
76
- # ── Render template ────────────────────────────────────────────────────────
77
- TITLE="Daily ${DATE}"
78
-
79
- # sed substitution — placeholders are {{name}}, no shell interpolation in the
80
- # template, so this is safe with simple replacement.
81
- sed \
82
- -e "s|{{date}}|${DATE}|g" \
83
- -e "s|{{created}}|${DATE}|g" \
84
- -e "s|{{updated}}|${DATE}|g" \
85
- -e "s|{{title}}|${TITLE}|g" \
86
- -e "s|{{weekday}}|${WEEKDAY}|g" \
87
- "$TEMPLATE" > "$TARGET.tmp"
88
-
89
- mv "$TARGET.tmp" "$TARGET"
90
-
91
- echo "Created daily note: $TARGET"
92
- exit 0
@@ -1,36 +0,0 @@
1
- ---
2
- id: daily-{{date}}
3
- type: daily
4
- title: {{title}}
5
- created: {{created}}
6
- updated: {{updated}}
7
- tags:
8
- - daily
9
- status: draft
10
- ---
11
-
12
- # {{title}} ({{weekday}})
13
-
14
- ## Energie & Fokus
15
-
16
- - [ ]
17
-
18
- ## Termine
19
-
20
- -
21
-
22
- ## Done heute
23
-
24
- -
25
-
26
- ## Scratch
27
-
28
- -
29
-
30
- ## Offen für morgen
31
-
32
- -
33
-
34
- ## Links
35
-
36
- - [[_MOC]]