You can generally trust the compiler to be smart about eliminating unreachable code, text strings, and dictionary words. In other words, it should be safe to include
(tree) in the source code, and only use it from the debugger.
If you are unsure, add some unique text to the rule body, and then run the compiled game through
txd (z-tools) or
aamshow (Å-machine tools) to verify that the text isn’t there.
I realized just now that there’s a flaw in the current version of the algorithm: Closures are always considered reachable, even if they are defined inside an unreachable block of code. By extension, every predicate that is queried from inside a closure is also considered reachable. In the long run, this flaw should be fixed, but I don’t think it’s a huge problem in practice.