Project-level configuration and runtime query conventions.
psi-toolpsi-tool is the canonical live runtime self-inspection and self-modification surface.
Canonical requests are action-based:
action: "query" — read from the live EQL graphaction: "eval" — evaluate in-process Clojure in a named already-loaded namespaceaction: "mutate" — invoke one registered runtime mutation with one params mapaction: "reload-code" — reload already loaded namespaces by explicit namespace list or worktree scopeLegacy query-only calls of the form {query: "..."} remain accepted as a migration compatibility alias for action: "query", but canonical docs and examples use the action-based form.
Use query mode for:
Examples:
{:action "query"
:query "[:psi.graph/resolver-syms]"}
{:action "query"
:query "[:psi.agent-session/session-name :psi.agent-session/model-id]"
:entity "{:psi.agent-session/session-id \"sid\"}"}
Extension install introspection example:
{:action "query"
:query "[:psi.extensions/effective
:psi.extensions/diagnostics
:psi.extensions/last-apply]"
:entity "{:psi.agent-session/session-id \"sid\"}"}
Canonical discovery flow:
:psi.graph/resolver-syms:psi.graph/root-seeds:psi.graph/root-queryable-attrsUse mutate mode for canonical runtime writes that already exist as registered mutations.
Contract:
mutation must be a qualified mutation symbol stringparams must be a map/object when presententity is query-only and is rejected for action: "mutate"psi-tool reuses the canonical runtime mutation path rather than raw evalExample:
{:action "mutate"
:mutation "psi.extension/close-session"
:params {:session-id "8fe9b0a6-ad8a-4373-9478-557e537499f2"}}
Typical success shape:
#:psi-tool{:action :mutate
:mutation 'psi.extension/close-session
:duration-ms 4
:overall-status :ok
:result #:psi.agent-session{:close-session-closed? true
:close-session-id "8fe9b0a6-ad8a-4373-9478-557e537499f2"}}
Typical validation failure shape:
#:psi-tool{:action :mutate
:mutation 'psi.extension/not-a-real-mutation
:duration-ms 0
:overall-status :error
:error {:phase :validate
:message "Unknown psi-tool mutation: psi.extension/not-a-real-mutation"}}
Canonical session-admin flow:
:psi.runtime-session/active-id:psi.agent-session/context-session-summariesaction: "mutate" with psi.extension/close-sessionExample discovery + mutate sequence:
{:action "query"
:query "[:psi.runtime-session/active-id]"}
{:action "query"
:query "[{:psi.agent-session/context-session-summaries
[:psi.session-info/id
:psi.session-info/display-name
:psi.session-info/created
:psi.session-info/updated
:psi.session-info/parent-session-id
:psi.session-info/worktree-path]}]"}
{:action "mutate"
:mutation "psi.extension/close-session"
:params {:session-id "8fe9b0a6-ad8a-4373-9478-557e537499f2"}}
Eval is namespace-scoped, not worktree-scoped.
Requirements:
ns is requiredns must already be loadedpsi-tool does not auto-require or auto-create namespaces*read-eval* disabledExample:
{:action "eval"
:ns "clojure.core"
:form "(+ 1 2)"}
For psi self-development, reload is worktree-authoritative.
Interpretation:
:psi.agent-session/worktree-path is the invoking session worktreeReliable self-reload loop:
Examples:
{:action "query"
:query "[:psi.agent-session/worktree-path]"}
{:action "reload-code"
:namespaces ["psi.prompt-assets.system-prompt"]}
reload-code supports exactly one targeting mode:
{:action "reload-code"
:namespaces ["psi.agent-session.tools"]}
{:action "reload-code"}
{:action "reload-code"
:worktree-path "/abs/path/to/worktree"}
Rules:
namespacesnamespaces are supplied, the effective target worktree-path defaults to:
worktree-path:worktree-pathnamespaces are omitted, reload-code operates in worktree modeworktree-path:worktree-pathCan you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |