Learn
Start an Atlas learning session.
Start an Atlas learning session.
Optional arguments: $ARGUMENTS
- First argument: filter by topic (e.g., "JavaScript")
- Second argument: number of questions per batch (default: 10)
## Pre-check
1. Check that `knowledge.db` exists:
```bash
test -f knowledge.db && echo "EXISTS" || echo "NOT_EXISTS"
- If doesn't exist, display: "Atlas is not initialized. Run /init first."
Data Loading
- Read
topics.mdto know valid topics - Get statistics from DB:
sqlite3 knowledge.db "SELECT COUNT(*) FROM questions;" sqlite3 knowledge.db "SELECT COUNT(*) FROM questions WHERE id IN (SELECT question_id FROM knowledge_state WHERE next_review <= date('now'));"
Main Loop (continues indefinitely)
Repeat until user interruption:
1. Question Selection
Apply 70% new / 30% reviews ratio.
Due reviews (next_review <= today):
sqlite3 -json knowledge.db "SELECT q.*, ks.next_review FROM questions q JOIN knowledge_state ks ON q.id = ks.question_id WHERE ks.next_review <= date('now') ORDER BY ks.next_review ASC LIMIT 3;"
New questions: topics with few seen questions, round-robin between subtopics.
If topic filter specified, add WHERE topic = 'TOPIC' to queries.
2. For Each Question
If it's a review (existing question):
- Load question from DB
- Parse
wrong_answers(JSON array of 6 distractors) - Randomly select 3 distractors
- Shuffle the 4 options (1 correct + 3 distractors) in random order
- Display with
AskUserQuestion:- Header: "[Topic] > [Subtopic]"
- Question: the statement
- 4 options in shuffled order
If it's a new question (to generate):
- Choose next subtopic in round-robin
- Load existing questions for this subtopic (to avoid duplicates)
- Generate a new question:
- Statement
- Correct answer
- 6 distractors
- Explanation
- Present immediately with
AskUserQuestion(3 distractors out of 6)
3. Response Processing
After user answers:
If correct:
✓
[Question explanation]
If incorrect:
✗ The correct answer was: [correct answer]
[Question explanation]
4. Recording (only after response)
For a new question:
- Insert question into DB:
sqlite3 knowledge.db "INSERT INTO questions (topic, subtopic, question, correct_answer, wrong_answers, explanation) VALUES (...);" - Get ID and create initial SM-2 state
For any question (new or review):
Record the review:
sqlite3 knowledge.db "INSERT INTO reviews (question_id, success) VALUES (ID, SUCCESS);"Update knowledge_state according to SM-2:
# If success and repetitions == 0: interval = 1 # If success and repetitions == 1: interval = 6 # If success and repetitions > 1: interval = round(interval * easiness) # If success: repetitions++, easiness = max(1.3, easiness + 0.1) # If failure: repetitions = 0, interval = 1, easiness = max(1.3, easiness - 0.2) # next_review = date('now', '+' || interval || ' days') sqlite3 knowledge.db "UPDATE knowledge_state SET easiness = ..., interval = ..., repetitions = ..., next_review = date('now', '+X days') WHERE question_id = ID;"
5. Continue
Move to next question. Never display question number.
Edge Cases
No more reviews or uncovered topics:
Continue generating new questions on existing topics.
Generation failure:
If unable to generate a valid question, silently skip to next topic.
100 questions per subtopic limit:
Check before generation:
sqlite3 knowledge.db "SELECT COUNT(*) FROM questions WHERE subtopic = 'X';"
If >= 100, move to next subtopic.
Important Note
The session continues indefinitely. User can interrupt at any time with Ctrl+C. Data is saved after each response, so interruption only loses the current question. ```
Maintain Learn?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Learn on getagentictools](https://getagentictools.com/loops/jcchrrr-learn?ref=badge) npx agentictools info loops/jcchrrr-learn The second line is the CLI lookup for this page — handy in READMEs and docs.