SWI-Prolog provides a large number of hooks, mainly to control handling messages, debugging, startup, shut-down, macro-expansion, etc. Below is a summary of all defined hooks with an indication of their portability.
Hook into write_term/3 to alter the way terms are printed (ISO).
Hook into print_message/2 to alter the way system messages are printed (Quintus/SICStus).
Hook into print_message/2 that defines prefix, output stream, color, etc.
Hook into absolute_file_name/3 to define new library directories (most Prolog systems).
Hook into absolute_file_name/3 to define new search paths (Quintus/SICStus).
Hook into load_files/2 to modify read terms before they are compiled (macro-processing) (most Prolog systems).
Same as term_expansion/2 for individual goals (SICStus).
Hook into load_files/2 to load other data formats for Prolog sources from `non-file' resources. The load_files/2 predicate is the ancestor of consult/1, use_module/1, etc.
Hook into edit/1 to locate objects (SWI).
Hook into edit/1 to call an internal editor (SWI).
Hook into edit/1 to define the external editor to use (SWI).
Hook into the tracer to list the code associated to a particular goal (SWI).
Hook into the tracer to handle trace events (SWI).
Hook in spy/1, nospy/1, nospyall/0 and debugging/0 to extend these control predicates to higher-level libraries.
Hook in help/0, help/1 and apropos/1 to extend the help system.
Define a new resource (not really a hook, but similar) (SWI).
Old attempt to a generic hook mechanism. Handles undefined predicates (SWI).
Unification hook for attributed variables. Can be defined in any module. See section 6.1 for details.