math-skill 2.1.0 → 3.0.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 (234) hide show
  1. package/README.en-US.md +159 -200
  2. package/README.md +159 -200
  3. package/agents/math-critic.en.md +2 -2
  4. package/agents/math-critic.md +8 -8
  5. package/commands/ask.md +3 -10
  6. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  7. package/design-patterns/attention/equivariant-attention.md +72 -0
  8. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  9. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  10. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  12. package/design-patterns/attention/projection-attention.en.md +68 -0
  13. package/design-patterns/attention/projection-attention.md +68 -0
  14. package/design-patterns/attention/spectral-attention.en.md +71 -0
  15. package/design-patterns/attention/spectral-attention.md +71 -0
  16. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.md +71 -0
  18. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  19. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  20. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  21. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  22. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  23. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  24. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  25. package/design-patterns/loss/constraint-penalty.md +78 -0
  26. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  27. package/design-patterns/loss/contrastive-loss.md +68 -0
  28. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  29. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  30. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  31. package/design-patterns/loss/orthogonality-loss.md +60 -0
  32. package/design-patterns/loss/variational-loss.en.md +61 -0
  33. package/design-patterns/loss/variational-loss.md +71 -0
  34. package/design-patterns/representation/equivariant-split.en.md +87 -0
  35. package/design-patterns/representation/equivariant-split.md +89 -0
  36. package/design-patterns/representation/manifold-representation.en.md +85 -0
  37. package/design-patterns/representation/manifold-representation.md +87 -0
  38. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  39. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  40. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  41. package/design-patterns/representation/subspace-alignment.md +92 -0
  42. package/design-patterns/routing/graph-routing.en.md +79 -0
  43. package/design-patterns/routing/graph-routing.md +81 -0
  44. package/design-patterns/routing/moe-routing.en.md +85 -0
  45. package/design-patterns/routing/moe-routing.md +87 -0
  46. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  47. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  48. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  49. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  50. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  51. package/knowledge-base/differential-geometry/connection.md +51 -0
  52. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  53. package/knowledge-base/differential-geometry/curvature.md +49 -0
  54. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  55. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  56. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  57. package/knowledge-base/differential-geometry/manifold.md +47 -0
  58. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  60. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  61. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  62. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  63. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  64. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  65. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  66. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.md +54 -0
  68. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  69. package/knowledge-base/lie-theory/group-action.md +51 -0
  70. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  72. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.md +51 -0
  74. package/knowledge-base/lie-theory/representation.en.md +52 -0
  75. package/knowledge-base/lie-theory/representation.md +52 -0
  76. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  78. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  80. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  82. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  83. package/knowledge-base/matrix-analysis/projection.md +47 -0
  84. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  86. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  87. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  88. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  89. package/knowledge-base/optimization/convex-optimization.md +50 -0
  90. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  92. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  93. package/knowledge-base/optimization/proximal-method.md +52 -0
  94. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  95. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  96. package/knowledge-base/overview.en.md +29 -218
  97. package/knowledge-base/overview.md +29 -220
  98. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  99. package/knowledge-base/probability/concentration-inequality.md +45 -0
  100. package/knowledge-base/probability/entropy.en.md +47 -0
  101. package/knowledge-base/probability/entropy.md +47 -0
  102. package/knowledge-base/probability/fisher-information.en.md +48 -0
  103. package/knowledge-base/probability/fisher-information.md +48 -0
  104. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  105. package/knowledge-base/probability/information-bottleneck.md +49 -0
  106. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  107. package/knowledge-base/probability/kl-divergence.md +51 -0
  108. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  109. package/knowledge-base/topology/euler-characteristic.md +54 -0
  110. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  111. package/knowledge-base/topology/fundamental-group.md +52 -0
  112. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  113. package/knowledge-base/topology/persistent-homology.md +54 -0
  114. package/lenses/algorithmic.en.md +49 -0
  115. package/lenses/algorithmic.md +49 -0
  116. package/lenses/axiomatization.en.md +48 -0
  117. package/lenses/axiomatization.md +48 -0
  118. package/lenses/categorical.en.md +48 -0
  119. package/lenses/categorical.md +48 -0
  120. package/lenses/causal.en.md +49 -0
  121. package/lenses/causal.md +49 -0
  122. package/lenses/duality.en.md +47 -0
  123. package/lenses/duality.md +47 -0
  124. package/lenses/game.en.md +50 -0
  125. package/lenses/game.md +50 -0
  126. package/lenses/geometric.en.md +53 -0
  127. package/lenses/geometric.md +53 -0
  128. package/lenses/local-to-global.en.md +52 -0
  129. package/lenses/local-to-global.md +52 -0
  130. package/lenses/perturbation.en.md +51 -0
  131. package/lenses/perturbation.md +51 -0
  132. package/lenses/probabilistic.en.md +48 -0
  133. package/lenses/probabilistic.md +48 -0
  134. package/lenses/projection.en.md +50 -0
  135. package/lenses/projection.md +50 -0
  136. package/lenses/spectral.en.md +52 -0
  137. package/lenses/spectral.md +52 -0
  138. package/lenses/symmetry.en.md +49 -0
  139. package/lenses/symmetry.md +49 -0
  140. package/lenses/topological.en.md +48 -0
  141. package/lenses/topological.md +48 -0
  142. package/lenses/variational.en.md +48 -0
  143. package/lenses/variational.md +48 -0
  144. package/package.json +9 -3
  145. package/references/books/abstract-algebra.md +5 -5
  146. package/references/books/algebraic-geometry-rising-sea.md +5 -5
  147. package/references/books/differential-geometry.md +3 -3
  148. package/references/books/matrix-analysis.md +4 -4
  149. package/references/books/micro-lie-theory.md +3 -3
  150. package/references/books/optimization-ml.md +1 -1
  151. package/references/books/smooth-manifolds.md +3 -3
  152. package/references/gpu-friendly-math.en.md +8 -8
  153. package/references/gpu-friendly-math.md +2 -2
  154. package/references/inspiration.en.md +1 -1
  155. package/references/inspiration.md +2 -2
  156. package/skills/math-research-activator/SKILL.en.md +161 -106
  157. package/skills/math-research-activator/SKILL.md +162 -110
  158. package/skills/math-research-activator/original-texts.en.md +9 -9
  159. package/skills/math-research-activator/original-texts.md +11 -11
  160. package/commands/abstraction.md +0 -11
  161. package/commands/algorithmic-thinking.md +0 -11
  162. package/commands/axiomatization.md +0 -11
  163. package/commands/causal-inference.md +0 -11
  164. package/commands/discrete-combinatorial.md +0 -11
  165. package/commands/game-theory.md +0 -11
  166. package/commands/induction-analogy.md +0 -11
  167. package/commands/information-theory.md +0 -11
  168. package/commands/logic-deduction.md +0 -11
  169. package/commands/modeling.md +0 -11
  170. package/commands/optimization.md +0 -11
  171. package/commands/probability-statistics.md +0 -11
  172. package/commands/symmetry-invariance.md +0 -11
  173. package/commands/topological-thinking.md +0 -11
  174. package/commands/transformation.md +0 -11
  175. package/skills/abstraction/SKILL.en.md +0 -117
  176. package/skills/abstraction/SKILL.md +0 -121
  177. package/skills/abstraction/original-texts.en.md +0 -163
  178. package/skills/abstraction/original-texts.md +0 -175
  179. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  180. package/skills/algorithmic-thinking/SKILL.md +0 -138
  181. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  182. package/skills/algorithmic-thinking/original-texts.md +0 -256
  183. package/skills/axiomatization/SKILL.en.md +0 -144
  184. package/skills/axiomatization/SKILL.md +0 -151
  185. package/skills/axiomatization/original-texts.en.md +0 -154
  186. package/skills/axiomatization/original-texts.md +0 -160
  187. package/skills/causal-inference/SKILL.en.md +0 -147
  188. package/skills/causal-inference/SKILL.md +0 -151
  189. package/skills/causal-inference/original-texts.en.md +0 -136
  190. package/skills/causal-inference/original-texts.md +0 -167
  191. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  192. package/skills/discrete-combinatorial/SKILL.md +0 -131
  193. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  194. package/skills/discrete-combinatorial/original-texts.md +0 -185
  195. package/skills/game-theory/SKILL.en.md +0 -117
  196. package/skills/game-theory/SKILL.md +0 -123
  197. package/skills/game-theory/original-texts.en.md +0 -131
  198. package/skills/game-theory/original-texts.md +0 -131
  199. package/skills/induction-analogy/SKILL.en.md +0 -145
  200. package/skills/induction-analogy/SKILL.md +0 -152
  201. package/skills/induction-analogy/original-texts.en.md +0 -140
  202. package/skills/induction-analogy/original-texts.md +0 -154
  203. package/skills/information-theory/SKILL.en.md +0 -134
  204. package/skills/information-theory/SKILL.md +0 -140
  205. package/skills/information-theory/original-texts.en.md +0 -127
  206. package/skills/information-theory/original-texts.md +0 -127
  207. package/skills/logic-deduction/SKILL.en.md +0 -130
  208. package/skills/logic-deduction/SKILL.md +0 -135
  209. package/skills/logic-deduction/original-texts.en.md +0 -160
  210. package/skills/logic-deduction/original-texts.md +0 -173
  211. package/skills/modeling/SKILL.en.md +0 -135
  212. package/skills/modeling/SKILL.md +0 -139
  213. package/skills/modeling/original-texts.en.md +0 -162
  214. package/skills/modeling/original-texts.md +0 -165
  215. package/skills/optimization/SKILL.en.md +0 -129
  216. package/skills/optimization/SKILL.md +0 -135
  217. package/skills/optimization/original-texts.en.md +0 -167
  218. package/skills/optimization/original-texts.md +0 -168
  219. package/skills/probability-statistics/SKILL.en.md +0 -146
  220. package/skills/probability-statistics/SKILL.md +0 -151
  221. package/skills/probability-statistics/original-texts.en.md +0 -191
  222. package/skills/probability-statistics/original-texts.md +0 -193
  223. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  224. package/skills/symmetry-invariance/SKILL.md +0 -139
  225. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  226. package/skills/symmetry-invariance/original-texts.md +0 -221
  227. package/skills/topological-thinking/SKILL.en.md +0 -124
  228. package/skills/topological-thinking/SKILL.md +0 -128
  229. package/skills/topological-thinking/original-texts.en.md +0 -134
  230. package/skills/topological-thinking/original-texts.md +0 -164
  231. package/skills/transformation/SKILL.en.md +0 -120
  232. package/skills/transformation/SKILL.md +0 -124
  233. package/skills/transformation/original-texts.en.md +0 -204
  234. package/skills/transformation/original-texts.md +0 -216
@@ -3,9 +3,9 @@
3
3
  # GPU 友好性总清单 / GPU-Friendly Math Checklist
4
4
 
5
5
  > 本文件是「GPU 可行性」验收门的**唯一权威来源(single source of truth)**。
6
- > activator、16 个思想武器、`books/*.md`、以及 `../agents/math-critic.md` 都引用此处,不重复定义。
6
+ > activator、15 个思想透镜、`books/*.md`、以及 `../agents/math-critic.md` 都引用此处,不重复定义。
7
7
  >
8
- > This file is the single source of truth for the "GPU-feasibility" acceptance gate. The activator, the 16 weapons, the book references, and the math-critic all point here.
8
+ > This file is the single source of truth for the "GPU-feasibility" acceptance gate. The activator, the 15 thinking lenses, the book references, and the math-critic all point here.
9
9
 
10
10
  ## 核心命题 / Core Proposition
11
11
 
@@ -108,6 +108,6 @@ What matters is not finding the legendary "global optimum," but rather, at each
108
108
 
109
109
  The inspiration for this project stems precisely from these two insights:
110
110
 
111
- 1. **The value of mathematical tools far exceeds their original intent** — Sophus Lie's dragon-slaying blade story teaches us that a tool invented for solving differential equations ultimately became the universal language for describing symmetry. This is the core idea behind "thinking weapons": every mathematical concept carries transferable value far beyond its original application domain.
111
+ 1. **The value of mathematical tools far exceeds their original intent** — Sophus Lie's dragon-slaying blade story teaches us that a tool invented for solving differential equations ultimately became the universal language for describing symmetry. This is the core idea behind "thinking lenses": every mathematical concept carries transferable value far beyond its original application domain.
112
112
 
113
113
  2. **Mathematics is a lens for understanding life** — Optimization theory is not just about algorithms; it is a framework for understanding the structure of life decisions. When you transfer the "exploration–exploitation trade-off" from reinforcement learning to career choices, or the "local optimum trap" from convex optimization to everyday decisions, mathematics steps off the blackboard and into daily life.
@@ -20,7 +20,7 @@ Sophus Lie 是一个想打造一把**屠龙刀**(解通微分方程)的铁
20
20
 
21
21
  一个为解决特定问题而发明的工具,最终在完全不同的领域展现出远超初衷的价值。公理化思想最初是为了让几何严密,后来却成了所有数学分支的基础语言;傅里叶变换最初是为了解热方程,后来却成了信号处理和量子力学的核心;欧拉的生成函数最初是为了算整数分拆,后来却成了组合学和概率论的通用工具。
22
22
 
23
- 数学思想武器也是如此——你学习它,可能是为了审查一篇论文或解决一个具体问题,但它真正的价值,在于它改变了你看世界的方式。
23
+ 数学思想透镜也是如此——你学习它,可能是为了审查一篇论文或解决一个具体问题,但它真正的价值,在于它改变了你看世界的方式。
24
24
 
25
25
  ---
26
26
 
@@ -110,6 +110,6 @@ $x_0$ 是你的出身、天赋、起点。
110
110
 
111
111
  本项目的灵感来源,正是这两段感悟:
112
112
 
113
- 1. **数学工具的价值远超初衷** —— Sophus Lie 的屠龙刀故事告诉我们,一个为解微分方程而发明的工具,最终成为描述对称性的通用语言。这正是"思想武器"的核心理念:每个数学思想方法,都有远超其原始应用场景的迁移价值。
113
+ 1. **数学工具的价值远超初衷** —— Sophus Lie 的屠龙刀故事告诉我们,一个为解微分方程而发明的工具,最终成为描述对称性的通用语言。这正是"思想透镜"的核心理念:每个数学思想方法,都有远超其原始应用场景的迁移价值。
114
114
 
115
115
  2. **数学是理解生活的透镜** —— 最优化理论不只是算法,它还是一种理解人生决策结构的方式。当你把"探索与利用的权衡"从强化学习迁移到职业选择,把"局部最优陷阱"从凸优化迁移到生活决策,数学就从黑板走进了日常。
@@ -1,132 +1,187 @@
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
+ # 🧭 Math Research OS
10
10
 
11
- ## Core Principle
11
+ > "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."
12
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**:
13
+ 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.**
14
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.
15
+ ## Three-Layer Orthogonal Architecture
17
16
 
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.
17
+ | Layer | Responsibility | Directory | Core Question |
18
+ |-------|---------------|-----------|--------------|
19
+ | **Thinking Lenses** | Diagnose problem structure, recommend mathematical perspectives | `../../lenses/*.md` | Which perspective should we view this problem through? |
20
+ | **Math Knowledge** | Provide concrete mathematical tools (definitions/theorems/formulas) | `../../knowledge-base/*/*.md` | What specific mathematics does this perspective require? |
21
+ | **Design Translation** | Translate mathematics into AI modules/losses/operators | `../../design-patterns/*/*.md` | How does this mathematics become model architecture? |
19
22
 
20
- ## When to Auto-Engage
23
+ Auxiliary layers:
24
+ - `../../references/books/*.md`: Distilled notes from 7 textbooks; full context when deeper understanding is needed
25
+ - `../../references/gpu-friendly-math.md`: GPU Eight-Dimension Acceptance Gate (single source of truth)
26
+ - `../../agents/math-critic.md`: Math-engineering dual critic
21
27
 
22
- **Both the "environment signal" AND the "task signal" must be satisfied simultaneously (neither alone is sufficient):**
28
+ ## Intent Diagnosis (5 Scenarios)
23
29
 
24
- ### Gate 0 · Exclusion Gate (evaluated first; if hit, do not engage)
30
+ | Scenario | Diagnostic Signal | Invocation Path |
31
+ |----------|------------------|-----------------|
32
+ | **A. Problem Analysis** | "Is this design sound?" "Are there gaps in the reasoning chain?" | Lenses → critic |
33
+ | **B. Mechanism Design** | "Design a new attention mechanism" "Transfer X to Y" | Lenses → Knowledge → Design → critic |
34
+ | **C. Knowledge Query** | "What is a tangent space on a manifold?" "How is the projection theorem applied?" | Knowledge |
35
+ | **D. Verification & Review** | "Does this formula hold?" "What guarantees does this loss provide?" | Knowledge → critic |
36
+ | **E. Pure Engineering** | Debugging, refactoring, hyperparameter tuning, code review | **Do not invoke the math system** |
37
+
38
+ ## Lens Library (15 Mathematical Perspectives)
25
39
 
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)
40
+ Each lens answers: What is this perspective? What kinds of problems is it suited to diagnose? Which knowledge domains does it route to?
41
+
42
+ | Lens | File | Core Perspective |
43
+ |------|------|-----------------|
44
+ | Axiomatization | `../../lenses/axiomatization.md` | Examine consistency/independence/completeness of assumptions |
45
+ | Duality | `../../lenses/duality.md` | Transform to the dual space to expose constraints and invariants |
46
+ | Symmetry | `../../lenses/symmetry.md` | Invariants and conservation laws under transformations |
47
+ | Spectral Decomposition | `../../lenses/spectral.md` | Eigenvalues/singular values reveal dominant structure |
48
+ | Geometric | `../../lenses/geometric.md` | Metric/curvature/spatial structure on manifolds |
49
+ | Projection & Decomposition | `../../lenses/projection.md` | Orthogonal decomposition, subspace separation, conflict elimination |
50
+ | Variational | `../../lenses/variational.md` | Constrained extrema, energy minimization |
51
+ | Local-to-Global | `../../lenses/local-to-global.md` | Patching local properties into global ones, cohomological obstructions |
52
+ | Topological | `../../lenses/topological.md` | Invariants under continuous deformation, connectedness, holes |
53
+ | Categorical | `../../lenses/categorical.md` | Universal properties, functors, natural transformations |
54
+ | Perturbation | `../../lenses/perturbation.md` | Propagation of small perturbations, stability, robustness |
55
+ | Causal | `../../lenses/causal.md` | Correlation ≠ causation, interventions, counterfactuals |
56
+ | Game-Theoretic | `../../lenses/game.md` | Multi-agent strategic interaction, equilibria, mechanism design |
57
+ | Probabilistic & Statistical | `../../lenses/probabilistic.md` | Quantifying uncertainty, Bayesian updating |
58
+ | Algorithmic | `../../lenses/algorithmic.md` | Complexity, feasibility, parallelizability |
59
+
60
+ ## Knowledge Base (Organized by Mathematical Domain)
61
+
62
+ Each knowledge card answers: Minimal definition, core formulas, applicable problems, AI design translation, engineering feasibility, risks.
63
+
64
+ | Domain | Directory | Knowledge Cards |
65
+ |--------|-----------|----------------|
66
+ | Matrix Analysis | `../../knowledge-base/matrix-analysis/` | projection, spectral-decomposition, low-rank-approximation, positive-semidefinite, matrix-perturbation |
67
+ | Optimization | `../../knowledge-base/optimization/` | lagrangian-duality, convex-optimization, constrained-optimization, riemannian-optimization, proximal-method |
68
+ | Differential Geometry | `../../knowledge-base/differential-geometry/` | manifold, tangent-space, metric-tensor, geodesic, curvature, connection |
69
+ | Lie Theory | `../../knowledge-base/lie-theory/` | group-action, lie-group, lie-algebra, representation, equivariance |
70
+ | Topology | `../../knowledge-base/topology/` | persistent-homology, euler-characteristic, fundamental-group |
71
+ | Probability & Information | `../../knowledge-base/probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information |
72
+ | Information Geometry | `../../knowledge-base/information-geometry/` | natural-gradient, fisher-metric |
73
+
74
+ ## Design Pattern Library (Organized by AI Component)
75
+
76
+ Each design pattern answers: Mathematical origin, AI module form, implementable architecture, GPU feasibility, paper-level exposition, risks.
77
+
78
+ | Component Type | Directory | Patterns |
79
+ |---------------|-----------|----------|
80
+ | Attention | `../../design-patterns/attention/` | projection-attention, spectral-attention, equivariant-attention, geometry-aware-attention, information-bottleneck-attention |
81
+ | Loss Functions | `../../design-patterns/loss/` | orthogonality-loss, contrastive-loss, variational-loss, information-bottleneck-loss, constraint-penalty |
82
+ | Routing | `../../design-patterns/routing/` | optimal-transport-routing, graph-routing, moe-routing, spectral-clustering-routing |
83
+ | Representation | `../../design-patterns/representation/` | shared-private-decomposition, manifold-representation, equivariant-split, subspace-alignment |
84
+ | Compression | `../../design-patterns/compression/` | low-rank-kv-cache, spectral-token-pruning, topology-preserving-compression, leverage-score-selection |
85
+
86
+ ## Automatic Trigger Conditions
87
+
88
+ **All of Gate 1 + Gate 2 + Gate 3 must be satisfied simultaneously for intervention:**
89
+
90
+ ### Gate 0 · Exclusion Gate (Highest Priority)
91
+ 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.
92
+
93
+ ### Gate 1 · Environment Signal
94
+ 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.
95
+
96
+ ### Gate 2 · Task Signal
97
+ 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`.
98
+
99
+ ### Gate 3 · Intent Match
100
+ The user's intent matches one of scenarios A/B/C/D. Pure engineering tasks matching scenario E → no intervention.
101
+
102
+ > **`/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.
103
+
104
+ ## Main Workflow
105
+
106
+ ### Step 1: Diagnose Intent
107
+ 1. Determine which scenario (A/B/C/D/E) the user's intent belongs to
108
+ 2. Extract the core tension of the problem: what to preserve? what to suppress? what are the constraints? what is the engineering bottleneck?
109
+ 3. Output a problem-type classification
110
+
111
+ ### Step 2: Route Invocation
112
+
113
+ ```
114
+ Scenario A (Analysis): Select 1–3 lenses → output perspective diagnosis → critic review
115
+ Scenario B (Design): Select 1–3 lenses → query knowledge cards → generate design patterns → critic review
116
+ Scenario C (Query): Load knowledge cards directly → output per knowledge activation protocol
117
+ Scenario D (Verification): Load knowledge cards → critic reviews conditions and boundaries
118
+ Scenario E (Engineering): No intervention
119
+ ```
120
+
121
+ ### Step 3: Output Format
122
+
123
+ **Scenario A/B Output**:
124
+ 1. **[Diagnosis]** Problem type + core tension
125
+ 2. **[Lens]** Recommend 1–3 mathematical perspectives (annotate why each is/is not suitable)
126
+ 3. **[Knowledge]** (Scenario B only) Required concrete mathematical tools (reference knowledge cards)
127
+ 4. **[Design]** (Scenario B only) Candidate AI module drafts (reference design patterns)
128
+ 5. **[GPU]** Run candidates through the Eight-Dimension Gate (friendly/retrofittable/unfriendly)
129
+ 6. **[Conclusion]** Retain candidates that pass both acceptance gates + next-step recommendations
130
+
131
+ **Scenario C Output** (Knowledge Activation Protocol):
132
+ 1. Minimal definition
133
+ 2. Core formulas
134
+ 3. Applicable problems
135
+ 4. AI design translation
136
+ 5. Engineering feasibility
137
+ 6. Risks and failure conditions
138
+ 7. Further references (distilled book notes / original book paths)
139
+
140
+ **Scenario D Output**:
141
+ 1. Conditions under which it holds
142
+ 2. Conditions under which it fails
143
+ 3. What it can guarantee at most
144
+ 4. What it cannot guarantee
145
+ 5. Engineering feasibility
34
146
 
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)
147
+ **A conclusion must always be provided never output analysis alone without convergence.**
94
148
 
95
- Load the corresponding book activation file (`../../references/books/`) by problem type:
149
+ ## GPU Eight-Dimension Acceptance Gate
96
150
 
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 |
151
+ Formal terminology (single authoritative source: `../../references/gpu-friendly-math.md`):
152
+ **Tensorization / GEMM-mappability / Complexity / Memory & KV-Cache / Low-Precision Stability / Parallelism & Communication / Sparse Structure / Operator Fusion**
106
153
 
107
- ## Deep-Dive Protocol
154
+ ## Depth-of-Consultation Protocol
108
155
 
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.
156
+ - **Light**: Read knowledge cards (`../../knowledge-base/*/*.md`); self-contained and immediately usable
157
+ - **Medium**: Read distilled book notes (`../../references/books/*.md`) for more complete context
158
+ - **Deep**: When `math_book/<PDF>` is available locally, the agent automatically runs `pdftotext` + grep to locate the original page
112
159
 
113
- ## Worked Example: Tropical Sheaf Attention
160
+ ## Workflow Example
114
161
 
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.
162
+ **User**: "Design a new KV Cache compression method that preserves long-range dependencies I don't want to just do top-k."
116
163
 
117
- ## Operating Procedure
164
+ ```
165
+ Step 1 — Diagnosis: Scenario B (Mechanism Design)
166
+ Problem type: Sequence memory compression + information preservation + long-range structure
167
+ Core tension: Compressing token count vs. preserving long-range dependencies
118
168
 
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.
169
+ Step 2 Lens Selection:
170
+ 1. Spectral Decomposition (preserve dominant subspace)
171
+ 2. Information Theory (retain states with maximum mutual information)
172
+ 3. Topological (preserve critical connectivity points of sequential structure)
125
173
 
126
- **A conclusion must always be provided never output analysis alone without convergence.**
174
+ Step 3Knowledge Query:
175
+ → low-rank-approximation (Matrix Analysis)
176
+ → leverage-score-selection (Design Pattern: compression)
177
+ → information-bottleneck (Probability & Information)
127
178
 
128
- ## Relations
179
+ Step 4 — Design Translation:
180
+ Candidate A: Spectral KV Compression (low-rank + leverage score)
181
+ Candidate B: Information-Preserving Cache (query sensitivity)
182
+ Candidate C: Topology-Preserving Cache (graph bridge-node retention)
129
183
 
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.
184
+ Step 5 Critic Review:
185
+ A is most GPU-friendly; B requires estimating future queries with inherent uncertainty; C has prohibitive graph construction cost
186
+ Recommendation: Prioritize A; use B as a lightweight gate
187
+ ```