Conversation
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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.
| const handleBack = () => { | ||
| setSelectedPrompt(null); | ||
| setPromptData(null); | ||
| setContent(''); | ||
| }; |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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.
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.
not specifically related to this changeset but why is this CLI only?
There was a problem hiding this comment.
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 |
…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>
Co-authored-by: Douwe Osinga <douwe@squareup.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: