💬 Console
Loading kontask...
Open full page →
Completed
on 11 Jan 2026, 11:43 am

Output

Context Injection Architecture

Two mechanisms work together to give Claude the context it needs at turn start.

1. Auto-Injected by Code (router.ts)

Injected dynamically into every dashboard console prompt:

<turn-context session="ses_xxx">
  current-flow: flow_xxx "Flow Title"
  active-flows:
    - flow_abc: "Feature A" (feature)
    - flow_def: "Bug Fix B" (bugfix) ←current
  recent: "Last Kontask", "Previous", "Before That"
  ⚡ 2 approved task(s) awaiting processing
  🔗 Thread hint (if debugging sequence detected)
</turn-context>
<!-- Thread detection comment with lastKontaskId -->

DASHBOARD CONSOLE REQUEST from user "username":
{user prompt}

---
CRITICAL OUTPUT INSTRUCTIONS - You MUST create a kontask...
  - sessionId: "ses_xxx" (exact session)
  - requestId: "uuid" (for turn recovery)
  - scope: product|greatvibe
  - Tool usage reminders (Glob, Grep, Read, Task)

Source: konui/src/router.ts:200-243 and konui/src/turn-context.ts

2. Seeded in CLAUDE.md (Static Instructions)

Always loaded as project instructions, teaches Claude how to use the injected context:

## Turn Context (Auto-Injected)
  - What the <turn-context> tag means
  - How to read active-flows and link kontasks via flowId
  - When to call konui_get_turn_context (rarely needed)
  - What NOT to do at turn start (don't call redundant tools)

## Dashboard Console Kontask Requirement
  - How to detect dashboard sessions
  - Always create kontask with output
  - Post-compaction reminder

## Approved Task Handling
  - Trust hook output for approved tasks
  - Process approved tasks before user request

## Kontask Output Format
  - HTML templates (dark theme preferred)
  - Button styling, status badges
  - context.choices for interactive options

## gvFlow - Flow Curation
  - How flows are emergent (auto-create)
  - When to specify flowId
  - Flow types and lifecycle

## Thread Detection
  - When to create 'continues' edges
  - Debugging sequence patterns

Why This Split?

Auto-Injected CLAUDE.md
Dynamic data (session ID, flows, recent work) Static instructions (how to interpret data)
Per-turn values (requestId, username) Behavioral patterns (when to create kontasks)
Lightweight (~200 tokens) Comprehensive (~8K tokens)
Changes every turn Same for all turns

Key Files

Auto-injection:
  └── konui/src/router.ts         # Wraps prompt at :200-243
  └── konui/src/turn-context.ts   # getMinimalTurnContext()

Static instructions:
  └── CLAUDE.md                   # Project instructions
      └── "Turn Context" section
      └── "Dashboard Console" section
      └── "Kontask" sections
Summary: Auto-injection provides the data (what session, what flows exist), while CLAUDE.md provides the training (how to use that data, when to create kontasks, output formatting).

Quick Actions

View Turn
Original Request

No layout configured

Details

Type General
Status Completed
Scope greatvibe
Tags konsolecontextarchitecture
Created 11 Jan 2026, 11:43 am
Updated 11 Jan 2026, 11:43 am
Timing
⏱️ 114.6s
0 tools
TTFE 0% Thinking 100% Tools 0%
Created By claude

📋 Claude's Context

Session ses_40728090...

Raw Data

{
  "id": "4b19ee8f-92a5-4393-8a25-f8062eaa46f9",
  "type": "general",
  "status": "completed",
  "title": "Auto-Injection vs CLAUDE.md Instructions Analysis",
  "description": "Breakdown of what's auto-injected into prompts vs what's seeded via CLAUDE.md",
  "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;\">Context Injection Architecture</h2>\n\n<p style=\"color:#98c379;font-size:14px;margin-bottom:20px;\">Two mechanisms work together to give Claude the context it needs at turn start.</p>\n\n<h3 style=\"color:#61afef;margin:20px 0 12px 0;\">1. Auto-Injected by Code (router.ts)</h3>\n<p style=\"color:#7f848e;margin-bottom:10px;\">Injected dynamically into every dashboard console prompt:</p>\n<pre style=\"background:#2d2d2d;padding:16px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;\">\n<span style=\"color:#c678dd;\">&lt;turn-context</span> session=\"ses_xxx\"<span style=\"color:#c678dd;\">&gt;</span>\n  <span style=\"color:#98c379;\">current-flow:</span> flow_xxx \"Flow Title\"\n  <span style=\"color:#98c379;\">active-flows:</span>\n    - flow_abc: \"Feature A\" (feature)\n    - flow_def: \"Bug Fix B\" (bugfix) ←current\n  <span style=\"color:#98c379;\">recent:</span> \"Last Kontask\", \"Previous\", \"Before That\"\n  <span style=\"color:#e5c07b;\">⚡ 2 approved task(s) awaiting processing</span>\n  <span style=\"color:#56b6c2;\">🔗 Thread hint (if debugging sequence detected)</span>\n<span style=\"color:#c678dd;\">&lt;/turn-context&gt;</span>\n<span style=\"color:#7f848e;\">&lt;!-- Thread detection comment with lastKontaskId --&gt;</span>\n\n<span style=\"color:#e5c07b;\">DASHBOARD CONSOLE REQUEST from user \"username\":</span>\n{user prompt}\n\n---\n<span style=\"color:#f97316;\">CRITICAL OUTPUT INSTRUCTIONS</span> - You MUST create a kontask...\n  - sessionId: \"ses_xxx\" <span style=\"color:#7f848e;\">(exact session)</span>\n  - requestId: \"uuid\" <span style=\"color:#7f848e;\">(for turn recovery)</span>\n  - scope: product|greatvibe\n  - Tool usage reminders (Glob, Grep, Read, Task)\n</pre>\n\n<p style=\"color:#7f848e;margin:16px 0 8px;\"><strong>Source:</strong> <code style=\"color:#98c379;\">konui/src/router.ts:200-243</code> and <code style=\"color:#98c379;\">konui/src/turn-context.ts</code></p>\n\n<h3 style=\"color:#61afef;margin:20px 0 12px 0;\">2. Seeded in CLAUDE.md (Static Instructions)</h3>\n<p style=\"color:#7f848e;margin-bottom:10px;\">Always loaded as project instructions, teaches Claude <em>how</em> to use the injected context:</p>\n<pre style=\"background:#2d2d2d;padding:16px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;\">\n<span style=\"color:#c678dd;\">## Turn Context (Auto-Injected)</span>\n  - What the &lt;turn-context&gt; tag means\n  - How to read active-flows and link kontasks via flowId\n  - When to call konui_get_turn_context (rarely needed)\n  - What NOT to do at turn start (don't call redundant tools)\n\n<span style=\"color:#c678dd;\">## Dashboard Console Kontask Requirement</span>\n  - How to detect dashboard sessions\n  - Always create kontask with output\n  - Post-compaction reminder\n\n<span style=\"color:#c678dd;\">## Approved Task Handling</span>\n  - Trust hook output for approved tasks\n  - Process approved tasks before user request\n\n<span style=\"color:#c678dd;\">## Kontask Output Format</span>\n  - HTML templates (dark theme preferred)\n  - Button styling, status badges\n  - context.choices for interactive options\n\n<span style=\"color:#c678dd;\">## gvFlow - Flow Curation</span>\n  - How flows are emergent (auto-create)\n  - When to specify flowId\n  - Flow types and lifecycle\n\n<span style=\"color:#c678dd;\">## Thread Detection</span>\n  - When to create 'continues' edges\n  - Debugging sequence patterns\n</pre>\n\n<h3 style=\"color:#61afef;margin:20px 0 12px 0;\">Why This Split?</h3>\n<table style=\"width:100%;border-collapse:collapse;margin:12px 0;\">\n<tr style=\"background:#2d2d2d;\">\n  <th style=\"padding:10px;text-align:left;color:#e5c07b;border-bottom:1px solid #444;\">Auto-Injected</th>\n  <th style=\"padding:10px;text-align:left;color:#e5c07b;border-bottom:1px solid #444;\">CLAUDE.md</th>\n</tr>\n<tr>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#98c379;\">Dynamic data</span> (session ID, flows, recent work)</td>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#56b6c2;\">Static instructions</span> (how to interpret data)</td>\n</tr>\n<tr>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#98c379;\">Per-turn values</span> (requestId, username)</td>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#56b6c2;\">Behavioral patterns</span> (when to create kontasks)</td>\n</tr>\n<tr>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#98c379;\">Lightweight</span> (~200 tokens)</td>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#56b6c2;\">Comprehensive</span> (~8K tokens)</td>\n</tr>\n<tr>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#98c379;\">Changes every turn</span></td>\n  <td style=\"padding:10px;border-bottom:1px solid #333;\"><span style=\"color:#56b6c2;\">Same for all turns</span></td>\n</tr>\n</table>\n\n<h3 style=\"color:#61afef;margin:20px 0 12px 0;\">Key Files</h3>\n<pre style=\"background:#2d2d2d;padding:12px;border-radius:6px;line-height:1.8;\">\n<span style=\"color:#56b6c2;font-weight:bold;\">Auto-injection:</span>\n  └── <span style=\"color:#e5c07b;\">konui/src/router.ts</span>         <span style=\"color:#7f848e;\"># Wraps prompt at :200-243</span>\n  └── <span style=\"color:#e5c07b;\">konui/src/turn-context.ts</span>   <span style=\"color:#7f848e;\"># getMinimalTurnContext()</span>\n\n<span style=\"color:#56b6c2;font-weight:bold;\">Static instructions:</span>\n  └── <span style=\"color:#e5c07b;\">CLAUDE.md</span>                   <span style=\"color:#7f848e;\"># Project instructions</span>\n      └── \"Turn Context\" section\n      └── \"Dashboard Console\" section\n      └── \"Kontask\" sections\n</pre>\n\n<div style=\"margin-top:20px;padding:12px;background:#2d2d2d;border-radius:6px;border-left:4px solid #22c55e;\">\n<strong style=\"color:#22c55e;\">Summary:</strong> Auto-injection provides the <em>data</em> (what session, what flows exist), while CLAUDE.md provides the <em>training</em> (how to use that data, when to create kontasks, output formatting).\n</div>\n</div>",
    "requestedAt": "2026-01-11T10:30:00.000Z",
    "requestId": "74ada610-a963-4a1c-833b-3bbae334da7f",
    "choices": [
      {
        "label": "Show turn-context.ts",
        "value": "Show me the full turn-context.ts file that builds the <turn-context> tag",
        "primary": false
      },
      {
        "label": "Show router injection",
        "value": "Show the exact code in router.ts where prompts are wrapped with context",
        "primary": false
      },
      {
        "label": "CLAUDE.md sections",
        "value": "List all the sections in CLAUDE.md that teach Claude about dashboard console behavior",
        "primary": false
      }
    ],
    "turnTiming": {
      "totalMs": 114587,
      "ttfeMs": 102,
      "thinkingMs": 114482,
      "toolExecutionMs": 0,
      "toolCallCount": 0,
      "thinkingPct": 100,
      "toolsPct": 0,
      "ttfePct": 0
    }
  },
  "createdBy": "claude",
  "createdAt": "2026-01-11T01:43:40.166Z",
  "updatedAt": "2026-01-11T01:43:51.883Z",
  "requestId": "74ada610-a963-4a1c-833b-3bbae334da7f",
  "scope": "greatvibe",
  "tags": [
    "konsole",
    "context",
    "architecture"
  ],
  "sessionId": "ses_40728090-b86"
}
Loading timeline...
Loading kontask...
Open full page →
DashboardReportsKontasksOrphansFlowsDecisionsSessionsTelemetryLogs + Go