Hello,
The main idea is to separate the solver from the individual integration rules.
Currently, rules recursively invoke one another, which has led to a number of recurring problems over time: manual propagation of state (e.g. the recent branch contextvars work), loop detection, repeated transformations, and increasing coordination between rules despite there being no shared solver state.
The proposal is for rules to become largely stateless; they simply describe a single transformation, while a central solver manages recursion, branching, visited expressions, rule scheduling, rewrite preferences, and other global concerns.
This is not intended as a concrete implementation proposal yet, but rather as a discussion about whether this is the right long-term direction for manualintegrate. The issue also raises several design questions, including what state the solver should track and how rule priorities and branching should be represented.
I'd appreciate any thoughts or feedback, especially from people who have worked on the integration code before.
Thanks!