-
-
Notifications
You must be signed in to change notification settings - Fork 41
Description
π‘ Summary
Add terminal scrollback buffer to the LLM user prompt and consider removing the inclusion of file contents.
π¨ Details
In Ghostty, there is no API, so I used built-in function to extract the scrollback into a file, put the path of the scrollback file into the prompt and then call a fish function which takes that path and replaces it with the content.
Ghostty setup: https://codeberg.org/00sapo/dotfiles/src/commit/d03eebe10939702b71034edda597f56124a41754/home/dot_config/ghostty/config#L35-L36
Fish function: https://codeberg.org/00sapo/dotfiles/src/branch/main/home/dot_config/private_fish/functions/fish_ai_with_scrollback.fish
I don't think this is an elegant solution, honestly.
In wezterm, there are usable API that I had integrated into a plugin. We could do something similar. Reference: https://github.com/Michal1993r/ai-helper.wezterm/blob/68ce596a822761eb796d40646bb8d02f94f7155e/plugin/init.lua#L168-L176
Another option is to start script when fish-ai is started, so we can always access the "scrollback" and send the last N lines to the AI. This solution would be more general, but would probably impact the performance of the user's shell [1].
π References
[1] #531 (comment)