sm2(1) General Commands Manual sm2(1)

sm2Invoke the SuperMemo2 spaced-repetition algorithm.

sm2 file [new <question> <answer> | show | grade <0.0-5.0> | until | next]

From a file holding memories, search for the one that is the most stale and display its question.

Display the memory's answer with the command.

Score the recall of the memory with , from 0.0 being the worst, to 5.0 being very well.

If there are no memories that are considered stale, nothing is displayed.

To see when the next one will become stale, will display the time in days.

In order to immediately force a practice, use and then grade as usual.

It's suggested to create a "~/sr" directory to hold a collection of topics. A topic's file should be named "<topic>.sr.txt". The "txt" extension is recommended so it's easy to open the file with a text editor to adjust or delete memories.

When adding a memory, try to make them as small as possible. For example when learning a word in a new language such as French, write the word in French as the question argument, and the word in your native language for the answer argument: sm2 "bonjour" "hello".

Names of sm2 files should be "<name>.sm2.txt" so that the operating system can open them by default.

The file format is the following:

timestamp-practiced repetitions-two-digits question answer\n

for every new memory. All fields are plain text.

The format was designed to be efficient for the program to edit, and modifiable and understandable by a person in a text editor.

# Typical usage of sm2

mkdir ~/sr/
touch ~/sr/french.sm2.txt
sm2 ~/sr/french.sm2.txt new bonjour hello
sm2 ~/sr/french.sm2.txt new "au revoir" goodbye
sm2 ~/sr/french.sm2.txt new merci "thank you"
sm2 ~/sr/french.sm2.txt # bonjour
sm2 ~/sr/french.sm2.txt show # hello
sm2 ~/sr/french.sm2.txt grade 3.5
# repeat as many times until nothing shows up.


Spaced-repetition is a technique used to strengthen memories based on a "forgetting curve" ideated by Hermann Ebbinghaus.

SuperMemo2 (and all other "SuperMemo algorithms") is an algorithm and program by Piotr Wozniak which builds on this idea. It was released in 1987 and popularized spaced-repetition.

Before this, the Leitner system (Sebastian Leitner) was used, which is a physical manifestation of spaced-repetition.

sm2 implements the SuperMemo2 algorithm as it's shown to be effective, simple to implement, and easy to adjust.

An alternative popular open-source program is called Anki.

It will become tiresome quickly to type these commands over and over. Below is a minimal REPL for quick repeated usage. The commands are "s" and "g", the rest are the same.

while true;
  read command arg1;
  case $command in
    s) sm2 "$1" show;;
    g) sm2 "$1" grade $arg1;;
    *) sm2 "$1" $command;;
  case $command in
    g*) sm2 "$1" ;;
    *) ;;

Len Falken (

November 26, 2022