kenaz 0.3.18 → 0.3.19

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 (308) hide show
  1. package/core/.claude/commands/agent-worker.md +1 -1
  2. package/core/.claude/commands/architect.md +1 -2
  3. package/core/.claude/commands/spec.md +1 -1
  4. package/core/.claude/commands//347/224/242/345/223/201.md +1 -1
  5. package/core/.claude/hooks/__tests__/task-1977-dedupe-guard.test.js +8 -8
  6. package/core/.claude/skills/architect_agent/SKILL.md +11 -92
  7. package/core/.claude/skills/assessment_agent/SKILL.md +0 -1
  8. package/core/.claude/skills/backend_engineer/SKILL.md +3 -6
  9. package/core/.claude/skills/code_reviewer/SKILL.md +1 -1
  10. package/core/.claude/skills/code_reviewer/patterns.yaml +1 -1
  11. package/core/.claude/skills/designer/SKILL.md +3 -6
  12. package/core/.claude/skills/dev_agent/SKILL.md +30 -491
  13. package/core/.claude/skills/developer/SKILL.md +3 -6
  14. package/core/.claude/skills/feature_agent/SKILL.md +3 -17
  15. package/core/.claude/skills/product_manager/SKILL.md +29 -1064
  16. package/core/.claude/skills/qa_engineer/SKILL.md +12 -17
  17. package/core/.claude/skills/spec_optimizer/SKILL.md +25 -275
  18. package/core/.claude/skills/sre_agent/SKILL.md +3 -6
  19. package/core/.collaboration/README.md +2 -3
  20. package/core/.collaboration/core/task-api.js +5 -138
  21. package/core/.collaboration/docs/CLI.md +0 -2
  22. package/core/.failure/INDEX.yaml +6 -40
  23. package/core/.failure/agent-execution/FAIL-013-search-cwd-drift-and-case-mismatch.yaml +1 -1
  24. package/core/.failure/tools/README.md +9 -227
  25. package/core/.formation/bifrost/launch.js +1 -6
  26. package/core/.formation/bifrost/launch.test.js +1 -1
  27. package/core/.formation/bifrost/shared/ansuz-boot-policy.js +3 -3
  28. package/core/.formation/bifrost/shared/ansuz-boot-policy.test.js +1 -2
  29. package/core/.formation/tools/__tests__/m1-hmap-convid.test.js +1 -124
  30. package/core/.formation/tools/dispatch.js +1 -1
  31. package/core/.formation/tools/loader.js +17 -140
  32. package/core/.formation/tools/post-complete.js +0 -31
  33. package/core/.rule/INDEX.yaml +0 -18
  34. package/core/.rule/general/agent-workflow.yaml +14 -164
  35. package/core/.rule/general/project-self-containment.yaml +8 -19
  36. package/core/.rule/general/rust-verify-target.yaml +6 -5
  37. package/core/.rule/general/synapse-code-intelligence.yaml +3 -3
  38. package/core/.specialist/Amelia/capability.yaml +12 -12
  39. package/core/.specialist/Amelia/workflow.yaml +2 -2
  40. package/core/.specialist/Ansuz/SYSTEM_DOC.md +20 -578
  41. package/core/.specialist/Ansuz/cognitive_principles.yaml +2 -3
  42. package/core/.specialist/Ansuz/concepts/boot_rules_summary.yaml +0 -1
  43. package/core/.specialist/Ansuz/concepts/deep_knowledge_pointers.yaml +1 -2
  44. package/core/.specialist/Ansuz/core.yaml +6 -108
  45. package/core/.specialist/Ansuz/guards/lesson_guards.yaml +0 -3
  46. package/core/.specialist/Ansuz/identity_contract.yaml +0 -1
  47. package/core/.specialist/Ansuz/knowledge.yaml +0 -4
  48. package/core/.specialist/Ansuz/rule.yaml +0 -1
  49. package/core/.specialist/Ansuz/tools/handoff-session-identity.test.js +6 -150
  50. package/core/.specialist/tests/runtime-discovery/README.md +1 -1
  51. package/core/.specialist/tools/__tests__/task-2374-usage-counter.test.js +1 -12
  52. package/core/.specialist/tools/prompt-files.test.js +1 -0
  53. package/core/.specialist/tools/task-bridge.js +1 -66
  54. package/core/.system/README.md +11 -552
  55. package/core/.system/collaboration/README.md +10 -174
  56. package/core/CLAUDE.md +1 -6
  57. package/core/KENAZ_CORE_VERSION +1 -1
  58. package/core/dev/scripts/js-yaml-resolution.test.js +1 -1
  59. package/core/dev/scripts/run-rust-tests.js +9 -45
  60. package/core/dev/scripts/rust-verify-worktree.js +4 -4
  61. package/core/dev/scripts/verify-target-dir.js +6 -6
  62. package/core/plugins/kenaz/INVENTORY.md +8 -8
  63. package/core/plugins/kenaz/commands/architect.md +1 -2
  64. package/core/plugins/kenaz/commands/spec.md +1 -1
  65. package/core/plugins/kenaz/commands//347/224/242/345/223/201.md +1 -1
  66. package/core/plugins/kenaz/guidance.md +1 -1
  67. package/core/plugins/kenaz/scripts/sync.js +1 -1
  68. package/core/plugins/kenaz/skills/architect_agent/SKILL.md +11 -92
  69. package/core/plugins/kenaz/skills/assessment_agent/SKILL.md +0 -1
  70. package/core/plugins/kenaz/skills/backend_engineer/SKILL.md +3 -6
  71. package/core/plugins/kenaz/skills/code_reviewer/SKILL.md +1 -1
  72. package/core/plugins/kenaz/skills/code_reviewer/patterns.yaml +1 -1
  73. package/core/plugins/kenaz/skills/designer/SKILL.md +3 -6
  74. package/core/plugins/kenaz/skills/dev_agent/SKILL.md +30 -491
  75. package/core/plugins/kenaz/skills/developer/SKILL.md +3 -6
  76. package/core/plugins/kenaz/skills/feature_agent/SKILL.md +3 -17
  77. package/core/plugins/kenaz/skills/product_manager/SKILL.md +29 -1064
  78. package/core/plugins/kenaz/skills/qa_engineer/SKILL.md +12 -17
  79. package/core/plugins/kenaz/skills/spec_optimizer/SKILL.md +25 -275
  80. package/core/plugins/kenaz/skills/sre_agent/SKILL.md +3 -6
  81. package/package.json +6 -6
  82. package/core/.claude/commands/archive.md +0 -24
  83. package/core/.claude/commands/init.md +0 -112
  84. package/core/.claude/commands/legacy_dev.md +0 -18
  85. package/core/.claude/commands/product-review.md +0 -131
  86. package/core/.claude/commands/strategy.md +0 -141
  87. package/core/.claude/commands/sunny.md +0 -1
  88. package/core/.claude/commands//347/224/242/345/223/201/346/252/242/350/246/226.md +0 -129
  89. package/core/.claude/commands//351/200/262/345/272/246.md +0 -15
  90. package/core/.claude/hooks/__tests__/substrate.test.js +0 -122
  91. package/core/.claude/hooks/_substrate-paths.js +0 -95
  92. package/core/.claude/hooks/context-check.js +0 -51
  93. package/core/.claude/hooks/fatigue-check.js +0 -52
  94. package/core/.claude/hooks/handoff-snapshot-on-commit.js +0 -154
  95. package/core/.claude/hooks/handoff-snapshot-on-question.js +0 -158
  96. package/core/.claude/hooks/handoff-staleness.js +0 -197
  97. package/core/.claude/hooks/jev-thalamus-context.js +0 -17
  98. package/core/.claude/hooks/jev-thalamus-context.test.js +0 -41
  99. package/core/.claude/hooks/lease-release.js +0 -119
  100. package/core/.claude/hooks/lease-touch.js +0 -96
  101. package/core/.claude/hooks/reflex-feedback.js +0 -5
  102. package/core/.claude/hooks/session-init.ps1 +0 -49
  103. package/core/.claude/hooks/sound-event.js +0 -70
  104. package/core/.claude/hooks/sound-event.sh +0 -37
  105. package/core/.claude/hooks/stream-delta.js +0 -169
  106. package/core/.claude/no-hooks.settings.json +0 -3
  107. package/core/.claude/skills/legacy_dev/SKILL.md +0 -202
  108. package/core/.claude/skills/sunny/SKILL.md +0 -74
  109. package/core/.collaboration/cli/commands/assign.js +0 -39
  110. package/core/.collaboration/cli/commands/claim.js +0 -33
  111. package/core/.collaboration/cli/commands/complete.js +0 -44
  112. package/core/.collaboration/cli/commands/create.js +0 -110
  113. package/core/.collaboration/cli/commands/get.js +0 -83
  114. package/core/.collaboration/cli/commands/index.js +0 -52
  115. package/core/.collaboration/cli/commands/list.js +0 -51
  116. package/core/.collaboration/cli/commands/lock.js +0 -45
  117. package/core/.collaboration/cli/commands/rebuild.js +0 -39
  118. package/core/.collaboration/cli/commands/search.js +0 -61
  119. package/core/.collaboration/cli/commands/stats.js +0 -61
  120. package/core/.collaboration/cli/commands/transfer.js +0 -41
  121. package/core/.collaboration/cli/commands/unlock.js +0 -48
  122. package/core/.collaboration/cli/formatters/help-formatter.js +0 -70
  123. package/core/.collaboration/cli/formatters/index.js +0 -7
  124. package/core/.collaboration/cli/task-cli.js +0 -46
  125. package/core/.collaboration/cli/utils/arg-parser.js +0 -74
  126. package/core/.collaboration/cli/utils/git-user.js +0 -25
  127. package/core/.collaboration/cli/utils/index.js +0 -9
  128. package/core/.collaboration/cli/utils/output.js +0 -10
  129. package/core/.collaboration/config/default.yaml +0 -189
  130. package/core/.collaboration/core/conflict-resolver.js +0 -461
  131. package/core/.collaboration/core/conflict-resolver.test.js +0 -389
  132. package/core/.collaboration/core/migrate-legacy.js +0 -260
  133. package/core/.collaboration/docs/API.md +0 -787
  134. package/core/.collaboration/docs/ARCHITECTURE.md +0 -596
  135. package/core/.collaboration/docs/FAQ.md +0 -695
  136. package/core/.collaboration/docs/MIGRATION.md +0 -804
  137. package/core/.collaboration/docs/examples/README.md +0 -320
  138. package/core/.collaboration/docs/examples/advanced-queries.js +0 -261
  139. package/core/.collaboration/docs/examples/basic-usage.js +0 -184
  140. package/core/.collaboration/docs/examples/team-workflow.js +0 -352
  141. package/core/.failure/agent-execution/FAIL-001-agent-no-output.yaml +0 -391
  142. package/core/.failure/agent-execution/FAIL-007-pm-lead-wrong-team-invocation.yaml +0 -0
  143. package/core/.failure/agent-execution/FAIL-010-phase0-poem-format-skipped.yaml +0 -28
  144. package/core/.failure/agent-execution/FAIL-010-skipping-cognitive-checkpoint-after-verification.yaml +0 -59
  145. package/core/.failure/agent-execution/FAIL-012-grep-shortcut-during-investigation.yaml +0 -85
  146. package/core/.failure/architecture/FAIL-006-python-version-compatibility.yaml +0 -445
  147. package/core/.failure/pipeline/FAIL-003-queue-pollution.yaml +0 -335
  148. package/core/.failure/pipeline/README.md +0 -95
  149. package/core/.failure/retired/FAIL-009-skipping-synapse-pulse-before-code-change.yaml +0 -49
  150. package/core/.failure/tools/USAGE_GUIDE.md +0 -323
  151. package/core/.failure/tools/check_failures.ps1 +0 -387
  152. package/core/.failure/tools/log_failure.ps1 +0 -474
  153. package/core/.formation/.episode-input.json +0 -10
  154. package/core/.formation/.merge-lock +0 -1
  155. package/core/.formation/lead.yaml +0 -118
  156. package/core/.formation/legacy.bak/designer.yaml +0 -57
  157. package/core/.formation/legacy.bak/pm.yaml +0 -57
  158. package/core/.formation/legacy.bak/qa.yaml +0 -57
  159. package/core/.formation/legacy.bak/review.yaml +0 -62
  160. package/core/.formation/legacy.bak/scheduler.yaml +0 -129
  161. package/core/.formation/legacy.bak/sre.yaml +0 -57
  162. package/core/.formation/role-map.yaml +0 -274
  163. package/core/.formation/roles/_shared/modules/code_review.yaml +0 -98
  164. package/core/.formation/roles/_shared/modules/security.yaml +0 -103
  165. package/core/.formation/roles/_shared/modules/testing.yaml +0 -14
  166. package/core/.formation/roles/backend/role.yaml +0 -93
  167. package/core/.formation/roles/code_reviewer/role.yaml +0 -102
  168. package/core/.formation/roles/database_optimizer/role.yaml +0 -107
  169. package/core/.formation/roles/designer/role.yaml +0 -66
  170. package/core/.formation/roles/developer/role.yaml +0 -75
  171. package/core/.formation/roles/frontend/role.yaml +0 -134
  172. package/core/.formation/roles/incident_response/role.yaml +0 -89
  173. package/core/.formation/roles/qa/role.yaml +0 -89
  174. package/core/.formation/roles/security/role.yaml +0 -87
  175. package/core/.formation/roles/sre/role.yaml +0 -66
  176. package/core/.formation/skills/coordinator.yaml +0 -52
  177. package/core/.formation/solo/diagnosis.yaml +0 -78
  178. package/core/.formation/solo/strategy.yaml +0 -121
  179. package/core/.formation/tests/hello.txt +0 -2
  180. package/core/.formation/tools/coordinator.js +0 -350
  181. package/core/.formation/tools/jev-correction.js +0 -214
  182. package/core/.formation/tools/jev-correction.test.js +0 -178
  183. package/core/.formation/tools/log-reader.js +0 -232
  184. package/core/.formation/tools/revert-daemon-state.js +0 -162
  185. package/core/.formation/tools/test-drift.js +0 -148
  186. package/core/.formation/unit/heimdall.yaml +0 -96
  187. package/core/.formation/unit/plan.yaml +0 -67
  188. package/core/.formation/unit/think.yaml +0 -58
  189. package/core/.kenaz/MUNINN_SNAPSHOT9_EPISODE.json +0 -32
  190. package/core/.kenaz/MUNINN_SNAPSHOT9_RUNE.json +0 -23
  191. package/core/.kenaz/MUNINN_SNAPSHOT9_SUMMARY.md +0 -89
  192. package/core/.kenaz/ash_TASK_1428-20260507.json +0 -14
  193. package/core/.kenaz/muninn_episode_write.ps1 +0 -17
  194. package/core/.kenaz/muninn_snapshot11_rune_candidates.md +0 -63
  195. package/core/.kenaz/muninn_snapshot1_rune_candidates.md +0 -49
  196. package/core/.kenaz/runes_TASK_1428.json +0 -57
  197. package/core/.kenaz/tmp_heimdall_proposal_8d3e392.json +0 -13
  198. package/core/.kenaz/tmp_props.json +0 -1
  199. package/core/.kenaz/tmp_sounddrop_t1_prompt.txt +0 -371
  200. package/core/.rule/MECHANIZED.md +0 -61
  201. package/core/.rule/general/cortex-memory-recall.yaml +0 -446
  202. package/core/.rule/general/pipeline.yaml +0 -246
  203. package/core/.rule/general/sunny-access-control.yaml +0 -60
  204. package/core/.rule/general/system-invariants.yaml +0 -231
  205. package/core/.rule/pipeline/PPL-002-completed-task-archival.yaml +0 -528
  206. package/core/.rule/pipeline/auto-update.yaml +0 -282
  207. package/core/.rule/pipeline/task-execution.yaml +0 -365
  208. package/core/.specialist/Ansuz/concepts/phase_protocol.yaml +0 -65
  209. package/core/.specialist/Ansuz/experiments/boot_ablation_replay.js +0 -197
  210. package/core/.specialist/Ansuz/tools/bootstrap-anchors.js +0 -289
  211. package/core/.specialist/Ansuz/workflow.yaml +0 -1225
  212. package/core/.specialist/experiments/rg_benchmark.js +0 -523
  213. package/core/.specialist/experiments/rg_benchmark_results.json +0 -27
  214. package/core/.specialist/tools/jev-optional-context.js +0 -107
  215. package/core/.specialist/tools/jev-optional-context.test.js +0 -152
  216. package/core/.specialist/tools/memory-action-log.js +0 -839
  217. package/core/.specialist/tools/phase-gate.js +0 -3534
  218. package/core/.specialist/tools/phase-gate.test.js +0 -85
  219. package/core/.specialist/tools/precompute-runner.js +0 -444
  220. package/core/.specialist/tools/rule-engine.js +0 -621
  221. package/core/.specialist/tools/task-bridge-jev.test.js +0 -170
  222. package/core/.synapse/memory-shared.json.sync +0 -1
  223. package/core/.system/agent-skills/README.md +0 -724
  224. package/core/.system/cli-tools/README.md +0 -724
  225. package/core/.system/cortex/MODULES.md +0 -1046
  226. package/core/.system/dashboard/FRONTEND.md +0 -812
  227. package/core/.system/dashboard/README.md +0 -737
  228. package/core/.system/failure/README.md +0 -723
  229. package/core/.system/formation/LEGACY_SKILLS.md +0 -974
  230. package/core/.system/formation/POST_COMPLETE.md +0 -602
  231. package/core/.system/formation/README.md +0 -1094
  232. package/core/.system/formation/TOOLS_REFERENCE.md +0 -1145
  233. package/core/.system/kenaz/README.md +0 -787
  234. package/core/.system/memory/README.md +0 -719
  235. package/core/.system/pipeline/README.md +0 -712
  236. package/core/.system/rule/README.md +0 -794
  237. package/core/.system/sunny/README.md +0 -476
  238. package/core/.system/sunny/RULES.json +0 -89
  239. package/core/.system/sunny/knowledge/INDEX.md +0 -37
  240. package/core/.system/sunny/knowledge/agent-teams-api.md +0 -0
  241. package/core/.system/sunny/knowledge/ansuz-specialist.md +0 -500
  242. package/core/.system/sunny/knowledge/claude-cli-spawn.md +0 -177
  243. package/core/.system/sunny/knowledge/collaboration-api.md +0 -925
  244. package/core/.system/sunny/teammates/README.md +0 -107
  245. package/core/.system/sunny/teammates/how_to_use.yaml +0 -101
  246. package/core/.system/sunny/teammates/tools/headless/launcher.js +0 -318
  247. package/core/.system/sunny/teammates/tools/powershell/launcher.js +0 -241
  248. package/core/.system/sunny/teammates/tools/powershell/start.bat +0 -50
  249. package/core/.system/sunny/teammates/tools/utils/env.js +0 -96
  250. package/core/.system/sunny/teammates/tools/utils/format-output.js +0 -329
  251. package/core/.system/sunny/tools.json +0 -101
  252. package/core/dev/scripts/cleanup-queue.js +0 -184
  253. package/core/dev/scripts/cleanup_queue.js +0 -86
  254. package/core/dev/scripts/legacy/README.md +0 -39
  255. package/core/dev/scripts/legacy/dev_agent_scheduler.ps1.bak +0 -536
  256. package/core/dev/scripts/legacy/multi_agent_scheduler.ps1.bak +0 -1978
  257. package/core/dev/scripts/matrix/CLI_README.md +0 -214
  258. package/core/dev/scripts/matrix/README.md +0 -310
  259. package/core/dev/scripts/matrix/package-lock.json +0 -4266
  260. package/core/dev/scripts/matrix/package.json +0 -55
  261. package/core/dev/scripts/matrix/src/abbreviations.ts +0 -295
  262. package/core/dev/scripts/matrix/src/cli/commands/convert.ts +0 -211
  263. package/core/dev/scripts/matrix/src/cli/commands/create.ts +0 -95
  264. package/core/dev/scripts/matrix/src/cli/commands/delete.ts +0 -102
  265. package/core/dev/scripts/matrix/src/cli/commands/list-tags.ts.wip +0 -140
  266. package/core/dev/scripts/matrix/src/cli/commands/manage-tags.ts.wip +0 -173
  267. package/core/dev/scripts/matrix/src/cli/commands/query.ts +0 -261
  268. package/core/dev/scripts/matrix/src/cli/commands/read.ts +0 -77
  269. package/core/dev/scripts/matrix/src/cli/commands/stats.ts.wip +0 -168
  270. package/core/dev/scripts/matrix/src/cli/commands/tokens.ts.wip +0 -126
  271. package/core/dev/scripts/matrix/src/cli/commands/update.ts +0 -147
  272. package/core/dev/scripts/matrix/src/cli/commands/validate.ts +0 -275
  273. package/core/dev/scripts/matrix/src/cli/index.ts +0 -350
  274. package/core/dev/scripts/matrix/src/cli/utils/file-handler.ts +0 -72
  275. package/core/dev/scripts/matrix/src/cli/utils/logger.ts +0 -65
  276. package/core/dev/scripts/matrix/src/index.ts +0 -62
  277. package/core/dev/scripts/matrix/src/indexer/tag-indexer.ts +0 -165
  278. package/core/dev/scripts/matrix/src/parser.ts +0 -281
  279. package/core/dev/scripts/matrix/src/serializer.ts +0 -151
  280. package/core/dev/scripts/matrix/src/validator.ts +0 -301
  281. package/core/dev/scripts/matrix/tests/abbreviations.test.ts +0 -122
  282. package/core/dev/scripts/matrix/tests/cli.test.ts +0 -177
  283. package/core/dev/scripts/matrix/tests/convert.test.ts +0 -143
  284. package/core/dev/scripts/matrix/tests/parser.test.ts +0 -203
  285. package/core/dev/scripts/matrix/tests/query.test.ts +0 -85
  286. package/core/dev/scripts/matrix/tests/serializer.test.ts +0 -197
  287. package/core/dev/scripts/matrix/tests/validate.test.ts +0 -141
  288. package/core/dev/scripts/matrix/tests/validator.test.ts +0 -167
  289. package/core/dev/scripts/matrix/tsconfig.json +0 -20
  290. package/core/dev/scripts/matrix/types/index.d.ts +0 -111
  291. package/core/dev/scripts/matrix/types/index.d.ts.map +0 -1
  292. package/core/dev/scripts/matrix/types/index.js +0 -8
  293. package/core/dev/scripts/matrix/types/index.js.map +0 -1
  294. package/core/dev/scripts/matrix/types/index.ts +0 -124
  295. package/core/dev/scripts/memory-usage-report.js +0 -152
  296. package/core/dev/scripts/probe/ansuz-scaffold-ablation.js +0 -579
  297. package/core/dev/scripts/probe/ansuz-scaffold-ablation.test.js +0 -244
  298. package/core/dev/scripts/probe/hook-latency-probe.js +0 -315
  299. package/core/dev/scripts/probe/hook-latency-probe.test.js +0 -105
  300. package/core/dev/scripts/probe/prediction-signal-auc.js +0 -483
  301. package/core/dev/scripts/probe/prediction-signal-auc.test.js +0 -200
  302. package/core/dev/scripts/test-pty-ws-tunnel.js +0 -229
  303. package/core/dev/scripts/validate_pipeline.js +0 -197
  304. package/core/dev/spikes/task2145-evidence-20261004/backend-log-excerpt.txt +0 -56
  305. package/core/dev/spikes/task2145-evidence-20261004/graph.shadow +0 -0
  306. package/core/dev/spikes/task2145-evidence-20261004/graph.wal +0 -0
  307. package/core/dev/spikes/task2145-evidence-20261004/graph_corrupt_suspect.marker +0 -1
  308. package/core/plugins/kenaz/commands/strategy.md +0 -141
@@ -1,241 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Sunny Team Launcher - Window Mode
4
- * 開新視窗執行 Claude + Agent Teams
5
- *
6
- * 使用方式:
7
- * - 正常調用:開新視窗執行
8
- * - --run 參數:直接在當前終端執行(供新視窗內部使用)
9
- */
10
-
11
- const { spawn } = require('child_process');
12
- const path = require('path');
13
- const { getClaudeEnv } = require('../utils/env');
14
-
15
- const CONFIG = {
16
- cwd: process.cwd(),
17
- teammateMode: 'in-process'
18
- };
19
-
20
- // 系統前置指示
21
- const SYSTEM_PREFIX = `You are the TEAM LEAD using Claude Code's OFFICIAL "agent teams" feature.
22
-
23
- YOUR ROLE: Team Lead
24
- - You are RESPONSIBLE for this task's success or failure.
25
- - You MUST coordinate teammates and ensure they complete their work.
26
- - You CANNOT end the session until ALL teammates have reported back.
27
- - If you end early, the task FAILS and it's YOUR fault.
28
-
29
- This is NOT the project's .formation/ directory system. Do NOT read .formation/ files.
30
- To create teammates, use natural language like: "Create a teammate named X who handles Y"
31
- Each teammate is a separate Claude instance running in parallel.
32
-
33
- `;
34
-
35
- // 共用後置指示
36
- const AUTO_EXECUTE = `
37
-
38
- BEFORE YOU START - OUTPUT YOUR PLAN:
39
- First, explain exactly what you will do step by step:
40
- 1. What teammates will you create?
41
- 2. How will you wait for their results?
42
- 3. What tools will you use to poll for messages?
43
- 4. When will you know all teammates are done?
44
-
45
- RULES:
46
- 1. Do NOT ask questions. Execute immediately after stating your plan.
47
- 2. Do NOT read CLAUDE.md - this is a separate system.
48
- 3. Create teammates using natural language descriptions.
49
- 4. IMPORTANT: Use "sonnet" model for ALL teammates to reduce cost.
50
-
51
- WAITING FOR TEAMMATES - CRITICAL:
52
- 5. After spawning ALL teammates, you MUST enter a polling loop.
53
- 6. In the loop: call "sleep 5" with Bash, then check if teammates sent messages.
54
- 7. Teammates send results via SendMessage - you will see them as incoming user messages.
55
- 8. Keep looping (sleep + check) until you have received messages from ALL teammates.
56
- 9. Do NOT end until you have ACTUAL CONTENT from every single teammate.
57
- 10. If a teammate is slow, keep waiting - do NOT give up or timeout early.
58
- 11. Only after ALL teammates report back, synthesize their findings into final answer.`;
59
-
60
- const TEAM_PRESETS = {
61
- developer: {
62
- prompt: `${SYSTEM_PREFIX}Create an agent team with 3 teammates for development:
63
- 1. "Frontend" - handles React/TypeScript UI implementation
64
- 2. "Backend" - handles API and database work
65
- 3. "Reviewer" - reviews changes and checks for issues
66
-
67
- Start working on the task immediately.${AUTO_EXECUTE}`
68
- },
69
- strategy: {
70
- prompt: `${SYSTEM_PREFIX}Create an agent team with 3 teammates for strategic analysis:
71
- 1. "Architect" - handles system design and technical decisions
72
- 2. "Researcher" - investigates options and gathers information
73
- 3. "Critic" - challenges assumptions and finds flaws
74
-
75
- Analyze and discuss the task, then provide recommendations.${AUTO_EXECUTE}`
76
- },
77
- review: {
78
- prompt: `${SYSTEM_PREFIX}Create an agent team with 3 teammates for code review:
79
- 1. "Security" - checks for vulnerabilities
80
- 2. "Performance" - checks for bottlenecks
81
- 3. "Testing" - validates test coverage
82
-
83
- Review the codebase and report findings.${AUTO_EXECUTE}`
84
- },
85
- debug: {
86
- prompt: `${SYSTEM_PREFIX}Create an agent team with 3 teammates for debugging:
87
- 1. "Investigator-A" - investigates hypothesis A
88
- 2. "Investigator-B" - investigates hypothesis B
89
- 3. "Investigator-C" - investigates hypothesis C
90
-
91
- Each investigates a different angle. Debate and disprove each other's theories until consensus.${AUTO_EXECUTE}`
92
- }
93
- };
94
-
95
- /**
96
- * 直接在當前終端執行 Claude 互動模式
97
- * 直接把 prompt 作為參數(簡化版 prompt 避免截斷)
98
- */
99
- function runClaude(options = {}) {
100
- const {
101
- prompt,
102
- task,
103
- cwd = CONFIG.cwd,
104
- teammateMode = CONFIG.teammateMode
105
- } = options;
106
-
107
- const env = getClaudeEnv();
108
-
109
- console.log(`☀️ Starting Claude Agent Team (Interactive Mode)...`);
110
- console.log(` Mode: ${teammateMode}`);
111
- console.log(` Task: ${task || '(none)'}`);
112
- console.log(` CWD: ${cwd}`);
113
- console.log(`----------------------------------------`);
114
-
115
- // Windows 需要用 claude.cmd
116
- const claudeCmd = process.platform === 'win32' ? 'claude.cmd' : 'claude';
117
-
118
- // 組裝完整 prompt(包含 task)
119
- const fullPrompt = task ? `${prompt} Task: ${task}` : prompt;
120
-
121
- // Windows CMD 處理:
122
- // 1. 換行符會破壞 shell 解析,替換成空格
123
- // 2. 雙引號用 "" 轉義
124
- const escapedPrompt = fullPrompt
125
- .replace(/\r?\n/g, ' ')
126
- .replace(/"/g, '""');
127
-
128
- // 組裝完整命令(用引號包住 prompt)
129
- const cmd = `${claudeCmd} "${escapedPrompt}" --dangerously-skip-permissions --allowedTools Bash,Read,Edit,Write,Glob,Grep,WebFetch,Task --teammate-mode ${teammateMode}`;
130
-
131
- console.log(` CMD: ${cmd.substring(0, 120)}...`);
132
-
133
- const child = spawn(cmd, [], {
134
- cwd,
135
- env,
136
- stdio: 'inherit',
137
- shell: true
138
- });
139
-
140
- child.on('close', (code) => {
141
- console.log(`\n----------------------------------------`);
142
- console.log(`☀️ Claude exited with code ${code}`);
143
- });
144
-
145
- return child;
146
- }
147
-
148
- /**
149
- * 開新視窗執行 start.bat
150
- */
151
- function launchInNewWindow(preset, task) {
152
- const startBatPath = path.join(__dirname, 'start.bat');
153
- const taskArg = task ? `"${task}"` : '';
154
- const fullCmd = `start "" cmd /K ""${startBatPath}" ${preset} ${taskArg}"`;
155
-
156
- spawn('cmd', ['/c', fullCmd], {
157
- stdio: 'inherit',
158
- shell: true,
159
- detached: true
160
- }).unref();
161
-
162
- console.log(`☀️ New window launched.`);
163
- }
164
-
165
- // CLI 入口
166
- if (require.main === module) {
167
- const args = process.argv.slice(2);
168
-
169
- if (args.includes('--help') || args.includes('-h')) {
170
- console.log(`
171
- ☀️ Sunny Team Launcher - Window Mode
172
-
173
- Usage:
174
- node launcher.js [options]
175
-
176
- Options:
177
- --preset <name> Use preset team (developer|strategy|review|debug)
178
- --task <prompt> Custom task description
179
- --mode <mode> Teammate display mode (in-process|tmux)
180
- --cwd <path> Working directory
181
- --run Run directly (don't open new window)
182
- --list-presets Show available presets
183
-
184
- Examples:
185
- node launcher.js --preset developer --task "Implement user auth"
186
- node launcher.js --preset debug --task "Find memory leak"
187
- `);
188
- process.exit(0);
189
- }
190
-
191
- if (args.includes('--list-presets')) {
192
- console.log('\n☀️ Available Team Presets:\n');
193
- Object.entries(TEAM_PRESETS).forEach(([name, config]) => {
194
- console.log(` ${name}:`);
195
- console.log(` ${config.prompt.split('\n')[0]}`);
196
- console.log();
197
- });
198
- process.exit(0);
199
- }
200
-
201
- // 解析參數
202
- const getArg = (flag) => {
203
- const idx = args.indexOf(flag);
204
- return idx !== -1 && args[idx + 1] ? args[idx + 1] : null;
205
- };
206
-
207
- const preset = getArg('--preset');
208
- const task = getArg('--task');
209
- const mode = getArg('--mode') || CONFIG.teammateMode;
210
- const cwd = getArg('--cwd') || CONFIG.cwd;
211
- const runDirectly = args.includes('--run');
212
-
213
- // 組裝 prompt
214
- let prompt = null;
215
- if (preset && TEAM_PRESETS[preset]) {
216
- prompt = TEAM_PRESETS[preset].prompt;
217
- } else if (task) {
218
- prompt = `Create an agent team to help with the task.`;
219
- }
220
-
221
- if (runDirectly) {
222
- // 直接執行模式(在新視窗內部使用)
223
- if (!prompt) {
224
- console.log('❌ No task specified.');
225
- process.exit(1);
226
- }
227
- runClaude({ prompt, task, cwd, teammateMode: mode });
228
- } else {
229
- // 開新視窗模式
230
- if (!prompt) {
231
- console.log('☀️ No task specified. Use --preset or --task to specify a task.\n');
232
- console.log('Examples:');
233
- console.log(' node launcher.js --preset debug --task "Find the bug"');
234
- console.log(' node launcher.js --preset developer --task "Add login feature"');
235
- process.exit(0);
236
- }
237
- launchInNewWindow(preset, task);
238
- }
239
- }
240
-
241
- module.exports = { runClaude, launchInNewWindow, TEAM_PRESETS, CONFIG };
@@ -1,50 +0,0 @@
1
- @echo off
2
- REM Sunny Team Launcher - Windows Batch
3
- REM 用法: start.bat <preset> [task]
4
- REM 範例: start.bat debug "找出記憶體洩漏原因"
5
-
6
- setlocal enabledelayedexpansion
7
-
8
- set PRESET=%1
9
- set TASK=%~2
10
-
11
- if "%PRESET%"=="" (
12
- echo ☀️ Sunny Team Launcher
13
- echo.
14
- echo 用法: start.bat ^<preset^> [task]
15
- echo.
16
- echo Presets:
17
- echo debug - 3 個調查員從不同角度分析問題
18
- echo developer - Frontend + Backend + Reviewer 開發團隊
19
- echo strategy - Architect + Researcher + Critic 策略團隊
20
- echo review - Security + Performance + Testing 審查團隊
21
- echo.
22
- echo 範例:
23
- echo start.bat debug "為什麼 auth.js 會 crash"
24
- echo start.bat developer "實作用戶登入功能"
25
- exit /b 0
26
- )
27
-
28
- REM 取得腳本所在目錄
29
- set SCRIPT_DIR=%~dp0
30
-
31
- REM 切到專案根目錄(往上 5 層:tools/powershell -> tools -> teammates -> sunny -> .system -> 根目錄)
32
- cd /d "%SCRIPT_DIR%..\..\..\..\..\"
33
-
34
- echo ☀️ Starting Sunny Team...
35
- echo Preset: %PRESET%
36
- echo Task: %TASK%
37
- echo CWD: %CD%
38
- echo ----------------------------------------
39
-
40
- REM 直接執行 launcher.js --run 模式
41
- if "%TASK%"=="" (
42
- node "%SCRIPT_DIR%launcher.js" --run --preset %PRESET%
43
- ) else (
44
- node "%SCRIPT_DIR%launcher.js" --run --preset %PRESET% --task "%TASK%"
45
- )
46
-
47
- echo.
48
- echo ----------------------------------------
49
- echo ☀️ Team session ended.
50
- pause
@@ -1,96 +0,0 @@
1
- /**
2
- * Sunny Team - 環境變數配置
3
- */
4
-
5
- const fs = require('fs');
6
- const path = require('path');
7
- const { execSync } = require('child_process');
8
-
9
- /**
10
- * 用 where 指令搜尋 Git,推導 bash.exe 路徑
11
- */
12
- function detectGitBash() {
13
- try {
14
- // Windows: where git → C:\Program Files\Git\cmd\git.exe
15
- // 從 git.exe 路徑推導 bash.exe 路徑
16
- const gitPath = execSync('where git', { encoding: 'utf8' })
17
- .split('\n')[0]
18
- .trim();
19
-
20
- if (gitPath) {
21
- // git.exe 通常在 Git\cmd\git.exe,bash.exe 在 Git\bin\bash.exe
22
- const gitDir = path.dirname(path.dirname(gitPath));
23
- const bashPath = path.join(gitDir, 'bin', 'bash.exe');
24
-
25
- if (fs.existsSync(bashPath)) {
26
- return bashPath;
27
- }
28
- }
29
- } catch (e) {
30
- // where git 失敗,fallback 到硬編碼路徑
31
- }
32
-
33
- // Fallback: 常見路徑
34
- const fallbackPaths = [
35
- 'C:\\Program Files\\Git\\bin\\bash.exe',
36
- 'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
37
- 'D:\\Program Files\\Git\\bin\\bash.exe'
38
- ];
39
-
40
- for (const p of fallbackPaths) {
41
- if (fs.existsSync(p)) {
42
- return p;
43
- }
44
- }
45
-
46
- return null;
47
- }
48
-
49
- /**
50
- * 取得啟動 Claude 所需的環境變數
51
- */
52
- function getClaudeEnv(options = {}) {
53
- const env = { ...process.env };
54
-
55
- // 啟用 agent teams(實驗性功能)
56
- env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS = '1';
57
-
58
- // 移除 CLAUDECODE 避免 nested session 錯誤
59
- delete env.CLAUDECODE;
60
-
61
- // Windows: 設定 git-bash 路徑
62
- if (process.platform === 'win32') {
63
- if (!env.CLAUDE_CODE_GIT_BASH_PATH) {
64
- const gitBash = detectGitBash();
65
- if (gitBash) {
66
- env.CLAUDE_CODE_GIT_BASH_PATH = gitBash;
67
- }
68
- }
69
- }
70
-
71
- // 覆蓋自訂設定
72
- if (options.env) {
73
- Object.assign(env, options.env);
74
- }
75
-
76
- return env;
77
- }
78
-
79
- /**
80
- * 印出環境變數資訊
81
- */
82
- function printEnvInfo(env) {
83
- console.log(' ENV:');
84
- if (env.CLAUDE_CODE_GIT_BASH_PATH) {
85
- console.log(` Git Bash: ${env.CLAUDE_CODE_GIT_BASH_PATH}`);
86
- }
87
- if (env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS) {
88
- console.log(` Agent Teams: enabled`);
89
- }
90
- }
91
-
92
- module.exports = {
93
- detectGitBash,
94
- getClaudeEnv,
95
- printEnvInfo
96
- };