                                                     (< (- good-pri) (:reward-to-state node)) :sbn
                                                     :else                                    :dbn)))
                                           bad-nodes)]
+;              (println (apply str (repeat depth \ )) (count good-nodes) (count nbn) (count dbn) (count sbn))
+              (reset! (:rec-context-atom entry) (:rec-context rec))
               (doseq [n good-nodes]       (queues/g-pq-add! good-queue n (- (:reward-to-state n))))
               (doseq [n (concat nbn sbn)] (queues/g-pq-add! bad-queue  n (- (:reward-to-state n))))
               (when (> (:cutoff rec) Double/NEGATIVE_INFINITY)

              {:keys [clean dirtied still-dirty]} 
                (util/group-by (fn [[s r]] (classify-result-type r (:min-cycle-depth (:entry (meta s))) cutoff-depth-map))
                          new-results)]
          (swap! (:result-map-atom node) (partial merge-safe >=) (into {} clean))

          (when (= (first (env/action-name (:action node))) 'nav)
            (let [[_ dx dy] (env/action-name (:action node))]
              (doseq [[ss sr] (stitch-effect-map clean state 0 #_ reward-to-state)]
;                (println ss sr clean new-results (env/action-name (:action node)))
                (let [[sx sy] (map #(env/get-var state %) '[[atx] [aty]])]
                  (when-not (= (- sr) (+ (util/abs (- sx dx)) (util/abs (- sy dy))))
                     (println [sx sy] [dx dy] sr (:min-cycle-depth (:entry (meta ss))) reward-to-state) #_ (dr/debug-repl))))))
          
          (doseq [entry (concat good-roots (map #(:entry (meta (key %))) dirtied))] 
            (assert (util/xor (not (:sanode entry)) (:cutoff (meta entry))))

    (do (assert (pred (get m k) v)) m)
    (assoc m k v)))



(defn extract-effect [state context opt]
