You can, of course, put your post-filter in a macro file as
$noMessages = sub { ... };and then use
ANS($ans->cmp->withPostFilter($noMessages));in the problem, to make it easier.
I understand your pedagogical need, and was not suggesting that you not modify the problems, only that they not be distributed as part of the NPL, where people might not realize their special purpose.
Good luck with the quizzes.
Davide