I use pi from Emacs, via its RPC interface (I hate TUIs). I've replaced pi's reading/writing tools with alternatives which invoke emacsclient. That way:
- Emacs buffers remain up to date (rather than the on-disk content changing underneath it).
- I can use ordinary undo, etc. on changes made by pi.
- Various editor conveniences are automatically applied, e.g. auto-formatting of code; showing the contents of compressed files; etc.
- The LLM is given extra metadata, like warnings from linters/compilers/LSP/etc.
- The same tools work for buffers which aren't files (e.g. shells, Web browser, etc.)