It would improve efficiency if we could detect if an (almost) empty plan with just a last call to a goal -- with NO free variables -- has already appeared in the intention, and in that case delete the top of the intended means before pushing another instance on top; to be more clear, in this intention:
6. +!g2 <- ...
5. +!g1(X) <- !g2.
4. +!g1(X) <- !g1(X).
3. +!g1(X) <- !g1(X).
2. +!g1(X) <- !g1(X).
1. +!g0 <- !g1(X); !g3(X); a1.
lines (3) and (4) serve no purpose. We need (2) e.g. in case a plan fails and the agent needs to know what it was trying to do, or to drop goals, etc. but removing lines like (3) and (4) the only information we lose is how many recursive calls took place (which isn't useful information anyway, in principle).
done at Jason 1.4.0