math-skill 3.0.0 → 3.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 (183) hide show
  1. package/README.en-US.md +50 -30
  2. package/README.md +26 -6
  3. package/agents/math-critic.en.md +30 -28
  4. package/agents/math-critic.md +30 -30
  5. package/commands/ask.en.md +15 -0
  6. package/commands/ask.md +6 -1
  7. package/design-patterns/attention/equivariant-attention.en.md +17 -11
  8. package/design-patterns/attention/equivariant-attention.md +16 -10
  9. package/design-patterns/attention/geometry-aware-attention.en.md +11 -11
  10. package/design-patterns/attention/geometry-aware-attention.md +10 -10
  11. package/design-patterns/attention/information-bottleneck-attention.en.md +40 -20
  12. package/design-patterns/attention/information-bottleneck-attention.md +40 -20
  13. package/design-patterns/attention/projection-attention.en.md +12 -12
  14. package/design-patterns/attention/projection-attention.md +11 -11
  15. package/design-patterns/attention/spectral-attention.en.md +27 -13
  16. package/design-patterns/attention/spectral-attention.md +26 -12
  17. package/design-patterns/compression/leverage-score-selection.en.md +14 -14
  18. package/design-patterns/compression/leverage-score-selection.md +14 -14
  19. package/design-patterns/compression/low-rank-kv-cache.en.md +40 -13
  20. package/design-patterns/compression/low-rank-kv-cache.md +39 -13
  21. package/design-patterns/compression/spectral-token-pruning.en.md +17 -15
  22. package/design-patterns/compression/spectral-token-pruning.md +17 -15
  23. package/design-patterns/compression/topology-preserving-compression.en.md +11 -11
  24. package/design-patterns/compression/topology-preserving-compression.md +11 -11
  25. package/design-patterns/loss/constraint-penalty.en.md +9 -5
  26. package/design-patterns/loss/constraint-penalty.md +10 -7
  27. package/design-patterns/loss/contrastive-loss.en.md +38 -12
  28. package/design-patterns/loss/contrastive-loss.md +39 -13
  29. package/design-patterns/loss/information-bottleneck-loss.en.md +6 -6
  30. package/design-patterns/loss/information-bottleneck-loss.md +7 -7
  31. package/design-patterns/loss/orthogonality-loss.en.md +25 -18
  32. package/design-patterns/loss/orthogonality-loss.md +25 -19
  33. package/design-patterns/loss/variational-loss.en.md +5 -5
  34. package/design-patterns/loss/variational-loss.md +6 -6
  35. package/design-patterns/overview.en.md +36 -0
  36. package/design-patterns/overview.md +36 -0
  37. package/design-patterns/representation/equivariant-split.en.md +5 -5
  38. package/design-patterns/representation/equivariant-split.md +5 -6
  39. package/design-patterns/representation/manifold-representation.en.md +13 -13
  40. package/design-patterns/representation/manifold-representation.md +14 -15
  41. package/design-patterns/representation/shared-private-decomposition.en.md +13 -8
  42. package/design-patterns/representation/shared-private-decomposition.md +13 -10
  43. package/design-patterns/representation/subspace-alignment.en.md +13 -13
  44. package/design-patterns/representation/subspace-alignment.md +13 -13
  45. package/design-patterns/routing/graph-routing.en.md +12 -12
  46. package/design-patterns/routing/graph-routing.md +12 -12
  47. package/design-patterns/routing/moe-routing.en.md +13 -13
  48. package/design-patterns/routing/moe-routing.md +13 -15
  49. package/design-patterns/routing/optimal-transport-routing.en.md +6 -6
  50. package/design-patterns/routing/optimal-transport-routing.md +7 -7
  51. package/design-patterns/routing/spectral-clustering-routing.en.md +27 -16
  52. package/design-patterns/routing/spectral-clustering-routing.md +27 -18
  53. package/knowledge-base/differential-geometry/connection.en.md +17 -2
  54. package/knowledge-base/differential-geometry/connection.md +17 -2
  55. package/knowledge-base/differential-geometry/curvature.en.md +14 -1
  56. package/knowledge-base/differential-geometry/curvature.md +14 -1
  57. package/knowledge-base/differential-geometry/geodesic.en.md +16 -2
  58. package/knowledge-base/differential-geometry/geodesic.md +16 -2
  59. package/knowledge-base/differential-geometry/index.en.md +52 -0
  60. package/knowledge-base/differential-geometry/index.md +52 -0
  61. package/knowledge-base/differential-geometry/manifold.en.md +15 -2
  62. package/knowledge-base/differential-geometry/manifold.md +15 -2
  63. package/knowledge-base/differential-geometry/metric-tensor.en.md +16 -2
  64. package/knowledge-base/differential-geometry/metric-tensor.md +17 -3
  65. package/knowledge-base/differential-geometry/tangent-space.en.md +17 -3
  66. package/knowledge-base/differential-geometry/tangent-space.md +17 -3
  67. package/knowledge-base/information-geometry/fisher-metric.en.md +32 -13
  68. package/knowledge-base/information-geometry/fisher-metric.md +32 -13
  69. package/knowledge-base/information-geometry/index.en.md +45 -0
  70. package/knowledge-base/information-geometry/index.md +45 -0
  71. package/knowledge-base/information-geometry/natural-gradient.en.md +24 -10
  72. package/knowledge-base/information-geometry/natural-gradient.md +24 -10
  73. package/knowledge-base/lie-theory/equivariance.en.md +18 -3
  74. package/knowledge-base/lie-theory/equivariance.md +18 -3
  75. package/knowledge-base/lie-theory/group-action.en.md +16 -2
  76. package/knowledge-base/lie-theory/group-action.md +16 -2
  77. package/knowledge-base/lie-theory/index.en.md +52 -0
  78. package/knowledge-base/lie-theory/index.md +52 -0
  79. package/knowledge-base/lie-theory/lie-algebra.en.md +17 -2
  80. package/knowledge-base/lie-theory/lie-algebra.md +17 -2
  81. package/knowledge-base/lie-theory/lie-group.en.md +17 -3
  82. package/knowledge-base/lie-theory/lie-group.md +17 -3
  83. package/knowledge-base/lie-theory/representation.en.md +17 -2
  84. package/knowledge-base/lie-theory/representation.md +17 -2
  85. package/knowledge-base/matrix-analysis/index.en.md +49 -0
  86. package/knowledge-base/matrix-analysis/index.md +49 -0
  87. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +20 -7
  88. package/knowledge-base/matrix-analysis/low-rank-approximation.md +20 -7
  89. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +13 -1
  90. package/knowledge-base/matrix-analysis/matrix-perturbation.md +13 -1
  91. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +20 -6
  92. package/knowledge-base/matrix-analysis/positive-semidefinite.md +20 -6
  93. package/knowledge-base/matrix-analysis/projection.en.md +14 -1
  94. package/knowledge-base/matrix-analysis/projection.md +14 -1
  95. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +14 -1
  96. package/knowledge-base/matrix-analysis/spectral-decomposition.md +14 -1
  97. package/knowledge-base/optimization/constrained-optimization.en.md +17 -3
  98. package/knowledge-base/optimization/constrained-optimization.md +17 -3
  99. package/knowledge-base/optimization/convex-optimization.en.md +15 -2
  100. package/knowledge-base/optimization/convex-optimization.md +15 -2
  101. package/knowledge-base/optimization/index.en.md +50 -0
  102. package/knowledge-base/optimization/index.md +50 -0
  103. package/knowledge-base/optimization/lagrangian-duality.en.md +18 -4
  104. package/knowledge-base/optimization/lagrangian-duality.md +18 -4
  105. package/knowledge-base/optimization/proximal-method.en.md +15 -1
  106. package/knowledge-base/optimization/proximal-method.md +15 -1
  107. package/knowledge-base/optimization/riemannian-optimization.en.md +18 -4
  108. package/knowledge-base/optimization/riemannian-optimization.md +18 -4
  109. package/knowledge-base/overview.en.md +20 -8
  110. package/knowledge-base/overview.md +20 -8
  111. package/knowledge-base/probability/concentration-inequality.en.md +21 -7
  112. package/knowledge-base/probability/concentration-inequality.md +21 -7
  113. package/knowledge-base/probability/entropy.en.md +24 -8
  114. package/knowledge-base/probability/entropy.md +23 -7
  115. package/knowledge-base/probability/fisher-information.en.md +24 -10
  116. package/knowledge-base/probability/fisher-information.md +24 -10
  117. package/knowledge-base/probability/index.en.md +51 -0
  118. package/knowledge-base/probability/index.md +51 -0
  119. package/knowledge-base/probability/information-bottleneck.en.md +24 -8
  120. package/knowledge-base/probability/information-bottleneck.md +24 -8
  121. package/knowledge-base/probability/kl-divergence.en.md +21 -8
  122. package/knowledge-base/probability/kl-divergence.md +21 -8
  123. package/knowledge-base/topology/euler-characteristic.en.md +15 -2
  124. package/knowledge-base/topology/euler-characteristic.md +15 -2
  125. package/knowledge-base/topology/fundamental-group.en.md +16 -2
  126. package/knowledge-base/topology/fundamental-group.md +16 -2
  127. package/knowledge-base/topology/index.en.md +48 -0
  128. package/knowledge-base/topology/index.md +48 -0
  129. package/knowledge-base/topology/persistent-homology.en.md +17 -2
  130. package/knowledge-base/topology/persistent-homology.md +17 -2
  131. package/lenses/algorithmic.en.md +1 -1
  132. package/lenses/algorithmic.md +1 -1
  133. package/lenses/axiomatization.en.md +1 -1
  134. package/lenses/axiomatization.md +1 -1
  135. package/lenses/categorical.en.md +1 -1
  136. package/lenses/categorical.md +1 -1
  137. package/lenses/causal.en.md +1 -1
  138. package/lenses/causal.md +1 -1
  139. package/lenses/duality.en.md +1 -1
  140. package/lenses/duality.md +1 -1
  141. package/lenses/game.en.md +2 -2
  142. package/lenses/game.md +2 -2
  143. package/lenses/geometric.en.md +1 -1
  144. package/lenses/geometric.md +1 -1
  145. package/lenses/local-to-global.en.md +1 -1
  146. package/lenses/local-to-global.md +1 -1
  147. package/lenses/perturbation.en.md +1 -1
  148. package/lenses/perturbation.md +1 -1
  149. package/lenses/probabilistic.en.md +1 -1
  150. package/lenses/probabilistic.md +1 -1
  151. package/lenses/projection.en.md +1 -1
  152. package/lenses/projection.md +1 -1
  153. package/lenses/spectral.en.md +2 -2
  154. package/lenses/spectral.md +2 -2
  155. package/lenses/symmetry.en.md +1 -1
  156. package/lenses/symmetry.md +1 -1
  157. package/lenses/topological.en.md +2 -2
  158. package/lenses/topological.md +2 -2
  159. package/lenses/variational.en.md +1 -1
  160. package/lenses/variational.md +1 -1
  161. package/package.json +5 -5
  162. package/references/agentic-workflow.en.md +3 -3
  163. package/references/agentic-workflow.md +1 -1
  164. package/references/books/abstract-algebra.en.md +124 -0
  165. package/references/books/abstract-algebra.md +17 -17
  166. package/references/books/algebraic-geometry-rising-sea.en.md +171 -0
  167. package/references/books/algebraic-geometry-rising-sea.md +7 -7
  168. package/references/books/differential-geometry.en.md +140 -0
  169. package/references/books/differential-geometry.md +23 -23
  170. package/references/books/matrix-analysis.en.md +146 -0
  171. package/references/books/matrix-analysis.md +32 -32
  172. package/references/books/micro-lie-theory.en.md +116 -0
  173. package/references/books/micro-lie-theory.md +16 -16
  174. package/references/books/optimization-ml.en.md +163 -0
  175. package/references/books/optimization-ml.md +20 -21
  176. package/references/books/smooth-manifolds.en.md +105 -0
  177. package/references/books/smooth-manifolds.md +15 -15
  178. package/references/gpu-friendly-math.en.md +35 -9
  179. package/references/gpu-friendly-math.md +33 -5
  180. package/references/skill-index.en.md +105 -0
  181. package/references/skill-index.md +105 -0
  182. package/skills/math-research-activator/SKILL.en.md +72 -88
  183. package/skills/math-research-activator/SKILL.md +61 -78
@@ -5,25 +5,34 @@ description: |
5
5
  ---
6
6
 
7
7
 
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
8
+ > **Language Routing & Mixed-Input Rules**: Judge primary language by sentence structure/verbs/mood particles. AI/math/engineering terms don't count. Code/paths/formulas excluded. When CN/EN ratio is close, follow last turn; default to Chinese if no context. Explicit request overrides. Chinese → `SKILL.md`, English this file. Full rules: `../../references/skill-index.en.md`.
9
+
10
+ # Math Research OS
10
11
 
11
12
  > "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
13
 
13
14
  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
15
 
16
+ ## Core Principle
17
+
18
+ > Math Skill does not store mathematics. It activates, routes, and translates mathematics for AI research.
19
+
20
+ - **knowledge-base/** is not a closed encyclopedia but a set of mathematical activation anchors
21
+ - When existing cards cannot cover a problem, the agent must NOT stop or force-fit; instead, generate a "temporary knowledge card" based on lenses, reference layers, and the agent's own mathematical knowledge, then continue with design translation
22
+ - **design-patterns/** is a collection of math→AI translation prototypes, not a complete model repository; when no matching pattern exists, generate a temporary design candidate from the mathematical structure and label it as a temporary design pattern
23
+
15
24
  ## Three-Layer Orthogonal Architecture
16
25
 
17
26
  | Layer | Responsibility | Directory | Core Question |
18
27
  |-------|---------------|-----------|--------------|
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? |
28
+ | **Thinking Lenses** | Diagnose problem structure, recommend mathematical perspectives | `../../lenses/*.en.md` | Which perspective should we view this problem through? |
29
+ | **Math Knowledge** | Provide concrete mathematical tools (definitions/theorems/formulas) | `../../knowledge-base/*/*.en.md` | What specific mathematics does this perspective require? |
30
+ | **Design Translation** | Translate mathematics into AI modules/losses/operators | `../../design-patterns/*/*.en.md` | How does this mathematics become model architecture? |
22
31
 
23
32
  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
33
+ - `../../references/books/*.en.md`: Distilled notes from 7 textbooks; full context when deeper understanding is needed
34
+ - `../../references/gpu-friendly-math.en.md`: GPU Eight-Dimension Acceptance Gate (single source of truth)
35
+ - `../../agents/math-critic.en.md`: Math-engineering dual critic
27
36
 
28
37
  ## Intent Diagnosis (5 Scenarios)
29
38
 
@@ -32,56 +41,20 @@ Auxiliary layers:
32
41
  | **A. Problem Analysis** | "Is this design sound?" "Are there gaps in the reasoning chain?" | Lenses → critic |
33
42
  | **B. Mechanism Design** | "Design a new attention mechanism" "Transfer X to Y" | Lenses → Knowledge → Design → critic |
34
43
  | **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 |
44
+ | **D. Verification & Review** | "Does this formula hold?" "What guarantees does this loss provide?" | Knowledge → relevant design patterns (if a concrete AI construct is cited) → critic |
36
45
  | **E. Pure Engineering** | Debugging, refactoring, hyperparameter tuning, code review | **Do not invoke the math system** |
37
46
 
38
47
  ## Lens Library (15 Mathematical Perspectives)
39
48
 
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 |
49
+ 15 lenses covering: Axiomatization, Duality, Symmetry, Spectral Decomposition, Geometric, Projection & Decomposition, Variational, Local-to-Global, Topological, Categorical, Perturbation, Causal, Game-Theoretic, Probabilistic & Statistical, Algorithmic. Directory: `../../lenses/*.en.md`. Full catalog table: `../../references/skill-index.en.md`.
59
50
 
60
51
  ## Knowledge Base (Organized by Mathematical Domain)
61
52
 
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 |
53
+ 7 domains: Matrix Analysis, Optimization, Differential Geometry, Lie Theory, Topology, Probability & Information, Information Geometry. Directory: `../../knowledge-base/*/*.en.md`. Full catalog table: `../../references/skill-index.en.md`.
73
54
 
74
55
  ## Design Pattern Library (Organized by AI Component)
75
56
 
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 |
57
+ 5 component types: Attention, Loss Functions, Routing, Representation, Compression. Directory: `../../design-patterns/*/*.en.md`. Full catalog table: `../../references/skill-index.en.md`.
85
58
 
86
59
  ## Automatic Trigger Conditions
87
60
 
@@ -112,76 +85,87 @@ The user's intent matches one of scenarios A/B/C/D. Pure engineering tasks match
112
85
 
113
86
  ```
114
87
  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
88
+ Scenario B (Design): Select 1–3 lenses → invoke relevant activation anchors; if no coverage, enter Knowledge Gap Protocol → generate formal/temporary design patterns → critic review
89
+ Scenario C (Query): Prefer loading relevant activation anchors; if no coverage, generate temporary knowledge card → output per knowledge activation protocol
90
+ Scenario D (Verification): Load relevant anchors or temporary knowledge cards → critic reviews conditions and boundaries
118
91
  Scenario E (Engineering): No intervention
119
92
  ```
120
93
 
121
94
  ### Step 3: Output Format
122
95
 
96
+ **Token-economy rule**: The following is the maximum structure, not the default full template. Trim to the user's question; for simple knowledge queries, provide only the needed definition / formula / risk. Expand design and GPU sections only when relevant, and do not restate loaded cards verbatim.
97
+
123
98
  **Scenario A/B Output**:
124
99
  1. **[Diagnosis]** Problem type + core tension
125
100
  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)
101
+ 3. **[Knowledge]** (Scenario B only) Activated mathematical structures (reference activation anchors or temporary knowledge cards)
102
+ 4. **[Design]** (Scenario B only) Candidate AI module drafts (reference design patterns or temporary design drafts)
128
103
  5. **[GPU]** Run candidates through the Eight-Dimension Gate (friendly/retrofittable/unfriendly)
129
104
  6. **[Conclusion]** Retain candidates that pass both acceptance gates + next-step recommendations
130
105
 
131
- **Scenario C Output** (Knowledge Activation Protocol):
106
+ **Scenario C Output** (Knowledge Activation Protocol, trimmed as needed):
132
107
  1. Minimal definition
133
108
  2. Core formulas
134
109
  3. Applicable problems
135
- 4. AI design translation
136
- 5. Engineering feasibility
110
+ 4. AI design translation (only when the question involves AI / operators)
111
+ 5. Engineering feasibility (only when implementation / GPU matters)
137
112
  6. Risks and failure conditions
138
- 7. Further references (distilled book notes / original book paths)
113
+ 7. Further references (only when traceability is requested or the conclusion depends on book references)
139
114
 
140
- **Scenario D Output**:
115
+ **Scenario D Output** (short conclusion first + conditions/boundaries):
141
116
  1. Conditions under which it holds
142
117
  2. Conditions under which it fails
143
118
  3. What it can guarantee at most
144
119
  4. What it cannot guarantee
145
- 5. Engineering feasibility
120
+ 5. Engineering feasibility (only when implementation / GPU matters)
146
121
 
147
122
  **A conclusion must always be provided — never output analysis alone without convergence.**
148
123
 
149
124
  ## GPU Eight-Dimension Acceptance Gate
150
125
 
151
- Formal terminology (single authoritative source: `../../references/gpu-friendly-math.md`):
126
+ Formal terminology (single authoritative source: `../../references/gpu-friendly-math.en.md`):
152
127
  **Tensorization / GEMM-mappability / Complexity / Memory & KV-Cache / Low-Precision Stability / Parallelism & Communication / Sparse Structure / Operator Fusion**
153
128
 
129
+ **Quantitative assessment requirements**: For each candidate design, the GPU assessment should not only provide [v]/[~]/[x] labels but also answer:
130
+ 1. FLOPs of core operations and ratio vs. baseline
131
+ 2. Peak memory (bytes), whether large matrices are materialized
132
+ 3. Numerical stability strategy under bf16/fp8
133
+ 4. Number of fusible kernels and expected speedup
134
+
135
+ See the quantitative checklist in `../../references/gpu-friendly-math.en.md`.
136
+
154
137
  ## Depth-of-Consultation Protocol
155
138
 
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
139
+ - **Light**: Read knowledge cards (`../../knowledge-base/*/*.en.md`); self-contained and immediately usable
140
+ - **Medium**: Read distilled book notes (`../../references/books/*.en.md`) for more complete context
158
141
  - **Deep**: When `math_book/<PDF>` is available locally, the agent automatically runs `pdftotext` + grep to locate the original page
159
142
 
160
- ## Workflow Example
143
+ ## Knowledge Gap Protocol
161
144
 
162
- **User**: "Design a new KV Cache compression method that preserves long-range dependencies I don't want to just do top-k."
145
+ When the mathematical tools required by the user's problem are not in the existing `knowledge-base/`, do NOT force-fit existing cards. Execute the following procedure:
163
146
 
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
168
-
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)
173
-
174
- Step 3 Knowledge Query:
175
- → low-rank-approximation (Matrix Analysis)
176
- → leverage-score-selection (Design Pattern: compression)
177
- → information-bottleneck (Probability & Information)
178
-
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)
183
-
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
- ```
147
+ 1. **Gap Identification**: Explicitly state that no fully corresponding knowledge card exists. Classify the gap as: new domain, new theorem family, new structure, new application scenario, or combinatorial extension of existing cards.
148
+
149
+ 2. **Lens Fallback**: Select 1–3 most relevant thinking lenses to determine the problem's mathematical structure. E.g., local-to-global, categorical, spectral, projection, causal, perturbation.
150
+
151
+ 3. **Candidate Knowledge Localization**: Provide mathematical keywords, theorem families, concept clusters, and reference book directions to look up. Existing card coverage is not required, but explain why these concepts are relevant.
152
+
153
+ 4. **Temporary Knowledge Card**: Generate a temporary knowledge summary in the same format as formal cards:
154
+ - Minimal definition
155
+ - Core structure
156
+ - Applicable problems
157
+ - AI design translation
158
+ - GPU feasibility
159
+ - Risks and failure conditions
160
+ - **Source & Confidence** (required):
161
+ - Knowledge source: label as "Agent inference / Lens derivation / Reference book extrapolation / Requires external verification"
162
+ - Confidence: High (theorem-backed) / Medium (reasonable inference, not rigorously proven) / Low (exploratory hypothesis)
163
+ - Unverified claims: list key conclusions requiring subsequent verification
164
+
165
+ 5. **Design Translation**: If the user's goal is mechanism design, translate the temporary knowledge into candidate AI modules, losses, routing, attention, representation, or compression schemes.
166
+
167
+ 6. **Upgrade Recommendation**: If this gap recurs frequently, recommend adding a formal knowledge card or design pattern.
168
+
169
+ ## Workflow Example
170
+
171
+ Full workflow example: `../../references/skill-index.en.md`.
@@ -5,14 +5,22 @@ description: |
5
5
  English: 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.
6
6
  ---
7
7
 
8
- > **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`;中文消息则继续使用本文件。
8
+ > **语言路由与混合输入规则**:看句式/动词/语气词主框架判定主语言。AI/数学/工程术语不计入。代码/路径/公式不计入。中英接近时沿用上一轮,无上下文默认中文。显式要求优先。中文→本文件,英文→`SKILL.en.md`。完整规则见 `../../references/skill-index.md`。
9
9
 
10
- # 🧭 数学研究操作系统 / Math Research OS
10
+ # 数学研究操作系统 / Math Research OS
11
11
 
12
12
  > "思想系统不负责给定理,知识系统不负责乱启发,设计层不负责装深刻。"
13
13
 
14
14
  本系统是面向 AI 架构创新的数学参谋部——不是武器库,而是告诉你:**这场仗是什么仗、该用什么兵种、怎么部署、哪里会翻车。**
15
15
 
16
+ ## 核心原则
17
+
18
+ > Math Skill 不存储数学,它激活数学、路由数学,并把数学翻译成 AI 研究设计。
19
+
20
+ - **knowledge-base/** 不是封闭百科,而是数学激活锚点集合(activation anchors)
21
+ - 当现有卡片不能覆盖问题时,Agent 不得停止或强行套用,而应基于透镜、参考层和自身数学知识生成"临时知识卡",继续完成设计翻译
22
+ - **design-patterns/** 是 math→AI 翻译原型集合,不是完整模型仓库;无对应模式时根据数学结构临时生成候选设计,并标记为 temporary design pattern
23
+
16
24
  ## 三层正交架构
17
25
 
18
26
  | 层 | 职责 | 目录 | 核心问题 |
@@ -38,51 +46,15 @@ description: |
38
46
 
39
47
  ## 透镜库(15 个数学视角)
40
48
 
41
- 每个透镜回答:这是什么视角?适合诊断什么问题?会路由到哪些知识域?
42
-
43
- | 透镜 | 文件 | 核心视角 |
44
- |------|------|---------|
45
- | 公理化 | `../../lenses/axiomatization.md` | 审查假设的相容性/独立性/完备性 |
46
- | 对偶 | `../../lenses/duality.md` | 转换到对偶空间暴露约束与不变量 |
47
- | 对称性 | `../../lenses/symmetry.md` | 变换下的不变量与守恒律 |
48
- | 谱分解 | `../../lenses/spectral.md` | 特征值/奇异值揭示主导结构 |
49
- | 几何 | `../../lenses/geometric.md` | 度量/曲率/流形上的空间结构 |
50
- | 投影与分解 | `../../lenses/projection.md` | 正交分解、子空间分离、冲突消除 |
51
- | 变分 | `../../lenses/variational.md` | 约束下极值、能量最小化 |
52
- | 局部到整体 | `../../lenses/local-to-global.md` | 局部性质拼接为全局、层上同调障碍 |
53
- | 拓扑 | `../../lenses/topological.md` | 连续变形不变量、连通性、空洞 |
54
- | 范畴化 | `../../lenses/categorical.md` | 泛性质、函子、自然变换 |
55
- | 扰动 | `../../lenses/perturbation.md` | 小扰动的传播、稳定性、鲁棒性 |
56
- | 因果 | `../../lenses/causal.md` | 相关≠因果、干预、反事实 |
57
- | 博弈 | `../../lenses/game.md` | 多方策略互动、均衡、机制设计 |
58
- | 概率统计 | `../../lenses/probabilistic.md` | 量化不确定性、贝叶斯更新 |
59
- | 算法 | `../../lenses/algorithmic.md` | 复杂度、可行性、并行性 |
49
+ 15 个透镜覆盖:公理化、对偶、对称性、谱分解、几何、投影与分解、变分、局部到整体、拓扑、范畴化、扰动、因果、博弈、概率统计、算法。目录:`../../lenses/*.md`。完整目录表见 `../../references/skill-index.md`。
60
50
 
61
51
  ## 知识库(按数学领域组织)
62
52
 
63
- 每个知识卡片回答:最小定义、核心公式、适用问题、AI 设计翻译、工程可行性、风险。
64
-
65
- | 领域 | 目录 | 知识卡片 |
66
- |------|------|---------|
67
- | 矩阵分析 | `../../knowledge-base/matrix-analysis/` | projection, spectral-decomposition, low-rank-approximation, positive-semidefinite, matrix-perturbation |
68
- | 最优化 | `../../knowledge-base/optimization/` | lagrangian-duality, convex-optimization, constrained-optimization, riemannian-optimization, proximal-method |
69
- | 微分几何 | `../../knowledge-base/differential-geometry/` | manifold, tangent-space, metric-tensor, geodesic, curvature, connection |
70
- | 李理论 | `../../knowledge-base/lie-theory/` | group-action, lie-group, lie-algebra, representation, equivariance |
71
- | 拓扑 | `../../knowledge-base/topology/` | persistent-homology, euler-characteristic, fundamental-group |
72
- | 概率与信息 | `../../knowledge-base/probability/` | concentration-inequality, entropy, kl-divergence, information-bottleneck, fisher-information |
73
- | 信息几何 | `../../knowledge-base/information-geometry/` | natural-gradient, fisher-metric |
53
+ 7 个领域:矩阵分析、最优化、微分几何、李理论、拓扑、概率与信息、信息几何。目录:`../../knowledge-base/*/*.md`。完整目录表见 `../../references/skill-index.md`。
74
54
 
75
55
  ## 设计模式库(按 AI 组件组织)
76
56
 
77
- 每个设计模式回答:数学来源、AI 模块形式、可实现结构、GPU 可行性、论文表述、风险。
78
-
79
- | 组件类型 | 目录 | 模式 |
80
- |---------|------|------|
81
- | 注意力 | `../../design-patterns/attention/` | projection-attention, spectral-attention, equivariant-attention, geometry-aware-attention, information-bottleneck-attention |
82
- | 损失函数 | `../../design-patterns/loss/` | orthogonality-loss, contrastive-loss, variational-loss, information-bottleneck-loss, constraint-penalty |
83
- | 路由 | `../../design-patterns/routing/` | optimal-transport-routing, graph-routing, moe-routing, spectral-clustering-routing |
84
- | 表示 | `../../design-patterns/representation/` | shared-private-decomposition, manifold-representation, equivariant-split, subspace-alignment |
85
- | 压缩 | `../../design-patterns/compression/` | low-rank-kv-cache, spectral-token-pruning, topology-preserving-compression, leverage-score-selection |
57
+ 5 个组件类型:注意力、损失函数、路由、表示、压缩。目录:`../../design-patterns/*/*.md`。完整目录表见 `../../references/skill-index.md`。
86
58
 
87
59
  ## 自动触发条件
88
60
 
@@ -113,37 +85,39 @@ description: |
113
85
 
114
86
  ```
115
87
  场景 A(分析):选 1-3 个透镜 → 输出视角诊断 → critic 审查
116
- 场景 B(设计):选 1-3 个透镜 → 查知识卡片生成设计模式 → critic 审查
117
- 场景 C(查询):直接加载知识卡片 → 按知识激活协议输出
118
- 场景 D(验证):加载知识卡片 → critic 审查条件与边界
88
+ 场景 B(设计):选 1-3 个透镜 → 调用相关激活锚点;若无覆盖则进入 Knowledge Gap Protocol 生成正式/临时设计模式 → critic 审查
89
+ 场景 C(查询):优先加载相关激活锚点;若无覆盖则生成临时知识卡 → 按知识激活协议输出
90
+ 场景 D(验证):加载相关锚点或临时知识卡 → critic 审查条件与边界
119
91
  场景 E(工程):不介入
120
92
  ```
121
93
 
122
94
  ### 第三步:输出格式
123
95
 
96
+ **Token 经济原则**:以下是最长结构,不是默认全文模板。按用户问题裁剪;简单知识查询只给必要定义/公式/风险,设计与 GPU 内容只在与问题有关时展开;避免复述已加载卡片全文。
97
+
124
98
  **场景 A/B 输出**:
125
99
  1. **[诊断]** 问题类型 + 核心张力
126
100
  2. **[透镜]** 推荐 1-3 个数学视角(标注为什么适合/不适合)
127
- 3. **[知识]**(仅场景 B)需要的具体数学工具(引用知识卡片)
128
- 4. **[设计]**(仅场景 B)候选 AI 模块草案(引用设计模式)
101
+ 3. **[知识]**(仅场景 B)激活的数学结构(引用激活锚点或临时知识卡)
102
+ 4. **[设计]**(仅场景 B)候选 AI 模块草案(引用设计模式或临时设计草案)
129
103
  5. **[GPU]** 候选过八维门(友好/可改造/不友好)
130
104
  6. **[结论]** 保留通过双验收门的候选 + 下一步建议
131
105
 
132
- **场景 C 输出**(知识激活协议):
106
+ **场景 C 输出**(知识激活协议,按需裁剪):
133
107
  1. 最小定义
134
108
  2. 核心公式
135
109
  3. 适用问题
136
- 4. AI 设计翻译
137
- 5. 工程可行性
110
+ 4. AI 设计翻译(仅当问题与 AI/算子相关)
111
+ 5. 工程可行性(仅当涉及实现/GPU)
138
112
  6. 风险与失效条件
139
- 7. 深入参考(书蒸馏稿 / 原书路径)
113
+ 7. 深入参考(仅当用户要追溯或结论依赖外部书稿)
140
114
 
141
- **场景 D 输出**:
115
+ **场景 D 输出**(优先短结论 + 条件边界):
142
116
  1. 成立条件
143
117
  2. 不成立条件
144
118
  3. 最多能保证什么
145
119
  4. 不能保证什么
146
- 5. 工程可行性
120
+ 5. 工程可行性(仅当涉及实现/GPU)
147
121
 
148
122
  **必须给出结论,不得只输出分析而不收敛。**
149
123
 
@@ -152,37 +126,46 @@ description: |
152
126
  正式术语(唯一权威来源:`../../references/gpu-friendly-math.md`):
153
127
  **张量化 / GEMM 可映射 / 复杂度 / 显存与 KV-Cache / 低精度稳定 / 并行与通信 / 稀疏结构 / 算子融合**
154
128
 
129
+ **量化评估要求**:对每个候选设计,GPU 评估不应只给 [v]/[~]/[x] 标签,还需回答:
130
+ 1. 核心操作的 FLOPs 和与 baseline 的比值
131
+ 2. 峰值显存 (bytes),是否物化大矩阵
132
+ 3. bf16/fp8 下的数值稳定性策略
133
+ 4. 可融合的 kernel 数和预期加速
134
+
135
+ 详见 `../../references/gpu-friendly-math.md` 的量化检查清单。
136
+
155
137
  ## 深度查阅协议
156
138
 
157
139
  - **轻度**:读知识卡片(`../../knowledge-base/*/*.md`),自足可用
158
140
  - **中度**:读书蒸馏稿(`../../references/books/*.md`),获取更完整上下文
159
141
  - **深度**:本机有 `math_book/<PDF>` 时,Agent 自动 `pdftotext` + grep 定位原文页
160
142
 
161
- ## 工作流范例
143
+ ## 知识缺口协议 / Knowledge Gap Protocol
162
144
 
163
- **用户**:"设计新的 KV Cache 压缩方法,保留长期依赖,不想只做 top-k"
145
+ 当用户问题需要的数学工具不在现有 `knowledge-base/` 中时,不得强行套用已有卡片。执行以下流程:
164
146
 
165
- ```
166
- 第一步 诊断:场景 B(机制设计)
167
- 问题类型:序列记忆压缩 + 信息保留 + 长程结构
168
- 核心张力:压缩 token 数量 vs 不破坏长期依赖
169
-
170
- 第二步 透镜选择:
171
- 1. 谱分解(保留主导子空间)
172
- 2. 信息论(保留最大互信息状态)
173
- 3. 拓扑(保留序列结构关键连接点)
174
-
175
- 第三步 知识查询:
176
- low-rank-approximation(矩阵分析)
177
- leverage-score-selection(矩阵分析)
178
- information-bottleneck(概率与信息)
179
-
180
- 第四步 设计翻译:
181
- 候选 A:Spectral KV Compression(低秩 + leverage score)
182
- 候选 B:Information-Preserving Cache(query sensitivity)
183
- 候选 C:Topology-Preserving Cache(图桥接节点保留)
184
-
185
- 第五步 Critic 审查:
186
- A 最 GPU 友好,B 需估计未来 query 有不确定性,C 图构建成本过高
187
- 建议:优先 A,B 作轻量 gate
188
- ```
147
+ 1. **缺口识别**:明确指出现有知识库中没有完全对应的知识卡片。判断缺口属于:新领域、新定理族、新结构、新应用场景,还是已有卡片的组合扩展。
148
+
149
+ 2. **透镜回退**:选择 1-3 个最相关思想透镜,用它们确定问题的数学结构。例如:局部到整体、范畴化、谱分解、投影、因果、扰动等。
150
+
151
+ 3. **候选知识定位**:给出应查找的数学关键词、定理族、概念簇、参考书方向。不要求已有知识卡覆盖,但必须说明为什么这些知识相关。
152
+
153
+ 4. **临时知识卡**:生成一个"临时知识摘要",格式同正式知识卡:
154
+ - 最小定义
155
+ - 核心结构
156
+ - 适用问题
157
+ - AI 设计翻译
158
+ - GPU 可行性
159
+ - 风险与失效条件
160
+ - **来源与置信度**(必填):
161
+ - 知识来源:标注为"Agent 推断 / 透镜推导 / 参考书外推 / 需外部验证"
162
+ - 置信度:高(有定理支撑)/ 中(合理推断但未严格证明)/ 低(探索性假说)
163
+ - 未核验声明:列出需要后续验证的关键结论
164
+
165
+ 5. **设计翻译**:若用户目标是机制设计,则将临时知识转译为候选 AI 模块、loss、routing、attention、representation 或 compression 方案。
166
+
167
+ 6. **升级建议**:如果该缺口高频出现,建议新增正式 knowledge card 或 design pattern。
168
+
169
+ ## 工作流范例
170
+
171
+ 完整工作流范例见 `../../references/skill-index.md`。