crewly 1.8.9 → 1.8.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/config/constants.d.ts.map +1 -0
  2. package/config/index.d.ts.map +1 -0
  3. package/config/roles/_common/memory-instructions.md +6 -5
  4. package/config/roles/_common/wiki-instructions.md +49 -0
  5. package/config/roles/architect/prompt.md +2 -2
  6. package/config/roles/backend-developer/prompt.md +2 -2
  7. package/config/roles/designer/prompt.md +2 -2
  8. package/config/roles/developer/prompt.md +2 -2
  9. package/config/roles/frontend-developer/prompt.md +2 -2
  10. package/config/roles/fullstack-dev/prompt.md +2 -2
  11. package/config/roles/generalist/prompt.md +2 -2
  12. package/config/roles/ops/prompt.md +2 -2
  13. package/config/roles/orchestrator/prompt.md +135 -11
  14. package/config/roles/product-manager/prompt.md +2 -2
  15. package/config/roles/qa/prompt.md +2 -2
  16. package/config/roles/qa-engineer/prompt.md +2 -2
  17. package/config/roles/researcher/prompt.md +15 -6
  18. package/config/roles/sales/prompt.md +2 -2
  19. package/config/roles/support/prompt.md +2 -2
  20. package/config/roles/team-leader/prompt.md +17 -2
  21. package/config/roles/tpm/prompt.md +2 -2
  22. package/config/roles/ux-designer/prompt.md +2 -2
  23. package/config/skills/orchestrator/wiki-cleanup/SKILL.md +89 -0
  24. package/config/skills/orchestrator/wiki-cleanup/execute.sh +139 -0
  25. package/config/skills/orchestrator/wiki-lint/SKILL.md +75 -0
  26. package/config/skills/orchestrator/wiki-lint/execute.sh +66 -0
  27. package/config/skills/orchestrator/wiki-migrate/SKILL.md +103 -0
  28. package/config/skills/orchestrator/wiki-migrate/execute.sh +82 -0
  29. package/config/skills/orchestrator/wiki-process-queue/SKILL.md +9 -1
  30. package/dist/backend/backend/src/controllers/task-management/task-management.controller.d.ts +169 -0
  31. package/dist/backend/backend/src/controllers/task-management/task-management.controller.d.ts.map +1 -0
  32. package/dist/backend/backend/src/controllers/task-management/task-management.controller.js +1779 -0
  33. package/dist/backend/backend/src/controllers/task-management/task-management.controller.js.map +1 -0
  34. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.d.ts +18 -0
  35. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.d.ts.map +1 -1
  36. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.js +63 -0
  37. package/dist/backend/backend/src/controllers/task-pool/task-pool.controller.js.map +1 -1
  38. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.d.ts.map +1 -1
  39. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.js +5 -1
  40. package/dist/backend/backend/src/controllers/task-pool/task-pool.routes.js.map +1 -1
  41. package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts +109 -0
  42. package/dist/backend/backend/src/controllers/wiki/wiki.controller.d.ts.map +1 -1
  43. package/dist/backend/backend/src/controllers/wiki/wiki.controller.js +419 -4
  44. package/dist/backend/backend/src/controllers/wiki/wiki.controller.js.map +1 -1
  45. package/dist/backend/backend/src/controllers/wiki/wiki.routes.d.ts.map +1 -1
  46. package/dist/backend/backend/src/controllers/wiki/wiki.routes.js +11 -1
  47. package/dist/backend/backend/src/controllers/wiki/wiki.routes.js.map +1 -1
  48. package/dist/backend/backend/src/index.d.ts.map +1 -1
  49. package/dist/backend/backend/src/index.js +78 -3
  50. package/dist/backend/backend/src/index.js.map +1 -1
  51. package/dist/backend/backend/src/index.js.orc-bak-20260529 +3130 -0
  52. package/dist/backend/backend/src/services/agent/crewly-agent/agent-runner.service.d.ts +513 -0
  53. package/dist/backend/backend/src/services/agent/crewly-agent/agent-runner.service.d.ts.map +1 -0
  54. package/dist/backend/backend/src/services/agent/crewly-agent/agent-runner.service.js +1568 -0
  55. package/dist/backend/backend/src/services/agent/crewly-agent/agent-runner.service.js.map +1 -0
  56. package/dist/backend/backend/src/services/agent/crewly-agent/agent-worker.d.ts +86 -0
  57. package/dist/backend/backend/src/services/agent/crewly-agent/agent-worker.d.ts.map +1 -0
  58. package/dist/backend/backend/src/services/agent/crewly-agent/agent-worker.js +147 -0
  59. package/dist/backend/backend/src/services/agent/crewly-agent/agent-worker.js.map +1 -0
  60. package/dist/backend/backend/src/services/agent/crewly-agent/api-client.d.ts +68 -0
  61. package/dist/backend/backend/src/services/agent/crewly-agent/api-client.d.ts.map +1 -0
  62. package/dist/backend/backend/src/services/agent/crewly-agent/api-client.js +131 -0
  63. package/dist/backend/backend/src/services/agent/crewly-agent/api-client.js.map +1 -0
  64. package/dist/backend/backend/src/services/agent/crewly-agent/audit-log.service.d.ts +130 -0
  65. package/dist/backend/backend/src/services/agent/crewly-agent/audit-log.service.d.ts.map +1 -0
  66. package/dist/backend/backend/src/services/agent/crewly-agent/audit-log.service.js +263 -0
  67. package/dist/backend/backend/src/services/agent/crewly-agent/audit-log.service.js.map +1 -0
  68. package/dist/backend/backend/src/services/agent/crewly-agent/audit-trail.service.d.ts +74 -0
  69. package/dist/backend/backend/src/services/agent/crewly-agent/audit-trail.service.d.ts.map +1 -0
  70. package/dist/backend/backend/src/services/agent/crewly-agent/audit-trail.service.js +140 -0
  71. package/dist/backend/backend/src/services/agent/crewly-agent/audit-trail.service.js.map +1 -0
  72. package/dist/backend/backend/src/services/agent/crewly-agent/auditor-tools.d.ts +29 -0
  73. package/dist/backend/backend/src/services/agent/crewly-agent/auditor-tools.d.ts.map +1 -0
  74. package/dist/backend/backend/src/services/agent/crewly-agent/auditor-tools.js +279 -0
  75. package/dist/backend/backend/src/services/agent/crewly-agent/auditor-tools.js.map +1 -0
  76. package/dist/backend/backend/src/services/agent/crewly-agent/crewly-agent-runtime.service.d.ts +340 -0
  77. package/dist/backend/backend/src/services/agent/crewly-agent/crewly-agent-runtime.service.d.ts.map +1 -0
  78. package/dist/backend/backend/src/services/agent/crewly-agent/crewly-agent-runtime.service.js +1176 -0
  79. package/dist/backend/backend/src/services/agent/crewly-agent/crewly-agent-runtime.service.js.map +1 -0
  80. package/dist/backend/backend/src/services/agent/crewly-agent/deepseek-sse-transform.d.ts +79 -0
  81. package/dist/backend/backend/src/services/agent/crewly-agent/deepseek-sse-transform.d.ts.map +1 -0
  82. package/dist/backend/backend/src/services/agent/crewly-agent/deepseek-sse-transform.js +145 -0
  83. package/dist/backend/backend/src/services/agent/crewly-agent/deepseek-sse-transform.js.map +1 -0
  84. package/dist/backend/backend/src/services/agent/crewly-agent/env-isolation.service.d.ts +79 -0
  85. package/dist/backend/backend/src/services/agent/crewly-agent/env-isolation.service.d.ts.map +1 -0
  86. package/dist/backend/backend/src/services/agent/crewly-agent/env-isolation.service.js +218 -0
  87. package/dist/backend/backend/src/services/agent/crewly-agent/env-isolation.service.js.map +1 -0
  88. package/dist/backend/backend/src/services/agent/crewly-agent/index.d.ts +16 -0
  89. package/dist/backend/backend/src/services/agent/crewly-agent/index.d.ts.map +1 -0
  90. package/dist/backend/backend/src/services/agent/crewly-agent/index.js +16 -0
  91. package/dist/backend/backend/src/services/agent/crewly-agent/index.js.map +1 -0
  92. package/dist/backend/backend/src/services/agent/crewly-agent/mcp-tool-bridge.d.ts +135 -0
  93. package/dist/backend/backend/src/services/agent/crewly-agent/mcp-tool-bridge.d.ts.map +1 -0
  94. package/dist/backend/backend/src/services/agent/crewly-agent/mcp-tool-bridge.js +185 -0
  95. package/dist/backend/backend/src/services/agent/crewly-agent/mcp-tool-bridge.js.map +1 -0
  96. package/dist/backend/backend/src/services/agent/crewly-agent/model-manager.d.ts +141 -0
  97. package/dist/backend/backend/src/services/agent/crewly-agent/model-manager.d.ts.map +1 -0
  98. package/dist/backend/backend/src/services/agent/crewly-agent/model-manager.js +310 -0
  99. package/dist/backend/backend/src/services/agent/crewly-agent/model-manager.js.map +1 -0
  100. package/dist/backend/backend/src/services/agent/crewly-agent/output-filter.service.d.ts +91 -0
  101. package/dist/backend/backend/src/services/agent/crewly-agent/output-filter.service.d.ts.map +1 -0
  102. package/dist/backend/backend/src/services/agent/crewly-agent/output-filter.service.js +143 -0
  103. package/dist/backend/backend/src/services/agent/crewly-agent/output-filter.service.js.map +1 -0
  104. package/dist/backend/backend/src/services/agent/crewly-agent/prompt-guard.service.d.ts +103 -0
  105. package/dist/backend/backend/src/services/agent/crewly-agent/prompt-guard.service.d.ts.map +1 -0
  106. package/dist/backend/backend/src/services/agent/crewly-agent/prompt-guard.service.js +256 -0
  107. package/dist/backend/backend/src/services/agent/crewly-agent/prompt-guard.service.js.map +1 -0
  108. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.d.ts +143 -0
  109. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.d.ts.map +1 -0
  110. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.js +264 -0
  111. package/dist/backend/backend/src/services/agent/crewly-agent/rate-limiter.js.map +1 -0
  112. package/dist/backend/backend/src/services/agent/crewly-agent/smoke-test.d.ts +13 -0
  113. package/dist/backend/backend/src/services/agent/crewly-agent/smoke-test.d.ts.map +1 -0
  114. package/dist/backend/backend/src/services/agent/crewly-agent/smoke-test.js +91 -0
  115. package/dist/backend/backend/src/services/agent/crewly-agent/smoke-test.js.map +1 -0
  116. package/dist/backend/backend/src/services/agent/crewly-agent/tool-registry.d.ts +135 -0
  117. package/dist/backend/backend/src/services/agent/crewly-agent/tool-registry.d.ts.map +1 -0
  118. package/dist/backend/backend/src/services/agent/crewly-agent/tool-registry.js +1937 -0
  119. package/dist/backend/backend/src/services/agent/crewly-agent/tool-registry.js.map +1 -0
  120. package/dist/backend/backend/src/services/ai/prompt-builder.service.js +1 -1
  121. package/dist/backend/backend/src/services/autonomous/auto-assign.service.d.ts +429 -0
  122. package/dist/backend/backend/src/services/autonomous/auto-assign.service.d.ts.map +1 -0
  123. package/dist/backend/backend/src/services/autonomous/auto-assign.service.js +852 -0
  124. package/dist/backend/backend/src/services/autonomous/auto-assign.service.js.map +1 -0
  125. package/dist/backend/backend/src/services/project/task-tracking.service.d.ts +171 -0
  126. package/dist/backend/backend/src/services/project/task-tracking.service.d.ts.map +1 -0
  127. package/dist/backend/backend/src/services/project/task-tracking.service.js +725 -0
  128. package/dist/backend/backend/src/services/project/task-tracking.service.js.map +1 -0
  129. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.d.ts.map +1 -1
  130. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.js +50 -0
  131. package/dist/backend/backend/src/services/reconciler/reconciler-data-provider.js.map +1 -1
  132. package/dist/backend/backend/src/services/task-pool/task-pool.service.d.ts +19 -0
  133. package/dist/backend/backend/src/services/task-pool/task-pool.service.d.ts.map +1 -1
  134. package/dist/backend/backend/src/services/task-pool/task-pool.service.js +45 -0
  135. package/dist/backend/backend/src/services/task-pool/task-pool.service.js.map +1 -1
  136. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.d.ts.map +1 -1
  137. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.js +34 -1
  138. package/dist/backend/backend/src/services/v3/agent-auto-claim.service.js.map +1 -1
  139. package/dist/backend/backend/src/services/v3/project-task-watcher.service.d.ts +118 -0
  140. package/dist/backend/backend/src/services/v3/project-task-watcher.service.d.ts.map +1 -0
  141. package/dist/backend/backend/src/services/v3/project-task-watcher.service.js +326 -0
  142. package/dist/backend/backend/src/services/v3/project-task-watcher.service.js.map +1 -0
  143. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.d.ts +72 -0
  144. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.d.ts.map +1 -0
  145. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.js +186 -0
  146. package/dist/backend/backend/src/services/wiki/wiki-backlinks.service.js.map +1 -0
  147. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts +27 -4
  148. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.d.ts.map +1 -1
  149. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js +133 -10
  150. package/dist/backend/backend/src/services/wiki/wiki-bookkeep-trigger.service.js.map +1 -1
  151. package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.d.ts +18 -1
  152. package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.d.ts.map +1 -1
  153. package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.js +15 -4
  154. package/dist/backend/backend/src/services/wiki/wiki-bookkeep.service.js.map +1 -1
  155. package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.d.ts +74 -0
  156. package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.d.ts.map +1 -0
  157. package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.js +154 -0
  158. package/dist/backend/backend/src/services/wiki/wiki-chat-subscriber.service.js.map +1 -0
  159. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.d.ts +160 -0
  160. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.d.ts.map +1 -0
  161. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.js +399 -0
  162. package/dist/backend/backend/src/services/wiki/wiki-cleanup.service.js.map +1 -0
  163. package/dist/backend/backend/src/services/wiki/wiki-lint.service.d.ts +182 -0
  164. package/dist/backend/backend/src/services/wiki/wiki-lint.service.d.ts.map +1 -0
  165. package/dist/backend/backend/src/services/wiki/wiki-lint.service.js +505 -0
  166. package/dist/backend/backend/src/services/wiki/wiki-lint.service.js.map +1 -0
  167. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.d.ts +232 -0
  168. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.d.ts.map +1 -0
  169. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.js +1416 -0
  170. package/dist/backend/backend/src/services/wiki/wiki-migrate.service.js.map +1 -0
  171. package/dist/backend/backend/src/services/wiki/wiki-recent.service.d.ts +51 -0
  172. package/dist/backend/backend/src/services/wiki/wiki-recent.service.d.ts.map +1 -0
  173. package/dist/backend/backend/src/services/wiki/wiki-recent.service.js +102 -0
  174. package/dist/backend/backend/src/services/wiki/wiki-recent.service.js.map +1 -0
  175. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.d.ts +104 -0
  176. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.d.ts.map +1 -0
  177. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.js +229 -0
  178. package/dist/backend/backend/src/services/wiki/wiki-reflect-trigger.service.js.map +1 -0
  179. package/dist/backend/backend/src/services/wiki/wiki-search.service.d.ts +90 -0
  180. package/dist/backend/backend/src/services/wiki/wiki-search.service.d.ts.map +1 -0
  181. package/dist/backend/backend/src/services/wiki/wiki-search.service.js +190 -0
  182. package/dist/backend/backend/src/services/wiki/wiki-search.service.js.map +1 -0
  183. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.d.ts +164 -0
  184. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.d.ts.map +1 -0
  185. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.js +675 -0
  186. package/dist/backend/backend/src/services/wiki/wiki-workitem-bridge.service.js.map +1 -0
  187. package/dist/backend/backend/src/services/workflow/cron-task.service.d.ts.map +1 -1
  188. package/dist/backend/backend/src/services/workflow/cron-task.service.js +65 -0
  189. package/dist/backend/backend/src/services/workflow/cron-task.service.js.map +1 -1
  190. package/dist/backend/backend/src/types/auto-assign.types.d.ts +271 -0
  191. package/dist/backend/backend/src/types/auto-assign.types.d.ts.map +1 -0
  192. package/dist/backend/backend/src/types/auto-assign.types.js +136 -0
  193. package/dist/backend/backend/src/types/auto-assign.types.js.map +1 -0
  194. package/dist/backend/backend/src/types/cron-task.types.d.ts +16 -1
  195. package/dist/backend/backend/src/types/cron-task.types.d.ts.map +1 -1
  196. package/dist/backend/backend/src/utils/esm-require.utils.d.ts +111 -0
  197. package/dist/backend/backend/src/utils/esm-require.utils.d.ts.map +1 -0
  198. package/dist/backend/backend/src/utils/esm-require.utils.js +124 -0
  199. package/dist/backend/backend/src/utils/esm-require.utils.js.map +1 -0
  200. package/dist/cli/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts +220 -0
  201. package/dist/cli/backend/src/services/ai/prompt-modules/prompt-module.interface.d.ts.map +1 -0
  202. package/dist/cli/backend/src/services/ai/prompt-modules/prompt-module.interface.js +37 -0
  203. package/dist/cli/backend/src/services/ai/prompt-modules/prompt-module.interface.js.map +1 -0
  204. package/dist/cli/backend/src/services/knowledge/fts5-search-strategy.d.ts +56 -0
  205. package/dist/cli/backend/src/services/knowledge/fts5-search-strategy.d.ts.map +1 -0
  206. package/dist/cli/backend/src/services/knowledge/fts5-search-strategy.js +91 -0
  207. package/dist/cli/backend/src/services/knowledge/fts5-search-strategy.js.map +1 -0
  208. package/dist/cli/backend/src/services/knowledge/learnings-index.service.d.ts +159 -0
  209. package/dist/cli/backend/src/services/knowledge/learnings-index.service.d.ts.map +1 -0
  210. package/dist/cli/backend/src/services/knowledge/learnings-index.service.js +304 -0
  211. package/dist/cli/backend/src/services/knowledge/learnings-index.service.js.map +1 -0
  212. package/dist/cli/backend/src/services/knowledge/wiki-compiler.service.d.ts +115 -0
  213. package/dist/cli/backend/src/services/knowledge/wiki-compiler.service.d.ts.map +1 -0
  214. package/dist/cli/backend/src/services/knowledge/wiki-compiler.service.js +215 -0
  215. package/dist/cli/backend/src/services/knowledge/wiki-compiler.service.js.map +1 -0
  216. package/dist/cli/backend/src/services/memory/embedding-provider.d.ts +78 -0
  217. package/dist/cli/backend/src/services/memory/embedding-provider.d.ts.map +1 -0
  218. package/dist/cli/backend/src/services/memory/embedding-provider.js +179 -0
  219. package/dist/cli/backend/src/services/memory/embedding-provider.js.map +1 -0
  220. package/dist/cli/backend/src/services/memory/vector-store.service.d.ts +331 -0
  221. package/dist/cli/backend/src/services/memory/vector-store.service.d.ts.map +1 -0
  222. package/dist/cli/backend/src/services/memory/vector-store.service.js +814 -0
  223. package/dist/cli/backend/src/services/memory/vector-store.service.js.map +1 -0
  224. package/dist/cli/backend/src/services/project/task-tracking.service.d.ts +171 -0
  225. package/dist/cli/backend/src/services/project/task-tracking.service.d.ts.map +1 -0
  226. package/dist/cli/backend/src/services/project/task-tracking.service.js +725 -0
  227. package/dist/cli/backend/src/services/project/task-tracking.service.js.map +1 -0
  228. package/dist/cli/backend/src/services/task-pool/task-pool.service.d.ts +19 -0
  229. package/dist/cli/backend/src/services/task-pool/task-pool.service.d.ts.map +1 -1
  230. package/dist/cli/backend/src/services/task-pool/task-pool.service.js +45 -0
  231. package/dist/cli/backend/src/services/task-pool/task-pool.service.js.map +1 -1
  232. package/dist/cli/backend/src/types/auto-assign.types.d.ts +271 -0
  233. package/dist/cli/backend/src/types/auto-assign.types.d.ts.map +1 -0
  234. package/dist/cli/backend/src/types/auto-assign.types.js +136 -0
  235. package/dist/cli/backend/src/types/auto-assign.types.js.map +1 -0
  236. package/dist/cli/cli/src/index.js +0 -0
  237. package/frontend/dist/assets/{index-db3f5041.css → index-068bb4f6.css} +10 -1
  238. package/frontend/dist/assets/index-c24ceb15.js +4960 -0
  239. package/frontend/dist/index.html +2 -2
  240. package/package.json +1 -1
  241. package/config/skills/agent/core/query-knowledge/SKILL.md +0 -87
  242. package/config/skills/agent/core/query-knowledge/execute.sh +0 -30
  243. package/config/skills/orchestrator/query-knowledge/SKILL.md +0 -75
  244. package/config/skills/orchestrator/query-knowledge/execute.sh +0 -30
  245. package/frontend/dist/assets/index-cc115bb4.js +0 -4926
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: Wiki Cleanup
3
+ description: Detect + remove low-quality pages from a wiki vault (low confidence, agent memory dumps, per-agent overflow). Default dry-run; archives every deletion; idempotent.
4
+ version: 1.0.0
5
+ category: knowledge
6
+ skillType: claude-skill
7
+ assignableRoles:
8
+ - orchestrator
9
+ - team-leader
10
+ ---
11
+
12
+ # Wiki Cleanup
13
+
14
+ Removes low-quality pages from a wiki vault. Origin: the 2026-05-27 migrate pass dumped every agent's `memory.json roleKnowledge[]` entries as their own wiki page (~3,277 pages across 6 project vaults). Many are stream-of-consciousness daily memory rather than team-level patterns. This skill identifies + deletes them safely.
15
+
16
+ ## Two modes
17
+
18
+ ### scan (default) — dry-run
19
+
20
+ Walks `<vault>/llm-curated/**/*.md`, parses each page's frontmatter, and returns the list of pages flagged by at least one cleanup rule. **No filesystem mutation.** Use this to eyeball what would be deleted before running apply.
21
+
22
+ ```bash
23
+ bash execute.sh --vault /Users/me/proj/.crewly/wiki
24
+ bash execute.sh --vault /Users/me/proj/.crewly/wiki --min-confidence 0.4
25
+ bash execute.sh --vault /Users/me/proj/.crewly/wiki --max-per-agent 20
26
+ ```
27
+
28
+ Output:
29
+ ```json
30
+ {
31
+ "candidates": [
32
+ { "relPath": "llm-curated/patterns/x.md", "reasons": ["confidence 0.3 < 0.5"], ... }
33
+ ],
34
+ "scannedCount": 526,
35
+ "summary": { "lowConfidence": 412, "agentMemoryDump": 380, "perAgentCapped": 18 },
36
+ "truncated": false
37
+ }
38
+ ```
39
+
40
+ ### apply — execute deletes
41
+
42
+ Deletes the explicit `--pages` list and archives each page's body + frontmatter to `<vault>/.wiki-cleanup-archive.json`. The migrate manifest (`.migration-state.json`) is **deliberately left intact** so that `wiki-migrate --apply` sees "already migrated" for the cleaned-up `sourceId`s and skips re-import. Touching the manifest would break that idempotence and the page would resurrect on the next bridge tick (the 2026-05-28 cleanup-then-migrate-resurrection bug).
43
+
44
+ ```bash
45
+ bash execute.sh --vault /Users/me/proj/.crewly/wiki \
46
+ --apply \
47
+ --pages "llm-curated/patterns/a.md,llm-curated/patterns/b.md"
48
+ ```
49
+
50
+ Output:
51
+ ```json
52
+ {
53
+ "deleted": ["llm-curated/patterns/a.md", "llm-curated/patterns/b.md"],
54
+ "skipped": [],
55
+ "archivePath": "/Users/me/proj/.crewly/wiki/.wiki-cleanup-archive.json",
56
+ "manifestEntriesInvalidated": 2
57
+ }
58
+ ```
59
+
60
+ ## Scan rules
61
+
62
+ | Rule | Default | Disables via | What it catches |
63
+ |---|---|---|---|
64
+ | `--min-confidence FLOAT` | `0.5` | `--min-confidence 0` | Pages with frontmatter `confidence < threshold`. Migrate sets this when the classifier was uncertain — usually correlates with low-quality content. |
65
+ | (drop agent memory dumps) | ON | `--no-drop-agent-memory` | Pages with `migrated_from: "agent/<id>/memory.json"`. These are verbatim daily-memory dumps, NOT team-level patterns. |
66
+ | `--max-per-agent INT` | `0` (off) | omit flag | Keeps top-N pages per `original_author` (by confidence desc, original_date desc). Useful for taming pathological cases where one agent dumped 100+ entries. |
67
+
68
+ A page is a candidate if it matches **any** rule (union, not intersection). The per-agent cap only considers pages NOT already flagged by other rules — so a low-confidence page doesn't "use up" a cap slot.
69
+
70
+ ## Safety guarantees
71
+
72
+ - **Default dry-run.** Without `--apply`, nothing is written.
73
+ - **Archive before delete.** Every deleted page's body + frontmatter is appended to `.wiki-cleanup-archive.json` BEFORE the file is removed. Rollback = "paste body back into the path from the archive."
74
+ - **Migrate manifest is preserved.** Cleanup deletes the file on disk but never touches `.migration-state.json` — the manifest is what makes `wiki-migrate --apply` idempotent. Future migrate runs see the matching `sourceId` + content hash and skip re-import. Page stays deleted.
75
+ - **Frozen folders are protected.** `memory/`, `sop/`, `sop-overrides/`, `okr/` are NEVER scanned and NEVER deleted (even if the caller passes a frozen-folder path to `--pages`, apply skips it with `reason: 'frozen'`).
76
+ - **Path-traversal guard.** Any `--pages` entry that resolves outside the vault (`../../etc/passwd` etc) is skipped with `reason: 'outside_vault'`.
77
+ - **Idempotent.** A `--apply` re-run on the same `--pages` list with already-deleted entries is a no-op (each missing file → `reason: 'not_found'`).
78
+ - **Legacy source files are NEVER touched.** `~/.crewly/agents/*/memory.json` and `<project>/.crewly/knowledge/*` stay as-is. Cleanup only removes wiki pages.
79
+
80
+ ## When to invoke
81
+
82
+ - **Operator one-shot**: you notice `<project>/.crewly/wiki/llm-curated/patterns/` has 500+ entries. Run `scan` to see candidates, then `apply` with the page list you actually want gone.
83
+ - **Bridge-auto**: starting 2026-05-28 the `WikiWorkItemBridge` periodically scans every vault and creates `wiki_quality_cleanup` WorkItems with a chunked candidate list. The agent claims the WI, reads the brief, and calls `--apply` with the explicit list of pages it decided to delete. See your prompt's "Bridge-auto WorkItems — DO NOT bulk-delete" rule.
84
+
85
+ ## Failure modes
86
+
87
+ - `400 invalid_input` — `vaultPath` missing or `pages` empty on apply.
88
+ - `404 vault_missing` — `vaultPath` does not exist on disk.
89
+ - `400 confirm_required` — apply was POSTed without `confirm: true` (the skill always sets this; see the underlying HTTP route for raw clients).
@@ -0,0 +1,139 @@
1
+ #!/bin/bash
2
+ # wiki-cleanup — detect + remove low-quality pages from a wiki vault.
3
+ #
4
+ # Two modes:
5
+ # scan (default) — dry-run. Returns the list of cleanup candidates
6
+ # with their reasons (low confidence / agent
7
+ # memory dump / per-agent cap). No filesystem writes.
8
+ # apply — delete the listed pages, archive each body +
9
+ # frontmatter to <vault>/.wiki-cleanup-archive.json,
10
+ # and invalidate matching migrate-manifest entries
11
+ # so the same source can't re-import the page.
12
+ #
13
+ # Safety:
14
+ # - LEGACY FILES are never touched (memory.json, .crewly/knowledge/*).
15
+ # - Frozen folders (memory/, sop/, sop-overrides/, okr/) are not scanned.
16
+ # - apply requires an explicit `--pages` list — the caller (usually an
17
+ # agent in the loop) decides which scan candidates to actually delete.
18
+ #
19
+ # Usage:
20
+ # bash execute.sh --vault /abs/vault # scan with defaults
21
+ # bash execute.sh --vault /abs/vault --min-confidence 0.4 # scan with custom rule
22
+ # bash execute.sh --vault /abs/vault --apply --pages "a.md,b.md" # delete the two listed pages
23
+ set -euo pipefail
24
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
25
+ source "${SCRIPT_DIR}/../../_common/lib.sh"
26
+
27
+ INPUT_JSON=""
28
+ VAULT=""
29
+ APPLY="false"
30
+ PAGES_CSV=""
31
+ MIN_CONFIDENCE=""
32
+ DROP_AGENT_MEMORY=""
33
+ MAX_PER_AGENT=""
34
+
35
+ if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
36
+ INPUT_JSON="$1"; shift || true
37
+ fi
38
+
39
+ while [[ $# -gt 0 ]]; do
40
+ case "$1" in
41
+ --vault|-v) VAULT="$2"; shift 2 ;;
42
+ --apply|-a) APPLY="true"; shift ;;
43
+ --pages|-p) PAGES_CSV="$2"; shift 2 ;;
44
+ --min-confidence) MIN_CONFIDENCE="$2"; shift 2 ;;
45
+ --no-drop-agent-memory)
46
+ DROP_AGENT_MEMORY="false"; shift ;;
47
+ --max-per-agent) MAX_PER_AGENT="$2"; shift 2 ;;
48
+ --json|-j) INPUT_JSON="$2"; shift 2 ;;
49
+ --help|-h)
50
+ cat <<EOF
51
+ Usage:
52
+ execute.sh --vault <abs path> # scan (dry-run)
53
+ execute.sh --vault <abs path> --min-confidence 0.4 # scan with custom threshold
54
+ execute.sh --vault <abs path> --apply --pages "X.md,Y.md" # delete listed pages
55
+
56
+ Scan rules (applied independently — any match flags the page):
57
+ --min-confidence FLOAT Pages with frontmatter confidence < FLOAT
58
+ (default 0.5).
59
+ --no-drop-agent-memory Disable the "drop pages migrated_from:
60
+ agent/<id>/memory.json" rule (default ON).
61
+ --max-per-agent INT Keep top-N (by confidence desc, date desc)
62
+ per original_author. Default 0 = disabled.
63
+
64
+ Apply:
65
+ --apply Execute deletes (requires --pages).
66
+ --pages "X.md,Y.md" Comma-separated relative paths to delete.
67
+ Each MUST be under the vault. Paths under
68
+ frozen folders (memory/, sop/, ...) are
69
+ refused even with --apply.
70
+
71
+ Outputs a JSON report:
72
+ scan: { candidates: [...], scannedCount, summary, truncated }
73
+ apply: { deleted: [...], skipped: [...], archivePath, manifestEntriesInvalidated }
74
+
75
+ Re-runs are safe — apply is idempotent (a missing file is "skipped").
76
+ EOF
77
+ exit 0 ;;
78
+ --) shift; break ;;
79
+ *)
80
+ if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then INPUT_JSON="$1"; shift
81
+ else error_exit "Unknown argument: $1"; fi ;;
82
+ esac
83
+ done
84
+
85
+ if [ -n "$INPUT_JSON" ]; then
86
+ INPUT=$(read_json_input "$INPUT_JSON")
87
+ [ -z "$VAULT" ] && VAULT=$(printf '%s' "$INPUT" | jq -r '.vaultPath // empty')
88
+ if printf '%s' "$INPUT" | jq -e '.apply == true' >/dev/null 2>&1; then APPLY="true"; fi
89
+ if [ -z "$PAGES_CSV" ]; then
90
+ JSON_PAGES=$(printf '%s' "$INPUT" | jq -r '.pages // [] | join(",")')
91
+ [ -n "$JSON_PAGES" ] && PAGES_CSV="$JSON_PAGES"
92
+ fi
93
+ if [ -z "$MIN_CONFIDENCE" ]; then
94
+ MIN_CONFIDENCE=$(printf '%s' "$INPUT" | jq -r '.rules.minConfidence // empty')
95
+ fi
96
+ if [ -z "$MAX_PER_AGENT" ]; then
97
+ MAX_PER_AGENT=$(printf '%s' "$INPUT" | jq -r '.rules.maxPerAgent // empty')
98
+ fi
99
+ fi
100
+
101
+ require_param "vaultPath (--vault)" "$VAULT"
102
+
103
+ export _WC_V="$VAULT"
104
+
105
+ if [ "$APPLY" = "true" ]; then
106
+ if [ -z "$PAGES_CSV" ]; then
107
+ error_exit "--apply requires --pages with at least one relative path"
108
+ fi
109
+ # Convert CSV → JSON array of trimmed strings.
110
+ export _WC_PAGES="$PAGES_CSV"
111
+ BODY=$(jq -n '{
112
+ vaultPath: env._WC_V,
113
+ pages: (env._WC_PAGES | split(",") | map(gsub("^\\s+|\\s+$"; ""))),
114
+ confirm: true
115
+ }')
116
+ api_call POST "/wiki/cleanup/apply" "$BODY"
117
+ unset _WC_PAGES
118
+ else
119
+ # Build rules object only with keys the user actually set.
120
+ RULES_JSON="{}"
121
+ if [ -n "$MIN_CONFIDENCE" ]; then
122
+ export _WC_MC="$MIN_CONFIDENCE"
123
+ RULES_JSON=$(printf '%s' "$RULES_JSON" | jq '. + {minConfidence: (env._WC_MC | tonumber)}')
124
+ unset _WC_MC
125
+ fi
126
+ if [ "$DROP_AGENT_MEMORY" = "false" ]; then
127
+ RULES_JSON=$(printf '%s' "$RULES_JSON" | jq '. + {dropAgentMemoryDumps: false}')
128
+ fi
129
+ if [ -n "$MAX_PER_AGENT" ]; then
130
+ export _WC_MPA="$MAX_PER_AGENT"
131
+ RULES_JSON=$(printf '%s' "$RULES_JSON" | jq '. + {maxPerAgent: (env._WC_MPA | tonumber)}')
132
+ unset _WC_MPA
133
+ fi
134
+ export _WC_RULES="$RULES_JSON"
135
+ BODY=$(jq -n '{vaultPath: env._WC_V, rules: (env._WC_RULES | fromjson)}')
136
+ api_call POST "/wiki/cleanup/scan" "$BODY"
137
+ unset _WC_RULES
138
+ fi
139
+ unset _WC_V
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: Wiki Lint
3
+ description: Deterministic vault validation — frozen-path violations, dangling wikilinks, orphan pages, stale claims, restructure proposals. Reports only; the agent decides what to fix.
4
+ version: 1.0.0
5
+ category: knowledge
6
+ skillType: claude-skill
7
+ assignableRoles:
8
+ - orchestrator
9
+ - team-leader
10
+ ---
11
+
12
+ # Wiki Lint
13
+
14
+ Per v2.1 spec §3, the third Phase 1 wiki skill (alongside `wiki-ingest` and `wiki-query`). Unlike `wiki-bookkeep` which surfaces HEALTH metrics (counts, recent activity, duplicate clusters), `wiki-lint` validates CORRECTNESS:
15
+
16
+ | Check | Surfaces | Why it matters |
17
+ |---|---|---|
18
+ | `frozenPathRespected` | Ingest-style files inside frozen folders | Frozen paths (`memory/`, `sop/`, `team-norm/`, `sop-overrides/`, `okr/`) are OSS-referenced; LLM-curated content there breaks `get-sops` / `remember` / etc. |
19
+ | `missingEntities` | `[[wikilinks]]` that resolve to no page in the vault | Renamed-target or hallucinated link; dead reference must be fixed or removed. |
20
+ | `orphanPages` | Pages with zero incoming wikilinks (excluding `log.md`, `index.md`, `README*`, `SCHEMA.md`) | Either the page should be linked from somewhere or it should be archived — orphans are "did anyone find this useful?" candidates. |
21
+ | `staleClaims` | Files un-touched for `staleDays` (default 90) | Old enough to need a freshness check — the claim may have been superseded by newer pages. |
22
+ | `restructureProposals` | Heuristic proposals (e.g. "add an index.md" for big folders) | LLM-curated only; lint refuses to alter frozen paths. |
23
+
24
+ **The skill never modifies the vault.** It produces a JSON report; the agent's LLM reads it, decides what to do, and routes through `wiki-ingest` for any rewrites.
25
+
26
+ ## When to run
27
+
28
+ - After a `wiki-bookkeep` consolidation pass (verify the merges didn't create new orphans or dangling links).
29
+ - When you suspect drift — e.g. a customer page was renamed and other pages may still point at the old name.
30
+ - As part of a weekly cron (the bookkeep trigger may grow to fire lint too).
31
+
32
+ ## Inputs
33
+
34
+ | Flag | Required | Default | Description |
35
+ |---|---|---|---|
36
+ | `--vault <path>` | yes | — | Absolute vault path (must contain `SCHEMA.md`). |
37
+ | `--stale-days <n>` | no | 90 | Files older than this count as stale claims. |
38
+
39
+ ## What you do with the report
40
+
41
+ 1. **`frozenPathRespected: false`** is the most serious finding — a `wiki-ingest` call somehow wrote into a frozen folder (the runtime usually rejects this with 422; if you see it here, file a bug). For each violation, move the file to `llm-curated/` (`wiki-ingest --target llm-curated/<…>`) and delete the original.
42
+ 2. **`missingEntities`** — open the source page, fix or remove the dangling link.
43
+ 3. **`orphanPages`** — for each, decide: add an inbound link (edit a parent index page) OR mark for archive in your reply.
44
+ 4. **`staleClaims`** — for each, decide if the claim is still true. If superseded, link the newer page; if no longer relevant, mark for archive.
45
+ 5. **`restructureProposals`** — pick the high-value ones and act on them via `wiki-ingest`.
46
+
47
+ ## Output
48
+
49
+ ```json
50
+ {
51
+ "success": true,
52
+ "report": {
53
+ "vault": { "scope": "project", "id": "crewly", "path": "..." },
54
+ "generatedAt": "2026-05-24T19:00:00.000Z",
55
+ "staleDays": 90,
56
+ "frozenPathRespected": true,
57
+ "frozenViolations": [],
58
+ "missingEntities": [
59
+ { "sourcePath": "llm-curated/decisions/pricing.md", "target": "ghost-page", "lineNumber": 7 }
60
+ ],
61
+ "orphanPages": ["llm-curated/customers/forgotten.md"],
62
+ "staleClaims": ["llm-curated/patterns/old-pattern.md"],
63
+ "restructureProposals": [
64
+ { "description": "llm-curated/decisions/ has 31 pages and no index.md ...", "path": "llm-curated/decisions" }
65
+ ],
66
+ "truncated": false
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Failure modes
72
+
73
+ - `404 vault_missing` — vault directory does not exist.
74
+ - `404 schema_missing` — SCHEMA.md not found or unparseable.
75
+ - `400 invalid_input` — vaultPath not absolute / staleDays not positive.
@@ -0,0 +1,66 @@
1
+ #!/bin/bash
2
+ # wiki-lint — deterministic vault validation pass.
3
+ #
4
+ # Distinct from wiki-bookkeep (which reports HEALTH metrics). Lint focuses
5
+ # on CORRECTNESS:
6
+ # - frozenPathRespected (no ingest-style writes inside frozen folders)
7
+ # - missingEntities ([[wikilinks]] that resolve to no page)
8
+ # - orphanPages (pages with zero incoming wikilinks)
9
+ # - staleClaims (untouched for staleDays, default 90)
10
+ # - restructureProposals (heuristics for llm-curated/ only)
11
+ #
12
+ # This skill does NOT modify the vault. Your runtime reads the report and
13
+ # decides next actions: rename / merge / archive (via wiki-ingest for the
14
+ # rewrites; archiving is out of Phase 1 scope — surface in chat).
15
+ #
16
+ # Usage:
17
+ # bash execute.sh --vault /path
18
+ # bash execute.sh --vault /path --stale-days 60
19
+ set -euo pipefail
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ source "${SCRIPT_DIR}/../../_common/lib.sh"
22
+
23
+ INPUT_JSON=""
24
+ VAULT_PATH=""
25
+ STALE_DAYS=""
26
+
27
+ if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
28
+ INPUT_JSON="$1"; shift || true
29
+ fi
30
+
31
+ while [[ $# -gt 0 ]]; do
32
+ case "$1" in
33
+ --vault|-v) VAULT_PATH="$2"; shift 2 ;;
34
+ --stale-days|-s) STALE_DAYS="$2"; shift 2 ;;
35
+ --json|-j) INPUT_JSON="$2"; shift 2 ;;
36
+ --help|-h)
37
+ cat <<EOF
38
+ Usage:
39
+ execute.sh --vault <path> [--stale-days 90]
40
+
41
+ Runs a deterministic validation pass and returns a JSON report. Each
42
+ section is capped to 50 rows so the payload stays bounded. The skill
43
+ makes no LLM calls; your runtime decides what to act on.
44
+ EOF
45
+ exit 0 ;;
46
+ --) shift; break ;;
47
+ *)
48
+ if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then INPUT_JSON="$1"; shift
49
+ else error_exit "Unknown argument: $1"; fi ;;
50
+ esac
51
+ done
52
+
53
+ if [ -n "$INPUT_JSON" ]; then
54
+ INPUT=$(read_json_input "$INPUT_JSON")
55
+ [ -z "$VAULT_PATH" ] && VAULT_PATH=$(printf '%s' "$INPUT" | jq -r '.vaultPath // empty')
56
+ [ -z "$STALE_DAYS" ] && STALE_DAYS=$(printf '%s' "$INPUT" | jq -r '.staleDays // empty')
57
+ fi
58
+
59
+ require_param "vaultPath (--vault)" "$VAULT_PATH"
60
+
61
+ export _WL_V="$VAULT_PATH"
62
+ BODY=$(jq -n '{vaultPath: env._WL_V}')
63
+ [ -n "$STALE_DAYS" ] && BODY=$(echo "$BODY" | jq --argjson s "$STALE_DAYS" '. + {staleDays: $s}')
64
+ unset _WL_V
65
+
66
+ api_call POST "/wiki/lint" "$BODY"
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: Wiki Migrate
3
+ description: One-shot conversion from legacy `.crewly/knowledge/*.json` + loose `.md` + agent `memory.json` into the v2.1 three-scope vault structure. Default dry-run; idempotent; never deletes legacy files.
4
+ version: 1.0.0
5
+ category: knowledge
6
+ skillType: claude-skill
7
+ assignableRoles:
8
+ - orchestrator
9
+ - team-leader
10
+ ---
11
+
12
+ # Wiki Migrate
13
+
14
+ For users who installed Crewly BEFORE the v2.1 LLM-wiki landed (2026-05-22+). The legacy knowledge stores live at:
15
+
16
+ | Legacy source | New target |
17
+ |---|---|
18
+ | `<project>/.crewly/knowledge/decisions.json[]` | `<project>/.crewly/wiki/llm-curated/decisions/<date>-<slug>.md` |
19
+ | `<project>/.crewly/knowledge/patterns.json[]` | `<project>/.crewly/wiki/llm-curated/patterns/<date>-<slug>.md` |
20
+ | `<project>/.crewly/knowledge/gotchas.json[]` | `<project>/.crewly/wiki/llm-curated/patterns/<date>-<slug>.md` |
21
+ | `<project>/.crewly/knowledge/relationships.json[]` | `<project>/.crewly/wiki/llm-curated/people/<date>-<slug>.md` |
22
+ | `<project>/.crewly/knowledge/learnings.md` | appended to `<project>/.crewly/wiki/llm-curated/log.md` |
23
+ | `<project>/.crewly/knowledge/*.md` (loose) | `<project>/.crewly/wiki/llm-curated/decisions/<slug>.md` |
24
+ | `<project>/.crewly/docs/*.md` ← **legacy `query-knowledge` storage** | `<project>/.crewly/wiki/llm-curated/docs/<slug>.md` |
25
+ | `<project>/CLAUDE.md` / `AGENTS.md` / `DEPLOYMENT*.md` | `<project>/.crewly/wiki/llm-curated/runbooks/<slug>.md` |
26
+ | `<project>/deploy/*.md`, `<project>/docs/deploy*.md`, `<project>/.claude/commands/deploy*.md` | `<project>/.crewly/wiki/llm-curated/runbooks/<slug>.md` |
27
+ | `~/.crewly/agents/<id>/memory.json roleKnowledge[]` | `<project>/.crewly/wiki/llm-curated/{patterns,decisions}/<date>-<slug>.md` (copy; original retained) |
28
+ | `<crewly-src>/config/sops/<role>/*.md` (OSS-distributed) | `~/.crewly/global-wiki/llm-curated/sops/<role>/<slug>.md` (via `migrate/oss-sops`) |
29
+ | `<crewly-src>/config/domain-sops/*.sop.md` | `~/.crewly/global-wiki/llm-curated/sops/domain/<slug>.md` |
30
+ | `<crewly-src>/config/templates/pro-sops/norms/*.md` | `~/.crewly/global-wiki/llm-curated/sops/pro-norms/<slug>.md` |
31
+
32
+ Per spec §6 the agent's `memory.json` stays put — this skill **copies** its `roleKnowledge` entries to the wiki rather than moving them, so private agent memory keeps working unchanged.
33
+
34
+ ## What the legacy stores were (and what replaces them)
35
+
36
+ The migration **fully retires** the legacy `query-knowledge` skill (2026-05-27). After migration:
37
+
38
+ - `<project>/.crewly/docs/*.md` → still on disk (NOT deleted) but no agent skill reads them; **all content is in the wiki**
39
+ - `<project>/.crewly/knowledge/*` → same — preserved as source of truth but consumers now use `wiki-query`
40
+ - The single replacement skill is `wiki-query` (v2.1) — same query verb, richer vault routing (global / team / project)
41
+
42
+ If you're updating prompts that referenced `query-knowledge`, swap to:
43
+
44
+ ```bash
45
+ bash {{AGENT_SKILLS_PATH}}/core/wiki-query/execute.sh --vault <vault-path> --query "<topic>" --top-k 5
46
+ ```
47
+
48
+ Vault picker:
49
+ - Org-wide SOPs / cross-team decisions / OKR → `~/.crewly/global-wiki`
50
+ - Team SOPs / team norms → `~/.crewly/teams/<team-uuid>/wiki`
51
+ - Project decisions / customers / project runbooks → `<project-root>/.crewly/wiki`
52
+
53
+ ## Guarantees
54
+
55
+ - **Default dry-run.** No writes happen unless `--apply` (or `confirm: true` in JSON body) is passed.
56
+ - **Idempotent.** A manifest at `<vault>/.migration-state.json` records every migrated entry's content hash + sourceId. Re-runs skip duplicates.
57
+ - **Legacy preserved.** `.crewly/knowledge/` and `memory.json` files are NEVER deleted. Rollback is just "ignore the new vault."
58
+ - **Bootstrap on apply.** If the project / global / team vaults are missing `SCHEMA.md`, they're created with the v2.1 skeleton before any content lands.
59
+ - **Routing default.** Everything goes to the project vault. Items whose body looks cross-project (mention foreign team UUIDs, "company-wide", OKR lingo, cross-project codenames) are tagged `routing_uncertain: true` in frontmatter; `wiki-lint` surfaces them later for human review / promotion to global.
60
+
61
+ ## Inputs
62
+
63
+ | Flag | Required | Default | Description |
64
+ |---|---|---|---|
65
+ | `--project-root <abs path>` | yes | — | The dir containing `.crewly/`. |
66
+ | `--apply` | no | off | Execute writes. Without this, run a dry-run scan. |
67
+ | `--no-memory` | no | off | Skip the per-agent `memory.json` import. |
68
+
69
+ ## What you do with the report
70
+
71
+ **On scan (dry-run):**
72
+ - Read `proposedPages` — each row tells you target path, source file, sourceId.
73
+ - Look at `bootstrapNeeded` — confirms which vaults will be created.
74
+ - Look at `summary` — counts per source type.
75
+ - Look for `routingUncertain: true` rows — these will land in the project vault but flagged for later human review.
76
+
77
+ **On apply:**
78
+ - Confirm `applied` count matches the proposal.
79
+ - `bootstrapped` lists the vault dirs newly created.
80
+ - `manifestPath` is the persistent ledger — `cat` it to audit the migration.
81
+ - Run `wiki-lint --vault <project-vault>` afterwards to surface any `routing_uncertain` items.
82
+
83
+ ## Examples
84
+
85
+ **Dry-run:**
86
+ ```bash
87
+ bash execute.sh --project-root /Users/me/code/myproject
88
+ ```
89
+
90
+ **Apply for real:**
91
+ ```bash
92
+ bash execute.sh --project-root /Users/me/code/myproject --apply
93
+ ```
94
+
95
+ **Apply but skip agent memory.json copies:**
96
+ ```bash
97
+ bash execute.sh --project-root /Users/me/code/myproject --no-memory --apply
98
+ ```
99
+
100
+ ## Failure modes
101
+
102
+ - `400 invalid_input` — `projectRoot` is not absolute, or `confirm` was missing on apply (skill handles this automatically).
103
+ - `404 project_root_missing` — the directory doesn't exist.
@@ -0,0 +1,82 @@
1
+ #!/bin/bash
2
+ # wiki-migrate — one-shot conversion of legacy `.crewly/knowledge/*.json` +
3
+ # loose .md + agent memory.json into the v2.1 three-scope vault structure.
4
+ #
5
+ # Two modes:
6
+ # scan (default) — dry-run preview. Returns proposed pages with
7
+ # target paths, no writes.
8
+ # apply — execute the migration. Bootstraps missing vaults,
9
+ # writes pages, records a manifest. LEGACY FILES
10
+ # ARE NEVER DELETED.
11
+ #
12
+ # Safe to re-run. The manifest at <project>/.crewly/wiki/.migration-state.json
13
+ # tracks already-migrated entries by content hash + sourceId.
14
+ #
15
+ # Usage:
16
+ # bash execute.sh --project-root /abs/path # scan
17
+ # bash execute.sh --project-root /abs/path --apply # write
18
+ # bash execute.sh --project-root /abs/path --no-memory --apply # skip agent memory.json copies
19
+ set -euo pipefail
20
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
21
+ source "${SCRIPT_DIR}/../../_common/lib.sh"
22
+
23
+ INPUT_JSON=""
24
+ PROJECT_ROOT=""
25
+ APPLY="false"
26
+ INCLUDE_MEMORY="true"
27
+
28
+ if [[ $# -gt 0 && ${1:0:1} == '{' ]]; then
29
+ INPUT_JSON="$1"; shift || true
30
+ fi
31
+
32
+ while [[ $# -gt 0 ]]; do
33
+ case "$1" in
34
+ --project-root|-p) PROJECT_ROOT="$2"; shift 2 ;;
35
+ --apply|-a) APPLY="true"; shift ;;
36
+ --no-memory) INCLUDE_MEMORY="false"; shift ;;
37
+ --json|-j) INPUT_JSON="$2"; shift 2 ;;
38
+ --help|-h)
39
+ cat <<EOF
40
+ Usage:
41
+ execute.sh --project-root <abs path> # scan (dry-run)
42
+ execute.sh --project-root <abs path> --apply # execute migration
43
+ execute.sh --project-root <abs path> --no-memory --apply
44
+ # apply but skip agent memory.json copies
45
+
46
+ Outputs a JSON report:
47
+ - legacyDetected : true when any legacy source exists
48
+ - proposedPages : per-entry target + skipReason (when "already migrated")
49
+ - bootstrapNeeded : which vaults will be bootstrapped on --apply
50
+ - summary : counts per source type
51
+ - applied/skipped : only present on --apply
52
+
53
+ The skill makes NO LLM calls. Re-running is safe (idempotent via manifest).
54
+ EOF
55
+ exit 0 ;;
56
+ --) shift; break ;;
57
+ *)
58
+ if [[ -z "$INPUT_JSON" && ${1:0:1} == '{' ]]; then INPUT_JSON="$1"; shift
59
+ else error_exit "Unknown argument: $1"; fi ;;
60
+ esac
61
+ done
62
+
63
+ if [ -n "$INPUT_JSON" ]; then
64
+ INPUT=$(read_json_input "$INPUT_JSON")
65
+ [ -z "$PROJECT_ROOT" ] && PROJECT_ROOT=$(printf '%s' "$INPUT" | jq -r '.projectRoot // empty')
66
+ if printf '%s' "$INPUT" | jq -e '.apply == true' >/dev/null 2>&1; then APPLY="true"; fi
67
+ if printf '%s' "$INPUT" | jq -e '.includeAgentMemory == false' >/dev/null 2>&1; then INCLUDE_MEMORY="false"; fi
68
+ fi
69
+
70
+ require_param "projectRoot (--project-root)" "$PROJECT_ROOT"
71
+
72
+ export _WM_R="$PROJECT_ROOT"
73
+ export _WM_M="$INCLUDE_MEMORY"
74
+
75
+ if [ "$APPLY" = "true" ]; then
76
+ BODY=$(jq -n '{projectRoot: env._WM_R, includeAgentMemory: (env._WM_M == "true"), confirm: true}')
77
+ api_call POST "/wiki/migrate/apply" "$BODY"
78
+ else
79
+ BODY=$(jq -n '{projectRoot: env._WM_R, includeAgentMemory: (env._WM_M == "true")}')
80
+ api_call POST "/wiki/migrate/scan" "$BODY"
81
+ fi
82
+ unset _WM_R _WM_M
@@ -21,9 +21,16 @@ Claim the next pending queue item and get back the vault state your runtime's LL
21
21
  - **Merge** into an existing `result.vaultContext.candidatePages[i].path` — preferred if a candidate fits.
22
22
  - **Create** a new page under `llm-curated/<freshly-invented-subfolder>/<slug>.md`. You may invent subfolder names; there is NO preset taxonomy.
23
23
  - **Skip** if you decide the item isn't wiki-worthy after all.
24
- 4. Commit:
24
+ 4. **Cascade-update related pages (2026-05-26 — Karpathy 10-15-pages-per-source rule).** After writing the primary target, ask: *"what existing pages in this vault are now stale or contradicted because of this new content?"* Run `wiki-query` with the topic to surface related pages, read each, and decide:
25
+ - **Update**: the new content changes the truth of that page → `wiki-ingest --target <that-page>` with the updated body
26
+ - **Cross-link**: just add a `[[<primary-target-slug>]]` to that page so future readers find the connection
27
+ - **Leave alone**: no contradiction, no overlap — skip
28
+ - **Update `index.md`**: if you created a new sub-folder or added a load-bearing page, append a link in `llm-curated/index.md` (create the file if absent)
29
+ - Aim for **3-7 cascade touches per primary ingest** when the topic is load-bearing (customers, decisions, OKRs). Routine learnings may have 0-1 cascade touches.
30
+ 5. Commit:
25
31
  - To write: call `wiki-ingest` with `--vault`, `--source-type`, `--source-ref`, `--source-body`, and `--target <relative-path>`.
26
32
  - Then POST `/api/wiki/queue/<id>/process` with `{ingested:true, pagesWritten:[…], targetPath:'…', summary:'…'}`.
33
+ - `pagesWritten` should list ALL pages touched in step 4 + step 5 — primary + every cascade update.
27
34
  - To skip: POST `/api/wiki/queue/<id>/skip` with `{skipReason:'…'}`.
28
35
 
29
36
  ## Hard rules your LLM must honor
@@ -31,6 +38,7 @@ Claim the next pending queue item and get back the vault state your runtime's LL
31
38
  - **NEVER target a frozen folder** (`result.vaultContext.schemaSummary.frozenPaths`). The ingest call will reject these with HTTP 422.
32
39
  - **PREFER merging into an existing page** over creating a new one. Only create new when nothing fits.
33
40
  - **DO NOT re-justify wiki-worthiness** — the agent who queued the item already did (`result.item.reason`). Your job is classification, not gatekeeping. The exception is skip: if context reveals the item is a duplicate / low signal, skip with a `skipReason`.
41
+ - **Cascade updates are cheap and load-bearing — do not skip them.** A wiki where every page is a disconnected snapshot is no better than chat history. Per Karpathy: *"updating cross-references, keeping summaries current, noting when new data contradicts old claims — humans abandon wikis because of this. LLMs don't get bored."* The compounding value of the wiki comes from these cascade touches, not from the primary write.
34
42
 
35
43
  ## Inputs
36
44