math-skill 2.1.0 → 3.0.1

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 (244) hide show
  1. package/README.en-US.md +165 -198
  2. package/README.md +165 -198
  3. package/agents/math-critic.en.md +28 -26
  4. package/agents/math-critic.md +33 -33
  5. package/commands/ask.en.md +10 -0
  6. package/commands/ask.md +3 -10
  7. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  8. package/design-patterns/attention/equivariant-attention.md +72 -0
  9. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  10. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  12. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  13. package/design-patterns/attention/projection-attention.en.md +68 -0
  14. package/design-patterns/attention/projection-attention.md +68 -0
  15. package/design-patterns/attention/spectral-attention.en.md +71 -0
  16. package/design-patterns/attention/spectral-attention.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  18. package/design-patterns/compression/leverage-score-selection.md +71 -0
  19. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  20. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  21. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  22. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  23. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  24. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  25. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  26. package/design-patterns/loss/constraint-penalty.md +78 -0
  27. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  28. package/design-patterns/loss/contrastive-loss.md +68 -0
  29. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  30. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  31. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  32. package/design-patterns/loss/orthogonality-loss.md +60 -0
  33. package/design-patterns/loss/variational-loss.en.md +61 -0
  34. package/design-patterns/loss/variational-loss.md +71 -0
  35. package/design-patterns/representation/equivariant-split.en.md +87 -0
  36. package/design-patterns/representation/equivariant-split.md +89 -0
  37. package/design-patterns/representation/manifold-representation.en.md +85 -0
  38. package/design-patterns/representation/manifold-representation.md +87 -0
  39. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  40. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  41. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  42. package/design-patterns/representation/subspace-alignment.md +92 -0
  43. package/design-patterns/routing/graph-routing.en.md +79 -0
  44. package/design-patterns/routing/graph-routing.md +81 -0
  45. package/design-patterns/routing/moe-routing.en.md +85 -0
  46. package/design-patterns/routing/moe-routing.md +87 -0
  47. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  48. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  49. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  50. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  51. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  52. package/knowledge-base/differential-geometry/connection.md +51 -0
  53. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  54. package/knowledge-base/differential-geometry/curvature.md +49 -0
  55. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  56. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  57. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  58. package/knowledge-base/differential-geometry/manifold.md +47 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  60. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  61. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  62. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  63. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  64. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  65. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  66. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  68. package/knowledge-base/lie-theory/equivariance.md +54 -0
  69. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  70. package/knowledge-base/lie-theory/group-action.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  72. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  74. package/knowledge-base/lie-theory/lie-group.md +51 -0
  75. package/knowledge-base/lie-theory/representation.en.md +52 -0
  76. package/knowledge-base/lie-theory/representation.md +52 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  78. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  80. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  82. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  83. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  84. package/knowledge-base/matrix-analysis/projection.md +47 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  86. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  87. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  88. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  89. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  90. package/knowledge-base/optimization/convex-optimization.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  92. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  93. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  94. package/knowledge-base/optimization/proximal-method.md +52 -0
  95. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  96. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  97. package/knowledge-base/overview.en.md +29 -218
  98. package/knowledge-base/overview.md +29 -220
  99. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  100. package/knowledge-base/probability/concentration-inequality.md +45 -0
  101. package/knowledge-base/probability/entropy.en.md +47 -0
  102. package/knowledge-base/probability/entropy.md +47 -0
  103. package/knowledge-base/probability/fisher-information.en.md +48 -0
  104. package/knowledge-base/probability/fisher-information.md +48 -0
  105. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  106. package/knowledge-base/probability/information-bottleneck.md +49 -0
  107. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  108. package/knowledge-base/probability/kl-divergence.md +51 -0
  109. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  110. package/knowledge-base/topology/euler-characteristic.md +54 -0
  111. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  112. package/knowledge-base/topology/fundamental-group.md +52 -0
  113. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  114. package/knowledge-base/topology/persistent-homology.md +54 -0
  115. package/lenses/algorithmic.en.md +49 -0
  116. package/lenses/algorithmic.md +49 -0
  117. package/lenses/axiomatization.en.md +48 -0
  118. package/lenses/axiomatization.md +48 -0
  119. package/lenses/categorical.en.md +48 -0
  120. package/lenses/categorical.md +48 -0
  121. package/lenses/causal.en.md +49 -0
  122. package/lenses/causal.md +49 -0
  123. package/lenses/duality.en.md +47 -0
  124. package/lenses/duality.md +47 -0
  125. package/lenses/game.en.md +50 -0
  126. package/lenses/game.md +50 -0
  127. package/lenses/geometric.en.md +53 -0
  128. package/lenses/geometric.md +53 -0
  129. package/lenses/local-to-global.en.md +52 -0
  130. package/lenses/local-to-global.md +52 -0
  131. package/lenses/perturbation.en.md +51 -0
  132. package/lenses/perturbation.md +51 -0
  133. package/lenses/probabilistic.en.md +48 -0
  134. package/lenses/probabilistic.md +48 -0
  135. package/lenses/projection.en.md +50 -0
  136. package/lenses/projection.md +50 -0
  137. package/lenses/spectral.en.md +52 -0
  138. package/lenses/spectral.md +52 -0
  139. package/lenses/symmetry.en.md +49 -0
  140. package/lenses/symmetry.md +49 -0
  141. package/lenses/topological.en.md +48 -0
  142. package/lenses/topological.md +48 -0
  143. package/lenses/variational.en.md +48 -0
  144. package/lenses/variational.md +48 -0
  145. package/package.json +9 -3
  146. package/references/agentic-workflow.en.md +1 -1
  147. package/references/agentic-workflow.md +1 -1
  148. package/references/books/abstract-algebra.en.md +124 -0
  149. package/references/books/abstract-algebra.md +22 -22
  150. package/references/books/algebraic-geometry-rising-sea.en.md +171 -0
  151. package/references/books/algebraic-geometry-rising-sea.md +11 -11
  152. package/references/books/differential-geometry.en.md +140 -0
  153. package/references/books/differential-geometry.md +19 -19
  154. package/references/books/matrix-analysis.en.md +146 -0
  155. package/references/books/matrix-analysis.md +10 -10
  156. package/references/books/micro-lie-theory.en.md +116 -0
  157. package/references/books/micro-lie-theory.md +17 -17
  158. package/references/books/optimization-ml.en.md +163 -0
  159. package/references/books/optimization-ml.md +7 -8
  160. package/references/books/smooth-manifolds.en.md +105 -0
  161. package/references/books/smooth-manifolds.md +14 -14
  162. package/references/gpu-friendly-math.en.md +23 -10
  163. package/references/gpu-friendly-math.md +17 -4
  164. package/references/inspiration.en.md +1 -1
  165. package/references/inspiration.md +2 -2
  166. package/skills/math-research-activator/SKILL.en.md +195 -114
  167. package/skills/math-research-activator/SKILL.md +194 -119
  168. package/skills/math-research-activator/original-texts.en.md +9 -9
  169. package/skills/math-research-activator/original-texts.md +11 -11
  170. package/commands/abstraction.md +0 -11
  171. package/commands/algorithmic-thinking.md +0 -11
  172. package/commands/axiomatization.md +0 -11
  173. package/commands/causal-inference.md +0 -11
  174. package/commands/discrete-combinatorial.md +0 -11
  175. package/commands/game-theory.md +0 -11
  176. package/commands/induction-analogy.md +0 -11
  177. package/commands/information-theory.md +0 -11
  178. package/commands/logic-deduction.md +0 -11
  179. package/commands/modeling.md +0 -11
  180. package/commands/optimization.md +0 -11
  181. package/commands/probability-statistics.md +0 -11
  182. package/commands/symmetry-invariance.md +0 -11
  183. package/commands/topological-thinking.md +0 -11
  184. package/commands/transformation.md +0 -11
  185. package/skills/abstraction/SKILL.en.md +0 -117
  186. package/skills/abstraction/SKILL.md +0 -121
  187. package/skills/abstraction/original-texts.en.md +0 -163
  188. package/skills/abstraction/original-texts.md +0 -175
  189. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  190. package/skills/algorithmic-thinking/SKILL.md +0 -138
  191. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  192. package/skills/algorithmic-thinking/original-texts.md +0 -256
  193. package/skills/axiomatization/SKILL.en.md +0 -144
  194. package/skills/axiomatization/SKILL.md +0 -151
  195. package/skills/axiomatization/original-texts.en.md +0 -154
  196. package/skills/axiomatization/original-texts.md +0 -160
  197. package/skills/causal-inference/SKILL.en.md +0 -147
  198. package/skills/causal-inference/SKILL.md +0 -151
  199. package/skills/causal-inference/original-texts.en.md +0 -136
  200. package/skills/causal-inference/original-texts.md +0 -167
  201. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  202. package/skills/discrete-combinatorial/SKILL.md +0 -131
  203. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  204. package/skills/discrete-combinatorial/original-texts.md +0 -185
  205. package/skills/game-theory/SKILL.en.md +0 -117
  206. package/skills/game-theory/SKILL.md +0 -123
  207. package/skills/game-theory/original-texts.en.md +0 -131
  208. package/skills/game-theory/original-texts.md +0 -131
  209. package/skills/induction-analogy/SKILL.en.md +0 -145
  210. package/skills/induction-analogy/SKILL.md +0 -152
  211. package/skills/induction-analogy/original-texts.en.md +0 -140
  212. package/skills/induction-analogy/original-texts.md +0 -154
  213. package/skills/information-theory/SKILL.en.md +0 -134
  214. package/skills/information-theory/SKILL.md +0 -140
  215. package/skills/information-theory/original-texts.en.md +0 -127
  216. package/skills/information-theory/original-texts.md +0 -127
  217. package/skills/logic-deduction/SKILL.en.md +0 -130
  218. package/skills/logic-deduction/SKILL.md +0 -135
  219. package/skills/logic-deduction/original-texts.en.md +0 -160
  220. package/skills/logic-deduction/original-texts.md +0 -173
  221. package/skills/modeling/SKILL.en.md +0 -135
  222. package/skills/modeling/SKILL.md +0 -139
  223. package/skills/modeling/original-texts.en.md +0 -162
  224. package/skills/modeling/original-texts.md +0 -165
  225. package/skills/optimization/SKILL.en.md +0 -129
  226. package/skills/optimization/SKILL.md +0 -135
  227. package/skills/optimization/original-texts.en.md +0 -167
  228. package/skills/optimization/original-texts.md +0 -168
  229. package/skills/probability-statistics/SKILL.en.md +0 -146
  230. package/skills/probability-statistics/SKILL.md +0 -151
  231. package/skills/probability-statistics/original-texts.en.md +0 -191
  232. package/skills/probability-statistics/original-texts.md +0 -193
  233. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  234. package/skills/symmetry-invariance/SKILL.md +0 -139
  235. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  236. package/skills/symmetry-invariance/original-texts.md +0 -221
  237. package/skills/topological-thinking/SKILL.en.md +0 -124
  238. package/skills/topological-thinking/SKILL.md +0 -128
  239. package/skills/topological-thinking/original-texts.en.md +0 -134
  240. package/skills/topological-thinking/original-texts.md +0 -164
  241. package/skills/transformation/SKILL.en.md +0 -120
  242. package/skills/transformation/SKILL.md +0 -124
  243. package/skills/transformation/original-texts.en.md +0 -204
  244. package/skills/transformation/original-texts.md +0 -216
@@ -1,132 +1,213 @@
1
1
  ---
2
2
  name: math-research-activator
3
3
  description: |
4
- Auto-trigger (requires BOTH environment AND task signals): only when **designing/improving** new model architectures/operators/attention mechanisms, **analyzing** algorithm theoretical properties (complexity, convergence, expressivity), or **transferring** modern math structures (algebraic geometry, differential geometry, Lie theory, abstract algebra, matrix analysis, optimization) into algorithm/GPU co-design. Does NOT trigger for: code review, debugging, parameter tracing, refactoring, hyperparameter tuning, or loss implementation edits. Also the manual /ask entry (weapon selector).
4
+ Mathematical research OS auto-diagnoses user intent, routes to thinking lenses, math knowledge base, or design translation layer. Triggers on architecture/operator design, theoretical analysis, math-to-AI transfer. Does NOT trigger for pure engineering tasks (debug, refactoring, hyperparameter tuning).
5
5
  ---
6
6
 
7
- # 🧭 Math Research Activator
8
7
 
9
- > "The model already holds enough mathematics inside; what's missing is a cross-domain activation. The human picks the direction; the agent searches, enumerates, verifies."
8
+ > **File routing**: When this document references any file (lenses, knowledge-base, design-patterns, references, agents), always load the `.en.md` variant if it exists. For example, `../../lenses/symmetry.md` → load `lenses/symmetry.en.md`.
9
+ >
10
+ > ## Language Routing & Mixed-Input Rules
11
+ >
12
+ > Language routing only determines "which language version to read" and "what language to respond in." It does NOT affect whether the math system triggers or the A/B/C/D/E scenario classification.
13
+ >
14
+ > ### Decision Rules
15
+ >
16
+ > 1. **Judge the natural-language frame first**
17
+ > - If the user's sentence structure, verbs, and mood particles are primarily Chinese, treat as Chinese even if English technical terms are interspersed.
18
+ > - E.g., "帮我 design 一个 attention" / "这个 loss 有没有理论问题" → Chinese.
19
+ >
20
+ > 2. **English technical terms do not count as English primary language**
21
+ > - attention, loss, routing, embedding, manifold, operator, kernel, KV-cache, transformer, MoE, etc. are domain terms and do not trigger a switch to English.
22
+ >
23
+ > 3. **Code, paths, and formulas are excluded from language detection**
24
+ > - File paths, function names, variable names, LaTeX formulas, and CLI arguments do not count toward language ratio.
25
+ >
26
+ > 4. **When primary language is unclear, follow the user's last clear language**
27
+ > - If the CN/EN ratio is close and indeterminate, use the user's most recent unambiguous natural language.
28
+ > - If there is no prior context, default to Chinese.
29
+ >
30
+ > 5. **Output language matches primary language**
31
+ > - Chinese primary → read `SKILL.md`, respond in Chinese, retaining necessary English terms.
32
+ > - English primary → read `SKILL.en.md`, respond in English.
33
+ > - If the user explicitly requests "in English" / "in Chinese," follow the explicit request.
34
+
35
+ # Math Research OS
36
+
37
+ > "The thinking system does not hand out theorems, the knowledge system does not indulge in loose inspiration, and the design layer does not fake profundity."
38
+
39
+ This system is a mathematical staff office for AI architecture innovation — not an arsenal, but one that tells you: **what kind of battle this is, which arms to deploy, how to deploy them, and where things could go wrong.**
40
+
41
+ ## Three-Layer Orthogonal Architecture
42
+
43
+ | Layer | Responsibility | Directory | Core Question |
44
+ |-------|---------------|-----------|--------------|
45
+ | **Thinking Lenses** | Diagnose problem structure, recommend mathematical perspectives | `../../lenses/*.md` | Which perspective should we view this problem through? |
46
+ | **Math Knowledge** | Provide concrete mathematical tools (definitions/theorems/formulas) | `../../knowledge-base/*/*.md` | What specific mathematics does this perspective require? |
47
+ | **Design Translation** | Translate mathematics into AI modules/losses/operators | `../../design-patterns/*/*.md` | How does this mathematics become model architecture? |
48
+
49
+ Auxiliary layers:
50
+ - `../../references/books/*.md`: Distilled notes from 7 textbooks; full context when deeper understanding is needed
51
+ - `../../references/gpu-friendly-math.md`: GPU Eight-Dimension Acceptance Gate (single source of truth)
52
+ - `../../agents/math-critic.md`: Math-engineering dual critic
53
+
54
+ ## Intent Diagnosis (5 Scenarios)
55
+
56
+ | Scenario | Diagnostic Signal | Invocation Path |
57
+ |----------|------------------|-----------------|
58
+ | **A. Problem Analysis** | "Is this design sound?" "Are there gaps in the reasoning chain?" | Lenses → critic |
59
+ | **B. Mechanism Design** | "Design a new attention mechanism" "Transfer X to Y" | Lenses → Knowledge → Design → critic |
60
+ | **C. Knowledge Query** | "What is a tangent space on a manifold?" "How is the projection theorem applied?" | Knowledge |
61
+ | **D. Verification & Review** | "Does this formula hold?" "What guarantees does this loss provide?" | Knowledge → critic |
62
+ | **E. Pure Engineering** | Debugging, refactoring, hyperparameter tuning, code review | **Do not invoke the math system** |
63
+
64
+ ## Lens Library (15 Mathematical Perspectives)
65
+
66
+ Each lens answers: What is this perspective? What kinds of problems is it suited to diagnose? Which knowledge domains does it route to?
67
+
68
+ | Lens | File | Core Perspective |
69
+ |------|------|-----------------|
70
+ | Axiomatization | `../../lenses/axiomatization.md` | Examine consistency/independence/completeness of assumptions |
71
+ | Duality | `../../lenses/duality.md` | Transform to the dual space to expose constraints and invariants |
72
+ | Symmetry | `../../lenses/symmetry.md` | Invariants and conservation laws under transformations |
73
+ | Spectral Decomposition | `../../lenses/spectral.md` | Eigenvalues/singular values reveal dominant structure |
74
+ | Geometric | `../../lenses/geometric.md` | Metric/curvature/spatial structure on manifolds |
75
+ | Projection & Decomposition | `../../lenses/projection.md` | Orthogonal decomposition, subspace separation, conflict elimination |
76
+ | Variational | `../../lenses/variational.md` | Constrained extrema, energy minimization |
77
+ | Local-to-Global | `../../lenses/local-to-global.md` | Patching local properties into global ones, cohomological obstructions |
78
+ | Topological | `../../lenses/topological.md` | Invariants under continuous deformation, connectedness, holes |
79
+ | Categorical | `../../lenses/categorical.md` | Universal properties, functors, natural transformations |
80
+ | Perturbation | `../../lenses/perturbation.md` | Propagation of small perturbations, stability, robustness |
81
+ | Causal | `../../lenses/causal.md` | Correlation ≠ causation, interventions, counterfactuals |
82
+ | Game-Theoretic | `../../lenses/game.md` | Multi-agent strategic interaction, equilibria, mechanism design |
83
+ | Probabilistic & Statistical | `../../lenses/probabilistic.md` | Quantifying uncertainty, Bayesian updating |
84
+ | Algorithmic | `../../lenses/algorithmic.md` | Complexity, feasibility, parallelizability |
85
+
86
+ ## Knowledge Base (Organized by Mathematical Domain)
87
+
88
+ Each knowledge card answers: Minimal definition, core formulas, applicable problems, AI design translation, engineering feasibility, risks.
89
+
90
+ | Domain | Directory | Knowledge Cards |
91
+ |--------|-----------|----------------|
92
+ | Matrix Analysis | `../../knowledge-base/matrix-analysis/` | projection, spectral-decomposition, low-rank-approximation, positive-semidefinite, matrix-perturbation |
93
+ | Optimization | `../../knowledge-base/optimization/` | lagrangian-duality, convex-optimization, constrained-optimization, riemannian-optimization, proximal-method |
94
+ | Differential Geometry | `../../knowledge-base/differential-geometry/` | manifold, tangent-space, metric-tensor, geodesic, curvature, connection |
95
+ | Lie Theory | `../../knowledge-base/lie-theory/` | group-action, lie-group, lie-algebra, representation, equivariance |
96
+ | Topology | `../../knowledge-base/topology/` | persistent-homology, euler-characteristic, fundamental-group |
97
+ | Probability & Information | `../../knowledge-base/probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information |
98
+ | Information Geometry | `../../knowledge-base/information-geometry/` | natural-gradient, fisher-metric |
99
+
100
+ ## Design Pattern Library (Organized by AI Component)
101
+
102
+ Each design pattern answers: Mathematical origin, AI module form, implementable architecture, GPU feasibility, paper-level exposition, risks.
103
+
104
+ | Component Type | Directory | Patterns |
105
+ |---------------|-----------|----------|
106
+ | Attention | `../../design-patterns/attention/` | projection-attention, spectral-attention, equivariant-attention, geometry-aware-attention, information-bottleneck-attention |
107
+ | Loss Functions | `../../design-patterns/loss/` | orthogonality-loss, contrastive-loss, variational-loss, information-bottleneck-loss, constraint-penalty |
108
+ | Routing | `../../design-patterns/routing/` | optimal-transport-routing, graph-routing, moe-routing, spectral-clustering-routing |
109
+ | Representation | `../../design-patterns/representation/` | shared-private-decomposition, manifold-representation, equivariant-split, subspace-alignment |
110
+ | Compression | `../../design-patterns/compression/` | low-rank-kv-cache, spectral-token-pruning, topology-preserving-compression, leverage-score-selection |
111
+
112
+ ## Automatic Trigger Conditions
113
+
114
+ **All of Gate 1 + Gate 2 + Gate 3 must be satisfied simultaneously for intervention:**
115
+
116
+ ### Gate 0 · Exclusion Gate (Highest Priority)
117
+ The following tasks **never** trigger the system regardless of workspace contents: code review, debugging, refactoring, hyperparameter tuning, build/deployment, purely factual queries, general software engineering.
118
+
119
+ ### Gate 1 · Environment Signal
120
+ The workspace contains architecture-level core code (attention/transformer/MoE, `*.cu`/kernel) or research notes. Routine files like `model.py` or `trainer.py` alone **do not** constitute an environment signal.
121
+
122
+ ### Gate 2 · Task Signal
123
+ The user's task involves **designing/improving** a new architecture/operator, **analyzing** theoretical properties, **transferring** mathematical structures into AI design, or **querying math knowledge relevant to AI research** (e.g., "how is tangent space used in optimization?"). Pure encyclopedic math queries (e.g., "what is a group?" with no AI context) do not auto-trigger, but can be accessed via `/ask`.
124
+
125
+ ### Gate 3 · Intent Match
126
+ The user's intent matches one of scenarios A/B/C/D. Pure engineering tasks matching scenario E → no intervention.
127
+
128
+ > **`/ask` entry**: Manual invocation skips Gate 1 and Gate 2, executing only Gate 0 (exclusion) + Gate 3 (intent match), allowing direct access to any scenario including knowledge queries.
129
+
130
+ ## Main Workflow
131
+
132
+ ### Step 1: Diagnose Intent
133
+ 1. Determine which scenario (A/B/C/D/E) the user's intent belongs to
134
+ 2. Extract the core tension of the problem: what to preserve? what to suppress? what are the constraints? what is the engineering bottleneck?
135
+ 3. Output a problem-type classification
136
+
137
+ ### Step 2: Route Invocation
138
+
139
+ ```
140
+ Scenario A (Analysis): Select 1–3 lenses → output perspective diagnosis → critic review
141
+ Scenario B (Design): Select 1–3 lenses → query knowledge cards → generate design patterns → critic review
142
+ Scenario C (Query): Load knowledge cards directly → output per knowledge activation protocol
143
+ Scenario D (Verification): Load knowledge cards → critic reviews conditions and boundaries
144
+ Scenario E (Engineering): No intervention
145
+ ```
146
+
147
+ ### Step 3: Output Format
148
+
149
+ **Scenario A/B Output**:
150
+ 1. **[Diagnosis]** Problem type + core tension
151
+ 2. **[Lens]** Recommend 1–3 mathematical perspectives (annotate why each is/is not suitable)
152
+ 3. **[Knowledge]** (Scenario B only) Required concrete mathematical tools (reference knowledge cards)
153
+ 4. **[Design]** (Scenario B only) Candidate AI module drafts (reference design patterns)
154
+ 5. **[GPU]** Run candidates through the Eight-Dimension Gate (friendly/retrofittable/unfriendly)
155
+ 6. **[Conclusion]** Retain candidates that pass both acceptance gates + next-step recommendations
156
+
157
+ **Scenario C Output** (Knowledge Activation Protocol):
158
+ 1. Minimal definition
159
+ 2. Core formulas
160
+ 3. Applicable problems
161
+ 4. AI design translation
162
+ 5. Engineering feasibility
163
+ 6. Risks and failure conditions
164
+ 7. Further references (distilled book notes / original book paths)
165
+
166
+ **Scenario D Output**:
167
+ 1. Conditions under which it holds
168
+ 2. Conditions under which it fails
169
+ 3. What it can guarantee at most
170
+ 4. What it cannot guarantee
171
+ 5. Engineering feasibility
10
172
 
11
- ## Core Principle
12
-
13
- **No lengthy math tutorials.** Once triggered, immediately enter the three-step pipeline: "Diagnose → Map → GPU Screen," activating modern mathematics into algorithm/hardware design, and passing every output through the **dual acceptance gate**:
14
-
15
- 1. **Mathematically correct (beautiful in math)** — self-consistent, differentiable (or relaxable to differentiable), with correctness guarantees.
16
- 2. **GPU-feasible (friendly to GPU)** — see `../../references/gpu-friendly-math.md` eight dimensions.
17
-
18
- > This is the **sole automatic entry point** of the skill pack. It loads the methodology layer (`../../references/agentic-workflow.md`, `../../references/gpu-friendly-math.md`), the book activation layer (`../../references/books/*.md`), and the 16 thinking weapons (sibling directories `../*/SKILL.md`) on demand, keeping only the minimal trigger and diagnostic logic resident at all times — progressive disclosure to save tokens.
19
-
20
- ## When to Auto-Engage
21
-
22
- **Both the "environment signal" AND the "task signal" must be satisfied simultaneously (neither alone is sufficient):**
23
-
24
- ### Gate 0 · Exclusion Gate (evaluated first; if hit, do not engage)
25
-
26
- The following tasks must **never** trigger this activator, regardless of what code is in the workspace:
27
- - Code review / debugging / parameter-passing chain verification / interface consistency checks
28
- - Refactoring, renaming, removing redundant code, dead code cleanup
29
- - Build / packaging / CI / deployment / environment configuration
30
- - Pure factual queries ("what does this function do," "who receives this parameter")
31
- - General software engineering (file I/O, networking, data loading, logging)
32
- - Training script hyperparameter tuning, hyperparameter search, experiment comparison
33
- - Adding / modifying loss implementation details (as opposed to designing the mathematical structure of a new loss)
34
-
35
- **Rule of thumb: if the task can be accomplished by "reading code → tracing call chains → reporting results," no mathematical weapon is needed.**
36
-
37
- ### Gate 1 · Environment Signal (necessary condition, not sufficient)
38
-
39
- The workspace contains at least one of the following:
40
- - Core model architecture code (not training scripts / data pipelines): attention/transformer/MoE implementations, `*.cu`/`*.cuh`/kernels, Triton/CUDA operators.
41
- - Algorithm research notes / paper review documents.
42
- - Design drafts or mathematical derivations for new architectures / new operators.
43
-
44
- > The mere presence of `model.py`, `trainer.py`, `config.json`, or similar routine ML engineering files **does not constitute an environment signal**.
45
-
46
- ### Gate 2 · Task Signal (necessary condition, not sufficient)
47
-
48
- The user's current task explicitly involves at least one of the following:
49
- - **Designing or improving** a new model architecture / operator / attention mechanism (not fixing an existing implementation).
50
- - **Selecting or justifying** the applicability of a mathematical structure (e.g., "should we use manifold constraints," "does this structure have equivariance").
51
- - **Analyzing** theoretical properties of an algorithm (complexity lower bounds, convergence, expressivity, information bottleneck).
52
- - **Transferring** a mathematical structure from some field into algorithm/GPU design.
53
-
54
- > If the task signal is merely "code doesn't run," "parameter wasn't passed," "loss didn't take effect," or similar engineering issues, the activator does **not trigger** even if the environment signal is hit.
55
-
56
- **When NOT to engage:**
57
- - Gate 0 is hit (exclusion gate).
58
- - Either Gate 1 or Gate 2 is not satisfied.
59
- - The problem is not in a domain where mathematics can help.
60
-
61
- ## The Activation Loop
62
-
63
- > See `../../references/agentic-workflow.md` for detailed working methodology (Human-in-the-Agent-Loop).
64
-
65
- 1. **Diagnose**: What is the algorithmic structure or bottleneck? (complexity? memory/KV? numerics? parallelism? expressivity?)
66
- 2. **Map**: Use the "Modern Math Toolbox" (below) to scan for transferable structures, **enumerating multiple candidates** (leverage the large context window — don't just give one).
67
- 3. **Route**: Select 1–3 thinking weapons for deeper analysis (decision tree below).
68
- 4. **GPU Screen**: Pass each candidate through the eight dimensions of `../../references/gpu-friendly-math.md`, rating "friendly / retrofittable / unfriendly" + adaptation recommendations.
69
- 5. **Dual Acceptance Gate**: Retain only candidates that are **mathematically correct AND (eight-dimension friendly or retrofittable)**.
70
- 6. **Track**: For complex explorations, use a markdown testplan table (template in agentic-workflow.md) to iterate toward convergence.
71
-
72
- The eight-dimension terminology must remain consistent: **Tensorization / GEMM-Mappability / Complexity / Memory & KV-Cache / Low-Precision Stability / Parallelism & Communication / Sparsity Structure / Operator Fusion**. Do not substitute vague judgments covering only a subset of dimensions for the full eight-dimension gate.
73
-
74
- ## Weapon Routing
75
-
76
- Match by the core characteristic of the problem (select up to 3, label primary/secondary):
77
-
78
- 1. **Multi-agent interaction** (my optimum depends on others) → `/game-theory` (primary); resource allocation + `/optimization`; information asymmetry + `/information-theory`
79
- 2. **Uncertainty / randomness** → `/probability-statistics` (primary); need causal rather than correlational + `/causal-inference`
80
- 3. **Optimization under constraints** → `/optimization` (primary); need to model first + `/modeling` (prerequisite)
81
- 4. **Current form is intractable, need change of perspective / simplification** → `/transformation` (primary)
82
- 5. **Need to extract essential structure** → `/abstraction` (primary); verify assumptions + `/axiomatization`; simplify + `/symmetry-invariance`
83
- 6. **Need rigorous reasoning and verification** → `/logic-deduction` (primary); verify premises + `/axiomatization`
84
- 7. **Finding patterns from data / experience** → `/induction-analogy` (primary); cross-domain transfer + `/abstraction`
85
- 8. **Building predictive / explanatory models** → `/modeling` (primary); optimization + `/optimization`; uncertainty + `/probability-statistics`
86
- 9. **Invariance / conservation / equivariance under change** → `/symmetry-invariance` (primary); connected structure + `/topological-thinking`
87
- 10. **Reducing to executable steps / evaluating feasibility and complexity** → `/algorithmic-thinking` (primary)
88
- 11. **Compression / encoding / information bottleneck / KV-Cache compression / quantization** → `/information-theory` (primary); representation transforms + `/transformation`; routing information gain + `/game-theory`
89
- 12. **Counting / enumeration / structure of finite objects** → `/discrete-combinatorial` (primary)
90
-
91
- > **Modern math priority hint**: When the problem is "designing/improving an operator or structure," **always open the modern math toolbox first** while routing weapons — many breakthroughs come from transferring structures from algebraic geometry / differential geometry / Lie theory, rather than circling within classical tools alone.
92
-
93
- ## Modern-Math Toolbox (Layer 3 · Loaded on Demand)
173
+ **A conclusion must always be provided — never output analysis alone without convergence.**
94
174
 
95
- Load the corresponding book activation file (`../../references/books/`) by problem type:
175
+ ## GPU Eight-Dimension Acceptance Gate
96
176
 
97
- | Trigger Signal | Load | Typical Activation |
98
- |---------|------|---------|
99
- | Operator = matrix multiply / spectrum / low-rank / numerical stability | `matrix-analysis.md` | GEMM formulation, low-rank compression, spectral normalization, preconditioning |
100
- | Training / convergence / optimizer / constraints | `optimization-ml.md` | Feasibility of adaptive / second-order optimization, dual solving |
101
- | Symmetry / equivariance / semiring / permutation invariance | `abstract-algebra.md` | Group-equivariant layers, tropical semiring routing, finite-field encoding |
102
- | Manifold constraints / latent-space geometry / differentiable structure | `smooth-manifolds.md` | Manifold optimization, Stiefel/orthogonal constraints, geodesic interpolation |
103
- | Metric / curvature / natural gradient / gauge / fiber bundle | `differential-geometry.md` | Natural gradient / K-FAC, information geometry, gauge equivariance |
104
- | Pose / SO(3) / SE(3) / state estimation / equivariance | `micro-lie-theory.md` | Lie group optimization, SE(3) equivariance, manifold loss |
105
- | Attention / sparsity / global consistency / KV compression | `algebraic-geometry-rising-sea.md` | Sheaf attention, Čech cohomology regularization, Plücker KV, tropical gating |
177
+ Formal terminology (single authoritative source: `../../references/gpu-friendly-math.md`):
178
+ **Tensorization / GEMM-mappability / Complexity / Memory & KV-Cache / Low-Precision Stability / Parallelism & Communication / Sparse Structure / Operator Fusion**
106
179
 
107
- ## Deep-Dive Protocol
180
+ ## Depth-of-Consultation Protocol
108
181
 
109
- - **Light**: Read `../../references/books/<book>.md` (distilled notes, shipped with the release, self-contained).
110
- - **Deep (full fidelity to original text required)**: If a local `math_book/<corresponding PDF>` exists, **let the agent search automatically** — `pdftotext "math_book/<file>.pdf" -` grep keywords → Read the matching page. **No reliance on pre-embedded anchors.**
111
- - No PDF available (e.g., npm-installed on a different machine): Stay at the distilled-notes layer, which remains self-contained and usable.
182
+ - **Light**: Read knowledge cards (`../../knowledge-base/*/*.md`); self-contained and immediately usable
183
+ - **Medium**: Read distilled book notes (`../../references/books/*.md`) for more complete context
184
+ - **Deep**: When `math_book/<PDF>` is available locally, the agent automatically runs `pdftotext` + grep to locate the original page
112
185
 
113
- ## Worked Example: Tropical Sheaf Attention
186
+ ## Workflow Example
114
187
 
115
- A research candidate template (see `../../references/gpu-friendly-math.md` for details): tropical gating (semiring piecewise-linear replacing Top-K) + cellular sheaf diffusion (low-rank restriction maps per edge = small GEMMs) + Čech cohomology regularization (H¹ as a structural consistency signal) + Plücker KV compression. Treat this as an exploration template for "math beautiful x GPU friendly": verify complexity, memory, low-precision stability, and kernel fusibility dimension by dimension before claiming passage through the eight-dimension gate.
188
+ **User**: "Design a new KV Cache compression method that preserves long-range dependencies I don't want to just do top-k."
116
189
 
117
- ## Operating Procedure
190
+ ```
191
+ Step 1 — Diagnosis: Scenario B (Mechanism Design)
192
+ Problem type: Sequence memory compression + information preservation + long-range structure
193
+ Core tension: Compressing token count vs. preserving long-range dependencies
118
194
 
119
- Once triggered, the output must contain:
120
- 1. **[Diagnosis]**: One sentence identifying the algorithmic structure/bottleneck (interaction / uncertainty / constraints / structure / dynamics / complexity / memory / numerics / parallelism).
121
- 2. **[Mapping]**: Enumerate transferable modern math structure candidates (>=2, annotated with source book).
122
- 3. **[Weapon Routing]**: 1–3 thinking weapons, labeled primary/secondary + trigger commands.
123
- 4. **[GPU Screen]**: Each candidate evaluated against the eight dimensions, rated "friendly / retrofittable / unfriendly" + adaptation recommendations.
124
- 5. **[Conclusion]**: Retain only candidates passing the dual acceptance gate; provide a testplan table when necessary.
195
+ Step 2 Lens Selection:
196
+ 1. Spectral Decomposition (preserve dominant subspace)
197
+ 2. Information Theory (retain states with maximum mutual information)
198
+ 3. Topological (preserve critical connectivity points of sequential structure)
125
199
 
126
- **A conclusion must always be provided never output analysis alone without convergence.**
200
+ Step 3Knowledge Query:
201
+ → low-rank-approximation (Matrix Analysis)
202
+ → leverage-score-selection (Design Pattern: compression)
203
+ → information-bottleneck (Probability & Information)
127
204
 
128
- ## Relations
205
+ Step 4 — Design Translation:
206
+ Candidate A: Spectral KV Compression (low-rank + leverage score)
207
+ Candidate B: Information-Preserving Cache (query sensitivity)
208
+ Candidate C: Topology-Preserving Cache (graph bridge-node retention)
129
209
 
130
- - This entry point routes all 16 thinking weapons and loads the methodology layer and book activation layer on demand.
131
- - The manual entry `/ask` is equivalent to invoking this activator (weapon selector mode).
132
- - Review of outputs can be delegated to `agents/math-critic.md` (including the GPU feasibility dimension) for a second pass.
210
+ Step 5 Critic Review:
211
+ A is most GPU-friendly; B requires estimating future queries with inherent uncertainty; C has prohibitive graph construction cost
212
+ Recommendation: Prioritize A; use B as a lightweight gate
213
+ ```