plugins

Code that runs at fixed points in a mind's life, for work that isn't thinking: opening a database, warming a cache, closing what was opened. Every file in plugins/ is loaded before the mind starts.

// plugins/memory.ts
export default definePlugin(axon => {
    axon.hooks.on("boot", async () => {
        await memory.open({ connection: kernel.memory.connect("long-term") })
    })

    axon.hooks.on("shutdown", async () => {
        await memory.close()
    })
})
HookFires
bootonce, after loading, before the first tick
wakeat the start of every wake
tickbefore every tick — keep it cheap
shutdownonce, when the mind is unloaded

Never thinking

A plugin can't be ordered, checked or recorded the way a system is. So a decision made in one is a decision nobody can trace. Anything the mind believes or decides is a component and a system.

Don't rely on shutdown

It won't run on a crash or a power cut. Write what matters when it happens, not when the mind stops.