Feature request - templates for aider
Issue
Some inspiration could be taken from https://github.com/simonw/llm by Simon Willison, his LLM tool allows the creation of plugins (#1814) . He also has a prompt template system that allows users to save prompt templates. This can be used to interesting effect, for example (note in this example I wrote it out in full without using a template for clarity):
#!/bin/sh
llm -s "Output the keystrokes required to achieve the following task in vim. Answer in as few words as possible. Print the keystrokes, then on a newline print a succinct explanation." -m claude-3.5-sonnet "$*"
I alias that script to vh and then use it like this:
~$ vh copy line under cursor
yy Yank (copy) the current line
I think that custom commands would be handy for aider, for example when using aider as interactive help for itself, the following command would be handy to check what's new in aider:
/run git log --since="1 month ago" --pretty=format:"%h - %s" --grep="feature\|add\|new"
it would be handy to save things like that, but they're probably not worthy of a plugin - therefore ability to save them as a template would be handy.
Version and model info
No response
Possible related issues: #1745 #1704
I think that custom commands would be handy for aider, for example when using aider as interactive help for itself, the following command would be handy to check what's new in aider:
/run git log --since="1 month ago" --pretty=format:"%h - %s" --grep="feature\|add\|new"
Another "trick" to get the latest changes is something like this (being in the aider repository root and on the current main branch) ->
$ git diff HEAD~100 aider/website/HISTORY.md
The raw git commit log is a bit too noisy for this, IMHO.
If you leave out the path specifier, this also works to summarize changes in aider in general, as the commit log is often not helpful in this regard. Hypothetically ->
$ git diff v0.57.1 | llm -s "Summarize the supplied git diff changes briefly"
Of course you can specific an amount of commits relative to the current HEAD like in the first example instead of the git tag v0.57.1 for this, or even a specific commit id.
For bigger ranges it may be helpful to check the size of the git diff first before sending it to the LLM ->
$ git diff v0.57.1 | wc
6492 24095 217919
I've also found lot of good info in the issues and PRs; these can be explored with gh
gh pr list --state merged --limit 10
I've also found lot of good info in the issues and PRs; these can be explored with
gh
gh pr list --state merged --limit 10
You will only see outside contributions this way, not Paul's changes (which are the vast majority).
@lockmeister Also, you can simply use up-arrow or control-r to search for previous commands you have input. You can then re-use them easily.
This doesn't directly address this issue, but I was curious to see how far I could push LLM assuming prompt templates won't be implemented in aider anytime soon.
My usecase is that overtime my git repo of markdown notes becomes very disorganized. I want to use llm to suggest a new repository structure.
I can't make use of aider --show-repo-map because I have a bunch of "Has it been deleted from the file system but not from git?" messages. This is because I'm using obsidian.md's sync feature to sync markdown files between machines. However, only one machine is committing and pushing changes to a github repo, the other machines do not push or pull changes because this would frequently cause a lot of git conflicts due to the timing of the obsidian's syncing. So the other machines end up with lots of dirty git working trees, but get the latest changes via obsidian sync.
Assuming llm is already installed, I also want to install llm-echo.
llm install llm-echo
llm -m echo is just outputting to stdout what was sent via stdin. Instead of using aider --show-repo-map, I use git ls-files. Here's an example to output filenames in a git dir, ignoring files in .gitignore and .aiderignore.
git ls-files --others --exclude-standard --exclude-from=.aiderignore \
| llm -m echo --no-log | jq .prompt -r
When I'm ready to run llm, I just run something like this
git ls-files --others --exclude-standard --exclude-from=.aiderignore \
| llm -s "Please suggest a new directory structure"
The above command could just be added to a bash file and then aider can run the bash file and add the output of the llm command to aider's context.
It's also possible to use prompt templates with llm, which was already mentioned above. Here is the link to that https://llm.datasette.io/en/stable/templates.html.
Also, you can simply use up-arrow or control-r to search for previous commands you have input. You can then re-use them easily.
I have prompts that I use frequently across many repositories. Would be good to be able to say:
/prompt my-prompt-name and have it auto-inserted.