<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: hagen666</title>
    <description>The latest articles on DEV Community by hagen666 (@hagen666).</description>
    <link>https://dev.to/hagen666</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4244046%2F0b1ff9f1-2f67-4b71-9ba0-b43b09cc089b.png</url>
      <title>DEV Community: hagen666</title>
      <link>https://dev.to/hagen666</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hagen666"/>
    <language>en</language>
    <item>
      <title>Turning long AI sessions into a work map: dsh-topic-graph</title>
      <dc:creator>hagen666</dc:creator>
      <pubDate>Sat, 14 Nov 2026 07:40:11 +0000</pubDate>
      <link>https://dev.to/hagen666/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph-3mmj</link>
      <guid>https://dev.to/hagen666/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph-3mmj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Split a session into turns, let AI incrementally cluster them into topics and stages, and see at a glance where tokens, tools, and time went.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;dsh-topic-graph&lt;/code&gt;&lt;/strong&gt; is a Web UI plugin for &lt;a href="https://github.com/deepseek-ai" rel="noopener noreferrer"&gt;DeepSeek Harness&lt;/a&gt; (dsh) that turns a long agent session into a navigable &lt;strong&gt;work map&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;It splits a session into &lt;strong&gt;turns&lt;/strong&gt;, has the model cluster turns into named &lt;strong&gt;topics&lt;/strong&gt; and topics into &lt;strong&gt;stages&lt;/strong&gt; — incrementally, so long sessions don't blow up the context.&lt;/li&gt;
&lt;li&gt;Every topic/stage carries its own &lt;strong&gt;token, tool-call, and agent-time stats&lt;/strong&gt;, so you can see &lt;em&gt;what was expensive&lt;/em&gt; and &lt;em&gt;what was slow&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Three views: &lt;strong&gt;workflow&lt;/strong&gt; (stage → topic tree + details), &lt;strong&gt;timeline&lt;/strong&gt; (turns as an X axis, stages as lanes), and &lt;strong&gt;structure graph&lt;/strong&gt; (topic tree + relation rail).&lt;/li&gt;
&lt;li&gt;Subagent sessions are segmented too and drawn as &lt;strong&gt;branches&lt;/strong&gt; on the same map.&lt;/li&gt;
&lt;li&gt;Recent additions: a &lt;strong&gt;settings page&lt;/strong&gt; (enable/disable the backend service) and &lt;strong&gt;bilingual UI (Chinese / English)&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The problem: long sessions are linear, work is not
&lt;/h2&gt;

&lt;p&gt;If you use an AI coding agent for real work, you know the feeling: after a few hundred turns, you can no longer answer the simplest management questions about your own session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Where did the work actually go?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Which part was expensive / slow?&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Where was that conclusion we reached an hour ago?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A chat log is a linear list of messages. But the work is a network: you bounce between features, hit errors, go back, verify, and revisit. Once a session gets long, reconstructing that map from memory and search is a archaeology project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;dsh-topic-graph&lt;/code&gt;&lt;/strong&gt; does that reconstruction for you. It listens to the session event stream, splits the session by &lt;strong&gt;turns&lt;/strong&gt;, and asks the model to incrementally fold turns into &lt;strong&gt;topics&lt;/strong&gt; and topics into &lt;strong&gt;stages&lt;/strong&gt; — with names, summaries, and stats.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3n2c4u48ftz93axm5l9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3n2c4u48ftz93axm5l9y.png" alt="Workflow: stage overview" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Three concepts
&lt;/h2&gt;

&lt;p&gt;The whole plugin is built on a deliberately boring abstraction:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Turn&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One user message → the assistant's completed reply. The unit of measurement and segmentation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Topic&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;One continuous line of work, e.g. "implement the login endpoint" or "debug the cache stampede".&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A group of adjacent topics that belongs together, e.g. "requirements → implementation → integration".&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every topic and stage is named and summarized by the model, and carries its &lt;strong&gt;token usage, tool calls, and agent time&lt;/strong&gt;. That's the key difference from a plain "chat summary": it measures &lt;strong&gt;effort&lt;/strong&gt;, not just content.&lt;/p&gt;




&lt;h2&gt;
  
  
  View 1: Workflow
&lt;/h2&gt;

&lt;p&gt;The main view is &lt;strong&gt;Topics · Workflow&lt;/strong&gt;. On the left is a &lt;strong&gt;stage → topic&lt;/strong&gt; tree; on the right is the selected stage's detail.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stage tree is collapsible and shows token/time share per stage.&lt;/li&gt;
&lt;li&gt;Stage header shows token usage, wall time, and a tool-call breakdown bar.&lt;/li&gt;
&lt;li&gt;A mini &lt;strong&gt;relations&lt;/strong&gt; diagram shows how the topics inside the stage relate to each other (X = turns, dots = topics, dashed lines = relations).&lt;/li&gt;
&lt;li&gt;Topic cards expand into turn-by-turn detail.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkiqx1r3yjxlducr1kkw9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkiqx1r3yjxlducr1kkw9.png" alt="Workflow: topics and turns" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drill into a turn and you get the token breakdown (input / output / cache read / cache write), step activity time, tool calls, total steps, and the model — plus the user prompt and assistant reply, with a one-click &lt;strong&gt;jump to the conversation&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdnfdks3e0voaeb2c1tvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdnfdks3e0voaeb2c1tvq.png" alt="Workflow: turn detail" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Per-turn AI analysis
&lt;/h3&gt;

&lt;p&gt;Some turns are dense — a messy debugging session, a long investigation. One click turns the turn's model/tool trace into a &lt;strong&gt;human-readable, step-by-step explanation&lt;/strong&gt;, with each step tagged by how many trace steps it covers. The result is cached and can be regenerated.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzfwhtoxx473hpan03edi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzfwhtoxx473hpan03edi.png" alt="Workflow: per-turn AI analysis" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  View 2: Timeline
&lt;/h2&gt;

&lt;p&gt;Switch to &lt;strong&gt;Topics · Graph&lt;/strong&gt; and you get the &lt;strong&gt;timeline&lt;/strong&gt; by default: the X axis is turns (time), the Y axis is stages (lanes), and each topic is drawn as a colored bar spanning its turn range.&lt;/p&gt;

&lt;p&gt;Semantic relations between topics are drawn as faint dashed curves — subtle by default, highlighted on hover or click. You can read "where did we go back to something" without turning the view into a spider web.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhzsgqz8m206q51p7x28l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhzsgqz8m206q51p7x28l.png" alt="Graph: timeline" width="799" height="527"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  View 3: Structure graph
&lt;/h2&gt;

&lt;p&gt;The structure graph is the &lt;strong&gt;stage → topic&lt;/strong&gt; tree, with a relation rail on the right that draws the relations between topics. Stages collapse, hover shows details, click opens the topic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2b0ffdhxmvkfjqls4lk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb2b0ffdhxmvkfjqls4lk.png" alt="Graph: structure" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The timeline answers &lt;em&gt;"what happened when"&lt;/em&gt;. The structure graph answers &lt;em&gt;"how does the work fit together"&lt;/em&gt;. They're complementary, not alternatives.&lt;/p&gt;




&lt;h2&gt;
  
  
  What it measures
&lt;/h2&gt;

&lt;p&gt;The top bar shows session-level stats — tokens, step time, tools, turns, topics, stages, relations, and the AI segmentation cost — with the segmentation model selector and manual segmentation controls right there.&lt;/p&gt;

&lt;p&gt;Each topic, stage, and turn gets three &lt;strong&gt;shares&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Token share&lt;/strong&gt; — how much of the session's tokens this piece of work burned;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-call share&lt;/strong&gt; — how many of the tool calls it accounts for;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent time share&lt;/strong&gt; — how much wall time it took.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After one "project" in a single session, you can answer directly: &lt;strong&gt;which part was most expensive, which was slowest, and which was the most tool-heavy.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Relations between topics
&lt;/h2&gt;

&lt;p&gt;Beyond "what came before what", the plugin identifies semantic relations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;next&lt;/code&gt; — the chronological chain of adjacent root topics;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;belongTo&lt;/code&gt; — a topic belongs to a stage / a subtopic belongs to its parent / a subagent topic belongs to a branch;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;has_relation&lt;/code&gt; — model-judged semantic relations (depends on / continues / contrasts / fixes / verifies / &lt;strong&gt;revisits&lt;/strong&gt; …), with a label;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;delegates&lt;/code&gt; — parent topic → subagent branch delegation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Revisits&lt;/strong&gt; are the pattern that matters most in long sessions: &lt;em&gt;"we talk about A, move to B, then come back to A"&lt;/em&gt;. After segmentation, the plugin runs a cheap, title-only relation pass specifically to surface these "we came back" loops.&lt;/p&gt;




&lt;h2&gt;
  
  
  Subagents on the same map
&lt;/h2&gt;

&lt;p&gt;In dsh, a subagent runs in its own session — easy to lose track of. The plugin segments subagent sessions too and draws them as &lt;strong&gt;branches&lt;/strong&gt; under their parent topic. Multi-level delegation (a subagent spawning another subagent) is supported.&lt;/p&gt;

&lt;p&gt;The result: the main agent's and the subagents' tokens and time can be compared on the same map, instead of each session being its own island.&lt;/p&gt;




&lt;h2&gt;
  
  
  How the segmentation works (the engineering part)
&lt;/h2&gt;

&lt;p&gt;The hard part of "draw a structure over hundreds of turns" isn't the model's intelligence — it's &lt;strong&gt;context length&lt;/strong&gt; and &lt;strong&gt;stability&lt;/strong&gt;. A few things the plugin does:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Incremental segmentation&lt;/strong&gt;: when new turns arrive, only the &lt;em&gt;new&lt;/em&gt; turn summaries plus the existing topic/stage structure are sent to the model. Historical turn bodies are never re-sent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Batching with halving retries&lt;/strong&gt;: 6 turns per request by default; a failed request halves the batch (6 → 3 → 1) and remembers the working size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;400 handling&lt;/strong&gt;: on 400-class errors it retries with the adapter's default reasoning effort.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Truncation detection&lt;/strong&gt;: the output budget scales with topic count; if the structure JSON is truncated, it retries with a larger budget and detects the truncation instead of accepting a half-parsed structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fast fallback&lt;/strong&gt;: repeated failures fall back to local rule-based segmentation, so it never burns money retrying forever.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is that even a huge session can be imported &lt;strong&gt;incrementally, while you watch&lt;/strong&gt;, instead of waiting for one big request that may fail.&lt;/p&gt;




&lt;h2&gt;
  
  
  Settings page and bilingual UI (recent)
&lt;/h2&gt;

&lt;p&gt;The plugin adds a &lt;strong&gt;Topic Graph&lt;/strong&gt; page under dsh &lt;strong&gt;Settings&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend service on/off&lt;/strong&gt; — when disabled, automatic segmentation and AI analysis stop (existing data stays viewable); the setting is persisted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI language&lt;/strong&gt; — Chinese / English / follow dsh, applied instantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI output follows the language&lt;/strong&gt; — topic/stage names, relation labels, and per-turn analysis are generated in the selected language (or match the conversation when set to "follow dsh").&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option 1 (recommended): from the dsh-market plugin market&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Search for &lt;code&gt;dsh-topic-graph&lt;/code&gt; in dsh's plugin market and click &lt;strong&gt;Install&lt;/strong&gt;. Plugin page:&lt;br&gt;
👉 &lt;a href="https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/" rel="noopener noreferrer"&gt;https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: npm&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dsh plugin --profile web add dsh-topic-graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Option 3: GitHub&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dsh plugin --profile web add github:hagen666/dsh-topic-graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Restart dsh and refresh the page — the &lt;strong&gt;Topics&lt;/strong&gt; view appears right after &lt;strong&gt;Chat / Trajectory&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repo: &lt;a href="https://github.com/hagen666/dsh-topic-graph" rel="noopener noreferrer"&gt;https://github.com/hagen666/dsh-topic-graph&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;npm: &lt;a href="https://www.npmjs.com/package/dsh-topic-graph" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/dsh-topic-graph&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Market: &lt;a href="https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/" rel="noopener noreferrer"&gt;https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;The premise is simple: &lt;strong&gt;sessions are written for the AI, but progress is read by humans.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Fold a few hundred turns into a map with stats, relations, and jump-to-turn, and questions that used to require memory — &lt;em&gt;"where are we?", "why did this take so long?", "where was that conclusion?"&lt;/em&gt; — become a glance.&lt;/p&gt;

&lt;p&gt;If you run long tasks with dsh, give it a try. Issues and ideas are very welcome.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
