← Back to Kontasks
Automatic Flow Topic Refinement Implementation
Output
✅ Automatic Flow Topic Refinement
Implemented automatic flow topic/domain classification refinement based on linked kontask topics.
Problem Solved
PRIMARY_TOPIC_MATCH signals weren't firing because flows had stale topic classifications from their initial title (e.g., "greatVibe Development" → topic_pipeline) that didn't match the actual work being done (kontasks with topic_feature, topic_bugfix, etc.).
Implementation
1. refineFlowTopics() in gv-flow-store.ts • Aggregates topics/domains from all linked kontasks • Adds missing topic edges ("touches" type) • Configurable: minKontaskCount, addPrimary 2. Auto-triggered on link-to-flow • Fire-and-forget call in /api/kontasks/link-to-flow • minKontaskCount: 1 (even single kontask adds topics) 3. MCP Tool: konui_refine_flow_topics • Manual invocation for existing flows • Returns detailed analysis (topic counts, domains)
Test Results
Linked kontask to "greatVibe Development" flow. Topics auto-refined:
topic_schema → Refined from 6 kontasks (6 primary) topic_review → Refined from 5 kontasks (1 primary) topic_planning → Refined from 4 kontasks (1 primary) topic_design → Refined from 3 kontasks (1 primary) topic_docs → Refined from 2 kontasks (0 primary) topic_architecture → Refined from 1 kontask (1 primary) topic_requirements → Refined from 1 kontask (0 primary)
Files Modified
/konui/src/ ├── gv-flow-store.ts # +162 lines (refineFlowTopics function) ├── router.ts # +32 lines (API endpoint + auto-trigger) /konui/mcp/ └── server.ts # +63 lines (MCP tool definition)
Impact on Gravity
Flow-kontask matching now improves over time as more kontasks are linked:
- PRIMARY_TOPIC_MATCH (+25 pts) fires when kontask's primary topic matches flow
- SECONDARY_TOPIC_MATCH (+10 pts) fires for secondary topic overlap
- Flow topics accumulate from linked kontasks → better matching
Commit: 41dec990 • Turn ID: auto-injected
Quick Actions
Original Request
No layout configured
Details
Type
General
Status
Completed
Scope
greatvibe
Tags
gravityflowstopicsclassification
Created
10 Jan 2026, 11:42 pm
Updated
10 Jan 2026, 11:42 pm
Created By
claude
Raw Data
{
"id": "04f0455f-795b-442e-9316-3213c2701457",
"type": "general",
"status": "completed",
"title": "Automatic Flow Topic Refinement Implementation",
"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;\">✅ Automatic Flow Topic Refinement</h2>\n\n<p style=\"color:#98c379;font-size:14px;margin-bottom:16px;\">Implemented automatic flow topic/domain classification refinement based on linked kontask topics.</p>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:16px 0 8px 0;\">Problem Solved</h3>\n<p style=\"color:#e0e0e0;\">PRIMARY_TOPIC_MATCH signals weren't firing because flows had stale topic classifications from their initial title (e.g., \"greatVibe Development\" → <span style=\"color:#e5c07b;\">topic_pipeline</span>) that didn't match the actual work being done (kontasks with <span style=\"color:#e5c07b;\">topic_feature</span>, <span style=\"color:#e5c07b;\">topic_bugfix</span>, etc.).</p>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:16px 0 8px 0;\">Implementation</h3>\n<pre style=\"background:#2d2d2d;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;\">\n<span style=\"color:#c678dd;\">1.</span> <span style=\"color:#98c379;\">refineFlowTopics()</span> in gv-flow-store.ts\n • Aggregates topics/domains from all linked kontasks\n • Adds missing topic edges (\"touches\" type)\n • Configurable: minKontaskCount, addPrimary\n\n<span style=\"color:#c678dd;\">2.</span> <span style=\"color:#98c379;\">Auto-triggered on link-to-flow</span>\n • Fire-and-forget call in /api/kontasks/link-to-flow\n • minKontaskCount: 1 (even single kontask adds topics)\n\n<span style=\"color:#c678dd;\">3.</span> <span style=\"color:#98c379;\">MCP Tool</span>: konui_refine_flow_topics\n • Manual invocation for existing flows\n • Returns detailed analysis (topic counts, domains)\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:16px 0 8px 0;\">Test Results</h3>\n<p style=\"color:#e0e0e0;margin-bottom:8px;\">Linked kontask to \"greatVibe Development\" flow. Topics auto-refined:</p>\n<pre style=\"background:#2d2d2d;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;\">\n<span style=\"color:#98c379;\">topic_schema</span> <span style=\"color:#7f848e;\">→ Refined from 6 kontasks (6 primary)</span>\n<span style=\"color:#98c379;\">topic_review</span> <span style=\"color:#7f848e;\">→ Refined from 5 kontasks (1 primary)</span>\n<span style=\"color:#98c379;\">topic_planning</span> <span style=\"color:#7f848e;\">→ Refined from 4 kontasks (1 primary)</span>\n<span style=\"color:#98c379;\">topic_design</span> <span style=\"color:#7f848e;\">→ Refined from 3 kontasks (1 primary)</span>\n<span style=\"color:#98c379;\">topic_docs</span> <span style=\"color:#7f848e;\">→ Refined from 2 kontasks (0 primary)</span>\n<span style=\"color:#98c379;\">topic_architecture</span> <span style=\"color:#7f848e;\">→ Refined from 1 kontask (1 primary)</span>\n<span style=\"color:#98c379;\">topic_requirements</span> <span style=\"color:#7f848e;\">→ Refined from 1 kontask (0 primary)</span>\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:16px 0 8px 0;\">Files Modified</h3>\n<pre style=\"background:#2d2d2d;padding:12px;border-radius:6px;overflow-x:auto;line-height:1.6;color:#e0e0e0;\">\n<span style=\"color:#56b6c2;\">/konui/src/</span>\n├── <span style=\"color:#e5c07b;\">gv-flow-store.ts</span> <span style=\"color:#7f848e;\"># +162 lines (refineFlowTopics function)</span>\n├── <span style=\"color:#e5c07b;\">router.ts</span> <span style=\"color:#7f848e;\"># +32 lines (API endpoint + auto-trigger)</span>\n<span style=\"color:#56b6c2;\">/konui/mcp/</span>\n└── <span style=\"color:#e5c07b;\">server.ts</span> <span style=\"color:#7f848e;\"># +63 lines (MCP tool definition)</span>\n</pre>\n\n<h3 style=\"font-family:sans-serif;color:#61afef;margin:16px 0 8px 0;\">Impact on Gravity</h3>\n<p style=\"color:#e0e0e0;\">Flow-kontask matching now improves over time as more kontasks are linked:</p>\n<ul style=\"color:#e0e0e0;margin:8px 0;padding-left:20px;\">\n<li><span style=\"color:#98c379;\">PRIMARY_TOPIC_MATCH</span> (+25 pts) fires when kontask's primary topic matches flow</li>\n<li><span style=\"color:#98c379;\">SECONDARY_TOPIC_MATCH</span> (+10 pts) fires for secondary topic overlap</li>\n<li>Flow topics accumulate from linked kontasks → better matching</li>\n</ul>\n\n<p style=\"color:#7f848e;font-size:12px;margin-top:16px;\">Commit: 41dec990 • Turn ID: auto-injected</p>\n</div>",
"choices": [
{
"label": "Test gravity with 20 kontasks",
"value": "Test the gravity well again with the last 20 kontasks to see if PRIMARY_TOPIC_MATCH signals are now firing after the topic refinement",
"primary": true
},
{
"label": "Refine another flow",
"value": "Manually refine topics for another flow using konui_refine_flow_topics"
},
{
"label": "View flow topics",
"value": "Show all topic edges for the greatVibe Development flow"
}
]
},
"createdBy": "claude",
"createdAt": "2026-01-10T13:42:49.230Z",
"updatedAt": "2026-01-10T13:42:49.396Z",
"scope": "greatvibe",
"tags": [
"gravity",
"flows",
"topics",
"classification"
]
}