math-skill 1.0.0 → 2.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 (50) hide show
  1. package/README.en-US.md +280 -0
  2. package/README.md +280 -278
  3. package/agents/math-critic.md +235 -203
  4. package/commands/abstraction.md +13 -34
  5. package/commands/algorithmic-thinking.md +13 -34
  6. package/commands/ask.md +20 -21
  7. package/commands/axiomatization.md +13 -34
  8. package/commands/causal-inference.md +13 -34
  9. package/commands/discrete-combinatorial.md +13 -34
  10. package/commands/game-theory.md +13 -34
  11. package/commands/induction-analogy.md +13 -34
  12. package/commands/information-theory.md +13 -34
  13. package/commands/logic-deduction.md +13 -34
  14. package/commands/modeling.md +13 -37
  15. package/commands/optimization.md +13 -33
  16. package/commands/probability-statistics.md +13 -36
  17. package/commands/symmetry-invariance.md +13 -34
  18. package/commands/topological-thinking.md +13 -33
  19. package/commands/transformation.md +13 -33
  20. package/knowledge-base/overview.md +228 -230
  21. package/package.json +71 -59
  22. package/references/agentic-workflow.md +53 -0
  23. package/references/books/abstract-algebra.md +120 -0
  24. package/references/books/algebraic-geometry-rising-sea.md +167 -0
  25. package/references/books/differential-geometry.md +136 -0
  26. package/references/books/matrix-analysis.md +142 -0
  27. package/references/books/micro-lie-theory.md +112 -0
  28. package/references/books/optimization-ml.md +160 -0
  29. package/references/books/smooth-manifolds.md +101 -0
  30. package/references/gpu-friendly-math.md +65 -0
  31. package/skills/abstraction/SKILL.md +119 -264
  32. package/skills/algorithmic-thinking/SKILL.md +136 -371
  33. package/skills/axiomatization/SKILL.md +149 -213
  34. package/skills/causal-inference/SKILL.md +149 -374
  35. package/skills/discrete-combinatorial/SKILL.md +129 -286
  36. package/skills/game-theory/SKILL.md +121 -318
  37. package/skills/induction-analogy/SKILL.md +150 -310
  38. package/skills/information-theory/SKILL.md +138 -242
  39. package/skills/logic-deduction/SKILL.md +133 -280
  40. package/skills/math-research-activator/SKILL.md +134 -0
  41. package/skills/{meta-selector → math-research-activator}/original-texts.md +104 -104
  42. package/skills/modeling/SKILL.md +137 -318
  43. package/skills/optimization/SKILL.md +133 -292
  44. package/skills/probability-statistics/SKILL.md +149 -312
  45. package/skills/symmetry-invariance/SKILL.md +137 -358
  46. package/skills/topological-thinking/SKILL.md +126 -273
  47. package/skills/transformation/SKILL.md +122 -264
  48. package/docs/CLAUDE.md +0 -187
  49. package/skills/meta-selector/SKILL.md +0 -188
  50. /package/{docs → references}/inspiration.md +0 -0
@@ -0,0 +1,280 @@
1
+ <p align="right">
2
+ <a href="README.md">中文</a> | <a href="README.en-US.md">English</a>
3
+ </p>
4
+
5
+ # ⚔️ Math Skill — Math Research Activator
6
+
7
+ > **Activating modern mathematics (algebraic geometry / differential geometry / Lie theory / category theory / matrix analysis / optimization) into algorithm × GPU co-design — beautiful in math, friendly to GPUs.**
8
+
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
+ [![npm version](https://img.shields.io/npm/v/math-skill.svg)](https://www.npmjs.com/package/math-skill)
11
+
12
+ ---
13
+
14
+ ## Philosophy
15
+
16
+ The mathematical foundation of this AI revolution is **20th-century mathematics stepping onto the commercial computing stage for the first time** — category theory, algebraic topology, algebraic geometry. Most mainstream algorithms today still rest on the 1800–1900s calculus / linear algebra. Activating modern mathematics into algorithm design is the most important thing in the algorithm exploration phase.
17
+
18
+ This skill packages sixteen core mathematical ideas into callable thinking frameworks, and **steps in automatically** when the workspace contains ML / model code, CUDA / kernels, or algorithm research notes: diagnose the problem → map modern mathematical structures → route thinking weapons → GPU feasibility screening. Every deliverable must pass a **double acceptance gate**:
19
+
20
+ 1. **Beautiful in math** — self-consistent, differentiable (or relaxable to differentiable), with correctness guarantees.
21
+ 2. **Friendly to GPU** — passes the eight-dimensional gate in `references/gpu-friendly-math.md`.
22
+
23
+ > "The model already has enough math inside; what's missing is a single cross-domain activation. Humans pick direction; the agent searches, enumerates, and verifies."
24
+
25
+ ---
26
+
27
+ ## What v2.0.1 Does
28
+
29
+ - **Auto-trigger entry**: `math-research-activator` only intervenes when both environment signals (workspace contains architecture core code / CUDA kernel / research notes) AND task signals (designing new architectures / operators, analyzing theoretical properties, transferring mathematical structures) are hit. Pure engineering tasks (debugging, code review, refactoring, hyperparameter tuning) do NOT trigger.
30
+ - **Modern math activation layer**: `references/books/*.md` × 7 (algebraic geometry, differential geometry, Lie theory, abstract algebra, matrix analysis, optimization, manifolds) serve as low-token activation indices, loaded by problem type — they do not replace the full books.
31
+ - **GPU 8-D cross-cut**: all 15 thinking weapons are explicitly mapped to the formal eight dimensions of `references/gpu-friendly-math.md`: tensorization / GEMM-mappability / complexity / memory & KV-Cache / low-precision stability / parallelism & communication / sparse structure / operator fusion.
32
+ - **Single research path**: oriented toward research, algorithms, operators, and training/inference infra; the life-advice mode has been dropped.
33
+ - **Progressive disclosure**: resident layer (activator + description) → methodology layer (on demand) → book layer (on demand), keeping irrelevant context out of the prompt.
34
+
35
+ ---
36
+
37
+ ## Sixteen Thinking Weapons
38
+
39
+ | # | Thinking Weapon | Core Idea | Algorithm / GPU Application |
40
+ |---|----------------|-----------|----------------------------|
41
+ | 0 | 🧭 [Math Research Activator](skills/math-research-activator/SKILL.md) | Auto-trigger entry: diagnose → map → route → GPU filter, with a double acceptance gate | Intervenes only when both environment AND task signals hit; pure engineering tasks are excluded |
42
+ | 1 | 📐 [Axiomatization](skills/axiomatization/SKILL.md) | Build rigorous logic from the fewest assumptions | Review algorithm assumptions; pin down axioms and invariants for structures |
43
+ | 2 | 🧩 [Abstraction](skills/abstraction/SKILL.md) | Grasp the essence, ignore non-essential detail | Extract transferable structures; discover cross-domain commonalities |
44
+ | 3 | 🧠 [Logic Deduction](skills/logic-deduction/SKILL.md) | Rigorously derive new truths from existing truths | Formally verify algorithm correctness; loop invariants |
45
+ | 4 | 🌉 [Modeling](skills/modeling/SKILL.md) | Real problem → math problem → explain reality | Build computable models; parameterized selection |
46
+ | 5 | ⚖️ [Optimization](skills/optimization/SKILL.md) | Find the optimum under constraints | Optimizer selection; second-order GPU feasibility; duality |
47
+ | 6 | 🎲 [Probability & Statistics](skills/probability-statistics/SKILL.md) | Quantify uncertainty; extract patterns from data | Randomized algorithms, sampling, quantization, training dynamics |
48
+ | 7 | 🔄 [Transformation](skills/transformation/SKILL.md) | Complex problem → equivalent simpler problem | Conv → GEMM, spectral transforms, KV frequency-domain compression |
49
+ | 8 | ⚛️ [Symmetry & Invariance](skills/symmetry-invariance/SKILL.md) | Properties preserved under transformations | Equivariant networks (SO(3)/SE(3)), tropical semiring routing |
50
+ | 9 | 📈 [Induction & Analogy](skills/induction-analogy/SKILL.md) | From special to general, known to unknown | Cross-domain structure transfer; inductive bias design |
51
+ | 10 | 🖥️ [Algorithmic Thinking](skills/algorithmic-thinking/SKILL.md) | Reduce to finite steps; evaluate cost and feasibility | Sub-quadratic complexity, parallelism, operator fusion |
52
+ | 11 | 📡 [Information Theory](skills/information-theory/SKILL.md) | Information is the reduction of uncertainty | Compression, pruning, quantization, KV compression, routing |
53
+ | 12 | 🎯 [Game Theory](skills/game-theory/SKILL.md) | Optimal strategy depends on others' choices | Multi-agent, adversarial training, routing games |
54
+ | 13 | 🔗 [Causal Inference](skills/causal-inference/SKILL.md) | Correlation ≠ causation, but causation can be formalized | Interpretability, OOD generalization, DGP modeling |
55
+ | 14 | 🌀 [Topological Thinking](skills/topological-thinking/SKILL.md) | Properties preserved under continuous deformation | Čech cohomology regularization, sheaf attention, TDA |
56
+ | 15 | 🧮 [Discrete & Combinatorial Thinking](skills/discrete-combinatorial/SKILL.md) | Counting, enumeration, laws of finite objects | Sparse structure, routing, finite-field / semiring algorithms |
57
+
58
+ ---
59
+
60
+ ## Quick Start
61
+
62
+ ### Installation
63
+
64
+ Just paste the following into Claude Code or any other terminal-style AI assistant:
65
+
66
+ ```
67
+ Please help me install math-skill: https://github.com/the-thinker0/math-skill, and show me how to use it
68
+ ```
69
+
70
+ Manual-install alternative (downloads the source; does not register the skill automatically):
71
+
72
+ ```bash
73
+ git clone https://github.com/the-thinker0/math-skill.git
74
+ ```
75
+
76
+ Claude Code / Codex-style platforms: copy or symlink `skills/` and `commands/` according to the platform's skills / commands directory conventions, keeping `references/` at the same repo depth. Don't copy a single `SKILL.md` in isolation — `../../references/*` won't resolve.
77
+
78
+ Cursor / other Markdown-rule platforms: treat `commands/*.md` as the manual entry points and `skills/*/SKILL.md` as the rule / skill body, and keep `references/`. If the platform has no auto-trigger mechanism, fire manually with `/ask` or the matching command.
79
+
80
+ You can also inspect the npm package first:
81
+
82
+ ```bash
83
+ npm pack math-skill --dry-run
84
+ ```
85
+
86
+ ### Usage
87
+
88
+ **Auto-trigger**: fires only when both conditions hold — (1) the workspace contains architecture core code (attention / transformer / MoE, `*.cu` / kernel, Triton) or research notes, AND (2) the user's task involves **designing / improving** new architectures / operators, **analyzing** theoretical properties, or **transferring** mathematical structures. Pure engineering tasks (debugging, argument-passing checks, refactoring, hyperparameter tuning, loss implementation tweaks) do not trigger.
89
+
90
+ ### Does it auto-trigger in normal chat?
91
+
92
+ Yes, but it depends on whether the install platform supports **skill metadata auto-routing**. In skills-aware environments like Claude Code / Codex, you don't need `/ask` on every turn after installing. As of v2.0.1 the trigger has been tightened: the skill loads only when **both environment and task signals hit** — routine code review, debugging, and refactoring will not fire it.
93
+
94
+ For example, you can simply ask:
95
+
96
+ ```
97
+ I want to design a long-context attention that uses less KV-Cache — any modern math angle?
98
+ ```
99
+
100
+ Or:
101
+
102
+ ```
103
+ Can the memory access and fusion pattern of this Triton kernel be improved at the algorithmic-structure level?
104
+ ```
105
+
106
+ Such questions trigger `math-research-activator`, which loads `references/gpu-friendly-math.md` and `references/books/*.md` on demand. `/ask` and the slash commands below are the **explicit / fallback entry**: use them only when the platform has no auto-trigger, or when you want to force a specific thinking weapon.
107
+
108
+ **Manual fallback** (when in doubt, start with `/ask`):
109
+
110
+ ```
111
+ /ask <your question> # activator: diagnose + map + route + GPU filter
112
+ /axiomatization <your question> # axiomatization
113
+ /abstraction <your question> # abstraction
114
+ /logic-deduction <your question> # logic deduction
115
+ /modeling <your question> # modeling
116
+ /optimization <your question> # optimization
117
+ /probability-statistics <your question> # probability & statistics
118
+ /transformation <your question> # transformation
119
+ /symmetry-invariance <your question> # symmetry & invariance
120
+ /induction-analogy <your question> # induction & analogy
121
+ /algorithmic-thinking <your question> # algorithmic thinking
122
+ /information-theory <your question> # information theory
123
+ /game-theory <your question> # game theory
124
+ /causal-inference <your question> # causal inference
125
+ /topological-thinking <your question> # topological thinking
126
+ /discrete-combinatorial <your question> # discrete & combinatorial thinking
127
+ ```
128
+
129
+ ### Language Switching
130
+
131
+ Default output is **Chinese**. For **English** output, append `in English` to a command:
132
+
133
+ ```
134
+ /optimization Is K-FAC feasible on H100 with this batch size? in English
135
+ ```
136
+
137
+ ---
138
+
139
+ ## Usage Examples
140
+
141
+ ### Auto-trigger (research / algorithm / GPU)
142
+
143
+ The activator steps in only when the workspace contains a kernel or attention core implementation **and the task involves design / analysis / transfer**: problem diagnosis, transferable modern-math structure candidates, weapon routing, 8-D GPU screening. Pure engineering tasks (debugging, code review, hyperparameter tuning) do not trigger. See the **Tropical Sheaf Attention** example in `skills/math-research-activator/SKILL.md`: it is a candidate exploration template, not a pre-baked benchmark result — it has to be validated on complexity, memory, low-precision stability, and kernel fusibility before adoption.
144
+
145
+ ### Manual trigger (research scenarios)
146
+
147
+ **Review an algorithm's theoretical assumptions**:
148
+ ```
149
+ /axiomatization This attention variant claims permutation invariance, yet its positional encoding smuggles in an implicit total order — is it self-consistent?
150
+ ```
151
+
152
+ **Check a proof / invariant**:
153
+ ```
154
+ /logic-deduction Does the step from line 5 to line 6 in this convergence proof skip a premise? Does the loop invariant hold?
155
+ ```
156
+
157
+ **Optimizer / second-order feasibility**:
158
+ ```
159
+ /optimization I want to replace Adam with K-FAC but memory is tight — is this second-order method feasible on GPU? Is there a retrofittable low-rank approximation?
160
+ ```
161
+
162
+ **Change representation via transformation**:
163
+ ```
164
+ /transformation Can this custom convolution operator be rewritten as a GEMM that fully saturates Tensor Cores? Is the inverse transform numerically stable?
165
+ ```
166
+
167
+ **Equivariance / symmetry**:
168
+ ```
169
+ /symmetry-invariance Design an SO(3)-equivariant feature layer — can the group action be tensorized into a GEMM?
170
+ ```
171
+
172
+ ---
173
+
174
+ ## Progressive Disclosure
175
+
176
+ | Layer | Content | Load timing |
177
+ |-------|---------|-------------|
178
+ | Resident trigger | `skills/math-research-activator/SKILL.md` + each weapon's short `description` | Loaded on auto / manual trigger |
179
+ | Methodology | `references/agentic-workflow.md` (Human-in-the-Agent-Loop), `references/gpu-friendly-math.md` (8-D gate) | Referenced by activator on demand |
180
+ | Book activation | `references/books/*.md` × 7 (modern-math structure distillations) | Loaded by problem type on demand |
181
+
182
+ **Deep dive / look-up**: the distillations are self-sufficient. When you need the full original text and have `math_book/<PDF>` locally, let the agent run `pdftotext` + grep + Read on the matching page (no pre-embedded anchors required). PDFs are never bundled into npm / git (copyright + 110MB).
183
+
184
+ ---
185
+
186
+ ## Directory Structure
187
+
188
+ ```
189
+ math-skill/
190
+ ├── package.json # v2.0.1, files[] includes references/
191
+ ├── .gitignore / .npmignore # excludes math_book/ PDFs
192
+ ├── commands/ # manual slash-command entries (15 weapons + ask)
193
+ ├── skills/ # 16 thinking weapons (15 weapons + math-research-activator)
194
+ │ ├── math-research-activator/ # auto-trigger entry
195
+ │ └── <weapon>/{SKILL.md, original-texts.md}
196
+ ├── references/ # v2 addition: methodology + book activation layer
197
+ │ ├── agentic-workflow.md # collaboration style
198
+ │ ├── gpu-friendly-math.md # 8-D GPU acceptance gate
199
+ │ ├── inspiration.md # inspiration
200
+ │ └── books/ # 7 modern-math distillations
201
+ ├── agents/math-critic.md # critic agent (18 dimensions, incl. GPU + modern-math activation)
202
+ ├── knowledge-base/overview.md
203
+ ├── tests/{validate.sh, validate.ps1}
204
+ ├── math_book/ # local PDFs (ignored by git/npm, not published)
205
+ └── README.md / LICENSE
206
+ ```
207
+
208
+ ---
209
+
210
+ ## What Each Skill Contains
211
+
212
+ Each `skills/*/SKILL.md` (v2 single research / algorithm path):
213
+
214
+ 1. **Core principle** + blockquote sub-section **Mathematical Formalization** (definitions / theorems / formulas)
215
+ 2. **GPU friendliness (cross-cut check)** — how this weapon's structure maps to GPU, passing the 8-D gate
216
+ 3. **When NOT to use** / **When to use** (research trigger, including algorithm / operator-design usage)
217
+ 4. **Method flow** — single research path (all math retained)
218
+ 5. **Common mistakes** — including a one-liner on GPU computability
219
+ 6. **Operating procedure** — single output format, ending with a `[GPU Feasibility]` item
220
+ 7. **Relationship to other skills** — includes a "modern math activation" row, pointing to `references/books/*`
221
+
222
+ Each weapon also ships an `original-texts.md` (math sources and classical references). Outputs can be sent to `agents/math-critic.md` (18 dimensions, including GPU feasibility + modern-math activation) for a second pass.
223
+
224
+ ---
225
+
226
+ ## Mathematical Knowledge System
227
+
228
+ `knowledge-base/overview.md` provides a math knowledge map: three pillars (algebra / geometry / analysis), main branches, knowledge layers (foundation → algebra → synthesis → frontier), and the mapping from thinking weapons to math branches.
229
+
230
+ ---
231
+
232
+ ## Inspiration
233
+
234
+ The story of Sophus Lie forging a "dragon-slaying blade" tells us this: the Lie group–Lie algebra machinery invented to solve differential equations ended up becoming the lingua franca for describing symmetry and robot state estimation — the value of a mathematical tool far outlives its original intent, which is exactly the prototype of "cross-domain activation." See [`references/inspiration.md`](references/inspiration.md).
235
+
236
+ ---
237
+
238
+ ## Changelog
239
+
240
+ ### v2.0.1
241
+ - **Tightened auto-trigger conditions**: `math-research-activator` changed from "any environment OR conversation signal hits → trigger" to "environment AND task signals must both hit" (Gate 1 + Gate 2 as dual necessary conditions).
242
+ - **Added an exclusion gate (Gate 0)**: pure engineering tasks — code review, debugging, argument-passing checks, refactoring, hyperparameter tuning, loss implementation tweaks — are now on an explicit exclusion list with the highest priority.
243
+ - **Narrowed environment signals**: mere `model.py`, `trainer.py`, `config.json` and other routine ML engineering files no longer count as environment signals; architecture core code (attention / transformer / MoE, CUDA / Triton kernel) or research notes is required.
244
+ - **Updated `description` field**: explicitly lists "does not trigger on" scenarios, reducing skill metadata mis-matches on AI platforms.
245
+
246
+ ### v2.0.0
247
+ - Initial v2 release: 16 thinking weapons, modern-math activation layer, 8-D GPU cross-cut, progressive disclosure.
248
+
249
+ ### v1.0.0
250
+ - Initial release: fifteen thinking weapons (axiomatization / abstraction / logic deduction / modeling / optimization / probability & statistics / transformation / symmetry & invariance / induction & analogy / algorithmic thinking / information theory / game theory / causal inference / topology / discrete & combinatorial) + dual research-and-life paths.
251
+ - Fifteen `skills/*/SKILL.md` files (core principle, when-not-to-use, method flow, common mistakes, operating procedure) + matching `original-texts.md` (math sources and classical references).
252
+ - Fifteen manual slash-command entries (`commands/*.md`).
253
+ - `knowledge-base/overview.md` (three pillars / main branches / knowledge layers / weapon mapping).
254
+ - `agents/math-critic.md` critic agent.
255
+ - Validation scripts `tests/{validate.sh, validate.ps1}`.
256
+ - Published to npm (`math-skill`), MIT license.
257
+
258
+ ---
259
+
260
+ ## License
261
+
262
+ MIT License. See `LICENSE`.
263
+
264
+ ---
265
+
266
+ ## Contributing
267
+
268
+ Issues and Pull Requests are welcome — let's learn and build together!
269
+
270
+ ---
271
+
272
+ ## Star History
273
+
274
+ <a href="https://www.star-history.com/?repos=the-thinker0%2Fmath-skill&type=date&legend=top-left">
275
+ <picture>
276
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=the-thinker0/math-skill&type=date&theme=dark&legend=top-left" />
277
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=the-thinker0/math-skill&type=date&legend=top-left" />
278
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=the-thinker0/math-skill&type=date&legend=top-left" />
279
+ </picture>
280
+ </a>