← Back to Kontasks
Current Architecture: Konui ↔ Konsole ↔ Claude
Detailed analysis of how dashboard console communicates with konsole and Claude CLI
Output
Current Architecture: Konui ↔ Konsole ↔ Claude
Data Flow Overview
┌─────────────────┐ │ Browser Client │ └────────┬────────┘ │ POST /api/konsole/dashboard/stream │ {prompt, requestId, images} ▼ ┌─────────────────────────────────────┐ │ Konui Server (port 8666) │ │ • Health check konsole │ │ • Get/create session file │ │ • Wrap prompt with kontask template │ └─────────────────┬───────────────────┘ │ POST /sessions/{id}/prompt │ JSON body to konsole ▼ ┌─────────────────────────────────────┐ │ Konsole Server (port 8020) │ │ • Manage session lifecycle │ │ • Spawn Claude CLI subprocess │ │ • Parse stream-json stdout │ └─────────────────┬───────────────────┘ │ claude --output-format stream-json │ --resume {claudeSessionId} ▼ ┌─────────────────────────────────────┐ │ Claude Code CLI (subprocess) │ │ stdout: line-delimited JSON │ └─────────────────────────────────────┘
Protocol at Each Hop
| Hop | Protocol | Format |
|---|---|---|
| Browser → Konui | HTTP POST | JSON body |
| Konui ← Browser | SSE | text/event-stream |
| Konui → Konsole | HTTP POST | JSON body |
| Konsole ← Konui | SSE | text/event-stream |
| Konsole → Claude | stdin (CLI arg) | Prompt string |
| Claude → Konsole | stdout | stream-json (NDJSON) |
Claude stream-json Events
{"type":"system","session_id":"uuid","subtype":"init"}
{"type":"assistant","message":{"content":[{"type":"tool_use",...}]}}
{"type":"user","message":{"content":[{"type":"tool_result",...}]}}
{"type":"result","result":"final response","usage":{...}}Key Files
| konui/src/router.ts:1295 | Dashboard stream handler |
| konui/src/konsole-client.ts:218 | sendPromptToKonsole() |
| konsole/src/main.ts:263 | HTTP route handler |
| konsole/src/stream.ts:221 | processPrompt() + SSE |
| konsole/src/claude.ts:43 | spawnClaude() subprocess |
Key Insight for Quick Turn
The current architecture already routes everything through konsole. Konui never talks directly to Claude. This means adding chat sessions to konsole is the right approach - we just need to:
• Add a new session type (chat) that uses API instead of CLI
• Add session pooling for warm sessions
• Add provider abstraction layer
The SSE streaming infrastructure already exists and can be reused.
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
architecturekonsolekonuistreaming
Created
5 Jan 2026, 11:44 am
Updated
5 Jan 2026, 11:44 am
Timing
⏱️ 167.7s
15 tools
● TTFE 3%
● Thinking 48%
● Tools 49%
Created By
claude
Raw Data
{
"id": "e531bdf2-32e4-4982-aa7b-b616fb7815f3",
"type": "general",
"status": "completed",
"title": "Current Architecture: Konui ↔ Konsole ↔ Claude",
"description": "Detailed analysis of how dashboard console communicates with konsole and Claude CLI",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\"><h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">Current Architecture: Konui ↔ Konsole ↔ Claude</h2><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#daa520;margin:0 0 12px 0;\">Data Flow Overview</h3><pre style=\"margin:0;color:#e0e0e0;font-size:0.8em;line-height:1.5;overflow-x:auto;\"><span style=\"color:#61afef;\">┌─────────────────┐</span>\n<span style=\"color:#61afef;\">│ Browser Client │</span>\n<span style=\"color:#61afef;\">└────────┬────────┘</span>\n │ <span style=\"color:#98c379;\">POST /api/konsole/dashboard/stream</span>\n │ <span style=\"color:#7f848e;\">{prompt, requestId, images}</span>\n ▼\n<span style=\"color:#c678dd;\">┌─────────────────────────────────────┐</span>\n<span style=\"color:#c678dd;\">│ Konui Server (port 8666) │</span>\n<span style=\"color:#c678dd;\">│ • Health check konsole │</span>\n<span style=\"color:#c678dd;\">│ • Get/create session file │</span>\n<span style=\"color:#c678dd;\">│ • Wrap prompt with kontask template │</span>\n<span style=\"color:#c678dd;\">└─────────────────┬───────────────────┘</span>\n │ <span style=\"color:#98c379;\">POST /sessions/{id}/prompt</span>\n │ <span style=\"color:#7f848e;\">JSON body to konsole</span>\n ▼\n<span style=\"color:#e5c07b;\">┌─────────────────────────────────────┐</span>\n<span style=\"color:#e5c07b;\">│ Konsole Server (port 8020) │</span>\n<span style=\"color:#e5c07b;\">│ • Manage session lifecycle │</span>\n<span style=\"color:#e5c07b;\">│ • Spawn Claude CLI subprocess │</span>\n<span style=\"color:#e5c07b;\">│ • Parse stream-json stdout │</span>\n<span style=\"color:#e5c07b;\">└─────────────────┬───────────────────┘</span>\n │ <span style=\"color:#98c379;\">claude --output-format stream-json</span>\n │ <span style=\"color:#7f848e;\">--resume {claudeSessionId}</span>\n ▼\n<span style=\"color:#56b6c2;\">┌─────────────────────────────────────┐</span>\n<span style=\"color:#56b6c2;\">│ Claude Code CLI (subprocess) │</span>\n<span style=\"color:#56b6c2;\">│ stdout: line-delimited JSON │</span>\n<span style=\"color:#56b6c2;\">└─────────────────────────────────────┘</span></pre></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#4caf50;margin:0 0 12px 0;\">Protocol at Each Hop</h3><table style=\"width:100%;border-collapse:collapse;font-size:0.85em;\"><tr style=\"background:#1e1e1e;\"><th style=\"padding:10px;text-align:left;border-bottom:1px solid #444;\">Hop</th><th style=\"padding:10px;text-align:left;border-bottom:1px solid #444;\">Protocol</th><th style=\"padding:10px;text-align:left;border-bottom:1px solid #444;\">Format</th></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Browser → Konui</td><td style=\"padding:10px;border-bottom:1px solid #333;\">HTTP POST</td><td style=\"padding:10px;border-bottom:1px solid #333;\">JSON body</td></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Konui ← Browser</td><td style=\"padding:10px;border-bottom:1px solid #333;\"><strong>SSE</strong></td><td style=\"padding:10px;border-bottom:1px solid #333;\">text/event-stream</td></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Konui → Konsole</td><td style=\"padding:10px;border-bottom:1px solid #333;\">HTTP POST</td><td style=\"padding:10px;border-bottom:1px solid #333;\">JSON body</td></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Konsole ← Konui</td><td style=\"padding:10px;border-bottom:1px solid #333;\"><strong>SSE</strong></td><td style=\"padding:10px;border-bottom:1px solid #333;\">text/event-stream</td></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Konsole → Claude</td><td style=\"padding:10px;border-bottom:1px solid #333;\">stdin (CLI arg)</td><td style=\"padding:10px;border-bottom:1px solid #333;\">Prompt string</td></tr><tr><td style=\"padding:10px;border-bottom:1px solid #333;\">Claude → Konsole</td><td style=\"padding:10px;border-bottom:1px solid #333;\"><strong>stdout</strong></td><td style=\"padding:10px;border-bottom:1px solid #333;\">stream-json (NDJSON)</td></tr></table></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#9c27b0;margin:0 0 12px 0;\">Claude stream-json Events</h3><pre style=\"margin:0;color:#aaa;font-size:0.8em;line-height:1.5;\">{\"type\":\"system\",\"session_id\":\"uuid\",\"subtype\":\"init\"}\n{\"type\":\"assistant\",\"message\":{\"content\":[{\"type\":\"tool_use\",...}]}}\n{\"type\":\"user\",\"message\":{\"content\":[{\"type\":\"tool_result\",...}]}}\n{\"type\":\"result\",\"result\":\"final response\",\"usage\":{...}}</pre></div><div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\"><h3 style=\"color:#2196f3;margin:0 0 12px 0;\">Key Files</h3><table style=\"width:100%;border-collapse:collapse;font-size:0.85em;\"><tr><td style=\"padding:6px;border-bottom:1px solid #444;color:#61afef;\">konui/src/router.ts:1295</td><td style=\"padding:6px;border-bottom:1px solid #444;\">Dashboard stream handler</td></tr><tr><td style=\"padding:6px;border-bottom:1px solid #444;color:#61afef;\">konui/src/konsole-client.ts:218</td><td style=\"padding:6px;border-bottom:1px solid #444;\">sendPromptToKonsole()</td></tr><tr><td style=\"padding:6px;border-bottom:1px solid #444;color:#61afef;\">konsole/src/main.ts:263</td><td style=\"padding:6px;border-bottom:1px solid #444;\">HTTP route handler</td></tr><tr><td style=\"padding:6px;border-bottom:1px solid #444;color:#61afef;\">konsole/src/stream.ts:221</td><td style=\"padding:6px;border-bottom:1px solid #444;\">processPrompt() + SSE</td></tr><tr><td style=\"padding:6px;border-bottom:1px solid #444;color:#61afef;\">konsole/src/claude.ts:43</td><td style=\"padding:6px;border-bottom:1px solid #444;\">spawnClaude() subprocess</td></tr></table></div><div style=\"background:rgba(218,165,32,0.15);border:1px solid rgba(218,165,32,0.3);padding:12px;border-radius:6px;\"><h4 style=\"margin:0 0 8px 0;color:#daa520;\">Key Insight for Quick Turn</h4><p style=\"margin:0;color:#e0e0e0;line-height:1.6;\">The current architecture already routes <strong>everything through konsole</strong>. Konui never talks directly to Claude. This means adding chat sessions to konsole is the right approach - we just need to:<br><br>• Add a new session type (<code>chat</code>) that uses API instead of CLI<br>• Add session pooling for warm sessions<br>• Add provider abstraction layer<br><br>The SSE streaming infrastructure already exists and can be reused.</p></div></div>",
"requestedAt": "2026-01-05T12:45:00Z",
"requestId": "0b5ef02f-df98-44db-b5ec-4cd5ae8e07ca",
"choices": [
{
"label": "Start Phase 2a",
"value": "Start implementing Phase 2a - add chat session type to konsole with API-based provider",
"primary": true
},
{
"label": "More detail",
"value": "Show me more detail about the SSE streaming infrastructure"
},
{
"label": "Different focus",
"value": "I want to focus on something else"
}
],
"turnTiming": {
"totalMs": 167650,
"ttfeMs": 4470,
"thinkingMs": 81231,
"toolExecutionMs": 81947,
"toolCallCount": 15,
"thinkingPct": 48,
"toolsPct": 49,
"ttfePct": 3
}
},
"createdBy": "claude",
"createdAt": "2026-01-05T01:44:25.834Z",
"updatedAt": "2026-01-05T01:44:32.211Z",
"requestId": "0b5ef02f-df98-44db-b5ec-4cd5ae8e07ca",
"scope": "vibetools",
"tags": [
"architecture",
"konsole",
"konui",
"streaming"
],
"targetUser": "claude"
}