Can I first ask why do you need access to global context? Your own node will have its own closure (for variables that live the life of the runtime) so access to context is not really needed. And imo, not a great idea.
What I would like to do is to build a unique identifier for each running flow each time, to write a log-file with all (for me) required information. To cat all information / events - within one running flow each time it will be processed - together (in the logging-file) I will access this unique identifier from all nodes within one flow within one run/process - so my idea is, that accessing this identifier via the hooks via the global/flow context will be the best way. I don't want to modify any node / any flow - thats the reason I'll use the Hook-Events.
Since the hooks are executed within the nodes in a flow (on the server), I assumed that the "outer context" was also available.
I have integrated several functions within the node that registers the hooks, which are then called by all nodes and create and determine the "UnifiedID", as well as details about the respective node and the assignment to the respective flow (via the "start" file determined) and so process the logging of the necessary data in a SQLITE database.
Of course, I could also register the ID via the SQLITE database and then read out this data in each node, but for me this does not appear to be performant enough and poses imo too many risks in the processes (DB lock, etc.).
Hence the consideration of working with memory variables that are also reset when Node-Red is aborted and restarted.
I hope my thoughts have become understandable and clear. Thank you for your support and the time you are spending.
I could still find a solution. I use the option of global variables provided in Node.js in the standard and initialize them in the "onSend" hook. This means that they can be used for all nodes in a flow. I use the ID of the flow as a name of the variable, which ensures uniqueness. Maybe someone else can do something with this. Greetings.