oh-my-customcodex 0.1.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 (351) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +327 -0
  3. package/dist/cli/index.js +32054 -0
  4. package/dist/index.js +5469 -0
  5. package/package.json +89 -0
  6. package/templates/.claude/agents/arch-documenter.md +38 -0
  7. package/templates/.claude/agents/arch-speckit-agent.md +66 -0
  8. package/templates/.claude/agents/be-django-expert.md +47 -0
  9. package/templates/.claude/agents/be-express-expert.md +31 -0
  10. package/templates/.claude/agents/be-fastapi-expert.md +45 -0
  11. package/templates/.claude/agents/be-go-backend-expert.md +45 -0
  12. package/templates/.claude/agents/be-nestjs-expert.md +29 -0
  13. package/templates/.claude/agents/be-springboot-expert.md +42 -0
  14. package/templates/.claude/agents/db-alembic-expert.md +73 -0
  15. package/templates/.claude/agents/db-postgres-expert.md +38 -0
  16. package/templates/.claude/agents/db-redis-expert.md +38 -0
  17. package/templates/.claude/agents/db-supabase-expert.md +37 -0
  18. package/templates/.claude/agents/de-airflow-expert.md +48 -0
  19. package/templates/.claude/agents/de-dbt-expert.md +36 -0
  20. package/templates/.claude/agents/de-kafka-expert.md +83 -0
  21. package/templates/.claude/agents/de-pipeline-expert.md +34 -0
  22. package/templates/.claude/agents/de-snowflake-expert.md +38 -0
  23. package/templates/.claude/agents/de-spark-expert.md +38 -0
  24. package/templates/.claude/agents/fe-design-expert.md +120 -0
  25. package/templates/.claude/agents/fe-flutter-agent.md +48 -0
  26. package/templates/.claude/agents/fe-svelte-agent.md +33 -0
  27. package/templates/.claude/agents/fe-vercel-agent.md +40 -0
  28. package/templates/.claude/agents/fe-vuejs-agent.md +34 -0
  29. package/templates/.claude/agents/infra-aws-expert.md +49 -0
  30. package/templates/.claude/agents/infra-docker-expert.md +49 -0
  31. package/templates/.claude/agents/lang-golang-expert.md +46 -0
  32. package/templates/.claude/agents/lang-java21-expert.md +42 -0
  33. package/templates/.claude/agents/lang-kotlin-expert.md +45 -0
  34. package/templates/.claude/agents/lang-python-expert.md +45 -0
  35. package/templates/.claude/agents/lang-rust-expert.md +45 -0
  36. package/templates/.claude/agents/lang-typescript-expert.md +45 -0
  37. package/templates/.claude/agents/mgr-claude-code-bible.md +62 -0
  38. package/templates/.claude/agents/mgr-creator.md +57 -0
  39. package/templates/.claude/agents/mgr-gitnerd.md +50 -0
  40. package/templates/.claude/agents/mgr-sauron.md +163 -0
  41. package/templates/.claude/agents/mgr-supplier.md +39 -0
  42. package/templates/.claude/agents/mgr-updater.md +40 -0
  43. package/templates/.claude/agents/qa-engineer.md +36 -0
  44. package/templates/.claude/agents/qa-planner.md +78 -0
  45. package/templates/.claude/agents/qa-writer.md +32 -0
  46. package/templates/.claude/agents/sec-codeql-expert.md +56 -0
  47. package/templates/.claude/agents/slack-cli-expert.md +98 -0
  48. package/templates/.claude/agents/souls/lang-golang-expert.soul.md +21 -0
  49. package/templates/.claude/agents/sys-memory-keeper.md +123 -0
  50. package/templates/.claude/agents/sys-naggy.md +76 -0
  51. package/templates/.claude/agents/tool-bun-expert.md +26 -0
  52. package/templates/.claude/agents/tool-npm-expert.md +31 -0
  53. package/templates/.claude/agents/tool-optimizer.md +37 -0
  54. package/templates/.claude/agents/wiki-curator.md +72 -0
  55. package/templates/.claude/config/required-plugins.json +30 -0
  56. package/templates/.claude/contexts/dev.md +20 -0
  57. package/templates/.claude/contexts/ecomode.md +110 -0
  58. package/templates/.claude/contexts/index.yaml +41 -0
  59. package/templates/.claude/contexts/research.md +28 -0
  60. package/templates/.claude/contexts/review.md +23 -0
  61. package/templates/.claude/hooks/hooks.json +533 -0
  62. package/templates/.claude/hooks/scripts/adaptive-harness-scan.sh +45 -0
  63. package/templates/.claude/hooks/scripts/agent-start-recorder.sh +40 -0
  64. package/templates/.claude/hooks/scripts/agent-teams-advisor.sh +76 -0
  65. package/templates/.claude/hooks/scripts/audit-log.sh +64 -0
  66. package/templates/.claude/hooks/scripts/auto-continue-guard.sh +33 -0
  67. package/templates/.claude/hooks/scripts/content-hash-validator.sh +75 -0
  68. package/templates/.claude/hooks/scripts/context-budget-advisor.sh +107 -0
  69. package/templates/.claude/hooks/scripts/cost-cap-advisor.sh +71 -0
  70. package/templates/.claude/hooks/scripts/cwd-change-detector.sh +36 -0
  71. package/templates/.claude/hooks/scripts/eval-core-batch-save.sh +46 -0
  72. package/templates/.claude/hooks/scripts/feedback-collector.sh +92 -0
  73. package/templates/.claude/hooks/scripts/file-change-validator.sh +26 -0
  74. package/templates/.claude/hooks/scripts/git-delegation-guard.sh +57 -0
  75. package/templates/.claude/hooks/scripts/model-escalation-advisor.sh +106 -0
  76. package/templates/.claude/hooks/scripts/omcodex-auto-update.sh +4 -0
  77. package/templates/.claude/hooks/scripts/omcustom-auto-update.sh +177 -0
  78. package/templates/.claude/hooks/scripts/rtk-intercept.sh +77 -0
  79. package/templates/.claude/hooks/scripts/rule-deletion-guard.sh +60 -0
  80. package/templates/.claude/hooks/scripts/schema-validator.sh +106 -0
  81. package/templates/.claude/hooks/scripts/secret-filter.sh +100 -0
  82. package/templates/.claude/hooks/scripts/session-autofix-prompt.sh +34 -0
  83. package/templates/.claude/hooks/scripts/session-autofix.sh +146 -0
  84. package/templates/.claude/hooks/scripts/session-env-check.sh +254 -0
  85. package/templates/.claude/hooks/scripts/skill-extractor-analyzer.sh +49 -0
  86. package/templates/.claude/hooks/scripts/stage-blocker.sh +16 -0
  87. package/templates/.claude/hooks/scripts/stale-todo-scanner.sh +91 -0
  88. package/templates/.claude/hooks/scripts/stall-detection-advisor.sh +112 -0
  89. package/templates/.claude/hooks/scripts/stop-console-audit.sh +46 -0
  90. package/templates/.claude/hooks/scripts/stuck-detector.sh +199 -0
  91. package/templates/.claude/hooks/scripts/task-outcome-recorder.sh +119 -0
  92. package/templates/.claude/hooks/scripts/task-state-precompact.sh +58 -0
  93. package/templates/.claude/hooks/scripts/user-prompt-preprocessor.sh +32 -0
  94. package/templates/.claude/hooks/skill-count-reminder.sh +34 -0
  95. package/templates/.claude/install-hooks.sh +100 -0
  96. package/templates/.claude/ontology/agents.yaml +546 -0
  97. package/templates/.claude/ontology/graphs/agent-skill.json +102 -0
  98. package/templates/.claude/ontology/graphs/full-graph.json +629 -0
  99. package/templates/.claude/ontology/graphs/routing.json +112 -0
  100. package/templates/.claude/ontology/graphs/skill-rule.json +78 -0
  101. package/templates/.claude/ontology/rules.yaml +251 -0
  102. package/templates/.claude/ontology/schema.yaml +144 -0
  103. package/templates/.claude/ontology/skills.yaml +575 -0
  104. package/templates/.claude/rules/MAY-optimization.md +42 -0
  105. package/templates/.claude/rules/MUST-agent-design.md +340 -0
  106. package/templates/.claude/rules/MUST-agent-identification.md +77 -0
  107. package/templates/.claude/rules/MUST-agent-teams.md +293 -0
  108. package/templates/.claude/rules/MUST-completion-verification.md +112 -0
  109. package/templates/.claude/rules/MUST-continuous-improvement.md +69 -0
  110. package/templates/.claude/rules/MUST-enforcement-policy.md +50 -0
  111. package/templates/.claude/rules/MUST-intent-transparency.md +74 -0
  112. package/templates/.claude/rules/MUST-language-policy.md +28 -0
  113. package/templates/.claude/rules/MUST-orchestrator-coordination.md +399 -0
  114. package/templates/.claude/rules/MUST-parallel-execution.md +184 -0
  115. package/templates/.claude/rules/MUST-permissions.md +32 -0
  116. package/templates/.claude/rules/MUST-safety.md +23 -0
  117. package/templates/.claude/rules/MUST-sync-verification.md +145 -0
  118. package/templates/.claude/rules/MUST-tool-identification.md +97 -0
  119. package/templates/.claude/rules/SHOULD-ecomode.md +123 -0
  120. package/templates/.claude/rules/SHOULD-error-handling.md +33 -0
  121. package/templates/.claude/rules/SHOULD-hud-statusline.md +51 -0
  122. package/templates/.claude/rules/SHOULD-interaction.md +77 -0
  123. package/templates/.claude/rules/SHOULD-memory-integration.md +371 -0
  124. package/templates/.claude/rules/SHOULD-ontology-rag-routing.md +49 -0
  125. package/templates/.claude/rules/SHOULD-wiki-sync.md +73 -0
  126. package/templates/.claude/rules/index.yaml +141 -0
  127. package/templates/.claude/schemas/tool-inputs.json +62 -0
  128. package/templates/.claude/skills/action-validator/SKILL.md +89 -0
  129. package/templates/.claude/skills/adaptive-harness/SKILL.md +335 -0
  130. package/templates/.claude/skills/adversarial-review/SKILL.md +80 -0
  131. package/templates/.claude/skills/agora/SKILL.md +194 -0
  132. package/templates/.claude/skills/airflow-best-practices/SKILL.md +94 -0
  133. package/templates/.claude/skills/alembic-best-practices/SKILL.md +295 -0
  134. package/templates/.claude/skills/ambiguity-gate/SKILL.md +94 -0
  135. package/templates/.claude/skills/analysis/SKILL.md +223 -0
  136. package/templates/.claude/skills/audit-agents/SKILL.md +118 -0
  137. package/templates/.claude/skills/aws-best-practices/SKILL.md +281 -0
  138. package/templates/.claude/skills/claude-code-bible/SKILL.md +93 -0
  139. package/templates/.claude/skills/claude-code-bible/scripts/fetch-docs.js +244 -0
  140. package/templates/.claude/skills/claude-native/SKILL.md +215 -0
  141. package/templates/.claude/skills/codex-exec/SKILL.md +206 -0
  142. package/templates/.claude/skills/codex-exec/scripts/codex-wrapper.cjs +430 -0
  143. package/templates/.claude/skills/create-agent/SKILL.md +94 -0
  144. package/templates/.claude/skills/cve-triage/SKILL.md +91 -0
  145. package/templates/.claude/skills/dag-orchestration/SKILL.md +201 -0
  146. package/templates/.claude/skills/dbt-best-practices/SKILL.md +55 -0
  147. package/templates/.claude/skills/de-lead-routing/SKILL.md +230 -0
  148. package/templates/.claude/skills/deep-plan/SKILL.md +344 -0
  149. package/templates/.claude/skills/deep-verify/SKILL.md +111 -0
  150. package/templates/.claude/skills/dev-lead-routing/SKILL.md +161 -0
  151. package/templates/.claude/skills/dev-refactor/SKILL.md +234 -0
  152. package/templates/.claude/skills/dev-review/SKILL.md +172 -0
  153. package/templates/.claude/skills/django-best-practices/SKILL.md +334 -0
  154. package/templates/.claude/skills/docker-best-practices/SKILL.md +276 -0
  155. package/templates/.claude/skills/evaluator-optimizer/SKILL.md +421 -0
  156. package/templates/.claude/skills/fastapi-best-practices/SKILL.md +271 -0
  157. package/templates/.claude/skills/fix-refs/SKILL.md +109 -0
  158. package/templates/.claude/skills/flutter-best-practices/SKILL.md +325 -0
  159. package/templates/.claude/skills/gemini-exec/SKILL.md +215 -0
  160. package/templates/.claude/skills/gemini-exec/scripts/gemini-wrapper.cjs +485 -0
  161. package/templates/.claude/skills/go-backend-best-practices/SKILL.md +135 -0
  162. package/templates/.claude/skills/go-best-practices/SKILL.md +204 -0
  163. package/templates/.claude/skills/hada-scout/SKILL.md +92 -0
  164. package/templates/.claude/skills/harness-eval/SKILL.md +95 -0
  165. package/templates/.claude/skills/harness-synthesizer/SKILL.md +145 -0
  166. package/templates/.claude/skills/help/SKILL.md +127 -0
  167. package/templates/.claude/skills/idea/SKILL.md +88 -0
  168. package/templates/.claude/skills/impeccable-design/SKILL.md +173 -0
  169. package/templates/.claude/skills/intent-detection/SKILL.md +293 -0
  170. package/templates/.claude/skills/intent-detection/patterns/agent-triggers.yaml +438 -0
  171. package/templates/.claude/skills/java21-best-practices/SKILL.md +190 -0
  172. package/templates/.claude/skills/jinja2-prompts/SKILL.md +86 -0
  173. package/templates/.claude/skills/kafka-best-practices/SKILL.md +53 -0
  174. package/templates/.claude/skills/kotlin-best-practices/SKILL.md +257 -0
  175. package/templates/.claude/skills/lists/SKILL.md +80 -0
  176. package/templates/.claude/skills/memory-management/SKILL.md +196 -0
  177. package/templates/.claude/skills/memory-recall/SKILL.md +172 -0
  178. package/templates/.claude/skills/memory-save/SKILL.md +128 -0
  179. package/templates/.claude/skills/model-escalation/SKILL.md +62 -0
  180. package/templates/.claude/skills/monitoring-setup/SKILL.md +215 -0
  181. package/templates/.claude/skills/multi-model-verification/SKILL.md +130 -0
  182. package/templates/.claude/skills/npm-audit/SKILL.md +74 -0
  183. package/templates/.claude/skills/npm-publish/SKILL.md +65 -0
  184. package/templates/.claude/skills/npm-version/SKILL.md +104 -0
  185. package/templates/.claude/skills/omcodex-auto-improve/SKILL.md +136 -0
  186. package/templates/.claude/skills/omcodex-feedback/SKILL.md +205 -0
  187. package/templates/.claude/skills/omcodex-improve-report/SKILL.md +65 -0
  188. package/templates/.claude/skills/omcodex-loop/SKILL.md +45 -0
  189. package/templates/.claude/skills/omcodex-release-notes/SKILL.md +117 -0
  190. package/templates/.claude/skills/omcodex-takeover/SKILL.md +115 -0
  191. package/templates/.claude/skills/omcodex-web/SKILL.md +95 -0
  192. package/templates/.claude/skills/optimize-analyze/SKILL.md +57 -0
  193. package/templates/.claude/skills/optimize-bundle/SKILL.md +69 -0
  194. package/templates/.claude/skills/optimize-report/SKILL.md +76 -0
  195. package/templates/.claude/skills/peer-messaging/SKILL.md +59 -0
  196. package/templates/.claude/skills/pipeline/SKILL.md +103 -0
  197. package/templates/.claude/skills/pipeline-architecture-patterns/SKILL.md +84 -0
  198. package/templates/.claude/skills/pipeline-guards/SKILL.md +173 -0
  199. package/templates/.claude/skills/post-release-followup/SKILL.md +134 -0
  200. package/templates/.claude/skills/postgres-best-practices/SKILL.md +67 -0
  201. package/templates/.claude/skills/pr-auto-improve/SKILL.md +129 -0
  202. package/templates/.claude/skills/professor-triage/SKILL.md +321 -0
  203. package/templates/.claude/skills/python-best-practices/SKILL.md +223 -0
  204. package/templates/.claude/skills/qa-lead-routing/SKILL.md +104 -0
  205. package/templates/.claude/skills/react-best-practices/SKILL.md +102 -0
  206. package/templates/.claude/skills/reasoning-sandwich/SKILL.md +64 -0
  207. package/templates/.claude/skills/redis-best-practices/SKILL.md +84 -0
  208. package/templates/.claude/skills/release-plan/SKILL.md +207 -0
  209. package/templates/.claude/skills/research/SKILL.md +493 -0
  210. package/templates/.claude/skills/result-aggregation/SKILL.md +165 -0
  211. package/templates/.claude/skills/rtk-exec/SKILL.md +199 -0
  212. package/templates/.claude/skills/rtk-exec/scripts/rtk-wrapper.cjs +377 -0
  213. package/templates/.claude/skills/rust-best-practices/SKILL.md +268 -0
  214. package/templates/.claude/skills/sauron-watch/SKILL.md +239 -0
  215. package/templates/.claude/skills/scout/SKILL.md +250 -0
  216. package/templates/.claude/skills/sdd/SKILL.md +24 -0
  217. package/templates/.claude/skills/sdd-dev/SKILL.md +257 -0
  218. package/templates/.claude/skills/sdd-development/SKILL.md +24 -0
  219. package/templates/.claude/skills/secretary-routing/SKILL.md +132 -0
  220. package/templates/.claude/skills/skill-extractor/SKILL.md +155 -0
  221. package/templates/.claude/skills/skills-sh-search/SKILL.md +210 -0
  222. package/templates/.claude/skills/snowflake-best-practices/SKILL.md +66 -0
  223. package/templates/.claude/skills/spark-best-practices/SKILL.md +53 -0
  224. package/templates/.claude/skills/springboot-best-practices/SKILL.md +74 -0
  225. package/templates/.claude/skills/springboot-best-practices/examples/config-properties-example.java +22 -0
  226. package/templates/.claude/skills/springboot-best-practices/examples/controller-example.java +28 -0
  227. package/templates/.claude/skills/springboot-best-practices/examples/controller-test-example.java +33 -0
  228. package/templates/.claude/skills/springboot-best-practices/examples/entity-example.java +22 -0
  229. package/templates/.claude/skills/springboot-best-practices/examples/exception-handler-example.java +30 -0
  230. package/templates/.claude/skills/springboot-best-practices/examples/repository-example.java +17 -0
  231. package/templates/.claude/skills/springboot-best-practices/examples/repository-test-example.java +23 -0
  232. package/templates/.claude/skills/springboot-best-practices/examples/security-config-example.java +27 -0
  233. package/templates/.claude/skills/springboot-best-practices/examples/service-example.java +33 -0
  234. package/templates/.claude/skills/status/SKILL.md +155 -0
  235. package/templates/.claude/skills/structured-dev-cycle/SKILL.md +200 -0
  236. package/templates/.claude/skills/stuck-recovery/SKILL.md +80 -0
  237. package/templates/.claude/skills/supabase-postgres-best-practices/SKILL.md +100 -0
  238. package/templates/.claude/skills/systematic-debugging/SKILL.md +288 -0
  239. package/templates/.claude/skills/systematic-debugging/condition-based-waiting-example.ts +278 -0
  240. package/templates/.claude/skills/systematic-debugging/condition-based-waiting.md +240 -0
  241. package/templates/.claude/skills/systematic-debugging/defense-in-depth.md +252 -0
  242. package/templates/.claude/skills/systematic-debugging/find-polluter.sh +147 -0
  243. package/templates/.claude/skills/systematic-debugging/root-cause-tracing.md +87 -0
  244. package/templates/.claude/skills/task-decomposition/SKILL.md +197 -0
  245. package/templates/.claude/skills/typescript-best-practices/SKILL.md +322 -0
  246. package/templates/.claude/skills/update-docs/SKILL.md +142 -0
  247. package/templates/.claude/skills/update-external/SKILL.md +169 -0
  248. package/templates/.claude/skills/vercel-deploy/SKILL.md +75 -0
  249. package/templates/.claude/skills/web-design-guidelines/SKILL.md +119 -0
  250. package/templates/.claude/skills/wiki/SKILL.md +426 -0
  251. package/templates/.claude/skills/wiki-rag/SKILL.md +154 -0
  252. package/templates/.claude/skills/worker-reviewer-pipeline/SKILL.md +165 -0
  253. package/templates/.claude/skills/writing-clearly-and-concisely/SKILL.md +66 -0
  254. package/templates/.claude/statusline.sh +380 -0
  255. package/templates/.claude/uninstall-hooks.sh +52 -0
  256. package/templates/.github/workflows/wiki-sync.yml +132 -0
  257. package/templates/AGENTS.md.en +255 -0
  258. package/templates/AGENTS.md.ko +255 -0
  259. package/templates/CLAUDE.md +263 -0
  260. package/templates/CLAUDE.md.en +256 -0
  261. package/templates/CLAUDE.md.ko +256 -0
  262. package/templates/deprecated-files.json +10 -0
  263. package/templates/guides/agents-md-quality/README.md +110 -0
  264. package/templates/guides/airflow/README.md +47 -0
  265. package/templates/guides/alembic/README.md +438 -0
  266. package/templates/guides/aws/common-patterns.md +169 -0
  267. package/templates/guides/aws/index.yaml +26 -0
  268. package/templates/guides/aws/well-architected.md +143 -0
  269. package/templates/guides/cc-token-saver/README.md +97 -0
  270. package/templates/guides/claude-code/01-overview.md +42 -0
  271. package/templates/guides/claude-code/03-tools.md +107 -0
  272. package/templates/guides/claude-code/04-agent-skills.md +90 -0
  273. package/templates/guides/claude-code/05-agent-sdk.md +129 -0
  274. package/templates/guides/claude-code/06-mcp.md +165 -0
  275. package/templates/guides/claude-code/07-prompt-engineering.md +100 -0
  276. package/templates/guides/claude-code/08-testing.md +56 -0
  277. package/templates/guides/claude-code/09-guardrails.md +78 -0
  278. package/templates/guides/claude-code/10-monitoring.md +87 -0
  279. package/templates/guides/claude-code/11-sub-agents.md +159 -0
  280. package/templates/guides/claude-code/12-workflow-patterns.md +182 -0
  281. package/templates/guides/claude-code/13-cli-flags.md +151 -0
  282. package/templates/guides/claude-code/index.yaml +61 -0
  283. package/templates/guides/dbt/README.md +32 -0
  284. package/templates/guides/django-best-practices/README.md +476 -0
  285. package/templates/guides/docker/compose-best-practices.md +284 -0
  286. package/templates/guides/docker/dockerfile-best-practices.md +262 -0
  287. package/templates/guides/docker/index.yaml +26 -0
  288. package/templates/guides/drizzle-orm/README.md +69 -0
  289. package/templates/guides/elements-of-style/elements-of-style.html +2609 -0
  290. package/templates/guides/fastapi/best-practices.md +232 -0
  291. package/templates/guides/fastapi/index.yaml +21 -0
  292. package/templates/guides/flutter/architecture.md +141 -0
  293. package/templates/guides/flutter/fundamentals.md +119 -0
  294. package/templates/guides/flutter/index.yaml +44 -0
  295. package/templates/guides/flutter/performance.md +119 -0
  296. package/templates/guides/flutter/security.md +120 -0
  297. package/templates/guides/flutter/state-management.md +144 -0
  298. package/templates/guides/flutter/testing.md +155 -0
  299. package/templates/guides/git-worktree-workflow/README.md +138 -0
  300. package/templates/guides/go-backend/index.yaml +26 -0
  301. package/templates/guides/go-backend/project-layout.md +243 -0
  302. package/templates/guides/go-backend/uber-style.md +212 -0
  303. package/templates/guides/golang/concurrency.md +282 -0
  304. package/templates/guides/golang/effective-go.md +309 -0
  305. package/templates/guides/golang/error-handling.md +250 -0
  306. package/templates/guides/golang/index.yaml +27 -0
  307. package/templates/guides/hook-data-flow/README.md +135 -0
  308. package/templates/guides/iceberg/README.md +49 -0
  309. package/templates/guides/impeccable-design/color-and-contrast.md +278 -0
  310. package/templates/guides/impeccable-design/index.yaml +12 -0
  311. package/templates/guides/impeccable-design/motion-design.md +390 -0
  312. package/templates/guides/impeccable-design/typography.md +386 -0
  313. package/templates/guides/impeccable-design/ux-writing.md +400 -0
  314. package/templates/guides/index.yaml +265 -0
  315. package/templates/guides/java21/index.yaml +29 -0
  316. package/templates/guides/java21/java-style-guide.md +248 -0
  317. package/templates/guides/java21/modern-java21.md +303 -0
  318. package/templates/guides/kafka/README.md +32 -0
  319. package/templates/guides/kotlin/coding-conventions.md +247 -0
  320. package/templates/guides/kotlin/idioms.md +234 -0
  321. package/templates/guides/kotlin/index.yaml +26 -0
  322. package/templates/guides/multi-model-routing/README.md +101 -0
  323. package/templates/guides/multi-provider-exec/README.md +83 -0
  324. package/templates/guides/postgres/README.md +58 -0
  325. package/templates/guides/python/index.yaml +26 -0
  326. package/templates/guides/python/pep8-style-guide.md +202 -0
  327. package/templates/guides/python/zen-of-python.md +79 -0
  328. package/templates/guides/redis/README.md +50 -0
  329. package/templates/guides/rust/error-handling.md +262 -0
  330. package/templates/guides/rust/index.yaml +26 -0
  331. package/templates/guides/rust/ownership.md +180 -0
  332. package/templates/guides/skill-bundle-design/README.md +106 -0
  333. package/templates/guides/slack-cli/README.md +145 -0
  334. package/templates/guides/snowflake/README.md +32 -0
  335. package/templates/guides/spark/README.md +32 -0
  336. package/templates/guides/springboot/best-practices.md +361 -0
  337. package/templates/guides/springboot/index.yaml +22 -0
  338. package/templates/guides/supabase-postgres/README.md +32 -0
  339. package/templates/guides/supabase-postgres/index.yaml +19 -0
  340. package/templates/guides/typescript/advanced-types.md +225 -0
  341. package/templates/guides/typescript/index.yaml +26 -0
  342. package/templates/guides/typescript/type-system.md +219 -0
  343. package/templates/guides/web-design/accessibility.md +66 -0
  344. package/templates/guides/web-design/index.yaml +20 -0
  345. package/templates/guides/web-design/performance.md +102 -0
  346. package/templates/guides/web-scraping/README.md +926 -0
  347. package/templates/guides/web-scraping/index.yaml +19 -0
  348. package/templates/guides/worktree-lifecycle/README.md +104 -0
  349. package/templates/index.yaml +18 -0
  350. package/templates/manifest.json +49 -0
  351. package/templates/workflows/auto-dev.yaml +46 -0
@@ -0,0 +1,112 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Stall Detection Advisor
5
+ # Trigger: SubagentStop
6
+ # Purpose: Detect stalled parallel agents and advise adaptive splitting (R009)
7
+ # Protocol: stdin JSON -> analyze durations -> stderr advisory, stdout pass-through, exit 0 always (R021)
8
+
9
+ # ORDERING: This hook MUST run AFTER task-outcome-recorder.sh in hooks.json SubagentStop array.
10
+ # Reason: This script removes consumed entries from AGENT_START_FILE; task-outcome-recorder reads them first.
11
+
12
+ command -v jq >/dev/null 2>&1 || { cat; exit 0; }
13
+
14
+ input=$(cat)
15
+
16
+ AGENT_START_FILE="/tmp/.codex-agent-starts-${PPID}"
17
+ DURATION_FILE="/tmp/.codex-agent-durations-${PPID}"
18
+
19
+ # Skip if no start records exist
20
+ [ -f "$AGENT_START_FILE" ] || { echo "$input"; exit 0; }
21
+
22
+ # --- 1. Extract completed agent info ---
23
+ agent_type=$(echo "$input" | jq -r '.agent_type // "unknown"')
24
+ model=$(echo "$input" | jq -r '.model // "inherit"')
25
+ description=$(echo "$input" | jq -r '.description // ""' | head -c 80)
26
+
27
+ # --- 2. Calculate duration from start record ---
28
+ start_epoch=$(grep -F "\"agent_type\":\"${agent_type}\"" "$AGENT_START_FILE" 2>/dev/null | tail -1 | jq -r '.start_epoch // "0"' 2>/dev/null || echo "0")
29
+
30
+ if [ "$start_epoch" = "0" ] || [ "$start_epoch" = "null" ]; then
31
+ echo "$input"
32
+ exit 0
33
+ fi
34
+
35
+ now_epoch=$(date +%s)
36
+ duration_seconds=$((now_epoch - start_epoch))
37
+
38
+ # Guard against negative duration (NTP adjustment, clock skew)
39
+ if [ "$duration_seconds" -lt 0 ]; then duration_seconds=0; fi
40
+
41
+ # --- 3. Stall detection (BEFORE recording this agent's duration, so self is excluded from average) ---
42
+ # Need at least 1 completed peer to calculate average
43
+ if [ -f "$DURATION_FILE" ]; then
44
+ completed_count=$(wc -l < "$DURATION_FILE" | tr -d ' ')
45
+ else
46
+ completed_count=0
47
+ fi
48
+
49
+ if [ "$completed_count" -ge 1 ]; then
50
+ # Calculate average duration of completed agents (null-safe)
51
+ avg_duration=$(jq -s '[.[].duration_seconds | numbers] | if length == 0 then 0 else add / length | floor end' "$DURATION_FILE" 2>/dev/null || echo "0")
52
+
53
+ if [ "$avg_duration" -gt 0 ]; then
54
+ stall_threshold=$((avg_duration * 2))
55
+
56
+ # Check for still-running agents (in start file but not in duration file)
57
+ if [ -f "$AGENT_START_FILE" ] && [ -s "$AGENT_START_FILE" ]; then
58
+ while IFS= read -r line; do
59
+ running_agent=$(echo "$line" | jq -r '.agent_type // ""' 2>/dev/null || true)
60
+ running_start=$(echo "$line" | jq -r '.start_epoch // "0"' 2>/dev/null || echo "0")
61
+ running_desc=$(echo "$line" | jq -r '.description // ""' 2>/dev/null || true)
62
+ running_model=$(echo "$line" | jq -r '.model // "inherit"' 2>/dev/null || true)
63
+
64
+ if [ "$running_start" = "0" ] || [ "$running_start" = "null" ]; then continue; fi
65
+
66
+ elapsed=$((now_epoch - running_start))
67
+
68
+ if [ "$elapsed" -gt "$stall_threshold" ]; then
69
+ # --- Emit advisory (stderr) ---
70
+ echo "" >&2
71
+ echo "─── [Stall Detection Advisory] ───────────────────────────" >&2
72
+ echo " Stalled: ${running_agent}:${running_model} (${elapsed}s elapsed, 2x avg ${avg_duration}s)" >&2
73
+ echo " Description: ${running_desc}" >&2
74
+ echo " ⚡ Consider spawning independent pending tasks immediately" >&2
75
+ echo " R009 Adaptive Parallel Splitting applies" >&2
76
+ echo "──────────────────────────────────────────────────────────" >&2
77
+ echo "" >&2
78
+ fi
79
+ done < "$AGENT_START_FILE"
80
+ fi
81
+ fi
82
+ fi
83
+
84
+ # --- 4. Record duration (AFTER stall detection so self is excluded from average) ---
85
+ duration_entry=$(jq -cn \
86
+ --arg agent "$agent_type" \
87
+ --arg model "$model" \
88
+ --arg desc "$description" \
89
+ --arg dur "$duration_seconds" \
90
+ --arg ts "$now_epoch" \
91
+ '{agent_type: $agent, model: $model, description: $desc, duration_seconds: ($dur | tonumber), timestamp: $ts}')
92
+
93
+ echo "$duration_entry" >> "$DURATION_FILE"
94
+
95
+ # Remove only first consumed start entry (preserve siblings for parallel same-type agents)
96
+ if [ -f "$AGENT_START_FILE" ]; then
97
+ awk -v pat="\"agent_type\":\"${agent_type}\"" 'found || $0 !~ pat { print; next } { found=1 }' "$AGENT_START_FILE" > "${AGENT_START_FILE}.tmp" 2>/dev/null || true
98
+ mv "${AGENT_START_FILE}.tmp" "$AGENT_START_FILE" 2>/dev/null || true
99
+ fi
100
+
101
+ # Ring buffer: 50 max
102
+ if [ -f "$DURATION_FILE" ]; then
103
+ line_count=$(wc -l < "$DURATION_FILE" | tr -d ' ')
104
+ if [ "$line_count" -gt 50 ]; then
105
+ tail -50 "$DURATION_FILE" > "${DURATION_FILE}.tmp"
106
+ mv "${DURATION_FILE}.tmp" "$DURATION_FILE"
107
+ fi
108
+ fi
109
+
110
+ # Pass through
111
+ echo "$input"
112
+ exit 0
@@ -0,0 +1,46 @@
1
+ #!/bin/bash
2
+ # Stop hook: Final audit for console.log and session diagnostics
3
+ # Always exits 0 (never blocks session termination)
4
+ # Ref: https://github.com/baekenough/oh-my-customcode/issues/206
5
+
6
+ set -euo pipefail
7
+
8
+ input=$(cat)
9
+
10
+ # --- Session diagnostics ---
11
+ # Output session status for debugging stop evaluator false positives
12
+ echo "[Stop] Session termination audit starting..." >&2
13
+
14
+ # Check for background task output files (helps diagnose evaluator false positives)
15
+ bg_task_files=$(find /tmp -maxdepth 1 -name "claude-*.output" 2>/dev/null | wc -l | tr -d ' ')
16
+ if [ "$bg_task_files" -gt 0 ]; then
17
+ echo "[Stop] Background task output files found: ${bg_task_files} (informational only — these are normal)" >&2
18
+ fi
19
+
20
+ # --- Console.log audit ---
21
+ if git rev-parse --git-dir > /dev/null 2>&1; then
22
+ modified_files=$(git diff --name-only HEAD 2>/dev/null | grep -E '\.(ts|tsx|js|jsx)$' || true)
23
+
24
+ if [ -n "$modified_files" ]; then
25
+ has_console=false
26
+ while IFS= read -r file; do
27
+ if [ -f "$file" ]; then
28
+ if grep -q "console\.log" "$file" 2>/dev/null; then
29
+ echo "[Stop] WARNING: console.log found in $file" >&2
30
+ has_console=true
31
+ fi
32
+ fi
33
+ done <<< "$modified_files"
34
+
35
+ if [ "$has_console" = true ]; then
36
+ echo "[Stop] Remove console.log statements before committing" >&2
37
+ fi
38
+ fi
39
+ fi
40
+
41
+ echo "[Stop] Audit complete. Session safe to terminate." >&2
42
+
43
+ # CRITICAL: Always pass through input and exit 0
44
+ # This hook MUST NEVER block session termination
45
+ echo "$input"
46
+ exit 0
@@ -0,0 +1,199 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ HOOK_START=$(date +%s%N 2>/dev/null || echo 0)
4
+
5
+ # Dependency check: exit silently if jq not available
6
+ command -v jq >/dev/null 2>&1 || exit 0
7
+
8
+ # Stuck Detector Hook
9
+ # Trigger: PostToolUse, tool matches "Edit|Write|Bash|Task|Agent"
10
+ # Purpose: Detect repetitive failure loops and advise recovery
11
+ # Protocol: stdin JSON -> process -> stdout pass-through
12
+ # - exit 0: advisory (normal cases, < HARD_BLOCK_THRESHOLD repetitions)
13
+ # - exit 1: hard block (extreme stuck loops, >= HARD_BLOCK_THRESHOLD repetitions)
14
+
15
+ # Hard block threshold: consecutive identical operations before blocking
16
+ HARD_BLOCK_THRESHOLD=${CLAUDE_STUCK_THRESHOLD:-3}
17
+
18
+ input=$(cat)
19
+
20
+ # Extract tool info
21
+ tool_name=$(echo "$input" | jq -r '.tool_name // "unknown"')
22
+ file_path=$(echo "$input" | jq -r '.tool_input.file_path // .tool_input.command // ""' | head -c 120)
23
+ is_error=$(echo "$input" | jq -r '.tool_output.is_error // false')
24
+ output_preview=$(echo "$input" | jq -r '.tool_output.output // ""' | head -c 200)
25
+
26
+ # Session-scoped history
27
+ HISTORY_FILE="${OMCODEX_STUCK_HISTORY_FILE:-/tmp/.codex-tool-history-${PPID}}"
28
+
29
+ # Create entry
30
+ timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
31
+
32
+ # Generate error hash for deduplication (first 50 chars of error)
33
+ error_hash=""
34
+ if [ "$is_error" = "true" ]; then
35
+ error_hash=$(echo "$output_preview" | head -c 50 | md5sum 2>/dev/null | cut -d' ' -f1 || echo "unknown")
36
+ fi
37
+
38
+ entry=$(jq -cn \
39
+ --arg ts "$timestamp" \
40
+ --arg tool "$tool_name" \
41
+ --arg path "$file_path" \
42
+ --arg err "$is_error" \
43
+ --arg hash "$error_hash" \
44
+ --arg preview "$output_preview" \
45
+ '{timestamp: $ts, tool: $tool, path: $path, is_error: $err, error_hash: $hash, preview: $preview}')
46
+
47
+ echo "$entry" >> "$HISTORY_FILE"
48
+
49
+ # Ring buffer: keep last 100 entries
50
+ if [ -f "$HISTORY_FILE" ]; then
51
+ line_count=$(wc -l < "$HISTORY_FILE")
52
+ if [ "$line_count" -gt 100 ]; then
53
+ tail -100 "$HISTORY_FILE" > "${HISTORY_FILE}.tmp"
54
+ mv "${HISTORY_FILE}.tmp" "$HISTORY_FILE"
55
+ fi
56
+ fi
57
+
58
+ # --- Detection Logic ---
59
+
60
+ # Only check for patterns if we have enough history
61
+ if [ ! -f "$HISTORY_FILE" ]; then
62
+ echo "$input"
63
+ exit 0
64
+ fi
65
+
66
+ recent_count=$(wc -l < "$HISTORY_FILE")
67
+ if [ "$recent_count" -lt 3 ]; then
68
+ echo "$input"
69
+ exit 0
70
+ fi
71
+
72
+ stuck_detected=false
73
+ signal_type=""
74
+ pattern_desc=""
75
+ occurrence_count=0
76
+ threshold=0
77
+ recovery=""
78
+
79
+ # Signal 1: Repeated error (same error_hash 3+ times in last 10 entries)
80
+ if [ "$is_error" = "true" ] && [ -n "$error_hash" ]; then
81
+ error_repeat=$(tail -10 "$HISTORY_FILE" | grep -c "\"error_hash\":\"${error_hash}\"" 2>/dev/null || echo "0")
82
+ if [ "$error_repeat" -ge 3 ]; then
83
+ stuck_detected=true
84
+ signal_type="Repeated error"
85
+ pattern_desc="Same error appeared ${error_repeat} times in last 10 tool calls"
86
+ occurrence_count=$error_repeat
87
+ threshold=3
88
+ recovery="Rephrase the task or try a different approach"
89
+ fi
90
+ fi
91
+
92
+ # Signal 2: Edit loop (same file edited 3+ times in last 8 entries)
93
+ if [ "$stuck_detected" = false ] && { [ "$tool_name" = "Edit" ] || [ "$tool_name" = "Write" ]; }; then
94
+ if [ -n "$file_path" ]; then
95
+ escaped_path=$(echo "$file_path" | sed 's/[.[\*^$()+?{|]/\\&/g')
96
+ edit_repeat=$(tail -8 "$HISTORY_FILE" | grep -c "\"path\":\"${escaped_path}\"" 2>/dev/null || echo "0")
97
+ if [ "$edit_repeat" -ge 3 ]; then
98
+ stuck_detected=true
99
+ signal_type="Edit loop"
100
+ pattern_desc="$(basename "$file_path") edited ${edit_repeat} times in last 8 calls"
101
+ occurrence_count=$edit_repeat
102
+ threshold=3
103
+ recovery="Try a different file or approach instead of re-editing"
104
+ fi
105
+ fi
106
+ fi
107
+
108
+ # Signal 3: Tool spam (same tool 5+ times in last 8 entries)
109
+ if [ "$stuck_detected" = false ]; then
110
+ tool_repeat=$(tail -8 "$HISTORY_FILE" | grep -c "\"tool\":\"${tool_name}\"" 2>/dev/null || echo "0")
111
+ if [ "$tool_repeat" -ge 5 ]; then
112
+ stuck_detected=true
113
+ signal_type="Tool loop"
114
+ pattern_desc="${tool_name} called ${tool_repeat} times in last 8 calls"
115
+ occurrence_count=$tool_repeat
116
+ threshold=5
117
+ recovery="Step back and reconsider the approach"
118
+ fi
119
+ fi
120
+
121
+ # Output advisory if stuck detected
122
+ if [ "$stuck_detected" = true ]; then
123
+ echo "" >&2
124
+ echo "--- [Stuck Detection] Loop detected ---" >&2
125
+ echo " Signal: ${signal_type}" >&2
126
+ echo " Pattern: ${pattern_desc}" >&2
127
+ echo " Occurrences: ${occurrence_count}/${threshold}" >&2
128
+ echo " 💡 Recovery: ${recovery}" >&2
129
+ echo "----------------------------------------" >&2
130
+ fi
131
+
132
+ # --- Hard Block Detection (extreme stuck loops) ---
133
+ # Check if the same operation has been repeated HARD_BLOCK_THRESHOLD+ times consecutively.
134
+ # This catches cases where advisory warnings are being ignored.
135
+
136
+ hard_block=false
137
+ hard_block_reason=""
138
+
139
+ if [ -f "$HISTORY_FILE" ]; then
140
+ last_n=$(tail -"$HARD_BLOCK_THRESHOLD" "$HISTORY_FILE" 2>/dev/null)
141
+ last_n_count=$(echo "$last_n" | wc -l | tr -d ' ')
142
+
143
+ if [ "$last_n_count" -ge "$HARD_BLOCK_THRESHOLD" ]; then
144
+ # Check 1: Same file edited HARD_BLOCK_THRESHOLD+ times consecutively
145
+ if [ -n "$file_path" ]; then
146
+ escaped_path=$(echo "$file_path" | sed 's/[.[\*^$()+?{|]/\\&/g')
147
+ consecutive_file=$(echo "$last_n" | grep -c "\"path\":\"${escaped_path}\"" 2>/dev/null || echo "0")
148
+ if [ "$consecutive_file" -ge "$HARD_BLOCK_THRESHOLD" ]; then
149
+ hard_block=true
150
+ hard_block_reason="Same file ($(basename "$file_path")) edited ${consecutive_file} consecutive times"
151
+ fi
152
+ fi
153
+
154
+ # Check 2: Same error repeated HARD_BLOCK_THRESHOLD+ times consecutively
155
+ if [ "$hard_block" = false ] && [ "$is_error" = "true" ] && [ -n "$error_hash" ]; then
156
+ consecutive_error=$(echo "$last_n" | grep -c "\"error_hash\":\"${error_hash}\"" 2>/dev/null || echo "0")
157
+ if [ "$consecutive_error" -ge "$HARD_BLOCK_THRESHOLD" ]; then
158
+ hard_block=true
159
+ hard_block_reason="Same error repeated ${consecutive_error} consecutive times"
160
+ fi
161
+ fi
162
+
163
+ # Check 3: Same tool+target combination HARD_BLOCK_THRESHOLD+ times consecutively
164
+ if [ "$hard_block" = false ] && [ -n "$file_path" ]; then
165
+ escaped_path=$(echo "$file_path" | sed 's/[.[\*^$()+?{|]/\\&/g')
166
+ consecutive_tool_target=$(echo "$last_n" | grep "\"tool\":\"${tool_name}\"" | grep -c "\"path\":\"${escaped_path}\"" 2>/dev/null || echo "0")
167
+ if [ "$consecutive_tool_target" -ge "$HARD_BLOCK_THRESHOLD" ]; then
168
+ hard_block=true
169
+ hard_block_reason="${tool_name} called on $(basename "$file_path") ${consecutive_tool_target} consecutive times"
170
+ fi
171
+ fi
172
+ fi
173
+ fi
174
+
175
+ if [ "$hard_block" = true ]; then
176
+ echo "" >&2
177
+ echo "=== [Stuck Detection] HARD BLOCK ===" >&2
178
+ echo " ${hard_block_reason}" >&2
179
+ echo " Threshold: ${HARD_BLOCK_THRESHOLD} consecutive identical operations" >&2
180
+ echo " Action: Blocking this tool call to break the stuck loop." >&2
181
+ echo " Recovery: Step back, re-read the error, and try a fundamentally different approach." >&2
182
+ echo "=====================================" >&2
183
+ echo "$input"
184
+ HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
185
+ if [ "$HOOK_START" != "0" ] && [ "$HOOK_END" != "0" ]; then
186
+ HOOK_MS=$(( (HOOK_END - HOOK_START) / 1000000 ))
187
+ echo "[Hook Perf] $(basename "$0"): ${HOOK_MS}ms" >> "/tmp/.codex-hook-perf-${PPID}.log"
188
+ fi
189
+ exit 1
190
+ fi
191
+
192
+ # Pass through
193
+ echo "$input"
194
+ HOOK_END=$(date +%s%N 2>/dev/null || echo 0)
195
+ if [ "$HOOK_START" != "0" ] && [ "$HOOK_END" != "0" ]; then
196
+ HOOK_MS=$(( (HOOK_END - HOOK_START) / 1000000 ))
197
+ echo "[Hook Perf] $(basename "$0"): ${HOOK_MS}ms" >> "/tmp/.codex-hook-perf-${PPID}.log"
198
+ fi
199
+ exit 0
@@ -0,0 +1,119 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+
4
+ # Dependency check: exit silently if jq not available
5
+ command -v jq >/dev/null 2>&1 || exit 0
6
+
7
+ # Task/Agent Outcome Recorder Hook
8
+ # Trigger: PostToolUse (tool == "Task" || "Agent") and SubagentStop
9
+ # Purpose: Record task outcomes for model escalation decisions
10
+ # Protocol: stdin JSON -> process -> stdout pass-through, exit 0 always
11
+
12
+ input=$(cat)
13
+
14
+ # Extract task info — support both PostToolUse (tool_input.*) and SubagentStop (top-level) shapes
15
+ agent_type=$(echo "$input" | jq -r '.tool_input.subagent_type // .agent_type // "unknown"')
16
+ model=$(echo "$input" | jq -r '.tool_input.model // .model // "inherit"')
17
+ description=$(echo "$input" | jq -r '.tool_input.description // .description // ""' | head -c 80)
18
+
19
+ # Extract skill name from description or prompt
20
+ skill_name=""
21
+ if echo "$description" | grep -qiE '(skill:|routing|→.*skill)'; then
22
+ skill_name=$(echo "$description" | grep -oiE '[a-z]+-[a-z]+(-[a-z]+)*-?(routing|skill|practices|detection|decomposition|orchestration|pipeline|guards|cycle|plan|review|refactor|publish|version|audit|exec|analyze|bundle|report|setup|watch|lists|status|help|save|recall)' | head -1)
23
+ fi
24
+ # Fallback: check prompt field for "Skill: {name}" pattern
25
+ if [ -z "$skill_name" ]; then
26
+ prompt=$(echo "$input" | jq -r '.tool_input.prompt // ""' | head -c 500)
27
+ skill_name=$(echo "$prompt" | grep -oiE 'Skill:\s*[a-z]+-[a-z]+(-[a-z]+)*' | sed 's/[Ss]kill:\s*//' | head -1)
28
+ fi
29
+
30
+ # Determine outcome
31
+ is_error=$(echo "$input" | jq -r '.tool_output.is_error // false')
32
+
33
+ if [ "$is_error" = "true" ]; then
34
+ outcome="failure"
35
+ error_summary=$(echo "$input" | jq -r '.tool_output.output // ""' | head -c 200)
36
+ else
37
+ outcome="success"
38
+ error_summary=""
39
+ fi
40
+
41
+ # Session-scoped outcome log and agent count tracker
42
+ OUTCOME_FILE="/tmp/.codex-task-outcomes-${PPID}"
43
+ TASK_COUNT_FILE="/tmp/.codex-task-count-${PPID}"
44
+
45
+ # --- Pattern Detection ---
46
+ # Priority: skill-specific patterns > parallel > sequential (default)
47
+ pattern="sequential"
48
+
49
+ # Check description for skill-specific workflow patterns
50
+ desc_lower=$(echo "$description" | tr '[:upper:]' '[:lower:]')
51
+
52
+ if echo "$desc_lower" | grep -qE '(evaluator.optimizer|evaluator_optimizer)'; then
53
+ pattern="evaluator-optimizer"
54
+ elif echo "$desc_lower" | grep -qE '(worker.reviewer|worker_reviewer)'; then
55
+ pattern="worker-reviewer"
56
+ elif echo "$desc_lower" | grep -qE '(dag.orchestrat|dag_orchestrat|multi.phase|orchestrat)'; then
57
+ pattern="orchestrator"
58
+ elif echo "$desc_lower" | grep -qE '(parallel|\[1\]|\[2\]|\[3\]|\[4\])'; then
59
+ pattern="parallel"
60
+ else
61
+ # Infer parallel from agent count: if 2+ agents spawned this session, mark as parallel
62
+ if [ -f "$TASK_COUNT_FILE" ]; then
63
+ session_agent_count=$(cat "$TASK_COUNT_FILE" 2>/dev/null || echo "0")
64
+ if [ "$session_agent_count" -ge 2 ] 2>/dev/null; then
65
+ pattern="parallel"
66
+ fi
67
+ fi
68
+ fi
69
+
70
+ # Duration calculation from start recorder
71
+ # ORDERING: This script MUST run BEFORE stall-detection-advisor.sh in hooks.json SubagentStop array.
72
+ # Reason: stall-detection-advisor removes consumed entries from AGENT_START_FILE after reading.
73
+ AGENT_START_FILE="/tmp/.codex-agent-starts-${PPID}"
74
+ duration_seconds=0
75
+ if [ -f "$AGENT_START_FILE" ]; then
76
+ start_epoch=$(grep -F "\"agent_type\":\"${agent_type}\"" "$AGENT_START_FILE" 2>/dev/null | tail -1 | jq -r '.start_epoch // "0"' 2>/dev/null || echo "0")
77
+ if [ "$start_epoch" != "0" ] && [ "$start_epoch" != "null" ]; then
78
+ now_epoch=$(date +%s)
79
+ duration_seconds=$((now_epoch - start_epoch))
80
+ fi
81
+ fi
82
+
83
+ # Append JSON line entry
84
+ timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)
85
+ entry=$(jq -n \
86
+ --arg ts "$timestamp" \
87
+ --arg agent "$agent_type" \
88
+ --arg model "$model" \
89
+ --arg outcome "$outcome" \
90
+ --arg pattern "$pattern" \
91
+ --arg skill "$skill_name" \
92
+ --arg desc "$description" \
93
+ --arg err "$error_summary" \
94
+ --arg dur "$duration_seconds" \
95
+ '{timestamp: $ts, agent_type: $agent, model: $model, outcome: $outcome, pattern_used: $pattern, skill: $skill, description: $desc, error_summary: $err, duration_seconds: ($dur | tonumber)}')
96
+
97
+ echo "$entry" >> "$OUTCOME_FILE"
98
+
99
+ # Ring buffer: keep last 50 entries
100
+ if [ -f "$OUTCOME_FILE" ]; then
101
+ line_count=$(wc -l < "$OUTCOME_FILE")
102
+ if [ "$line_count" -gt 50 ]; then
103
+ tail -50 "$OUTCOME_FILE" > "${OUTCOME_FILE}.tmp"
104
+ mv "${OUTCOME_FILE}.tmp" "$OUTCOME_FILE"
105
+ fi
106
+ fi
107
+
108
+ # Report failures to stderr
109
+ if [ "$outcome" = "failure" ]; then
110
+ echo "" >&2
111
+ echo "--- [Agent Outcome] FAILURE: ${agent_type}:${model} ---" >&2
112
+ echo " ${description}" >&2
113
+ echo " Error: $(echo "$error_summary" | head -c 100)" >&2
114
+ echo "-----------------------------------------------" >&2
115
+ fi
116
+
117
+ # Pass through
118
+ echo "$input"
119
+ exit 0
@@ -0,0 +1,58 @@
1
+ #!/bin/bash
2
+ # PreCompact hook: serialize active task state before context compaction
3
+ # Pairs with PostCompact prompt that restores this state
4
+
5
+ STATE_FILE="/tmp/.codex-task-state-$PPID.json"
6
+
7
+ collect_state() {
8
+ local pipeline_state=""
9
+ local autonomous=""
10
+ local dev_stage=""
11
+ local tool_count=""
12
+ local loop_count=""
13
+
14
+ # Pipeline state
15
+ for f in /tmp/.codex-pipeline-*-$PPID.json; do
16
+ [ -f "$f" ] && pipeline_state=$(cat "$f" 2>/dev/null | jq -c '.' 2>/dev/null) && break
17
+ done
18
+
19
+ # Autonomous mode
20
+ [ -f "/tmp/.codex-autonomous-$PPID" ] && autonomous="true"
21
+
22
+ # Dev stage (structured-dev-cycle)
23
+ [ -f "/tmp/.codex-dev-stage" ] && dev_stage=$(cat "/tmp/.codex-dev-stage" 2>/dev/null)
24
+
25
+ # Tool call counter
26
+ [ -f "/tmp/claude-tool-count-$PPID" ] && tool_count=$(cat "/tmp/claude-tool-count-$PPID" 2>/dev/null)
27
+
28
+ # Auto-continue loop count
29
+ [ -f "/tmp/.codex-loop-count-$PPID" ] && loop_count=$(cat "/tmp/.codex-loop-count-$PPID" 2>/dev/null)
30
+
31
+ # Build JSON (keep under 500 bytes for context efficiency)
32
+ jq -n \
33
+ --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
34
+ --arg pipeline "$pipeline_state" \
35
+ --arg auto "$autonomous" \
36
+ --arg stage "$dev_stage" \
37
+ --arg tools "$tool_count" \
38
+ --arg loops "$loop_count" \
39
+ '{
40
+ captured_at: $ts,
41
+ pipeline: (if $pipeline != "" then ($pipeline | fromjson? // null) else null end),
42
+ autonomous_mode: ($auto == "true"),
43
+ dev_stage: (if $stage != "" then $stage else null end),
44
+ tool_calls: (if $tools != "" then ($tools | tonumber? // null) else null end),
45
+ loop_count: (if $loops != "" then ($loops | tonumber? // null) else null end)
46
+ } | del(.[] | nulls)'
47
+ }
48
+
49
+ state=$(collect_state 2>/dev/null)
50
+
51
+ if [ -n "$state" ] && [ "$state" != "{}" ]; then
52
+ echo "$state" > "$STATE_FILE"
53
+ echo "[PreCompact] Task state saved to $STATE_FILE" >&2
54
+ else
55
+ echo "[PreCompact] No active task state to save" >&2
56
+ fi
57
+
58
+ cat
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+ # UserPromptSubmit hook — advisory pre-processing of user input
3
+ # Provides skill matching hints based on user input patterns
4
+ # Advisory only — never blocks user prompt submission
5
+
6
+ input=$(cat)
7
+ user_input=$(echo "$input" | jq -r '.user_input // ""' 2>/dev/null)
8
+
9
+ if [ -z "$user_input" ]; then
10
+ echo "$input"
11
+ exit 0
12
+ fi
13
+
14
+ # Detect common patterns and provide advisory hints
15
+ hints=""
16
+
17
+ # Korean session-end signals
18
+ if echo "$user_input" | grep -qiE '(끝|종료|마무리|done|wrap up|end session)'; then
19
+ hints="${hints}[Hook] Session-end signal detected — R011 memory saves will be triggered\n"
20
+ fi
21
+
22
+ # Workflow invocation
23
+ if echo "$user_input" | grep -qE '^/'; then
24
+ hints="${hints}[Hook] Slash command detected\n"
25
+ fi
26
+
27
+ # Output hints to stderr (advisory)
28
+ if [ -n "$hints" ]; then
29
+ printf "%b" "$hints" >&2
30
+ fi
31
+
32
+ echo "$input"
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env bash
2
+ # skill-count-reminder.sh — Advisory reminder when skills are created/modified
3
+ # Triggered by PostToolUse on Write/Edit targeting .codex/skills/*/SKILL.md
4
+ # R021: Advisory-only, never blocks (always exit 0)
5
+
6
+ set -euo pipefail
7
+
8
+ # Read tool input from stdin
9
+ INPUT=$(cat)
10
+
11
+ # Extract the file path from the tool input
12
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // ""' 2>/dev/null)
13
+
14
+ # Only trigger for .codex/skills/ paths with SKILL.md
15
+ if [[ "$FILE_PATH" == *".codex/skills/"*"SKILL.md"* ]]; then
16
+ SKILL_NAME=$(echo "$FILE_PATH" | sed 's|.*\.codex/skills/||' | sed 's|/SKILL.md||')
17
+ ACTUAL_COUNT=$(find .codex/skills -name 'SKILL.md' 2>/dev/null | wc -l | tr -d ' ')
18
+
19
+ cat >&2 << EOF
20
+ ─── [Skill Sync Reminder] New/modified skill: ${SKILL_NAME} ───
21
+ Current skill count: ${ACTUAL_COUNT}
22
+
23
+ Update these 6 locations before committing:
24
+ 1. AGENTS.md → 스킬 (${ACTUAL_COUNT} 디렉토리)
25
+ 2. README.md line ~16 → ${ACTUAL_COUNT} skills
26
+ 3. README.md line ~135 → ### Skills (${ACTUAL_COUNT})
27
+ 4. README.md line ~275 → # ${ACTUAL_COUNT} skill modules
28
+ 5. templates/AGENTS.md → 스킬 (${ACTUAL_COUNT} 디렉토리)
29
+ 6. templates/.codex/skills/${SKILL_NAME}/SKILL.md → copy file
30
+ ───────────────────────────────────────────────────────
31
+ EOF
32
+ fi
33
+
34
+ exit 0