aider icon indicating copy to clipboard operation
aider copied to clipboard

Add "pre" and "post" handlers

Open robbintt opened this issue 4 months ago • 5 comments

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.py handler)
  • 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"
Screenshot 2025-08-27 at 08 51 18

Loaded handlers are visible at startup, otherwise the line is not shown:

Screenshot 2025-08-27 at 13 07 03

robbintt avatar Aug 27 '25 15:08 robbintt

Example of missing handler:

Screenshot 2025-08-27 at 08 52 33

robbintt avatar Aug 27 '25 15:08 robbintt

I think this might be a great upgrade for Aider - as long as it is optional, why not?

tomjuggler avatar Sep 22 '25 19:09 tomjuggler

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.

robbintt avatar Oct 01 '25 16:10 robbintt

love the idea, I'm looking also for extending aider without changing upstream nor forking.

ant31 avatar Oct 10 '25 17:10 ant31

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

ant31 avatar Oct 11 '25 09:10 ant31

Aider seems to be in maintenance mode, as such this PR is now closed.

robbintt avatar Nov 16 '25 14:11 robbintt

@robbintt Yes, are you forking the project/switching to different tool? I think this PR was really needed in term of feature :(

ant31 avatar Nov 17 '25 09:11 ant31

I think this pr was merged into https://github.com/dwash96/aider-ce

tomatrow avatar Nov 17 '25 20:11 tomatrow