Prolog to PDDL

I’m combining C#, SWI-Prolog (possibly with sCASP), and external PDDL planners. Before using Prolog, I generated the PDDL via C#. But, since game state is going to be stored as a Prolog database, it might be better to store actions in the same database and generate PDDL only when highly optimized planning is necessary. I saw logicmoo’s PDDL support, but I don’t understand the implementation and my issue remains unanswered after 10 days. So, I’m investigating my own solution. An action might be defined in Prolog like:

effect(walk,[loc(AGENT,TO),not(loc(AGENT,FROM)),increase(total-cost,20 - strength(AGENT)].

Maybe positive and negative preconditions and effects should be listed separately so it is easier to know whether they require assert or retract? Then the database might be queried:

true.		[if possible]
false.		[if not possible]

If I were to use sCASP, I might be able to understand why an action is not possible, e.g. john can’t walk from the kitchen to the livingroom because john is not in the kitchen right now. I might be able to get quick answers to compare action costs:

5. 			[returns 20 - strength(AGENT)]

And then write a valid PDDL file with actions that look like this:

write_PDDL_action(action(walk,john). [outputs text below]

    (:action walk
        :parameters (?a - agent ?from ?to - place)
            (not (dead ?a))
            (loc ?a ?from)
            (adjacent ?from ?to flat)
            (not (= ?from ?to))
            (loc ?a ?to)
            (not (loc ?a ?from))
            ;(increase (total-cost) 5)

the agent’s name is just necessary to calculate the cost. However, if the Prolog–>PDDL converter outputs facts like strength(john,15) then the PDDL action might contain the formula (20 - strength(john)) or something similar. Any thoughts would be appreciated!