It can be easy, but I am not sure if you ONLY want to exclude hierarchy notes but allow tasks and projects. Anyway, try this,
@tag///* except @tag//@type note
In the documentation, you read about Axis and the simple ones are the following
"children /, descendants //, or descendant-or-self /// axis"
So, with the following,
You are getting all of the items tagged with
@tag and its “descendant-or-self”, but when you add,
except @tag//@type note
You are excluding the descendants that are “notes”. Just be aware that if you
notes happen to have other children that are not
notes those notes will logically appear since TaskPaper by default shows you the inheritance. If you want to go nuclear and do not show any notes under your tag regardless of whether they have a child(s) that is a task or project, use the axis to stop those.
@tag//* except @tag//@type note///*