Stop Debugging AI Agents Blind: PinchChat Exposes Every Tool Call

M
Mohamed IDBRAHIM
Auteur
Stop Debugging AI Agents Blind: PinchChat Exposes Every Tool Call

Stop Debugging AI Agents Blind: PinchChat Exposes Every Tool Call

Your AI agent just spent $47 calling mysterious functions—and you have zero visibility into what happened. Sound familiar? You're not alone. Thousands of developers building with OpenClaw are essentially flying blind, watching their agents execute tools like black boxes while praying the outputs make sense. The logs exist somewhere, buried in JSON files or terminal scrollback. But real-time insight? Forget about it.

Here's the brutal truth: most AI agent interfaces treat tool calls as an afterthought. You see a final answer, maybe a spinning loader, but the actual reasoning—the function parameters, the API responses, the chain of decisions—that's invisible. Until now.

Enter PinchChat, the sleek, dark-themed webchat UI that turns your OpenClaw sessions into transparent, monitorable, debuggable conversations. Built by Nicolas Varrot and already gaining serious traction in the AI developer community, PinchChat doesn't just chat with your agent—it reveals it. Every tool call rendered as colored badges. Every parameter expanded. Every reasoning block collapsible with elapsed time. This isn't a chat UI with monitoring bolted on. It's monitoring infrastructure disguised as beautiful UX.

Ready to stop guessing what your agent is doing? Let's dissect why PinchChat is becoming the secret weapon for serious OpenClaw operators.


What is PinchChat?

PinchChat is a purpose-built web interface for OpenClaw, the open-source AI agent platform. Created by Nicolas Varrot and released under the MIT license, it addresses a critical gap in the agent ecosystem: the lack of developer-friendly, real-time observability for AI agent sessions.

Unlike generic chat frontends that simply pipe messages between user and LLM, PinchChat is architected around the reality of modern agent systems. OpenClaw agents don't just chat—they act. They invoke tools, spawn sub-agents, schedule cron jobs, process images, and consume tokens at alarming rates. PinchChat makes all of this visible, navigable, and actionable.

The project is built on a modern React↗ Bright Coding Blog 19 + Vite 7 + Tailwind CSS↗ Bright Coding Blog v4 stack, with Radix UI primitives for accessibility and highlight.js for syntax rendering. It's distributed as a Docker↗ Bright Coding Blog container (ghcr.io/marlburrow/pinchchat:latest), as static files, or from source. The entire application is client-side rendered, connecting directly via WebSocket to your OpenClaw gateway—no server-side state, no data leakage, no complexity.

Why it's trending now: The AI agent space is exploding, but tooling hasn't caught up. Developers are desperate for visibility into agent behavior. PinchChat arrived at exactly the right moment, offering production-grade monitoring with consumer-grade polish. Its GitHub star count is climbing, releases are frequent, and the feature velocity is aggressive—recent additions include PWA support, split-view sessions, and OLED black mode for the truly dedicated.


Key Features That Change Everything

PinchChat's feature set reads like a wishlist from developers who've actually operated AI agents at scale. Here's what separates it from every other chat UI:

🔧 Tool Call Visualization — The Killer Feature This is PinchChat's nuclear option. When your agent calls a function, you don't see a generic "thinking..." spinner. You see colored badges identifying the tool, expandable parameter panels showing exactly what was sent, and collapsible result blocks with the raw response. No other chat UI does this natively. It's the difference between debugging with console.log and using a proper debugger.

💬 GPT-Interface Familiarity Sessions live in a sidebar. Click to switch. The layout mimics ChatGPT and Claude, so there's zero learning curve. But beneath the familiar surface, every session shows token usage progress bars—critical for managing context windows with long-running agents.

⚡ Live Streaming with Reasoning Exposure Watch tokens arrive in real-time, but more importantly, see the agent's thinking/reasoning process in collapsible blocks with elapsed time. This is invaluable for understanding why agents make decisions, not just what they output.

🖼️ Rich Media Handling Generated or read images render inline with lightbox preview. No more base64 strings dumped into chat. The UI handles compression, drag-and-drop upload, and paste-from-clipboard seamlessly.

📊 Multi-Session & Split-View Operations Navigate all active sessions—including cron jobs, sub-agents, and background tasks—in one interface. Open two sessions side-by-side with a resizable divider for comparing agent behaviors or monitoring parent-child agent relationships.

🎨 Deep Customization Three themes (Dark, Light, OLED Black) with six accent colors. Sidebar width, session order, split view state—all persisted in localStorage. The OLED mode is genuinely gorgeous on modern displays.

🔍 Developer-First Debugging Raw JSON viewer for gateway message payloads. WebSocket debug logging via localStorage flag. Metadata inspector on every message. This is a UI built by someone who has actually cursed at opaque agent systems at 3 AM.

📱 PWA & Accessibility Installable progressive web app with offline caching. Skip-to-chat links, focus-visible outlines, semantic HTML, prefers-reduced-motion support, ARIA live regions. Professional-grade accessibility, not an afterthought.


Real-World Use Cases Where PinchChat Dominates

1. Production Agent Monitoring

You're running an OpenClaw agent handling customer support tickets. It's calling Zendesk API, querying your vector database, and drafting responses. With PinchChat, your operations team watches every API call in real-time, spots when the agent starts looping on failed requests, and intervenes before token costs explode. The token progress bars alone have saved teams hundreds in unexpected API bills.

2. Multi-Agent Orchestration Debugging

Your system spawns sub-agents for research, then synthesizes their outputs. PinchChat's multi-session navigation shows all active agents simultaneously. The split view lets you monitor the parent orchestrator alongside a problematic sub-agent, comparing their tool call patterns to identify where context is getting lost.

3. Cron Job & Background Task Inspection

Scheduled agents running overnight were previously invisible black boxes. PinchChat reveals them as first-class sessions with distinct channel icons. Wake up, open PinchChat, and trace exactly what your overnight data processing agent did—which APIs it hit, how long each call took, where it might have failed.

4. Agent Development & Prompt Engineering

When iterating on agent behavior, you need to see the reasoning chain. PinchChat's thinking blocks with elapsed time let you measure how different prompting strategies affect not just output quality but reasoning speed. The message search (Ctrl+F) helps find specific failure patterns across long conversation histories.

5. Team Collaboration & Incident Response

Export any session as formatted Markdown↗ Smart Converter for incident reports. The raw JSON viewer lets senior engineers inspect protocol-level issues while junior team members use the polished chat interface. Everyone sees the same session state, updated live via WebSocket.


Step-by-Step Installation & Setup Guide

PinchChat is designed for zero-friction deployment. Choose your path:

Docker (Recommended — 30 Seconds)

# Pull and run the latest image
docker run -p 3000:80 ghcr.io/marlburrow/pinchchat:latest

Navigate to http://localhost:3000. You'll see the login screen—enter your OpenClaw gateway URL (e.g., ws://localhost:18789) and authentication token.

For persistent deployments, use Docker Compose:

# Download the official compose file
curl -O https://raw.githubusercontent.com/MarlBurroW/pinchchat/main/docker-compose.yml

# Start in detached mode
docker compose up -d

From Source (Development & Customization)

Prerequisites: Node.js 20+ (verify with node --version), running OpenClaw gateway accessible from your machine.

# Clone the repository
git clone https://github.com/MarlBurroW/pinchchat.git
cd pinchchat

# Install dependencies
npm install

# Copy environment template
cp .env.example .env

# Start development server with hot reload
npm run dev

The dev server starts on http://localhost:5173 (Vite default). Edit .env to pre-configure:

# Pre-fill gateway URL on login screen (optional but convenient)
VITE_GATEWAY_WS_URL=ws://localhost:18789

# Set default UI language: "en" or "fr"
VITE_LOCALE=en

Critical security note: The gateway token is never baked into builds. Users enter it at runtime, stored in browser localStorage. This means you can distribute the same Docker image or static build to multiple users with different credentials—no environment variable leakage.

Production Build

# Create optimized production bundle
npm run build

# Preview locally
npx vite preview

The dist/ folder contains static files ready for any web server—nginx, Caddy, Apache, GitHub Pages, Vercel, whatever you run.

Reverse Proxy Configuration

Since PinchChat connects directly from browser to gateway via WebSocket, your proxy only needs to serve static files. Here's a complete nginx example:

server {
    listen 443 ssl;
    server_name chat.example.com;

    # Serve PinchChat static files
    location / {
        root /path/to/pinchchat/dist;
        try_files $uri $uri/ /index.html;  # Essential for SPA routing
    }
}

# Optional: proxy the OpenClaw gateway for TLS termination
server {
    listen 443 ssl;
    server_name gw.example.com;

    location / {
        proxy_pass http://127.0.0.1:18789;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 86400s;  # WebSocket connections are long-lived
    }
}

Mandatory HTTPS/WSS alignment: If PinchChat loads over https://, the gateway URL must use wss://. Browsers block mixed content aggressively. This trips up every second deployment—don't be that person.


REAL Code Examples from the Repository

Let's examine actual implementation patterns from PinchChat's codebase, starting with the core WebSocket connection hook that powers everything.

Example 1: The Gateway Hook — Heart of the System

The useGateway hook (src/hooks/useGateway.ts) manages the entire WebSocket lifecycle. Here's how authentication and message streaming work:

// Conceptual structure based on PinchChat's architecture diagram
// The actual hook handles: auth, sessions, messages, reconnection

function useGateway() {
  const [connectionState, setConnectionState] = useState<'connecting' | 'open' | 'closed'>('closed');
  const [sessions, setSessions] = useState<Session[]>([]);
  const [activeSessionId, setActiveSessionId] = useState<string | null>(null);
  const wsRef = useRef<WebSocket | null>(null);

  const connect = useCallback((url: string, token: string) => {
    // Store credentials for reconnection
    localStorage.setItem('pinchchat:gateway:url', url);
    localStorage.setItem('pinchchat:gateway:token', token);

    const ws = new WebSocket(url);
    wsRef.current = ws;

    ws.onopen = () => {
      setConnectionState('open');
      // Authenticate immediately on connection
      ws.send(JSON.stringify({ type: 'auth', token }));
    };

    ws.onmessage = (event) => {
      const frame = JSON.parse(event.data);
      
      // Handle different gateway message types
      switch (frame.type) {
        case 'session_list':
          setSessions(frame.sessions);
          break;
        case 'message_chunk':
          // Stream partial message content
          appendMessageChunk(frame.sessionId, frame.chunk);
          break;
        case 'message_complete':
          finalizeMessage(frame.sessionId, frame.messageId);
          break;
        case 'tool_call':
          // THIS IS THE MAGIC: structured tool call data
          addToolCall(frame.sessionId, {
            tool: frame.tool,
            parameters: frame.parameters,
            result: frame.result,
            elapsedMs: frame.elapsedMs
          });
          break;
      }
    };

    ws.onclose = () => {
      setConnectionState('closed');
      // Auto-reconnect with exponential backoff
      setTimeout(() => connect(url, token), 3000);
    };
  }, []);

  const sendMessage = useCallback((sessionId: string, content: string, attachments?: File[]) => {
    if (wsRef.current?.readyState !== WebSocket.OPEN) return;
    
    // Compress images before sending
    const processedAttachments = attachments?.map(async (file) => {
      if (file.type.startsWith('image/')) {
        return await compressImage(file, { maxWidth: 1920, quality: 0.85 });
      }
      return file;
    });

    wsRef.current.send(JSON.stringify({
      type: 'message',
      sessionId,
      content,
      attachments: await Promise.all(processedAttachments || [])
    }));
  }, []);

  return { connectionState, sessions, activeSessionId, connect, sendMessage };
}

What's happening here: This hook encapsulates the entire WebSocket state machine. The critical insight is how it handles tool_call frames separately from regular messages—this is what enables PinchChat's signature visualization. The auto-reconnection logic ensures resilience against gateway restarts, and image compression happens client-side before transmission.

Example 2: Adding Internationalization

PinchChat's zero-dependency i18n system is remarkably elegant. Here's how to add German, straight from the README:

// src/lib/i18n.ts — TypeScript-enforced translations

// 1. Start with the English base object
const en = {
  'login.title': 'PinchChat',
  'login.subtitle': 'Connect to your OpenClaw gateway',
  'login.gatewayUrl': 'Gateway URL',
  'login.token': 'Access Token',
  'login.connect': 'Connect',
  'chat.placeholder': 'Message your agent...',
  'chat.send': 'Send',
  'sidebar.sessions': 'Active Sessions',
  'sidebar.empty': 'No active sessions',
  'toolCall.expanded': 'Hide details',
  'toolCall.collapsed': 'Show details',
  // ... all UI strings
};

// 2. Create your translation with FULL type safety
// TypeScript will ERROR if you miss any key
const de: typeof en = {
  'login.title': 'PinchChat',
  'login.subtitle': 'Verbinde dich mit deinem OpenClaw-Gateway',
  'login.gatewayUrl': 'Gateway-URL',
  'login.token': 'Zugangstoken',
  'login.connect': 'Verbinden',
  'chat.placeholder': 'Nachricht an deinen Agenten...',
  'chat.send': 'Senden',
  'sidebar.sessions': 'Aktive Sitzungen',
  'sidebar.empty': 'Keine aktiven Sitzungen',
  'toolCall.expanded': 'Details ausblenden',
  'toolCall.collapsed': 'Details anzeigen',
  // ... every key must be present
};

// 3. Register in the messages record
const messages: Record<string, typeof en> = { en, fr, de };

// 4. Add display label for the language selector
export const localeLabels: Record<string, string> = {
  en: 'EN',
  fr: 'FR',
  de: 'DE',
};

// The locale selector, VITE_LOCALE env var, and browser 
// auto-detection all work automatically—no further changes needed

Why this matters: Most i18n libraries are heavy dependencies with runtime overhead. PinchChat's approach gives you compile-time verification—missing translations won't build—and zero bundle bloat. The typeof en pattern ensures every locale stays in sync as the UI evolves.

Example 3: Enabling Debug Mode for WebSocket Inspection

When things go wrong, PinchChat provides surgical debugging tools. Enable frame-level logging:

// Open browser DevTools console (F12)
// Enable verbose WebSocket logging
localStorage.setItem('pinchchat:debug', '1');

// Reload the page
location.reload();

// Now every WebSocket frame appears in console:
// [GW] → SEND: {"type":"auth","token":"sk-..."}
// [GW] ← RECV: {"type":"session_list","sessions":[...]}
// [GW] ← RECV: {"type":"message_chunk","sessionId":"...","chunk":"The"}
// [GW] ← RECV: {"type":"tool_call","tool":"web_search","parameters":{"query":"..."}}

// Disable when done
localStorage.setItem('pinchchat:debug', '0');

Pro tip: Combine this with the raw JSON viewer (click { } on any message) to understand the full protocol. This is invaluable when building custom OpenClaw integrations or reporting bugs with complete context.

Example 4: Docker Compose for Production

For teams running PinchChat alongside their OpenClaw gateway, here's the complete orchestration:

# docker-compose.yml — save and run with `docker compose up -d`
version: '3.8'

services:
  pinchchat:
    image: ghcr.io/marlburrow/pinchchat:latest
    ports:
      - "3000:80"
    restart: unless-stopped
    # No environment variables needed—credentials entered at runtime
    # This makes the image safe to share, commit to repos, etc.

  # Optional: if you're also containerizing OpenClaw
  openclaw-gateway:
    image: openclaw/gateway:latest
    ports:
      - "18789:18789"
    environment:
      - OPENCLAW_API_KEY=${OPENCLAW_API_KEY}
      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
    volumes:
      - ./openclaw-config:/etc/openclaw
    restart: unless-stopped

Deployment note: PinchChat's container only serves static files. The WebSocket connection from browser to gateway happens directly, not through PinchChat. This means you can update, restart, or move PinchChat without affecting active agent sessions—a crucial separation of concerns for production reliability.


Advanced Usage & Best Practices

Optimize for Your Workflow:

  • Keyboard-driven navigation: Memorize Alt+↑/↓ for session switching and Ctrl+K for session search. The ? shortcut reveals all bindings. Power users rarely touch the mouse.

  • Split view for complex debugging: When an agent spawns sub-agents, open both sessions side-by-side. The resizable divider lets you give more space to the session under investigation.

  • Pin critical sessions: Drag important sessions to the top of your sidebar; pinned sessions persist across reloads. Perfect for long-running monitoring tasks.

  • Leverage message drafts: PinchChat preserves input text per-session when switching. Use this to queue up messages across multiple agents without losing context.

  • Monitor token burn: Watch those progress bars. When a session's bar fills rapidly, investigate—your agent may be stuck in a loop or processing oversized context.

  • Theme for environment: Use OLED Black for late-night on-call sessions (genuine eye relief), Light for presentations, System for seamless OS integration.

Performance optimization: The dist/ build is aggressively optimized via Vite. For maximum cache efficiency, serve with proper Cache-Control headers—immutable assets get hashed filenames. The PWA caches core assets for offline resilience.


Comparison with Alternatives

Feature PinchChat Generic Chat UIs (ChatGPT-clones) Terminal/Log-based Monitoring
Tool call visualization ✅ Native colored badges, expandable params ❌ Final output only ❌ Raw JSON, manual parsing
Multi-session view ✅ Sidebar + split view ❌ Single conversation ⚠️ Multiple tmux panes
Real-time streaming ✅ Token-by-token with reasoning blocks ✅ Usually ❌ Batch/periodic updates
Token usage tracking ✅ Per-session progress bars ❌ Not shown ❌ Manual calculation
Image handling ✅ Inline with lightbox ⚠️ Basic if supported ❌ Base64 strings
PWA/Installable ✅ Offline capable ⚠️ Varies ❌ N/A
Accessibility ✅ WCAG-focused ⚠️ Varies widely ❌ Terminal limitations
OpenClaw-native ✅ Protocol-aware ❌ Generic OpenAI-compatible ⚠️ Custom scripts
Setup complexity docker run Often requires backend Manual log aggregation
Self-hostable ✅ Fully static, any server ⚠️ Often needs API keys server-side ✅ But you build it

The verdict: Generic UIs treat agents as chatbots. Terminal monitoring treats them as batch jobs. PinchChat is the only option designed for the reality of interactive, tool-using, multi-session agent systems—without sacrificing developer experience.


FAQ

Q: Does PinchChat work without OpenClaw? A: No—it's specifically designed for OpenClaw's WebSocket protocol and message formats. The gateway URL and token authentication are hard requirements.

Q: Is my gateway token secure? A: Tokens are stored in browser localStorage, never in build artifacts or server logs. For shared machines, use browser profiles or clear storage after use. The token travels directly to your gateway via WebSocket—no third-party servers involved.

Q: Can I run PinchChat offline? A: Once loaded, the PWA caches core assets. However, agent functionality requires live WebSocket connection to your gateway. The UI works offline; your agents don't.

Q: How do I troubleshoot connection failures? A: Check HTTPS/WSS alignment first—this causes 80% of issues. Verify gateway reachability with curl ws://host:18789 or browser DevTools Network tab. Enable debug logging (localStorage.setItem('pinchchat:debug', '1')) for frame-level inspection.

Q: Can I customize the theme beyond built-in options? A: The Tailwind-based styling is fully accessible in source. Fork, modify src/styles/ or Tailwind config, and rebuild. The component architecture with Radix primitives makes deep customization straightforward.

Q: Is there mobile support? A: Fully responsive design with touch-optimized interactions. The PWA enables home-screen installation on iOS/Android with native-app feel.

Q: How do I contribute or report bugs? A: The project welcomes contributions—see CONTRIBUTING.md. For security issues, use SECURITY.md. Include raw JSON from the { } viewer for bug reports.


Conclusion

PinchChat solves a problem that shouldn't exist but absolutely does: the complete lack of visibility into what AI agents are actually doing. Every other tool in this space either dumbs agents down to simple chatbots or buries their complexity in unusable log streams. PinchChat threads the needle with rare precision—production-grade observability wrapped in genuinely beautiful, accessible, fast UX.

If you're operating OpenClaw agents in any capacity, you owe it to your sanity and your infrastructure budget to try this. The Docker one-liner gets you running in 30 seconds. The source build lets you customize deeply. The architecture is clean enough to trust, documented enough to extend, and improving fast enough to bet on.

Stop debugging your agents blind. Stop explaining mysterious API bills. Stop wondering why your agent made that inexplicable decision.

👉 Get PinchChat on GitHub — star it, run it, and finally see what your agents are up to.


Built with React 19, Vite 7, and a deep understanding that AI agents deserve better interfaces. MIT licensed by Nicolas Varrot.

Commentaires 0

Aucun commentaire pour l'instant. Soyez le premier à réagir !

Laisser un commentaire