codymaster 4.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 (193) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +285 -0
  3. package/adapters/antigravity.js +15 -0
  4. package/adapters/claude-code.js +17 -0
  5. package/adapters/cursor.js +16 -0
  6. package/commands/bootstrap.md +49 -0
  7. package/commands/build.md +48 -0
  8. package/commands/content.md +48 -0
  9. package/commands/continuity.md +60 -0
  10. package/commands/debug.md +51 -0
  11. package/commands/demo.md +96 -0
  12. package/commands/deploy.md +51 -0
  13. package/commands/plan.md +42 -0
  14. package/commands/review.md +55 -0
  15. package/commands/track.md +46 -0
  16. package/commands/ux.md +46 -0
  17. package/dist/agent-dispatch.js +161 -0
  18. package/dist/chains/builtin.js +85 -0
  19. package/dist/continuity.js +385 -0
  20. package/dist/dashboard.js +926 -0
  21. package/dist/data.js +122 -0
  22. package/dist/index.js +2434 -0
  23. package/dist/judge.js +252 -0
  24. package/dist/parallel-dispatch.js +359 -0
  25. package/dist/parallel-quality.js +172 -0
  26. package/dist/skill-chain.js +258 -0
  27. package/install.sh +513 -0
  28. package/package.json +79 -0
  29. package/skills/.content-factory-state.json +132 -0
  30. package/skills/.git 2/logs/refs/heads/main +1 -0
  31. package/skills/.git 2/logs/refs/remotes/origin/main +1 -0
  32. package/skills/.git 2/objects/02/fb0956734b5f8ba3f918b7defd04a89cfe0076 +0 -0
  33. package/skills/.git 2/objects/08/1e129d75dc6feac6c02037272e6bd1a04e3324 +0 -0
  34. package/skills/.git 2/objects/0c/5393416f3c5e01c9a655a802bff0dd52f76f0a +0 -0
  35. package/skills/.git 2/objects/10/0b9be46978a946a77188f68be725098a122001 +0 -0
  36. package/skills/.git 2/objects/10/cf041167fc9843610eb3d90259ef3396315fdc +0 -0
  37. package/skills/.git 2/objects/12/5e19538dd6e1338ffe74f6c4c165b00435bf48 +0 -0
  38. package/skills/.git 2/objects/16/a9b9d0088d5c1347628b45a2620b479d8ad57c +0 -0
  39. package/skills/.git 2/objects/17/8c2a9ef93c33ae4eec9d58e82321f9229843a1 +0 -0
  40. package/skills/.git 2/objects/25/397ae41d09104d763bdcac2695209d85cdea89 +0 -0
  41. package/skills/.git 2/objects/2f/a836b7947f2d458e1f639788bf4bb0983a3305 +0 -0
  42. package/skills/.git 2/objects/3a/baaaf0a1c0909c0828335791557125fba911e0 +0 -0
  43. package/skills/.git 2/objects/42/2924221b81f5ce3c4e4daac9a64a24f9b01f9a +0 -0
  44. package/skills/.git 2/objects/42/ec0ce707447dc11446a34c9995fb8533801731 +0 -0
  45. package/skills/.git 2/objects/46/e43ce92866d56ce74b1d750db307cfe6154a15 +0 -0
  46. package/skills/.git 2/objects/48/5e41b633c63f55b8277bcc59f44f67681f671a +0 -0
  47. package/skills/.git 2/objects/49/49c596a3a89fa240642acd95dd3258e261eb09 +0 -0
  48. package/skills/.git 2/objects/50/9d42d8412ef8eaf7f7e138476bac2e4d10ce60 +0 -0
  49. package/skills/.git 2/objects/55/0c8c389d981b463ef849aeb792d8be3ccb6ec8 +0 -0
  50. package/skills/.git 2/objects/5d/82d3b18410cdda3ace3677436f0cb599dbe2d2 +0 -0
  51. package/skills/.git 2/objects/60/0617c58e871a38b33bf29e282d132bb3c381ad +0 -0
  52. package/skills/.git 2/objects/6a/8369a99c687b7245c92ffaf0e0f0dab9014504 +0 -0
  53. package/skills/.git 2/objects/79/bea435d40ab531c1aaf6be0432c6a5b7aaed21 +0 -0
  54. package/skills/.git 2/objects/7e/5ebd79251c2f14e4aceb86c74b6b6daae6b500 +0 -0
  55. package/skills/.git 2/objects/81/98a822a60178d6d5023ddb3e222cddf048742e +0 -0
  56. package/skills/.git 2/objects/86/0a0e1943dfe53411d2e499a1f16f46a96ef758 +0 -0
  57. package/skills/.git 2/objects/86/971fb55fdc081fdbae52376f0f13e57a4e9b04 +0 -0
  58. package/skills/.git 2/objects/88/b89dd609a0a03f8d4fe8bfde20d5b8fc1d326d +0 -0
  59. package/skills/.git 2/objects/90/8737edb6b7809e32cc01590b4e08ba42a9d40d +0 -0
  60. package/skills/.git 2/objects/93/d5a8a9a7d4fb7f11491cb596a6880528725118 +0 -0
  61. package/skills/.git 2/objects/98/46a2ab81d0c3b3eb00ef88fc56989aa7e9f316 +0 -0
  62. package/skills/.git 2/objects/9b/d8dd1e49cf274eaf9c555f3ab39dce7af5715e +0 -0
  63. package/skills/.git 2/objects/a1/13329fb0cec96ae78b222d33a24c3b5bc7fa1f +0 -0
  64. package/skills/.git 2/objects/a9/e6effe626e8a3aea3a8fc3364b492191c6e7d0 +0 -0
  65. package/skills/.git 2/objects/ad/6de7e48d9782cca9353d1ff0aa1aab7fe1df85 +0 -0
  66. package/skills/.git 2/objects/af/54ae316f771ff692e299ffcd8bf2f06b413b59 +0 -0
  67. package/skills/.git 2/objects/b0/4cb8b0b00dad633e731c1472161419e738d674 +0 -0
  68. package/skills/.git 2/objects/b3/094abb0b9ed46419b269e4a4e36a459690e3b0 +0 -0
  69. package/skills/.git 2/objects/b9/435c5d4baac2cfc5c83009ddd27b46b60db5f1 +0 -0
  70. package/skills/.git 2/objects/ba/5da17dbaec5ec2dcfdfd126aead518d1171d5c +0 -0
  71. package/skills/.git 2/objects/c0/bf58703aa258ba5dd63083bebaec8f223d844c +0 -0
  72. package/skills/.git 2/objects/c4/701a34edf1fc1bad58ccc57bd03f9426acb59a +0 -0
  73. package/skills/.git 2/objects/c7/5ccce9a4e5cc74d9b3174550cf6d993ca43638 +0 -0
  74. package/skills/.git 2/objects/c7/710d59b5a35b0f1f0a0399386643a0bd94c929 +0 -0
  75. package/skills/.git 2/objects/d1/fe58237112e953e5fec52da22cf38e08be3df9 +5 -0
  76. package/skills/.git 2/objects/d2/2bbe9fd2f74c95bc5583e803f5e435f1e2cd86 +0 -0
  77. package/skills/.git 2/objects/d7/e72852ea2bff74581dbf247d400120086229f4 +0 -0
  78. package/skills/.git 2/objects/d8/d4c3b5553e4fd72807e1d4b49ef07d9ef3ac35 +0 -0
  79. package/skills/.git 2/objects/dc/75050c2876f6a02ae2a53a3c886f395b622977 +0 -0
  80. package/skills/.git 2/objects/ee/e8546f95acec500187c08a28a8b9ee02db0dec +0 -0
  81. package/skills/.git 2/objects/ef/263c059208b416c2146434f10cb2b9fabcba16 +0 -0
  82. package/skills/.git 2/objects/f3/ae597e84d9a59b88acd21c99bde2eaf686d785 +0 -0
  83. package/skills/.git 2/objects/f3/f6f5673c821d3d8e76fa267a9e882e7a5387ea +0 -0
  84. package/skills/.git 2/objects/f9/6e6d0ad02624dd11d5848594d056caef7a5e8b +0 -0
  85. package/skills/.git 2/objects/ff/278988fc1edf0db3abcf18de795f4cc0b4f3e1 +0 -0
  86. package/skills/.git 2/refs/heads/main +1 -0
  87. package/skills/.git 2/refs/remotes/origin/main +1 -0
  88. package/skills/.pytest_cache 2/v/cache/nodeids +76 -0
  89. package/skills/.pytest_cache 2/v/cache/stepwise +1 -0
  90. package/skills/_shared/helpers.md +123 -0
  91. package/skills/_shared/outputs-convention.md +24 -0
  92. package/skills/cm-ads-tracker/SKILL.md +109 -0
  93. package/skills/cm-ads-tracker/evals/evals.json +55 -0
  94. package/skills/cm-ads-tracker/references/gtm-architecture.md +321 -0
  95. package/skills/cm-ads-tracker/references/industry-events.md +294 -0
  96. package/skills/cm-ads-tracker/references/platforms-api.md +238 -0
  97. package/skills/cm-ads-tracker/templates/capi-payload.md +79 -0
  98. package/skills/cm-ads-tracker/templates/datalayer-push.js +104 -0
  99. package/skills/cm-ads-tracker/templates/gtm-variables.js +56 -0
  100. package/skills/cm-brainstorm-idea/SKILL.md +423 -0
  101. package/skills/cm-code-review/SKILL.md +151 -0
  102. package/skills/cm-content-factory/SKILL.md +416 -0
  103. package/skills/cm-continuity/SKILL.md +399 -0
  104. package/skills/cm-dashboard/SKILL.md +533 -0
  105. package/skills/cm-dashboard/ui/app.js +1270 -0
  106. package/skills/cm-dashboard/ui/index.html +206 -0
  107. package/skills/cm-dashboard/ui/style.css +440 -0
  108. package/skills/cm-debugging/SKILL.md +412 -0
  109. package/skills/cm-deep-search/SKILL.md +242 -0
  110. package/skills/cm-design-system/SKILL.md +97 -0
  111. package/skills/cm-design-system/resources/halo-modern.md +40 -0
  112. package/skills/cm-design-system/resources/lunaris-advanced.md +40 -0
  113. package/skills/cm-design-system/resources/nitro-enterprise.md +39 -0
  114. package/skills/cm-design-system/resources/shadcn-default.md +37 -0
  115. package/skills/cm-dockit/README.md +100 -0
  116. package/skills/cm-dockit/SKILL.md +302 -0
  117. package/skills/cm-dockit/index.html +443 -0
  118. package/skills/cm-dockit/package-lock.json +1850 -0
  119. package/skills/cm-dockit/package.json +14 -0
  120. package/skills/cm-dockit/prompts/analysis.md +34 -0
  121. package/skills/cm-dockit/prompts/api-reference.md +24 -0
  122. package/skills/cm-dockit/prompts/architecture.md +21 -0
  123. package/skills/cm-dockit/prompts/data-flow.md +20 -0
  124. package/skills/cm-dockit/prompts/database.md +21 -0
  125. package/skills/cm-dockit/prompts/deployment.md +22 -0
  126. package/skills/cm-dockit/prompts/flows.md +21 -0
  127. package/skills/cm-dockit/prompts/jtbd.md +20 -0
  128. package/skills/cm-dockit/prompts/personas.md +24 -0
  129. package/skills/cm-dockit/prompts/sop-modules.md +40 -0
  130. package/skills/cm-dockit/scripts/doc-gen.sh +121 -0
  131. package/skills/cm-dockit/scripts/dockit-dashboard.sh +142 -0
  132. package/skills/cm-dockit/scripts/dockit-runner.sh +607 -0
  133. package/skills/cm-dockit/scripts/dockit-task.sh +166 -0
  134. package/skills/cm-dockit/skills/analyze-codebase.md +174 -0
  135. package/skills/cm-dockit/skills/api-reference.md +237 -0
  136. package/skills/cm-dockit/skills/changelog-guide.md +195 -0
  137. package/skills/cm-dockit/skills/content-guidelines.md +190 -0
  138. package/skills/cm-dockit/skills/sop-guide.md +184 -0
  139. package/skills/cm-dockit/skills/tech-docs.md +287 -0
  140. package/skills/cm-dockit/templates/markdown/structure.md +60 -0
  141. package/skills/cm-dockit/templates/vitepress-premium/.vitepress/config.mts +110 -0
  142. package/skills/cm-dockit/templates/vitepress-premium/.vitepress/theme/custom.css +189 -0
  143. package/skills/cm-dockit/templates/vitepress-premium/.vitepress/theme/index.ts +4 -0
  144. package/skills/cm-dockit/templates/vitepress-premium/package.json +19 -0
  145. package/skills/cm-dockit/templates/vitepress-premium/tests/frontend.test.ts +45 -0
  146. package/skills/cm-dockit/tests/runner.test.ts +66 -0
  147. package/skills/cm-dockit/workflows/export-markdown.md +82 -0
  148. package/skills/cm-dockit/workflows/generate-docs.md +68 -0
  149. package/skills/cm-dockit/workflows/setup-vitepress.md +181 -0
  150. package/skills/cm-example/SKILL.md +26 -0
  151. package/skills/cm-execution/SKILL.md +268 -0
  152. package/skills/cm-git-worktrees/SKILL.md +164 -0
  153. package/skills/cm-how-it-work/SKILL.md +189 -0
  154. package/skills/cm-identity-guard/SKILL.md +412 -0
  155. package/skills/cm-jtbd/SKILL.md +98 -0
  156. package/skills/cm-planning/SKILL.md +130 -0
  157. package/skills/cm-project-bootstrap/SKILL.md +161 -0
  158. package/skills/cm-project-bootstrap/templates/AGENTS.md +42 -0
  159. package/skills/cm-project-bootstrap/templates/frontend-safety.test.js +51 -0
  160. package/skills/cm-project-bootstrap/templates/i18n-sync.test.js +38 -0
  161. package/skills/cm-project-bootstrap/templates/pr-template.md +12 -0
  162. package/skills/cm-project-bootstrap/templates/project-identity.json +29 -0
  163. package/skills/cm-project-bootstrap/templates/vitest.config.js +10 -0
  164. package/skills/cm-quality-gate/SKILL.md +218 -0
  165. package/skills/cm-readit/SKILL.md +289 -0
  166. package/skills/cm-readit/audio-player.md +206 -0
  167. package/skills/cm-readit/examples/blog-reader.js +352 -0
  168. package/skills/cm-readit/examples/voice-cro.js +390 -0
  169. package/skills/cm-readit/tts-engine.md +262 -0
  170. package/skills/cm-readit/ui-patterns.md +362 -0
  171. package/skills/cm-readit/voice-cro.md +223 -0
  172. package/skills/cm-safe-deploy/SKILL.md +120 -0
  173. package/skills/cm-safe-deploy/templates/deploy.sh +89 -0
  174. package/skills/cm-safe-i18n/SKILL.md +473 -0
  175. package/skills/cm-secret-shield/SKILL.md +580 -0
  176. package/skills/cm-skill-chain/SKILL.md +78 -0
  177. package/skills/cm-skill-index/SKILL.md +318 -0
  178. package/skills/cm-skill-mastery/SKILL.md +169 -0
  179. package/skills/cm-start/SKILL.md +65 -0
  180. package/skills/cm-status/SKILL.md +12 -0
  181. package/skills/cm-tdd/SKILL.md +370 -0
  182. package/skills/cm-terminal/SKILL.md +177 -0
  183. package/skills/cm-test-gate/SKILL.md +242 -0
  184. package/skills/cm-ui-preview/SKILL.md +291 -0
  185. package/skills/cm-ux-master/DESIGN_STANDARD_TEMPLATE.md +54 -0
  186. package/skills/cm-ux-master/SKILL.md +114 -0
  187. package/skills/cro-methodology/SKILL.md +98 -0
  188. package/skills/cro-methodology/references/COPYWRITING.md +178 -0
  189. package/skills/cro-methodology/references/OBJECTIONS.md +135 -0
  190. package/skills/cro-methodology/references/PERSUASION.md +158 -0
  191. package/skills/cro-methodology/references/RESEARCH.md +220 -0
  192. package/skills/cro-methodology/references/funnel-analysis.md +365 -0
  193. package/skills/cro-methodology/references/testing-methodology.md +330 -0
@@ -0,0 +1,412 @@
1
+ ---
2
+ name: cm-debugging
3
+ description: Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes
4
+ ---
5
+
6
+ # Systematic Debugging
7
+
8
+ ## Overview
9
+
10
+ Random fixes waste time and create new bugs. Quick patches mask underlying issues.
11
+
12
+ **Core principle:** ALWAYS find root cause before attempting fixes. Symptom fixes are failure.
13
+
14
+ **Violating the letter of this process is violating the spirit of debugging.**
15
+
16
+ **Thinking principle (TRIZ):** Use structured cognitive tools — not just checklists — to see bugs from multiple dimensions. When linear investigation stalls, 9 Windows and Contradiction Analysis break the deadlock.
17
+
18
+ ## The Iron Law
19
+
20
+ ```
21
+ NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
22
+ ```
23
+
24
+ If you haven't completed Phase 1, you cannot propose fixes.
25
+
26
+ ## When to Use
27
+
28
+ Use for ANY technical issue:
29
+ - Test failures
30
+ - Bugs in production
31
+ - Unexpected behavior
32
+ - Performance problems
33
+ - Build failures
34
+ - Integration issues
35
+
36
+ **Use this ESPECIALLY when:**
37
+ - Under time pressure (emergencies make guessing tempting)
38
+ - "Just one quick fix" seems obvious
39
+ - You've already tried multiple fixes
40
+ - Previous fix didn't work
41
+ - You don't fully understand the issue
42
+
43
+ **Don't skip when:**
44
+ - Issue seems simple (simple bugs have root causes too)
45
+ - You're in a hurry (rushing guarantees rework)
46
+ - Manager wants it fixed NOW (systematic is faster than thrashing)
47
+
48
+ ## Bug Complexity Classifier
49
+
50
+ Before entering the phases, classify the bug to determine which cognitive tools activate:
51
+
52
+ ```
53
+ BUG enters cm-debugging
54
+ → Is reproduction straightforward AND error message points to exact cause?
55
+ → YES → SIMPLE PATH (standard Phase 0.5 → 1 → 2 → 3 → 4 → 5)
56
+ → NO → COMPLEX PATH (all phases + TRIZ tools: 9 Windows, Contradiction, Troika)
57
+
58
+ STALL DETECTOR (auto-triggers during any phase):
59
+ → Phase 1 investigation doesn't surface root cause after 2 attempts?
60
+ → Phase 3 hypothesis fails twice in a row?
61
+ → UPGRADE to Complex Path → activate TRIZ tools immediately
62
+ ```
63
+
64
+ > **Why classify?** Simple bugs don't need heavy thinking tools. Complex bugs NEED them. The stall detector catches bugs that look simple but aren't.
65
+
66
+ ## The Phases
67
+
68
+ You MUST complete each phase before proceeding to the next.
69
+
70
+ ### Phase 0.5: Memory Integrity Check (BEFORE blaming code)
71
+
72
+ > **BEFORE blaming code, ASK: "Could memory be causing this bug?"**
73
+
74
+ 1. **SUSPECT** — Identify relevant memories:
75
+ - What module/file is the bug in?
76
+ - Read `.cm/learnings.json` filtered by that scope
77
+ - List all active learnings + decisions for this area
78
+
79
+ 2. **INVESTIGATE** — Did AI follow a memory when writing buggy code?
80
+ - Check: Does the buggy code match a `prevention` pattern from any learning?
81
+ - Check: Does the buggy code follow a `decision` that may be outdated?
82
+ - If YES → that memory is a **suspect**
83
+
84
+ 3. **VERIFY** — Is the suspect memory still correct?
85
+ - Compare learning with current codebase (not when it was recorded)
86
+ - Has the dependency/pattern/architecture changed since learning was recorded?
87
+ - If memory is WRONG → proceed to HEAL
88
+
89
+ 4. **HEAL** (only if memory confirmed as cause):
90
+ - **Invalidate:** Set `status = "invalidated"` — learning is proven wrong
91
+ - **Correct:** Update `prevention` with correct info, set `status = "corrected"`
92
+ - **Scope-reduce:** Learning is right for smaller scope → narrow the scope
93
+ - **Record meta-learning** in `.cm/meta-learnings.json`
94
+
95
+ ```
96
+ IF memory caused the bug:
97
+ → HEAL memory FIRST
98
+ → THEN proceed to Phase 1 to fix code
99
+ → The code fix will be correct because memory is now correct
100
+
101
+ IF memory did NOT cause the bug:
102
+ → Proceed to Phase 1 normally
103
+ ```
104
+
105
+ > **WHY PHASE 0.5?** Fix memory first → code fix will be correct.
106
+ > Without fixing memory → bug will return next session (bug loop).
107
+
108
+ ### Phase 1: Root Cause Investigation
109
+
110
+ **BEFORE attempting ANY fix:**
111
+
112
+ 1. **Read Error Messages Carefully**
113
+ - Don't skip past errors or warnings
114
+ - They often contain the exact solution
115
+ - Read stack traces completely
116
+ - Note line numbers, file paths, error codes
117
+
118
+ 2. **Reproduce Consistently**
119
+ - Can you trigger it reliably?
120
+ - What are the exact steps?
121
+ - Does it happen every time?
122
+ - If not reproducible → gather more data, don't guess
123
+
124
+ 3. **Check Recent Changes**
125
+ - What changed that could cause this?
126
+ - Git diff, recent commits
127
+ - New dependencies, config changes
128
+ - Environmental differences
129
+
130
+ 4. **Gather Evidence in Multi-Component Systems**
131
+
132
+ **WHEN system has multiple components (CI → build → signing, API → service → database):**
133
+
134
+ **BEFORE proposing fixes, add diagnostic instrumentation:**
135
+ ```
136
+ For EACH component boundary:
137
+ - Log what data enters component
138
+ - Log what data exits component
139
+ - Verify environment/config propagation
140
+ - Check state at each layer
141
+
142
+ Run once to gather evidence showing WHERE it breaks
143
+ THEN analyze evidence to identify failing component
144
+ THEN investigate that specific component
145
+ ```
146
+
147
+ 5. **Trace Data Flow**
148
+
149
+ **WHEN error is deep in call stack:**
150
+
151
+ - Where does bad value originate?
152
+ - What called this with bad value?
153
+ - Keep tracing up until you find the source
154
+ - Fix at source, not at symptom
155
+
156
+ 6. **9 Windows Analysis (TRIZ) — Complex Path / Stall Detector**
157
+
158
+ **WHEN standard investigation stalls OR bug classified as complex:**
159
+
160
+ Map the bug across 3 time periods × 3 system scopes:
161
+
162
+ ```
163
+ ┌──────────────────┬───────────────────────┬───────────────────────┬───────────────────────┐
164
+ │ │ BEFORE bug │ DURING bug │ AFTER fix (target) │
165
+ ├──────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤
166
+ │ SUPER-SYSTEM │ What was the system │ What external │ What system-level │
167
+ │ (environment, │ environment before? │ conditions exist │ changes prevent │
168
+ │ CI, infra, │ Any env/dep/infra │ during the bug? │ recurrence? │
169
+ │ dependencies) │ changes? │ (timing, load, etc.) │ │
170
+ ├──────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤
171
+ │ SYSTEM │ How did the module │ What is the exact │ How should the │
172
+ │ (module/feature)│ work before the bug? │ broken behavior? │ module work after? │
173
+ │ │ Last known good? │ What's different │ What invariant │
174
+ │ │ (git log, deploy) │ from expected? │ must hold? │
175
+ ├──────────────────┼───────────────────────┼───────────────────────┼───────────────────────┤
176
+ │ SUB-SYSTEM │ What were the │ What specific │ What component │
177
+ │ (function, var, │ component values/ │ values/states are │ changes fix this │
178
+ │ config, state) │ states before? │ wrong now? │ at the root? │
179
+ └──────────────────┴───────────────────────┴───────────────────────┴───────────────────────┘
180
+ ```
181
+
182
+ **Fill ALL 9 windows.** This reveals:
183
+ - **Temporal blind spots:** What changed between BEFORE and DURING?
184
+ - **Scope blind spots:** Is the root cause at a DIFFERENT level than the symptom?
185
+ - **Fix quality:** Does the target AFTER state prevent the class of bug, not just this instance?
186
+
187
+ > **WHY 9 WINDOWS?** Most debugging stalls happen because you're looking at the wrong time period OR the wrong system level. 9 Windows forces you to check ALL combinations.
188
+
189
+ ### Phase 2: Pattern Analysis
190
+
191
+ **Find the pattern before fixing:**
192
+
193
+ 1. **Find Working Examples**
194
+ - Locate similar working code in same codebase
195
+ - What works that's similar to what's broken?
196
+
197
+ 2. **Compare Against References**
198
+ - If implementing pattern, read reference implementation COMPLETELY
199
+ - Don't skim - read every line
200
+ - Understand the pattern fully before applying
201
+
202
+ 3. **Identify Differences**
203
+ - What's different between working and broken?
204
+ - List every difference, however small
205
+ - Don't assume "that can't matter"
206
+
207
+ 4. **Understand Dependencies**
208
+ - What other components does this need?
209
+ - What settings, config, environment?
210
+ - What assumptions does it make?
211
+
212
+ 5. **Contradiction Analysis (TRIZ) — Complex Path / Stall Detector**
213
+
214
+ **WHEN pattern analysis reveals conflicting behaviors or "impossible" states:**
215
+
216
+ Fill in this template:
217
+
218
+ ```
219
+ CONTRADICTION TEMPLATE:
220
+ ┌─────────────────────────────────────────────────────────────┐
221
+ │ System NEEDS: [what the feature/module SHOULD do] │
222
+ │ System DOES: [what it ACTUALLY does] │
223
+ │ Conflict: [WHY it can't do both — the hidden tension] │
224
+ │ Resolution: [dissolve the contradiction, don't compromise]│
225
+ └─────────────────────────────────────────────────────────────┘
226
+ ```
227
+
228
+ **Common debugging contradictions:**
229
+ - "Function must be fast" vs "Function must be complete" → missing edge case in optimization
230
+ - "Config must be flexible" vs "Config must have safe defaults" → bad default caused the bug
231
+ - "Module must be independent" vs "Module needs shared state" → coupling created race condition
232
+
233
+ > **WHY CONTRADICTION?** Bugs often hide where two legitimate requirements CONFLICT. Standard pattern analysis compares code structure. Contradiction analysis compares system INTENTIONS.
234
+
235
+ ### Phase 3: Hypothesis and Testing
236
+
237
+ **Scientific method:**
238
+
239
+ 1. **Form Single Hypothesis**
240
+ - State clearly: "I think X is the root cause because Y"
241
+ - Write it down
242
+ - Be specific, not vague
243
+
244
+ 2. **Test Minimally**
245
+ - Make the SMALLEST possible change to test hypothesis
246
+ - One variable at a time
247
+ - Don't fix multiple things at once
248
+
249
+ 3. **Verify Before Continuing**
250
+ - Did it work? Yes → Phase 4
251
+ - Didn't work? Form NEW hypothesis
252
+ - DON'T add more fixes on top
253
+
254
+ 4. **When You Don't Know**
255
+ - Say "I don't understand X"
256
+ - Don't pretend to know
257
+ - Ask for help
258
+ - Research more
259
+
260
+ 5. **Troika Consulting (TRIZ) — Complex Path / When Hypothesis Stalls**
261
+
262
+ **WHEN you can't form a strong hypothesis OR 2 hypotheses have failed:**
263
+
264
+ Force yourself to generate hypotheses from **3 different lenses**:
265
+
266
+ ```
267
+ LENS 1 — Code Lens:
268
+ "What code path leads to this state?"
269
+ Focus: control flow, logic branches, exception handling, return values
270
+
271
+ LENS 2 — Data Lens:
272
+ "What data/input causes this? What data is missing, corrupt, or unexpected?"
273
+ Focus: input validation, data shape, null/undefined, encoding, type coercion
274
+
275
+ LENS 3 — Environment Lens:
276
+ "What environmental factor triggers this?"
277
+ Focus: timing, concurrency, config, network, filesystem, memory, OS differences
278
+ ```
279
+
280
+ **Rules:**
281
+ - You MUST generate at least 1 hypothesis from EACH lens
282
+ - If a lens seems "irrelevant" — that's exactly where the bug hides
283
+ - Test the hypothesis from the LEAST obvious lens first
284
+
285
+ > **WHY TROIKA?** When debugging stalls, it's because you're stuck in ONE perspective. Troika forces 3 fundamentally different viewpoints. The bug is almost always visible from a lens you haven't tried.
286
+
287
+ ### Phase 4: Implementation
288
+
289
+ **Fix the root cause, not the symptom:**
290
+
291
+ 1. **Create Failing Test Case**
292
+ - Simplest possible reproduction
293
+ - Automated test if possible
294
+ - MUST have before fixing
295
+ - Use the `cm-tdd` skill for writing proper failing tests
296
+
297
+ 2. **Implement Single Fix**
298
+ - Address the root cause identified
299
+ - ONE change at a time
300
+ - No "while I'm here" improvements
301
+ - No bundled refactoring
302
+
303
+ 3. **Verify Fix**
304
+ - Test passes now?
305
+ - No other tests broken?
306
+ - Issue actually resolved?
307
+
308
+ 4. **If Fix Doesn't Work**
309
+ - STOP
310
+ - Count: How many fixes have you tried?
311
+ - If < 3: Return to Phase 1, re-analyze with new information
312
+ - **If ≥ 3: STOP and question the architecture (step 5 below)**
313
+ - DON'T attempt Fix #4 without architectural discussion
314
+
315
+ 5. **If 3+ Fixes Failed: Question Architecture**
316
+
317
+ **Pattern indicating architectural problem:**
318
+ - Each fix reveals new shared state/coupling/problem in different place
319
+ - Fixes require "massive refactoring" to implement
320
+ - Each fix creates new symptoms elsewhere
321
+
322
+ **Discuss with your human partner before attempting more fixes**
323
+
324
+ This is NOT a failed hypothesis - this is a wrong architecture.
325
+
326
+ ### Step 5: Record Learning (MANDATORY)
327
+
328
+ After fixing any bug, ALWAYS write to `.cm/CONTINUITY.md` → "Mistakes & Learnings":
329
+
330
+ ```
331
+ - What Failed: [exact error message or behavior]
332
+ - Why It Failed: [root cause from Phase 1]
333
+ - How to Prevent: [concrete pattern to avoid]
334
+ - Scope: [global | module:{name} | file:{path}]
335
+ ```
336
+
337
+ **Scope rules:** Choose the SMALLEST scope that applies.
338
+ - Bug in one file → `file:src/api/routes.ts`
339
+ - Bug in module pattern → `module:auth`
340
+ - Bug in project-wide practice → `global`
341
+
342
+ **Anti-duplicate:** If a similar learning already exists in `.cm/learnings.json`,
343
+ reinforce it (reinforceCount++) instead of creating a new entry.
344
+
345
+ > **Token savings:** Next time same error pattern appears, AI reads the learning
346
+ > (~50 tokens) instead of repeating full 4-phase debug cycle (~3,000 tokens).
347
+ > **This is the #1 token saver in the entire kit.**
348
+
349
+ ---
350
+
351
+ ## Red Flags - STOP and Follow Process
352
+
353
+ If you catch yourself thinking:
354
+ - "Quick fix for now, investigate later"
355
+ - "Just try changing X and see if it works"
356
+ - "Add multiple changes, run tests"
357
+ - "Skip the test, I'll manually verify"
358
+ - "It's probably X, let me fix that"
359
+ - "I don't fully understand but this might work"
360
+ - "Pattern says X but I'll adapt it differently"
361
+ - "Here are the main problems: [lists fixes without investigation]"
362
+ - Proposing solutions before tracing data flow
363
+ - **"One more fix attempt" (when already tried 2+)**
364
+ - **Each fix reveals new problem in different place**
365
+
366
+ **ALL of these mean: STOP. Return to Phase 1.**
367
+
368
+ **When you see these user signals:** STOP. Return to Phase 1.
369
+ - "Stop guessing"
370
+ - "Ultrathink this"
371
+
372
+ ## Common Rationalizations
373
+
374
+ | Excuse | Reality |
375
+ |--------|---------|
376
+ | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. |
377
+ | "Emergency, no time for process" | Systematic debugging is FASTER than guess-and-check thrashing. |
378
+ | "Just try this first, then investigate" | First fix sets the pattern. Do it right from the start. |
379
+ | "I'll write test after confirming fix works" | Untested fixes don't stick. Test first proves it. |
380
+ | "Multiple fixes at once saves time" | Can't isolate what worked. Causes new bugs. |
381
+
382
+ ## Quick Reference
383
+
384
+ | Phase | Key Activities | TRIZ Tool (Complex Path) | Success Criteria |
385
+ |-------|---------------|--------------------------|------------------|
386
+ | **1. Root Cause** | Read errors, reproduce, check changes, gather evidence | **9 Windows** — temporal × spatial analysis | Understand WHAT and WHY |
387
+ | **2. Pattern** | Find working examples, compare | **Contradiction Analysis** — conflicting requirements | Identify root differences |
388
+ | **3. Hypothesis** | Form theory, test minimally | **Troika** — Code/Data/Environment lenses | Confirmed or new hypothesis |
389
+ | **4. Implementation** | Create test, fix, verify | — | Bug resolved, tests pass |
390
+
391
+ ## When Process Reveals "No Root Cause"
392
+
393
+ If systematic investigation reveals issue is truly environmental, timing-dependent, or external:
394
+
395
+ 1. You've completed the process
396
+ 2. Document what you investigated
397
+ 3. Implement appropriate handling (retry, timeout, error message)
398
+ 4. Add monitoring/logging for future investigation
399
+
400
+ **But:** 95% of "no root cause" cases are incomplete investigation.
401
+
402
+ ## Integration
403
+
404
+ **Related skills:**
405
+ - **cm-tdd** - For creating failing test case (Phase 4, Step 1)
406
+ - **cm-quality-gate** - Verify fix worked before claiming success
407
+ - **cm-brainstorm-idea** - When 3+ fixes fail and bug reveals architectural problem → redirect to brainstorm
408
+
409
+ **TRIZ tools used:**
410
+ - **9 Windows** (Phase 1) — See bug across time × system scope
411
+ - **Contradiction Analysis** (Phase 2) — Find hidden conflicts between requirements
412
+ - **Troika Consulting** (Phase 3) — Force 3 different lenses on the same bug
@@ -0,0 +1,242 @@
1
+ ---
2
+ name: cm-deep-search
3
+ description: "Optional power-up — detects oversized codebases/docs and suggests tobi/qmd for local semantic search. Bridges cm-continuity (working memory) with long-term document retrieval. Zero-config detection, non-intrusive suggestion."
4
+ ---
5
+
6
+ # Deep Search — Semantic Memory Power-Up
7
+
8
+ > **When your project outgrows AI's context window, bring the search engine to your docs.**
9
+ > Optional integration with [tobi/qmd](https://github.com/tobi/qmd) — BM25 + Vector + LLM re-ranking, 100% local.
10
+
11
+ ## When to Trigger
12
+
13
+ **This skill is NOT invoked directly.** It is triggered automatically by other skills when they detect an oversized project.
14
+
15
+ ### Detection Thresholds
16
+
17
+ During codebase scan (Phase 1a of `cm-brainstorm-idea`, Step 2 of `cm-dockit`, etc.), check:
18
+
19
+ ```
20
+ TRIGGER if ANY of these are true:
21
+ → docs/ folder contains >50 markdown files
22
+ → Project has >200 source files total
23
+ → User mentions "meeting notes", "historical PRDs", "old specs"
24
+ → User asks "find that file that talked about X from before"
25
+ → cm-dockit just generated >30 doc files
26
+ ```
27
+
28
+ ### What to Say (Non-Intrusive)
29
+
30
+ When threshold is met, suggest naturally — DO NOT block or force:
31
+
32
+ ```markdown
33
+ 💡 **Pro Tip: Deep Search**
34
+
35
+ This project has [X doc files / Y source files] — quite large for AI to read directly.
36
+ You can install **[qmd](https://github.com/tobi/qmd)** to create semantic search
37
+ across all your documentation, helping AI find the right context faster.
38
+
39
+ Quick install:
40
+ \`\`\`bash
41
+ npm install -g @tobilu/qmd
42
+ qmd collection add ./docs --name project-docs
43
+ qmd context add qmd://project-docs "Project documentation for [project-name]"
44
+ qmd embed
45
+ \`\`\`
46
+
47
+ Then AI can search using: `qmd query "your question"`
48
+ ```
49
+
50
+ ---
51
+
52
+ ## Setup Guide (when user agrees to install)
53
+
54
+ ### Step 1: Install
55
+
56
+ ```bash
57
+ # Node.js
58
+ npm install -g @tobilu/qmd
59
+
60
+ # Or Bun
61
+ bun install -g @tobilu/qmd
62
+ ```
63
+
64
+ ### Step 2: Index project docs
65
+
66
+ ```bash
67
+ # Add collections
68
+ qmd collection add ./docs --name docs
69
+ qmd collection add ./src --name source --mask "**/*.{ts,tsx,js,jsx,py,go,rs}"
70
+
71
+ # Add context (helps AI understand each collection's purpose)
72
+ qmd context add qmd://docs "Technical documentation for [project-name]"
73
+ qmd context add qmd://source "Source code for [project-name]"
74
+
75
+ # Create vector embeddings
76
+ qmd embed
77
+ ```
78
+
79
+ ### Step 3: Setup MCP Server (for Claude/Cursor/Antigravity)
80
+
81
+ Add to MCP config:
82
+
83
+ ```json
84
+ {
85
+ "mcpServers": {
86
+ "qmd": {
87
+ "command": "qmd",
88
+ "args": ["mcp"]
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ Or run HTTP mode for shared server:
95
+
96
+ ```bash
97
+ qmd mcp --http --daemon
98
+ ```
99
+
100
+ ### Step 4: Verify
101
+
102
+ ```bash
103
+ # Check index
104
+ qmd status
105
+
106
+ # Test search
107
+ qmd query "authentication flow"
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Usage with CodyMaster Skills
113
+
114
+ ### With `cm-brainstorm-idea` (Phase 1: DISCOVER)
115
+
116
+ When AI needs to understand the full picture of a large project:
117
+
118
+ ```bash
119
+ # Find all docs related to the topic being brainstormed
120
+ qmd query "user authentication redesign" --json -n 10
121
+
122
+ # Get full content of important docs
123
+ qmd get "docs/architecture.md" --full
124
+ ```
125
+
126
+ ### With `cm-planning` (Phase A: Brainstorm)
127
+
128
+ When searching for specs, PRDs, or past decisions related to the feature being planned:
129
+
130
+ ```bash
131
+ qmd query "payment integration decisions" --files --min-score 0.4
132
+ ```
133
+
134
+ ### With `cm-dockit` (Post-generation)
135
+
136
+ After `cm-dockit` finishes generating docs, index them so AI can search from any session:
137
+
138
+ ```bash
139
+ qmd collection add ./docs --name project-knowledge
140
+ qmd embed
141
+ ```
142
+
143
+ ### With `cm-continuity` (Tier 4: External Memory)
144
+
145
+ `cm-continuity` manages working memory (500 words). `qmd` extends it with long-term semantic search:
146
+
147
+ ```
148
+ Tier 1: Sensory Memory → temporary variables in session (not persisted)
149
+ Tier 2: Working Memory → CONTINUITY.md (~500 words)
150
+ Tier 3: Long-Term Memory → learnings.json, decisions.json
151
+ Tier 4: External Semantic → qmd (optional, used when project is large)
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 🛑 Staleness Prevention
157
+
158
+ The biggest risk of Semantic Search is **stale index / new source**. If AI reads outdated docs and generates incorrect code, the consequences are severe.
159
+
160
+ CodyMaster handles this with 3 mechanisms:
161
+
162
+ ### 1. The "Post-Execution" Sync
163
+ Whenever AI completes a task that changes/creates a large number of files (e.g., `cm-dockit` generates docs, `cm-execution` refactors source code):
164
+ ```bash
165
+ # This runs quickly because qmd only embeds changed files (incremental)
166
+ qmd embed
167
+ ```
168
+ > **AI Rule:** If the project has qmd enabled, AI must automatically run `qmd embed` via terminal before finishing a task.
169
+
170
+ ### 2. The "Pre-Flight" Check
171
+ Before starting `cm-brainstorm-idea` or `cm-planning` on a project using qmd, AI calls the MCP tool to perform a health check:
172
+ ```json
173
+ // AI auto-runs this MCP tool
174
+ {
175
+ "name": "status",
176
+ "arguments": {}
177
+ }
178
+ ```
179
+ If status reports files pending/un-embedded, AI will run `qmd embed` in terminal before searching.
180
+
181
+ ### 3. Git Hook (Recommended for User)
182
+ For 100% safety beyond AI's control (when end-user modifies code directly):
183
+ AI should suggest the user install a **Git Post-Commit Hook**:
184
+ ```bash
185
+ # Add file .git/hooks/post-commit
186
+ #!/bin/sh
187
+ qmd embed > /dev/null 2>&1 &
188
+ ```
189
+ This ensures every commit triggers QMD to silently update the index in the background.
190
+
191
+ ---
192
+
193
+ ## Position in CodyMaster Lifecycle
194
+
195
+ ```
196
+ cm-continuity (memory) ─────────────── always active
197
+ cm-deep-search (search) ──── optional ─┤
198
+ ├── feeds context to ──→ cm-brainstorm-idea
199
+ │ ──→ cm-planning
200
+ cm-dockit (generate docs) ── produces ─┤ ──→ cm-execution
201
+ ```
202
+
203
+ ## Integration
204
+
205
+ | Skill | Relationship |
206
+ |-------|-------------|
207
+ | `cm-continuity` | COMPLEMENT: continuity = RAM, qmd = semantic disk search |
208
+ | `cm-brainstorm-idea` | TRIGGERED BY: Phase 1a codebase scan detects large corpus |
209
+ | `cm-dockit` | TRIGGERED AFTER: docs generated, suggest indexing |
210
+ | `cm-planning` | CONSUMER: uses qmd results for context during planning |
211
+ | `cm-execution` | CONSUMER: searches for related code/docs during execution |
212
+
213
+ ---
214
+
215
+ ## Requirements
216
+
217
+ ```
218
+ System: macOS / Linux / Windows (WSL)
219
+ Runtime: Node.js 20+ or Bun 1.0+
220
+ VRAM: ~2-4GB for GGUF models (embedding + reranking)
221
+ Disk: ~2-5GB for models (downloaded on first run)
222
+ ```
223
+
224
+ ## Rules
225
+
226
+ ```
227
+ ✅ DO:
228
+ - Suggest qmd ONLY when detection threshold is met
229
+ - Keep suggestion non-intrusive (Pro Tip format, never blocking)
230
+ - Always include context command (qmd context add) — this is qmd's killer feature
231
+ - Guide user to setup MCP server for seamless AI integration
232
+
233
+ ❌ DON'T:
234
+ - Force installation on every project
235
+ - Suggest qmd for small projects (<50 docs, <200 src files)
236
+ - Replace cm-continuity — they solve DIFFERENT problems
237
+ - Assume qmd is installed — always check first
238
+ ```
239
+
240
+ ## The Bottom Line
241
+
242
+ **`cm-continuity` = "remembers what you're doing." `cm-deep-search` = "finds what was written before." Together = complete memory system.**