JidoGralkor.Lifecycle (jido_gralkor v11.0.0)

Copy Markdown View Source

Jido.AgentServer.Lifecycle implementation that flushes the active Gralkor session when an agent process terminates.

Sole job: on terminate/2, read the committed Jido thread id from state.agent.state[:__thread__].id and schedules Gralkor.Client.flush(thread_id) before the agent runtime exits. Capture already retains the accepted route definitions. The scheduled ingestion remains asynchronous. Failures are logged but never prevent termination. First-turn agents (no thread committed yet) terminate without calling Gralkor.

Memory consolidation while the agent is alive is owned by JidoGralkor.ContextRotator, not this module. The AgentServer's built-in :idle_timeout knob is unaffected — consumers can use it directly if they want a reaper, but this module no longer wires one on their behalf.