Skip to content

Debugging

Tools and workflows for debugging meloqui assistants.

Debug Tmux Layout

Most assistant packages include a debug:tmux script that launches a split-pane layout with:

  • Main pane: The assistant UI
  • Log pane: Real-time JSON logs (tail -f on log file)
  • Conversation pane: Human-readable conversation transcript
bash
# In any assistant package
npm run debug:tmux

Environment Variables

The debug script sets these automatically:

VariableDescription
MELOQUI_LOG_FILEPath to JSON log file
MELOQUI_LOG_LEVELLog verbosity (DEBUG, INFO, WARN, ERROR)
MELOQUI_CONVERSATION_FILEPath to conversation transcript

Tmux Navigation

Scrolling

The assistant UI (Ink/React) captures mouse events. To scroll the tmux buffer:

MethodDescription
Shift + scroll wheelBypasses the app, scrolls tmux buffer
PageUpEnters copy mode and scrolls up
prefix + [Enters copy mode manually

Copy Mode Navigation

Once in copy mode (prefix + [ or PageUp):

KeyAction
qExit copy mode
j/kLine up/down
Ctrl+uPage up
Ctrl+dPage down
gGo to top
GGo to bottom
/Search forward
?Search backward

Copy/Paste

With mouse mode enabled:

MethodDescription
Drag to selectAuto-copies to system clipboard
Double-clickSelects word and copies
Option + dragUses iTerm2 native selection (bypasses tmux)
v (copy mode)Start selection
y (copy mode)Copy selection to clipboard
Cmd+VPaste from system clipboard

Pane Navigation

KeyAction
prefix + arrowMove between panes
prefix + zToggle pane zoom (fullscreen)
prefix + qShow pane numbers
prefix + xClose current pane

Note: Default prefix is Ctrl+b

Add to ~/.tmux.conf:

bash
# Enable mouse support
set -g mouse on

# Increase scrollback buffer
set -g history-limit 50000

# Page up enters copy mode
bind -n PageUp copy-mode -u

# Vi-style copy mode
setw -g mode-keys vi

# Copy to system clipboard (macOS)
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"

Reload config: tmux source-file ~/.tmux.conf

Log Levels

Set MELOQUI_LOG_LEVEL to control verbosity:

LevelShows
DEBUGEverything including request/response details
INFONormal operations
WARNWarnings and errors
ERRORErrors only

Conversation Logging

The conversation file shows a human-readable transcript:

═══════════════════════════════════════════════════════════════════
[2024-01-15 22:30:45] USER
───────────────────────────────────────────────────────────────────
Hello, can you help me with this code?

═══════════════════════════════════════════════════════════════════
[2024-01-15 22:30:47] ASSISTANT
───────────────────────────────────────────────────────────────────
Of course! I'd be happy to help. What would you like me to look at?

  🔧 Tool: read_file
     {"filePath": "/path/to/file.ts"}
  ✓ read_file: export function example() { ... }

Uses synchronous writes so tail -f shows output immediately.

Released under the MIT License.