How to save an answer to a file
This guide shows how to keep an answer of the agent — a mini tutorial, an explanation, a snippet — in a Markdown file, without the model writing it a second time. It assumes you use mm in the terminal or the window mode (-tui).
There are two ways. /save is a command you type: nothing is asked of the model. save_answer is a tool the model calls when you ask in your own words.
Save with the command
-
Ask your question and wait for the answer.
-
Type:
/save nushell-first-script.mdmm writes the last answer as it is and prints:
💾 saved the last answer to nushell-first-script.md (2418 bytes) -
To save an earlier answer, add its rank from the end:
/save rust-app.md 2saves the answer before the last one.
Save by asking the agent
-
Turn the tool on in the agent file:
saveAnswerTool: true -
Ask in your own words, after the answer or in the same request:
save it in nushell-first-script.mdteach me pattern matching in Kotlin and save it in kotlin-match.mdThe model only sends the file name; mm writes the text the model already gave. The terminal shows:
💾 save_answer: nushell-first-script.md (the previous answer)
Variants
- The file already exists. Neither
/savenorsave_answeroverwrites it: they say so and write nothing. Give another name, or remove the file first. - A directory that does not exist yet.
/save notes/rust/app.mdcreatesnotes/rust/. - You want each save confirmed. With
yolo: false,save_answerasks before writing, likewrite_file./savenever asks: you typed it. - In an editor (ACP).
/saveis not offered there;save_answerworks, and writes in the session's directory.
See also
- The command: slash commands
- The tool:
save_answerandsaveAnswerTool
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|