Anki add-on: Limit new cards based on due + reviews

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

GitHub repository: ig3/anki-limitnew
Repository description: Limit the number of new cards in Anki
Languages: Python, Shell