Textbook Learning (书本知识吸收)
When the user feeds you a textbook, book, or study material, absorb its knowledge thoroughly and make it available for downstream tasks in the current session.
When to Use
- User says "投喂" (feed), "学习这本书", "吸收知识", or sends a PDF/EPUB for systematic study
- User sends course materials and expects you to understand them for future questions
- User asks you to "read and absorb" a textbook before working on related problems
Workflow
Step 1: Deep Read
Use pdf-deep-reading skill for the extraction pass. Get the full content — every chapter, every section. Don't skim.
Special case — large EPUBs with many short chapters (e.g., video-tutorial-style books): When an EPUB has 200+ chapters (each covering one video/section), bulk-extract first:
1. Use ebooklib + BeautifulSoup to dump all chapter text to a JSON file (/tmp/ctf_full/chapters.json)
2. Build a part/chapter index to understand the book structure (chapter titles → major parts)
3. Do NOT try to read every chapter individually — group by part, then read the key technical chapters (the ones with substantive content, not just section separators)
4. Chapters with auto-generated titles like chapter3 (<h1> missing) have their title embedded in the first line of the text body (e.g., "1.1 Burp Suite..."). Extract it from there.
Detection: an EPUB with >50 document items where many have identical <title> content is likely a video-tutorial book. Read by part, not by individual short chapter.
Step 2: Structured Knowledge Extraction
Extract and organize knowledge into these categories. Output them to the conversation so both you and the user can refer to them:
A. 核心概念 (Core Concepts)
- Key definitions, terminology, and their precise meanings
- Include page numbers for reference
B. 公式与定理 (Formulas & Theorems)
- Every important formula with variable definitions
- Theorem statements and conditions
- Number them for easy reference: F1, F2, T1, T2...
C. 算法与流程 (Algorithms & Procedures)
- Step-by-step algorithms, encryption/decryption flows, computational procedures
- Pseudo-code or numbered steps
- Label them: A1, A2...
D. 解题模式 (Problem-Solving Patterns)
- Common question types and their solution templates
- Typical pitfalls and edge cases
- How to recognize which approach to use
E. 知识框架 (Knowledge Framework)
- How concepts connect: dependencies, hierarchies, contrasts
- "先学X再学Y" relationships
- Chapter-to-chapter logical flow
Step 3: Knowledge Manifesto
After extraction, produce a compact Knowledge Index (知识索引) that acts as a quick-reference table of contents for the book's knowledge. Format:
## 知识索引:《书名》
### 第一章: 标题
- 概念: C1.1 xxx (p.N), C1.2 xxx (p.M)
- 公式: F1.1 xxx, F1.2 xxx
- 算法: A1.1 xxx
### 第二章: 标题
...
This index lives in the conversation. When the user later asks a question, scan this index to locate the relevant knowledge instantly.
Step 4: Active Recall
When the user asks questions related to the absorbed material:
1. Scan the knowledge index first
2. Cite specific concepts/formulas/algorithms by their labels (e.g., "根据第三章 F3.2...")
3. Show the reasoning from the textbook's framework, not general knowledge
4. If the textbook has a specific approach that differs from the conventional one, use the textbook's approach
Knowledge Retention Strategy
Within a session, the extracted knowledge stays in context. For cross-session tasks:
- The knowledge index itself is compact enough to reference via session_search
- Key frameworks that will be reused (e.g., "密码学中AES的完整加密流程") should be saved as skills when they stabilize
- For exam prep, save study plans via study-plan-creation skill
Pitfalls
-
Don't assume standard conventions — If the textbook uses non-standard notation (e.g.,
MixColuminstead ofMixColumns), use the textbook's version. The exam will too. -
Chinese math notation quirks — Chinese textbooks often use different symbols than English ones. Respect the textbook's notation.
-
Scanned PDFs — vision-based extraction workflow — Many of the user's textbooks are scanned (no text layer). Detection:
page.get_text()returns empty string, orlen(page.get_text('blocks')) == 0. Workflow for scanned PDFs:
- (a) Use PyMuPDFdoc.get_toc()to extract embedded TOC metadata (this works even on scanned pages).
- (b) Extract key pages as high-res PNG images:page.get_pixmap(dpi=300)thenpix.save(). Key pages = chapter start pages from TOC, TOC pages themselves.
- (c) Usevision_analyzeon each saved PNG to OCR the text content.
- (d) Assemble structured notes from the OCR results + known book structure.
- Do NOT trypdftotext,marker-pdf, orpdf-deep-readingfirst on scanned PDFs — they will all fail silently. Check for text layer first (one page is enough). -
Scanned PPTX files — python-pptx + vision workflow — The user's 密码学及其应用 course materials arrive as
.pptxfiles that are essentially scanned images with no editable text. Detection:page.get_text()returns empty on every slide. Workflow:
- (a) Installpython-pptx(pip install python-pptx).
- (b) Loop through each slide: extract text withshape.text(skip empty ones), collect meaningful content.
- (c) If all text is empty (fully scanned): export key slides as high-res images withslide.get_pixmap(dpi=300)→ PyMuPDF can't render PPTX directly, so usepptx.Presentation()+shapes.z_orderapproach, or export via LibreOffice if available. Alternatively: convert PPTX to PDF first with LibreOffice (soffice --headless --convert-to pdf file.pptx), then use PyMuPDF on the resulting PDF.
- (d) Usevision_analyzeon each saved image to OCR the content.
- (e) For large PPTX files (100+ slides), save images topages/subdirectory to avoid memory issues.
- This session: Successfully extracted 8 chapters of 密码学及其应用 PPT (454 total pages across all files) using this approach. -
Don't skip "obvious" chapters — Even introductory chapters contain definitions the exam will test. Extract everything.
-
Stay in the textbook's mental model — When answering questions, think like the textbook author, not like a generic AI. The grading rubric follows the textbook's framework.
-
Output file format — User prefers
.jsonfor structured data files (question banks, etc.). Do not use.hjsonunless explicitly asked. When delivering structured data as a file, use.jsonextension. -
Video-tutorial chapters may lack h1/h2 — Chinese CTF/practical books rewritten from video series often have 200+ chapter files with auto-generated
<title>tags. The actual section number and title (e.g., "1.1 Burp Suite") appears in the body text as the first meaningful line. When BeautifulSoup fails to find h1/h2, extract the first non-empty text line that looks like a section header (starts with a digit followed by a period). -
Chunk EPUB by part before question generation — For multi-part books (6 parts × 50 chapters each), generate questions part-by-part using
delegate_taskin parallel, then merge. Each subagent gets one part's text file as context, avoiding context window overflow.
Step 5: Question Bank Generation (题库生成)
When the user asks to generate a question bank from absorbed knowledge:
-
Parse format requirements — The user has a standardized JSON schema for questions. Read back the format spec from the conversation if provided. Key fields: id, content, options, answer, explanation, type, difficulty, source, nodes, formulas, siblings.
-
Type mapping — true_false (options=["对","错"]), single_choice (answer like "A"), multi_choice (answer like "BCD", letters ordered alphabetically).
-
ID convention — Use a subject abbreviation (e.g.,
llmpefor this book), chapter-based nodes (ch0for preface/intro,ch1-chNfor chapters,tffor standalone true/false). Sequential numbering zero-padded to 3 digits. -
Difficulty calibration — Basic concepts → 2, understanding/application → 3, comprehensive analysis → 4.
-
Coverage — Generate questions evenly across all chapters. Include both single-choice and true/false types. Each question must have an explanation citing specific book content.
-
Output format — Save as
.json(not.hjsonunless explicitly asked). User prefers standard JSON. Output the JSON inline without markdown code block wrapping unless the user asks for a file.
Integration with Other Skills
| User Intent | Skill Chain |
|---|---|
| Feed textbook → study later | textbook-learning → study-plan-creation |
| Feed textbook → do lab | textbook-learning → lab-assignment-implementation |
| Feed textbook → exam prep | textbook-learning → knowledge index → Q&A |
| Feed PDF → deep analysis | pdf-deep-reading → textbook-learning |
| Feed practice exam book → question bank | textbook-learning → question-bank-formatter |
Handling Practice Exam Books
When the user feeds a practice exam book (e.g., CISA Practice Exams, CISSP questions), the "knowledge" is structured as Q&A pairs, not conceptual chapters. In this case:
- Still do a deep read to understand the domain structure and question distribution
- Produce a compact domain overview with key concepts (the A/B/D/E categories still apply in condensed form)
- Skip the full knowledge index — instead chain directly to
question-bank-formatterfor structured JSON output - Note the domain-to-chapter mapping (exam books often reorder chapters vs. domain numbers)
| Feed PDF → deep analysis |pdf-deep-reading→textbook-learning|
Example
User: "投喂《现代密码学》杨波第4版"
Response flow:
1. Load pdf-deep-reading, extract all content
2. Output structured knowledge (概念/公式/算法/解题模式/框架) per chapter
3. Output compact knowledge index
4. "知识已吸收,可以开始提问或做实验"