-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Docs/json recipe support #5492
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
Merged
Merged
Docs/json recipe support #5492
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d77bce6
misc fixes
dianed-square 9de8d10
recipes: JSON import support; JSON recipe examples; updated validatio…
dianed-square bf24c53
validation fix
dianed-square a46c2d5
Merge branch 'main' into docs/json-recipe-support
dianed-square d0919bd
readd imports
dianed-square File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,12 @@ | ||
| --- | ||
| sidebar_position: 2 | ||
| title: Recipe Reference Guide | ||
| description: Complete technical reference for creating and customizing recipes in goose via the CLI. | ||
| description: Complete technical reference for creating and customizing recipes in goose | ||
| --- | ||
|
|
||
| import Tabs from '@theme/Tabs'; | ||
| import TabItem from '@theme/TabItem'; | ||
|
|
||
| Recipes are reusable goose configurations that package up a specific setup so it can be easily shared and launched by others. | ||
|
|
||
| ## Recipe File Format | ||
|
|
@@ -12,11 +15,7 @@ Recipes can be defined in either: | |
| - `.yaml` files (recommended) | ||
| - `.json` files | ||
|
|
||
| Files should be named either: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. goose says it's unnecessarily prescriptive |
||
| - `recipe.yaml`/`recipe.json` | ||
| - `<recipe_name>.yaml`/`<recipe_name>.json` | ||
|
|
||
| After creating recipe files, you can use the [`goose recipe` subcommands](/docs/guides/goose-cli-commands#recipe) to validate, share, and open your recipes. | ||
| See [Shareable Recipes](/docs/guides/recipes/session-recipes) to learn how to create, use, and manage recipes. | ||
|
|
||
| ### CLI and Desktop Formats | ||
|
|
||
|
|
@@ -25,12 +24,18 @@ goose recipes use two formats: | |
| - **CLI Format**: Recipe fields (like `title`, `description`, `instructions`) are at the root level of the YAML/JSON file. This format is used when recipes are created via the CLI `/recipe` command and [Recipe Generator](/recipe-generator) YAML option. | ||
| - **Desktop Format**: Recipe fields are nested inside a `recipe` object, with additional metadata fields at the root level. This format is used when recipes are created from goose Desktop. | ||
|
|
||
| The CLI automatically detects and handles both formats when running `goose run --recipe <file>` and `goose recipe` commands. The Desktop can [import](/docs/guides/recipes/storing-recipes#importing-recipes) and use YAML recipes (or deeplinks) in either CLI or Desktop format. | ||
| The CLI automatically detects and handles both formats for `.yaml` and `.json` recipe files when running `goose run --recipe <file>` and `goose recipe` commands. The Desktop can [import](/docs/guides/recipes/storing-recipes#importing-recipes) `.yaml`, `.yml`, and `.json` recipe files (or deeplinks) in either CLI or Desktop format. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. enumerated file extensions because of the diff between cli/desktop support for |
||
|
|
||
| <details> | ||
| <summary>Format Examples</summary> | ||
|
|
||
| **CLI Format:** | ||
| Recipes can be written in either YAML or JSON format. Both formats follow the same schema structure. | ||
|
|
||
| ### CLI Format | ||
|
|
||
| <Tabs> | ||
| <TabItem value="yaml" label="YAML" default> | ||
|
|
||
| ```yaml | ||
| version: "1.0.0" | ||
| title: "Code Review Assistant" | ||
|
|
@@ -40,7 +45,28 @@ prompt: "Review the code in this repository" | |
| extensions: [] | ||
| ``` | ||
|
|
||
| **Desktop Format:** | ||
| </TabItem> | ||
| <TabItem value="json" label="JSON"> | ||
|
|
||
| ```json | ||
| { | ||
| "version": "1.0.0", | ||
| "title": "Code Review Assistant", | ||
| "description": "Automated code review with best practices", | ||
| "instructions": "You are a code reviewer...", | ||
| "prompt": "Review the code in this repository", | ||
| "extensions": [] | ||
| } | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| ### Desktop Format | ||
|
|
||
| <Tabs> | ||
| <TabItem value="yaml" label="YAML" default> | ||
|
|
||
| ```yaml | ||
| name: "Code Review Assistant" | ||
| recipe: | ||
|
|
@@ -55,6 +81,29 @@ lastModified: 2025-07-02T03:46:46.778Z | |
| isArchived: false | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| <TabItem value="json" label="JSON"> | ||
|
|
||
| ```json | ||
| { | ||
| "name": "Code Review Assistant", | ||
| "recipe": { | ||
| "version": "1.0.0", | ||
| "title": "Code Review Assistant", | ||
| "description": "Automated code review with best practices", | ||
| "instructions": "You are a code reviewer...", | ||
| "prompt": "Review the code in this repository", | ||
| "extensions": [] | ||
| }, | ||
| "isGlobal": true, | ||
| "lastModified": "2025-07-02T03:46:46.778Z", | ||
| "isArchived": false | ||
| } | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| :::note | ||
| goose automatically adds metadata fields to recipes saved from the Desktop app. | ||
| ::: | ||
|
|
@@ -238,6 +287,9 @@ The `extensions` field allows you to specify which Model Context Protocol (MCP) | |
|
|
||
| ### Example Extension Configuration | ||
|
|
||
| <Tabs> | ||
| <TabItem value="yaml" label="YAML" default> | ||
|
|
||
| ```yaml | ||
| extensions: | ||
| - type: stdio | ||
|
|
@@ -268,6 +320,45 @@ extensions: | |
| description: "GitHub MCP extension for repository operations" | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| <TabItem value="json" label="JSON"> | ||
|
|
||
| ```json | ||
| { | ||
| "extensions": [ | ||
| { | ||
| "type": "stdio", | ||
| "name": "codesearch", | ||
| "cmd": "uvx", | ||
| "args": ["mcp_codesearch@latest"], | ||
| "timeout": 300, | ||
| "bundled": true, | ||
| "description": "Query https://codesearch.sqprod.co/ directly from goose" | ||
| }, | ||
| { | ||
| "type": "stdio", | ||
| "name": "presidio", | ||
| "timeout": 300, | ||
| "cmd": "uvx", | ||
| "args": ["mcp_presidio@latest"], | ||
| "available_tools": ["query_logs"] | ||
| }, | ||
| { | ||
| "type": "stdio", | ||
| "name": "github-mcp", | ||
| "cmd": "github-mcp-server", | ||
| "args": [], | ||
| "env_keys": ["GITHUB_PERSONAL_ACCESS_TOKEN"], | ||
| "timeout": 60, | ||
| "description": "GitHub MCP extension for repository operations" | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| ### Extension Secrets | ||
|
|
||
| This feature is only available through the CLI. | ||
|
|
@@ -516,12 +607,15 @@ sub_recipes: | |
|
|
||
| ## Complete Recipe Example | ||
|
|
||
| <Tabs> | ||
| <TabItem value="yaml" label="YAML" default> | ||
|
|
||
| ```yaml | ||
| version: "1.0.0" | ||
| title: "Example Recipe" | ||
| description: "A sample recipe demonstrating the format" | ||
| instructions: "Follow these steps with {{ required_param }} and {{ optional_param }}" | ||
| prompt: "Your task is to use {{ required_param }}" | ||
| prompt: "Your task is to use {{ required_param }} with {{ interactive_param }}" | ||
| parameters: | ||
| - key: required_param | ||
| input_type: string | ||
|
|
@@ -576,9 +670,92 @@ response: | |
| description: "Additional details of steps taken" | ||
| required: | ||
| - result | ||
| - status | ||
| - details | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| <TabItem value="json" label="JSON"> | ||
|
|
||
| ```json | ||
| { | ||
| "version": "1.0.0", | ||
| "title": "Example Recipe", | ||
| "description": "A sample recipe demonstrating the format", | ||
| "instructions": "Follow these steps with {{ required_param }} and {{ optional_param }}", | ||
| "prompt": "Your task is to use {{ required_param }} with {{ interactive_param }}", | ||
| "parameters": [ | ||
| { | ||
| "key": "required_param", | ||
| "input_type": "string", | ||
| "requirement": "required", | ||
| "description": "A required parameter example" | ||
| }, | ||
| { | ||
| "key": "optional_param", | ||
| "input_type": "string", | ||
| "requirement": "optional", | ||
| "default": "default value", | ||
| "description": "An optional parameter example" | ||
| }, | ||
| { | ||
| "key": "interactive_param", | ||
| "input_type": "string", | ||
| "requirement": "user_prompt", | ||
| "description": "Will prompt user if not provided" | ||
| } | ||
| ], | ||
| "extensions": [ | ||
| { | ||
| "type": "stdio", | ||
| "name": "codesearch", | ||
| "cmd": "uvx", | ||
| "args": ["mcp_codesearch@latest"], | ||
| "timeout": 300, | ||
| "bundled": true, | ||
| "description": "Query codesearch directly from goose" | ||
| } | ||
| ], | ||
| "settings": { | ||
| "goose_provider": "anthropic", | ||
| "goose_model": "claude-sonnet-4-20250514", | ||
| "temperature": 0.7 | ||
| }, | ||
| "retry": { | ||
| "max_retries": 3, | ||
| "timeout_seconds": 30, | ||
| "checks": [ | ||
| { | ||
| "type": "shell", | ||
| "command": "echo 'Task validation check passed'" | ||
| } | ||
| ], | ||
| "on_failure": "echo 'Retry attempt failed, cleaning up...'" | ||
| }, | ||
| "response": { | ||
| "json_schema": { | ||
| "type": "object", | ||
| "properties": { | ||
| "result": { | ||
| "type": "string", | ||
| "description": "The main result of the task" | ||
| }, | ||
| "details": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| }, | ||
| "description": "Additional details of steps taken" | ||
| } | ||
| }, | ||
| "required": ["result", "details"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| </TabItem> | ||
| </Tabs> | ||
|
|
||
| ## Template Inheritance | ||
|
|
||
| Parent recipe (`parent.yaml`): | ||
|
|
@@ -614,13 +791,16 @@ Recipes can be loaded from: | |
|
|
||
| ## Validation Rules | ||
|
|
||
| The following rules are enforced when loading recipes: | ||
| Recipe files must be valid YAML or JSON. In addition, the following [validation rules](https://github.com/block/goose/blob/main/crates/goose/src/recipe/validate_recipe.rs) are enforced when loading recipes and are also checked by the [`goose recipe validate` subcommand](/docs/guides/goose-cli-commands#recipe): | ||
|
|
||
| 1. All template variables must have corresponding parameter definitions | ||
| 2. Optional parameters must have default values | ||
| 3. Parameter keys must be unique | ||
| 4. Recipe files must be valid YAML or JSON | ||
| 5. Required fields (version, title, description) must be present | ||
| - Required `title` and `description` fields must be present | ||
| - At least one of `instructions` or `prompt` must be present | ||
| - All template variables must have corresponding parameter definitions | ||
| - Parameter keys must be unique (not enforced, but required for proper functionality) | ||
| - All defined parameters must be used in template variables (no unused parameters) | ||
| - Optional parameters must have default values | ||
| - File parameters cannot have default values (prevents importing sensitive files) | ||
| - `response.json_schema` must be a valid JSON schema if specified | ||
|
|
||
| ## Error Handling | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.