Your objective is to save the current pipeline as a reusable CocoRecipe template.
Pre-flight Check
Check that .cocoplus/flow.json exists and is valid JSON. If not:
Output: "No valid flow.json found. A completed pipeline is required to create a recipe. Run $plan and $build first." Then stop.
Check that ~/.coco/plugins/cocoplus/recipes/ exists (Windows: %APPDATA%\coco\plugins\cocoplus\recipes\). If not writable, output the error and stop.
Check for Name Conflict
If ~/.coco/plugins/cocoplus/recipes/<name>.json.template already exists:
Output: "A recipe named '' already exists. Overwrite it or choose a different name? (overwrite/rename)"
Wait for response.
Parameterization Wizard
Read .cocoplus/flow.json. For each stage, present the key configurable fields one at a time:
label— stage nameagent— assigned personamodel— model override (if present)- Any stage-specific prompt parameters
For each field, ask: "Should ': ' be a fixed value or a parameter that users supply when using this recipe? (fixed/param)"
If the developer chooses param:
- Ask: "Parameter name (e.g.,
target_table):" - Ask: "Description (one line, shown to users):"
- Ask: "Required or optional? (required/optional)"
Replace the field value with {{parameter_name}} in the working copy.
Collect Recipe Metadata
Ask for a one-line recipe description.
Build Template File
Assemble the final template:
- Insert
__recipe_metablock at the top with:name,description,stage_count, and theparametersarray (each withname,description,requiredfields) - Apply all
{{param}}substitutions - Remaining field values stay as-is
Write Template
Write to ~/.coco/plugins/cocoplus/recipes/<name>.json.template.
Output
✓ Recipe saved: ~/.coco/plugins/cocoplus/recipes/<name>.json.template
Parameters: <param1> (required), <param2> (required), <param3> (optional)
This recipe is now available in $recipe list and $recipe use <name>.
Anti-Rationalization
| Shortcut / Temptation | Why It Fails |
|---|---|
| Auto-detect parameterizable fields without asking | The developer knows which values are project-specific vs pipeline-generic; don't guess |
| Write to project-local recipes/ instead of profile folder | Profile-scoped recipes are available across all projects; that's the feature value |
Exit Criteria
-
<name>.json.templatewritten to profilerecipes/folder with__recipe_metablock - All
{{param}}slots correspond to entries in theparametersarray - Output confirms recipe name and parameter list
- Recipe immediately visible in
$recipe list