Inline Diffs
muxd prints a unified diff to the terminal whenever the agent writes to a file, so you can see the exact change without opening an editor.
When Diffs Appear
| Tool | Behavior |
|---|---|
file_edit | Always shows a diff of the lines that changed |
file_write (overwrite) | Shows a diff between the previous file content and the new content |
file_write (new file) | Prints a creation notice instead of a diff |
For new files the output looks like:
Created src/server.go (143 lines)
For edits and overwrites, a standard unified diff is printed:
--- a/internal/store/store.go
+++ b/internal/store/store.go
@@ -42,7 +42,7 @@ func (s *Store) CreateSession(title string) (Session, error) {
- id := uuid.New().String()
+ id := newUUID()
now := time.Now().UTC()
_, err := s.db.Exec(
`INSERT INTO sessions (id, title, created_at, updated_at) VALUES (?, ?, ?, ?)`,
Toggling Diffs
Diffs are enabled by default. To turn them off:
/config set show_diffs false
To re-enable:
/config set show_diffs true
The setting is stored in ~/.config/muxd/config.json and persists across sessions.
Large Diff Truncation
Diffs longer than 100 lines are truncated. A notice is printed after the cutoff:
... diff truncated (247 lines total) ...
The full change is still applied to the file — truncation only affects what is displayed in the terminal. To see the complete diff after truncation, use git diff or your preferred diff tool.
Edge Cases
| Situation | Behavior |
|---|---|
show_diffs false | No diff or creation notice is printed |
| Binary file | Creation or overwrite notice only — no diff |
| File deleted | Deletion notice printed, no diff |
| Diff computation error | Change is applied; a warning is printed instead of a diff |
New file with file_write | Creation notice instead of diff |