Feature Request: add an /ask command
Issue
Hi,
I've been using Aider for a while for coding and it's been really great!
I was wondering if it was possible to take advantage of the extensive engineering you did on aider to make a code base LLM friendly to allow the user to ask questions about the code.
The most recent example I have is that I stumbled upon a git repository where I wanted to add a new feature, but the original author didn't explain how to run the projecr. So I was wondering if it was possible to ask Aider to just tell me how I'm supposed to run it, for instance.
Something like /ask that would not use the diff prompts?
Thanks!
Version and model info
No response
While it is already good when asked questions (see: https://aider.chat/examples/2048-game.html) it also has many quirks and costs, like using context with the coding instructions which has a cost, if using blocks, it will often use SEARCH/REPLACE (equal) which wastes output token, which often fail retries making more and more calls. Or it modifies files, or asks to open files (which is sometimes ok, if it needs to explain them).
instead of ask commands, we could have modes, and these be abstracted. it could probably be beyond the scope, but imagine modes to be like:
/modes - provides a list of aider modes, which can be selected with @
People could eventually build their own @modes it finetune them (eg. @mode:custom_1). And eventually, @code could invoke other modes, such as @learn. Or @learn could plug in tools like pyright as a Language Server, and help with stubs of binaries, search, especially useful for large code bases, or as a way to @learn without having to open entire files.
This is a BIG wishlist item. In the meantime, I am enjoying the tool so much, and having a separate chat thru a different client when asking, brainstorming, etc. which is also frustrating as aider has all the context and makes us so spoiled.
about the context, cursor is also good, but what about making aider compatible with the openai api behaving like its own model with built-in context?
or if someone makes a standard to provide context to llms, aider would get the prompt, output the context only, and then we could pass that to any llm.
but aider could automate more the context file selection in the future
On Fri, 5 Jul 2024 at 18:48, fferreres @.***> wrote:
While it is already good when asked questions (see: https://aider.chat/examples/2048-game.html) it also has many quirks and costs, like using context with the coding instructions which has a cost, if using blocks, it will often use SEARCH/REPLACE (equal) which wastes output token, which often fail retries making more and more calls. Or it modifies files, or asks to open files (which is sometimes ok, if it needs to explain them).
instead of ask commands, we could have modes, and these be abstracted. it could probably be beyond the scope, but imagine modes to be like: /modes - provides a list of aider modes, which can be selected with @ @learn - mode used to ask questions about the code @code https://github.com/code - the default mode which focuses on coding according to a request @review https://github.com/review - mode used for code review, testing and bugfixing @brainstorm https://github.com/brainstorm - a mode that is used to diverge, then converge ideas that can then be easily saved or put to work ...
People could eventually build their own @modes https://github.com/modes it finetune them (eg. @mode https://github.com/mode:custom_1). And eventually, @code https://github.com/code could invoke other modes, such as @learn. Or @learn could plug in tools like pyright as a Language Server, and help with stubs of binaries, search, especially useful for large code bases, or as a way to @learn without having to open entire files.
This is a BIG wishlist item. In the meantime, I am enjoying the tool so much, and having a separate chat thru a different client when asking, brainstorming, etc. which is also frustrating as aider has all the context and makes us so spoiled.
— Reply to this email directly, view it on GitHub https://github.com/paul-gauthier/aider/issues/795#issuecomment-2211209269, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXJNRVX53HTA4DIDKTK62DZK3L5LAVCNFSM6AAAAABKNADABCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRGIYDSMRWHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>
there's a feature called --dry-run. when aider is run like that, it won't make changes to files. this is a safe mode, where you can ask anything, and at worst, i will rehearse what changes it would have made.
I am using aider to tailor aider.
I asked it to explain the flow and all changes impacted by the --dry-run flag, and once it did,, I asked to have a compatible version but that can be toggled at run-time. and it did that in a few seconds. in these cases, it helps to instruct it to not code anything when asked about the flow, but allow them to open all relevant files, because a chance like it affects 3 files and if it misses, for example, commands.py you end up with hardcoded things in the wrong place.
you can see the new feature here:
Note: to tailor aider (possible breaking it) with aider itself, I do this: python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git python -m pip install -e . git init
this makes it so any change to the code, also changes how aider works globally.
So to play with aider changing aider I also do: git branch playground git checkout playground
when i want aider vanila, I do: git checkout main
when a new version of aider is available, i search online how to merge from origin into my local main.
@paul-gauthier since you added the /help command, wouldn't it be easier to add /ask ?
Agreed that this would be ultra helpful. The current main limitation of Aider is unfortunately that it starts to code right away, often making it affect modules that shouldn't be affected.
I think specific command are not necessary. There is a need of more agents and an agent orchestrator (don't remember the proper concept).
The idea is to have an user facing agent that received any request (brainstorming, coding, planning, review, learn, extend reop map, etc etc). And agent that performs those specific tasks with a set of tools each.
That would be little bit slower due we have another call to a model, but we can solve many other problems without trying to force the coder agent (the current one) with other tasks which its not specialized.
Maybe we can take the role of the orchestrator using an specific agent directly with a command like /agent <agent_id>, and avoid the double llm call talking directly with an specialized AI as we wan't.
I want to do something quite similar, right now I need an AI agent to do planning before coding to break complex request into smaller problems that can be solved iteratively, before passing it to the coder.
I think specific command are not necessary. There is a need of more agents and an agent orchestrator (don't remember the proper concept).
The idea is to have an user facing agent that received any request (brainstorming, coding, planning, review, learn, extend reop map, etc etc). And agent that performs those specific tasks with a set of tools each.
That would be little bit slower due we have another call to a model, but we can solve many other problems without trying to force the coder agent (the current one) with other tasks which its not specialized.
Maybe we can take the role of the orchestrator using an specific agent directly with a command like /agent <agent_id>, and avoid the double llm call talking directly with an specialized AI as we wan't.
I want to do something quite similar, right now I need an AI agent to do planning before coding to break complex request into smaller problems that can be solved iteratively, before passing it to the coder.
I respectuflly disagree: to me this is out of scope because aider is already scriptable, so it would make more sense to create the orchestra outside of aider and add aider as a tool instead of adding this to aider. For example using a langchain agent to control aider.
But the "/ask" seems needed to me to have a way to make general requests that leverage aider's apparently unrivaled way to "parse" a whole project.
Srry, my answer was for the guy who proposed /modes. I find completely ok to have an /ask command that doesn't produce code.
There is a new /ask <question> command that lets you ask questions about your code without making any changes.
And a /chat-mode <mode> command that lets you switch chat modes (edit formats):
- diff: A coder that uses search/replace blocks for code modifications.
- diff-fenced: A coder that uses fenced search/replace blocks for code modifications.
- whole: A coder that operates on entire files for code modifications.
- udiff: A coder that uses unified diff format for code modifications.
- help: Interactive help and documentation about aider.
- ask: Ask questions about code without making any changes.
The change is available in the main branch. You can get it by installing the latest version from github:
python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git
If you have a chance to try it, let me know how it works for you.
Thanks this would help a lot, i tried new mode and its working great. Now able to have discussions without code changes.
Any chat done using /chat-mode ask and reverting back to coding mode using /chat-mode diff is retained in Context.
However if i switch back to diff mode it doesn't apply the discussed code change. I will try few more things and revert back with chat if it doesn't work.
I wanted to have discussion about code and then use that to come back to diff mode to now make code changes.
Thanks a lot it looks awesome!
One thing though, I don't think the user should have to know the type of editing mode used for coding because it depends on the model. What I mean is that if say I use the brand new sonnet from Anthropic, I don't know if by default aider determined it was best to use "diff", "whole", "udiff" etc. So after a /chat-mode ask, if I want to go back to coding but I don't know which mode was used I think there should be a /chat-mode code that use the model's default editing mode.
Yup. I had exactly that plan in mind including the psuedo-mode name "code". It's in the main branch now:
> /chat-mode
Chat mode should be one of these:
- help : Get help about using aider (usage, config, troubleshoot).
- ask : Ask questions about your code without making any changes.
- code : Ask for changes to your code (using the best edit format).
Or a valid edit format:
- diff : A coder that uses search/replace blocks for code modifications.
- diff-fenced : A coder that uses fenced search/replace blocks for code modifications.
- udiff : A coder that uses unified diff format for code modifications.
- whole : A coder that operates on entire files for code modifications.
I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.
@thiswillbeyourgithub @paul-gauthier
While using ask feature of aider, I had Thought that, is there a way that I can always start in ask mode. So we can discuss the problem and code first This will also build chain of thought and ramp up llm to solve the problem.
Once I feel that it has understood the problem, instead of slash ask, can I get slash code command to ask it to produce code? This means in most of the time I stay in ask mode while I check its responses and when it is ready, I ask him to code.
Let me know your thoughts on this workflow. .
You can run aider with --edit-format ask to launch in ask mode. And you can add that to your config files if you always want to start in ask.
Great But then to ask it to code once discussion is done I should Switch using /chat-mode code to now start coding. Is this Understanding Correct.
You can run aider with
--edit-format askto launch in ask mode. And you can add that to your config files if you always want to start in ask.
Yup.
this is excellent. can't wait to try it out.
On Mon, Jul 29, 2024 at 6:38 AM paul-gauthier @.***> wrote:
Yup. I had exactly that plan in mind including the psuedo-mode name "code". It's in the main branch now:
/chat-mode
Chat mode should be one of these:
- help : Get help about using aider (usage, config, troubleshoot).
- ask : Ask questions about your code without making any changes.
- code : Ask for changes to your code (using the best edit format).
Or a valid edit format:
- diff : A coder that uses search/replace blocks for code modifications.
- diff-fenced : A coder that uses fenced search/replace blocks for code modifications.
- udiff : A coder that uses unified diff format for code modifications.
- whole : A coder that operates on entire files for code modifications.
— Reply to this email directly, view it on GitHub https://github.com/paul-gauthier/aider/issues/795#issuecomment-2255584336, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7O5LSBFKMBWIDC7RNIG4DZOYLSVAVCNFSM6AAAAABKNADABCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJVGU4DIMZTGY . You are receiving this because you commented.Message ID: @.***>