← Back to Kontasks
Turn Review Optimization Proposal
Solutions for reducing token overhead when Claude reviews turns
Output
Turn Review Optimization
⚠️ The Problem
Current konui_get_turn returns full workingHistory which can be 70K+ tokens for complex turns. Claude then:
- Fails to read with Read tool (25K token limit)
- Falls back to chunked file reads via Bash
- Wastes 3-5 failed attempts before succeeding
- Still processes massive JSON
✅ Solution 1: Add Summary Mode (Recommended)
Add a mode parameter to konui_get_turn:
konui_get_turn({ requestId: "...", mode: "summary" // default, or "full" })
Summary mode returns:
- prompt - Original user request (first 500 chars)
- toolSummary - Aggregated tool calls:
{Read: 35, Grep: 21, Bash: 10} - keyMilestones - First/last 3 events + any errors
- filesChanged - List of edited files
- outcome - Success/fail, duration, token counts
- kontaskSummary - Title + choices (no HTML)
~500 tokens instead of 70K
📄 Solution 2: Paginated Working History
Add pagination to full mode:
konui_get_turn({ requestId: "...", mode: "full", offset: 0, // start from event N limit: 20 // return N events })
Claude can request specific chunks when investigating.
🛠️ Solution 3: Separate Detail Tools
Add specialized tools for deep-dive:
// Get working history events konui_get_turn_events({ requestId, offset, limit }) // Get specific event details konui_get_turn_event({ requestId, eventIndex }) // Search events by tool/keyword konui_search_turn({ requestId, tool: "Edit", pattern: "error" })
📊 Implementation Comparison
| Approach | Effort | Token Savings | Use Case |
|---|---|---|---|
| Summary Mode | ~2 hours | 99% | Most reviews |
| Pagination | ~1 hour | 90%+ | Deep inspection |
| Separate Tools | ~4 hours | 95%+ | Debugging turns |
🎯 Recommendation
Phase 1: Add summary mode with mode: "summary" | "full" parameter (default: summary)
Phase 2: Add pagination for full mode
Phase 3: Add specialized search tools if needed
📝 What Summary Mode Should Extract
{
prompt: "First 500 chars of user request...",
toolCounts: { Read: 35, Grep: 21, Bash: 10, Edit: 1 },
eventCount: 181,
duration: { totalMs: 448506, ttfeMs: 59 },
tokens: { input: 1506, output: 11883, cacheRead: 5.5M },
filesEdited: ["konui/src/views/turn-playback.ts"],
outcome: "completed",
errors: [], // any tool_result errors
kontask: { title: "...", status: "completed" },
commitSha: "0e24809d"
}
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
vibetools
Tags
mcpperformanceturnsoptimization
Created
10 Jan 2026, 12:22 pm
Updated
10 Jan 2026, 12:22 pm
Timing
⏱️ 117.8s
0 tools
● TTFE 0%
● Thinking 100%
● Tools 0%
Created By
claude
📋 Claude's Context
Session
ses_df705a8d...
Raw Data
{
"id": "62e4a01c-5a84-4305-922d-6923d64174a9",
"type": "general",
"status": "completed",
"title": "Turn Review Optimization Proposal",
"description": "Solutions for reducing token overhead when Claude reviews turns",
"context": {
"output": "<div style=\"background:#1e1e1e;color:#e0e0e0;padding:20px;border-radius:8px;font-family:'Consolas','Monaco',monospace;\">\n<h2 style=\"font-family:sans-serif;color:#fff;margin:0 0 16px 0;\">Turn Review Optimization</h2>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#f87171;margin:0 0 12px 0;\">⚠️ The Problem</h3>\n<p style=\"margin:0;line-height:1.6;\">Current <code style=\"background:#374151;padding:2px 6px;border-radius:4px;\">konui_get_turn</code> returns <strong>full workingHistory</strong> which can be 70K+ tokens for complex turns. Claude then:</p>\n<ol style=\"margin:8px 0;padding-left:20px;line-height:1.8;\">\n<li>Fails to read with Read tool (25K token limit)</li>\n<li>Falls back to chunked file reads via Bash</li>\n<li>Wastes 3-5 failed attempts before succeeding</li>\n<li>Still processes massive JSON</li>\n</ol>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#98c379;margin:0 0 12px 0;\">✅ Solution 1: Add Summary Mode (Recommended)</h3>\n<p style=\"margin:0 0 12px 0;color:#e5e7eb;\">Add a <code style=\"background:#374151;padding:2px 6px;border-radius:4px;\">mode</code> parameter to <code style=\"background:#374151;padding:2px 6px;border-radius:4px;\">konui_get_turn</code>:</p>\n<pre style=\"background:#1a1b2e;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;margin:0;\">\n<span style=\"color:#c678dd;\">konui_get_turn</span>({ \n requestId: \"...\", \n <span style=\"color:#98c379;\">mode: \"summary\"</span> <span style=\"color:#7f848e;\">// default, or \"full\"</span>\n})\n</pre>\n<p style=\"margin:12px 0 0 0;\"><strong>Summary mode returns:</strong></p>\n<ul style=\"margin:8px 0;padding-left:20px;line-height:1.8;\">\n<li><span style=\"color:#61afef;\">prompt</span> - Original user request (first 500 chars)</li>\n<li><span style=\"color:#61afef;\">toolSummary</span> - Aggregated tool calls: <code style=\"background:#374151;padding:2px 6px;border-radius:4px;\">{Read: 35, Grep: 21, Bash: 10}</code></li>\n<li><span style=\"color:#61afef;\">keyMilestones</span> - First/last 3 events + any errors</li>\n<li><span style=\"color:#61afef;\">filesChanged</span> - List of edited files</li>\n<li><span style=\"color:#61afef;\">outcome</span> - Success/fail, duration, token counts</li>\n<li><span style=\"color:#61afef;\">kontaskSummary</span> - Title + choices (no HTML)</li>\n</ul>\n<p style=\"margin:12px 0 0 0;color:#22c55e;\"><strong>~500 tokens instead of 70K</strong></p>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#61afef;margin:0 0 12px 0;\">📄 Solution 2: Paginated Working History</h3>\n<p style=\"margin:0 0 12px 0;\">Add pagination to full mode:</p>\n<pre style=\"background:#1a1b2e;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;margin:0;\">\n<span style=\"color:#c678dd;\">konui_get_turn</span>({ \n requestId: \"...\", \n mode: \"full\",\n <span style=\"color:#e5c07b;\">offset: 0</span>, <span style=\"color:#7f848e;\">// start from event N</span>\n <span style=\"color:#e5c07b;\">limit: 20</span> <span style=\"color:#7f848e;\">// return N events</span>\n})\n</pre>\n<p style=\"margin:12px 0 0 0;\">Claude can request specific chunks when investigating.</p>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#c678dd;margin:0 0 12px 0;\">🛠️ Solution 3: Separate Detail Tools</h3>\n<p style=\"margin:0 0 12px 0;\">Add specialized tools for deep-dive:</p>\n<pre style=\"background:#1a1b2e;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;margin:0;\">\n<span style=\"color:#7f848e;\">// Get working history events</span>\n<span style=\"color:#c678dd;\">konui_get_turn_events</span>({ requestId, offset, limit })\n\n<span style=\"color:#7f848e;\">// Get specific event details</span>\n<span style=\"color:#c678dd;\">konui_get_turn_event</span>({ requestId, eventIndex })\n\n<span style=\"color:#7f848e;\">// Search events by tool/keyword</span>\n<span style=\"color:#c678dd;\">konui_search_turn</span>({ requestId, tool: \"Edit\", pattern: \"error\" })\n</pre>\n</div>\n\n<div style=\"background:#2d2d2d;padding:16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#f59e0b;margin:0 0 12px 0;\">📊 Implementation Comparison</h3>\n<table style=\"width:100%;border-collapse:collapse;font-size:0.9rem;\">\n<tr style=\"border-bottom:1px solid #374151;\">\n<th style=\"padding:8px;text-align:left;color:#9ca3af;\">Approach</th>\n<th style=\"padding:8px;text-align:left;color:#9ca3af;\">Effort</th>\n<th style=\"padding:8px;text-align:left;color:#9ca3af;\">Token Savings</th>\n<th style=\"padding:8px;text-align:left;color:#9ca3af;\">Use Case</th>\n</tr>\n<tr style=\"border-bottom:1px solid #374151;\">\n<td style=\"padding:8px;color:#98c379;\">Summary Mode</td>\n<td style=\"padding:8px;\">~2 hours</td>\n<td style=\"padding:8px;color:#22c55e;\">99%</td>\n<td style=\"padding:8px;\">Most reviews</td>\n</tr>\n<tr style=\"border-bottom:1px solid #374151;\">\n<td style=\"padding:8px;color:#61afef;\">Pagination</td>\n<td style=\"padding:8px;\">~1 hour</td>\n<td style=\"padding:8px;color:#22c55e;\">90%+</td>\n<td style=\"padding:8px;\">Deep inspection</td>\n</tr>\n<tr>\n<td style=\"padding:8px;color:#c678dd;\">Separate Tools</td>\n<td style=\"padding:8px;\">~4 hours</td>\n<td style=\"padding:8px;color:#22c55e;\">95%+</td>\n<td style=\"padding:8px;\">Debugging turns</td>\n</tr>\n</table>\n</div>\n\n<div style=\"background:#1e3a2f;border:1px solid #22c55e;padding:12px 16px;border-radius:6px;margin-bottom:16px;\">\n<h3 style=\"color:#22c55e;margin:0 0 8px 0;\">🎯 Recommendation</h3>\n<p style=\"margin:0;line-height:1.6;\"><strong>Phase 1:</strong> Add summary mode with <code style=\"background:#374151;padding:2px 6px;border-radius:4px;\">mode: \"summary\" | \"full\"</code> parameter (default: summary)<br>\n<strong>Phase 2:</strong> Add pagination for full mode<br>\n<strong>Phase 3:</strong> Add specialized search tools if needed</p>\n</div>\n\n<div style=\"background:#252f3f;padding:12px 16px;border-radius:6px;\">\n<h3 style=\"color:#9ca3af;margin:0 0 8px 0;\">📝 What Summary Mode Should Extract</h3>\n<pre style=\"margin:0;color:#e0e0e0;line-height:1.6;\">\n{\n <span style=\"color:#61afef;\">prompt</span>: \"First 500 chars of user request...\",\n <span style=\"color:#61afef;\">toolCounts</span>: { Read: 35, Grep: 21, Bash: 10, Edit: 1 },\n <span style=\"color:#61afef;\">eventCount</span>: 181,\n <span style=\"color:#61afef;\">duration</span>: { totalMs: 448506, ttfeMs: 59 },\n <span style=\"color:#61afef;\">tokens</span>: { input: 1506, output: 11883, cacheRead: 5.5M },\n <span style=\"color:#61afef;\">filesEdited</span>: [\"konui/src/views/turn-playback.ts\"],\n <span style=\"color:#61afef;\">outcome</span>: \"completed\",\n <span style=\"color:#61afef;\">errors</span>: [], <span style=\"color:#7f848e;\">// any tool_result errors</span>\n <span style=\"color:#61afef;\">kontask</span>: { title: \"...\", status: \"completed\" },\n <span style=\"color:#61afef;\">commitSha</span>: \"0e24809d\"\n}\n</pre>\n</div>\n</div>",
"requestedAt": "2026-01-10T12:20:00.000Z",
"requestId": "4d055d65-094e-4001-86f0-94bf4a7e4d56",
"choices": [
{
"label": "Implement summary mode",
"value": "Implement summary mode for konui_get_turn - add mode parameter with 'summary' as default that extracts key metrics instead of full workingHistory",
"primary": true
},
{
"label": "Add pagination first",
"value": "Add offset and limit parameters to konui_get_turn for paginated access to workingHistory"
},
{
"label": "Show current code",
"value": "Show me the current konui_get_turn implementation in konui/mcp/server.ts"
}
],
"turnTiming": {
"totalMs": 117841,
"ttfeMs": 50,
"thinkingMs": 117791,
"toolExecutionMs": 0,
"toolCallCount": 0,
"thinkingPct": 100,
"toolsPct": 0,
"ttfePct": 0
}
},
"createdBy": "claude",
"createdAt": "2026-01-10T02:22:04.063Z",
"updatedAt": "2026-01-10T02:22:10.387Z",
"requestId": "4d055d65-094e-4001-86f0-94bf4a7e4d56",
"scope": "vibetools",
"tags": [
"mcp",
"performance",
"turns",
"optimization"
],
"sessionId": "ses_df705a8d-ea1",
"flowId": "flow_01KEHQ5A7ZX7YDB8KG1NP2GE68",
"flowLinks": [
{
"flowId": "flow_01KEHQ5A7ZX7YDB8KG1NP2GE68",
"edgeType": "evidence",
"createdAt": "2026-01-10T02:22:04.063Z"
}
]
}