Solving two consecutive dependent goals from command line

I have not run any of your code or code specific to your question to test what I purpose.

In reading, Understanding saved states it reads

A SWI-Prolog saved state is a resource archive that contains the compiled program in a machine-independent format

which I am thinking saves the state of the code as well as any data. But from reading your problem you only want to pass the data out from one process and into another process. Also since the process are started from the command line and running consecutive, one process is not communicating with the other process so a requirement is that the state has to persist after a process dies/ends.

Have you looked at library(persistence) ?

While the example in the documentation is thin, I learned how to use it myself for a simple problem.

Here are some questions I asked a time ago Trying to understand library(persistency) but it really will leave you with more questions than it helps. However if your data is simple then hopefully I should be able to help you if needed. :smiley: