RClone Script to Incremental Backup with a total max size

I have a couple of folders I'd like to backup to a remote with rsync incrementally, probably using the --backup-dir strategy. I'd like the backups not to take up more than a specific size (say 1 TB). Any chance someone has already written a script that would do the backups and then delete the oldest backups if we're getting close to the size limit?