Reminds me of git-absorb, which is a non-AI version of part of this.
https://github.com/tummychow/git-absorb