Limit new cards based on due + reviews

AnkiWeb addon 548158563

Automatically adjusts new-card limits based on current review workload and overdue cards to maintain a steady study load and prevent overload.
AI-generated summary; may contain mistakes.

schedulingdeck-management

Open on AnkiWeb GitHub Find alternatives

AnkiWeb

Votes
8 (👍 6 · 👎 2)
Updated
2021-06-09
Anki versions
2.1.43~
License
MIT (from the license file in the package)
Virus scan
No ClamAV match A match does not prove malware. No match does not prove that the code is safe.
Languages
Python, JSON
Description language
en

Maintenance

abandoned

  • Last update or commit: 2021-08-31 (1888 days before the snapshot).
  • Commits in the last year: 0.
  • Issues: 3 open, 6 closed.
  • Pull requests: 0 open, 0 merged.
  • Median first response: 22 hours (9 answered issues and pull requests).

GitHub

Repository
ig3/anki-limitnew · more by ig3
Stars
⭐ 3 · forks 0 · open issues 3
Last commit
2021-08-31
License
MIT
Languages
Python, Shell
Tests
0

Will it work on my Anki?

Version branches
Min AnkiMax AnkiUpdated
2.1.172.1.43+2021-06-09
History across monthly snapshots

Loading…

Similar addons

Limit New by Young

Adjusts daily new card limits per deck based on young card counts, estimated review load, or cards due soon, with configurable rules and automatic updates.

schedulingdeck-management

8 votes 53% approval 👍 7 · 👎 1 ⭐ 10 Anki 26.05~ Updated 2026-07-22
Backlog Calculator

Calculates how many cards you must review daily to clear a chosen deck's due backlog, including subdecks, by a target date.

progress-tracking

3 votes 6% approval 👍 1 · 👎 2 ⭐ 0 Anki 2.1.61~ Updated 2023-05-23

Description

Limit new cards to maintain a steady workload. If you already have too many reviews to do, adding more new cards doesn't help but Anki adds the same number of new cards every day, whether you have capacity or not. Set new cards per day too low and you avoid being overwhelmed but your progress is slow. Set new cards per day too high and you will soon have an overwhelming number of reviews each day. You will not be able to complete them - there are only so many hours in the day, and you probably have other things you need to do. Intervals between reviews will be too long and you will not learn effectively. This add-on adjusts the number of new cards according to your workload. If your workload is light it allows many new cards - up to the new cards per day limit you configured on your deck. But if your workload is too high, it limits the number of new cards, letting you focus on reviews until you catch up. Works only with desktop Anki 2.1 and the V2 scheduler. I use the Linux version of Anki desktop and I'm not certain how different other versions are. If you try it on another version, probably best to work in an alternate profile or be sure you have backups. Carefully consider the limits you set, particularly if you have many decks and cards. You might start by setting very high limits the gradually lowering them. If they are too low, you will not get any new cards. New release 20210512 is tested on Anki 2.1.43 and 2.1.35 and should work with earlier releases back to 2.1.28. Anki 2.1.26 and earlier will continue to run the old implementations. The new release was necessitated by significant changes in the scheduler with version 2.1.28. After all, it is simpler and probably more correct. Performance might be an issue if revlog is large or with large numbers of decks and cards. New cards are limited based on due + reviews - an approximation of your study workload. If workload exceeds configured limits, the new cards limit is reduced. There are two configuration parameters: workloadLimit and workloadMax. The limit on new cards will be reduced progressively when workload exceeds workloadLimit, down to 0 when it reaches workloadMax. New cards are not limited in filtered decks. This version supports setting limits on total workload (calculated across all decks) or per-deck limits (calculated across each deck and its sub-decks). Because of the ways decks interact in Anki, the per-deck limits might not work as you would like or expect: while the add-on settings can be independent the decks can interact. It will probably be less confusing to enable either total limits or per-deck limits, though the add-on will work if you enable both. For the total limits, when workload exceeds totalWorkloadMax, maxNew = max(totalMinimumNew, totalWorkloadMax - totalCount + totalNew), where totalCount is scheduled New + Learn + Review + total viewed and totalNew is scheduled New. When workload is between totalWorkloadLimit and totalWorkloadMax, maxNew = max(totalMinimumNew, min(maxNew, int(round(newPerDay * (1 - ((totalCount - totalWorkloadLimit) / (totalWorkloadMax - totalWorkloadLimit))))))). For per-deck limits, the calculations are essentially the same, but dealing with counts for one deck and any sub-decks at a time. There is now an option to limit overdue cards. This is simpler, conceptually and in the implementation. If you have overdue cards, you have not completed all scheduled reviews. In this case, it is probably best not to have new cards until you have caught up. None the less there are overdue limit and max parameters so that new cards can be limited progressively, rather than abruptly cut off. The formula is max(totalMinimumNew, min(maxNew, int(round(newPerDay * (1 - (totalOverdue / totalOverdueMax)))))), and similar for the per-deck limits but, again, considering only the counts for the specific deck and its sub-decks. The new implementation has been somewhat problematic and is still not ideal due to how Anki works, limitations of its features for add-on integration and limitations in my understanding of the internals of Anki and its scheduler. But, it seems now to be behaving reasonable in a broader range of cases. I hope, at least, no longer crashing or failing to load and at least dealing with the extremes of workload adequately, though perhaps not finessing the intermediate workloads ideally, depending on your collection and configuration. Some of the data used by the add-on is only updated by Anki occasionally (I don't know the details of when it updates, but updates are sometimes somewhat delayed). While it would be possible to query the database directly for all data, the performance impact for users with larger collections is prohibitive. But the intent is to put some bounds on new cards to avoid gross overload. It is not intended to be exacting in the details of the limits. Keep this in mind when you use the add-on. Be concerned with the longer term impact (over a few days or weeks) rather than the details of changes within a day of study. Also available from https://github.com/ig3/anki-limitnew See README.md for full documentation. Updated 2 Sep 2020 to comment out print statements Updated 31 Aug 2020 to improve performance Updated 12 May 2021 to accommodate Anki 2.1.28 and later Updated 21 May 2021 to fix a bug in overdue limits Updated 22 May 2021 additional bug fixes and add minimum limit Updated 28 May 2021 fix handling of filtered decks Updated 9 Jun 2021 with several improvements to the calculations

README

Note: I have stopped using Anki. I now use srf instead. It provides a small subset of Anki features but the scheduler regulates new cards automatically, to maintain a steady workload without constant manual adjustments, and cards with shorter intervals are prioritized over cards with longer intervals, which I find significantly enhances learning, particularly with a backlog (e.g. after a few days without study). As I am not using Anki, I will not notice if a newer version of Anki is incompatible with this plugin and will have little motivation to adapt the plugin. If anyone wants to continue development, of course you can fork this repository and I would be happy to give over the plugin page on ankiweb. Let me know if you are interested.

anki-limitnew

Limit the number of new cards in Anki based on workload.

If you have too many cards due, you cannot study them all on schedule. This defeats the spaced repitition schedule. Adding more new cards only makes the problem worse. You can manually edit your new card limit but this add-on adjusts it automatically to keep a steady workload, adding as many new cards as you can handle without being overloaded.

This add-on works only with Anki 2.1 and the V2 scheduler.

There are three implementations:

  1. The original implementation for Anki 2.1.22
  2. An implementation for Anki 2.1.22 through 2.1.27
  3. The latest implementation for Anki 2.1.28

Installation

  • Download limitnew.ankiaddon
  • Start Anki and open Tools -> Add-ons
  • Drag the downloaded .ankiaddon file onto the add-ons list
  • Restart Anki

GitHub: https://github.com/ig3/anki-limitnew

Concepts

Ideally, you will complete study of all due cards every day. If you do, you will see your review cards according to the spaced repition algorithm. If you don't, your reviews of some cards will be delayed and learning will not be as effective. If you are unable to study for a few days, you may have more reviews due than you can complete in a day and adding more new cards will only make the problem worse. You need some time without any more new cards to catch up, then you can study new cards again. Otherwise, you may be perpetually overloaded and not learning effectively, going into a downward spiral of failure.

Each deck has a limit on new cards per day. This is a fixed number and if you complete your study each day, you will see this number of new cards each day. That's great, as long as you don't get overloaded and fall behind. You make steady progress.

Reality is, some cards are easier than others and some days are better than others. On a good day with easy cards, you could study many new cards and still complete all due reviews. On a bad day or with more difficult cards, adding too many new cards will make you fall behind and if you have limited time to study, you may not be able to complete all due reviews. If you fall behind for other reasons (i.e. you are unable to study for a few days) adding new cards before you are caught up just makes it harder to catch up.

But Anki shows the same number of new cards every day, regardless of your workload and how well you are coping.

One simple solution is to set your new card limit to 0 then add new cards by custom study. This way you can add as many new cards as you want, whenever you have capacity but not add any when you are overloaded. Effectively, you manage the number of new cards manually.

Another is to edit your deck options to reduce your new card limit when you are overloaded and increase it when you are not. Again, you are managing the number of new cards manually.

Yet another is to set Anki scheduling options to show new cards after reviews. If you don't complete your reviews, you will not see any new cards. This is automatic but you will see all your new cards together, at the end of your study and each deck is handled separately. If you have multiple decks, you may spend time studying new cards in one deck, then not have time to finish all the cards due when studying a subsequent deck.

With this add-on you can limit the number of new cards you see based on number of overdue cards, number of cards scheduled and number of cards viewed and you can set limits for the totals of these across all decks and for each deck individually.

The limits work regardless of study order (new cards first, last or mixed with reviews).

If you are coping well you will not have any overdue cards and the sum of cards viewed and scheduled will be below the limits you set. In this case you will see the full number of new cards you have configured as New cards/day in you options for New Cards.

If you have overdue cards or the sum of scheduled and viewed cards exceeds the limit you configure for this add-on, then the number of new cards you see will be reduced. The reduction is gradual, reacing zero at the maximums you set. Limits and maximums can be set for each deck and for totals across all decks.

The objective is to studay as many new cards as possible without becoming overloaded so that you can complete all scheduled reviews each day. If you do become overloaded, then hold off new cards completely, until you catch up with scheduled reviews.

New cards a limited based on number of overdue cards and workload: the sum of cards scheduled and cards viewed for the day. This is an approximation of the time and effort you are putting in to studying.

Workload: the number of cards due to be reviewed plus the number of card views on the day.

If you view the same card several times (e.g. as it progresses through your learning steps) then each view of the card contributes to workload. The workload is not the number of unique cards, but the total number of card views, regardless of which card. At the start of the day no cards have been viewed, but some number of cards are due. By the end of the day, if you complete review of all cards due, the remaining cards due is 0 but you will have viewed some number of cards. The sum of due and viewed cards the the approximation of workload. It tends to increase as you will view hard cards more than once.

Overdue: the number of cards overdue for review is simpler. If you complete all scheduled reviews each day, this number will be 0 but if you don't complete all scheduled reviews then you will accumulate overdue cards.

OverdueMax: the upper limit on overdue cards, beyond which no new cards per day will be reduced to 0.

For the limit based on overdue cards there is one parameter: OverdueMax. The new cards limit is reduced if there are any overdue cards. It is reduced gradually, down to 0 when the number of overdue cards exceeds OverdueMax. For example, if New cards/day is 20 and OverdueMax is 10, then if you have 0 overdue cards you may see 20 new cards but if you have 5 overdue cards you may only see 10 new cards and if you have 10 or more overdue cards you will not see any new cards.

For the limit based on workload there are two parameters: WorkloadLimit and WorkloadMax. The new cards limit is reduced if the workload exceeds WorkloadLimit. It is reduced gradually, down to 0 when the workload exceeds WorkloadMax. Depending on your preference, WorkloadLimit and WorkloadMax can be set equal for an abrupt cutoff of new cards, or WorkloadMax can be set greater than WorkloadLimit for a gradual reduction.

WorkloadLimit: the lower limit, beyond which new cards per day begins to be reduced from its configured value.

WorkLoadMax: the upper limit, beyond which the new cards per day is reduced to 0.

Configuration

The add-on has the following configuration parameters:

  • enableDeckLimits
  • enableTotalLimits
  • mode
  • totalWorkloadLimit
  • totalWorkloadMax
  • totalOverdueMax
  • totalMinimumNew
  • defaultDeckWorkloadLimit
  • defaultDeckWorkloadMax
  • defaultDeckOverdueMax
  • defaultDeckMinimumNew

To change the configuration, start Anki and open Tools -> Add-ons, select the limitnew add-on and click Configure. Set values for the two parameters, then click OK.

enableDeckLimits - default true

This parameter may be set to true or false.

If it is true, then new cards are limited per deck. Three new parameters are added to the New tab of deck options:

  • Workload Limit
  • Workload Max
  • Overdue Max

These parameters are configured per option group. Each deck has an option group configured. By creating multiple option groups, each deck can be configured differently.

These parameters work as described above but the workload and overdue cards are calculated separately for each deck. If decks are nested, then the calculations include cards overdue, due and studied for a deck and its sub-decks.

enableTotalLimits - default true

This parameter may be set to true or false.

If it is true then new cards are limited based on total workload: the sum of cards due and studied across all decks, and total number of overdue cards.

The limits are configured in add-on configuration parameters totalWorkloadLimit, totalWorkloadMax and totalOverdueMax. These work as described above.

mode - default min

This parameter is only used by the older implementations. Implementation for Anki 2.1.28 and later ignores it.

This parameter may be set to min or max.

If both enableDeckLimits and enableTotalLimits are true, then this parameter determines whether the number of new cards for a given deck is the maximum of the two limits or the minimum of them.

This parameter only works for the older implementations. For the current implementation (Anki 2.1.28 and later) the number of new cards is always the minimum.

totalWorkloadLimit - default 200

This parameter may be set to an integer.

If enableTotalLimits is true, this is the total workload beyond which the new card limit will be reduced. The total workload is calculated by summing the cards studied and reviews and learning cards scheduled across all decks.

Recommendation: Set workloadLimit to the number of cards you can study in a couple of hours, or however much time you have available to study each day. If you need only a few seconds per card, you might set your limit to 2,000 or higher. If you spend more like 30 seconds per card, then you might set your limit to about 200.

totalWorkloadMax - default 250

This parameter may be set to an integer.

If enableTotalLimits is true, this is the workload beyond which the new card limit will be reduced to totalMinimumNew. The total workload is calculated by summing the cards studied and reviews and learning cards scheduled across all decks.

If workloadMax is greater than workloadLimit then the new card limit will be gradually reduced as workload increases from workloadLimit to workloadMax.

Recommendation: Set totalWorkloadMax to the workload beyond which you don't want to see any new cards. If you want your new cards to be all-or-nothing, set totalWorkloadMax to the same value as totalWorkloadLimit.

totalOverdueMax - default 20

This parameter may be set to an integer.

If enableTotalLimits is true, this is the number of overdue cards beyond which the new card limit will be reduced to totalMinimumNew.

Recommendation: Set totalOverdueMax low. You will only have overdue cards if you fail to study all scheduled reviews. This is a strong indicator that you are overloaded, in which case adding more new cards will not be helpful.

totalMinimumNew - default 1

This parameter may be set to an integer.

If enableTotalLimits is true, this is the minimum that new cards will be reduced to based on total workload and overdue cards.

Recommendation: Set this to the number of new cards you want to see every day, regardless of your overall workload. It should be low enough that even when you are seriously overloaded, you will be able to recover reasonably quickly.

defaultDeckWorkloadLimit - default 200

This parameter may be set to an integer.

If enableDeckLimits is true, this is the default value of the option group Workload Limit parameter.

defaultDeckWorkloadMax - default 250

This parameter may be set to an integer.

If enableDeckLimits is true, this is the default value of the option group Workload Max parameter.

defaultDeckOverdueMax - default 20

This parameter may be set to an intenger.

If enableDeckLimits is true, this is the default value of the option group Overdue Max parameter.

defaultDeckMinimumNew - default 1

This parameter may be set to an integer.

If enableDeckLimits is true, this is the default value of the option group Minimum New parameter.

Per-Deck Limits

If enableDeckLimits is set to true, then deck options will include three new parameters: Workload Limit, Workload Max, Overdue Max and Minimum New. These values will not appear in the add-on configuration file. They only appear in the deck options. They work the same as the corresponding total parameters in the add-on configuration, except the workload and overdue cards are for the partucular deck. However, if you have nested decks, then the number for the parent deck include those of the sub-decks.

Custom Study - increase today's new card limit

Custom study allows you to increase the number of new cards for the day. This alters the deck, rather than creating a filtered deck. The implementation doesn't actually change the new card limit. Instead, it adjusts the count of new cards studied. If you allow 10 more new cards, the new card limit is unchanged but the count of new cards studied is reduced by 10, possibly to a negative number. Then, as you study more new cards, the count of new cards studied is increased. You can study more new cards until the count reaches the new card limit.

When your workload is less than your WorkloadLimit, this should work as expected but when the add-on has reduced your new card limit, the result can be a bit confusing.

Consider if your new card limit is 20 cards and you study 20 new cards. With the older implementations, your count of new cards is 20, your limit is 20 and Anki will not show you any more new cards. If you continue to study so that your total number of reviews exceeds your WorkloadMax, then this add-on will reduce your new card limit to 0. Now, your new card limit is 0, but your count of new cards is still 20. If you then add 10 more new cards by custom study, your new card limit is still 0 and your count of new cards is reduced to 10, but 10 is still more than 0 so you will not see any more new cards. If you then allow another 15 new cards, your count of new cards studied is reduced to -5 (these adjustments are cumulative). Since -5 is less than 0, you will see 5 more new cards.

The latest implementation is different. It changes the number of new cards you will see by changing the number of new cards seen, rather than the limit on new cards. Thus, it works consistently with how custom study works: to make Anki believe you have studied more or less new cards than you actually have. Being consistent with how custom study works, it will, hopefully, be a little less confusing if you do custom study.

Filtered decks

Filtered decks are for study outside the normal spaced repitition algorithm and deck configuration.

This add-on does not limit new cards in filtered decks. This includes filtered decks you create manually and those created by custom study.

Filtered decks do have reviews due and studying a filtered deck contributes to the count of card views - increasing the total workload for the day. This will not affect per-deck limits (assuming the filtered deck is not a sub-deck of the deck being studied) but it will affect the limits based on total workload.

Sub-decks

The new card limit of a sub-deck cannot be more than the limit of its parent deck. This limitation is imposed by the Anki v2 scheduler. This is true even if one studies only the sub-deck. This add-on may reduce the new card limit of the parent deck and as a result limit the new card limit of the sub-deck, regardless of the configuration of the sub-deck.

Anki versions older than 2.1.22

The latest implementation uses hook scheduler_new_limit_for_single_deck, introduced with Anki 2.1.22. For older versions, the old monkey patch integration is used. This version of the add-on is much simpler.

Configuration

The old implementation has only two configuration parameters:

  • workloadLimit (default 200)
  • workloadMax (default 250)

These are applied to workload calculated across all decks. There is no support for per-deck workload limits.

For example, you can set configuration to:

{
  "workloadLimit": 200,
  "workloadMax": 250
}

Any other configuration parameters will be ignored.

Change Log

09 Jun 2021

Some improvements to the calculations of workload and adjustment of new cards from Issue #5 with many thanks to JazzyJangles for testing and pointing out problems. Still not perfect but about as good as it will get with the limitations of Anki, and certainly better than previous. This still has a lot of prints for debugging.

28 May 2021

Possibly fix a bug during load. Anki sometimes calls the reviewer_did_answer_card hook before the collection has loaded (i.e. before calling the collection_did_load hook. In this case, the add-on is not initialized and per-deck configuration is not yet available. In this case, return without doing anything if reviewer_did_answer_card hook is called.

22 May 2021

Fix a bug in previous release that reduced new cards to 0 in many cases.

Add options to set a minimum on how low new cards will be reduced.

14 May 2021

A new implementation that works with Anki 2.1.28 and later.

Added limit on overdue cards as an alternative basis for limiting new cards. Having overdue cards is a strong indication that you are overloaded. While your number of scheduled and viewed cards are likely to be high in such a case, you might want to limit new cards purely on the basis of overdue cards, regardless of workload.

2 Sep 2020

Comment out print statements.

31 Aug 2020

A major rewrite to address some performance issues.

For Anki 2.1.22 and later, the scheduler_new_limit_for_single_deck hook is used for integration. Neither _groupChildrenMain nor _deckNewLimitSingle are monkey patched. For older versions of Anki, the old implementation is still used - monkey patching _groupChildrenMain and _deckNewLimitSingle.

The new implementation supports workload limits per deck, with configuration in deck options, and total workload limit with configuration in add-on options.

Database queries to determine workload (cards due and cards studied) are rewritten to improve performance and results are cached to avoid re-running them unnecessarily. The cache is cleared when cards are reviewed.

hooks

scheduler_new_limit_for_single_deck

This pylib hook is used to reduce the limit on new cards per deck, based on workload.

reviewer_did_answer_card

This GUI hook is used to clear the cache of number of cards due and studied when a card is answered.