Knowledge Base Indexer
You are indexing lecture notes from a CS 395T (Continuous Algorithms) assignment into a persistent knowledge base of theorems, definitions, and lemmas.
The target assignment folder is: $ARGUMENTS
PHASE 1: Validation
- Verify that
$ARGUMENTS/notes/ exists and contains .pdf files. If not, stop and tell the user.
- Create the
knowledge_base/ directory at the project root if it does not exist.
- List all existing YAML files in
knowledge_base/ so you know what's already indexed.
PHASE 2: Index New Notes
For each PDF file in $ARGUMENTS/notes/:
- Derive the YAML filename:
knowledge_base/<pdf-filename-without-extension>.yaml
- Check if this YAML file already exists. If it does, skip this PDF and tell the user it's already indexed.
- If not indexed yet, read the PDF using the Read tool. For PDFs longer than 10 pages, read in chunks using the
pages parameter.
- Extract ALL of the following into structured YAML:
- Definitions (with number and full statement)
- Theorems (with number, name if any, full statement, and proof sketch if short)
- Lemmas (with number, name if any, full statement)
- Corollaries (with number and full statement)
- Propositions (with number and full statement)
- Key remarks (only if they state a useful result)
- Key intermediate results within proofs — if a proof contains a numbered equation, a named intermediate claim, or a step that is independently useful, capture it in
proof_notes.
- Write the YAML file following this schema:
source: "filename.pdf"
lecture_number: 5
title: "Lecture title extracted from PDF"
items:
- type: theorem # theorem | lemma | definition | corollary | proposition | remark
number: "5.1" # numbering as it appears in the notes
name: "Named theorem" # if the theorem has a name, otherwise empty string
statement: |
Full mathematical statement in plain text with LaTeX math notation
context: "Brief note on when/how this result is typically used"
proof_notes: # optional — omit if the proof has no citable internals
- label: "(3)" # equation/line label as it appears in the notes (e.g. "(3)", "Line 4", "Claim 1")
content: |
The exact equation or claim in LaTeX math notation
description: "What this equation/step establishes and when it is useful to cite directly"
Populate proof_notes whenever:
- The proof contains a numbered or labeled equation that could be reused independently
- The proof establishes an intermediate claim or inequality that is stronger or more specific than the theorem statement itself
- A specific line or step is the crux of the argument and could be invoked directly in another proof
PHASE 3: Report
Tell the user:
- How many PDFs were found in
$ARGUMENTS/notes/
- How many were newly indexed vs. already indexed
- Total number of items extracted (theorems, definitions, lemmas, etc.) from newly indexed PDFs
- Where the YAML files were saved
1---2name: learn-243description: Index lecture note PDFs into the knowledge base4---5
6# Knowledge Base Indexer
7
8You are indexing lecture notes from a CS 395T (Continuous Algorithms) assignment into a persistent knowledge base of theorems, definitions, and lemmas.
9
10The target assignment folder is: `$ARGUMENTS`
11
12---
13
14## PHASE 1: Validation
15
161. Verify that `$ARGUMENTS/notes/` exists and contains `.pdf` files. If not, stop and tell the user.
172. Create the `knowledge_base/` directory at the project root if it does not exist.
183. List all existing YAML files in `knowledge_base/` so you know what's already indexed.
19
20---
21
22## PHASE 2: Index New Notes
23
24For each PDF file in `$ARGUMENTS/notes/`:
25
261. Derive the YAML filename: `knowledge_base/<pdf-filename-without-extension>.yaml`
272. Check if this YAML file already exists. If it does, skip this PDF and tell the user it's already indexed.
283. If not indexed yet, read the PDF using the Read tool. For PDFs longer than 10 pages, read in chunks using the `pages` parameter.
294. Extract ALL of the following into structured YAML:
30 - **Definitions** (with number and full statement)
31 - **Theorems** (with number, name if any, full statement, and proof sketch if short)
32 - **Lemmas** (with number, name if any, full statement)
33 - **Corollaries** (with number and full statement)
34 - **Propositions** (with number and full statement)
35 - **Key remarks** (only if they state a useful result)
36 - **Key intermediate results within proofs** — if a proof contains a numbered equation, a named intermediate claim, or a step that is independently useful, capture it in `proof_notes`.
375. Write the YAML file following this schema:
38
39```yaml
40source: "filename.pdf"
41lecture_number: 5
42title: "Lecture title extracted from PDF"
43items:
44 - type: theorem # theorem | lemma | definition | corollary | proposition | remark
45 number: "5.1" # numbering as it appears in the notes
46 name: "Named theorem" # if the theorem has a name, otherwise empty string
47 statement: |
48 Full mathematical statement in plain text with LaTeX math notation
49 context: "Brief note on when/how this result is typically used"
50 proof_notes: # optional — omit if the proof has no citable internals
51 - label: "(3)" # equation/line label as it appears in the notes (e.g. "(3)", "Line 4", "Claim 1")
52 content: |
53 The exact equation or claim in LaTeX math notation
54 description: "What this equation/step establishes and when it is useful to cite directly"
55```
56
57Populate `proof_notes` whenever:
58- The proof contains a numbered or labeled equation that could be reused independently
59- The proof establishes an intermediate claim or inequality that is stronger or more specific than the theorem statement itself
60- A specific line or step is the crux of the argument and could be invoked directly in another proof
61
62---
63
64## PHASE 3: Report
65
66Tell the user:
67- How many PDFs were found in `$ARGUMENTS/notes/`
68- How many were newly indexed vs. already indexed
69- Total number of items extracted (theorems, definitions, lemmas, etc.) from newly indexed PDFs
70- Where the YAML files were saved