Add "pre" and "post" handlers
Add handlers to Aider to improve extensibility and take pressure off the existing feature backlog.
These handlers are all hooks. I kept the more general term so it is more extensible.
Handlers are appropriate for many use cases:
- Existing pre and post actions should be moved to handlers (see included
autotest_handler.pyhandler) - MCP and other calls can be added to a pre-handler without extensive code changes
- Potential for extension to any other desired entrypoint, such as tool calls analyzing the generation stream for early completion or cancellation
Example .aider.conf.yml section:
handlers:
- name: file-adder
config:
reflections: 6
model: gemini/gemini-2.5-flash
- name: autotest
config:
test_cmd: "echo noop"
Loaded handlers are visible at startup, otherwise the line is not shown:
Example of missing handler:
I think this might be a great upgrade for Aider - as long as it is optional, why not?
I think this might be a great upgrade for Aider - as long as it is optional, why not?
Yes, it's a noop until configured.
love the idea, I'm looking also for extending aider without changing upstream nor forking.
I've many prompt that I nearly always use after changes (e.g update the changelog, write migration plan for the breaking changes, /run git --no-pager diff + review the changes etc.... , or even jsut the 'add tests'. Small unit of work are performing better, being able to chain them will make this tool awesome.
Thank you for the idea, and PR can't wait to see it merged
Aider seems to be in maintenance mode, as such this PR is now closed.
@robbintt Yes, are you forking the project/switching to different tool? I think this PR was really needed in term of feature :(
I think this pr was merged into https://github.com/dwash96/aider-ce