I have pushed a number of commits to arrive at a generic mechanism to handle kernel events that applications may be interested in. Before that, most was handled using an undocumented hook user:prolog_event_hook/1
that was implemented for several modules around the (graphical) debugger. The debugger needs to know about reclaimed clauses as it needs to update its caches that keep information about clauses. It also needs to know about breakpoints being set and possibly being cleared because the code is removed and Prolog environment frames that are finished as it maintains a view of these.
The new mechanism is implemented by prolog_listen/2,3 and friends. In addition to the old stuff it allows for tracking changes to (dynamic) predicates. If you build the current git source you can run
?- help(prolog_listen).
to get an idea of the API. The plan is to use this API for more hooks in the future. Nothing is fixed yet, so remarks to making it better, more compatible, etc. are welcome.