Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add mode for fully customizable system prompt template #1249

Conversation

jtorreggiani
Copy link
Collaborator

@jtorreggiani jtorreggiani commented Feb 15, 2025

Summary of changes

This PR introduces a custom system mode that enables full customization of the system prompt by defining a system.md template file in the ~/.config/goose directory.

The custom system prompt supports all of the context about the user's enabled extensions and the system prompt extensions (introduced in #1167) as the main system prompt in the goose source code. You can copy goose's core system.md as a starter and customize it to your needs.

Why enable full customizability?

When building personal assistants and rigorously testing reasoning and chain of thought strategies it is useful you have complete control on the entire system prompt. I do the locally by running goose from source and manually changed the source code system.md file. This change gives end users the same control over their system prompt.

Trade-offs

  • This PR only attempts enabling this functionality in the CLI client

@jtorreggiani jtorreggiani changed the title Add mode for fully customizable system prompt template feat: Add mode for fully customizable system prompt template Feb 15, 2025
@jtorreggiani jtorreggiani added enhancement New feature or request cli labels Feb 15, 2025
@@ -39,6 +39,8 @@ pub async fn build_session(
}
.expect("Failed to create agent");

let system_mode: Option<String> = config.get("GOOSE_SYSTEM_MODE").ok();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of checking the mode, can we check whether we have system file provided? If yes, we use it as the system prompt input file, if no, leave it empty. Right now other users must have the same file name system.md

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea that makes sense! Will push that change. Thanks for taking a look!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the updates! To simply the code, is it better to have followings?

let system_prompt_file: Option<String> = config.get("GOOSE_SYSTEM_PROMPT_FILE_PATH").ok();

if system_prompt_file is empty, we use the default file, so you don't need to override

How do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that works! I thought letting it autodetect the default path was less intrusive and left the goose config file alone for now. Happy to add this option. Should I add it to the configure tool in this PR as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yingjiehe-xyz I've pushed up changes to enable the GOOSE_SYSTEM_PROMPT_FILE_PATH option in the config file. It helped reduce the total number of line changes. Thanks for the suggestion!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

Copy link
Collaborator

@yingjiehe-xyz yingjiehe-xyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@cliffhall
Copy link

Please implement this.

We need easy and full control of the system prompt. I wasn't sure why it was so important until this morning.

I was just porting the agent communications protocol and instructions for GooseTeam so that I could finally see the agents use the new MCP server and execute their protocol instructions in order to collaborate. I had not yet put a message into the server, I just ran goose with the instructions, it assumed project coordinator role and since it had no marching orders, and it KNEW IT WAS MADE BY BLOCK it began planning how it could dream up some integrations between Square and CashApp!

Since_Block_Made_Me

@jtorreggiani jtorreggiani force-pushed the jtorreggiani/add-customizable-system-prompt-template branch from f08a360 to 340ef78 Compare February 20, 2025 02:33
@jtorreggiani jtorreggiani merged commit 9d20d88 into block:main Feb 20, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants