output writes to files and stdout. log writes to stderr. append adds to existing files. stream enables real-time token-by-token output from LLM calls.
Output Directive
output @content to "out.txt"
output @data to "config.json"
output @message to stdout
output @error to stderr
output @config.yaml() to "settings.yaml"
output @results.json() to "results.json"
output @plain.text() to "plain.txt"
Use transformer methods before output when you need a specific file format:
| Transformer | Behavior |
|---|---|
@value.json() |
Emit JSON text |
@value.yaml() |
Emit YAML text |
@value.text() |
Emit plain text |
Examples:
output @data.json() to "results.json"
output @data.yaml() to "config.yml"
output @data.text() to "plain.txt"
See Also
- Append Directive - Append structured or text output incrementally.
- Log Directive - Emit output to stderr.
- Pipelines Basics - Attach
outputas a pipeline effect stage.
Log Directive
var @debugMode = true
log @message >> same as output @message to stderr
log `Processing: @item`
>> In action contexts
for @item in @items => log @item
when @debugMode => log "Debug info"
See Also
- Output Directive - File/stdout/stderr output patterns and formatting.
- Pipelines Basics - Use
| logas a pipeline effect stage.
Append Directive
append @record to "events.jsonl" >> JSON object per line
append "raw line" to "events.log"
>> In pipelines
var @_ = @data | append "audit.jsonl"
>> In loops
for @name in @runs => append @name to "pipeline.log"
.jsonl enforces JSON serialization. Other extensions write text. .json blocked.
Streaming
stream @claude("prompt") >> keyword form
stream @generateReport() >> directive form
>> Parallel streams
stream @a() || stream @b() >> concurrent, buffered results
Suppress: --no-stream flag or MLLD_NO_STREAM=true