JidoGralkor.Lifecycle (jido_gralkor v3.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 fire-and-forget Gralkor.Client.flush(thread_id) so the buffered turns don't strand in Gralkor.CaptureBuffer state outliving the agent. Failures are logged but never block 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.