Psi exposes a self-describing EQL graph at session root. This graph surface is intended to help humans and future ψ discover what is queryable before guessing attribute names or internal paths.
The graph surface provides:
- a compact summary of registered resolvers and mutations
- a capability-oriented graph view over the live query system
- a canonical list of attrs reachable from session-root seeds
- a stable discovery workflow for interactive querying
This is a capability graph.
- Nodes represent operations and domain capabilities.
- Edges represent operation -> capability membership.
- Edge
:attributevalues annotate those edges with operation IO attrs.
This is not a full dependency graph.
- Edges do not represent resolver dependency flow.
- Edges do not represent attr-to-resolver links as standalone nodes.
- Edges do not directly encode root reachability.
When exploring a running psi instance, prefer this sequence:
- Query the graph surface for discovery metadata.
- Read
:psi.graph/root-queryable-attrs. - Read
:psi.graph/capabilitiesand:psi.graph/domain-coverage. - Query the discovered attrs directly.
Examples:
[:psi.graph/root-seeds]
[:psi.graph/root-queryable-attrs]
[:psi.graph/capabilities]
[:psi.graph/domain-coverage]Then query discovered attrs directly, for example:
[:psi.agent-session/phase :psi.agent-session/model]
[:git.repo/status :git.worktree/count]
[:psi.memory/status]Session-admin discovery example:
[:psi.runtime-session/active-id
{: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]}]Canonical session-admin flow:
- query
:psi.runtime-session/active-id - query
:psi.agent-session/context-session-summaries - choose explicit non-active session ids in caller logic
- invoke
psi-tool(action: "mutate")withpsi.extension/close-session
This keeps target selection explicit in caller logic while routing the actual write through the same registered mutation path the runtime already owns.
Prompt lifecycle introspection example:
[:psi.agent-session/last-prepared-turn-id
:psi.agent-session/last-prepared-message-count
:psi.agent-session/last-execution-turn-id
:psi.agent-session/last-execution-turn-outcome
:psi.agent-session/last-execution-stop-reason]Notable session-admin root attrs include:
:psi.runtime-session/active-id— the invoking runtime session id from the live query context:psi.runtime-session/list— the explicit in-memory runtime session inventory:psi.runtime-session/count— the in-memory runtime session count:psi.persisted-session/list— the persisted session inventory for the current worktree:psi.persisted-session/list-all— the persisted session inventory across all project directories:psi.agent-session/context-session-summaries— compact live runtime context summary for safe operational selection
The root context attrs injected for session-root querying.
Current seeds are:
:psi/agent-session-ctx:psi/memory-ctx:psi/recursion-ctx:psi/engine-ctx
These seeds are diagnostic/discovery information. They are not included in
:psi.graph/root-queryable-attrs.
A sorted vector of keyword attrs reachable from the root seeds via resolvers.
Contract:
- derived by fixed-point reachability
- resolver outputs only
- mutations do not contribute
- seed attrs themselves are excluded
- only keyword attrs are returned
- sorted for deterministic discovery
Count of registered resolver operations in the introspected graph.
Count of registered mutation operations in the introspected graph.
Set of qualified resolver symbols.
Set of qualified mutation symbols.
Boolean indicating that a non-empty introspection graph/env is available.
This should be read as a practical readiness signal for graph discovery, not as proof of a stronger internal compiler lifecycle state.
Vector of graph nodes.
Node types are restricted to:
:resolver:mutation:capability
Typical node fields include:
:id:type:domain:symbolfor operation nodes:operation-countfor capability nodes
Vector of graph edges.
Each edge includes:
:from:to:attribute
Edge semantics:
:fromis an operation node id:tois a capability node id:attributeannotates the edge with one IO attr from that operation
:attribute may be:
- a keyword attr
- a join map attr
nilwhen an operation has no IO attrs
Rich per-domain summaries for domains present in the graph.
Typical fields include:
:id:domain:operation-count:resolver-count:mutation-count:operation-symbols:attributes
This surface is useful when you want a richer picture of what a domain exposes.
Normalized per-domain operation counts.
Fields:
:domain:operation-count:resolver-count:mutation-count
This surface differs from :psi.graph/capabilities:
capabilitiesreports only domains present in the graphdomain-coverageincludes required zero-count domains
Current required domains are:
:ai:history:agent-session:introspection
[:psi.graph/resolver-count
:psi.graph/mutation-count
:psi.graph/resolver-syms
:psi.graph/mutation-syms
:psi.graph/env-built
:psi.graph/nodes
:psi.graph/edges
:psi.graph/capabilities
:psi.graph/domain-coverage][:psi.graph/root-seeds
:psi.graph/root-queryable-attrs][:psi.graph/capabilities
:psi.graph/domain-coverage][:git.worktree/list
:git.worktree/current
:git.worktree/count
:git.worktree/inside-repo?]Implementation:
components/agent-session/src/psi/agent_session/resolvers.cljcomponents/introspection/src/psi/introspection/graph.clj
Tests:
components/agent-session/test/psi/agent_session/graph_surface_test.cljcomponents/introspection/test/psi/introspection/graph_test.clj