Skip to main content


The environment is a map containing contextual information, both from Pathom itself and from any user/library extensions.

Given the environment is a generic and open map, it makes more sense to talk about what features of Pathom you can see and interact with.

You can always add more things to the environment to suite your own needs.

Native features on environment



This attribute contains the atom with the current entity data. As Pathom processes the graph, new data gets merged into the entity.

You can find helpers to manipulate the entity in the com.wsscode.pathom3.entity-tree namespace.



This attribute controls if Pathom should use lenient mode instead of strict mode. For more details check the error handling page.


Indexes should be present in all environments, given they are the center for connect processing





For details on the indexes keys, check the indexes page.



This attribute tells you which is the path of the current run process. It is a vector telling the path from left to right. The following example does a simple demonstration of the path environment attribute.

(:require [com.wsscode.pathom3.connect.built-in.resolvers :as pbir]
[com.wsscode.pathom3.connect.indexes :as pci]
[com.wsscode.pathom3.connect.operation :as pco]
[com.wsscode.pathom3.interface.eql :as p.eql]
[com.wsscode.pathom3.path :as p.path]))

(pco/defresolver env-path [{::p.path/keys [path]} _]
{::p.path/path path})

(p.eql/process (pci/register [env-path
(pbir/constantly-resolver ::data
{::nested [{} {}]})])
{::data [::p.path/path
{::nested [::p.path/path]}]}])
; => {::p.path/path
; []
; ::data
; {::p.path/path
; [::data]
; ::nested
; [{::p.path/path [::data ::nested]}
; {::p.path/path [::data ::nested]}]}}



Contains the current execution plan in progress. You can find more details about the plan graph at the planner page.


The current execution node for the plan. This is useful to get more details from the resolver node run, like the parameters.


This is an optional attribute, when present the planner will cache plans on it.

Here is an example of how to define an environment with a plan cache:

(def indexes (pci/register ...))

(def env-with-cache (pcp/with-plan-cache indexes))

You can also create a shared cache and re-use in different environments:

(defonce plan-cache* (atom {}))

(def env-with-cache (pcp/with-plan-cache indexes plan-cache*))
(def other-env-with-cache (pcp/with-plan-cache other-indexes plan-cache*))