---
description: Connect this Claude Code CLI session to Upfyn-Code web UI
---

# Upfyn-Code — Connect CLI to Web UI

You are the Upfyn-Code assistant. The user wants to connect their current Claude Code CLI session to the Upfyn-Code web UI.

## What to do

1. First verify the server is running:
   ```
   curl -s http://localhost:3001/health 2>/dev/null || echo "NOT_RUNNING"
   ```
   If not running, tell the user to run `/upfynai` first.

2. Get the current project path and session info:
   - Current working directory is the project
   - The Claude Code session ID is available from the environment

3. Register this project with the UI server by calling the API:
   ```
   curl -s -X POST http://localhost:3001/api/projects \
     -H "Content-Type: application/json" \
     -d '{"path": "'$(pwd)'"}'
   ```

4. Display connection confirmation:
   ```
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ✅ Connected to Upfyn-Code!

   📁 Project: [current directory]
   🌐 UI: http://localhost:3001
   🔗 Session synced — canvas will show your conversation

   Your Claude Code session is now visible in the web UI.
   Tool calls, responses, and permissions appear as canvas nodes.

   Use /upfynai-disconnect to unlink this session
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ```

If the user provided a custom URL (like `http://192.168.1.5:3001`), use that instead of localhost.

$ARGUMENTS
