Soul Hooks

The Soul Engine API provides stateful hooks that can generate side effects during MentalProcess execution and extend the Soul Engine's functionality. All of the hooks follow the pattern use[Hook] and can be imported from the @opensouls/engine package.

exampleProcess.ts
import { MentalProcess, useProcessMemory } from "@opensouls/engine"
 
const exampleProcess: MentalProcess = async ({ workingMemory }) => {
  // example call to a hook which generates a local persistent memory container
  const count = useProcessMemory(0)
 
  // rest of the mental process
  // ...
  return workingMemory
}
 
export default exampleProcess

The Engine provides the following hooks: