跳到主要內容

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 子命令。該腳本處理原子寫入(寫入臨時文件,然後重命名)以防止損壞。

該文件在首次使用時自動創建。

流程

從事實創建卡片

激活規則

並非每個事實陳述都應成為抽認卡。使用此三層檢查:

  1. 明確意圖 — 用戶提及“memento”、“flashcard”、“remember this”、“save this card”、“add a card”或類似明確表示請求抽認卡的措辭 → 直接創建卡片,無需確認。
  2. 隱含意圖 — 用戶發送事實陳述但未提及抽認卡(例如,“光速是 299,792 km/s”) → 先詢問:“要我將其保存為 Memento 抽認卡嗎?”僅在用戶確認後創建卡片。
  3. 無意圖 — 消息是編碼任務、問題、指令、正常對話或任何明顯不是要記憶的事實 → 完全不激活此技能。讓其他技能或默認行為處理它。

當確認激活時(第 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 以確認已創建的卡片。

手動創建卡片

當用戶明確要求創建抽認卡時,向他們詢問:

  1. 問題(卡片正面)
  2. 答案(卡片背面)
  3. 集合名稱(可選 — 默認為 "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")

下一個問題:誰是第一個登上月球的人?

規則:

  1. 僅顯示問題。等待用戶回答。
  2. 收到答案後,將其與預期答案進行比較並評分:
    • correct → 用戶答對了關鍵事實(即使措辭不同)
    • partial → 方向正確但缺少核心細節
    • incorrect → 錯誤或偏離主題
  3. 你必須告知用戶正確答案以及他們的表現。 保持簡短並使用純文本。使用以下格式:
    • 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."
  4. 然後調用 rate 命令:correct→easy, partial→good, incorrect→hard。
  5. 然後顯示下一個問題。
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

間隔重複算法

評級決定下一次複習間隔:

RatingIntervalease_streakStatus change
hard+1 dayreset to 0stays learning
good+3 daysreset to 0stays learning
easy+7 days+1if ease_streak >= 3 → retired
retirepermanentreset 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 個項目,每個項目都有非空的 questionanswer 字符串。如果驗證失敗,重試一次。

步驟 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: 使用相同的自由文本評分流程逐一呈現問題:

  1. 顯示“Question 1/5: ...”並等待用戶回答。切勿包含答案或任何暗示將揭示答案的內容。
  2. 等待用戶用自己的話回答
  3. 使用評分提示對用戶的答案進行評分(參見“複習到期卡片”部分)
  4. 重要提示:在執行其他操作之前,你必須向用戶回覆反饋。 顯示評分、正確答案以及卡片下次到期的時間。不要靜默跳轉到下一個問題。保持簡短並使用純文本。示例:“Not quite. Answer: {answer}. Next review tomorrow.”
  5. 顯示反饋後,調用 rate 命令,然後在同一條消息中顯示下一個問題:
python3 ~/.hermes/skills/productivity/memento-flashcards/scripts/memento_cards.py rate \
--id CARD_ID --rating easy --user-answer "what the user said"
  1. 重複。每個答案在下一個問題出現之前都必須收到可見的反饋。

導出/導入 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=IDyoutu.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 測驗流程,確認每道題在顯示下一題之前都收到可見的反饋