Build-in clean up unused resourec

I have seen some script that can remove the unused resources, however, can this be built in? it is beneficial and much safer. Thanks.

Possibly related:

and

In short, it should be built-in — how long orphaned resources are kept is based on the "keep note history for" setting.