Skip to content

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Jan 9, 2026

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:

image

Copilot AI review requested due to automatic review settings January 9, 2026 18:45
Copy link
Contributor

Copilot AI left a 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.rs to 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.md to compaction.md and 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;
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines 359 to 361
super::routes::agent::start_agent,
super::routes::agent::resume_agent,
super::routes::agent::restart_agent,
Copy link

Copilot AI Jan 9, 2026

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).

Suggested change
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,

Copilot uses AI. Check for mistakes.
import ExternalBackendSection from './app/ExternalBackendSection';
import AppSettingsSection from './app/AppSettingsSection';
import ConfigSettings from './config/ConfigSettings';
import PromptsSettingsSection from './prompts/PromptsSettingsSection';
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings January 9, 2026 19:18
Copy link
Contributor

Copilot AI left a 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.

Comment on lines 130 to 134
const handleBack = () => {
setSelectedPrompt(null);
setPromptData(null);
setContent('');
};
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +122 to +128
})?;

Ok(Json(format!("Reset prompt to default: {}", name)))
}

pub fn routes() -> Router {
Router::new()
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
onClick={handleRestoreDefault}
className="text-xs"
>
View Default
Copy link

Copilot AI Jan 9, 2026

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.

Suggested change
View Default
Restore Default

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 9, 2026

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."

Suggested change
community
community.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +14
use utoipa::ToSchema;

#[derive(Serialize, ToSchema)]
pub struct PromptsListResponse {
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +941 to +962
},
"/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": {
Copy link

Copilot AI Jan 9, 2026

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.

Copilot uses AI. Check for mistakes.
@DOsinga DOsinga requested a review from baxen January 9, 2026 19:25
Copy link
Collaborator

@alexhancock alexhancock left a 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",
Copy link
Collaborator

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?

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 don't know. the CLI has a plan mode, the desktop does not

@DOsinga
Copy link
Collaborator Author

DOsinga commented Jan 12, 2026

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.

they should be part of the llm logs, but yeah, should be easy enough to do

Copilot AI review requested due to automatic review settings January 20, 2026 21:58
Copy link
Contributor

Copilot AI left a 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.

@DOsinga DOsinga merged commit 2f083b8 into main Jan 20, 2026
25 of 26 checks passed
@DOsinga DOsinga deleted the user-configurable-templates branch January 20, 2026 22:15
katzdave added a commit that referenced this pull request Jan 21, 2026
…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)
michaelneale added a commit that referenced this pull request Jan 21, 2026
* 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)
lifeizhou-ap added a commit that referenced this pull request Jan 22, 2026
* 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)
  ...
michaelneale added a commit that referenced this pull request Jan 22, 2026
wpfleger96 added a commit that referenced this pull request Jan 22, 2026
* 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)
  ...
wpfleger96 added a commit that referenced this pull request Jan 22, 2026
* 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)
  ...
wpfleger96 added a commit that referenced this pull request Jan 22, 2026
* 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)
  ...
fbalicchia pushed a commit to fbalicchia/goose that referenced this pull request Jan 23, 2026
Co-authored-by: Douwe Osinga <douwe@squareup.com>
Signed-off-by: fbalicchia <fbalicchia@cuebiq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants