Your objective is to manage reusable CocoFlow execution plan templates.
Before proceeding, verify that .cocoplus/ exists.
If not: output "CocoPlus not initialized in this directory. Run $pod init to begin." Then stop.
Templates live under .cocoplus/flows/templates/. They capture the orchestration pass output for a successful flow run: strategic assessment summary, dependency graph, dependency groups, model tier assignments, per-step context briefs, expected outputs, validation commands, and measured planning/execution cost split.
Commands
$flow template list
- Read every
*.jsonfile in.cocoplus/flows/templates/. - Display: name, source session, archetype, saved_at, last_used_at, reuse_count, and estimated planning bypass savings.
- If no templates exist, output: "No execution plan templates saved. Run
$flow template save --from <session-id> --name <name>after a successful flow run."
$flow template save --from <session-id> --name <name>
- Locate the completed orchestration artifact for
<session-id>in.cocoplus/flows/runs/or.cocoplus/harvest/. - Verify it contains:
dependency_graphdependency_groupstier_assignmentscontext_briefsexpected_outputs
- Refuse to save if any per-step
context_briefs[*].textexceeds 200 words. - Write
.cocoplus/flows/templates/<name>-plan.jsonatomically. - Append a
FLOW_TEMPLATE_SAVEDentry to.cocoplus/meter/template-benchmarks.jsonlif meter state exists.
$flow template validate <name>
- Load
.cocoplus/flows/templates/<name>-plan.json. - Compare template steps with current
.cocoplus/flow.json. - Validate referenced Snowflake objects against available trace/context artifacts when present.
- Report PASS, WARN, or FAIL with named incompatibilities. A FAIL means
$flow runmust use a fresh orchestration pass.
$flow template show <name>
Display strategic fit, dependency groups, model tier assignments, and context brief shapes. Do not print full historical worker context unless explicitly requested.
$flow template delete <name>
Archive to .cocoplus/flows/templates/archive/<timestamp>-<name>-plan.json rather than deleting.
V2 Integration
At the beginning of $flow run, attempt template matching. If a validated template matches the current flow.json shape and context slots, skip the strategic assessment and orchestration pass and dispatch from the template. Otherwise, run fresh orchestration and offer to save the resulting plan after completion.
Exit Criteria
-
listreports all saved templates and handles the empty state. -
saverefuses incomplete orchestration artifacts and context briefs over 200 words. -
validatenames each incompatibility. -
showpreviews template shape without flooding worker context. -
deletearchives rather than removes.
Anti-Rationalization
| Shortcut / Temptation | Why It Fails |
|---|---|
| Treat the skill as complete because the file exists | Skill contracts must describe observable behavior and verification, not just command names. |
| Skip artifact and safety checks for a small command | Small commands still mutate state or guide execution; preserve the same gates. |