The classic textbook Structure and Interpretation of Computer Programs has a chapter on implementing a logic programming language embedded in Scheme. [source: https://mitpress.mit.edu/sites/default/files/sicp/full-text/...]

While SICP is certainly a great book, more direct to the topic would be a different classic:

Norvig's Paradigms of AI Programming is purely about creating logic & unification systems in Lisp, and the foundation of many codebases still in use today.

https://github.com/norvig/paip-lisp