agentleFS
adamaiken89adamaiken89/learn-something/AGENTS.md

learn-something

AGENTS.md6 starsChanged 3 months agoMITView on GitHub

Code/file conventions live in CONVENTIONS.md — formatting, naming, failure philosophy, test patterns, workflow checklist. Read it before editing; keep it in sync when conventions change. Contains Part A (instruction) + Part B (schema contract): Pedagogy, Content Structure, Content Creation Protocol, Study Protocol, CLI, Cost Model, Integration, Trigger Behavior, Quality Rules, Schema Reference. Learner-facing subset of SKILL.md Part A5. Keep in sync — this is the quick reference learners use during study sessions. Thin bash wrapper (9 lines). Delegates all logic…

  • Deletes or force-pushes
  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

9 rules. About 0 are common, 1 is distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep time budgets: Every module ≤ 1.5h (hard cap, all levels.

    line 158
  2. Very specific:

    CLI: Add cmd_<name>(topic: str, ...) in learn.py, register via app.command('name')(cmd_name) (typer).

    line 167
  3. Very specific:

    Docs: Update SKILL.md Part A6 (CLI) and AGENTS.md CLI table.

    line 168
  4. Very specific:

    Study flow: If affected, update SKILL.md Part A5 + study-protocol.md.

    line 169
  5. Very specific:

    Content flow: If affected, update SKILL.md Part A3/A4.

    line 170
  6. Very specific:

    Cost: If it adds API calls, verify < $0.10/course (SKILL.md A7).

    line 171
  7. Very specific:

    Schema: If new data type, add JSON Schema to learn-something-schema/schemas/, TypeScript type to types/, validator to …

    line 172
  8. Very specific:

    Tests: Add 2+ tests in tests/test_learn.py (happy path + error case).

    line 173
  9. Very specific:

    Quality gate: If adding/removing a quality check, update _quality_checks() in learn.py + SKILL.md Part B5 table + content-verify.md.

    line 174

≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Learn Something — Agent Modification Guide

Code/file conventions live in CONVENTIONS.md — formatting, naming, failure philosophy, test patterns, workflow checklist. Read it before editing; keep it in sync when conventions change.

Skill Structure

learn-something/
├── SKILL.md           # Frontmatter metadata + main instruction body
├── study-protocol.md  # Learner-facing protocol reference
├── README.md          # General documentation
├── LICENSE            # MIT
├── AGENTS.md          # This file — agent modification guide
├── learn-something-schema/  # Shared JSON schemas (Phase 1)
│   ├── package.json
│   ├── schemas/       # JSON Schema files (deck, card, quiz, question, cloze_question, cloze_quiz, cumulative_question, cumulative_quiz, syllabus, stats, feedback)
│   ├── types/         # TypeScript type definitions
│   └── validate/      # Python + TypeScript validators
├── scripts/
│   ├── learn.sh       # Thin bash wrapper → delegates to learn.py
│   ├── learn.py       # Python CLI (FSRS, quiz engine, all commands)
│   ├── fsrs.py         # FSRS-6 algorithm (replaces FSRS-5/SM-2)
│   ├── quality.py     # Quality-gate checks (rules 1-17 + statistical) used by validate
│   ├── enrich.py      # LLM-based lesson enrichment (cloze/predict/error/diagram/mindmap)
│   ├── render_diagrams.py  # Mermaid → PNG renderer (mmdc CLI or mermaid.ink API) + shared render_source()
│   ├── migrate_courses.py  # Normalize legacy/invalid course YAML to canonical shapes (idempotent, --apply)
│   ├── mermaidcheck.py # Shared mmdc validator (fail-fast; NO regex fallback) + safe_mode advisory lint
│   ├── checksyntax.py  # Generation-stage lesson.md lint: fences, mermaid (mmdc), code blocks
│   ├── quizbalance.py  # Generation-stage quiz.yaml answer re-lettering (balanced sheets)
│   ├── epub.py        # EPUB 3 generator (zero-dep + optional extras)
│   └── pdf.py         # PDF generator (zero-dep + optional engines)
└── tests/
    ├── run.sh         # Test runner
    ├── test_learn.py  # CLI tests
    ├── test_fsrs.py   # FSRS algorithm tests
    ├── test_epub.py   # EPUB generator tests
    └── test_workstreams.py  # quizbalance / mermaidcheck / doctor-internals tests
└── templates/
    ├── syllabus.yaml  # 20-module course skeleton
    ├── module.md      # Lesson structure (concrete-first, cloze/predict/error/diagram/mindmap)
    ├── quiz.yaml      # MCQ template (4 options, difficulty 1-3)
    └── cloze.yaml     # Cloze template (fill-in-blank, difficulty 1-3)

Key Modification Points

SKILL.md frontmatter

---
name: learn-something
description: >
  Structured learning framework...
  Trigger: "I want to learn [topic]", ...
---
  • name: must match directory name (learn-something)
  • description: first sentence is summary. Remaining lines = trigger phrases.
  • Trigger phrases: space-separated quotes. Each trigger activates skill.

SKILL.md body

Contains Part A (instruction) + Part B (schema contract): Pedagogy, Content Structure, Content Creation Protocol, Study Protocol, CLI, Cost Model, Integration, Trigger Behavior, Quality Rules, Schema Reference.

  • Part A3/A4 (Content Creation Protocol): defines LLM behavior during course creation. Modify if changing AI creation flow. Includes 17 content quality rules now: concrete-first, cloze, predict, error-spotting, dual coding, mindmap, module size cap, human-readable title, etc.
  • Part A5 (Study Protocol): defines session types and FSRS rules. Mirror changes into study-protocol.md.
  • Part A6 (Trigger Behavior): defines first-response behavior. Modify if changing entry flow.

study-protocol.md

Learner-facing subset of SKILL.md Part A5. Keep in sync — this is the quick reference learners use during study sessions.

scripts/learn.sh

Thin bash wrapper (9 lines). Delegates all logic to learn.py.

scripts/learn.py

Python CLI. Key subsystems:

FunctionPurpose
fsrs_update()FSRS-6 algorithm: stability, difficulty, lapses, state, algorithm_version, desired_retention, learning_step. 4-level rating (1-4). States: New/Learning/Review/Relearning.
cmd_initCreate subject directory, copy syllabus template. Flags: `--depth surveystandarddeep, --pretest`
cmd_startShow subject overview + module list
cmd_create_moduleCreate module from template. Flag: --name. module_id must match NN-name (e.g., 01-intro)
cmd_create_clozeCreate cloze.yaml from template for a module
cmd_quizParse YAML, shuffle, display MCQs, update SRS deck. Flags: --adaptive, --weak-only
cmd_clozeCloze (fill-in-blank) quiz. Parse cloze.yaml, display prompts, update SRS deck. Flags: --adaptive, --weak-only
cmd_cumulative_quizCross-module quiz: 8-10 questions (MCQ/cloze/T/F). Flag: --modules X-Y
cmd_explainFeynman technique prompt with gap detection guide
cmd_reviewFSRS review: due cards, scoring, interval calc
cmd_blurtingBrain-dump before review. Compares user recall to lesson key terms
cmd_enrichAdd cloze/predict/error/diagram/mindmap/cloze-quiz enrichments to existing lessons via LLM. Flags: --types, --dry-run, `--render-mode apilocaloff`
cmd_fsrs_predictShow avg stability, difficulty, retention per topic
cmd_statsCard counts, due today, mastery rate, avg ease, session history
cmd_exportExport deck to CSV for Anki import
cmd_rateRate module clarity (1-5 stars), save to feedback.json. Flag: --comment
cmd_flagReport content error (wrong/outdated/confusing). Flag: --detail
cmd_feedbackAggregate feedback: avg ratings, flag counts, suggest modules
cmd_analyticsRetention analytics: mastery breakdown, session history, weak modules
cmd_forecastForgetting forecast: cards due now/week/month
cmd_study_planOptimal study session: due + weak cards, skip mastered
cmd_epubGenerate EPUB book from all modules + quizzes. Flags: --mermaid, --description
cmd_epub_regenRegenerate EPUB from cached book.md. Flags: --mermaid, --description
cmd_epub_verifyValidate EPUB structure
cmd_epub_list_themesList available EPUB themes
cmd_pdfGenerate PDF from all modules + quizzes. Flags: --engine, --title, --author
cmd_pdf_regenRegenerate PDF from cached book.md. Flags: --engine, --title, --author
cmd_syncExport deck to Reader directory (~/.coursereader/subjects/). Flag: --reader-path
cmd_sync_pullImport deck from Reader directory. Flag: --reader-path
cmd_validateFull quality gate: Pass 1 _schema_errors (deck/quiz/cloze/cumulative/syllabus/feedback vs JSON Schema + module dir naming), Pass 2 _content_syntax_errors (markdown + mermaid via mmdc — hard prerequisite, no fallback), Pass 3-4 _quality_checks (rules 15-17 + statistical). Rule 15 (mindmap) ERR; rule 16 (size) and rule 17 (H1 title) WARN-only — threshold via --max-chars N (default 12,000), time budget is the real cap. Exit 1 on any ERR
cmd_render_diagramsRender ```mermaid blocks in lesson.md to PNG. Flags: `--render-mode apilocal, --scale N`
cmd_mindmapGenerate/regenerate Mermaid mindmap for a module via LLM (auto-runs basic mermaid check after write)
cmd_balance_quizGeneration-stage: re-letter quiz.yaml answer positions to balanced no-3-run spread. Deterministic per topic-module (idempotent), backup .bak. Flags: none
cmd_checksyntaxGeneration-stage: lint a module's lesson.md — fence balance, mermaid blocks (shared mermaidcheck.py), code blocks via interpreters (python3 py_compile / node --check / bash -n). Flag: `--render apilocaloff` (smoke render)

FSRS-6 Algorithm (fsrs_update())

  • Replaces FSRS-5. Uses 19-parameter model from py-fsrs v6.
  • Quality mapping: 0-2→Again(1), 3→Hard(2), 4-5→Good(3); explicit rating arg (1-4) takes precedence.
  • Initial stability S0 = W[rating-1], difficulty D0 = W[4] - exp(W[5] * (rating - 3)) + 1
  • Retrievability: R = (1 + FACTOR * t / S) ^ DECAY
  • Short-term (elapsed < 1d) vs long-term (elapsed >= 1d) stability updates
  • Per-card desired_retention (default 0.9) drives interval via t = S/factor * (r^(1/decay) - 1)
  • States: New → Learning (Again/Hard) → Review → Relearning (lapse) → Review
  • Old SM-2 and FSRS-5 cards auto-migrate via _migrate_card() (lazy, on first update)
  • See fsrs.py for full parameter constants W[0..18] and DECAY = -W[17]

Quiz Engine (cmd_quiz)

  • Uses Python3 with yaml library.
  • Options shuffled per question, keys remapped (A-D → a-d).
  • Each quiz attempt updates SRS deck with FSRS-6 intervals.
  • Falls back to raw display if yaml unavailable.
  • Adaptive mode: weighted by ease, difficulty ramp, streak skip.

templates/

TemplatePurposeKey constraints
syllabus.yaml20-module default skeletontime_hours per module ≤ 1.5 (hard cap, all levels), prerequisites form DAG. Level → module count: beginner ~25-30 (0.5-0.75h each), intermediate ~15-20 (1-1.5h), advanced ~20-30 (1-1.5h, open questions)
module.mdLesson structureMust include: Real-World Example → Core Content (with Think, Cloze, Predict, Mermaid per section) → Why This Matters → Key Takeaways → Common Misconception → Spot the Mistake → Feynman Explain → Reframe → Drill
quiz.yamlMCQ format4 options, 1 correct, difficulty 1-3, tags per category
glossary.mdCourse term tableColumns: Term / Canonical / Avoid / Definition / Appears. Spec: SKILL.md A4.2. Not schema-validated — checked via content-verify checklist

Content Quality Rules

The 17 content quality rules are the single source of truth in SKILL.md → Part A4 (with automated checks). Do NOT duplicate the rule table here — if rules change, edit SKILL.md only.

Modification Rules

  1. Keep pedagogy alignment: Any new feature must fit Marva Collins (rigor/repetition), Feynman (explain-simply), or Desirable Difficulties (spacing/interleaving). Tag new features with which theory they serve.
  2. Keep cost model: Powered by DeepSeek V4 Flash. Content creation stays ~$0.10/course max. Study sessions stay $0.
  3. Keep time budgets: Every module ≤ 1.5h (hard cap, all levels; depth via more modules + open questions). Subject ≤ 40h guideline (deep courses may exceed; schema allows 200h).
  4. Keep FSRS-6 correct: Stability/difficulty formulas match py-fsrs v6. 19 params, 4-level rating, DECAY = -W[17]. Do not change W parameters without testing against known FSRS implementations.
  5. Keep trigger behavior: On trigger, enter content creation mode immediately — never generate full course in one shot unless user explicitly asks.
  6. Keep template constraints: MCQ = exactly 4 options, 1 correct. Module must include Feynman + Reframe sections.
  7. Keep sync: Changes to study protocol in SKILL.md must be mirrored in study-protocol.md. Changes to deck schema must sync between CLI and Reader.
  8. Keep backward compat: CLI flags and file structure (syllabus.yaml, modules/NN-name/lesson.md, modules/NN-name/quiz.yaml, srs/deck.json) are public API. Breaking changes need migration path.

Adding Features

  1. CLI: Add cmd_<name>(topic: str, ...) in learn.py, register via app.command('name')(cmd_name) (typer).
  2. Docs: Update SKILL.md Part A6 (CLI) and AGENTS.md CLI table.
  3. Study flow: If affected, update SKILL.md Part A5 + study-protocol.md.
  4. Content flow: If affected, update SKILL.md Part A3/A4.
  5. Cost: If it adds API calls, verify < $0.10/course (SKILL.md A7).
  6. Schema: If new data type, add JSON Schema to learn-something-schema/schemas/, TypeScript type to types/, validator to validate/python/validate.py.
  7. Tests: Add 2+ tests in tests/test_learn.py (happy path + error case).
  8. Quality gate: If adding/removing a quality check, update _quality_checks() in learn.py + SKILL.md Part B5 table + content-verify.md.

Testing

# Lint first (gate — runs automatically at the top of tests/run.sh)
ruff check --output-format=concise scripts/ tests/

# Create test directory
mkdir test-course && cd test-course

# Initialize
../scripts/learn.sh init python

# Create test module
../scripts/learn.sh create-module python 01-intro

# Run quiz
../scripts/learn.sh quiz python 01-intro

# Run review
../scripts/learn.sh review python

# Check stats (includes session history)
../scripts/learn.sh stats python

# Export to Anki CSV
../scripts/learn.sh export python

# Test diagram rendering
../scripts/learn.sh enrich python 01-intro --types diagram --render-mode off
../scripts/learn.sh render-diagrams python 01-intro --render-mode api

# Cleanup
cd .. && rm -rf test-course

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.