@neural-node-labs/xcoder-dna 0.0.0-stage → 1.5.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 (406) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/dist/agents/agent-catalog.d.ts +87 -0
  4. package/dist/agents/agent-catalog.js +159 -0
  5. package/dist/agents/agent-registry.d.ts +76 -0
  6. package/dist/agents/agent-registry.js +189 -0
  7. package/dist/agents/ai-chat-debate.d.ts +36 -0
  8. package/dist/agents/ai-chat-debate.js +300 -0
  9. package/dist/agents/ai-chat-report-writer.d.ts +7 -0
  10. package/dist/agents/ai-chat-report-writer.js +100 -0
  11. package/dist/agents/duplicate-detector.d.ts +41 -0
  12. package/dist/agents/duplicate-detector.js +65 -0
  13. package/dist/agents/genesis-agent.d.ts +61 -0
  14. package/dist/agents/genesis-agent.js +340 -0
  15. package/dist/agents/samurai-agent.d.ts +53 -0
  16. package/dist/agents/samurai-agent.js +279 -0
  17. package/dist/agents/sub-agent.d.ts +56 -0
  18. package/dist/agents/sub-agent.js +353 -0
  19. package/dist/backlog/backlog-requirement-validator.d.ts +10 -0
  20. package/dist/backlog/backlog-requirement-validator.js +60 -0
  21. package/dist/backlog/backlog-store.d.ts +29 -0
  22. package/dist/backlog/backlog-store.js +148 -0
  23. package/dist/backlog/po-agent.d.ts +16 -0
  24. package/dist/backlog/po-agent.js +121 -0
  25. package/dist/backlog/types.d.ts +25 -0
  26. package/dist/backlog/types.js +4 -0
  27. package/dist/bench/run.d.ts +11 -0
  28. package/dist/bench/run.js +185 -0
  29. package/dist/bench/types.d.ts +50 -0
  30. package/dist/bench/types.js +1 -0
  31. package/dist/cli/delegate.d.ts +90 -0
  32. package/dist/cli/delegate.js +220 -0
  33. package/dist/cli/swarm.d.ts +10 -0
  34. package/dist/cli/swarm.js +100 -0
  35. package/dist/cli/task.d.ts +14 -0
  36. package/dist/cli/task.js +121 -0
  37. package/dist/cli/wbc-arg.d.ts +6 -0
  38. package/dist/cli/wbc-arg.js +40 -0
  39. package/dist/cli/wbc.d.ts +45 -0
  40. package/dist/cli/wbc.js +98 -0
  41. package/dist/commands/license.d.ts +9 -0
  42. package/dist/commands/license.js +140 -0
  43. package/dist/commands/release.d.ts +44 -0
  44. package/dist/commands/release.js +180 -0
  45. package/dist/commands/test.d.ts +50 -0
  46. package/dist/commands/test.js +385 -0
  47. package/dist/config/env-guard.d.ts +35 -0
  48. package/dist/config/env-guard.js +100 -0
  49. package/dist/config/env-snapshot.d.ts +18 -0
  50. package/dist/config/env-snapshot.js +30 -0
  51. package/dist/config/loadConfig.d.ts +82 -0
  52. package/dist/config/loadConfig.js +249 -0
  53. package/dist/config/secure-mode.d.ts +29 -0
  54. package/dist/config/secure-mode.js +63 -0
  55. package/dist/config/user-config.d.ts +39 -0
  56. package/dist/config/user-config.js +202 -0
  57. package/dist/engine/reasoning-engine.d.ts +21 -0
  58. package/dist/engine/reasoning-engine.js +59 -0
  59. package/dist/events/bus.d.ts +22 -0
  60. package/dist/events/bus.js +18 -0
  61. package/dist/index.d.ts +87 -0
  62. package/dist/index.js +88 -0
  63. package/dist/indexing/ignoreRules.d.ts +1 -0
  64. package/dist/indexing/ignoreRules.js +53 -0
  65. package/dist/instance-swarm/instance-swarm-orchestrator.d.ts +57 -0
  66. package/dist/instance-swarm/instance-swarm-orchestrator.js +204 -0
  67. package/dist/instance-swarm/protocol-name-resolver.d.ts +23 -0
  68. package/dist/instance-swarm/protocol-name-resolver.js +64 -0
  69. package/dist/license/gate.d.ts +31 -0
  70. package/dist/license/gate.js +188 -0
  71. package/dist/license/http-client.d.ts +43 -0
  72. package/dist/license/http-client.js +195 -0
  73. package/dist/license/manager.d.ts +39 -0
  74. package/dist/license/manager.js +175 -0
  75. package/dist/license/receipt.d.ts +27 -0
  76. package/dist/license/receipt.js +108 -0
  77. package/dist/license/state-codec.d.ts +72 -0
  78. package/dist/license/state-codec.js +218 -0
  79. package/dist/license/state-paths.d.ts +17 -0
  80. package/dist/license/state-paths.js +64 -0
  81. package/dist/license/store.d.ts +44 -0
  82. package/dist/license/store.js +223 -0
  83. package/dist/license/trust-anchor.d.ts +24 -0
  84. package/dist/license/trust-anchor.js +74 -0
  85. package/dist/license/types.d.ts +34 -0
  86. package/dist/license/types.js +19 -0
  87. package/dist/llm/budget.d.ts +23 -0
  88. package/dist/llm/budget.js +58 -0
  89. package/dist/llm/client.d.ts +53 -0
  90. package/dist/llm/client.js +122 -0
  91. package/dist/llm/factory.d.ts +14 -0
  92. package/dist/llm/factory.js +32 -0
  93. package/dist/orchestrator/defect-logger.d.ts +31 -0
  94. package/dist/orchestrator/defect-logger.js +101 -0
  95. package/dist/orchestrator/defect-manager.d.ts +118 -0
  96. package/dist/orchestrator/defect-manager.js +338 -0
  97. package/dist/orchestrator/defect-migration.d.ts +14 -0
  98. package/dist/orchestrator/defect-migration.js +174 -0
  99. package/dist/orchestrator/defect-store.d.ts +48 -0
  100. package/dist/orchestrator/defect-store.js +76 -0
  101. package/dist/orchestrator/healing.d.ts +14 -0
  102. package/dist/orchestrator/healing.js +11 -0
  103. package/dist/orchestrator/interactive-steering.d.ts +64 -0
  104. package/dist/orchestrator/interactive-steering.js +107 -0
  105. package/dist/orchestrator/interrupt-handler.d.ts +30 -0
  106. package/dist/orchestrator/interrupt-handler.js +70 -0
  107. package/dist/orchestrator/lesson-manager.d.ts +25 -0
  108. package/dist/orchestrator/lesson-manager.js +122 -0
  109. package/dist/orchestrator/progress-summary.d.ts +15 -0
  110. package/dist/orchestrator/progress-summary.js +106 -0
  111. package/dist/orchestrator/reasoning-score.d.ts +49 -0
  112. package/dist/orchestrator/reasoning-score.js +117 -0
  113. package/dist/orchestrator/swarm.d.ts +36 -0
  114. package/dist/orchestrator/swarm.js +77 -0
  115. package/dist/orchestrator/task-factory.d.ts +15 -0
  116. package/dist/orchestrator/task-factory.js +176 -0
  117. package/dist/orchestrator/validation-gate.d.ts +23 -0
  118. package/dist/orchestrator/validation-gate.js +155 -0
  119. package/dist/protocol/react-contract.d.ts +136 -0
  120. package/dist/protocol/react-contract.js +698 -0
  121. package/dist/protocol/wks-protocol-manager.d.ts +22 -0
  122. package/dist/protocol/wks-protocol-manager.js +72 -0
  123. package/dist/sdlc-runtime/conversation-runner.d.ts +8 -0
  124. package/dist/sdlc-runtime/conversation-runner.js +64 -0
  125. package/dist/sdlc-runtime/dag-utils.d.ts +15 -0
  126. package/dist/sdlc-runtime/dag-utils.js +67 -0
  127. package/dist/sdlc-runtime/defect-integration.d.ts +7 -0
  128. package/dist/sdlc-runtime/defect-integration.js +99 -0
  129. package/dist/sdlc-runtime/execution-loop.d.ts +38 -0
  130. package/dist/sdlc-runtime/execution-loop.js +274 -0
  131. package/dist/sdlc-runtime/lesson-recorder.d.ts +9 -0
  132. package/dist/sdlc-runtime/lesson-recorder.js +27 -0
  133. package/dist/sdlc-runtime/plan-initializer.d.ts +47 -0
  134. package/dist/sdlc-runtime/plan-initializer.js +135 -0
  135. package/dist/sdlc-runtime/progress-persister.d.ts +10 -0
  136. package/dist/sdlc-runtime/progress-persister.js +34 -0
  137. package/dist/sdlc-runtime/protocol-loader.d.ts +10 -0
  138. package/dist/sdlc-runtime/protocol-loader.js +21 -0
  139. package/dist/sdlc-runtime/reporting.d.ts +24 -0
  140. package/dist/sdlc-runtime/reporting.js +68 -0
  141. package/dist/sdlc-runtime/run-task.d.ts +81 -0
  142. package/dist/sdlc-runtime/run-task.js +210 -0
  143. package/dist/sdlc-runtime/sdlc-orchestrator.d.ts +59 -0
  144. package/dist/sdlc-runtime/sdlc-orchestrator.js +170 -0
  145. package/dist/sdlc-runtime/sdlc-skill.d.ts +44 -0
  146. package/dist/sdlc-runtime/sdlc-skill.js +148 -0
  147. package/dist/sdlc-runtime/steering-handler.d.ts +14 -0
  148. package/dist/sdlc-runtime/steering-handler.js +51 -0
  149. package/dist/sdlc-runtime/trace-recorder.d.ts +10 -0
  150. package/dist/sdlc-runtime/trace-recorder.js +7 -0
  151. package/dist/security/index.d.ts +16 -0
  152. package/dist/security/index.js +12 -0
  153. package/dist/security/input-screen.d.ts +30 -0
  154. package/dist/security/input-screen.js +75 -0
  155. package/dist/security/tool-call-guard.d.ts +16 -0
  156. package/dist/security/tool-call-guard.js +174 -0
  157. package/dist/security/untrusted-content.d.ts +34 -0
  158. package/dist/security/untrusted-content.js +63 -0
  159. package/dist/skills/advanced-dfir/SKILL.md +85 -0
  160. package/dist/skills/advanced-pentest-lab/SKILL.md +88 -0
  161. package/dist/skills/analyst/SKILL.md +55 -0
  162. package/dist/skills/architect/SKILL.md +54 -0
  163. package/dist/skills/aws/SKILL.md +92 -0
  164. package/dist/skills/azure/SKILL.md +90 -0
  165. package/dist/skills/bylaw-context.d.ts +45 -0
  166. package/dist/skills/bylaw-context.js +61 -0
  167. package/dist/skills/bylaw-review.d.ts +20 -0
  168. package/dist/skills/bylaw-review.js +101 -0
  169. package/dist/skills/conversation/SKILL.md +29 -0
  170. package/dist/skills/design-patterns/SKILL.md +190 -0
  171. package/dist/skills/devops/SKILL.md +55 -0
  172. package/dist/skills/directives.d.ts +20 -0
  173. package/dist/skills/directives.js +313 -0
  174. package/dist/skills/docker/SKILL.md +76 -0
  175. package/dist/skills/docker-expert/SKILL.md +56 -0
  176. package/dist/skills/enterprise-systems-analyst/SKILL.md +83 -0
  177. package/dist/skills/enterprise-systems-analyst/references/crm.md +41 -0
  178. package/dist/skills/enterprise-systems-analyst/references/erp.md +40 -0
  179. package/dist/skills/enterprise-systems-analyst/references/financial-systems.md +35 -0
  180. package/dist/skills/enterprise-systems-analyst/references/hcm.md +38 -0
  181. package/dist/skills/enterprise-systems-analyst/references/mrp.md +37 -0
  182. package/dist/skills/enterprise-systems-analyst/references/scm.md +32 -0
  183. package/dist/skills/ethical-hacking-methodology/SKILL.md +119 -0
  184. package/dist/skills/externalSkillLoader.d.ts +25 -0
  185. package/dist/skills/externalSkillLoader.js +65 -0
  186. package/dist/skills/externalSkillRegistry.d.ts +33 -0
  187. package/dist/skills/externalSkillRegistry.js +94 -0
  188. package/dist/skills/filesystem-management/SKILL.md +61 -0
  189. package/dist/skills/first-run-seed.d.ts +26 -0
  190. package/dist/skills/first-run-seed.js +75 -0
  191. package/dist/skills/git-vcs/SKILL.md +84 -0
  192. package/dist/skills/kafka/SKILL.md +89 -0
  193. package/dist/skills/kubernetes/SKILL.md +93 -0
  194. package/dist/skills/kubernetes-expert/SKILL.md +54 -0
  195. package/dist/skills/openshift/SKILL.md +93 -0
  196. package/dist/skills/pentester/SKILL.md +59 -0
  197. package/dist/skills/performance-tester/SKILL.md +57 -0
  198. package/dist/skills/playwright-ui-tester/SKILL.md +67 -0
  199. package/dist/skills/programmer/SKILL.md +58 -0
  200. package/dist/skills/project-scaffolding/SKILL.md +133 -0
  201. package/dist/skills/qa-engineer/SKILL.md +91 -0
  202. package/dist/skills/rca/SKILL.md +58 -0
  203. package/dist/skills/redhat/SKILL.md +92 -0
  204. package/dist/skills/rosa/SKILL.md +80 -0
  205. package/dist/skills/scrum-framework/SKILL.md +74 -0
  206. package/dist/skills/scrum-framework/references/artifacts_and_quality.md +79 -0
  207. package/dist/skills/scrum-framework/references/roles_and_events.md +105 -0
  208. package/dist/skills/scrum-master-agent/SKILL.md +74 -0
  209. package/dist/skills/scrum-master-agent/references/behaviors.md +56 -0
  210. package/dist/skills/sdlc-skill.d.ts +1 -0
  211. package/dist/skills/sdlc-skill.js +4 -0
  212. package/dist/skills/secops/SKILL.md +52 -0
  213. package/dist/skills/secure-architect.bylaws.d.ts +68 -0
  214. package/dist/skills/secure-architect.bylaws.js +525 -0
  215. package/dist/skills/seed-skills.d.ts +48 -0
  216. package/dist/skills/seed-skills.js +213 -0
  217. package/dist/skills/skill-authoring/SKILL.md +123 -0
  218. package/dist/skills/skill-header.d.ts +51 -0
  219. package/dist/skills/skill-header.js +163 -0
  220. package/dist/skills/skill-path-guard.d.ts +41 -0
  221. package/dist/skills/skill-path-guard.js +95 -0
  222. package/dist/skills/skillRouter.d.ts +51 -0
  223. package/dist/skills/skillRouter.js +90 -0
  224. package/dist/skills/skills-root.d.ts +64 -0
  225. package/dist/skills/skills-root.js +168 -0
  226. package/dist/skills/software-architect/SKILL.md +77 -0
  227. package/dist/skills/software-engineer/SKILL.md +74 -0
  228. package/dist/skills/solid-principles/SKILL.md +94 -0
  229. package/dist/skills/task-planning/SKILL.md +115 -0
  230. package/dist/skills/tester/SKILL.md +54 -0
  231. package/dist/skills/ubuntu/SKILL.md +87 -0
  232. package/dist/skills/ui-ux-design/SKILL.md +114 -0
  233. package/dist/skills/workspace-context/SKILL.md +103 -0
  234. package/dist/sprint/controller.d.ts +37 -0
  235. package/dist/sprint/controller.js +220 -0
  236. package/dist/sprint/dag-builder.d.ts +14 -0
  237. package/dist/sprint/dag-builder.js +105 -0
  238. package/dist/sprint/reporter.d.ts +11 -0
  239. package/dist/sprint/reporter.js +97 -0
  240. package/dist/sprint/state-store.d.ts +10 -0
  241. package/dist/sprint/state-store.js +71 -0
  242. package/dist/sprint/types.d.ts +24 -0
  243. package/dist/sprint/types.js +4 -0
  244. package/dist/store/file-version-store.d.ts +24 -0
  245. package/dist/store/file-version-store.js +73 -0
  246. package/dist/store/task-store.d.ts +90 -0
  247. package/dist/store/task-store.js +166 -0
  248. package/dist/task-ingest/architect-detailer.d.ts +43 -0
  249. package/dist/task-ingest/architect-detailer.js +141 -0
  250. package/dist/task-ingest/detail-schema.d.ts +9 -0
  251. package/dist/task-ingest/detail-schema.js +195 -0
  252. package/dist/task-ingest/detailed-run.d.ts +36 -0
  253. package/dist/task-ingest/detailed-run.js +108 -0
  254. package/dist/task-ingest/extract-id.d.ts +9 -0
  255. package/dist/task-ingest/extract-id.js +24 -0
  256. package/dist/task-ingest/index.d.ts +23 -0
  257. package/dist/task-ingest/index.js +14 -0
  258. package/dist/task-ingest/ingest.d.ts +45 -0
  259. package/dist/task-ingest/ingest.js +163 -0
  260. package/dist/task-ingest/list-ingested.d.ts +13 -0
  261. package/dist/task-ingest/list-ingested.js +30 -0
  262. package/dist/task-ingest/pending-filter.d.ts +30 -0
  263. package/dist/task-ingest/pending-filter.js +59 -0
  264. package/dist/task-ingest/scanner.d.ts +56 -0
  265. package/dist/task-ingest/scanner.js +216 -0
  266. package/dist/task-ingest/source-reader.d.ts +25 -0
  267. package/dist/task-ingest/source-reader.js +93 -0
  268. package/dist/task-ingest/spec-builder.d.ts +34 -0
  269. package/dist/task-ingest/spec-builder.js +89 -0
  270. package/dist/task-ingest/wbs-extract.d.ts +50 -0
  271. package/dist/task-ingest/wbs-extract.js +226 -0
  272. package/dist/task-ingest/wbs-parser.d.ts +36 -0
  273. package/dist/task-ingest/wbs-parser.js +170 -0
  274. package/dist/tools/apiTestTool.d.ts +37 -0
  275. package/dist/tools/apiTestTool.js +128 -0
  276. package/dist/tools/ast-tools.d.ts +183 -0
  277. package/dist/tools/ast-tools.js +853 -0
  278. package/dist/tools/browse-tool.d.ts +105 -0
  279. package/dist/tools/browse-tool.js +394 -0
  280. package/dist/tools/credential.d.ts +17 -0
  281. package/dist/tools/credential.js +32 -0
  282. package/dist/tools/dependency-graph.d.ts +23 -0
  283. package/dist/tools/dependency-graph.js +164 -0
  284. package/dist/tools/edit-tool.d.ts +34 -0
  285. package/dist/tools/edit-tool.js +95 -0
  286. package/dist/tools/file-header-manager.d.ts +27 -0
  287. package/dist/tools/file-header-manager.js +153 -0
  288. package/dist/tools/fs-tools.d.ts +154 -0
  289. package/dist/tools/fs-tools.js +337 -0
  290. package/dist/tools/git-tools.d.ts +79 -0
  291. package/dist/tools/git-tools.js +348 -0
  292. package/dist/tools/github-tool.d.ts +48 -0
  293. package/dist/tools/github-tool.js +147 -0
  294. package/dist/tools/globTool.d.ts +20 -0
  295. package/dist/tools/globTool.js +34 -0
  296. package/dist/tools/grepTool.d.ts +19 -0
  297. package/dist/tools/grepTool.js +44 -0
  298. package/dist/tools/index-freshness.d.ts +58 -0
  299. package/dist/tools/index-freshness.js +196 -0
  300. package/dist/tools/index-glob.d.ts +48 -0
  301. package/dist/tools/index-glob.js +175 -0
  302. package/dist/tools/load-skill-tool.d.ts +15 -0
  303. package/dist/tools/load-skill-tool.js +114 -0
  304. package/dist/tools/patch-tools.d.ts +58 -0
  305. package/dist/tools/patch-tools.js +153 -0
  306. package/dist/tools/playwright-tool.d.ts +66 -0
  307. package/dist/tools/playwright-tool.js +121 -0
  308. package/dist/tools/project-detect.d.ts +20 -0
  309. package/dist/tools/project-detect.js +87 -0
  310. package/dist/tools/prompt-guidance.d.ts +22 -0
  311. package/dist/tools/prompt-guidance.js +23 -0
  312. package/dist/tools/schedule-audit.d.ts +50 -0
  313. package/dist/tools/schedule-audit.js +124 -0
  314. package/dist/tools/schedule-validation.d.ts +67 -0
  315. package/dist/tools/schedule-validation.js +210 -0
  316. package/dist/tools/scheduleTool.d.ts +62 -0
  317. package/dist/tools/scheduleTool.js +313 -0
  318. package/dist/tools/search-tools.d.ts +27 -0
  319. package/dist/tools/search-tools.js +78 -0
  320. package/dist/tools/sed-tool.d.ts +66 -0
  321. package/dist/tools/sed-tool.js +402 -0
  322. package/dist/tools/shell-result.d.ts +11 -0
  323. package/dist/tools/shell-result.js +1 -0
  324. package/dist/tools/shell-tool.d.ts +45 -0
  325. package/dist/tools/shell-tool.js +141 -0
  326. package/dist/tools/siteCrawlerTool.d.ts +32 -0
  327. package/dist/tools/siteCrawlerTool.js +205 -0
  328. package/dist/tools/tool-registry.d.ts +67 -0
  329. package/dist/tools/tool-registry.js +606 -0
  330. package/dist/tools/validate-tool.d.ts +23 -0
  331. package/dist/tools/validate-tool.js +201 -0
  332. package/dist/tools/workspace-index.d.ts +46 -0
  333. package/dist/tools/workspace-index.js +173 -0
  334. package/dist/types.d.ts +222 -0
  335. package/dist/types.js +7 -0
  336. package/dist/updater/index.d.ts +14 -0
  337. package/dist/updater/index.js +120 -0
  338. package/dist/util/banner.d.ts +25 -0
  339. package/dist/util/banner.js +140 -0
  340. package/dist/util/command-suggester.d.ts +6 -0
  341. package/dist/util/command-suggester.js +25 -0
  342. package/dist/util/confirm-interrupt.d.ts +10 -0
  343. package/dist/util/confirm-interrupt.js +31 -0
  344. package/dist/util/continue-trigger.d.ts +11 -0
  345. package/dist/util/continue-trigger.js +20 -0
  346. package/dist/util/env-info.d.ts +18 -0
  347. package/dist/util/env-info.js +37 -0
  348. package/dist/util/file-access-log.d.ts +35 -0
  349. package/dist/util/file-access-log.js +140 -0
  350. package/dist/util/footer-manager.d.ts +124 -0
  351. package/dist/util/footer-manager.js +195 -0
  352. package/dist/util/footer-renderer.d.ts +67 -0
  353. package/dist/util/footer-renderer.js +319 -0
  354. package/dist/util/footer-state.d.ts +34 -0
  355. package/dist/util/footer-state.js +18 -0
  356. package/dist/util/footer-text.d.ts +51 -0
  357. package/dist/util/footer-text.js +74 -0
  358. package/dist/util/ids.d.ts +1 -0
  359. package/dist/util/ids.js +4 -0
  360. package/dist/util/levenshtein.d.ts +6 -0
  361. package/dist/util/levenshtein.js +34 -0
  362. package/dist/util/logger.d.ts +10 -0
  363. package/dist/util/logger.js +41 -0
  364. package/dist/util/logs.d.ts +80 -0
  365. package/dist/util/logs.js +135 -0
  366. package/dist/util/output-handler.d.ts +89 -0
  367. package/dist/util/output-handler.js +193 -0
  368. package/dist/util/output-interceptor.d.ts +18 -0
  369. package/dist/util/output-interceptor.js +49 -0
  370. package/dist/util/output-paths.d.ts +43 -0
  371. package/dist/util/output-paths.js +121 -0
  372. package/dist/util/package-json.d.ts +6 -0
  373. package/dist/util/package-json.js +36 -0
  374. package/dist/util/process-kill.d.ts +27 -0
  375. package/dist/util/process-kill.js +148 -0
  376. package/dist/util/protocol-error-logger.d.ts +33 -0
  377. package/dist/util/protocol-error-logger.js +73 -0
  378. package/dist/util/redact.d.ts +25 -0
  379. package/dist/util/redact.js +119 -0
  380. package/dist/util/scroll-region-guard.d.ts +33 -0
  381. package/dist/util/scroll-region-guard.js +63 -0
  382. package/dist/util/spinner.d.ts +15 -0
  383. package/dist/util/spinner.js +49 -0
  384. package/dist/util/terminal-output.d.ts +34 -0
  385. package/dist/util/terminal-output.js +1 -0
  386. package/dist/util/terminal-silent.d.ts +6 -0
  387. package/dist/util/terminal-silent.js +20 -0
  388. package/dist/util/terminal.d.ts +56 -0
  389. package/dist/util/terminal.js +124 -0
  390. package/dist/util/text-sanitize.d.ts +8 -0
  391. package/dist/util/text-sanitize.js +45 -0
  392. package/dist/util/thinking-spinner.d.ts +27 -0
  393. package/dist/util/thinking-spinner.js +189 -0
  394. package/dist/util/tool-error-logger.d.ts +33 -0
  395. package/dist/util/tool-error-logger.js +77 -0
  396. package/dist/util/tty.d.ts +13 -0
  397. package/dist/util/tty.js +16 -0
  398. package/dist/util/xcoder-paths.d.ts +56 -0
  399. package/dist/util/xcoder-paths.js +63 -0
  400. package/dist/version.d.ts +2 -0
  401. package/dist/version.js +5 -0
  402. package/dist/worker-agent/to-subtask-node.d.ts +35 -0
  403. package/dist/worker-agent/to-subtask-node.js +41 -0
  404. package/dist/worker-agent/worker-orchestrator.d.ts +104 -0
  405. package/dist/worker-agent/worker-orchestrator.js +201 -0
  406. package/package.json +43 -3
@@ -0,0 +1,94 @@
1
+ // xcoder:version 1 | xcoder:task task-f9cf18 | xcoder:updated 2026-11-02T16:14:42.147Z | xcoder:subtask code-st-077ea2
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { resolveSkillsRoot } from "./skills-root.js";
5
+ import { MAX_PACK_DIRS, resolveSkillDir } from "./skill-path-guard.js";
6
+ import { parseSkillHeaderFile } from "./skill-header.js";
7
+ /**
8
+ * Registration manager for the Special Evolution skill system.
9
+ * Reads every <skillsDir>/<name>/SKILL.md, parses its YAML header so the
10
+ * LLM/orchestrator knows what each skill is for without loading the full body,
11
+ * and lazily loads the full body only when a skill is actually selected.
12
+ *
13
+ * Discovery goes through `resolveSkillsRoot()` — the single source of truth —
14
+ * so this class no longer joins `"skills"` onto anything itself.
15
+ */
16
+ export class SkillRegistry {
17
+ headers = new Map();
18
+ paths = new Map();
19
+ skillDir;
20
+ /**
21
+ * @param skillDir Explicit skills directory. When omitted (or empty) the
22
+ * resolved root's skills directory is used. An explicit directory is
23
+ * honoured even when it is empty — it never falls back to the bundled
24
+ * packs, so tests and embedded callers get exactly the set they asked for.
25
+ */
26
+ constructor(skillDir) {
27
+ this.skillDir = skillDir ? path.resolve(skillDir) : resolveSkillsRoot().skillsDir;
28
+ }
29
+ /** Scan and parse headers only — cheap, safe to call often (e.g. on --index). */
30
+ loadHeaders() {
31
+ this.headers.clear();
32
+ this.paths.clear();
33
+ let entries;
34
+ try {
35
+ entries = fs.readdirSync(this.skillDir, { withFileTypes: true });
36
+ }
37
+ catch {
38
+ return [];
39
+ }
40
+ let visited = 0;
41
+ for (const entry of entries) {
42
+ if (visited >= MAX_PACK_DIRS)
43
+ break;
44
+ if (!entry.isDirectory())
45
+ continue;
46
+ visited++;
47
+ // Validate the name and prove containment BEFORE joining anything.
48
+ const packDir = resolveSkillDir(this.skillDir, entry.name);
49
+ if (!packDir)
50
+ continue;
51
+ const skillPath = path.join(packDir, "SKILL.md");
52
+ const parsed = parseSkillHeaderFile(skillPath);
53
+ if (!parsed.ok || !parsed.header)
54
+ continue;
55
+ // Last pack wins on a duplicate name, matching the previous Map.set order.
56
+ this.headers.set(parsed.header.name, parsed.header);
57
+ this.paths.set(parsed.header.name, skillPath);
58
+ }
59
+ return [...this.headers.values()];
60
+ }
61
+ /** Load the full skill (header + body) by name, for injection into the LLM context. */
62
+ loadSkill(name) {
63
+ const skillPath = this.paths.get(name);
64
+ if (!skillPath)
65
+ return undefined;
66
+ const parsed = parseSkillHeaderFile(skillPath, { withBody: true });
67
+ if (!parsed.ok || !parsed.header)
68
+ return undefined;
69
+ return { header: parsed.header, body: parsed.body ?? "", path: skillPath };
70
+ }
71
+ /**
72
+ * Route a task description to candidate skills by trigger-keyword match.
73
+ * Returns skills ranked by match count, highest first. Multiple skills may
74
+ * be selected — xcoder composes them (see composes_with in each header).
75
+ */
76
+ route(taskDescription) {
77
+ if (this.headers.size === 0)
78
+ this.loadHeaders();
79
+ const text = taskDescription.toLowerCase();
80
+ const scored = [...this.headers.values()].map((h) => {
81
+ const score = h.triggers.reduce((acc, t) => acc + (text.includes(t.toLowerCase()) ? 1 : 0), 0);
82
+ return { header: h, score };
83
+ });
84
+ return scored
85
+ .filter((s) => s.score > 0)
86
+ .sort((a, b) => b.score - a.score)
87
+ .map((s) => s.header);
88
+ }
89
+ list() {
90
+ if (this.headers.size === 0)
91
+ this.loadHeaders();
92
+ return [...this.headers.values()];
93
+ }
94
+ }
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: filesystem-management
3
+ role: Filesystem/Workspace Manager
4
+ description: >
5
+ Manages the agent's view of the workspace filesystem — indexing, ignore rules, safe
6
+ read/write/move/delete operations, and keeping .agent/index in sync with reality. Load
7
+ whenever the task involves scanning, organizing, cleaning, moving, or indexing files/folders,
8
+ or when other skills need a fresh index before they can trust file state.
9
+ triggers: [index, filesystem, "clean up files", organize, move files, delete files, workspace, ".agentignore", scan directory]
10
+ version: 1.0
11
+ requires_tools: [glob_tool, grep_tool, read_tool, write_edit_tool, run_command_tool, indexing_tool]
12
+ composes_with: [programmer, architect, devops, analyst]
13
+ ---
14
+
15
+ ## Role
16
+ Owns the accuracy of the agent's picture of "what's on disk" and performs filesystem
17
+ operations safely — indexing, ignore-rule resolution, and structural changes (move/rename/
18
+ delete) without corrupting workspace state.
19
+
20
+ ## Process
21
+ 1. **Resolve ignore rules** — merge .agent/.agentignore with existing .gitignore /
22
+ .dockerignore before any scan; never index or touch ignored paths.
23
+ 2. **Scan** — walk the workspace recursively (respecting ignores) and diff against the last
24
+ known index.json to find added/removed/changed files.
25
+ 3. **Index** — write/update .agent/index/index.json (filename, filepath, version, dump file,
26
+ start/end line) and .agent/index/index00x.dump (chunked, <500KB each).
27
+ 4. **Mutate safely** — for move/rename/delete requests: confirm the operation plan, check for
28
+ references via grep before deleting anything code refers to, then execute.
29
+ 5. **Re-index after mutation** — any write/edit/move/delete invalidates the affected index
30
+ entries; refresh them, don't leave the index stale.
31
+
32
+ ## Strategies
33
+ - Treat index.json as a cache, not a source of truth — always re-verify against disk before
34
+ a destructive operation.
35
+ - Chunk dump files strictly under 500KB; roll to a new index00x.dump rather than exceeding it.
36
+ - Never delete without first grepping for references across the workspace.
37
+ - Prefer additive/renaming operations that are reversible over hard deletes where feasible.
38
+
39
+ ## Planning Approach
40
+ - Batch related filesystem changes into a single reviewable plan before executing, rather
41
+ than mutating file-by-file with no overview.
42
+ - For large reorganizations, produce a move-map (old path → new path) as an artifact before
43
+ touching anything.
44
+
45
+ ## Instructions for This Task Type
46
+ - Always resolve .agentignore + .gitignore + .dockerignore before scanning or indexing.
47
+ - Never exceed 500KB per dump file; split and update index.json's file→dump mapping.
48
+ - Surface a dry-run plan for any multi-file move/delete before executing if the change is
49
+ non-trivial (more than a few files).
50
+
51
+ ## Experience / Common Pitfalls
52
+ - Stale indexes are worse than no index — a skill trusting a stale index.json will act on
53
+ wrong file locations/content.
54
+ - Ignoring .gitignore rules leads to indexing build artifacts/dependencies, bloating dump
55
+ files and wasting LLM context.
56
+ - Deleting a file still referenced elsewhere is the most common destructive-operation mistake.
57
+
58
+ ## Output Artifacts
59
+ - .agent/index/index.json
60
+ - .agent/index/index00x.dump
61
+ - move-map / change plan (for reorganizations)
@@ -0,0 +1,26 @@
1
+ /**
2
+ * First-run seeding: copy the shipped packs into ~/.xcoder/skills once the CLI
3
+ * actually starts, so a user gets an editable, uninstall-surviving tree.
4
+ *
5
+ * This is strictly best-effort. Seeding runs at most once per process, never
6
+ * throws, and never touches files it does not own (see seed-skills.ts).
7
+ */
8
+ import { getUserHomeSkillsDir } from "./skills-root.js";
9
+ /**
10
+ * Seed ~/.xcoder/skills from the shipped packs, once per process.
11
+ *
12
+ * Returns the seed summary for tests, or `undefined` when there was nothing
13
+ * to do, it was already attempted, or it failed — failures are swallowed so a
14
+ * read-only home directory can never stop the CLI from starting.
15
+ */
16
+ export declare function maybeSeedSkillsHome(opts?: {
17
+ sourceDir?: string;
18
+ homeDir?: string;
19
+ }): Promise<{
20
+ written: number;
21
+ updated: number;
22
+ preserved: number;
23
+ } | undefined>;
24
+ /** Test hook: allow another seed attempt in the same process. */
25
+ export declare function resetFirstRunSeedState(): void;
26
+ export { getUserHomeSkillsDir };
@@ -0,0 +1,75 @@
1
+ // xcoder:version 2 | xcoder:task task-f9cf18 | xcoder:updated 2026-11-02T16:15:56.920Z | xcoder:subtask code-st-077ea2
2
+ /**
3
+ * First-run seeding: copy the shipped packs into ~/.xcoder/skills once the CLI
4
+ * actually starts, so a user gets an editable, uninstall-surviving tree.
5
+ *
6
+ * This is strictly best-effort. Seeding runs at most once per process, never
7
+ * throws, and never touches files it does not own (see seed-skills.ts).
8
+ */
9
+ import os from "node:os";
10
+ import path from "node:path";
11
+ import { log } from "../util/logger.js";
12
+ import { getAppDir, getUserHomeSkillsDir, probeSkillsDir } from "./skills-root.js";
13
+ import { seedSkillsHome } from "./seed-skills.js";
14
+ let attempted = false;
15
+ /**
16
+ * Candidate locations for the SHIPPED packs (never the user's home copy).
17
+ * Order mirrors resolveSkillsRoot's installer candidates.
18
+ */
19
+ function bundledSkillsCandidates() {
20
+ const appDir = getAppDir();
21
+ const exeDir = path.dirname(process.execPath);
22
+ return [
23
+ path.join(appDir, "skills"),
24
+ path.join(exeDir, "..", "share", "xcoder", "skills"),
25
+ path.join(appDir, "..", "skills"),
26
+ path.join(appDir, "..", "..", "skills"),
27
+ path.join(process.cwd(), "skills"),
28
+ ];
29
+ }
30
+ function findBundledSkillsDir() {
31
+ for (const candidate of bundledSkillsCandidates()) {
32
+ if (probeSkillsDir(candidate).count > 0)
33
+ return candidate;
34
+ }
35
+ return undefined;
36
+ }
37
+ /**
38
+ * Seed ~/.xcoder/skills from the shipped packs, once per process.
39
+ *
40
+ * Returns the seed summary for tests, or `undefined` when there was nothing
41
+ * to do, it was already attempted, or it failed — failures are swallowed so a
42
+ * read-only home directory can never stop the CLI from starting.
43
+ */
44
+ export async function maybeSeedSkillsHome(opts) {
45
+ if (attempted)
46
+ return undefined;
47
+ attempted = true;
48
+ if (process.env["XCODER_SKIP_SKILLS_SEED"] === "1")
49
+ return undefined;
50
+ const sourceDir = opts?.sourceDir ?? findBundledSkillsDir();
51
+ if (!sourceDir)
52
+ return undefined;
53
+ const homeDir = opts?.homeDir ?? os.homedir();
54
+ try {
55
+ const result = await seedSkillsHome({ sourceDir, homeDir });
56
+ if (process.env["XCODER_DEBUG_CONFIG_PATH"] && result.action !== "unchanged") {
57
+ log.dim(`skillsSeed: ${result.action} (written=${result.written.length}, ` +
58
+ `updated=${result.updated.length}, preserved=${result.preserved.length})`);
59
+ }
60
+ return {
61
+ written: result.written.length,
62
+ updated: result.updated.length,
63
+ preserved: result.preserved.length,
64
+ };
65
+ }
66
+ catch {
67
+ // Never let seeding break startup.
68
+ return undefined;
69
+ }
70
+ }
71
+ /** Test hook: allow another seed attempt in the same process. */
72
+ export function resetFirstRunSeedState() {
73
+ attempted = false;
74
+ }
75
+ export { getUserHomeSkillsDir };
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: git-vcs
3
+ role: devops
4
+ description: Git workflow discipline — clean, atomic commits, safe branching/merging/rebasing, and the correct recovery command for common "I broke my git state" situations, using this project's github_tool (clone/fetch/pull/status/commit/push).
5
+ triggers:
6
+ - "git repo"
7
+ - "git log"
8
+ - "git status"
9
+ - "using git"
10
+ - "commit"
11
+ - "branch"
12
+ - "merge conflict"
13
+ - "rebase"
14
+ - "pull request"
15
+ - "git history"
16
+ - "revert"
17
+ - "cherry-pick"
18
+ version: "1.0.0"
19
+ requires_tools:
20
+ - github_tool
21
+ - run_command_tool
22
+ composes_with:
23
+ - workspace-context
24
+ - software-engineer
25
+ ---
26
+
27
+ ## Process
28
+
29
+ 1. Before committing, check `status` and the actual diff (not just the file list) — stage exactly
30
+ the intended changes. `files` defaults to `['.']` in this project's `github_tool`, which stages
31
+ everything in the working tree; be deliberate about that when unrelated changes exist locally.
32
+ 2. Write commit messages that state *why*, not just *what* — the diff already shows what changed;
33
+ the message's job is the reasoning a diff can't express (why this approach, what it fixes, what
34
+ it doesn't cover).
35
+ 3. Keep commits atomic: one logical change per commit. A commit that mixes an unrelated formatting
36
+ pass with a real fix makes `git blame`/`git bisect` far less useful later.
37
+ 4. Pull/rebase onto the latest target branch before starting new work when working against a
38
+ shared branch, to minimize conflict surface discovered at the end instead of the start.
39
+ 5. Before pushing, re-read the actual diff being pushed (not just recall what you intended to
40
+ change) — catches accidental debug code, unintended file inclusions, or leftover conflict markers.
41
+
42
+ ## Instructions — non-negotiable
43
+
44
+ - Never force-push (`push --force`) to a shared/main branch — if history needs rewriting on a
45
+ shared branch, coordinate explicitly or use `--force-with-lease` on a branch confirmed to be
46
+ exclusively yours.
47
+ - Never commit secrets, credentials, or `.env` files — if one is committed by mistake, rotating the
48
+ credential is required; removing it from a later commit does not remove it from history that's
49
+ already been pushed/shared.
50
+ - Never resolve a merge conflict by blindly accepting "ours" or "theirs" wholesale without reading
51
+ both sides — conflicts often mean both changes are needed, merged correctly, not one discarded.
52
+ - Never rewrite (rebase/amend) commits that have already been pushed and pulled by others, without
53
+ explicit coordination.
54
+
55
+ ## Strategies
56
+
57
+ - Prefer `rebase` for keeping a feature branch current with its base (linear, readable history) and
58
+ `merge` for combining a completed feature branch back into a shared branch (preserves the actual
59
+ point-in-time context of when work merged) — know which one the project's convention expects.
60
+ - Prefer small, frequent commits over one large commit at the end of a task — easier to review,
61
+ easier to revert just the problematic part if something's wrong.
62
+ - When a change touches generated files (lockfiles, build output) alongside source, commit them
63
+ together only if the project tracks generated files at all — check `.gitignore` first.
64
+
65
+ ## Recovery commands for common situations
66
+
67
+ - Committed to the wrong branch, not yet pushed: `git reset --soft HEAD~1` on the wrong branch,
68
+ switch to the correct branch, commit there.
69
+ - Need to undo a pushed commit without rewriting shared history: `git revert <sha>` (creates a new
70
+ commit undoing it) rather than resetting/force-pushing.
71
+ - Merge conflict mid-rebase and want to abandon: `git rebase --abort` restores the pre-rebase state
72
+ cleanly — always safe to bail out this way rather than trying to force through a confusing
73
+ conflict state.
74
+ - Need one specific commit from another branch without merging everything: `git cherry-pick <sha>`.
75
+ - Accidentally staged something that shouldn't be committed: `git restore --staged <file>` (unstages
76
+ without discarding the actual edit).
77
+
78
+ ## Experience
79
+
80
+ - Most "git broke" panics have a clean, low-risk recovery command (see above) — resist the urge to
81
+ delete and re-clone the repo, which loses any uncommitted local work.
82
+ - A conflict that reappears identically after a previous "resolution" usually means the resolution
83
+ wasn't actually committed/staged correctly, not that the conflict is unresolvable — verify with
84
+ `status` after resolving.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: kafka
3
+ role: devops
4
+ description: Design and troubleshoot Kafka topics, partitioning, and consumer groups — correct delivery-semantics choice, partition-key design for ordering guarantees, and the standard diagnostic sequence for consumer lag.
5
+ triggers:
6
+ - "kafka"
7
+ - "topic partition"
8
+ - "consumer group"
9
+ - "message queue"
10
+ - "event streaming"
11
+ - "producer consumer"
12
+ version: "1.0.0"
13
+ requires_tools:
14
+ - run_command_tool
15
+ - ssh_tool
16
+ - read_tool
17
+ composes_with:
18
+ - workspace-context
19
+ - docker
20
+ - kubernetes
21
+ - aws
22
+ ---
23
+
24
+ ## Process
25
+
26
+ 1. Decide the delivery-semantics requirement explicitly before configuring anything: at-most-once
27
+ (fire and forget, fine for non-critical telemetry), at-least-once (default for most Kafka setups
28
+ — requires idempotent consumers since duplicates are possible), or exactly-once (transactional
29
+ producer + consumer, real throughput cost — only use where a duplicate is genuinely unacceptable,
30
+ e.g. financial transactions).
31
+ 2. Choose the partition key based on the ordering guarantee actually needed: messages with the same
32
+ key land on the same partition and are ordered relative to each other, but there is no ordering
33
+ guarantee across partitions. Partitioning by a high-cardinality key (e.g. user ID) gives good
34
+ parallelism; partitioning by something low-cardinality or constant defeats the purpose of having
35
+ multiple partitions.
36
+ 3. Set partition count based on target consumer parallelism, not arbitrarily — max useful
37
+ parallelism for one consumer group equals the partition count; more consumers than partitions
38
+ sit idle. Partition count can be increased later but never decreased on an existing topic, so
39
+ under-provisioning is more recoverable than over-provisioning is reversible.
40
+ 4. Set a retention policy (`retention.ms`/`retention.bytes`) deliberately based on how long
41
+ consumers legitimately need to replay from, not left at the cluster default by accident.
42
+ 5. For schema evolution, use a schema registry with a compatibility mode (backward/forward/full)
43
+ matched to the actual deploy order of producers vs. consumers — deploying an incompatible schema
44
+ change before all consumers are updated is a common outage cause.
45
+
46
+ ## Instructions — non-negotiable
47
+
48
+ - Never assume global ordering across a topic — only same-key messages on the same partition are
49
+ ordered. Design consumers to be correct under cross-partition reordering.
50
+ - Always make consumers idempotent (dedupe on a message ID/offset, or make the operation naturally
51
+ idempotent) when using at-least-once delivery — duplicates *will* happen (rebalances, retries).
52
+ - Never rely on manual offset management without understanding the commit strategy in use
53
+ (auto-commit vs. manual commit, and whether it's committed before or after processing) — this
54
+ determines exactly what's re-processed on a consumer crash.
55
+ - Monitor and alert on consumer lag, not just consumer liveness — a consumer that's running but
56
+ falling behind is a slow-motion outage that liveness checks won't catch.
57
+
58
+ ## Strategies
59
+
60
+ - Prefer fewer, well-designed topics over many narrow ones unless there's a genuine reason to
61
+ separate (different retention needs, different access-control boundary, different consumer
62
+ scaling needs).
63
+ - For high-throughput producers, batch and compress (`linger.ms`, `batch.size`, `compression.type`)
64
+ rather than sending every message individually — meaningful throughput difference at scale.
65
+ - Prefer Kafka Streams/ksqlDB for stream-processing logic that needs to live close to the data
66
+ over pulling everything into a separate service, when the processing is naturally
67
+ stream-shaped (windowed aggregation, joins between topics).
68
+
69
+ ## Diagnostic sequence for consumer lag / "messages aren't being processed"
70
+
71
+ 1. Check consumer group lag directly (`kafka-consumer-groups.sh --describe --group <g>` or the
72
+ equivalent cluster UI/API) — confirms whether it's actually lagging vs. a false alarm.
73
+ 2. If lag is growing steadily: is the consumer under-provisioned relative to partition count and
74
+ incoming rate, or is per-message processing slow (check consumer-side processing time, not just
75
+ Kafka-side metrics)?
76
+ 3. If lag is flat/not moving at all: check for a stuck/crashed consumer, a rebalance loop (frequent
77
+ rebalances usually mean `session.timeout.ms`/`max.poll.interval.ms` too tight for actual
78
+ processing time), or a permissions/connectivity issue preventing fetch.
79
+ 4. Check for a "poison pill" message (one malformed message repeatedly failing and blocking the
80
+ partition if the consumer isn't skipping/dead-lettering failed messages).
81
+
82
+ ## Experience
83
+
84
+ - Rebalance storms (consumers repeatedly leaving/rejoining the group) are usually caused by
85
+ processing taking longer than `max.poll.interval.ms`, not a Kafka infrastructure problem —
86
+ check consumer-side timing before touching cluster config.
87
+ - A "topic doesn't exist" error on first produce often means `auto.create.topics.enable` is off
88
+ (common and correct for production clusters) — the topic needs to be created explicitly, not
89
+ debugged as a connectivity issue.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: kubernetes
3
+ role: devops
4
+ description: Write and troubleshoot Kubernetes manifests and cluster workloads — correct workload type choice, resource requests/limits, probes, and the standard kubectl-based diagnostic sequence for a failing pod/deployment.
5
+ triggers:
6
+ - "kubernetes"
7
+ - "k8s"
8
+ - "kubectl"
9
+ - "the pod "
10
+ - "a pod "
11
+ - "pod is "
12
+ - "pod status"
13
+ - "deployment yaml"
14
+ - "helm chart"
15
+ - "ingress"
16
+ - "kubernetes cluster"
17
+ version: "1.0.0"
18
+ requires_tools:
19
+ - run_command_tool
20
+ - ssh_tool
21
+ - read_tool
22
+ - write_edit_tool
23
+ composes_with:
24
+ - workspace-context
25
+ - docker
26
+ - openshift
27
+ - rosa
28
+ - aws
29
+ - azure
30
+ ---
31
+
32
+ ## Process
33
+
34
+ 1. Choose the right workload type deliberately: `Deployment` for stateless/replaceable pods,
35
+ `StatefulSet` when pods need stable identity/storage/ordering, `DaemonSet` for one-per-node
36
+ agents, `Job`/`CronJob` for run-to-completion work. Using `Deployment` for something that needs
37
+ stable network identity or ordered startup is a common, hard-to-debug-later mistake.
38
+ 2. Always set both `resources.requests` and `resources.limits` (CPU and memory) — no requests means
39
+ the scheduler can't place pods sensibly; no limits means one runaway pod can starve its node.
40
+ 3. Define `readinessProbe` (traffic routing) and `livenessProbe` (restart-if-stuck) separately and
41
+ correctly — a liveness probe that's too aggressive causes restart loops on slow-starting apps; a
42
+ missing readiness probe sends traffic to a pod before it's actually ready.
43
+ 4. Use `ConfigMap`/`Secret` for configuration, never bake environment-specific values into the
44
+ image — the same image should be deployable unchanged across environments.
45
+ 5. For anything beyond a handful of static manifests, prefer Helm or Kustomize over hand-copied
46
+ YAML per environment, to keep environment diffs explicit and reviewable instead of implicit.
47
+
48
+ ## Instructions — non-negotiable
49
+
50
+ - Never apply a manifest without first running `kubectl diff` (or `--dry-run=client -o yaml`) to
51
+ see what will actually change, when the cluster is a shared/production one.
52
+ - Never set `livenessProbe` with a timeout/period tight enough to fail during normal startup —
53
+ check actual startup time first, or use `startupProbe` to give slow-starting apps room before
54
+ liveness checks begin.
55
+ - Namespace every resource explicitly rather than relying on `kubectl`'s current context default —
56
+ applying to the wrong namespace/cluster is a common, costly mistake.
57
+ - Never store secrets as plain `ConfigMap` values or in-image — use `Secret` objects (and note that
58
+ base64 in a `Secret` is encoding, not encryption; use a proper secrets manager/sealed-secrets
59
+ approach for anything genuinely sensitive).
60
+
61
+ ## Strategies
62
+
63
+ - Prefer many small, single-purpose containers/pods over one large pod doing several unrelated
64
+ jobs — matches Kubernetes' scaling and failure-isolation model.
65
+ - Set `PodDisruptionBudget` for anything that must maintain a minimum available replica count
66
+ during voluntary disruptions (node drains, cluster upgrades).
67
+ - Prefer `kubectl rollout status`/`kubectl rollout undo` for deploys over deleting and recreating
68
+ resources — preserves rollout history and enables clean rollback.
69
+
70
+ ## The standard diagnostic sequence for "pod isn't working"
71
+
72
+ 1. `kubectl get pods -n <ns>` — what phase is it in (Pending/CrashLoopBackOff/ImagePullBackOff/
73
+ Running-but-not-Ready)? The phase narrows the cause category immediately.
74
+ 2. `kubectl describe pod <pod> -n <ns>` — check `Events` at the bottom first; scheduling failures,
75
+ image pull errors, and probe failures all show up here with a specific reason.
76
+ 3. `kubectl logs <pod> -n <ns>` (add `--previous` if it's currently restarting) — application-level
77
+ errors.
78
+ 4. `kubectl get events -n <ns> --sort-by='.lastTimestamp'` — cluster-level events (evictions,
79
+ node pressure) that `describe pod` alone might not surface.
80
+ 5. For networking issues specifically: confirm the `Service` selector actually matches the pod's
81
+ labels (`kubectl get endpoints <svc>` should list the pod IPs — if empty, the selector is wrong).
82
+
83
+ ## Experience
84
+
85
+ - `ImagePullBackOff` is almost always either a typo'd image tag, a private registry the cluster
86
+ isn't authenticated against, or a platform/architecture mismatch (e.g. arm64 image on an amd64
87
+ node) — check these three before anything more exotic.
88
+ - `CrashLoopBackOff` combined with a very short `Age`-to-restart interval usually means the
89
+ container is exiting immediately on start (missing env var, bad config, wrong entrypoint) rather
90
+ than crashing after real work — `kubectl logs --previous` is the fastest path to the actual error.
91
+ - Pending pods are almost always a scheduling constraint (insufficient resources, node
92
+ selector/affinity nothing matches, or a taint with no matching toleration) — `describe pod`'s
93
+ Events section names the specific unmet constraint.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: kubernetes-expert
3
+ role: Kubernetes Specialist
4
+ description: >
5
+ Designs and troubleshoots Kubernetes manifests, cluster resources, and workload
6
+ configuration. Load whenever the task involves k8s manifests, deployments, services,
7
+ ingress, helm charts, cluster troubleshooting, or resource scaling.
8
+ triggers: [kubernetes, k8s, pod, deployment.yaml, helm, ingress, "cluster", "kubectl", statefulset, hpa]
9
+ version: 1.0
10
+ requires_tools: [read_tool, glob_tool, grep_tool, write_edit_tool, run_command_tool, ssh_tool]
11
+ composes_with: [docker-expert, devops, secops, performance-tester]
12
+ ---
13
+
14
+ ## Role
15
+ Owns correctness and efficiency of workloads on Kubernetes: manifests, resource sizing,
16
+ networking (Service/Ingress), scaling policy, and cluster-level troubleshooting.
17
+
18
+ ## Process
19
+ 1. **Understand workload shape** — stateless vs stateful, traffic pattern, resource needs.
20
+ 2. **Author manifests** — Deployment/StatefulSet, Service, Ingress, ConfigMap/Secret refs,
21
+ resource requests/limits set deliberately (not omitted, not copy-pasted defaults).
22
+ 3. **Wire health checks** — readiness/liveness probes matched to actual startup/health
23
+ behavior.
24
+ 4. **Validate** — `kubectl apply --dry-run` / lint manifests, then apply and check rollout
25
+ status and pod events.
26
+ 5. **Troubleshoot** — for issues, read pod events/logs and describe output before guessing at
27
+ a fix.
28
+
29
+ ## Strategies
30
+ - Always set resource requests/limits; unset limits are the most common cause of noisy-
31
+ neighbor incidents.
32
+ - Use readiness probes to gate traffic, liveness probes to recover hung processes — don't
33
+ conflate the two.
34
+ - Prefer Horizontal Pod Autoscaler over manual replica counts for variable load.
35
+ - Keep secrets out of manifests directly — reference Kubernetes Secrets/external secret
36
+ stores.
37
+
38
+ ## Planning Approach
39
+ - Namespace and label workloads by environment/team from the start; retrofitting later is
40
+ costly.
41
+ - Plan rollout strategy (RollingUpdate params, maxSurge/maxUnavailable) relative to
42
+ workload's tolerance for reduced capacity during deploys.
43
+
44
+ ## Instructions for This Task Type
45
+ - Always validate manifests (dry-run/lint) before declaring a change done.
46
+ - After apply, check `kubectl rollout status` and pod events, not just "apply succeeded".
47
+
48
+ ## Experience / Common Pitfalls
49
+ - Missing/incorrect probes cause traffic to hit not-yet-ready pods or mask hung processes.
50
+ - Unbounded resource requests lead to unpredictable scheduling and eviction under pressure.
51
+
52
+ ## Output Artifacts
53
+ - Kubernetes manifests / Helm chart
54
+ - Rollout validation report