-
Notifications
You must be signed in to change notification settings - Fork 2.5k
User configurable templates #6420
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR simplifies the prompt templating system and enables user customization of prompts. The changes introduce a new explicit template registry, replace the global environment approach with on-demand rendering, and add API endpoints for managing prompt customizations.
Key changes:
- Refactored
prompt_template.rsto use an explicit registry and support user-customized templates stored in the config directory - Added new "Prompts" settings tab in the desktop UI with API integration for CRUD operations
- Renamed
summarize_oneshot.mdtocompaction.mdand removed unused template files
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/desktop/src/components/settings/SettingsView.tsx | Adds new Prompts tab to settings with FileText icon |
| ui/desktop/src/api/types.gen.ts | Adds TypeScript types for prompt API responses and requests |
| ui/desktop/src/api/sdk.gen.ts | Adds API client functions for prompt management endpoints |
| ui/desktop/openapi.json | Defines OpenAPI schemas for prompt management endpoints |
| crates/goose/src/prompts/compaction.md | New template for conversation summarization (replaces summarize_oneshot.md) |
| crates/goose/src/prompts/system_gpt_4.1.md | Removed unused template file |
| crates/goose/src/prompts/mock.md | Removed test-only template file |
| crates/goose/src/prompt_template.rs | Complete refactor with explicit registry and user customization support |
| crates/goose/src/permission/permission_judge.rs | Updated to use new render_template function |
| crates/goose/src/context_mgmt/mod.rs | Updated to use compaction.md template |
| crates/goose/src/agents/subagent_handler.rs | Updated to use new render_template function |
| crates/goose/src/agents/prompt_manager.rs | Updated to use new render_template function |
| crates/goose/src/agents/extension_manager.rs | Updated to use new render_template function |
| crates/goose-server/src/routes/recipe_utils.rs | Updated to use new render_template function |
| crates/goose-server/src/routes/mod.rs | Adds prompts module to router configuration |
| crates/goose-server/src/routes/agent.rs | Updated to use new render_template function |
| crates/goose-server/src/openapi.rs | Registers prompt-related types and endpoints in OpenAPI spec |
| pub mod errors; | ||
| pub mod mcp_app_proxy; | ||
| pub mod mcp_ui_proxy; | ||
| pub mod prompts; |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module routes::prompts is declared and merged into the router, but the actual implementation file crates/goose-server/src/routes/prompts.rs does not exist. This will cause a compilation failure. The file needs to be created with implementations for get_prompts, get_prompt, save_prompt, reset_prompt, and reset_all_prompts handlers.
| super::routes::agent::start_agent, | ||
| super::routes::agent::resume_agent, | ||
| super::routes::agent::restart_agent, |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reset_all_prompts operation is missing from the OpenAPI handlers list. While the OpenAPI schema defines this endpoint, it's not registered in the paths array, which means it won't be accessible. Add super::routes::prompts::reset_all_prompts to the paths array (likely after line 358).
| super::routes::agent::start_agent, | |
| super::routes::agent::resume_agent, | |
| super::routes::agent::restart_agent, | |
| super::routes::prompts::reset_all_prompts, | |
| super::routes::agent::start_agent, | |
| super::routes::agent::resume_agent, |
| import ExternalBackendSection from './app/ExternalBackendSection'; | ||
| import AppSettingsSection from './app/AppSettingsSection'; | ||
| import ConfigSettings from './config/ConfigSettings'; | ||
| import PromptsSettingsSection from './prompts/PromptsSettingsSection'; |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The imported component PromptsSettingsSection does not exist in the codebase. This will cause a build failure. The component needs to be created at ui/desktop/src/components/settings/prompts/PromptsSettingsSection.tsx before this import can work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 6 comments.
| const handleBack = () => { | ||
| setSelectedPrompt(null); | ||
| setPromptData(null); | ||
| setContent(''); | ||
| }; |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the user clicks "Back to List" while editing a prompt, there's no check for unsaved changes. If the user has modified the content but not saved it, those changes are lost without warning. Add a confirmation dialog when hasChanges is true before executing handleBack.
| })?; | ||
|
|
||
| Ok(Json(format!("Reset prompt to default: {}", name))) | ||
| } | ||
|
|
||
| pub fn routes() -> Router { | ||
| Router::new() |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new prompts routes lack test coverage. Other routes in this codebase include tests for their endpoint handlers (see action_required.rs, audio.rs, config_management.rs, recipe.rs, reply.rs). Add tests to verify the behavior of get_prompts, get_prompt, save_prompt, and reset_prompt handlers.
| onClick={handleRestoreDefault} | ||
| className="text-xs" | ||
| > | ||
| View Default |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "View Default" button text is misleading - it replaces the current editor content with the default without warning or confirmation, potentially discarding unsaved changes. Either rename it to "Restore Default" to match its action, or implement a proper view-only mode that doesn't modify the editor content.
| View Default | |
| Restore Default |
| Customize the prompts that define goose's behavior in different contexts. These | ||
| prompts use Jinja2 templating syntax. Be careful when modifying template variables, | ||
| as incorrect changes can break functionality. Please share any improvements with the | ||
| community |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing period at the end of the sentence. The text should end with "community."
| community | |
| community. |
| use utoipa::ToSchema; | ||
|
|
||
| #[derive(Serialize, ToSchema)] | ||
| pub struct PromptsListResponse { |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend returns Template structs containing full prompt content (default_content and user_content), but the OpenAPI spec defines PromptInfo which only includes name, description, and is_customized. This creates an API contract mismatch where clients receive more data than documented. Create a separate PromptInfo struct or update the OpenAPI spec to match the actual response.
| }, | ||
| "/config/prompts/{name}": { | ||
| "get": { | ||
| "tags": [ | ||
| "super::routes::prompts" | ||
| ], | ||
| "operationId": "get_prompt", | ||
| "parameters": [ | ||
| { | ||
| "name": "name", | ||
| "in": "path", | ||
| "description": "Prompt template name (e.g., system.md)", | ||
| "required": true, | ||
| "schema": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| ], | ||
| "responses": { | ||
| "200": { | ||
| "description": "Prompt content retrieved successfully", | ||
| "content": { |
Copilot
AI
Jan 9, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OpenAPI spec defines a DELETE operation with operationId "reset_all_prompts" on the /config/prompts endpoint, but there's no corresponding backend handler registered in the router. The frontend works around this by calling resetPrompt for each customized prompt individually. Either implement the backend endpoint or remove it from the OpenAPI spec.
alexhancock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a good improvement and I like the configurability!
I do wonder if we should now include edited template content in diagnostic reports. It feels like we cannot guarantee good behavior as much once people start editing content of these.
| ), | ||
| ( | ||
| "plan.md", | ||
| "Prompt used when goose creates step-by-step plans. CLI only", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not specifically related to this changeset but why is this CLI only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. the CLI has a plan mode, the desktop does not
they should be part of the llm logs, but yeah, should be easy enough to do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 22 out of 23 changed files in this pull request and generated no new comments.
…ovider * 'main' of github.com:block/goose: increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531)
* main: increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531) Fix path for global agent skills (#6591) recipes: add mcp server (#6552) feat(gcp-vertex): add model list with org policy filtering (#6393) chore: encourage extension searching (#6582) blog: mobile apps consolidation and roadmap (#6580) chore: remove unused dependencies in cargo.toml (#6561) resolved all the extensions to load in cli (#6464)
* main: (41 commits) chore: tweak release docs (#6571) fix(goose): propagate session_id across providers and MCP (#6584) increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531) Fix path for global agent skills (#6591) recipes: add mcp server (#6552) feat(gcp-vertex): add model list with org policy filtering (#6393) chore: encourage extension searching (#6582) blog: mobile apps consolidation and roadmap (#6580) chore: remove unused dependencies in cargo.toml (#6561) ...
* main: (68 commits) fix(docs): use dynamic import for globby ESM module (#6636) chore: trigger CI Document tab completion (#6635) Install goose-mcp crate dependencies (#6632) feat(goose): standardize agent-session-id for session correlation (#6626) chore: tweak release docs (#6571) fix(goose): propagate session_id across providers and MCP (#6584) increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531) Fix path for global agent skills (#6591) ...
* main: (68 commits) fix(docs): use dynamic import for globby ESM module (#6636) chore: trigger CI Document tab completion (#6635) Install goose-mcp crate dependencies (#6632) feat(goose): standardize agent-session-id for session correlation (#6626) chore: tweak release docs (#6571) fix(goose): propagate session_id across providers and MCP (#6584) increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531) Fix path for global agent skills (#6591) ...
* main: (68 commits) fix(docs): use dynamic import for globby ESM module (#6636) chore: trigger CI Document tab completion (#6635) Install goose-mcp crate dependencies (#6632) feat(goose): standardize agent-session-id for session correlation (#6626) chore: tweak release docs (#6571) fix(goose): propagate session_id across providers and MCP (#6584) increase worker threads for ci (#6614) docs: todo tutorial update (#6613) Added goose doc map md file for goose agent to find relevant doc easily. (#6598) add back goose branding to home (#6617) fix: actually set the working dir for extensions from session (#6612) Multi chat (#6428) Lifei/fixed accumulated token count (#6587) Dont show MCP UI/Apps until tool is approved (#6492) docs: max tokens config (#6596) User configurable templates (#6420) docs: http proxy environment variables (#6594) feat: exclude subagent tool from code_execution filtering (#6531) Fix path for global agent skills (#6591) ...
Co-authored-by: Douwe Osinga <douwe@squareup.com> Signed-off-by: fbalicchia <fbalicchia@cuebiq.com>
Summary
Simplify how we do templating and make it possible for users to edit prompts
Example
Change the system prompt to make replies in Dutch by default: