An Org Babel library for sending prompts to an already running Aider.el or Aidermacs buffer directly from Org mode source blocks.
ob-aider.el
allows you to interact with aider.el or Aidermacs directly from Org mode documents. This enables you to:
- Document your AI-assisted coding sessions in Org mode
- Send prompts to Aider from within your Org documents
- Create reproducible AI-assisted coding workflows
- Utilize GPtel to write prompts to send to Aider.
- Emacs 27.1 or later
- Org mode 9.4 or later
- One of the following:
- For Aidermacs vterm support: vterm
- Clone this repository:
git clone https://github.com/localredhead/ob-aider.el.git
- Add the following to your Emacs configuration:
(add-to-list 'load-path "/path/to/ob-aider") (require 'ob-aider) ;; Enable aider in org-babel (with-eval-after-load 'org (org-babel-do-load-languages 'org-babel-load-languages (append org-babel-load-languages '((aider . t)))))
(use-package ob-aider
:straight (:host github :repo "localredhead/ob-aider.el")
:after org
:config
(org-babel-do-load-languages
'org-babel-load-languages
(append org-babel-load-languages
'((aider . t)))))
In your ~/.doom.d/packages.el
file, add:
If using melpa:
(package! ob-aider)
Or directly from GH:
(package! ob-aider
:recipe (:host github :repo "localredhead/ob-aider.el"))
Then in your ~/.doom.d/config.el
file, add:
(use-package! ob-aider
:after org
:config
(add-to-list 'org-babel-load-languages '(aider . t))
(org-babel-do-load-languages 'org-babel-load-languages org-babel-load-languages))
Then run doom sync
to install the package.
- Start an Aider session using
M-x aider-start
or an Aidermacs session usingM-x aidermacs
. - In your Org document, create an Aider source block:
#+begin_src aider Please refactor this function to be more efficient... #+end_src
- Execute the block with
C-c C-c
to send the prompt to the active Aider session. - The prompt will be sent to the Aider or Aidermacs buffer. Check that buffer for the response.
- No active Aider or Aidermacs conversation buffer found: Make sure you have started an Aider or Aidermacs session before executing an Aider source block.
One of the most powerful workflows enabled by ob-aider
is the combination with GPTel or similar Emacs LLM interfaces. This creates a seamless AI-assisted development environment:
The combination of GPTel and ob-aider creates a synergistic workflow where:
- GPTel helps you craft and refine prompts within your Org document
- ob-aider sends those refined prompts to your Aider session for code generation and modification
- Org mode documents the entire process in a single, executable document
This workflow allows you to leverage different AI tools for their respective strengths - using a general-purpose LLM to help formulate effective prompts for the code-focused Aider tool. The entire conversation history, thought process, and resulting code changes are preserved in a single Org document that can be shared, revisited, or modified later.
This integration transforms your Org documents into interactive AI-assisted development environments, where you can seamlessly move between brainstorming, prompt refinement, code generation, and documentation - all while maintaining a complete record of your development process.
This project would not be possible without the following amazing tools:
- GPTel - An elegant and efficient Emacs interface to OpenAI’s GPT and other LLMs
- Aider.el - Emacs interface for Aider, the AI pair programming tool
- Aidermacs - Another Emacs interface for Aider
- Org Mode - For its incredible Babel framework that makes this integration possible
Special thanks to the developers of these tools for their contributions to the Emacs ecosystem and for making AI-assisted development more accessible within our favorite editor.
- aider.el for the Aider Emacs integration
- Aidermacs for Aider integration
- Org Babel for the literate programming framework
- This project was 100% developed with the assistance of Claude 3 Opus and Claude 3 Sonnet, demonstrating the potential of AI-assisted development
- The entire project was developed using GPTel to write prompts and Aider.el, showcasing the power of AI pair programming