If I replace modify with retract &assert as below:
(defrule time_flies
?h <- (human (energy ?energy))
=>
(retract ?h)
(assert (human (energy (+ ?energy (random -3 3))))))
A new human is created infinitely with energy changing as expected and an increasing index. Maybe the combination of modify and random is the problem?
Then I tried using other function like simple /:
(defrule time_flies
?h <- (human (energy ?energy))
=>
(modify ?h (energy (+ ?energy (/ ?energy 2)))))
With fact: (assert (human (energy 1)))
It ends almost instantly with energy set to inf.0!
After slowing down the process to (/ ?energy 20000), it used several seconds to reach inf.0, and ends by itself. If change to retract&assert, it goes infinitely even after energy reaches inf.0.
This seems like another issue though, as the case with random function didn't involve inf.0.