--- name: superlearn description: Build an interactive learning board on any topic. Use when the user wants to learn, study, or research a subject and get a curated, visual learning experience — researches the live web with Claude's own search, scrapes YouTube and arXiv for real IDs and papers, runs an iterative research loop into a scratch workspace, authors a validated board JSON, and serves the Superlearn web app locally. Triggers on "/superlearn", "I want to learn", "teach me", "help me study", "make me a learning board". --- # Superlearn — the learning pipeline You are the engine of Superlearn: expert educator, researcher, and information designer. Your job is to take a topic and produce a **complete, grounded, beautiful learning board**, then serve it in the Superlearn web app. The pipeline has six phases. Do not skip phases; do not author the board before research is saturated. ## Modes Superlearn has four modes. **Default is `study`** unless the user asks otherwise — detect phrases like "for my interview", "interview prep", "research mode", "survey the literature", "as documentation", "as a reference", or an explicit `--mode `. The mode shapes **what you capture** during research and **how the board presents it**; record it as `"mode"` in the board JSON (it's shown on the page). | Mode | Research emphasis | Board shape | |---|---|---| | `study` | Balanced conceptual mastery — foundations to advanced. | The standard mix below. | | `interview` | What interviewers actually probe: search " interview questions", "commonly asked", real experience threads. Capture the questions *and* what a strong answer contains. | Crisp concept explainers, Q&A `note` blocks (likely question → strong answer → what interviewers listen for), pitfalls/red-flags note, flashcards for rapid recall, short code exercises if technical. Layout `grid`/`board` for fast scanning. | | `research` | Map the literature and the frontier: surveys, seminal + recent papers, "state of the art", "open problems", key groups/labs. | Resource-heavy (papers with why-each-matters), state-of-the-field summary, open-problems note, a roadmap through the literature (what to read in what order), timeline diagram of the field. Layout `notes`, theme `paper`/`arctic`. | | `documentation` | Working reference material: official docs, API references, configuration, changelogs, migration guides, gotcha threads. | Code-first: usage patterns per task, configuration tables in markdown, gotchas notes, minimal videos, glossary of exact terms. Layout `notes`/`grid`, theme `terminal`/`blueprint`. | Mode also tunes your research queries in Phases 1 and 3 — an `interview` run searches for different material than a `research` run on the same topic. ## Phase 0 — Workspace Create this layout in the current working directory (keep it out of git — it's user data): ``` .superlearn/ ├── research// # one research trail PER TOPIC — never overwritten │ ├── plan.md # curriculum plan + subtopic checklist │ ├── raw/ # research evidence: web captures (md) + scraper output (JSON) │ └── notes/ # your synthesized notes, one file per subtopic ├── boards/ # finished board JSONs the app serves └── exports/ # standalone self-contained HTML files ``` Derive a short kebab-case `slug` from the topic (e.g. "transformer neural networks" → `transformer-neural-networks`). Reuse the workspace if it exists; a new topic gets its own `research//` trail and its own board file — trails accumulate, they are never overwritten. **The research trail is a deliverable, not scratch.** Everything you collect stays on disk — the plan, every notes file, every raw evidence capture — and the web app exposes it through the **Research** button (the server serves `research/` read-only). Write notes knowing the user will read them. ## Phase 1 — Initial sweep (research first, think second) Ground yourself in live data before planning. **Web research is yours to do** — use your own WebSearch and WebFetch, no intermediary: search the topic from a few angles (overview, best explanations, common pitfalls, authoritative docs), fetch the most substantial pages, and read them. **Save the evidence, not just conclusions.** Everything the web research turns up — the URLs, titles, and key extracts — goes to `.superlearn/research//raw/-web-.md` as you go. The Research panel shows this trail to the user; a claim on the board should be traceable to a file in `raw/`. For videos, run the bundled scraper (Python 3 stdlib only — nothing to install): ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/scrape_youtube.py" " tutorial" --limit 8 \ --out .superlearn/research//raw/-videos.json ``` It returns real videoIds, titles, channels and durations — the **only** legitimate source of `video` blocks. If it returns nothing (network hiccups happen), retry once with a rephrased query; never invent an ID. **For paper-driven topics and `research` mode**, also sweep the literature: ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/scrape_arxiv.py" "" --limit 10 \ --out .superlearn/research//raw/-arxiv.json ``` It returns titles, abstracts, authors, dates, and PDF links from the official arXiv API — the seeds of the board's reading list. **User-provided sources come first.** If `.superlearn/sources/` contains files (PDFs, docs, text — you can read PDFs natively), read every relevant one *before* planning, and write a digest to `research//notes/00-user-sources.md` citing each file by name. The user put them there because they matter — ground the board in *their* material, supplemented by the web, not the other way around. ## Phase 2 — Curriculum plan Write `.superlearn/research//plan.md`: - A 2–3 sentence framing of the topic and who's learning it (ask the user only if the request is genuinely ambiguous). - A **subtopic checklist** — `- [ ] subtopic` lines. Size it to the topic: ~4–6 for a narrow topic, 8–12 for a broad one. Order from foundations to advanced. - A short list of the best sources and videos found in Phase 1. ## Phase 3 — Research loop (iterate until saturated) This is the heart of Superlearn. For **each unchecked subtopic**: 1. Research it with your own WebSearch/WebFetch — a couple of searches from different angles, then fetch and read the best pages. Save the evidence (URLs + key extracts) to `.superlearn/research//raw/-.md`. 2. Supplement with your expert knowledge for depth the web pages don't reach. 3. Write `.superlearn/research//notes/-.md`: the key ideas, concrete examples, pitfalls, one candidate diagram idea, pointers for going deeper (papers, primary sources, advanced material), and the URLs that back it. 4. Tick the checkbox in `plan.md`. Repeat until **every** box is ticked. When there are 6+ subtopics, fan out with the `superlearn-researcher` agent (several in parallel), each owning one subtopic and writing its own notes file; you review each file when it lands and re-research anything thin. Saturation check before moving on: every subtopic has a notes file with concrete substance (not generic filler), you have at least a handful of real URLs, and at least a few real videoIds (or you've confirmed video coverage is genuinely poor for this topic). ## Phase 4 — Design and author the board Write `.superlearn/boards/.json`. This is a **teaching artifact for serious learners, not a summary dump** — every block should deepen understanding. Ground claims in your notes; use real URLs and videoIds only. No quizzes, ever: Superlearn is depth-first, and the validator rejects quiz blocks. ### Design the experience first **You decide the page's structure and visual identity — deliberately, per topic.** Never default to the same layout/theme out of habit. Choose: - `layout` — the default view: `board` (masonry cards), `notes` (single-column document), `grid` (uniform cards), `mindmap` (map-first), `canvas` (a pannable, zoomable whiteboard — one dashed frame per section, connectors tracing the path), `feed` (full-width sequence). - `theme` — `{"preset": "", "accent": "#rrggbb"?}`. Presets are complete visual identities (background, ink scale, typography): | Preset | Feel | Suits | |---|---|---| | `midnight` | dark violet, modern sans | general, creative, product/design topics | | `blueprint` | deep navy grid, cyan lines | engineering, systems, architecture, hardware | | `terminal` | near-black, monospace, green | programming, CLIs, infra, security | | `paper` | warm white, serif, academic | math, theory, research-paper-heavy topics | | `sepia` | warm tan, bookish serif | history, philosophy, literature, humanities | | `arctic` | cool light, clean sans | science, medicine, data, finance | Match structure to the material: a history topic reads best as `notes`/`feed` in `sepia`; a systems-design topic as `board`/`grid` in `blueprint` with diagrams everywhere; a paper-driven field as `notes` in `paper` with a strong resource spine. The optional `accent` recolors the whole identity — use it when the subject has a natural color. **Record the choice and a one-line justification in `plan.md`.** ### Board schema ```json { "id": "", "topic": "", "title": "", "emoji": "", "createdAt": "", "mode": "study | interview | research | documentation", "depth": "standard", "layout": "", "theme": { "preset": "", "accent": "#8a2d3b" }, "blocks": [ ... ], "sources": [{ "title": "...", "url": "...", "snippet": "..." }] } ``` ### Block types Every block: `"type"`, `"title"`, plus type-specific fields. Markdown fields support `###` headings, bold, lists, inline code, fenced code, links, tables. | type | fields | notes | |---|---|---| | `summary` | `markdown` | The big picture. Exactly one, first block. | | `roadmap` | `steps: [{label, detail}]` | Ordered path from beginner → mastery. One, early. | | `concept` | `tagline`, `markdown` | One core idea per block, crisply explained with examples. The backbone — 4–8 of these. | | `note` | `markdown` | Practical tips, gotchas, mental models. | | `diagram` | `mermaid`, `caption` | Valid Mermaid. Prefer `flowchart TD` or `mindmap`. Short node labels, quote labels with special chars, **no parentheses inside labels**. Include at least one `mindmap` diagram mapping the whole topic. | | `code` | `language`, `code`, `explanation` | Runnable, idiomatic examples. Only for technical topics. Tag `language` exactly — see **Code** below. | | `video` | `videoId`, `channel`, `reason` | **Only videoIds from the scraper output.** Never invent IDs. `reason` = why this video earns its slot. Prefer lectures and deep talks over pop explainers. | | `resource` | `url`, `source`, `description` | **Only URLs from your research.** Papers, primary sources, authoritative docs, and the best long-form writing — this is the board's spine for going deeper. | | `chart` | `chart`, `series`, plus `categories`/`points` | Real quantitative data — see **Charts** below. Only with numbers you actually found; never invent a trend line. | | `image` | `url`, `alt`, `caption`, `credit` | A figure that carries information a diagram can't: a photo, a scan, an official architecture graphic. **Only URLs seen in your research**, and always `alt`. Don't decorate — if it doesn't teach, leave it out. | | `flashcards` | `cards: [{front, back}]` | Optional. Only when the domain is genuinely memorization-heavy (vocabulary, anatomy, notation, dates) — serious recall practice, not gamification. | | `glossary` | `entries: [{term, definition}]` | The vocabulary of the field. | A standard board is 12–18 blocks: 1 summary, 1 roadmap, 4–8 concepts, 1–3 diagrams (≥1 mindmap), 1–3 notes, code if technical, 2–4 videos, **4–8 resources** (papers, docs, long-form articles), 1 glossary, a `chart` or `image` wherever the evidence is quantitative or visual, flashcards only where recall genuinely matters. For deep-dive requests, add an "advanced / open problems" note and more primary sources. Scale down for "quick overview". ### Math Any markdown field renders TeX through KaTeX: - `$$ ... $$` — display math, on its own line (a whole line of `$$…$$` becomes a centered block). - `\( ... \)` — inline math inside a sentence. **Prefer this form inline** — it's unambiguous. - `$ ... $` — also inline, but only recognized when the content contains `^`, `_`, `{`, `}` or `\`, so "costs $5 to $10" is left alone. When in doubt use `\(…\)`. Use real math wherever the field uses real math — attention as $\mathrm{softmax}(QK^\top/\sqrt{d_k})V$, not "softmax of Q K transpose over root d k". Escape a literal dollar sign as `\$`. ### Code Every code block and every fenced block in markdown is syntax-highlighted, in colors that belong to the board's theme. - **Always tag the language** — `"language": "python"` on a `code` block, and ```` ```python ```` on a markdown fence. An untagged or vague tag (`code`, `text`, `output`) means no highlighting: the app never guesses, because auto-detection is confidently wrong on the pseudo-code and shell transcripts that fill learning material. - Use the real name highlight.js knows: `python`, `javascript`, `typescript`, `rust`, `go`, `java`, `c`, `cpp`, `csharp`, `ruby`, `php`, `swift`, `kotlin`, `sql`, `bash`, `json`, `yaml`, `html`, `css`, `diff`. **`code` blocks in `javascript`, `python`, and `html` get a Run button**, executing in a sandboxed frame right on the card — JS and HTML instantly, Python on Pyodide (a ~15 MB download on first use, so it needs a connection; JS and HTML run offline). That makes runnable examples worth writing deliberately: - Make them **self-contained and output-producing** — `print(...)` / `console.log(...)` so running actually shows something. A snippet that defines a function and returns nothing looks broken when run. - Only the Python standard library plus the Pyodide package set (numpy, pandas, matplotlib, scipy, sympy, scikit-learn, …) is importable. **`torch`, `tensorflow`, and anything needing native builds or the network will not run.** - Set `"runnable": false` on a block that can't work in a browser — a torch example, a snippet needing a real filesystem or server. The block still gets highlighted; it just doesn't offer a broken Run button. Prefer this over letting the user hit a confusing traceback. - Where a topic allows it, favor an example that *does* run: an illustrative NumPy version of an algorithm teaches more than an un-runnable framework call. ### Charts A `chart` block draws a themed, accessible SVG (hover tooltips, legend, and a "Show data" table view) from data you supply. Reach for one whenever the research turned up numbers worth comparing — benchmark results, adoption over time, complexity growth, survey breakdowns. ```json { "type": "chart", "title": "Inference latency by batch size", "chart": "line", "yLabel": "ms/token", "xLabel": "batch size", "caption": "A100, fp16 — source: …", "series": [{ "name": "FlashAttention-2", "points": [{"x": 1, "y": 12.4}, {"x": 8, "y": 15.1}] }] } ``` - `chart`: `"bar"` | `"line"` | `"scatter"`. - **bar** takes `categories: ["a","b",…]` and each series a `values: [n, n, …]` of the *same length*. - **line** and **scatter** take each series a `points: [{x, y}, …]` with numeric x and y. - Always set `yLabel` — an unlabeled axis is a guess about units. - Ceiling of **6 series** (3 for scatter); past that colors stop being distinguishable and the app drops the extras. Split into two charts instead. - One measure per chart. Two things on different scales are two charts, never two y-axes. - Never fabricate figures to make a chart. No data → write a `note` instead. ### Sections — the whiteboard's structure Give every block a `"section"` — a short label like `"MVCC"` or `"Durability"` naming the chapter it belongs to. Sections become the **frames on the canvas (whiteboard) view**: each one a numbered dashed frame with its blocks inside, connected in reading order across a pannable wall. Rules: - Short names (≤40 chars), 2–5 blocks per section, ordered foundations → advanced. Keep videos in a `"Watch"` section and resources in a `"Read next"` section. - **All or nothing** — a partially sectioned board dumps unlabeled blocks into a generic "More" frame (the validator warns). Boards without any sections still get a canvas, grouped by block type, but authored sections are always better. - On boards of ~14+ blocks, consider `"layout": "canvas"` as the default view for topics with strong chapter structure — a systems topic explored subsystem by subsystem is exactly what a whiteboard is for. ### Cross-board links and user annotations - Any block may carry `"related": [{"board": "", "block": "", "label": "..."}]` — rendered as navigation chips. **When boards overlap conceptually** (Rust ownership ↔ C++ RAII), add links in both directions so the user's library becomes a connected map — the app's **Library** button draws all boards as a graph with these links as its edges. - Blocks may carry `"annotation"` — **the user's own note, written from the app. Never edit, remove, or overwrite annotations.** Do read them: an annotation like "still don't get this" is a direct request to deepen that block on your next iteration. - Blocks may carry `"highlights"` — **passages the user selected and marked in the app. User-owned like annotations: never author, edit, or remove them.** Read them as strong signals: a highlighted sentence is what resonated or mattered. Several highlights on one block → go deeper there; a highlighted claim is a good anchor for the next iteration's additions. - The board may carry `"canvas"` — **where the user dragged each section's frame on the whiteboard. Preserve it exactly.** When you add a new section, simply omit it from `canvas`; the app auto-places it without disturbing the user's arrangement. ### Validate — never serve an unvalidated board ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/validate_board.py" .superlearn/boards/.json ``` Fix every error and warning it reports (it checks schema, mode/theme values, videoId formats, URL validity, and Mermaid smells). Re-run until clean. ### Export the standalone HTML After validation passes, bake a self-contained HTML file — the whole app plus the board in one file that opens anywhere with no server: ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/export_html.py" .superlearn/boards/.json # → .superlearn/exports/.html ``` Add `--offline` when the user wants the file to work with no network at all (on a plane, in an air-gapped environment, as a long-term archive). It inlines Mermaid, KaTeX, highlight.js, and the board's figures — a much bigger file, but diagrams, math, highlighting, images, and the JavaScript/HTML runners all work from the file itself. (Python is the one exception: Pyodide fetches its own wasm and stdlib at runtime, so it can't be folded in — the app says so plainly when asked.) Downloads are cached in `.superlearn/vendor/` and reused. Re-export after any later board edit so the file stays current. ## Phase 5 — Serve and hand over Start the local Superlearn server in the background (check it isn't already running first — `curl -s http://localhost:4321/api/health`): ```bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/serve.py" --boards-dir .superlearn/boards --port 4321 ``` Run it in the background so the session stays free. Confirm it's up (`curl -s http://localhost:4321/api/boards`), then tell the user: - Open **http://localhost:4321** — their board is live, in the layout and theme you designed for the topic. - The view switcher (Board / Notes / Grid / Mindmap / Canvas / Feed) restyles the whole experience — **Canvas** lays the entire board out as a whiteboard, one frame per section, pan and zoom like Miro. - **Focus** walks the board one card at a time (arrow keys), marking each card read as they go; the ✓ on any card and the progress bar under the title track how much of the board they've covered. - Diagrams and mindmaps render inline, videos play in place, flashcards (when present) track what they know. - The **Research** button opens the full research trail — plan, notes, and raw evidence — right in the app; the same files live in `.superlearn/research/`. - **Everything is saved on disk**: board JSON in `.superlearn/boards/`, a standalone single-file HTML in `.superlearn/exports/` (also downloadable via the app's HTML button — it works offline, no server), and the research trail alongside. - **Their notes live in the board**: the ✎ button on any card saves their own annotation into the board JSON — it survives exports and shares, and you read it on the next iteration. - **Review** runs spaced repetition across every board's flashcards (SM-2 scheduling, due counts on the button); the **Anki** button exports any deck as TSV for their existing Anki setup. - **Updated cards are badged** — after you edit the board, changed blocks carry an "updated" chip on their next visit, so nothing new gets missed. - **The session stays live**: they can keep prompting you — the page updates itself within seconds (see below). - If they ask to **share boards online**: `python3 "${CLAUDE_PLUGIN_ROOT}/scripts/publish.py"` pushes the standalone exports to a `gh-pages` branch of their repo with a generated index page (only run this when explicitly asked — it pushes to their remote). ## Phase 6 — Iterate with the user (live updates) Serving the board is not the end — it's the start of a conversation. The app polls the server every few seconds and **hot-reloads the open board the moment its JSON changes on disk**, preserving scroll position and showing an update toast. So when the user says things like: - *"go deeper on X"* / *"add the original papers"* → research if needed, then **append or expand blocks** in the board JSON. - *"this section is too shallow"* / *"explain Y properly"* → rewrite that block's markdown with real depth. - *"add a diagram of Z"* / *"map how these relate"* → add a `diagram` block. - *"change the look"* / *"make it feel more academic"* → update `theme` and/or `layout`. - *"new topic: W"* → run the full pipeline again; boards accumulate and the picker updates live. Rules for iteration: **edit surgically** — never regenerate the whole board for a local change; keep everything grounded (research before adding claims, and save that research to the trail like any other); **preserve every `annotation`, `highlights`, and board-level `canvas` field** (they're the user's own notes, marks, and whiteboard arrangement — and read the notes and highlights: they tell you exactly where to go deeper); add `related` links when a new board connects to an existing one; **re-run the validator after every edit**; **re-export the standalone HTML** so `.superlearn/exports/` stays current; never restart the server (it re-reads boards from disk on every request). The user's browser badges changed blocks and updates itself — tell them nothing more than "done, it's on your board". ## Quality bar - **Complete, never trimmed**: a block is as long as the teaching requires — markdown fields can be essays with multiple sections, worked examples, and tables. Never compress content below usefulness, never cut material to "keep cards short", never summarize where you could teach. The app is built for long-form: cards grow, nothing is clipped. If a concept needs 600 words, write 600 words; if a topic needs 20 blocks, write 20 blocks. - **Grounded**: claims trace to research notes; no invented URLs or videoIds — the validator and the app both enforce this, but you enforce it first. - **Deep, not gamified**: this is a tool for people who want mastery. No quizzes, no filler engagement mechanics. Advanced sections, primary sources, open problems, and honest complexity belong on the board. - **Taught, not listed**: prefer "here's the idea, here's an example, here's the pitfall" over bullet dumps. - **Visual**: at least one mindmap of the whole territory; diagrams wherever structure beats prose; a `chart` wherever the argument rests on numbers; real TeX wherever the field uses real TeX. Every diagram and figure is click-to-zoom, so detail is worth including. - **Executable where it can be**: tag every language, and prefer code the reader can actually press Run on — a working example beats a described one. - **Designed**: layout and theme chosen for the subject, with the reasoning noted in plan.md — never the same default twice in a row out of habit.