Text Mode (Default)
By default,duck and duck say render events as formatted, colored text with tagged prefixes.
Event Prefixes
Each event type is rendered with a distinctive prefix:[text]- Assistant message content[thinking]- Model reasoning (only with--show-thinking)[tool:name]- Tool execution start[tool:name output]- Tool execution results[error]- Error messages[compaction]- Context compaction events[retry]- Auto-retry attempts
Example Output
Color Support
Colors are automatically enabled when:stdoutis a TTY (interactive terminal)NO_COLORenvironment variable is not set- Terminal supports color (checked via
node:utilstyleText)
- Output is piped to a file or another command
NO_COLORis set to any value--no-colorflag is used
Thinking Blocks
By default, model reasoning is hidden for cleaner output. Show it with--show-thinking:
JSON Mode
Get raw NDJSON (newline-delimited JSON) events for programmatic parsing.Event Stream Format
Each line is a complete JSON object representing a Pi event:Event Types
All events follow thePiEvent union type from the Pi protocol:
Lifecycle Events
agent_startMessage Events
message_update - Streaming text or thinking deltastext_start- Begin text responsetext_delta- Incremental text chunktext_end- Text response completethinking_start- Begin reasoning blockthinking_delta- Incremental reasoning chunkthinking_end- Reasoning completeerror- Error in message generation
Tool Events
tool_execution_start - Tool invocation beginsError Events
prompt_error - Failed to process promptContext Management Events
auto_compaction_start - Context pruning beginsUI Events
extension_ui_request - Interactive prompt neededextension_ui_response method.
In text mode, UI requests are automatically handled via @clack/prompts (confirm, select, text input).
Parsing Examples
Filter Text Output
Extract Tool Calls
Count Events by Type
Monitor for Errors
Visibility Filtering
Not all events are shown in text mode by default. Here’s what’s visible: Always visible:- Text deltas
- Tool executions (start, updates, end)
- Errors (prompt_error, extension_error)
- Context management (compaction, retry)
- UI requests (except
setStatus)
- Thinking blocks (use
--show-thinking) - Internal status updates (
setStatusUI events) - Agent lifecycle events (start/end markers)
- All raw Pi protocol events
- Exact event timing and IDs
- Complete tool arguments and metadata