Content pack format v1
هذا المحتوى غير متوفر بلغتك بعد.
A content pack is a folder of plain files. People can read it, review it, translate it and share it, and AI tools can read it reliably. The schemas are in packages/content/src/schema.ts; content/examples/solar-system is a small complete example.
my-pack/ pack.json what the pack is facts.json every piece of knowledge, with where it came from questions.json questions, each linked to the facts it tests lessons/ optional: lessons that teach the facts u1-l1.json structured lesson u1-l1.md the same lesson, readable (generated) source/ optional: transcribed source pages (made by the pipeline) audio/ optional: each question read aloud, <questionId>.wav (made by `pnpm pipeline audio`, not committed) coverage.json optional: check results (made by the pipeline)The key idea: everything links to facts
Section titled “The key idea: everything links to facts”source page ──► fact ◄── lesson section ▲ └────── question- A fact is one small, self-contained piece of knowledge (“The Sun is a star.”), with the page it came from.
- Every lesson section lists the facts it teaches.
- Every question lists the facts it tests.
So we can prove nothing was lost (every fact is taught and tested), show “learn more” after a wrong answer, and trace any question back to its page.
pack.json
Section titled “pack.json”{ "formatVersion": 1, "id": "example-solar-system", "title": "Example: The Solar System", "language": "en", "subject": "science", "audience": { "grade": 4, "ageRange": "9-10" }, "source": { "title": "Written for this project as a sample", "pageOffset": 0 }, "license": "CC-BY-SA-4.0", "units": [ { "id": "u1", "title": "Our Solar System", "lessons": [{ "id": "u1-l1", "title": "The Sun and its planets", "pages": [1, 1] }] } ]}ids use lowercase letters, digits and dashes. language is a language code such as ar or en.
Making a pack from your own notes
Section titled “Making a pack from your own notes”The source can be a PDF book or your own notes as Markdown or text (.md, .txt). With notes, each ## heading starts a new “page”, and lessons point at those page numbers. Notes without headings are split about every 400 words.
"source": { "title": "My notes", "file": "notes.md" },"units": [{ "id": "u1", "title": "The Water Cycle", "lessons": [ { "id": "u1-l1", "title": "Water on Earth and evaporation", "pages": [1, 2] }, { "id": "u1-l2", "title": "Clouds, rain and the cycle", "pages": [3, 4] }]}]pnpm pipeline all -p path/to/my-pack # read (no AI for notes) → facts → rework → verify → questions → balance → review → audio → checkThe read step needs no AI for notes. The other steps need a free Gemini key in .env. A full example is content/examples/notes-sample.
facts.json
Section titled “facts.json”{ "id": "u1-l1-f01", "unitId": "u1", "lessonId": "u1-l1", "statement": "The Sun is a star.", "kind": "fact", "pages": [1], "importance": "core"}kind: definition, fact, process, function, classification, example, comparison, health-advice, vocabulary. importance: core (a test would ask it) or supporting.
questions.json
Section titled “questions.json”Multiple choice (3–4 choices, exactly one right):
{ "id": "u1-l1-q02", "type": "multiple-choice", "factIds": ["u1-l1-f02"], "prompt": "How many planets move around the Sun?", "choices": ["Six", "Eight", "Ten", "Twelve"], "answerIndex": 1, "explanation": "Eight planets move around the Sun.", "difficulty": 1}True / false:
{ "id": "u1-l1-q01", "type": "true-false", "factIds": ["u1-l1-f01"], "prompt": "The Sun is a star.", "answer": true, "explanation": "Yes! The Sun is a star.", "difficulty": 1}Typed answer (the player writes it; case, vowel marks, أ/إ/ا, ة/ه, “ال”/“the” and one small typo do not matter):
{ "id": "u1-l1-q07", "type": "typed", "factIds": ["u1-l1-f04"], "prompt": "Which planet is the largest? Type its name.", "answers": ["Jupiter"], "explanation": "Jupiter is the largest planet.", "difficulty": 2}Ordering (3–6 items, written in the right order; players see them shuffled):
{ "id": "u1-l1-q08", "type": "ordering", "factIds": ["u1-l1-f03", "u1-l1-f06"], "prompt": "Put these in order, starting closest to the Sun.", "items": ["Mercury", "Earth", "Jupiter"], "explanation": "Mercury is closest, Earth is third, and Jupiter is farther away.", "difficulty": 2}Matching (3–5 pairs; the right side is shuffled):
{ "id": "u1-l1-q09", "type": "matching", "factIds": ["u1-l1-f01", "u1-l1-f04"], "prompt": "Match each one with what it is.", "pairs": [ { "left": "The Sun", "right": "a star" }, { "left": "Jupiter", "right": "the largest planet" }, { "left": "The Moon", "right": "moves around the Earth" } ], "explanation": "…", "difficulty": 2}difficulty: 1 easy, 2 medium, 3 harder.
Not every screen can show every type: a game’s own UI declares the kinds it supports (surface.questionKinds, see PROTOCOL.md), and the hub asks only those. The Hollow Knight mod shows all of them except typed answers (a controller cannot type); the app window shows all.
Writing good questions for players
Section titled “Writing good questions for players”- Short: under 20 words. The player reads it between game moments.
- One clearly right answer; wrong choices should be believable but clearly wrong to someone who learned it.
- No “all of the above” or “none of the above”.
- Explanations teach and are kind. Never make the player feel stupid.
Check a pack
Section titled “Check a pack”pnpm pipeline check --pack content/examples/solar-systemIt validates every file and reports facts that are not taught or not tested.
Questions read aloud
Section titled “Questions read aloud”pnpm pipeline audio --pack <pack folder>Makes audio/<questionId>.wav for every question with Gemini text-to-speech (free tier works; a free key from https://aistudio.google.com/apikey in .env). It reads the prompt, then the numbered choices, so the player hears the same numbers they press. Existing files are skipped, so if the daily limit is reached, run it again the next day. Audio files are not committed: anyone can rebuild them. Voices by language: Arabic packs use Sawtak Arabi when SAWTAK_API_KEY and SAWTAK_VOICE are set; other packs use Gemini (gemini-3.8-flash-tts by default). Optional: GL_TTS_MODEL and GL_VOICE (a Gemini voice such as Charon or Kore) in .env.
Licenses
Section titled “Licenses”Packs we publish use CC BY-SA 4.0. Packs made from copyrighted books stay private in content/private/, which git ignores.