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()
})
})
| Hook | Fires |
|---|---|
boot | once, after loading, before the first tick |
wake | at the start of every wake |
tick | before every tick — keep it cheap |
shutdown | once, 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.