Memento Flashcards
间隔重复抽认卡系统。从事实或文本创建卡片,使用由智能体评分的自由文本回答与抽认卡进行交互,从 YouTube 转录生成测验,通过自适应调度复习到期卡片,以及以 CSV 格式导出/导入牌组。
技能元数据
| 来源 | 可选 — 使用 hermes skills install official/productivity/memento-flashcards 安装 |
| 路径 | optional-skills/productivity/memento-flashcards |
| 版本 | 1.0.0 |
| 作者 | Memento AI |
| 许可证 | MIT |
| 平台 | macos, linux |
| 标签 | Education, Flashcards, Spaced Repetition, Learning, Quiz, YouTube |
参考:完整 SKILL.md
以下是 Hermes 在触发此技能时加载的完整技能定义。这是技能激活时智能体看到的指令。
Memento Flashcards — 间隔重复抽认卡技能
概述
Memento 为您提供一个基于本地文件的、带有间隔重复调度的抽认卡系统。 用户可以通过自由文本回答与抽认卡进行交互,智能体会在对回答进行评分后安排下一次复习。 当用户想要执行以下操作时使用它:
- 记住一个事实 — 将任何陈述转化为问答式抽认卡
- 使用间隔重复进行学习 — 使用自适应间隔和智能体评分的自由文本回答来复习到期卡片
- 从 YouTube 视频进行测验 — 获取转录并生成包含 5 个问题的测验
- 管理牌组 — 将卡片组织成集合,导出/导入 CSV
所有卡片数据都存储在单个 JSON 文件中。不需要外部 API 密钥 — 您(智能体)直接生成抽认卡内容和测验问题。
Memento Flashcards 面向用户的响应风格:
- 仅使用纯文本。在回复用户时不要使用 Markdown 格式。
- 保持复习和测验反馈简短且中立。避免额外的赞扬、鼓励或长篇解释。
何时使用
当用户想要执行以下操作时使用此技能:
- 将事实保存为抽认卡以便日后复习
- 使用间隔重复复习到期卡片
- 从 YouTube 视频转录生成测验
- 导入、导出、检查或删除抽认卡数据
不要将此技能用于一般问答、编码帮助或非记忆任务。
快速参考
| 用户意图 | 操作 |
|---|---|
| “记住 X” / “将此保存为抽认卡” | 生成问答卡片,调用 memento_cards.py add |
| 发送事实但未提及抽认卡 | 询问“要我将其保存为 Memento 抽认卡吗?” — 仅在确认后创建 |
| “创建抽认卡” | 询问问题、答案、集合;调用 memento_cards.py add |
| “复习我的卡片” | 调用 memento_cards.py due,逐一展示卡片 |
| “就 [YouTube URL] 对我进行测验” | 调用 youtube_quiz.py fetch VIDEO_ID,生成 5 个问题,调用 memento_cards.py add-quiz |
| “导出我的卡片” | 调用 memento_cards.py export --output PATH |
| “从 CSV 导入卡片” | 调用 memento_cards.py import --file PATH --collection NAME |
| “显示我的统计信息” | 调用 memento_cards.py stats |
| “删除一张卡片” | 调用 memento_cards.py delete --id ID |
| “删除一个集合” | 调用 memento_cards.py delete-collection --collection NAME |
卡片存储
卡片存储在以下位置的 JSON 文件中:
~/.hermes/skills/productivity/memento-flashcards/data/cards.json
切勿直接编辑此文件。 始终使用 memento_cards.py 子命令。该脚本处理原子写入(写入临时文件,然后重命名)以防止损坏。
该文件在首次使用时自动创建。
流程
从事实创建卡片
激活规则
并非每个事实陈述都应成为抽认卡。使用此三层检查:
- 明确意图 — 用户提及“memento”、“flashcard”、“remember this”、“save this card”、“add a card”或类似明确表示请求抽认卡的措辞 → 直接创建卡片,无需确认。
- 隐含意图 — 用户发送事实陈述但未提及抽认卡(例如,“光速是 299,792 km/s”) → 先询问:“要我将其保存为 Memento 抽认卡吗?”仅在用户确认后创建卡片。
- 无意图 — 消息是编码任务、问题、指令、正常对话或任何明显不是要记忆的事实 → 完全不激活此技能。让其他技能或默认行为处理它。
当确认激活时(第 1 层直接激活,第 2 层在确认后激活),生成抽认卡:
步骤 1: 将陈述转化为问答对。在内部使用此格式:
Turn the factual statement into a front-back pair.
Return exactly two lines:
Q: <question text>
A: <answer text>
Statement: "{statement}"
规则:
- 问题应测试对关键事实的记忆
- 答案应简洁直接
步骤 2: 调用脚本以存储卡片:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py add \
--question "What year did World War 2 end?" \
--answer "1945" \
--collection "History"
如果用户未指定集合,则使用 "General" 作为默认值。
脚本输出 JSON 以确认已创建的卡片。
手动创建卡片
当用户明确要求创建抽认卡时,向他们询问:
- 问题(卡片正面)
- 答案(卡片背面)
- 集合名称(可选 — 默认为
"General")
然后如上所述调用 memento_cards.py add。
复习到期卡片
当用户想要复习时,获取所有到期的卡片:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py due
这将返回一个 JSON 数组,其中包含 next_review_at <= now 的卡片。如果需要集合过滤:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py due --collection "History"
复习流程(自由文本评分):
以下是你必须遵循的确切交互模式示例。用户回答后,你进行评分,告知正确答案,然后对卡片进行评级。
交互示例:
Agent: 柏林墙是哪一年倒塌的?
User: 1991
Agent: 不太对。柏林墙于 1989 年倒塌。下次复习时间是明天。 (agent 调用:memento_cards.py rate --id ABC --rating hard --user-answer "1991")
下一个问题:谁是第一个登上月球的人?
规则:
- 仅显示问题。等待用户回答。
- 收到答案后,将其与预期答案进行比较并评分:
- correct → 用户答对了关键事实(即使措辞不同)
- partial → 方向正确但缺少核心细节
- incorrect → 错误或偏离主题
- 你必须告知用户正确答案以及他们的表现。 保持简短并使用纯文本。使用以下格式:
- correct: "Correct. Answer: {answer}. Next review in 7 days."
- partial: "Close. Answer: {answer}. {what they missed}. Next review in 3 days."
- incorrect: "Not quite. Answer: {answer}. Next review tomorrow."
- 然后调用 rate 命令:correct→easy, partial→good, incorrect→hard。
- 然后显示下一个问题。
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py rate \
--id CARD_ID --rating easy --user-answer "what the user said"
切勿跳过第 3 步。 在继续之前,用户必须始终看到正确答案和反馈。
如果没有到期的卡片,告诉用户:“No cards due for review right now. Check back later!”
停用覆盖: 用户随时可以说“retire this card”以将其从复习中永久移除。对此使用 --rating retire。
间隔重复算法
评级决定下一次复习间隔:
| Rating | Interval | ease_streak | Status change |
|---|---|---|---|
| hard | +1 day | reset to 0 | stays learning |
| good | +3 days | reset to 0 | stays learning |
| easy | +7 days | +1 | if ease_streak >= 3 → retired |
| retire | permanent | reset to 0 | → retired |
- learning:卡片处于活跃轮换中
- retired:卡片不会出现在复习中(用户已掌握或手动停用)
- 连续三次“easy”评级会自动停用卡片
YouTube 测验生成
当用户发送 YouTube URL 并想要生成测验时:
步骤 1: 从 URL 中提取视频 ID(例如从 https://www.youtube.com/watch?v=dQw4w9WgXcQ 中提取 dQw4w9WgXcQ)。
步骤 2: 获取转录文本:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/youtube_quiz.py fetch VIDEO_ID
这将返回 {"title": "...", "transcript": "..."} 或错误信息。
如果脚本报告 missing_dependency,告诉用户安装它:
pip install youtube-transcript-api
步骤 3: 从转录文本生成 5 个测验问题。使用以下规则:
You are creating a 5-question quiz for a podcast episode.
Return ONLY a JSON array with exactly 5 objects.
Each object must contain keys 'question' and 'answer'.
Selection criteria:
- Prioritize important, surprising, or foundational facts.
- Skip filler, obvious details, and facts that require heavy context.
- Never return true/false questions.
- Never ask only for a date.
Question rules:
- Each question must test exactly one discrete fact.
- Use clear, unambiguous wording.
- Prefer What, Who, How many, Which.
- Avoid open-ended Describe or Explain prompts.
Answer rules:
- Each answer must be under 240 characters.
- Lead with the answer itself, not preamble.
- Add only minimal clarifying detail if needed.
使用前 15,000 个字符的转录文本作为上下文。自行生成问题(你是 LLM)。
步骤 4: 验证输出是否为有效的 JSON,且恰好包含 5 个项目,每个项目都有非空的 question 和 answer 字符串。如果验证失败,重试一次。
步骤 5: 存储测验卡片:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py add-quiz \
--video-id "VIDEO_ID" \
--questions '[{"question":"...","answer":"..."},...]' \
--collection "Quiz - Episode Title"
该脚本通过 video_id 进行去重——如果该视频的卡片已存在,则跳过创建并报告现有卡片。
步骤 6: 使用相同的自由文本评分流程逐一呈现问题:
- 显示“Question 1/5: ...”并等待用户回答。切勿包含答案或任何暗示将揭示答案的内容。
- 等待用户用自己的话回答
- 使用评分提示对用户的答案进行评分(参见“复习到期卡片”部分)
- 重要提示:在执行其他操作之前,你必须向用户回复反馈。 显示评分、正确答案以及卡片下次到期的时间。不要静默跳转到下一个问题。保持简短并使用纯文本。示例:“Not quite. Answer: {answer}. Next review tomorrow.”
- 显示反馈后,调用 rate 命令,然后在同一条消息中显示下一个问题:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py rate \
--id CARD_ID --rating easy --user-answer "what the user said"
- 重复。每个答案在下一个问题出现之前都必须收到可见的反馈。
导出/导入 CSV
导出:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py export \
--output ~/flashcards.csv
生成一个 3 列 CSV:question,answer,collection(无标题行)。
导入:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py import \
--file ~/flashcards.csv \
--collection "Imported"
读取包含列 question、answer 和可选 collection(第 3 列)的 CSV。如果缺少 collection 列,则使用 --collection 参数。
统计信息
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py stats
返回包含以下内容的 JSON:
total:卡片总数learning:处于活跃轮换中的卡片retired:已掌握的卡片due_now:当前需要复习的卡片collections:按集合名称细分
常见陷阱
- 切勿直接编辑
cards.json— 始终使用脚本子命令以避免数据损坏 - 字幕获取失败 — 部分 YouTube 视频没有英文字幕或已禁用字幕;请通知用户并建议更换其他视频
- 可选依赖 —
youtube_quiz.py需要youtube-transcript-api;如果缺失,请提示用户运行pip install youtube-transcript-api - 大规模导入 — 包含数千行的 CSV 导入可以正常工作,但生成的 JSON 输出可能较为冗长;请为用户总结结果
- 视频 ID 提取 — 支持
youtube.com/watch?v=ID和youtu.be/ID两种 URL 格式
验证
直接验证辅助脚本:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py stats
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py add --question "Capital of France?" --answer "Paris" --collection "General"
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py due
如果您是从代码库检出版本进行测试,请运行:
pytest tests/skills/test_memento_cards.py tests/skills/test_youtube_quiz.py -q
Agent 级别验证:
- 启动复习流程,确认反馈为纯文本、简洁,并且在显示下一张卡片前始终包含正确答案
- 运行 YouTube 测验流程,确认每道题在显示下一题之前都收到可见的反馈