create-principles-disciple 1.73.0 → 1.74.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 (272) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +24 -0
  3. package/console/dist/server/index.js +13 -1
  4. package/console/dist/server/routes/agents.js +3 -118
  5. package/console/dist/server/routes/update-history.d.ts +12 -0
  6. package/console/dist/server/routes/update-history.js +52 -0
  7. package/console/dist/server/routes/update.d.ts +10 -0
  8. package/console/dist/server/routes/update.js +435 -0
  9. package/console/dist/ui/App.js +2 -1
  10. package/console/dist/ui/components/UpdateBanner.d.ts +1 -0
  11. package/console/dist/ui/components/UpdateBanner.js +41 -0
  12. package/console/dist/ui/components/UpdateProgressDialog.d.ts +12 -0
  13. package/console/dist/ui/components/UpdateProgressDialog.js +28 -0
  14. package/console/dist/ui/i18n/en.json +0 -1
  15. package/console/dist/ui/i18n/zh-CN.json +0 -1
  16. package/console/dist/ui/pages/AgentsPage.js +3 -17
  17. package/console/dist/ui/pages/TasksPage.js +0 -1
  18. package/console/dist/ui/pages/UpdatePage.d.ts +1 -0
  19. package/console/dist/ui/pages/UpdatePage.js +142 -0
  20. package/console/dist/web/assets/app.css +7 -0
  21. package/console/dist/web/assets/app.js +456 -173
  22. package/console/package.json +2 -0
  23. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.d.ts +2 -0
  24. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.d.ts.map +1 -0
  25. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js +270 -0
  26. package/core/dist/runtime-v2/adapter/__tests__/schema-prompt-adapter.test.js.map +1 -0
  27. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts +1 -1
  28. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.d.ts.map +1 -1
  29. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js +4 -3
  30. package/core/dist/runtime-v2/adapter/pi-ai-runtime-adapter.js.map +1 -1
  31. package/core/dist/runtime-v2/adapter/schema-prompt-adapter.d.ts +13 -0
  32. package/core/dist/runtime-v2/adapter/schema-prompt-adapter.d.ts.map +1 -0
  33. package/core/dist/runtime-v2/adapter/schema-prompt-adapter.js +266 -0
  34. package/core/dist/runtime-v2/adapter/schema-prompt-adapter.js.map +1 -0
  35. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts +3 -7
  36. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.d.ts.map +1 -1
  37. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.js +7 -19
  38. package/core/dist/runtime-v2/adapter/tools/diagnostician-tool.js.map +1 -1
  39. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.js +97 -15
  40. package/core/dist/runtime-v2/diagnostician/__tests__/diagnostician-prompt-builder.test.js.map +1 -1
  41. package/core/dist/runtime-v2/diagnostician-output.d.ts +0 -10
  42. package/core/dist/runtime-v2/diagnostician-output.d.ts.map +1 -1
  43. package/core/dist/runtime-v2/diagnostician-output.js +5 -10
  44. package/core/dist/runtime-v2/diagnostician-output.js.map +1 -1
  45. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts +6 -1
  46. package/core/dist/runtime-v2/diagnostician-prompt-builder.d.ts.map +1 -1
  47. package/core/dist/runtime-v2/diagnostician-prompt-builder.js +23 -15
  48. package/core/dist/runtime-v2/diagnostician-prompt-builder.js.map +1 -1
  49. package/dist/index.js +0 -0
  50. package/dist/installer.d.ts.map +1 -1
  51. package/dist/installer.js +67 -0
  52. package/dist/installer.js.map +1 -1
  53. package/dist/uninstaller.d.ts +0 -5
  54. package/dist/uninstaller.d.ts.map +1 -1
  55. package/dist/uninstaller.js +53 -8
  56. package/dist/uninstaller.js.map +1 -1
  57. package/dist/updater.d.ts +45 -0
  58. package/dist/updater.d.ts.map +1 -0
  59. package/dist/updater.js +333 -0
  60. package/dist/updater.js.map +1 -0
  61. package/dist/utils/env.d.ts +6 -0
  62. package/dist/utils/env.d.ts.map +1 -1
  63. package/dist/utils/env.js +54 -0
  64. package/dist/utils/env.js.map +1 -1
  65. package/package.json +6 -2
  66. package/pd-cli/dist/index.js +4 -1
  67. package/pd-cli/dist/index.js.map +1 -1
  68. package/pd-cli/package.json +2 -2
  69. package/plugin/templates/langs/en/skills/ai-sprint-orchestration/runtime/.gitignore +2 -2
  70. package/plugin/templates/langs/zh/skills/ai-sprint-orchestration/runtime/.gitignore +2 -2
  71. package/core/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.d.ts +0 -2
  72. package/core/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.d.ts.map +0 -1
  73. package/core/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.js +0 -215
  74. package/core/dist/runtime-v2/__tests__/nocturnal-compliance-trust-boundary.test.js.map +0 -1
  75. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.d.ts +0 -2
  76. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.d.ts.map +0 -1
  77. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.js +0 -92
  78. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-config-resolve.test.js.map +0 -1
  79. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.d.ts +0 -2
  80. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.d.ts.map +0 -1
  81. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.js +0 -134
  82. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-decision.test.js.map +0 -1
  83. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.d.ts +0 -2
  84. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.d.ts.map +0 -1
  85. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.js +0 -226
  86. package/core/dist/runtime-v2/idle-trigger/__tests__/idle-trigger-edge-cases.test.js.map +0 -1
  87. package/core/dist/runtime-v2/idle-trigger/idle-trigger-decision.d.ts +0 -3
  88. package/core/dist/runtime-v2/idle-trigger/idle-trigger-decision.d.ts.map +0 -1
  89. package/core/dist/runtime-v2/idle-trigger/idle-trigger-decision.js +0 -5
  90. package/core/dist/runtime-v2/idle-trigger/idle-trigger-decision.js.map +0 -1
  91. package/core/dist/runtime-v2/idle-trigger/idle-trigger-policy.d.ts +0 -4
  92. package/core/dist/runtime-v2/idle-trigger/idle-trigger-policy.d.ts.map +0 -1
  93. package/core/dist/runtime-v2/idle-trigger/idle-trigger-policy.js +0 -81
  94. package/core/dist/runtime-v2/idle-trigger/idle-trigger-policy.js.map +0 -1
  95. package/core/dist/runtime-v2/idle-trigger/idle-trigger-types.d.ts +0 -29
  96. package/core/dist/runtime-v2/idle-trigger/idle-trigger-types.d.ts.map +0 -1
  97. package/core/dist/runtime-v2/idle-trigger/idle-trigger-types.js +0 -15
  98. package/core/dist/runtime-v2/idle-trigger/idle-trigger-types.js.map +0 -1
  99. package/core/dist/runtime-v2/idle-trigger/index.d.ts +0 -5
  100. package/core/dist/runtime-v2/idle-trigger/index.d.ts.map +0 -1
  101. package/core/dist/runtime-v2/idle-trigger/index.js +0 -4
  102. package/core/dist/runtime-v2/idle-trigger/index.js.map +0 -1
  103. package/core/dist/runtime-v2/nocturnal/candidate-scoring.d.ts +0 -486
  104. package/core/dist/runtime-v2/nocturnal/candidate-scoring.d.ts.map +0 -1
  105. package/core/dist/runtime-v2/nocturnal/candidate-scoring.js +0 -493
  106. package/core/dist/runtime-v2/nocturnal/candidate-scoring.js.map +0 -1
  107. package/core/dist/runtime-v2/nocturnal/index.d.ts +0 -9
  108. package/core/dist/runtime-v2/nocturnal/index.d.ts.map +0 -1
  109. package/core/dist/runtime-v2/nocturnal/index.js +0 -5
  110. package/core/dist/runtime-v2/nocturnal/index.js.map +0 -1
  111. package/core/dist/runtime-v2/nocturnal/nocturnal-compliance.d.ts +0 -185
  112. package/core/dist/runtime-v2/nocturnal/nocturnal-compliance.d.ts.map +0 -1
  113. package/core/dist/runtime-v2/nocturnal/nocturnal-compliance.js +0 -912
  114. package/core/dist/runtime-v2/nocturnal/nocturnal-compliance.js.map +0 -1
  115. package/core/dist/runtime-v2/nocturnal/snapshot-contract.d.ts +0 -192
  116. package/core/dist/runtime-v2/nocturnal/snapshot-contract.d.ts.map +0 -1
  117. package/core/dist/runtime-v2/nocturnal/snapshot-contract.js +0 -185
  118. package/core/dist/runtime-v2/nocturnal/snapshot-contract.js.map +0 -1
  119. package/core/dist/runtime-v2/nocturnal/trinity-types.d.ts +0 -421
  120. package/core/dist/runtime-v2/nocturnal/trinity-types.d.ts.map +0 -1
  121. package/core/dist/runtime-v2/nocturnal/trinity-types.js +0 -182
  122. package/core/dist/runtime-v2/nocturnal/trinity-types.js.map +0 -1
  123. package/pd-cli/dist/commands/runtime-idle-trigger.d.ts +0 -12
  124. package/pd-cli/dist/commands/runtime-idle-trigger.d.ts.map +0 -1
  125. package/pd-cli/dist/commands/runtime-idle-trigger.js +0 -102
  126. package/pd-cli/dist/commands/runtime-idle-trigger.js.map +0 -1
  127. package/plugin/dist/bundle.js +0 -2424
  128. package/plugin/dist/core/trajectory/index.js +0 -1804
  129. package/plugin/dist/openclaw.plugin.json +0 -65
  130. package/plugin/dist/templates/langs/en/core/AGENTS.md +0 -205
  131. package/plugin/dist/templates/langs/en/core/BOOT.md +0 -60
  132. package/plugin/dist/templates/langs/en/core/BOOTSTRAP.md +0 -273
  133. package/plugin/dist/templates/langs/en/core/HEARTBEAT.md +0 -74
  134. package/plugin/dist/templates/langs/en/core/IDENTITY.md +0 -8
  135. package/plugin/dist/templates/langs/en/core/PRINCIPLES.md +0 -10
  136. package/plugin/dist/templates/langs/en/core/SOUL.md +0 -46
  137. package/plugin/dist/templates/langs/en/core/TOOLS.md +0 -15
  138. package/plugin/dist/templates/langs/en/core/USER.md +0 -10
  139. package/plugin/dist/templates/langs/en/pain/00_seed_samples.md +0 -23
  140. package/plugin/dist/templates/langs/en/pain_dictionary.json +0 -22
  141. package/plugin/dist/templates/langs/en/principles/THINKING_OS.md +0 -64
  142. package/plugin/dist/templates/langs/en/skills/admin/SKILL.md +0 -39
  143. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
  144. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
  145. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/SKILL.md +0 -67
  146. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
  147. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
  148. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
  149. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
  150. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
  151. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
  152. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
  153. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/runtime/.gitignore +0 -2
  154. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
  155. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
  156. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
  157. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
  158. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
  159. package/plugin/dist/templates/langs/en/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
  160. package/plugin/dist/templates/langs/en/skills/bootstrap-tools/SKILL.md +0 -53
  161. package/plugin/dist/templates/langs/en/skills/deductive-audit/SKILL.md +0 -36
  162. package/plugin/dist/templates/langs/en/skills/evolution-framework-update/SKILL.md +0 -31
  163. package/plugin/dist/templates/langs/en/skills/evolve-system/SKILL.md +0 -46
  164. package/plugin/dist/templates/langs/en/skills/evolve-task/SKILL.md +0 -83
  165. package/plugin/dist/templates/langs/en/skills/feedback/SKILL.md +0 -51
  166. package/plugin/dist/templates/langs/en/skills/init-strategy/SKILL.md +0 -54
  167. package/plugin/dist/templates/langs/en/skills/inject-rule/SKILL.md +0 -19
  168. package/plugin/dist/templates/langs/en/skills/manage-okr/SKILL.md +0 -96
  169. package/plugin/dist/templates/langs/en/skills/pd-auditor/SKILL.md +0 -61
  170. package/plugin/dist/templates/langs/en/skills/pd-cli-operator/SKILL.md +0 -67
  171. package/plugin/dist/templates/langs/en/skills/pd-daily/SKILL.md +0 -199
  172. package/plugin/dist/templates/langs/en/skills/pd-diagnostician/SKILL.md +0 -466
  173. package/plugin/dist/templates/langs/en/skills/pd-explorer/SKILL.md +0 -65
  174. package/plugin/dist/templates/langs/en/skills/pd-grooming/SKILL.md +0 -46
  175. package/plugin/dist/templates/langs/en/skills/pd-implementer/SKILL.md +0 -68
  176. package/plugin/dist/templates/langs/en/skills/pd-mentor/SKILL.md +0 -230
  177. package/plugin/dist/templates/langs/en/skills/pd-pain-signal/SKILL.md +0 -30
  178. package/plugin/dist/templates/langs/en/skills/pd-planner/SKILL.md +0 -65
  179. package/plugin/dist/templates/langs/en/skills/pd-runtime-v2/SKILL.md +0 -61
  180. package/plugin/dist/templates/langs/en/skills/plan-script/SKILL.md +0 -32
  181. package/plugin/dist/templates/langs/en/skills/profile/SKILL.md +0 -24
  182. package/plugin/dist/templates/langs/en/skills/reflection/SKILL.md +0 -40
  183. package/plugin/dist/templates/langs/en/skills/reflection-log/SKILL.md +0 -37
  184. package/plugin/dist/templates/langs/en/skills/report/SKILL.md +0 -13
  185. package/plugin/dist/templates/langs/en/skills/root-cause/SKILL.md +0 -33
  186. package/plugin/dist/templates/langs/en/skills/triage/SKILL.md +0 -29
  187. package/plugin/dist/templates/langs/en/skills/watch-evolution/SKILL.md +0 -33
  188. package/plugin/dist/templates/langs/zh/core/AGENTS.md +0 -197
  189. package/plugin/dist/templates/langs/zh/core/BOOT.md +0 -60
  190. package/plugin/dist/templates/langs/zh/core/BOOTSTRAP.md +0 -273
  191. package/plugin/dist/templates/langs/zh/core/HEARTBEAT.md +0 -98
  192. package/plugin/dist/templates/langs/zh/core/IDENTITY.md +0 -8
  193. package/plugin/dist/templates/langs/zh/core/PRINCIPLES.md +0 -7
  194. package/plugin/dist/templates/langs/zh/core/SOUL.md +0 -46
  195. package/plugin/dist/templates/langs/zh/core/TOOLS.md +0 -15
  196. package/plugin/dist/templates/langs/zh/core/USER.md +0 -10
  197. package/plugin/dist/templates/langs/zh/pain/00_seed_samples.md +0 -24
  198. package/plugin/dist/templates/langs/zh/pain_dictionary.json +0 -18
  199. package/plugin/dist/templates/langs/zh/principles/THINKING_OS.md +0 -64
  200. package/plugin/dist/templates/langs/zh/skills/admin/SKILL.md +0 -41
  201. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/EXAMPLES.md +0 -63
  202. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/REFERENCE.md +0 -136
  203. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/SKILL.md +0 -67
  204. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/agent-registry.json +0 -143
  205. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/bugfix-complex-template.json +0 -107
  206. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/feature-complex-template.json +0 -107
  207. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/nocturnal-trinity-quality-enhancement.json +0 -111
  208. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal-verify.json +0 -95
  209. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/specs/workflow-validation-minimal.json +0 -98
  210. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1-acceptance-checklist.md +0 -58
  211. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/references/workflow-v1.4-work-unit-handoff.md +0 -190
  212. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/runtime/.gitignore +0 -2
  213. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/archive.mjs +0 -310
  214. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/contract-enforcement.mjs +0 -683
  215. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/decision.mjs +0 -604
  216. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/state-store.mjs +0 -32
  217. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/lib/task-specs.mjs +0 -707
  218. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/scripts/run.mjs +0 -3455
  219. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/test/archive.test.mjs +0 -230
  220. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/test/contract-enforcement.test.mjs +0 -672
  221. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/test/decision.test.mjs +0 -1321
  222. package/plugin/dist/templates/langs/zh/skills/ai-sprint-orchestration/test/run.test.mjs +0 -1435
  223. package/plugin/dist/templates/langs/zh/skills/bootstrap-tools/SKILL.md +0 -52
  224. package/plugin/dist/templates/langs/zh/skills/deductive-audit/SKILL.md +0 -36
  225. package/plugin/dist/templates/langs/zh/skills/evolution-framework-update/SKILL.md +0 -31
  226. package/plugin/dist/templates/langs/zh/skills/evolve-system/SKILL.md +0 -46
  227. package/plugin/dist/templates/langs/zh/skills/evolve-task/SKILL.md +0 -83
  228. package/plugin/dist/templates/langs/zh/skills/feedback/SKILL.md +0 -53
  229. package/plugin/dist/templates/langs/zh/skills/init-strategy/SKILL.md +0 -54
  230. package/plugin/dist/templates/langs/zh/skills/inject-rule/SKILL.md +0 -19
  231. package/plugin/dist/templates/langs/zh/skills/manage-okr/SKILL.md +0 -109
  232. package/plugin/dist/templates/langs/zh/skills/pd-auditor/SKILL.md +0 -61
  233. package/plugin/dist/templates/langs/zh/skills/pd-cli-operator/SKILL.md +0 -67
  234. package/plugin/dist/templates/langs/zh/skills/pd-daily/SKILL.md +0 -283
  235. package/plugin/dist/templates/langs/zh/skills/pd-diagnostician/SKILL.md +0 -391
  236. package/plugin/dist/templates/langs/zh/skills/pd-explorer/SKILL.md +0 -65
  237. package/plugin/dist/templates/langs/zh/skills/pd-grooming/SKILL.md +0 -46
  238. package/plugin/dist/templates/langs/zh/skills/pd-implementer/SKILL.md +0 -68
  239. package/plugin/dist/templates/langs/zh/skills/pd-mentor/SKILL.md +0 -230
  240. package/plugin/dist/templates/langs/zh/skills/pd-pain-signal/SKILL.md +0 -30
  241. package/plugin/dist/templates/langs/zh/skills/pd-planner/SKILL.md +0 -65
  242. package/plugin/dist/templates/langs/zh/skills/pd-runtime-v2/SKILL.md +0 -61
  243. package/plugin/dist/templates/langs/zh/skills/plan-script/SKILL.md +0 -32
  244. package/plugin/dist/templates/langs/zh/skills/profile/SKILL.md +0 -24
  245. package/plugin/dist/templates/langs/zh/skills/reflection/SKILL.md +0 -40
  246. package/plugin/dist/templates/langs/zh/skills/reflection-log/SKILL.md +0 -37
  247. package/plugin/dist/templates/langs/zh/skills/report/SKILL.md +0 -13
  248. package/plugin/dist/templates/langs/zh/skills/root-cause/SKILL.md +0 -33
  249. package/plugin/dist/templates/langs/zh/skills/triage/SKILL.md +0 -29
  250. package/plugin/dist/templates/langs/zh/skills/watch-evolution/SKILL.md +0 -33
  251. package/plugin/dist/templates/pain_dictionary.json +0 -36
  252. package/plugin/dist/templates/pain_settings.json +0 -103
  253. package/plugin/dist/templates/workspace/.principles/DECISION_POLICY.json +0 -44
  254. package/plugin/dist/templates/workspace/.principles/PRINCIPLES.md +0 -20
  255. package/plugin/dist/templates/workspace/.principles/PROFILE.json +0 -54
  256. package/plugin/dist/templates/workspace/.principles/PROFILE.schema.json +0 -56
  257. package/plugin/dist/templates/workspace/.principles/THINKING_OS.md +0 -64
  258. package/plugin/dist/templates/workspace/.principles/THINKING_OS_ARCHIVE.md +0 -7
  259. package/plugin/dist/templates/workspace/.principles/THINKING_OS_CANDIDATES.md +0 -9
  260. package/plugin/dist/templates/workspace/.principles/models/_INDEX.md +0 -27
  261. package/plugin/dist/templates/workspace/.principles/models/first_principles.md +0 -62
  262. package/plugin/dist/templates/workspace/.principles/models/marketing_4p.md +0 -52
  263. package/plugin/dist/templates/workspace/.principles/models/porter_five.md +0 -63
  264. package/plugin/dist/templates/workspace/.principles/models/swot.md +0 -60
  265. package/plugin/dist/templates/workspace/.principles/models/user_story_map.md +0 -63
  266. package/plugin/dist/templates/workspace/.state/WORKBOARD.json +0 -4
  267. package/plugin/dist/templates/workspace/AUDIT.md +0 -15
  268. package/plugin/dist/templates/workspace/PLAN.md +0 -2
  269. package/plugin/dist/templates/workspace/okr/CURRENT_FOCUS.md +0 -57
  270. package/plugin/dist/templates/workspace/okr/RECOVERY_PROTOCOL.md +0 -56
  271. package/plugin/dist/templates/workspace/okr/TASK_CHANGES.jsonl +0 -6
  272. package/plugin/dist/templates/workspace/okr/WEEK_TASKS.json +0 -6
@@ -1,199 +0,0 @@
1
- ---
2
- name: pd-daily
3
- description: Configure and send daily evolution reports. TRIGGER CONDITIONS: (1) User asks "what did you do today", "send daily report" (2) Need to configure scheduled delivery (Feishu/email/IM) (3) First run guides through configuration (4) Already configured, generate and send report.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Evolution Daily Report
8
-
9
- This skill enables the agent to help users configure and automatically send daily evolution reports, allowing users to perceive the system "improving every day."
10
-
11
- ## Execution Principles
12
-
13
- 1. First run must confirm requirements with the user
14
- 2. User preferences are stored in `{stateDir}/daily-report.md`; skip collection if exists
15
- 3. Use OpenClaw's cron tool to create scheduled tasks
16
- 4. Autonomously select available delivery channels
17
-
18
- ---
19
-
20
- ## Flow
21
-
22
- ### Step 1: Check Configuration File
23
-
24
- Read `{stateDir}/daily-report.md`:
25
- - **Exists** → Check cron task status, execute report generation
26
- - **Not exists** → Enter requirement collection flow
27
-
28
- ### Step 2: Requirement Collection (First Run)
29
-
30
- Ask through conversation:
31
-
32
- 1. **Enable evolution daily report?**
33
- 2. **Send time?** (Default: 9:00 daily)
34
- 3. **Timezone?** (Default: Asia/Shanghai)
35
- 4. **Delivery channel?**
36
- - Email → Need email address
37
- - WhatsApp/Telegram → Need phone number/User ID
38
- - Discord/Slack → Need channel ID
39
- - Voice notification → Need phone number
40
- 5. **Report style?** (See "Style Options" below)
41
- 6. **Content preferences?** Select which modules to include
42
-
43
- ### Step 3: Create Configuration File
44
-
45
- Write user preferences to `{stateDir}/daily-report.md`:
46
-
47
- ```markdown
48
- # Daily Report Configuration
49
-
50
- ## Basic Info
51
- - Status: enabled
52
- - Created: {date}
53
-
54
- ## Send Settings
55
- - Send time: 09:00
56
- - Timezone: Asia/Shanghai
57
- - Cron expression: 0 9 * * *
58
-
59
- ## Delivery Channel
60
- - Channel: whatsapp
61
- - Target: +8613800138000
62
-
63
- ## Report Style
64
- - Style: standard
65
- - Language: en
66
-
67
- ## Content Preferences
68
- - Growth highlights: yes
69
- - Pain signals: yes
70
- - Trend comparison: yes
71
- - Insights: yes
72
-
73
- ## Cron Task
74
- - jobId: {filled after creation}
75
- ```
76
-
77
- ### Step 4: Create Cron Task
78
-
79
- Use cron tool:
80
-
81
- ```json
82
- {
83
- "action": "add",
84
- "job": {
85
- "name": "evolution-daily-report",
86
- "schedule": { "kind": "cron", "expr": "0 9 * * *", "tz": "Asia/Shanghai" },
87
- "sessionTarget": "isolated",
88
- "payload": {
89
- "kind": "agentTurn",
90
- "message": "Execute daily report skill: read log data, generate report and send"
91
- },
92
- "delivery": { "mode": "announce", "channel": "whatsapp", "to": "+8613800138000" }
93
- }
94
- }
95
- ```
96
-
97
- ### Step 5: Report Generation (Triggered via cron or manually)
98
-
99
- 1. **Read Quantitative Data**: Fetch metrics from `daily-stats.json` and `pain_dictionary.json`.
100
- 2. **Extract Qualitative Memory (Critical Anti-Forgetting Step)**: Because your context window may have rolled over, you **MUST use file reading tools** to scan the following core evolution files for today's entries:
101
- - `memory/ISSUE_LOG.md`: Find specific errors and reflections recorded today.
102
- - `memory/DECISIONS.md`: Find new architectural rules established today.
103
- - `memory/logs/SYSTEM.log`: Find gatekeeper blocks or subagent spawn events from today.
104
- 3. **Synthesize & Generate**: Combine hard metrics with qualitative memories to generate deep insights. Never hallucinate insights.
105
- 4. **Send Report**: Dispatch via OpenClaw channel or print to screen.
106
-
107
- ---
108
-
109
- ## Data Sources
110
-
111
- | Data | Path | Description |
112
- |------|------|-------------|
113
- | Daily Stats | `{stateDir}/logs/daily-stats.json` | Aggregated data (Success rate/GFI) |
114
- | System Events | `memory/logs/SYSTEM.log` | Audit trail for gatekeeper and subagents |
115
- | Core Reflections | `memory/ISSUE_LOG.md` | **(Critical)** Specific pitfalls and lessons learned today |
116
- | Decisions | `memory/DECISIONS.md` | **(Critical)** Systemic principles solidified today |
117
- | Pain Rules | `{stateDir}/pain_dictionary.json` | Total active rules |
118
- | User Config | `{stateDir}/daily-report.md` | Formatting preferences |
119
-
120
- ---
121
-
122
- ## Style Options
123
-
124
- Ask user preference during requirement collection:
125
-
126
- | Style | Features | Suitable For |
127
- |-------|----------|--------------|
128
- | **Concise** | 3-5 core metrics, 1 min read | Busy users |
129
- | **Standard** | Full metrics + trend comparison, 5 min read | Default recommendation |
130
- | **Detailed** | Full data + analysis suggestions, 15 min read | Data enthusiasts |
131
- | **Humorous** | Casual tone + emoji style | Casual users |
132
- | **Visual** | ASCII charts + progress bars | Visual learners |
133
-
134
- ---
135
-
136
- ## Evolution Metrics Elements
137
-
138
- ### Growth Highlights (Positive)
139
-
140
- | Metric | Data Source | Progress Signal |
141
- |--------|-------------|-----------------|
142
- | Rules learned | `pain_dictionary.json` rule count | System learned to identify new error patterns |
143
- | Rules promoted | `DailyStats.pain.candidatesPromoted` | L3 semantic detection → formal rule |
144
- | Evolution tasks completed | `DailyStats.evolution.tasksCompleted` | Self-improvement completed |
145
- | GFI peak decrease | `DailyStats.gfi.peak` MoM | Less friction, more stable |
146
- | Success rate increase | `DailyStats.toolCalls.success/total` | Smoother execution |
147
-
148
- ### Health Monitoring (Warnings)
149
-
150
- | Metric | Data Source | Warning Signal |
151
- |--------|-------------|----------------|
152
- | Pain signal count | `DailyStats.pain.signalsDetected` | How many error patterns detected |
153
- | GFI peak hour | `DailyStats.gfi.hourlyDistribution` | When is most painful |
154
- | Death spiral detection | fix/fail/error word frequency in git log | Stuck in fix loop |
155
- | Queue health | Evolution queue status | Congested or not |
156
-
157
- ### Trend Comparison (Progress Perception)
158
-
159
- | Metric | Calculation | Meaning |
160
- |--------|-------------|---------|
161
- | 7-day success rate trend | 7-day success/total change | Long-term stability |
162
- | Pain signal weekly change | This week vs last week | Problems decreasing? |
163
- | Rule growth rate | New rules this week | Learning speed |
164
- | GFI average change | 7-day GFI average trend | Overall friction trend |
165
-
166
- ---
167
-
168
- ## Default Report Template
169
-
170
- ```markdown
171
- # 🌱 Evolution Daily Report - {date}
172
-
173
- ## 📈 Today's Growth
174
- - 🧠 Rules learned: {rules_promoted}
175
- - ✅ Evolutions completed: {tasks_completed}
176
- - 🎯 Success rate: {success_rate}% ({trend_emoji})
177
- - 📉 GFI peak: {gfi_peak} ({gfi_trend})
178
-
179
- ## ⚡ Pain Signals
180
- - Detections: {pain_count}
181
- - Avg intensity: {avg_score}
182
- - Top sources: {top_sources}
183
-
184
- ## 📊 Trend Comparison
185
- - 7-day success rate trend: {success_trend}
186
- - Pain signal weekly change: {pain_trend}
187
-
188
- ## 💡 Today's Insights
189
- {insights}
190
-
191
- ---
192
- 📊 Source: Principles Disciple
193
- ```
194
-
195
- ---
196
-
197
- ## Manual Trigger
198
-
199
- Users can run `/evolution-daily` anytime to manually generate and send today's report.
@@ -1,466 +0,0 @@
1
- ---
2
- name: pd-diagnostician
3
- description: Root cause analysis using verb/adjective + 5 Whys method for systematic diagnosis. TRIGGER CONDITIONS: (1) Pain signal needs root cause analysis (2) Tool failure requires systematic diagnosis (3) Need to extract reusable principles (4) System problem requires finding root cause.
4
- disable-model-invocation: true
5
- ---
6
-
7
- # Diagnostician - Root Cause Analysis Agent
8
-
9
- You are a professional root cause analysis expert. You MUST strictly follow the **six-phase protocol** (Phase 0 optional + Phase 1-5 mandatory) below to execute analysis and **immediately write results to the report file after each Phase completes**.
10
-
11
- ---
12
-
13
- ## 🔴 Execution Protocol (MUST execute in order)
14
-
15
- ### Phase 0: Conversation Context Acquisition [Always Attempt]
16
-
17
- **Goal**: Obtain conversation context when pain occurred, to assist diagnostic analysis.
18
-
19
- **Input**: Parse the following parameters from the task string:
20
- - `session_id`: Current session ID
21
- - `agent_id`: Agent ID (e.g., main, builder, diagnostician, etc.)
22
- - `pain_timestamp`: When pain occurred
23
-
24
- **🔄 Dual-Path Information Acquisition Strategy** (Execute by priority, auto-degrade to P2 if P1 fails):
25
-
26
- | Priority | Data Source | Condition | Action |
27
- |----------|-------------|-----------|--------|
28
- | P1 | OpenClaw built-in tools | session_id exists | Use sessions_history to get messages |
29
- | P2 | JSONL session file | P1 failed or no visible session | Read JSONL file directly |
30
- | P3 | Task embedded context | Task contains "Recent Conversation Context" | Use directly |
31
- | P4 | Active evidence collection | All above unavailable | Jump to Phase 1 enhanced |
32
-
33
- **Execution Steps**:
34
-
35
- 1. **Parse task string**, extract `session_id` and `agent_id` (if present)
36
-
37
- 2. **P1: Try OpenClaw built-in tools** (preferred):
38
- - Use `sessions_history` tool to get session message history
39
- - sessionKey format: `agent:{agent_id}:run:{session_id}` or from Session ID field in task
40
- - If tool call succeeds, record `context_source: "sessions_history"`, jump to step 4
41
- - **If fails** (visibility limits, tool unavailable), record failure reason, continue to P2
42
-
43
- 3. **P2: Fallback to JSONL direct read** (backup):
44
- - Path: `~/.openclaw/agents/{agent_id}/sessions/{session_id}.jsonl`
45
- - If file exists and readable, record `context_source: "jsonl"`
46
- - **If file doesn't exist or unreadable**, record `jsonl_available: false`, continue to P3
47
- - Smart filtering:
48
- - Ignore `toolResult` type (too large)
49
- - Ignore `thinking` type
50
- - Keep only `user` and `assistant` `text` content
51
- - Truncate each message to 500 characters
52
-
53
- 4. **P3: Check task embedded context**:
54
- - Look for one of these markers in the task string:
55
- - `## Recent Conversation Context (pre-extracted JSONL fallback)`
56
- - `## Pre-extracted Context (P2 - JSONL Fallback)`
57
- - `**Recent Conversation Context**:`
58
- - If found, extract the following block and record `context_source: "task_embedded"`
59
-
60
- 5. **Degradation handling** (when all above unavailable):
61
- - Do NOT stop! Continue to Phase 1
62
- - In Phase 1, **actively expand evidence collection scope**:
63
- - Search `.state/logs/events.jsonl` for pain-related events
64
- - Search codebase using keywords from `reason` field
65
- - Read file paths mentioned in `reason`
66
- - Record `context_source: "inferred"` in output
67
-
68
- **Output Fields**:
69
- ```json
70
- {
71
- "phase": "context_extraction",
72
- "session_id": "xxx or null",
73
- "agent_id": "main",
74
- "context_source": "sessions_history|jsonl|task_embedded|inferred",
75
- "jsonl_available": true,
76
- "conversation_summary": "[User]: ...\n[Assistant]: ... or inferred context description"
77
- }
78
- ```
79
-
80
- **⚠️ Important Notes**:
81
- - Even with NO conversation context, continue diagnosis!
82
- - Use error messages in `reason` field for code search
83
- - Use your intelligence to infer problem background from code and logs
84
-
85
- ---
86
-
87
- ### Phase 1: Evidence Gathering [Required]
88
-
89
- **Goal**: Collect sufficient factual evidence, avoid analysis based on assumptions.
90
-
91
- **Execution Steps**:
92
- 1. Use the Runtime V2 task input/context as the Pain signal source. Do not read `.state/.pain_flag` as the primary diagnosis input.
93
- 2. Read last 100 lines of `.state/logs/events.jsonl`
94
- 3. Use `read_file` or `search_file_content` to search codebase for relevant keywords
95
- 4. Record all evidence sources (file path:line number)
96
-
97
- **Output Fields**:
98
- ```json
99
- {
100
- "phase": "evidence_gathering",
101
- "evidence": {
102
- "pain_context": { "score": 65, "source": "...", "reason": "..." },
103
- "log_snippets": ["..."],
104
- "code_locations": [{ "file": "path/to/file.ts", "line": 42, "snippet": "..." }]
105
- }
106
- }
107
- ```
108
-
109
- **⚠️ Write Report File Immediately After Phase 1**:
110
- Once Phase 1 is complete, **immediately** write the result to the report file (do NOT wait until the end):
111
- ```
112
- write: .state/.diagnostician_report_<TASK_ID>.json
113
- content: {
114
- "taskId": "<TASK_ID>",
115
- "completedAt": "<ISO timestamp>",
116
- "phases": {
117
- "evidence_gathering": { ...Phase 1 result... }
118
- }
119
- }
120
- ```
121
- If the file already exists (a previous Phase was already written), read the existing content, merge the new Phase result into it, then overwrite.
122
-
123
- ---
124
-
125
- ### Phase 2: Causal Chain Construction [Required]
126
-
127
- **Goal**: Build 5 Whys causal chain, each Why must have evidence support.
128
-
129
- **Execution Rules**:
130
-
131
- | Why # | Depth | Checkpoint |
132
- |-------|-------|------------|
133
- | Why 1 | Surface phenomenon | Describe visible error/failure, don't guess cause |
134
- | Why 2 | Direct cause | Why did surface phenomenon occur? Find nearest trigger |
135
- | Why 3 | Process level | Why did direct cause occur? Check for missing processes |
136
- | Why 4 | Architecture level | Why was process missing? Check design/architecture issues |
137
- | Why 5 | Root cause | Why is architecture flawed? Find fixable systemic defect |
138
-
139
- **Termination Conditions** (stop when any met):
140
- - Found a problem that can be fixed directly by modifying code/config
141
- - Found a missing gate/check mechanism
142
- - Cannot propose deeper hypotheses for 2 consecutive Whys
143
-
144
- **Output Fields**:
145
- ```json
146
- {
147
- "phase": "causal_chain",
148
- "chain": [
149
- {
150
- "why": 1,
151
- "question": "Why did this error occur?",
152
- "answer": "...",
153
- "evidence": "file:line or log snippet",
154
- "evidence_type": "code|log|config"
155
- }
156
- ],
157
- "terminated_at": 5,
158
- "termination_reason": "Found fixable systemic defect"
159
- }
160
- ```
161
-
162
- **⚠️ Write Report File Immediately After Phase 2**:
163
- Once Phase 2 is complete, **immediately** merge the result into the report file (overwrite, do not lose Phase 1 content).
164
-
165
- ---
166
-
167
- ### Phase 3: Root Cause Classification [Required]
168
-
169
- **Goal**: Classify root cause, determine repair direction.
170
-
171
- **Classification Criteria**:
172
-
173
- | Category | Definition | Repair Direction |
174
- |----------|------------|------------------|
175
- | `People` | Capability blind spots, cognitive biases, habit issues | Training, docs, reminders |
176
- | `Design` | Architecture defects, process gaps, insufficient gates | Refactor, add checks, automate |
177
- | `Assumption` | Wrong assumptions about env/versions/deps | Explicit checks, version locking, env validation |
178
- | `Tooling` | Tool misconfiguration, API changes | Fix config, upgrade, replace |
179
-
180
- **Guardrail Failure Analysis** (required for Design category):
181
- - Why didn't existing Hooks/Rules catch this?
182
- - Is it missing rules, loose matching, or logic loopholes?
183
-
184
- **Output Fields**:
185
- ```json
186
- {
187
- "phase": "root_cause_classification",
188
- "root_cause": "...",
189
- "category": "Design",
190
- "guardrail_analysis": {
191
- "existing_guards": ["hook_a", "rule_b"],
192
- "failure_reason": "Missing rule: didn't check X condition",
193
- "recommendation": "Add rule to check Y condition"
194
- }
195
- }
196
- ```
197
-
198
- **⚠️ Write Report File Immediately After Phase 3**:
199
- Once Phase 3 is complete, **immediately** merge the result into the report file.
200
-
201
- ---
202
-
203
- ### Phase 4: Principle Extraction [Required]
204
-
205
- **Goal**: Extract reusable **highly abstract principles** to prevent similar issues.
206
-
207
- **⚠️ Key Distinction: Operational Rules vs Principles**
208
-
209
- | Level | Characteristics | Examples |
210
- |-------|-----------------|----------|
211
- | **Operational Rules** (atomic) | Specific to tool calls, file paths, code lines | "Check if directory exists before writing" |
212
- | **Principles** (abstract) | Cross-scenario applicability, describes behavioral norms and values | "Any file write must ensure integrity of target path, including directory structure and permission validation" |
213
-
214
- **Principle Extraction Rules**:
215
- 1. **Abstract**: Extract general behavioral norms from specific errors, don't bind to specific tools or files
216
- 2. **Reusable**: Principle should apply to multiple scenarios, not just this one problem
217
- 3. **Concise**: One sentence should suffice, under 40 words
218
- 4. **Verifiable**: Can clearly judge whether principle was followed
219
- 5. **Deduplication check** (mandatory, cannot skip):
220
- a. **Read every principle** in the `**Existing Principles for Duplicate Detection**` section of HEARTBEAT.md
221
- b. For each existing principle, compare its trigger/action/abstracted with your extracted principle
222
- c. **If core meaning is same or highly similar (>70% overlap)** → set `"duplicate": true`, `"duplicate_of"` to existing principle ID
223
- d. If completely different → set `"duplicate": false`
224
- e. **`duplicate` field MUST appear in output, cannot be omitted**
225
-
226
- **Deduplication example**:
227
- - Existing P_060: "Documented intent without operational feedback is not evolution"
228
- - You want to extract: "Documentation alone does not produce operational feedback"
229
- - Judgment: Same core meaning (both about docs ≠ execution feedback) → `"duplicate": true`, `"duplicate_of": "P_060"`
230
-
231
- **Principle Structure**:
232
- ```json
233
- {
234
- "phase": "principle_extraction",
235
- "principle": {
236
- "id": "System auto-assigns P_XXX format ID — do NOT make one up",
237
- "trigger_pattern": "regex or keywords for auto-matching",
238
- "action": "Specific check/gate/reminder action",
239
- "abstracted_principle": "Highly abstracted principle statement",
240
- "core_axiom_id": "T-01|T-02|T-03|T-04|T-05|T-06|T-07|T-08",
241
- "rationale": "Why this principle prevents the problem",
242
- "duplicate": false,
243
- "duplicate_of": "If similar to existing principle, fill its ID and name",
244
-
245
- "priority": "P0|P1|P2 (optional, default P1. P0=critical security/data, P1=process/quality, P2=style/preference)",
246
- "scope": "general|domain (optional, default general. If domain, fill domain field)",
247
- "domain": "If scope=domain, fill domain name like file_operations, api_calls, config_management",
248
-
249
- "suggested_rules": [
250
- {
251
- "name": "Short rule name",
252
- "type": "hook|gate|skill|test",
253
- "trigger_condition": "When to trigger this rule",
254
- "enforcement": "block|warn|log",
255
- "action": "What specific action to execute",
256
- "implementation_hint": "Suggested file path or module for implementation"
257
- }
258
- ],
259
-
260
- "implementation": {
261
- "type": "hook|rule|template",
262
- "target_file": "Suggested file path to add to",
263
- "code_snippet": "Pseudocode or implementation suggestion"
264
- }
265
- }
266
- }
267
- ```
268
-
269
- **Field Notes**:
270
- - `priority`, `scope`, `domain`, `suggested_rules` are **optional fields**, can omit if unsure
271
- - `suggested_rules` are **suggestions** for grounding principles into concrete rules, each rule should be specific enough to implement directly
272
- - One principle typically corresponds to 1-3 rules, not too many (overly granular) or too few (overly abstract)
273
-
274
- **`abstracted_principle` Writing Guide**:
275
-
276
- ❌ Wrong examples (operational rule level):
277
- - "Check if directory exists before writing"
278
- - "Read first then retry after edit tool failure"
279
- - "Check key validity before calling API"
280
-
281
- ✅ Correct examples (principle level):
282
- - "Any write operation must ensure integrity of target environment"
283
- - "Confirm current state before modifying, avoid operating on stale information"
284
- - "External dependency availability must be validated before invocation"
285
- - "Code modifications must go through Issue process, ensuring traceability and rollback"
286
-
287
- **Phase 4 Output Fields** (also write immediately after completing Phase 4 — merge with previous Phases):
288
- ```json
289
- {
290
- "taskId": "<TASK_ID>",
291
- "completedAt": "<ISO timestamp>",
292
- "phases": {
293
- "context_extraction": { ... Phase 0 result ... },
294
- "evidence_gathering": { ... Phase 1 result ... },
295
- "causal_chain": { ... Phase 2 result ... },
296
- "root_cause_classification": { ... Phase 3 result ... },
297
- "principle_extraction": {
298
- "phase": "principle_extraction",
299
- "classification": {
300
- "category": "development_transient|user_error|Design|Tooling|...",
301
- "confidence": "high|medium|low",
302
- "reproducible": true|false,
303
- "severity": "high|medium|low"
304
- },
305
- "principle": { ... }
306
- }
307
- }
308
- }
309
- ```
310
-
311
- **⚠️ Write Report File Immediately After Phase 4**:
312
- Once Phase 4 is complete, **immediately** merge the result (with `classification` and `principle`) into the report file. This is the final write — all Phases must now be present.
313
-
314
- ---
315
-
316
- ## 📤 Final Output Format
317
-
318
- ### ⚠️ JSON Format Mandatory Constraints (Violation = Output Invalid)
319
-
320
- Your diagnostic report will be **auto-parsed as JSON**. Any format errors will cause results to be discarded.
321
-
322
- **MUST comply**:
323
- 1. **ALL strings MUST use ASCII double quotes `"` (U+0022)** — NO Chinese quotes `""` (U+201C/U+201D), single quotes `'`, or other alternatives
324
- 2. **NO unescaped control characters in JSON** — Use `\n` for newlines, `\t` for tabs
325
- 3. **NO extra text outside JSON** — Don't write "OK, here's..." or similar lead-ins
326
- 4. **NO comments** — JSON doesn't support `//` or `/* */`
327
- 5. **NO trailing comma after last element** — Most common JSON error
328
-
329
- **Self-check method**: Before outputting, mentally verify: every `"` must have matching `"` after it, if content contains `"` it must be escaped as `\"`.
330
-
331
- The final report (written incrementally by each Phase) should look like:
332
-
333
- ```json
334
- {
335
- "taskId": "<TASK_ID>",
336
- "completedAt": "2026-03-24T10:30:00Z",
337
- "phases": {
338
- "context_extraction": { "phase": "context_extraction", "session_id": "...", "context_source": "...", "conversation_summary": "..." },
339
- "evidence_gathering": { "phase": "evidence_gathering", "evidence": { ... } },
340
- "causal_chain": { "phase": "causal_chain", "chain": [...], "terminated_at": 3, "termination_reason": "..." },
341
- "root_cause_classification": { "phase": "root_cause_classification", "root_cause": "...", "category": "Design", "guardrail_analysis": { ... } },
342
- "principle_extraction": {
343
- "phase": "principle_extraction",
344
- "classification": { "category": "Design", "confidence": "high", "reproducible": false, "severity": "low" },
345
- "principle": {
346
- "trigger_pattern": "...",
347
- "action": "...",
348
- "abstracted_principle": "...",
349
- "duplicate": false,
350
- "coreAxiomId": "T-02"
351
- }
352
- }
353
- }
354
- }
355
- ```
356
-
357
- ---
358
-
359
- ## ✅ Completion Protocol
360
-
361
- ### ✅ Checklist (ALL must be satisfied before writing marker)
362
-
363
- Before writing the marker file, you MUST confirm all of the following:
364
-
365
- 1. **Report file exists**: `.diagnostician_report_<TASK_ID>.json` has been written to disk
366
- 2. **All Phase fields present**:
367
- - [ ] `phases.context_extraction` ✅
368
- - [ ] `phases.evidence_gathering` ✅
369
- - [ ] `phases.causal_chain` ✅
370
- - [ ] `phases.root_cause_classification` ✅
371
- - [ ] `phases.principle_extraction` ✅
372
- 3. **Report is valid JSON**: Use read tool to verify file content parses correctly
373
-
374
- ### ✅ Write Marker (Final Step)
375
-
376
- **ONLY after confirming all conditions above are satisfied**, write the marker file:
377
- ```
378
- write: .state/.evolution_complete_<TASK_ID>
379
- content: diagnostic_completed: <ISO timestamp>
380
- outcome: <one-sentence summary>
381
- ```
382
-
383
- ### ❌ Forbidden
384
-
385
- - **NEVER write marker before JSON** — marker means diagnosis is complete, JSON report must exist
386
- - **NEVER skip any Phase** — even if a Phase seems inapplicable, write empty `{}`
387
- - **NEVER use non-ASCII quotes in JSON** — must use `"`, not `"` `"`
388
-
389
- ---
390
-
391
- ## ⚠️ Execution Constraints
392
-
393
- 1. **NO skipping phases**: MUST attempt Phase 0 (context acquisition), then execute Phase 1 → 2 → 3 → 4 in order
394
- 2. **NO evidence-less reasoning**: Each Why's answer MUST have evidence field
395
- 3. **NO vague conclusions**: Root cause must be specific and fixable
396
- 4. **NO skipping principle extraction**: Even for simple issues, extract principles
397
- 5. **NO skipping deduplication**: `duplicate` field MUST appear in principle_extraction output
398
- 6. **NO writing marker before all Phases complete**: Marker comes LAST, only after every Phase is written to JSON
399
-
400
- ---
401
-
402
- ## Example
403
-
404
- **Input**:
405
- ```
406
- Diagnose systemic pain [ID: abc123].
407
- **Source**: tool_failure
408
- **Reason**: Tool edit failed on MEMORY.md
409
- **Trigger Text**: "Cannot write to MEMORY.md: permission denied"
410
- ```
411
-
412
- **Output**:
413
- ```json
414
- {
415
- "diagnosis_report": {
416
- "task_id": "abc123",
417
- "timestamp": "2026-03-24T10:30:00Z",
418
- "summary": "File write failure due to missing directory existence check, causing direct write attempt when target directory doesn't exist",
419
- "phases": {
420
- "evidence_gathering": {
421
- "evidence": {
422
- "pain_context": { "score": 50, "source": "tool_failure", "reason": "edit failed" },
423
- "code_locations": [{ "file": "src/hooks/pain.ts", "line": 78, "snippet": "fs.writeFileSync(path, content)" }]
424
- }
425
- },
426
- "causal_chain": {
427
- "chain": [
428
- { "why": 1, "answer": "Directory doesn't exist when writing file", "evidence": "error: ENOENT", "evidence_type": "log" },
429
- { "why": 2, "answer": "Code didn't check if directory exists", "evidence": "pain.ts:78", "evidence_type": "code" },
430
- { "why": 3, "answer": "Missing directory check gate before file write", "evidence": "no relevant checks in hooks directory", "evidence_type": "code" }
431
- ],
432
- "terminated_at": 3,
433
- "termination_reason": "Found missing gate mechanism"
434
- },
435
- "root_cause_classification": {
436
- "root_cause": "Missing directory existence check gate before file write",
437
- "category": "Design",
438
- "guardrail_analysis": {
439
- "existing_guards": [],
440
- "failure_reason": "No pre-write check hook",
441
- "recommendation": "Add before_file_write hook to check directory existence"
442
- }
443
- },
444
- "principle_extraction": {
445
- "principle": {
446
- "id": "System auto-assigned",
447
- "trigger_pattern": "fs\\.writeFileSync|writeFile|mkdirSync",
448
- "action": "Check if target directory exists before writing, create if not",
449
- "abstracted_principle": "Any write operation must ensure integrity of target environment",
450
- "duplicate": false,
451
- "rationale": "Prevents write failures when directory doesn't exist",
452
- "implementation": {
453
- "type": "hook",
454
- "target_file": "src/hooks/file-safety.ts",
455
- "code_snippet": "if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });"
456
- }
457
- }
458
- }
459
- }
460
- }
461
- }
462
- ```
463
-
464
- ---
465
-
466
- Begin analysis task now.