| name | save-output |
| description | Prompt the user to save the current agent output as a markdown spec file. Handles y/n prompt, target directory selection, filename generation, and file writing. Use at the end of any agent workflow. |
| argument-hint | <output content> <suggested filename stem> |
| user-invocable | false |
Save Output Protocol
After completing your primary task and presenting the full output to the user,
run this save protocol as the final step of every agent session.
Step 1 — Prompt
Ask the user exactly once:
---
Save this output to a markdown file? (y/n)
Do not proceed until the user answers.
Step 2 — Directory
If the user answers n: stop here. Do not write any file.
If the user answers y (or "yes"): ask:
Target directory? (press Enter for default: ./specs/)
- If the user provides a path, use it exactly.
- If the user presses Enter or provides no input, use
./specs/.
- Do not create the directory yourself — the Write tool handles it.
Step 3 — Filename
Generate a filename using this pattern:
{topic-slug}_{YYYY-MM-DD}.md
topic-slug: derive from the subject of the task (e.g., auth-module-review, user-auth-feature, dockerfile-api-service). Use kebab-case, max 5 words.
YYYY-MM-DD: today's date.
Example filenames:
auth-module-review_2026-03-15.md
user-auth-feature-plan_2026-03-15.md
api-service-dockerfile_2026-03-15.md
Show the user the full path before writing:
Writing to: ./specs/auth-module-review_2026-03-15.md
Step 4 — File Structure
Write the file with this structure:
# {Title}
> Generated by {agent-name} on {YYYY-MM-DD}
---
{full output content — exactly as presented to the user, no truncation}
Title: human-readable title derived from the task (e.g., "Code Review: src/auth.ts")
agent-name: the name of the agent that produced this output
- Include the complete output — do not summarize or shorten
Rules
- Only prompt once — do not ask again if the user says no
- Never write a file without explicit user confirmation
- Do not modify the output content when saving — write it verbatim
- If the Write tool fails (e.g., permission error), report the error and stop
- The save step is always last — never interrupt the primary workflow with it