FSRS: is there a way to override Desired Retention using custom scheduling?

I am using Windows 10 and Anki 24.06.3 Qt6.

I’m experimenting with setting Desired Retention on a note-by-note basis, instead of being limited to the Deck Preset’s desired retention.

My current approach (which requires using the “Custom Scheduling” version of FSRS) is as follows:

  1. I added a new field to my note type called Custom Retention, which I can use to set the desired retention for each note (e.g., 0.5, 0.8, 0.99).
  2. I added the following code to the Front template:
{{#Custom Retention}}<div id="myId" request_retention="{{text:Custom Retention}}">{{/Custom Retention}}
  1. I then used the code from this FSRS repository as my Custom Scheduling code. I replaced the line "requestRetention" = 0.9, with the following code:
// Check for an element with a specific ID to adjust requestRetention
"requestRetention": (function() {
  const retentionElement = document.getElementById("myId");
  if (retentionElement !== null) {
    const customRetention = parseFloat(retentionElement.getAttribute("request_retention"));
    if (!isNaN(customRetention)) {
      return customRetention; // Use the custom retention value from the element's attribute
    }
  }
  return 0.9; // Default retention if element or attribute doesn't exist
})(),

This approach seems to work well enough, but I’m wondering if there is a way to only override Desired Retention, without using the full “Custom Scheduling” version of FSRS.

2 Likes

@L.M.Sherlock

3 Likes

Unfortunately, the desired retention is unaccessible to the custom scheduling and card templates. You could only modify it via developing an add-on.

3 Likes

Oh, that is a bummer. Guess I’ll be using the “Custom scheduling” version of FSRS for now. Thanks for clarifying! :slight_smile:

(@dae for some reason, I cannot seem to select any answer as the solution to this topic, since the button appears to be missing. Is this expected?)

(should be fixed now)

2 Likes