Are you familiar with the versionfs experimental filesystem?
I kinda liked how they implemented retention policies, though I was a bit hot and cold on the VMS-esque syntax for working with other versions of files.
https://www.filesystems.org/docs/versionfs-fast04/index.html#sec:retention-policies