For both of those, are they within the project's build root, or could be outside the build root?
We have AddPrefix and RemovePrefix which might work. And you can use PathGlobs to locate the files. This might not cover your use case though
If you stick with pathlib, you can make your rule uncacheable to force it to rerun. Goal rules are also uncacheable already, so if you're adding a new goal, you're good to use pathlib