Have you checked out any of the minikanren logic programming environments people have implemented in scheme?
The Reasoned Schemer is an accessible introduction to that space if you’re not put off by the socratic-themed dialogue.
& the Barliman demo is still pretty exciting even after LLM codegen.