       (swap! env update-in [:kn]
              (fn [cur]
                (-> cur
-                   ((datalog/chain (:cleanup-rules @env)))
+                   ((:cleanup-rules @env))
                    (datalog/and-now)
                    (datalog/assert-many feed-set)
                    (datalog/and-now)

    env))

(defn ->env [opts]
  (atom (merge {:tick-rules []
                :cleanup-rules []
                :rules []
                :watchers @watchers
                :feed (array)
                :queued? false}
               opts
               {:kn (datalog/Knowledge. (:kn opts #{}) #{} #{})})))

(defn run-env [opts]
  (-> opts

                   (datalog/fixpoint (datalog/chain stratum)))))

(defn tick [kn tick-rules rules watchers feeder-fn]
  (let [kn (-> kn (tick-rules) (rules))]
    (doseq [watch watchers]
      (watch kn feeder-fn))
    (datalog/and-now kn)))
