← Back to Kontasks
Stream-level System-Reminder Injection for Compaction
Implemented automatic injection of kontask reminder into stream after context compaction
Output
✅ Stream-level System-Reminder Injection Implemented
Automatic kontask reminder injection after context compaction is now active.
Problem Solved
When Claude auto-compacts context during a dashboard console session, the critical kontask instructions could be lost in the summarization. This caused Claude to output text without creating a kontask card, losing the deliverable.
Solution Architecture
Stream Event Flow: 1. Claude starts compacting └─ system event with subtype "auto_compact" └─ konsole sends auto_compact event to client 2. Compaction completes └─ First non-system event received └─ konsole sends auto_compact_end event └─ NEW: konsole sends system_reminder event 3. Claude receives reminder └─ <system-reminder> with kontask instructions └─ Contains sessionId and dashboardRequestId └─ Claude remembers to create kontask
Files Changed
konsole/src/ ├── session.ts +33 lines │ └── getPostCompactionReminder() - generates reminder text ├── stream.ts +17 lines │ └── Injects system_reminder after auto_compact_end └── types.ts +1 line └── Added system_reminder to StreamEvent union konui/src/ └── console-event-handler.ts +8 lines └── Client-side handler (logs + shows indicator)
Reminder Content
<system-reminder> POST-COMPACTION REMINDER: Your context was just compacted. CRITICAL: You MUST still create a kontask with your output. The kontask card IS the deliverable. Call konui_create_task with: - sessionId: "ses_xxx" (root level, for flow linking) - context.requestId: "xxx" (for recovery) - context.output: Your full HTML response - scope: "product" or "greatvibe" DO NOT skip the kontask. Text without a kontask is lost. </system-reminder>
Verification
- ✓ Type check passes (konsole + konui)
- ✓ All 201 konsole tests pass
- ✓ All 372 konui tests pass
- ✓ Committed:
84432a2d
Next Steps
Restart konsole to activate the changes. The reminder will be injected automatically on the next compaction event in a dashboard console session.
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
greatvibe
Tags
konsolekontaskscompactionstream
Created
11 Jan 2026, 10:28 am
Updated
11 Jan 2026, 10:28 am
Timing
⏱️ 306.6s
0 tools
● TTFE 0%
● Thinking 100%
● Tools 0%
Created By
claude
📋 Claude's Context
Session
ses_40728090...
🔗 Git Commit
84432a2d
Raw Data
{
"id": "367c0597-eba5-4f79-bd98-24b5bae11c4d",
"type": "general",
"status": "completed",
"title": "Stream-level System-Reminder Injection for Compaction",
"description": "Implemented automatic injection of kontask reminder into stream after context compaction",
"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;\">✅ Stream-level System-Reminder Injection Implemented</h2>\n\n<p style=\"color:#98c379;margin:0 0 16px 0;\">Automatic kontask reminder injection after context compaction is now active.</p>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Problem Solved</h3>\n<p style=\"color:#abb2bf;\">When Claude auto-compacts context during a dashboard console session, the critical kontask instructions could be lost in the summarization. This caused Claude to output text without creating a kontask card, losing the deliverable.</p>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Solution Architecture</h3>\n<pre style=\"background:#2d2d2d;padding:16px;border-radius:6px;overflow-x:auto;line-height:1.8;color:#e0e0e0;\">\n<span style=\"color:#7f848e;\">Stream Event Flow:</span>\n\n<span style=\"color:#e5c07b;\">1. Claude starts compacting</span>\n └─ <span style=\"color:#56b6c2;\">system event</span> with subtype \"auto_compact\"\n └─ konsole sends <span style=\"color:#98c379;\">auto_compact</span> event to client\n\n<span style=\"color:#e5c07b;\">2. Compaction completes</span>\n └─ First non-system event received\n └─ konsole sends <span style=\"color:#98c379;\">auto_compact_end</span> event\n └─ <span style=\"color:#c678dd;font-weight:bold;\">NEW: konsole sends system_reminder event</span>\n\n<span style=\"color:#e5c07b;\">3. Claude receives reminder</span>\n └─ <span style=\"color:#56b6c2;\"><system-reminder></span> with kontask instructions\n └─ Contains sessionId and dashboardRequestId\n └─ Claude remembers to create kontask\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Files Changed</h3>\n<pre style=\"background:#2d2d2d;padding:16px;border-radius:6px;overflow-x:auto;line-height:1.8;color:#e0e0e0;\">\n<span style=\"color:#56b6c2;font-weight:bold;\">konsole/src/</span>\n├── <span style=\"color:#e5c07b;\">session.ts</span> <span style=\"color:#7f848e;\">+33 lines</span>\n│ └── <span style=\"color:#98c379;\">getPostCompactionReminder()</span> - generates reminder text\n├── <span style=\"color:#e5c07b;\">stream.ts</span> <span style=\"color:#7f848e;\">+17 lines</span>\n│ └── Injects <span style=\"color:#98c379;\">system_reminder</span> after auto_compact_end\n└── <span style=\"color:#e5c07b;\">types.ts</span> <span style=\"color:#7f848e;\">+1 line</span>\n └── Added <span style=\"color:#98c379;\">system_reminder</span> to StreamEvent union\n\n<span style=\"color:#56b6c2;font-weight:bold;\">konui/src/</span>\n└── <span style=\"color:#e5c07b;\">console-event-handler.ts</span> <span style=\"color:#7f848e;\">+8 lines</span>\n └── Client-side handler (logs + shows indicator)\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Reminder Content</h3>\n<pre style=\"background:#2d2d2d;padding:16px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#98c379;font-size:13px;\">\n<system-reminder>\nPOST-COMPACTION REMINDER: Your context was just compacted.\n\nCRITICAL: You MUST still create a kontask with your output.\nThe kontask card IS the deliverable.\n\nCall konui_create_task with:\n- sessionId: \"ses_xxx\" (root level, for flow linking)\n- context.requestId: \"xxx\" (for recovery)\n- context.output: Your full HTML response\n- scope: \"product\" or \"greatvibe\"\n\nDO NOT skip the kontask. Text without a kontask is lost.\n</system-reminder>\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Verification</h3>\n<ul style=\"color:#abb2bf;margin:0;padding-left:20px;line-height:2;\">\n<li><span style=\"color:#98c379;\">✓</span> Type check passes (konsole + konui)</li>\n<li><span style=\"color:#98c379;\">✓</span> All 201 konsole tests pass</li>\n<li><span style=\"color:#98c379;\">✓</span> All 372 konui tests pass</li>\n<li><span style=\"color:#98c379;\">✓</span> Committed: <code style=\"background:#2d2d2d;padding:2px 6px;border-radius:3px;\">84432a2d</code></li>\n</ul>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:24px 0 12px 0;\">Next Steps</h3>\n<p style=\"color:#abb2bf;\">Restart konsole to activate the changes. The reminder will be injected automatically on the next compaction event in a dashboard console session.</p>\n\n</div>",
"requestedAt": "2026-01-11T09:15:00.000Z",
"requestId": "840b72e9-57fa-4468-a52a-270d802b3fed",
"commitSha": "84432a2d",
"choices": [
{
"label": "Restart konsole",
"value": "Restart konsole service to activate the stream-level system-reminder injection changes",
"primary": true
},
{
"label": "View the code",
"value": "Show me the key code changes for the system-reminder injection implementation"
},
{
"label": "Test compaction",
"value": "Explain how I can test that the system-reminder injection works correctly"
}
],
"turnTiming": {
"totalMs": 306588,
"ttfeMs": 85,
"thinkingMs": 306501,
"toolExecutionMs": 0,
"toolCallCount": 0,
"thinkingPct": 100,
"toolsPct": 0,
"ttfePct": 0
}
},
"createdBy": "claude",
"createdAt": "2026-01-11T00:28:30.964Z",
"updatedAt": "2026-01-11T00:28:35.167Z",
"requestId": "840b72e9-57fa-4468-a52a-270d802b3fed",
"scope": "greatvibe",
"tags": [
"konsole",
"kontasks",
"compaction",
"stream"
],
"sessionId": "ses_40728090-b86"
}