Learning with spaced repetition using Roam SR

While many Roam users store almost everything in their graphs, we often want to memorize bits and pieces to our own memory. While there are several ways to memorize knowledge, the most effective and efficient approach is spaced repetition.

Spaced repetition is a technique for efficient memorization and practice of skills. Instead trying to memorize by ‘cramming’, memorization is far more efficient by spacing out each review. The software schedules the review of items, optimally increasing the duration between reviews. Spaced repetition is slower, but its effectiveness can’t be denied as it allows learners to scale to memorizing hundreds of thousands of items.

The most popular spaced repetition system (SRS) in the world is Anki, a free and open source app and service. However, it requires manual entry of flashcards, which can become burdensome. So, some efforts have been done to bring spaced repetition to Roam, to reduce friction and turn any collection of blocks into flashcards. Notable examples for Roam are Roam Toolkit (a browser extension) or Neuracache (an external service which requires you to upload your database). While those options are fine, they’re not completely frictionless.

Roam SR by Adam Krivka is the first solution that mimics Anki to a large extent, but functions entirely within Roam. In this article, I’ll show you how to install, set up, and use the Roam SR plugin.

Installing Roam SR

Step 1—Get the code blocks.

Click here to go to the official Roam SR page. Next, copy the following blocks:

Roam SR source code

Step 2—Paste the code blocks in your graph.

Create a page titled roam/sr:

Create roam/sr page

Then, paste the blocks you’ve just copied onto the page:

Roam SR code blocks

Step 3—Activate the plugin.

Expand the script bullet and click the "Yes, I know what I'm doing" button to activate JavaScript in Roam button so the field turns yellow, indicating the plugin is active:

Roam SR active indicator

That’s it for the installation! Let’s have a look at how to adjust the settings.

Adjusting Roam SR’s settings

While there is a Settings block on the roam/sr page, I recommend you stay away from it unless you know what you’re doing. For now, we’ll only have a look at the roam/css block and the possibilities it gives.

If you’re somewhat familiar with CSS, you’ll see that by default all settings are turned off (they’re commented out with /* */). To activate one, simply remove the comments, like this setting that hides the #sr tag from the block during review:

Roam SR CSS settings

Marking cards for review

Marking cards for review is easy: simply add the tag #sr to a parent block to turn it into the front of a new flashcard. Any blocks that are nested underneath this parent block will show on the back of the card:

Roam SR card example

It’s also possible to mark a bunch of blocks as flashcards in one go. To do this, create a parent block with the {{sr}} shortcode (don’t click it yet!) and add blocks underneath that you wish to mark as flashcards:

Roam SR button inactive

By clicking the sr button, it will add the #sr tag to every block at one indentation level below, marking them as flashcards:

Roam SR button inactive

Reviewing cards

When you activate the plugin, a new button titled REVIEW appears in the left sidebar:

Roam SR sidebar button

The blue number indicates the amount of new cards up for review; the green number shows how many previously reviewed cards are up for another review.

By clicking the REVIEW button, the main screen will show the first card up in the queue:

Roam SR flashcard front

With spaced repetition, the trick is to test yourself on the question on the front of the card before clicking the Show answer button.

Once you’ve retrieved the answer from memory, click the Show answer button to see the back of the card:

Roam SR flashcard back

Finally, score yourself on the accuracy of the answer by choosing one of the options below. Each time you review a card and score yourself, the review interval will be adjusted.

If for any reason you don’t want to score yourself on the current card, click the Skip button. If the card contains an error, click the Flag button. The latter option will add the #f hashtag to the card, which enables you to quickly find it by navigating to the the page titled f in your graph.

Once you’ve reviewed all scheduled cards, the session will end and you will return to the Daily Notes page. You can also end the review session early by clicking the END SESSION button in the left sidebar.

Additional resources

Watch this demo by Roam SR developer Adam Krivka to see the plugin in action and how to install it:

Was this helpful?