{"slug": "turning-long-ai-sessions-into-a-work-map-dsh-topic-graph", "title": "Turning long AI sessions into a work map: dsh-topic-graph", "summary": "A developer built dsh-topic-graph, a plugin for the dsh AI coding agent that splits long sessions into turns and uses a model to incrementally cluster them into named topics and stages, each tagged with token usage, tool calls, and agent time. The tool renders the results as a stage-to-topic tree, a turn-by-time timeline, and a semantic relation graph that surfaces revisits and subagent delegation. It is aimed at answering effort questions—which part of a session was most expensive, slowest, or most tool-heavy—rather than summarizing chat content.", "body_md": "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.\n\n`dsh-topic-graph`\nIf 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:\n\nA 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.\n\n**`dsh-topic-graph`** does that reconstruction for you. It listens to the session event stream, splits the session by **turns**, and asks the model to incrementally fold turns into **topics** and topics into **stages** — with names, summaries, and stats.\n\nThe whole plugin is built on a deliberately boring abstraction:\n\n| Concept | What it is | \n|---|---|\n| **Turn** | One user message → the assistant's completed reply. The unit of measurement and segmentation. | \n| **Topic** | One continuous line of work, e.g. \"implement the login endpoint\" or \"debug the cache stampede\". | \n| **Stage** | A group of adjacent topics that belongs together, e.g. \"requirements → implementation → integration\". | \n\nEvery topic and stage is named and summarized by the model, and carries its **token usage, tool calls, and agent time**. That's the key difference from a plain \"chat summary\": it measures **effort**, not just content.\n\nThe main view is **Topics · Workflow**. On the left is a **stage → topic** tree; on the right is the selected stage's detail.\n\nDrill 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 **jump to the conversation**.\n\nSome turns are dense — a messy debugging session, a long investigation. One click turns the turn's model/tool trace into a **human-readable, step-by-step explanation**, with each step tagged by how many trace steps it covers. The result is cached and can be regenerated.\n\nSwitch to **Topics · Graph** and you get the **timeline** 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.\n\nSemantic 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.\n\nThe structure graph is the **stage → topic** tree, with a relation rail on the right that draws the relations between topics. Stages collapse, hover shows details, click opens the topic.\n\nThe timeline answers *\"what happened when\"*. The structure graph answers *\"how does the work fit together\"*. They're complementary, not alternatives.\n\nThe 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.\n\nEach topic, stage, and turn gets three **shares**:\n\nAfter one \"project\" in a single session, you can answer directly: **which part was most expensive, which was slowest, and which was the most tool-heavy.**\n\nBeyond \"what came before what\", the plugin identifies semantic relations:\n\n`next` — the chronological chain of adjacent root topics;`belongTo` — a topic belongs to a stage / a subtopic belongs to its parent / a subagent topic belongs to a branch;`has_relation` — model-judged semantic relations (depends on / continues / contrasts / fixes / verifies / `delegates` — parent topic → subagent branch delegation.\n**Revisits** are the pattern that matters most in long sessions: *\"we talk about A, move to B, then come back to A\"*. After segmentation, the plugin runs a cheap, title-only relation pass specifically to surface these \"we came back\" loops.\n\nIn dsh, a subagent runs in its own session — easy to lose track of. The plugin segments subagent sessions too and draws them as **branches** under their parent topic. Multi-level delegation (a subagent spawning another subagent) is supported.\n\nThe 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.\n\nThe hard part of \"draw a structure over hundreds of turns\" isn't the model's intelligence — it's **context length** and **stability**. A few things the plugin does:\n\nThe result is that even a huge session can be imported **incrementally, while you watch**, instead of waiting for one big request that may fail.\n\nThe plugin adds a **Topic Graph** page under dsh **Settings**:\n\n**Option 1 (recommended): from the dsh-market plugin market**\n\nSearch for `dsh-topic-graph` in dsh's plugin market and click **Install**. Plugin page:\n\n👉 [https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/](https://awesome-dsh-plugin.com/p/hagen666/dsh-topic-graph/)\n\n**Option 2: npm**\n\n```\ndsh plugin --profile web add dsh-topic-graph\n```\n\n**Option 3: GitHub**\n\n```\ndsh plugin --profile web add github:hagen666/dsh-topic-graph\n```\n\nRestart dsh and refresh the page — the **Topics** view appears right after **Chat / Trajectory**.\n\nThe premise is simple: **sessions are written for the AI, but progress is read by humans.**\n\nFold a few hundred turns into a map with stats, relations, and jump-to-turn, and questions that used to require memory — *\"where are we?\", \"why did this take so long?\", \"where was that conclusion?\"* — become a glance.\n\nIf you run long tasks with dsh, give it a try. Issues and ideas are very welcome.", "url": "https://wpnews.pro/news/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph", "canonical_source": "https://dev.to/hagen666/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph-3mmj", "published_at": "2026-11-14 07:40:11+00:00", "updated_at": "2026-11-14 07:50:15.378450+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["dsh-topic-graph", "dsh"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph", "markdown": "https://wpnews.pro/news/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph.md", "text": "https://wpnews.pro/news/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph.txt", "jsonld": "https://wpnews.pro/news/turning-long-ai-sessions-into-a-work-map-dsh-topic-graph.jsonld"}}