feat: give commands the ability to execute logic#63
Conversation
* main: fix: typo in exchange method `rewind` (#54) fix: remove unsafe pop of messages (#47) chore: Update LICENSE (#53) chore(docs): update is_dangerous_command method description (#48) refactor: improve safety rails speed and prompt (#45) feat: make goosehints jinja templated (#43) ci: enforce PR title follows conventional commit (#14) feat: show available toolkits (#37) adding in ability to provide per repo hints (#32) Apply ruff and add to CI (#40) added some regex based checks for dangerous commands (#38) chore: Update publish github workflow to check package versions before publishing (#19) chore: upgrade ai-exchange dependency (#36) fix: resuming sessions (#35) feat: upgrade `ai-exchange` to version `0.8.3` and fix tests (#34) fix: export metadata.plugins export should have valid module (#30) fix (#24) link to vs code extension (#20) Enable cli options for plugin (#22) Modified the readme to be more friendly to new users (#16)
|
a suggestion - would it be possible to detect and suggest a command a user could explore so they can accidentally discover it? One of the benefits of goose is that you ideally don't need to know how to drive it, commands start to bring more syntax/knowledge needed, so would be nice to be able to prompt people for that so it feels organic. |
michaelneale
left a comment
There was a problem hiding this comment.
am slightly wary of adding more non natural language style inputs to goose - but this seems nicely thought out
We were probably gonna work on surfacing features to users just in time, so we could work this in (if we decide to move forward with using commands). |
|
@lifeizhou-ap I know we had some discussion topics ongoing but the rest of the team is onboard - going ahead and merging this PR and we can follow up with any changes. |
* origin/main: docs: add in ollama (block#82) chore: add just command for releasing goose (block#55) feat: support markdown plans (block#79) feat: add version options (block#74) docs: fixing exchange url to public version (block#67) docs: Update CONTRIBUTING.md (block#69) chore: create mkdocs for goose (block#70) docs: fix broken link (block#71) feat: give commands the ability to execute logic (block#63) feat: jira toolkit (block#59) feat: run goose in a docker-style sandbox (block#44)
Current state of commands (before this PR)
Commands currently only serve autocompletion purposes. For example:

As it currently stands, commands do not trigger anything to occur when they are included in the prompt and enter is pressed.
Where does the
/filecommand currently fall short?The
/filecommand is included in the string that we will sent to the LLM, which introduces some uncertainty in regard to the user intent. This is because the LLM does not reliably know what a command such as/file:src/*means.How to remediate this?
1. ✅ Introduce a way for commands to modify their portion of the prompt that will be sent off
3. ❌ Indicate in the system prompt that commands exist, and that we should ignore the first portion of them (the command name)
Why did I choose 1 above?
Currently, only one command exists -
/file. However, we can imagine that folks may want to contribute other commands. Some of ideas of these may include:/rewind(:times)- rewinds until after the last user message. this would allow the user to remove an incorrect path the LLM went down, and instruct it in a different way./quorum:"set up 3 instances of goose that talk to this app and load test it"- this would make quorum more reliably be picked up (currently it is a toolkit that at times is not used despite indicating you want to use it)/add_toolkit:<toolkit_name>- adds a toolkit midway through a session's execution/checkpoint- adds a checkpoint to the exchange that you could revert back toAcross these commands, we notice different user intents:
/rewindand/checkpointtake an action on the exchange itself and should be scrubbed from the prompt sent to the LLM/quorumperforms some logic and returns a response string, which we would then add to the prompt sent to the LLM/add_toolkitalso takes an action on the exchange itself, but might also add onto the prompt sent to the LLM (indicating that we just added a new tool).From these examples, I see there is value in
/name:value)/name:valuewith a value determined by the commandThis led me to the signature for the
Command.executemethod:🤔 I don't like the above - what other options are there?
Option 1: instead of commands executing some logic, we could remove the
executemethod and only allow them to be used for autocompletion. We would need to make a small tweak so that only the value of the command is persisted in the prompt, not the command name itself.Option 2: completely remove the idea of commands, and either scrap the idea of file completions entirely, or just keep the file completion around and don't have it inherit from
Command