FYI - using prolog_frame_attribute/3 and parent

I don’t know the details of your code. A quick read hints that you are using a frame reference (much) later. You are responsible that it is still valid. The reference is just an integer that goes through some very elementary checks. Surely not something fool proof. A fool proof solution would generate unique ids and keep track of those. That is a lot of complicated admin. Typically you get a frame reference from the trace interception and a few more predicates, do you analysis and forget about it. If you want to do anything different you have to be very careful about the scoping rules.

These predicates are for a reason in the Hacker’s corner :slight_smile: