# FastRead

私人阅读库：把技术书拆成**可读、可查、可自测**的中文单页教程。

- **59 本**书 · **约 30,637 页**原书
- 每个教程是一个独立 HTML 文件，MathJax 已内联，**断网可读**
- 每本含：主线讲解、关键定义/定理/算法、例子、速查表、常见坑
- 数学/理论书含定理盒与公式；系统/编程书含命令、代码与故障案例
- 新转换默认**完整模式**：章节/小节/例子/代码全保留，不设字数上限，并用 `check_coverage.py` 验收
- **7 篇**论文解读 · [论文索引](papers/index.html)

打开 [`index.html`](index.html) 选择书籍或论文，也可以直接打开 `books/`、`papers/` 下的文件。

## 书籍索引

### 数学 · 分析与代数

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| A Course of Higher Mathematics, Vol. 1：Elementary Calculus | Vladimir I. Smirnov | 551 | [HTML](books/Smirnov-Vol-1-Tutorial.html) |
| A Course of Higher Mathematics, Vol. 2：Advanced Calculus | Vladimir I. Smirnov | 637 | [HTML](books/Smirnov-Vol-2-Tutorial.html) |
| A Course of Higher Mathematics, Vol. 3-1：Linear Algebra | Vladimir I. Smirnov | 336 | [HTML](books/Smirnov-Vol-3-1-Tutorial.html) |
| Collected Works of Alan M. Turing, Vol. 3: Morphogenesis | P. T. Saunders (ed.) | 159 | [HTML](books/Turing-Morphogenesis-Tutorial.html) |
| Concrete Mathematics：A Foundation for Computer Science | Graham, Knuth & Patashnik | 690 | [HTML](books/Concrete-Mathematics-Tutorial.html) |
| Fundamentals of Fourier Analysis | Loukas Grafakos | 416 | [HTML](books/Fourier-Analysis-Tutorial.html) |
| Group Theory in a Nutshell for Physicists | Anthony Zee | 633 | [HTML](books/Group-Theory-Zee-Tutorial.html) |
| Linear Algebra：A Beginning Graduate Student’s Guide | Jonathan S. Golan | 444 | [HTML](books/Linear-Algebra-Golan-Tutorial.html) |
| Linear Algebra for Computer Vision, Robotics, and Machine Learning：A Geometric and Computational Introduction | Jean Gallier & Jocelyn Quaintance | 788 | [HTML](books/Linear-Algebra-Vision-Robotics-ML-Tutorial.html) |
| The Renormalization Group and Condensed Matter Physics | David R. Nelson & Grace H. Zhang | 329 | [HTML](books/Renormalization-Group-Tutorial.html) |

### 数学 · 物理 · 理论

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Discrete Morse Theory：A combinatorial bridge between topology and algebra | Nicholas A. Scoville | 289 | [HTML](books/Discrete-Morse-Theory-Tutorial.html) |
| Fashion, Faith, and Fantasy：In the New Physics of the Universe | Roger Penrose | 518 | [HTML](books/Fashion-Faith-Fantasy-Tutorial.html) |
| Fly by Night Physics：How Physicists Use the Backs of Envelopes | A. Zee | 455 | [HTML](books/Fly-by-Night-Physics-Tutorial.html) |
| General Relativity for the Gifted Amateur：A guided tour from Newton to black holes | Stephen Blundell & Tom Lancaster | 641 | [HTML](books/General-Relativity-Tutorial.html) |
| Modern Classical Physics：Optics, fluids, plasmas, elasticity, relativity and statistical physics | Roger D. Blandford & Kip S. Thorne | 1552 | [HTML](books/Modern-Classical-Physics-Tutorial.html) |
| Optimal Transport：Old and New | Cédric Villani | 997 | [HTML](books/Optimal-Transport-Tutorial.html) |
| Symmetry, Shape and Space：An Introduction to Mathematics through Geometry | L. Christine Kinsey & Teresa E. Moore | 514 | [HTML](books/Symmetry-Shape-Space-Tutorial.html) |
| Thermal Physics：An Introduction to Thermal Physics | Daniel V. Schroeder | 432 | [HTML](books/Thermal-Physics-Tutorial.html) |

### 优化 · 金融 · 概率

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| An Introductory Course on Mathematical Game Theory and Applications | Julio González-Díaz, Ignacio García-Jurado & M. Gloria Fiestras-Janeiro | 432 | [HTML](books/Game-Theory-Tutorial.html) |
| Financial Mathematics：A Comprehensive Treatment | Giuseppe Campolieti & Roman N. Makarov | 826 | [HTML](books/Financial-Mathematics-Tutorial.html) |
| Fundamentals of Stochastic Filtering | Alan Bain & Dan Crisan | 395 | [HTML](books/Stochastic-Filtering-Tutorial.html) |
| Integer Programming：Models, Algorithms and Applications | Laurence A. Wolsey | 360 | [HTML](books/Integer-Programming-Tutorial.html) |
| Linear and Convex Optimization | Michael H. Veatch | 387 | [HTML](books/Linear-Convex-Optimization-Tutorial.html) |
| Portfolio Theory and Arbitrage：A Course in Mathematical Finance | Ioannis Karatzas & Constantinos Kardaras | 328 | [HTML](books/Portfolio-Theory-Arbitrage-Tutorial.html) |
| Probability and Computing | Randomization and Probabilistic Techniques in Algorithms and Data Analysis | 490 | [HTML](books/Probability-and-Computing-Tutorial.html) |

### 逻辑 · 形式方法 · 理论计算机

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| An Invitation to Mathematical Logic：A first course in model theory, computability and proof theory | David Marker | 359 | [HTML](books/Invitation-to-Mathematical-Logic-Tutorial.html) |
| Collected Works of A. M. Turing | A. M. Turing | 307 | [HTML](books/Turing-Collected-Works-Tutorial.html) |
| Computable Structure Theory：Computability, definability and algebraic structures | Rod Downey | 553 | [HTML](books/Computable-Structure-Theory-Tutorial.html) |
| Decision Procedures：An Algorithmic Point of View | Daniel Kroening & Ofer Strichman | 369 | [HTML](books/Decision-Procedures-Tutorial.html) |
| Formal Methods: An Appetizer | Flemming Nielson & Hanne Riis Nielson | 171 | [HTML](books/Formal-Methods-Appetizer-Tutorial.html) |
| Formal Reasoning About Programs：Verifying Software with Proof Assistants | Adam Chlipala | 160 | [HTML](books/Formal-Reasoning-About-Programs-Tutorial.html) |
| Handbook of Satisfiability：Theory, algorithms and applications of SAT | Armin Biere, Marijn Heule & Hans van Maaren | 1486 | [HTML](books/Handbook-of-Satisfiability-Tutorial.html) |
| Logic for Programmers：Practical Logic for Working Developers | Hillel Wayne | 150 | [HTML](books/Logic-for-Programmers-Tutorial.html) |
| Logic in Computer Science：Modelling and Reasoning about Systems | Michael Huth & Mark Ryan | 556 | [HTML](books/Logic-in-Computer-Science-Tutorial.html) |
| Logic Without Gaps or Gluts：How to Solve the Paradoxes Without Sacrificing Classical Logic | Ben Burgis | 193 | [HTML](books/Logic-Without-Gaps-or-Gluts-Tutorial.html) |
| Mathematical Logic：A graduate introduction to model theory, proof theory, recursion and set theory | Heinz-Dieter Ebbinghaus, Jörg Flum & Wolfgang Thomas | 305 | [HTML](books/Mathematical-Logic-Ebbinghaus-Tutorial.html) |
| Principles of Model Checking | Christel Baier & Joost-Pieter Katoen | 994 | [HTML](books/Model-Checking-Tutorial.html) |

### 机器学习 · 语言模型

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Build a Large Language Model：From Scratch | Sebastian Raschka | 370 | [HTML](books/Build-a-Large-Language-Model-Tutorial.html) |
| Deep Learning with Python：Third Edition | François Chollet & Matthew Watson | 650 | [HTML](books/Deep-Learning-with-Python-Tutorial.html) |
| Deep Learning with PyTorch：Training and Applying Deep Learning and Generative AI | Howard Huang et al. | 546 | [HTML](books/Deep-Learning-with-PyTorch-Tutorial.html) |
| Domain-Specific Small Language Models：Efficient AI for Local Deployment | Guglielmo Iozzia | 376 | [HTML](books/Domain-Specific-SLMs-Tutorial.html) |
| Grokking AI Algorithms：How AI Solves Complex Problems | Rishal Hurbans | 594 | [HTML](books/Grokking-AI-Algorithms-Tutorial.html) |
| Why Machines Learn：The Elegant Maths Behind Modern AI | Anil Ananthaswamy | 433 | [HTML](books/Why-Machines-Learn-Tutorial.html) |

### 系统 · 数据 · 网络

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Absolute FreeBSD：The Complete Guide to FreeBSD | Michael W. Lucas | 708 | [HTML](books/Absolute-FreeBSD-Tutorial.html) |
| Designing Data-Intensive Applications：The Big Ideas Behind Reliable, Scalable, and Maintainable Systems | Martin Kleppmann & Chris Riccomini | 673 | [HTML](books/Designing-Data-Intensive-Applications-Tutorial.html) |
| Linux+ and LPIC-1 Guide to Linux Certification | Jason Eckert | 786 | [HTML](books/Linux-LPIC1-Tutorial.html) |
| Systems Performance：Enterprise and the Cloud | Brendan Gregg | 929 | [HTML](books/Systems-Performance-Tutorial.html) |
| The Book of PF：A No-Nonsense Guide to the OpenBSD Firewall | Peter N. M. Hansteen | 266 | [HTML](books/Book-of-PF-Tutorial.html) |
| The Little Book of Semaphores：Classic Synchronization Problems in Python | Allen B. Downey | 291 | [HTML](books/Little-Book-of-Semaphores-Tutorial.html) |
| xv6: A Simple, Unix-like Teaching Operating System：Processes, Memory, File Systems and System Calls | Russ Cox, Frans Kaashoek & Robert Morris | 116 | [HTML](books/xv6-Tutorial.html) |

### 安全 · 二进制 · 逆向

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Black Hat Python：Python Programming for Hackers and Pentesters | Justin Seitz & Tim Arnold | 217 | [HTML](books/Black-Hat-Python-Tutorial.html) |
| Practical Binary Analysis：Build Your Own Linux Tools for Binary Instrumentation, Analysis, and Disassembly | Dennis Andriesse | 460 | [HTML](books/Practical-Binary-Analysis-Tutorial.html) |
| Practical Reverse Engineering：x86, x64, ARM, Windows Kernel, Reversing Tools, and Obfuscation | Bruce Dang, Alexandre Gazet & Elias Bachaalany | 383 | [HTML](books/Practical-Reverse-Engineering-Tutorial.html) |
| The Car Hacker’s Handbook：A Guide for the Penetration Tester | Craig Smith | 306 | [HTML](books/Car-Hackers-Handbook-Tutorial.html) |

### 数值计算 · 工程

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Numerical Methods for Engineers：Eighth Edition | Steven C. Chapra & Raymond P. Canale | 1006 | [HTML](books/Numerical-Methods-for-Engineers-Tutorial.html) |

### 认知科学 · 哲学

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| The Border Between Seeing and Thinking | Ned Block | 561 | [HTML](books/Border-Seeing-Thinking-Tutorial.html) |
| The Brain Abstracted | M. Chirimuuta | 377 | [HTML](books/Brain-Abstracted-Tutorial.html) |

### 经济学

| 教程 | 作者 | 页数 | 打开 |
|---|---|---:|---|
| Chicago Price Theory | Sonia Jaffe, Robert Minton, Casey Mulligan & Kevin Murphy | 457 | [HTML](books/Chicago-Price-Theory-Tutorial.html) |
| Human Action：A Treatise on Economics | Ludwig von Mises | 930 | [HTML](books/Human-Action-Tutorial.html) |

## 论文索引

| 论文 | 作者 | 会议/年份 | 打开 |
|---|---|---|---|
| From Cacophony to Hierarchy: A Principled Framework for Assessing AI Consciousness | Shamil Chandaria, Arvo Muñoz Morán, Fernando Rosas, Anil Seth, Henry Shevlin, Marcus Hutter et al. | arXiv preprint 2026 | [HTML](papers/From-Cacophony-to-Hierarchy.html) |
| InfraRSI: Harnessing Recursive Self-Improvement for Training Infrastructure | InfraRSI Team, Yuchuan Tian, Haocheng Mei, Ye Yuan, et al. | arXiv preprint 2026 | [HTML](papers/InfraRSI.html) |
| The entangled loop: Emotion, interference and hierarchy in the architecture of consciousness | Morten L. Kringelbach | Neuroscience & Biobehavioral Reviews 2026 | [HTML](papers/The-Entangled-Loop.html) |
| HVM2: A Parallel Evaluator for Interaction Combinators | Victor Taelin | preprint 2024 | [HTML](papers/HVM2-Parallel-Evaluator.html) |
| First-Order Homotopical Logic | Joseph Helfer | arXiv preprint 2019 | [HTML](papers/First-Order-Homotopical-Logic.html) |
| Attention Is All You Need | Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, Illia Polosukhin | NeurIPS 2017 | [HTML](papers/Attention-Is-All-You-Need.html) |
| Ironies of Automation | Lisanne Bainbridge | Automatica 1983 | [HTML](papers/Ironies-of-Automation.html) |

论文索引页：[papers/index.html](papers/index.html)

## 使用说明

- 直接双击 HTML 即可；侧栏目录、搜索、暗色模式、字号、证明折叠都在页面内。
- 顶部有「‹ 书库 ›」：上一本 / 返回索引 / 下一本；关闭页面再打开会回到上次阅读位置。
- 每节标题右侧的 ☆ 收藏该节（侧栏显示 ★）；选中正文可高亮，点击高亮即可移除。两者都只存在本机浏览器里。
- 每本都是单文件，约 2.3 MB；59 本合计约 135 MB。
- 原书 PDF 不在此仓库中；这里只保存学习版教程。
- `books/Index-Books1.html`、`books/Index-Books2.html` 是两批生成时的原始索引。

## 生成技能：pdf-book-to-web-tutorial

把“技术 PDF / EPUB → 中文单页教程”的完整流水线保存在：

`skill/pdf-book-to-web-tutorial/`

它包含：从 PDF 提取与分章、并行章节笔记提示词、单文件 HTML 构建、数学公式转义、页面骨架、主题 CSS、交互 JS，以及**内联 MathJax**（因此生成物可离线打开）。

### 安装到 OpenCode

```bash
# 方案 A：复制（简单）
mkdir -p ~/.config/opencode/skills
cp -R skill/pdf-book-to-web-tutorial ~/.config/opencode/skills/

# 方案 B：软链接（推荐；仓库更新后自动生效）
ln -sfn "$PWD/skill/pdf-book-to-web-tutorial" ~/.config/opencode/skills/pdf-book-to-web-tutorial
```

### 怎么触发

在对话里直接说：

> 用 `pdf-book-to-web-tutorial` 把这本书做成单页教程

或在 OpenCode 中加载该 skill。它会按“提取 → 蓝图 → 并行笔记 → 写作 → 构建 → QA → 事实核查”的顺序执行。

### 手动使用

```bash
# 1) 提取 PDF：带页码全文 + 按章拆分 + 编号结果统计
python3 skill/pdf-book-to-web-tutorial/scripts/extract_book.py book.pdf work/

# 2) 在 src/sections/ 写 HTML 片段后，组装单文件
python3 skill/pdf-book-to-web-tutorial/scripts/build_tutorial.py \
  --sections src/sections --out dist/Book-Tutorial.html \
  --title "书名 · 交互教程" --book-title "书名" \
  --book-subtitle "副标题" --short-title "书名"
```

`--dev` 会改用 CDN 加载 MathJax，构建更快，但产物不自包含；正式交付不要加。

### 技能目录

| 路径 | 作用 |
|---|---|
| `SKILL.md` | 完整工作流与十个常见坑 |
| `scripts/extract_book.py` | PDF/EPUB → `full.txt`、`chapters/`、`meta.json` |
| `scripts/build_tutorial.py` | sections + shell → 单文件 HTML（内联 CSS/JS/MathJax） |
| `scripts/escape_math.py` | 修复公式里的 `<`、`>`、`&`，并保护代码块 |
| `scripts/check_coverage.py` | 最终覆盖率检测（TOC/章节/术语/长度比） |
| `assets/shell.html` | 侧栏、顶栏、搜索、进度、暗色模式骨架 |
| `assets/theme.css` | 定理盒、速查表、代码块、响应式、打印样式 |
| `assets/app.js` | 目录高亮、搜索、主题、字号、证明折叠 |
| `assets/mathjax-tex-svg.js` | 内联 MathJax，保证离线可用 |
| `references/pipeline.md` | 分阶段细节与子代理提示词 |
| `references/qa-checklist.md` | 浏览器、手机、file:// 离线检查 |
| `references/design-system.md` | 版式、定理盒与交互约定 |

## 新增一本书

### 最省事：让 agent 跑

1. 把新 PDF 放到仓库外：

```bash
mkdir -p ~/Downloads/FastRead-inbox
# 把 PDF 放进 FastRead-inbox
```

2. 在 OpenCode 里说：

> 先用 `python3 tools/check_duplicate.py` 对 `~/Downloads/FastRead-inbox/` 里的每本书查重，已存在的跳过；  
> 再用 `pdf-book-to-web-tutorial` 把剩下的 PDF 做成单页教程。  
> 每本输出到 `~/Documents/Default Project/FastRead/books/<英文短名>-Tutorial.html`，  
> 完整覆盖原书章节/小节/例子/代码，不设字数上限；  
> 更新 `catalog.json`、`README.md`、`index.html`，  
> 跑覆盖率检测和 QA，最后提交并 push。

Agent 会依次完成：提取 → 章节蓝图 → 写 sections → 构建单文件 → **覆盖率检测** → QA → 更新索引 → Git 提交。

默认是**完整模式**：章节、小节、编号结果、例子、代码、参数都要保留；不设字数上限，长度服从内容。

### 手动流程

#### 1. 提取

```bash
cd "$HOME/Documents/Default Project/FastRead"
python3 skill/pdf-book-to-web-tutorial/scripts/extract_book.py \
  ~/Downloads/FastRead-inbox/新书.pdf \
  work/新书
```

查看 `work/新书/meta.json`：页数、章节数、`numbered_results_total`。若 `low_text_pages` 很多，先 OCR。

#### 2. 写 sections

在 `work/新书/src/sections/` 下写：

```text
00-hero.html
01-ch1.html
02-ch2.html
...
99-summary.html
```

使用 skill 的类：`chapter`、`lede`、`chap-intro`、`thm def/theorem/lem/ex/rem/warn`、`intuition`、`table-wrap cheat`、`cards`。

参考：

- `skill/pdf-book-to-web-tutorial/SKILL.md`
- `skill/pdf-book-to-web-tutorial/references/pipeline.md`
- `skill/pdf-book-to-web-tutorial/references/design-system.md`

#### 3. 构建

```bash
python3 skill/pdf-book-to-web-tutorial/scripts/build_tutorial.py \
  --sections work/新书/src/sections \
  --out books/New-Book-Tutorial.html \
  --title "新书 · 交互教程" \
  --book-title "新书" \
  --book-subtitle "副标题" \
  --short-title "新书" \
  --stats "<b>12</b> 章 · <b>500</b> 页"
```

默认内联 MathJax，产物约 2.2 MB，可离线打开。正式交付不要加 `--dev`。

#### 4. 覆盖率检测（必须）

```bash
python3 skill/pdf-book-to-web-tutorial/scripts/check_coverage.py \
  --work work/新书 --html books/New-Book-Tutorial.html \
  --report work/新书/coverage-report.md
```

门槛：TOC ≥75%、章节召回 ≥70%、术语召回 ≥30%。报告里的 missing 条目要补内容后重跑，不要改报告。

#### 5. QA

```bash
python3 tools/qa_tutorial.py books/New-Book-Tutorial.html --render
```

应满足：`merror = 0`、无 raw `$$`、无重复 ID、无断链、无未替换占位符、控制台 0 错误。手机 390px 检查见 skill 的 `references/qa-checklist.md`。

#### 6. 更新索引

在 `catalog.json` 增加一条：

```json
{
  "file": "New-Book-Tutorial.html",
  "title": "New Book",
  "subtitle": "A Subtitle",
  "author": "Author Name",
  "pages": 500,
  "category": "数学 · 分析与代数",
  "batch": "Books3"
}
```

可以直接使用现有九类之一；新分类会自动追加到末尾（要控制位置就加进 `tools/catalog_lib.py` 的 `ORDER`）：

- 数学 · 分析与代数
- 优化 · 金融 · 概率
- 逻辑 · 形式方法 · 理论计算机
- 机器学习 · 语言模型
- 系统 · 数据 · 网络
- 安全 · 二进制 · 逆向
- 数值计算 · 工程
- 认知科学 · 哲学
- 经济学

然后重建索引：

```bash
python3 tools/build_index.py
```

会重新生成 `README.md` 与 `index.html`，并给**所有**书刷新「上一本 / 书库 / 下一本」导航、阅读进度、书签与高亮脚本。新书顺序由分类 + 标题自动计算，不需要改其它书。

提交前校验：

```bash
python3 tools/build_index.py --check
```

#### 7. 提交

```bash
git add books/New-Book-Tutorial.html catalog.json README.md index.html
git commit -m "Add New Book tutorial"
git push
```

### 命名约定

- 文件名：`Title-Words-Tutorial.html`，ASCII、连字符、无空格。
- 一本书一个 HTML；配套 `work/` 不提交。
- 不要提交 PDF；`.gitignore` 已忽略 `*.pdf`、`inbox/`、`work/`。

### 详细版

更细的说明、常见坑和 QA 清单见 **[docs/ADDING-BOOKS.md](docs/ADDING-BOOKS.md)**。

## 维护

**第 0 步：查重**（避免把同一本书做两遍）：

```bash
python3 tools/check_duplicate.py ~/Downloads/Books/新书.pdf
# 退出码 0 = 没找到，可以转换；1 = 已存在/可能重复，先人工确认
```

新增教程：把 HTML 放进 `books/`，在 `catalog.json` 增加一条记录，然后运行：

```bash
python3 tools/build_index.py
```

会重新生成 `README.md` 与 `index.html`。