Skip to content

Commit 89843b0

Browse files
committed
🤖 fix: update example scripts to use stdout/stderr semantics
Updated .cmux/scripts/demo and .cmux/scripts/echo to use: - stdout for agent-visible output - stderr for user-only progress messages _Generated with mux_ Change-Id: Ibdcc0844cfd41715605b67498c6311c4a76db660 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 93b27ae commit 89843b0

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

.cmux/scripts/demo

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,20 @@
22
# Description: Demo script to showcase the script execution feature. Accepts no arguments.
33
set -euo pipefail
44

5-
# Regular output goes to stdout (visible in console logs)
6-
echo "Running demo script..."
7-
echo "Current workspace: $(pwd)"
8-
echo "Timestamp: $(date)"
5+
# Progress messages to stderr (shown to user, not sent to agent)
6+
echo "Running demo script..." >&2
7+
echo "Current workspace: $(pwd)" >&2
8+
echo "Timestamp: $(date)" >&2
99

10-
# Write formatted output to MUX_OUTPUT for toast display
11-
cat >>"$MUX_OUTPUT" <<'EOF'
10+
# Structured output to stdout (sent to agent)
11+
cat <<'EOF'
1212
## 🎉 Script Execution Demo
1313
1414
✅ Script executed successfully!
1515
16-
**Environment Variables Available:**
17-
- `MUX_OUTPUT`: Custom toast display
18-
- `MUX_PROMPT`: Send messages to agent
19-
EOF
20-
21-
# Write a prompt to MUX_PROMPT to send a message to the agent
22-
cat >>"$MUX_PROMPT" <<'EOF'
23-
The demo script has completed successfully. The script execution feature is working correctly with:
24-
1. Custom toast output via MUX_OUTPUT
25-
2. Agent prompting via MUX_PROMPT
16+
**Output Semantics:**
17+
- `stdout`: Sent to the agent as tool result
18+
- `stderr`: Shown to user only (progress/debug info)
2619
27-
You can now create workspace-specific scripts to automate tasks and interact with the agent.
20+
The demo script completed. You can create workspace-specific scripts to automate tasks.
2821
EOF

.cmux/scripts/echo

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44

55
# Check if arguments were provided
66
if [ $# -eq 0 ]; then
7-
cat >>"$MUX_OUTPUT" <<'EOF'
7+
cat <<'EOF'
88
## ⚠️ No Arguments Provided
99
1010
Usage: `/s echo <message...>`
@@ -14,10 +14,8 @@ EOF
1414
exit 0
1515
fi
1616

17-
# Access arguments using standard bash positional parameters
18-
# $1 = first arg, $2 = second arg, $@ = all args, $# = number of args
19-
20-
cat >>"$MUX_OUTPUT" <<EOF
17+
# Structured output to stdout (sent to agent)
18+
cat <<EOF
2119
## 🔊 Echo Script
2220
2321
**You said:** $@
@@ -31,18 +29,7 @@ cat >>"$MUX_OUTPUT" <<EOF
3129
**Individual arguments:**
3230
EOF
3331

34-
35-
# Echo arguments to stdout for AI tool visibility
36-
echo "Echoing arguments to stdout: $@"
37-
3832
# Loop through each argument
3933
for i in $(seq 1 $#); do
40-
echo "- Arg $i: ${!i}" >>"$MUX_OUTPUT"
34+
echo "- Arg $i: ${!i}"
4135
done
42-
43-
# Optionally send a message to the agent
44-
if [ $# -gt 3 ]; then
45-
cat >>"$MUX_PROMPT" <<EOF
46-
The user passed more than 3 arguments to the echo script. They seem to be testing the argument passing feature extensively!
47-
EOF
48-
fi

0 commit comments

Comments
 (0)