Transform articles, pasted text, local Markdown/TXT files, or PDF documents
into structured knowledge cards for efficient review and self-testing. Each
card isolates a single knowledge point with enough context to understand and
recall it independently.
When to Use
User pastes an article and asks to generate knowledge cards
User provides a local .md, .txt, or .pdf file path for card generation
User explicitly requests "knowledge cards", "study cards", or "flashcards"
from text content
User wants to review key points from a long-form article or PDF document
in a card format
Limitations
The following are NOT supported and should be declined with a clear explanation:
Web scraping: Do not fetch URLs or scrape web pages. If a URL is provided,
ask the user to paste the article text instead.
Scanned PDFs: If a PDF contains only scanned images (no embedded text),
extraction will fail. Ask the user to run OCR first and provide the text.
Encrypted PDFs: If a PDF is password-protected, ask the user to decrypt
it first.
Anki export: Do not generate .apkg files or Anki-compatible formats.
Graphical UI: Do not render cards as images or interactive interfaces.
Output is plain Markdown text only.
Dependencies
PDF text extraction requires the pypdf Python library. Install it before
using the PDF feature:
If pypdf is not installed and the user provides a PDF, inform them of the
dependency and offer to install it, or ask them to paste the text manually.
Workflow
Step 1 — Acquire Source Text
If the user pastes text directly, use it as the source.
If the user provides a local file path:
.md or .txt: Read the file content using the Read tool.
.pdf: Extract text using the bundled script. Run:
text
python scripts/extract_pdf.py "<pdf_file_path>"
The script outputs extracted text to stdout. If the exit code is non-zero,
check stderr for the error message:
Exit code 2: File not found — ask the user to verify the path.
Exit code 3: PDF is encrypted — ask the user to decrypt it first.
Exit code 4: No text extracted — the PDF may be scanned images only.
Ask the user to run OCR and provide the text.
Other formats (.docx, .html, etc.): Not supported. Ask the user
to paste text or provide a .md / .txt / .pdf file.
If the user provides a URL, explain the limitation and ask for pasted text
or a local file.
Step 2 — Analyze Content
Read the full source text carefully before extracting any knowledge points.
Identify the article's main topic and logical structure.
Distinguish between:
Core knowledge: Concepts, principles, definitions, causal relationships,
and methods that are central to the article's purpose.
Supporting detail: Examples, anecdotes, statistics, and background
context that illustrate but do not constitute standalone knowledge.
Filler: Transitional phrases, repetition, and tangential remarks.
Deduplicate: When the same concept appears multiple times, merge into a
single card.
Step 3 — Select Knowledge Points
Extract 5-8 knowledge points from the core knowledge identified in Step 2.
Apply these selection criteria in order of priority:
Importance: Does the point matter to the article's central argument or
learning objective?
Independence: Can the point be understood without reading other cards?
Non-redundancy: Is this point already covered by another card?
If the source contains fewer than 5 distinct important knowledge points,
produce fewer cards. Do not pad with low-value or repetitive content.
If the source contains more than 8 important points, select the 5-8 most
central ones. Briefly note that some points were omitted at the end of the
output.
For very long articles (over 5000 words), still produce at most 8 cards.
Focus on the article's overarching themes and key conclusions rather than
individual section details.
If the user explicitly requests a specific number of cards outside the 5-8
range, honor the request but warn when the requested count exceeds the
available distinct knowledge points.
Step 4 — Build Each Card
For every knowledge point, construct a card with exactly these four fields:
Card Fields
Field
Description
Guidelines
Title
Short phrase naming the knowledge point
Concise noun phrase or concept name (2-8 words); no full sentences
Core Knowledge
One or two sentences stating the key fact or principle
Direct and precise; must be derivable from the source text; no fabricated details
Explanation
2-4 sentences unpacking the knowledge point
Clarify cause, mechanism, context, or nuance; stay faithful to the source; do not introduce external information
Example / Self-Test
Either a concrete example or a self-test question
Priority: (1) if the source provides a relevant example, adapt it as "Example:"; (2) otherwise, write a self-test question whose answer requires recalling the core knowledge, labeled as "Self-Test:". Never invent examples not grounded in the source text.