oh-my-codex-cli 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 (292) hide show
  1. package/.agent/skills/agent-kb/HOW_TO_USE.md +428 -0
  2. package/.agent/skills/agent-kb/README.md +46 -0
  3. package/.agent/skills/agent-kb/SKILL.md +128 -0
  4. package/.agent/skills/agent-kb/references/intelligent-analysis-explained.md +333 -0
  5. package/.agent/skills/agent-kb/references/query-optimization.md +225 -0
  6. package/.agent/skills/aireview/SKILL.md +704 -0
  7. package/.agent/skills/analyze/SKILL.md +81 -0
  8. package/.agent/skills/architect-planner/HOW_TO_USE.md +238 -0
  9. package/.agent/skills/architect-planner/README.md +41 -0
  10. package/.agent/skills/architect-planner/SKILL.md +539 -0
  11. package/.agent/skills/auto-mbti/SKILL.md +291 -0
  12. package/.agent/skills/autopilot/SKILL.md +222 -0
  13. package/.agent/skills/backend-patterns/SKILL.md +602 -0
  14. package/.agent/skills/bdd-generator/README.md +78 -0
  15. package/.agent/skills/bdd-generator/SKILL.md +436 -0
  16. package/.agent/skills/brainstorming/HOW_TO_USE.md +289 -0
  17. package/.agent/skills/brainstorming/README.md +41 -0
  18. package/.agent/skills/brainstorming/SKILL.md +165 -0
  19. package/.agent/skills/build-fix/SKILL.md +190 -0
  20. package/.agent/skills/cancel/SKILL.md +658 -0
  21. package/.agent/skills/checkpoint/SKILL.md +94 -0
  22. package/.agent/skills/code-review/SKILL.md +273 -0
  23. package/.agent/skills/coding-standards/SKILL.md +535 -0
  24. package/.agent/skills/conductor/SKILL.md +128 -0
  25. package/.agent/skills/conductor/commands/conductor/implement.toml +358 -0
  26. package/.agent/skills/conductor/commands/conductor/newTrack.toml +142 -0
  27. package/.agent/skills/conductor/commands/conductor/revert.toml +123 -0
  28. package/.agent/skills/conductor/commands/conductor/setup.toml +429 -0
  29. package/.agent/skills/conductor/commands/conductor/status.toml +57 -0
  30. package/.agent/skills/conductor/scripts/install.sh +89 -0
  31. package/.agent/skills/conductor/templates/code_styleguides/csharp.md +115 -0
  32. package/.agent/skills/conductor/templates/code_styleguides/dart.md +238 -0
  33. package/.agent/skills/conductor/templates/code_styleguides/general.md +23 -0
  34. package/.agent/skills/conductor/templates/code_styleguides/go.md +48 -0
  35. package/.agent/skills/conductor/templates/code_styleguides/html-css.md +49 -0
  36. package/.agent/skills/conductor/templates/code_styleguides/javascript.md +51 -0
  37. package/.agent/skills/conductor/templates/code_styleguides/python.md +37 -0
  38. package/.agent/skills/conductor/templates/code_styleguides/typescript.md +43 -0
  39. package/.agent/skills/conductor/templates/rules/README.md +23 -0
  40. package/.agent/skills/conductor/templates/rules/agents.md +49 -0
  41. package/.agent/skills/conductor/templates/rules/coding-style.md +70 -0
  42. package/.agent/skills/conductor/templates/rules/dev.md +20 -0
  43. package/.agent/skills/conductor/templates/rules/git-workflow.md +45 -0
  44. package/.agent/skills/conductor/templates/rules/hooks.md +6 -0
  45. package/.agent/skills/conductor/templates/rules/patterns.md +55 -0
  46. package/.agent/skills/conductor/templates/rules/performance.md +47 -0
  47. package/.agent/skills/conductor/templates/rules/research.md +26 -0
  48. package/.agent/skills/conductor/templates/rules/review.md +22 -0
  49. package/.agent/skills/conductor/templates/rules/security.md +36 -0
  50. package/.agent/skills/conductor/templates/rules/testing.md +30 -0
  51. package/.agent/skills/conductor/templates/workflow.md +333 -0
  52. package/.agent/skills/consensus/HOW_TO_USE.md +191 -0
  53. package/.agent/skills/consensus/README.md +41 -0
  54. package/.agent/skills/consensus/SKILL.md +317 -0
  55. package/.agent/skills/content-research-writer/SKILL.md +537 -0
  56. package/.agent/skills/debug-analysis/SKILL.md +331 -0
  57. package/.agent/skills/deepinit/SKILL.md +347 -0
  58. package/.agent/skills/deepsearch/SKILL.md +56 -0
  59. package/.agent/skills/doctor/SKILL.md +158 -0
  60. package/.agent/skills/drawio/EXAMPLES.md +382 -0
  61. package/.agent/skills/drawio/QUICK_START.md +237 -0
  62. package/.agent/skills/drawio/README.md +315 -0
  63. package/.agent/skills/drawio/SETUP_GUIDE.md +254 -0
  64. package/.agent/skills/drawio/SKILL.md +1176 -0
  65. package/.agent/skills/e2e/SKILL.md +396 -0
  66. package/.agent/skills/ecomode/SKILL.md +160 -0
  67. package/.agent/skills/electron-driver/SKILL.md +144 -0
  68. package/.agent/skills/electron-driver/scripts/driver-template.js +71 -0
  69. package/.agent/skills/eval/SKILL.md +140 -0
  70. package/.agent/skills/eval-harness/SKILL.md +242 -0
  71. package/.agent/skills/evolve/SKILL.md +213 -0
  72. package/.agent/skills/frontend-design/SKILL.md +42 -0
  73. package/.agent/skills/frontend-patterns/SKILL.md +646 -0
  74. package/.agent/skills/frontend-ui-ux/SKILL.md +70 -0
  75. package/.agent/skills/git-master/SKILL.md +75 -0
  76. package/.agent/skills/help/SKILL.md +89 -0
  77. package/.agent/skills/iterative-retrieval/SKILL.md +217 -0
  78. package/.agent/skills/local-skills-setup/SKILL.md +483 -0
  79. package/.agent/skills/log-analyzer/SKILL.md +187 -0
  80. package/.agent/skills/mcp-setup/SKILL.md +226 -0
  81. package/.agent/skills/multi-model-research/HOW_TO_USE.md +614 -0
  82. package/.agent/skills/multi-model-research/README.md +233 -0
  83. package/.agent/skills/multi-model-research/SKILL.md +541 -0
  84. package/.agent/skills/multi-model-research/references/troubleshooting.md +415 -0
  85. package/.agent/skills/note/SKILL.md +80 -0
  86. package/.agent/skills/omc-setup/SKILL.md +219 -0
  87. package/.agent/skills/orchestrate/SKILL.md +620 -0
  88. package/.agent/skills/patent-workflow/IMPLEMENTATION_SUMMARY.md +500 -0
  89. package/.agent/skills/patent-workflow/README.md +455 -0
  90. package/.agent/skills/patent-workflow/SKILL.md +1036 -0
  91. package/.agent/skills/patent-workflow/tools/irr_checker.py +260 -0
  92. package/.agent/skills/patent-workflow/tools/sample_terminology.json +49 -0
  93. package/.agent/skills/patent-workflow/tools/term_checker.py +355 -0
  94. package/.agent/skills/pattern-recognition/SKILL.md +792 -0
  95. package/.agent/skills/pipeline/SKILL.md +448 -0
  96. package/.agent/skills/plan/SKILL.md +309 -0
  97. package/.agent/skills/planning-methodology/SKILL.md +370 -0
  98. package/.agent/skills/planning-with-files/SKILL.md +210 -0
  99. package/.agent/skills/planning-with-files/examples.md +202 -0
  100. package/.agent/skills/planning-with-files/reference.md +218 -0
  101. package/.agent/skills/planning-with-files/scripts/check-complete.ps1 +42 -0
  102. package/.agent/skills/planning-with-files/scripts/check-complete.sh +44 -0
  103. package/.agent/skills/planning-with-files/scripts/init-session.ps1 +120 -0
  104. package/.agent/skills/planning-with-files/scripts/init-session.sh +120 -0
  105. package/.agent/skills/planning-with-files/scripts/session-catchup.py +208 -0
  106. package/.agent/skills/planning-with-files/templates/findings.md +95 -0
  107. package/.agent/skills/planning-with-files/templates/progress.md +114 -0
  108. package/.agent/skills/planning-with-files/templates/task_plan.md +132 -0
  109. package/.agent/skills/project-analyze/CLAUDE.md +18 -0
  110. package/.agent/skills/project-analyze/HOW_TO_USE.md +145 -0
  111. package/.agent/skills/project-analyze/README.md +42 -0
  112. package/.agent/skills/project-analyze/SKILL.md +289 -0
  113. package/.agent/skills/project-analyze/SKILL.md.backup +287 -0
  114. package/.agent/skills/project-analyze/SKILL.md.backup_20260105_093646 +287 -0
  115. package/.agent/skills/project-analyze/assets/analysis-report-template.md +433 -0
  116. package/.agent/skills/project-analyze/references/analysis-patterns.md +422 -0
  117. package/.agent/skills/project-analyze/references/projectmind-explained.md +535 -0
  118. package/.agent/skills/project-session-manager/SKILL.md +428 -0
  119. package/.agent/skills/project-session-manager/lib/config.sh +86 -0
  120. package/.agent/skills/project-session-manager/lib/parse.sh +121 -0
  121. package/.agent/skills/project-session-manager/lib/session.sh +132 -0
  122. package/.agent/skills/project-session-manager/lib/tmux.sh +103 -0
  123. package/.agent/skills/project-session-manager/lib/worktree.sh +171 -0
  124. package/.agent/skills/project-session-manager/psm.sh +629 -0
  125. package/.agent/skills/project-session-manager/templates/feature.md +56 -0
  126. package/.agent/skills/project-session-manager/templates/issue-fix.md +57 -0
  127. package/.agent/skills/project-session-manager/templates/pr-review.md +65 -0
  128. package/.agent/skills/project-session-manager/templates/projects.json +19 -0
  129. package/.agent/skills/quality-check/HOW_TO_USE.md +171 -0
  130. package/.agent/skills/quality-check/README.md +50 -0
  131. package/.agent/skills/quality-check/SKILL.md +240 -0
  132. package/.agent/skills/quality-check/SKILL.md.backup +238 -0
  133. package/.agent/skills/quality-check/SKILL.md.backup_20260105_093646 +238 -0
  134. package/.agent/skills/quality-check/assets/quality-report-template.md +437 -0
  135. package/.agent/skills/quality-check/references/refactoring-patterns.md +550 -0
  136. package/.agent/skills/quality-check/references/scoring-criteria.md +454 -0
  137. package/.agent/skills/quality-validation/SKILL.md +519 -0
  138. package/.agent/skills/quality-validation/SKILL.md.backup +573 -0
  139. package/.agent/skills/quality-validation/SKILL.md.backup_20260105_093646 +573 -0
  140. package/.agent/skills/ralph/SKILL.md +236 -0
  141. package/.agent/skills/ralph-init/SKILL.md +78 -0
  142. package/.agent/skills/ralplan/SKILL.md +58 -0
  143. package/.agent/skills/refactor-clean/SKILL.md +49 -0
  144. package/.agent/skills/release/SKILL.md +84 -0
  145. package/.agent/skills/research/SKILL.md +526 -0
  146. package/.agent/skills/research-methodology/SKILL.md +268 -0
  147. package/.agent/skills/review/SKILL.md +53 -0
  148. package/.agent/skills/security-review/SKILL.md +509 -0
  149. package/.agent/skills/security-review/cloud-infrastructure-security.md +361 -0
  150. package/.agent/skills/setup-pm/SKILL.md +102 -0
  151. package/.agent/skills/skill/SKILL.md +424 -0
  152. package/.agent/skills/skill-create/SKILL.md +209 -0
  153. package/.agent/skills/skill-debugger/HOW_TO_USE.md +244 -0
  154. package/.agent/skills/skill-debugger/README.md +44 -0
  155. package/.agent/skills/skill-debugger/SKILL.md +326 -0
  156. package/.agent/skills/skill-debugger/diagnostic_checklist.md +115 -0
  157. package/.agent/skills/skill-development/SKILL.md +661 -0
  158. package/.agent/skills/skill-development/references/skill-creator-original.md +209 -0
  159. package/.agent/skills/skill-doc-generator/README.md +37 -0
  160. package/.agent/skills/skill-doc-generator/SKILL.md +331 -0
  161. package/.agent/skills/skill-quality-analyzer/HOW_TO_USE.md +243 -0
  162. package/.agent/skills/skill-quality-analyzer/README.md +61 -0
  163. package/.agent/skills/skill-quality-analyzer/SKILL.md +247 -0
  164. package/.agent/skills/skill-quality-analyzer/analyzer.py +209 -0
  165. package/.agent/skills/skill-quality-analyzer/expected_output.json +81 -0
  166. package/.agent/skills/skill-quality-analyzer/sample_input.json +9 -0
  167. package/.agent/skills/skill-tester/README.md +46 -0
  168. package/.agent/skills/skill-tester/SKILL.md +345 -0
  169. package/.agent/skills/start-dev/SKILL.md +701 -0
  170. package/.agent/skills/swarm/SKILL.md +691 -0
  171. package/.agent/skills/task-kb-lookup/SKILL.md +211 -0
  172. package/.agent/skills/task-kb-record/SKILL.md +417 -0
  173. package/.agent/skills/tdd/SKILL.md +446 -0
  174. package/.agent/skills/tdd-generator/DEMO.md +516 -0
  175. package/.agent/skills/tdd-generator/README.md +89 -0
  176. package/.agent/skills/tdd-generator/SKILL.md +278 -0
  177. package/.agent/skills/tdd-workflow/SKILL.md +424 -0
  178. package/.agent/skills/test-coverage/SKILL.md +48 -0
  179. package/.agent/skills/thinkdeep/HOW_TO_USE.md +183 -0
  180. package/.agent/skills/thinkdeep/README.md +41 -0
  181. package/.agent/skills/thinkdeep/SKILL.md +343 -0
  182. package/.agent/skills/ui-ux-pro-max/SKILL.md +228 -0
  183. package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
  184. package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
  185. package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
  186. package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
  187. package/.agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  188. package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  189. package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  190. package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  191. package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  192. package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  193. package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  194. package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  195. package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  196. package/.agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
  197. package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
  198. package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  199. package/.agent/skills/ui-ux-pro-max/scripts/core.py +236 -0
  200. package/.agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
  201. package/.agent/skills/ultrapilot/SKILL.md +647 -0
  202. package/.agent/skills/ultraqa/SKILL.md +152 -0
  203. package/.agent/skills/ultrawork/SKILL.md +123 -0
  204. package/.agent/skills/update-codemaps/SKILL.md +38 -0
  205. package/.agent/skills/update-docs/SKILL.md +52 -0
  206. package/.agent/skills/verification-loop/SKILL.md +140 -0
  207. package/.agent/skills/verify/SKILL.md +80 -0
  208. package/.agent/skills/writer-memory/SKILL.md +459 -0
  209. package/.agent/skills/writer-memory/lib/character-tracker.ts +338 -0
  210. package/.agent/skills/writer-memory/lib/memory-manager.ts +804 -0
  211. package/.agent/skills/writer-memory/lib/relationship-graph.ts +400 -0
  212. package/.agent/skills/writer-memory/lib/scene-organizer.ts +544 -0
  213. package/.agent/skills/writer-memory/lib/synopsis-builder.ts +339 -0
  214. package/.agent/skills/writer-memory/templates/synopsis-template.md +46 -0
  215. package/.governance/skill-lint.allowlist +4 -0
  216. package/.governance/skill-llm.allowlist +4 -0
  217. package/AGENTS.md +59 -0
  218. package/LICENSE +21 -0
  219. package/README.md +169 -0
  220. package/README.zh.md +145 -0
  221. package/bin/omcodex.js +8 -0
  222. package/commands/conductor/implement.toml +358 -0
  223. package/commands/conductor/newTrack.toml +142 -0
  224. package/commands/conductor/revert.toml +123 -0
  225. package/commands/conductor/setup.toml +429 -0
  226. package/commands/conductor/status.toml +57 -0
  227. package/docs/ALIGNMENT.md +40 -0
  228. package/docs/CODEX.md +133 -0
  229. package/docs/NOTIFY.md +81 -0
  230. package/docs/SKILL_GOVERNANCE.md +72 -0
  231. package/docs/SKILL_GOVERNANCE_FRAMEWORK.md +182 -0
  232. package/docs/SKILL_GOVERNANCE_FRAMEWORK.zh.md +170 -0
  233. package/package.json +50 -0
  234. package/prompts/architect.md +105 -0
  235. package/prompts/executor.md +134 -0
  236. package/prompts/planner.md +113 -0
  237. package/scripts/check-skill-governance.sh +84 -0
  238. package/scripts/check-skill-llm-governance.js +302 -0
  239. package/scripts/eval-skills.js +217 -0
  240. package/scripts/generate-catalog-docs.js +95 -0
  241. package/scripts/generate-codex-mcp-config.sh +22 -0
  242. package/scripts/install-codex-force.sh +5 -0
  243. package/scripts/install-codex-incremental.sh +5 -0
  244. package/scripts/install-codex.sh +79 -0
  245. package/scripts/notify-dispatch.js +15 -0
  246. package/scripts/setup-package-manager.js +137 -0
  247. package/src/catalog/generated/public-catalog.json +547 -0
  248. package/src/catalog/manifest.json +542 -0
  249. package/src/catalog/reader.js +43 -0
  250. package/src/catalog/schema.js +79 -0
  251. package/src/cli/doctor.js +62 -0
  252. package/src/cli/index.js +85 -0
  253. package/src/cli/notify.js +127 -0
  254. package/src/cli/route.js +43 -0
  255. package/src/cli/setup.js +155 -0
  256. package/src/cli/team.js +125 -0
  257. package/src/config/generator.js +119 -0
  258. package/src/mcp/memory-server.js +241 -0
  259. package/src/mcp/state-server.js +112 -0
  260. package/src/mcp/trace-server.js +168 -0
  261. package/src/notify/dispatch.js +74 -0
  262. package/src/notify/extensibility/dispatcher.js +113 -0
  263. package/src/notify/extensibility/events.js +15 -0
  264. package/src/notify/extensibility/loader.js +54 -0
  265. package/src/router/skill-router.js +90 -0
  266. package/src/team/auto-advance.js +72 -0
  267. package/src/team/orchestrator.js +82 -0
  268. package/src/team/state-store.js +33 -0
  269. package/src/utils/paths.js +33 -0
  270. package/templates/AGENTS.md +15 -0
  271. package/templates/catalog-manifest.json +542 -0
  272. package/templates/code_styleguides/csharp.md +115 -0
  273. package/templates/code_styleguides/dart.md +238 -0
  274. package/templates/code_styleguides/general.md +23 -0
  275. package/templates/code_styleguides/go.md +48 -0
  276. package/templates/code_styleguides/html-css.md +49 -0
  277. package/templates/code_styleguides/javascript.md +51 -0
  278. package/templates/code_styleguides/python.md +37 -0
  279. package/templates/code_styleguides/typescript.md +43 -0
  280. package/templates/rules/README.md +23 -0
  281. package/templates/rules/agents.md +49 -0
  282. package/templates/rules/coding-style.md +70 -0
  283. package/templates/rules/dev.md +20 -0
  284. package/templates/rules/git-workflow.md +45 -0
  285. package/templates/rules/notify.md +6 -0
  286. package/templates/rules/patterns.md +55 -0
  287. package/templates/rules/performance.md +47 -0
  288. package/templates/rules/research.md +26 -0
  289. package/templates/rules/review.md +22 -0
  290. package/templates/rules/security.md +36 -0
  291. package/templates/rules/testing.md +30 -0
  292. package/templates/workflow.md +333 -0
@@ -0,0 +1,535 @@
1
+ ---
2
+ name: coding-standards
3
+ description: Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development.
4
+ ---
5
+
6
+ # Coding Standards & Best Practices
7
+
8
+
9
+ ## Native Subagent Protocol (Codex)
10
+
11
+ Codex supports native subagents. Delegate with `spawn_agent`, coordinate with `send_input`, collect via `wait`, and clean up with `close_agent`.
12
+
13
+ Execution preference:
14
+ 1. Use native subagents first for independent workstreams (parallel when possible).
15
+ 2. Merge results in main thread and run final verification.
16
+ 3. Fallback only when delegation is blocked: use the `[ANALYST]`/`[ARCHITECT]`/`[EXECUTOR]`/`[REVIEWER]` structure in a single response.
17
+
18
+ Minimal orchestration pattern:
19
+ ```text
20
+ spawn_agent -> send_input (optional) -> wait -> close_agent
21
+ ```
22
+
23
+ Universal coding standards applicable across all projects.
24
+
25
+ ## Code Quality Principles
26
+
27
+ ### 1. Readability First
28
+ - Code is read more than written
29
+ - Clear variable and function names
30
+ - Self-documenting code preferred over comments
31
+ - Consistent formatting
32
+
33
+ ### 2. KISS (Keep It Simple, Stupid)
34
+ - Simplest solution that works
35
+ - Avoid over-engineering
36
+ - No premature optimization
37
+ - Easy to understand > clever code
38
+
39
+ ### 3. DRY (Don't Repeat Yourself)
40
+ - Extract common logic into functions
41
+ - Create reusable components
42
+ - Share utilities across modules
43
+ - Avoid copy-paste programming
44
+
45
+ ### 4. YAGNI (You Aren't Gonna Need It)
46
+ - Don't build features before they're needed
47
+ - Avoid speculative generality
48
+ - Add complexity only when required
49
+ - Start simple, refactor when needed
50
+
51
+ ## TypeScript/JavaScript Standards
52
+
53
+ ### Variable Naming
54
+
55
+ ```typescript
56
+ // ✅ GOOD: Descriptive names
57
+ const marketSearchQuery = 'election'
58
+ const isUserAuthenticated = true
59
+ const totalRevenue = 1000
60
+
61
+ // ❌ BAD: Unclear names
62
+ const q = 'election'
63
+ const flag = true
64
+ const x = 1000
65
+ ```
66
+
67
+ ### Function Naming
68
+
69
+ ```typescript
70
+ // ✅ GOOD: Verb-noun pattern
71
+ async function fetchMarketData(marketId: string) { }
72
+ function calculateSimilarity(a: number[], b: number[]) { }
73
+ function isValidEmail(email: string): boolean { }
74
+
75
+ // ❌ BAD: Unclear or noun-only
76
+ async function market(id: string) { }
77
+ function similarity(a, b) { }
78
+ function email(e) { }
79
+ ```
80
+
81
+ ### Immutability Pattern (CRITICAL)
82
+
83
+ ```typescript
84
+ // ✅ ALWAYS use spread operator
85
+ const updatedUser = {
86
+ ...user,
87
+ name: 'New Name'
88
+ }
89
+
90
+ const updatedArray = [...items, newItem]
91
+
92
+ // ❌ NEVER mutate directly
93
+ user.name = 'New Name' // BAD
94
+ items.push(newItem) // BAD
95
+ ```
96
+
97
+ ### Error Handling
98
+
99
+ ```typescript
100
+ // ✅ GOOD: Comprehensive error handling
101
+ async function fetchData(url: string) {
102
+ try {
103
+ const response = await fetch(url)
104
+
105
+ if (!response.ok) {
106
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`)
107
+ }
108
+
109
+ return await response.json()
110
+ } catch (error) {
111
+ console.error('Fetch failed:', error)
112
+ throw new Error('Failed to fetch data')
113
+ }
114
+ }
115
+
116
+ // ❌ BAD: No error handling
117
+ async function fetchData(url) {
118
+ const response = await fetch(url)
119
+ return response.json()
120
+ }
121
+ ```
122
+
123
+ ### Async/Await Best Practices
124
+
125
+ ```typescript
126
+ // ✅ GOOD: Parallel execution when possible
127
+ const [users, markets, stats] = await Promise.all([
128
+ fetchUsers(),
129
+ fetchMarkets(),
130
+ fetchStats()
131
+ ])
132
+
133
+ // ❌ BAD: Sequential when unnecessary
134
+ const users = await fetchUsers()
135
+ const markets = await fetchMarkets()
136
+ const stats = await fetchStats()
137
+ ```
138
+
139
+ ### Type Safety
140
+
141
+ ```typescript
142
+ // ✅ GOOD: Proper types
143
+ interface Market {
144
+ id: string
145
+ name: string
146
+ status: 'active' | 'resolved' | 'closed'
147
+ created_at: Date
148
+ }
149
+
150
+ function getMarket(id: string): Promise<Market> {
151
+ // Implementation
152
+ }
153
+
154
+ // ❌ BAD: Using 'any'
155
+ function getMarket(id: any): Promise<any> {
156
+ // Implementation
157
+ }
158
+ ```
159
+
160
+ ## React Best Practices
161
+
162
+ ### Component Structure
163
+
164
+ ```typescript
165
+ // ✅ GOOD: Functional component with types
166
+ interface ButtonProps {
167
+ children: React.ReactNode
168
+ onClick: () => void
169
+ disabled?: boolean
170
+ variant?: 'primary' | 'secondary'
171
+ }
172
+
173
+ export function Button({
174
+ children,
175
+ onClick,
176
+ disabled = false,
177
+ variant = 'primary'
178
+ }: ButtonProps) {
179
+ return (
180
+ <button
181
+ onClick={onClick}
182
+ disabled={disabled}
183
+ className={`btn btn-${variant}`}
184
+ >
185
+ {children}
186
+ </button>
187
+ )
188
+ }
189
+
190
+ // ❌ BAD: No types, unclear structure
191
+ export function Button(props) {
192
+ return <button onClick={props.onClick}>{props.children}</button>
193
+ }
194
+ ```
195
+
196
+ ### Custom Hooks
197
+
198
+ ```typescript
199
+ // ✅ GOOD: Reusable custom hook
200
+ export function useDebounce<T>(value: T, delay: number): T {
201
+ const [debouncedValue, setDebouncedValue] = useState<T>(value)
202
+
203
+ useEffect(() => {
204
+ const handler = setTimeout(() => {
205
+ setDebouncedValue(value)
206
+ }, delay)
207
+
208
+ return () => clearTimeout(handler)
209
+ }, [value, delay])
210
+
211
+ return debouncedValue
212
+ }
213
+
214
+ // Usage
215
+ const debouncedQuery = useDebounce(searchQuery, 500)
216
+ ```
217
+
218
+ ### State Management
219
+
220
+ ```typescript
221
+ // ✅ GOOD: Proper state updates
222
+ const [count, setCount] = useState(0)
223
+
224
+ // Functional update for state based on previous state
225
+ setCount(prev => prev + 1)
226
+
227
+ // ❌ BAD: Direct state reference
228
+ setCount(count + 1) // Can be stale in async scenarios
229
+ ```
230
+
231
+ ### Conditional Rendering
232
+
233
+ ```typescript
234
+ // ✅ GOOD: Clear conditional rendering
235
+ {isLoading && <Spinner />}
236
+ {error && <ErrorMessage error={error} />}
237
+ {data && <DataDisplay data={data} />}
238
+
239
+ // ❌ BAD: Ternary hell
240
+ {isLoading ? <Spinner /> : error ? <ErrorMessage error={error} /> : data ? <DataDisplay data={data} /> : null}
241
+ ```
242
+
243
+ ## API Design Standards
244
+
245
+ ### REST API Conventions
246
+
247
+ ```
248
+ GET /api/markets # List all markets
249
+ GET /api/markets/:id # Get specific market
250
+ POST /api/markets # Create new market
251
+ PUT /api/markets/:id # Update market (full)
252
+ PATCH /api/markets/:id # Update market (partial)
253
+ DELETE /api/markets/:id # Delete market
254
+
255
+ # Query parameters for filtering
256
+ GET /api/markets?status=active&limit=10&offset=0
257
+ ```
258
+
259
+ ### Response Format
260
+
261
+ ```typescript
262
+ // ✅ GOOD: Consistent response structure
263
+ interface ApiResponse<T> {
264
+ success: boolean
265
+ data?: T
266
+ error?: string
267
+ meta?: {
268
+ total: number
269
+ page: number
270
+ limit: number
271
+ }
272
+ }
273
+
274
+ // Success response
275
+ return NextResponse.json({
276
+ success: true,
277
+ data: markets,
278
+ meta: { total: 100, page: 1, limit: 10 }
279
+ })
280
+
281
+ // Error response
282
+ return NextResponse.json({
283
+ success: false,
284
+ error: 'Invalid request'
285
+ }, { status: 400 })
286
+ ```
287
+
288
+ ### Input Validation
289
+
290
+ ```typescript
291
+ import { z } from 'zod'
292
+
293
+ // ✅ GOOD: Schema validation
294
+ const CreateMarketSchema = z.object({
295
+ name: z.string().min(1).max(200),
296
+ description: z.string().min(1).max(2000),
297
+ endDate: z.string().datetime(),
298
+ categories: z.array(z.string()).min(1)
299
+ })
300
+
301
+ export async function POST(request: Request) {
302
+ const body = await request.json()
303
+
304
+ try {
305
+ const validated = CreateMarketSchema.parse(body)
306
+ // Proceed with validated data
307
+ } catch (error) {
308
+ if (error instanceof z.ZodError) {
309
+ return NextResponse.json({
310
+ success: false,
311
+ error: 'Validation failed',
312
+ details: error.errors
313
+ }, { status: 400 })
314
+ }
315
+ }
316
+ }
317
+ ```
318
+
319
+ ## File Organization
320
+
321
+ ### Project Structure
322
+
323
+ ```
324
+ src/
325
+ ├── app/ # Next.js App Router
326
+ │ ├── api/ # API routes
327
+ │ ├── markets/ # Market pages
328
+ │ └── (auth)/ # Auth pages (route groups)
329
+ ├── components/ # React components
330
+ │ ├── ui/ # Generic UI components
331
+ │ ├── forms/ # Form components
332
+ │ └── layouts/ # Layout components
333
+ ├── hooks/ # Custom React hooks
334
+ ├── lib/ # Utilities and configs
335
+ │ ├── api/ # API clients
336
+ │ ├── utils/ # Helper functions
337
+ │ └── constants/ # Constants
338
+ ├── types/ # TypeScript types
339
+ └── styles/ # Global styles
340
+ ```
341
+
342
+ ### File Naming
343
+
344
+ ```
345
+ components/Button.tsx # PascalCase for components
346
+ hooks/useAuth.ts # camelCase with 'use' prefix
347
+ lib/formatDate.ts # camelCase for utilities
348
+ types/market.types.ts # camelCase with .types suffix
349
+ ```
350
+
351
+ ## Comments & Documentation
352
+
353
+ ### When to Comment
354
+
355
+ ```typescript
356
+ // ✅ GOOD: Explain WHY, not WHAT
357
+ // Use exponential backoff to avoid overwhelming the API during outages
358
+ const delay = Math.min(1000 * Math.pow(2, retryCount), 30000)
359
+
360
+ // Deliberately using mutation here for performance with large arrays
361
+ items.push(newItem)
362
+
363
+ // ❌ BAD: Stating the obvious
364
+ // Increment counter by 1
365
+ count++
366
+
367
+ // Set name to user's name
368
+ name = user.name
369
+ ```
370
+
371
+ ### JSDoc for Public APIs
372
+
373
+ ```typescript
374
+ /**
375
+ * Searches markets using semantic similarity.
376
+ *
377
+ * @param query - Natural language search query
378
+ * @param limit - Maximum number of results (default: 10)
379
+ * @returns Array of markets sorted by similarity score
380
+ * @throws {Error} If OpenAI API fails or Redis unavailable
381
+ *
382
+ * @example
383
+ * ```typescript
384
+ * const results = await searchMarkets('election', 5)
385
+ * console.log(results[0].name) // "Trump vs Biden"
386
+ * ```
387
+ */
388
+ export async function searchMarkets(
389
+ query: string,
390
+ limit: number = 10
391
+ ): Promise<Market[]> {
392
+ // Implementation
393
+ }
394
+ ```
395
+
396
+ ## Performance Best Practices
397
+
398
+ ### Memoization
399
+
400
+ ```typescript
401
+ import { useMemo, useCallback } from 'react'
402
+
403
+ // ✅ GOOD: Memoize expensive computations
404
+ const sortedMarkets = useMemo(() => {
405
+ return markets.sort((a, b) => b.volume - a.volume)
406
+ }, [markets])
407
+
408
+ // ✅ GOOD: Memoize callbacks
409
+ const handleSearch = useCallback((query: string) => {
410
+ setSearchQuery(query)
411
+ }, [])
412
+ ```
413
+
414
+ ### Lazy Loading
415
+
416
+ ```typescript
417
+ import { lazy, Suspense } from 'react'
418
+
419
+ // ✅ GOOD: Lazy load heavy components
420
+ const HeavyChart = lazy(() => import('./HeavyChart'))
421
+
422
+ export function Dashboard() {
423
+ return (
424
+ <Suspense fallback={<Spinner />}>
425
+ <HeavyChart />
426
+ </Suspense>
427
+ )
428
+ }
429
+ ```
430
+
431
+ ### Database Queries
432
+
433
+ ```typescript
434
+ // ✅ GOOD: Select only needed columns
435
+ const { data } = await supabase
436
+ .from('markets')
437
+ .select('id, name, status')
438
+ .limit(10)
439
+
440
+ // ❌ BAD: Select everything
441
+ const { data } = await supabase
442
+ .from('markets')
443
+ .select('*')
444
+ ```
445
+
446
+ ## Testing Standards
447
+
448
+ ### Test Structure (AAA Pattern)
449
+
450
+ ```typescript
451
+ test('calculates similarity correctly', () => {
452
+ // Arrange
453
+ const vector1 = [1, 0, 0]
454
+ const vector2 = [0, 1, 0]
455
+
456
+ // Act
457
+ const similarity = calculateCosineSimilarity(vector1, vector2)
458
+
459
+ // Assert
460
+ expect(similarity).toBe(0)
461
+ })
462
+ ```
463
+
464
+ ### Test Naming
465
+
466
+ ```typescript
467
+ // ✅ GOOD: Descriptive test names
468
+ test('returns empty array when no markets match query', () => { })
469
+ test('throws error when OpenAI API key is missing', () => { })
470
+ test('falls back to substring search when Redis unavailable', () => { })
471
+
472
+ // ❌ BAD: Vague test names
473
+ test('works', () => { })
474
+ test('test search', () => { })
475
+ ```
476
+
477
+ ## Code Smell Detection
478
+
479
+ Watch for these anti-patterns:
480
+
481
+ ### 1. Long Functions
482
+ ```typescript
483
+ // ❌ BAD: Function > 50 lines
484
+ function processMarketData() {
485
+ // 100 lines of code
486
+ }
487
+
488
+ // ✅ GOOD: Split into smaller functions
489
+ function processMarketData() {
490
+ const validated = validateData()
491
+ const transformed = transformData(validated)
492
+ return saveData(transformed)
493
+ }
494
+ ```
495
+
496
+ ### 2. Deep Nesting
497
+ ```typescript
498
+ // ❌ BAD: 5+ levels of nesting
499
+ if (user) {
500
+ if (user.isAdmin) {
501
+ if (market) {
502
+ if (market.isActive) {
503
+ if (hasPermission) {
504
+ // Do something
505
+ }
506
+ }
507
+ }
508
+ }
509
+ }
510
+
511
+ // ✅ GOOD: Early returns
512
+ if (!user) return
513
+ if (!user.isAdmin) return
514
+ if (!market) return
515
+ if (!market.isActive) return
516
+ if (!hasPermission) return
517
+
518
+ // Do something
519
+ ```
520
+
521
+ ### 3. Magic Numbers
522
+ ```typescript
523
+ // ❌ BAD: Unexplained numbers
524
+ if (retryCount > 3) { }
525
+ setTimeout(callback, 500)
526
+
527
+ // ✅ GOOD: Named constants
528
+ const MAX_RETRIES = 3
529
+ const DEBOUNCE_DELAY_MS = 500
530
+
531
+ if (retryCount > MAX_RETRIES) { }
532
+ setTimeout(callback, DEBOUNCE_DELAY_MS)
533
+ ```
534
+
535
+ **Remember**: Code quality is not negotiable. Clear, maintainable code enables rapid development and confident refactoring.
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: conductor
3
+ description: Use when the user explicitly asks for Conductor, wants track/spec/plan artifacts, or needs long-lived project context management. Prefer start-dev for small or one-off tasks. If Conductor is not configured in the project, start with setup.
4
+ ---
5
+
6
+ # Conductor
7
+
8
+ Conductor is a Context-Driven Development (CDD) framework that transforms AI agents into proactive project managers. The philosophy is "Measure twice, code once" - every feature follows a strict protocol: **Context -> Spec & Plan -> Implement**.
9
+
10
+ ## Native Subagent Protocol (Codex)
11
+
12
+ Codex supports native subagents. Delegate with `spawn_agent`, coordinate with `send_input`, collect via `wait`, and clean up with `close_agent`.
13
+
14
+ Execution preference:
15
+ 1. Use native subagents first for independent workstreams (parallel when possible).
16
+ 2. Merge results in main thread and run final verification.
17
+ 3. Fallback only when delegation is blocked: use the `[ANALYST]`/`[ARCHITECT]`/`[EXECUTOR]`/`[REVIEWER]` structure in a single response.
18
+
19
+ Minimal orchestration pattern:
20
+ ```text
21
+ spawn_agent -> send_input (optional) -> wait -> close_agent
22
+ ```
23
+
24
+ ## Routing (Reduce Skill Confusion)
25
+
26
+ Use **Conductor** when the user explicitly wants:
27
+ - Track/spec/plan artifacts stored on disk
28
+ - Long-lived project context and workflow governance
29
+ - A feature/bug that will span multiple sessions or contributors
30
+
31
+ Use **start-dev** instead when the task is:
32
+ - Small, one-off, or exploratory
33
+ - Focused on quick implementation without new project artifacts
34
+
35
+ If ambiguous, ask: "Do you want this managed as a Conductor track (spec/plan artifacts), or should I just use start-dev for a quick implementation?"
36
+
37
+ ## Compatibility Note
38
+
39
+ Conductor writes to a fixed `conductor/` directory. If the user asks for a custom artifact path, confirm that Conductor does not support custom paths by default, and offer either:
40
+ - Proceed with the default `conductor/` directory, or
41
+ - Pause for a manual refactor of the protocol files.
42
+
43
+ ## Core Concepts
44
+
45
+ - **Track**: A unit of work (feature or bug fix) with its own spec and plan
46
+ - **Spec**: Detailed requirements document (`spec.md`)
47
+ - **Plan**: Phased task list with checkboxes (`plan.md`)
48
+ - **Workflow**: Rules for task lifecycle, TDD, commits, and quality gates
49
+
50
+ ## Directory Structure
51
+
52
+ When initialized, Conductor creates this structure in the project:
53
+
54
+ ```
55
+ conductor/
56
+ ├── product.md # Product vision and goals
57
+ ├── product-guidelines.md # UX/brand guidelines
58
+ ├── tech-stack.md # Technology choices
59
+ ├── workflow.md # Development workflow rules
60
+ ├── tracks.md # Master list of all tracks
61
+ ├── code_styleguides/ # Language-specific style guides
62
+ ├── tracks/ # Active tracks
63
+ │ └── <track_id>/
64
+ │ ├── metadata.json
65
+ │ ├── spec.md
66
+ │ └── plan.md
67
+ └── archive/ # Completed tracks
68
+ ```
69
+
70
+ ## Available Commands
71
+
72
+ | Command | Purpose |
73
+ |---------|---------|
74
+ | **Setup** | Initialize Conductor in a project (new or existing) |
75
+ | **New Track** | Create a new feature/bug track with spec and plan |
76
+ | **Implement** | Execute tasks from a track's plan following TDD workflow |
77
+ | **Status** | Show progress overview of all tracks |
78
+ | **Revert** | Git-aware rollback of tracks, phases, or tasks |
79
+
80
+ ## Protocol References
81
+
82
+ The detailed protocols are in TOML format. Read the `prompt` field from each file:
83
+
84
+ | Action | Protocol File |
85
+ |--------|---------------|
86
+ | Setup project | `commands/conductor/setup.toml` |
87
+ | Create new track | `commands/conductor/newTrack.toml` |
88
+ | Implement tasks | `commands/conductor/implement.toml` |
89
+ | Check status | `commands/conductor/status.toml` |
90
+ | Revert changes | `commands/conductor/revert.toml` |
91
+
92
+ **How to read**: Each `.toml` file has a `prompt` field containing the full protocol instructions.
93
+
94
+ ## Task Status Markers
95
+
96
+ - `[ ]` - Pending
97
+ - `[~]` - In Progress
98
+ - `[x]` - Completed
99
+
100
+ ## Key Workflow Principles
101
+
102
+ 1. **The Plan is Source of Truth**: All work tracked in `plan.md`
103
+ 2. **Test-Driven Development**: Write tests before implementing
104
+ 3. **High Code Coverage**: Target >80% coverage
105
+ 4. **Commit After Each Task**: With git notes for traceability
106
+ 5. **Phase Checkpoints**: Manual verification at phase completion
107
+
108
+ ## When to Use Each Protocol
109
+
110
+ - **"set up conductor" or "initialize project"** -> Read `commands/conductor/setup.toml`
111
+ - **"new feature", "new track", "plan a feature"** -> Read `commands/conductor/newTrack.toml`
112
+ - **"implement", "start working", "next task"** -> Read `commands/conductor/implement.toml`
113
+ - **"status", "progress", "where are we"** -> Read `commands/conductor/status.toml`
114
+ - **"revert", "undo", "rollback"** -> Read `commands/conductor/revert.toml`
115
+ - **If the user does not mention Conductor and the task is small** -> Use `start-dev` instead
116
+
117
+ ## Assets
118
+
119
+ - **Code Styleguides**: `templates/code_styleguides/` (general, go, python, javascript, typescript, html-css)
120
+ - **Workflow Template**: `templates/workflow.md`
121
+
122
+ ## Critical Rules
123
+
124
+ 1. **Validate every tool call** - If any fails, halt and report to user
125
+ 2. **Sequential questions** - Ask one question at a time, wait for response
126
+ 3. **User confirmation required** - Before writing files or making changes
127
+ 4. **Check setup first** - Verify `conductor/` exists before any operation
128
+ 5. **Agnostic language** - Do not suggest slash commands like `$conductor:xxx`. Instead, tell the user to ask you directly (e.g., "to start implementing, just ask me" instead of "run $conductor:implement")