Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

State Ownership

Lifetime Table

StateLocationLifetime
LLM Routerquery/core.clj :: router-atomProcess
Conversation cacheconversation/core.clj :: cacheProcess
SCI sandboxenvironment :sci-ctxConversation
Extensionsenvironment :extensionsConversation
Var-index cacheenvironment :var-index-atomConversation
Recursion depthenvironment :depth-atomConversation
Iteration budgetenvironment :max-iterations-atom (query-scoped, assoc’d by query engine)Query
Current iteration refenvironment :current-iteration-id-atom (query-scoped, assoc’d by query engine)Query
Token usageusage-atom (local in iteration-loop)Query
Repetition countscall-counts-atom (local in iteration-loop)Query

Environment Map

The environment is the runtime map representing one live conversation. See Environment Map for every key, its type, and what you can/cannot do with it from extension code.

Conversation Cache

conversation/core.clj maintains a process-level (defonce cache (atom {})) mapping conversation ID strings to {:env environment :lock Object}.

  • ensure-env! — find-or-create in cache
  • cache-env! — insert into cache
  • close! — dispose environment + remove from cache
  • close-all! — dispose all + reset cache (process shutdown)

The per-conversation :lock object serializes send! calls — only one turn runs at a time per conversation.