Adaptive Learning Skill
Create self-contained, browser-based adaptive learning apps from any course material.
Architecture
- - FSRS (ts-fsrs): Per-card spaced repetition scheduling (Stability, Difficulty, Retrievability)
- BKT: Per-topic Bayesian Knowledge Tracing for mastery estimation
- Two modes: Breadth-first (cover all topics, weakest first) / Depth-first (drill one topic deep)
- Pure frontend: HTML + CSS + JS, works offline via
file://, no server needed
Workflow
1. Gather Course Material
From a URL:
CODEBLOCK0
From a local folder:
CODEBLOCK1
2. Generate Question Bank
Create questions.json with this schema:
CODEBLOCK2
Guidelines:
- - 5-8 questions per topic minimum, across 3 difficulty levels
- Difficulty 1 (基础): Definitions, "what is", simple complexity questions
- Difficulty 2 (中等): Apply algorithms, analyze examples, describe procedures
- Difficulty 3 (高级): Proofs, novel problem design, optimization, "why" questions
- Use LaTeX (
$...$ inline, $$...$$ block) for math - Use
\\n for line breaks in question/answer text - INLINECODE5 controls topic ordering (0-based)
3. Build the App
Run the bundler script:
CODEBLOCK3
Then register the course in engine.js COURSE_REGISTRY:
CODEBLOCK4
4. Verify
Open <output-dir>/index.html in a browser. Verify:
- - Course appears in selector
- Cards render with KaTeX math
- Flip/rating/FSRS scheduling works
- Mode toggle (breadth/depth) works
Framework Files (assets/framework/)
| File | Purpose |
|---|
| INLINECODE9 | Main page with course selector + learning UI |
| INLINECODE10 |
Dark theme, responsive styles |
|
engine.js | FSRS + BKT engine, question selection, state management |
|
ts-fsrs.umd.js | FSRS algorithm library (UMD build of ts-fsrs) |
Key Features
- - FSRS scheduling: Cards show Stability/Difficulty values; review intervals adapt to performance
- BKT mastery: Per-topic mastery percentage in progress drawer
- Configurable: Target retention (70-97%), daily new card limit
- localStorage: All progress persists across sessions
- Keyboard shortcuts: Space=flip, 1=Good, 2=Hard, 3=Again, f=follow-up, n=next-topic
- KaTeX: Full LaTeX math rendering
- Drag & drop: Import any questions.json directly in the UI
- Multi-course: One framework, multiple course data packs
Adding to Existing Installation
To add a new course to an existing adaptive-learning setup at ~/adaptive-learning/:
- 1. Save
questions.json to INLINECODE15 - Generate preload: INLINECODE16
- Add to
COURSE_REGISTRY in INLINECODE18
自适应学习技能
从任何课程材料创建独立的、基于浏览器的自适应学习应用。
架构
- - FSRS (ts-fsrs):基于卡片的间隔重复调度(稳定性、难度、可提取性)
- BKT:基于主题的贝叶斯知识追踪,用于掌握程度评估
- 两种模式:广度优先(覆盖所有主题,最薄弱优先)/ 深度优先(深入钻研一个主题)
- 纯前端:HTML + CSS + JS,通过 file:// 离线运行,无需服务器
工作流程
1. 收集课程材料
从 URL 获取:
- 1. 获取课程页面,提取主题列表和资源链接
- 将作业/讨论/讲义PDF下载到 ~/课程名称/
从本地文件夹获取:
- 1. 列出文件,识别PDF和文档
- 读取/解析以理解主题和内容
2. 生成题库
使用以下模式创建 questions.json:
json
[{
id: 唯一标识,
topic: 主题名称,
topicIndex: 0,
difficulty: 1,
question: 支持通过KaTeX渲染$LaTeX$,
answer: 支持$LaTeX$和\\n换行,
tags: [标签1, 标签2]
}]
指南:
- - 每个主题至少5-8道题,覆盖3个难度级别
- 难度1(基础):定义、什么是、简单复杂度问题
- 难度2(中等):应用算法、分析示例、描述流程
- 难度3(高级):证明、新颖问题设计、优化、为什么类问题
- 使用LaTeX(行内$...$,块级$$...$$)表示数学公式
- 在问题/答案文本中使用\\n换行
- topicIndex控制主题排序(从0开始)
3. 构建应用
运行打包脚本:
bash
bash SKILL_DIR/scripts/generate-course.sh <课程ID> <输出目录>
然后在 engine.js 的 COURSE_REGISTRY 中注册课程:
javascript
{ id: 课程ID, name: 课程名称, desc: 描述, school: 学校, term: 学期 }
4. 验证
在浏览器中打开 <输出目录>/index.html。验证:
- - 课程出现在选择器中
- 卡片正确渲染KaTeX数学公式
- 翻转/评分/FSRS调度正常工作
- 模式切换(广度/深度)正常工作
框架文件(assets/framework/)
| 文件 | 用途 |
|---|
| index.html | 主页面,包含课程选择器和学习界面 |
| style.css |
深色主题,响应式样式 |
| engine.js | FSRS + BKT引擎,问题选择,状态管理 |
| ts-fsrs.umd.js | FSRS算法库(ts-fsrs的UMD构建) |
关键特性
- - FSRS调度:卡片显示稳定性/难度值;复习间隔根据表现自适应调整
- BKT掌握度:进度抽屉中显示每个主题的掌握百分比
- 可配置:目标保留率(70-97%),每日新卡片限制
- localStorage:所有进度跨会话持久保存
- 快捷键:空格=翻转,1=良好,2=困难,3=重来,f=跟进,n=下一主题
- KaTeX:完整的LaTeX数学渲染
- 拖放:直接在界面中导入任意questions.json
- 多课程:一个框架,多个课程数据包
添加到现有安装
要将新课程添加到位于 ~/adaptive-learning/ 的现有自适应学习设置中:
- 1. 将 questions.json 保存到 ~/adaptive-learning/courses//
- 生成预加载:bash scripts/generate-course.sh questions.json ~/adaptive-learning/framework/
- 在 engine.js 的 COURSE_REGISTRY 中添加课程