<?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: 世界是一片荒原</title>
    <description>The latest articles on DEV Community by 世界是一片荒原 (@wanqiu12345).</description>
    <link>https://dev.to/wanqiu12345</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%2F4253530%2F95b496a1-70b5-4a24-8c83-d0f6f96dc50d.jpg</url>
      <title>DEV Community: 世界是一片荒原</title>
      <link>https://dev.to/wanqiu12345</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wanqiu12345"/>
    <language>en</language>
    <item>
      <title>Running four AI sessions at once — with a live agent graph and context-compaction warnings</title>
      <dc:creator>世界是一片荒原</dc:creator>
      <pubDate>Thu, 19 Nov 2026 09:56:26 +0000</pubDate>
      <link>https://dev.to/wanqiu12345/running-four-ai-sessions-at-once-with-a-live-agent-graph-and-context-compaction-warnings-319</link>
      <guid>https://dev.to/wanqiu12345/running-four-ai-sessions-at-once-with-a-live-agent-graph-and-context-compaction-warnings-319</guid>
      <description>&lt;h3&gt;
  
  
  A panoramic console for multiple Agent sessions
&lt;/h3&gt;

&lt;p&gt;When you push several tasks in DeepSeek Harness (DSH) at once, the bottleneck isn't model speed — it's that &lt;strong&gt;you can only watch one session&lt;/strong&gt;. Code is being edited in A, research is running in B, subagents are working underneath — but you have to open each one and switch back and forth, guessing which is stuck and which is close to filling its context.&lt;/p&gt;

&lt;p&gt;Subagents are a black box too: which parent session they hang off and how much work they've done is invisible in the stock UI. And compaction happens silently — halfway through an edit, early conversation gets replaced by a summary, and the first things lost are exactly what a successor needs: file paths, commands, error messages.&lt;/p&gt;

&lt;p&gt;These are gaps in DSH's native UI, not configuration mistakes. I built a plugin to close them: &lt;strong&gt;Session Matrix&lt;/strong&gt; (&lt;code&gt;dsh-session-matrix&lt;/code&gt;) — a &lt;strong&gt;panoramic console&lt;/strong&gt; that lets you watch multiple sessions running in parallel, see the parent/child Agent graph at a glance, and hand work off before the details are lost.&lt;/p&gt;

&lt;h3&gt;
  
  
  What installing it adds
&lt;/h3&gt;

&lt;p&gt;Nothing is injected into your conversation flow. You get one new sidebar entry, "会话矩阵工作台", with two tabs: &lt;strong&gt;Workspace&lt;/strong&gt; and &lt;strong&gt;Agent graph&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%2Fzrrueomkmlng5wfbgeyd.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%2Fzrrueomkmlng5wfbgeyd.png" alt="Sidebar entry and session list" width="800" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Workspace: four native panes you can actually type in
&lt;/h3&gt;

&lt;p&gt;The workspace opens up to four session panes in a 2×2 grid. The point is not just "side by side" — &lt;strong&gt;every pane is a real native DSH conversation instance&lt;/strong&gt;. Message stream, tool-call rows, approval buttons, Chat/Trajectory switching, and the composer at the bottom are all native, so you can type and send messages right there. It is not a wall of read-only screenshots.&lt;/p&gt;

&lt;p&gt;A session only ever occupies one pane — no duplicates. Dividers drag and the ratio is remembered; each pane has a zoom slider with four steps (55/70/85/100%), remembered per session.&lt;/p&gt;

&lt;p&gt;The one exception is subagents: their panes are read-only, marked with a "只读 · 子代理" badge, viewable but not directly promptable. That matches DSH's own rules.&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%2F2m3op1edvym2dcsu2oba.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%2F2m3op1edvym2dcsu2oba.png" alt="Four native panes side by side" width="800" height="548"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Agent graph: see who hangs off whom
&lt;/h3&gt;

&lt;p&gt;The second view is a four-column directed graph: workbench → project → session → subagent.&lt;/p&gt;

&lt;p&gt;The edges are not guesses — they come only from the real &lt;code&gt;parentSession&lt;/code&gt; field in each session header. Parent-child relationships are actual data, not "they look like the same project, draw a line." Node color shows distance to the compaction point (normal / warning / critical); node size shows cumulative usage, so the heavy ones stand out.&lt;/p&gt;

&lt;p&gt;Select any node and three panels below re-scope to its subtree: prompt composition (what the model sees right now), cumulative usage and cost (what this session has burned in total), and a per-session matrix — so you can see at a glance who is spending the most and who is near the limit.&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%2Fyjxlk9uyrswv5hn133wc.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%2Fyjxlk9uyrswv5hn133wc.png" alt="Agent graph with the neural link and node drill-down" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One distinction worth calling out: &lt;strong&gt;"context occupancy" and "cumulative usage" are different things.&lt;/strong&gt; The former is how many tokens are in the model's view right now — a snapshot that rolls forward as the session runs. The latter is the total read/written over the session's life, monotonically increasing, including cache reads and writes. The UI labels both clearly so you don't mix them up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compaction warning: the official formula, not a made-up percentage
&lt;/h3&gt;

&lt;p&gt;For context monitoring I did not invent thresholds. The compaction point mirrors DSH's own &lt;code&gt;dsh-compaction-basic&lt;/code&gt; plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;messageBudget  = contextWindow − reservedCompletionTokens
pressureBudget = messageBudget − policy.headroomTokens   # headroom defaults to 4096
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a 1,048,576 window with 256,000 reserved, that is 788,480 tokens (75.2%). The warning line sits at 80% of the point, the critical line at 92%. Occupancy uses the provider-reported prompt size, not a character estimate.&lt;/p&gt;

&lt;p&gt;To be precise: &lt;strong&gt;this is a warning before compaction — it does not expand the context window or stop compaction from happening.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Handoff protocol: let the agent write the handoff before compaction
&lt;/h3&gt;

&lt;p&gt;Losing details to compaction is better routed around than fought. The top-right "通用交接提示词" button copies a prompt you send into a target session. The agent then self-checks the session title, extracts state, snapshots files to disk, and writes a structured &lt;code&gt;HANDOFF-&amp;lt;timestamp&amp;gt;.md&lt;/code&gt; with seven sections: goal, progress, key files, rejected approaches, and open questions. Paste the takeover message into a fresh session and carry on.&lt;/p&gt;

&lt;p&gt;The button only copies — it does not send anything or modify any session. The protocol tells the agent not to write API keys, passwords, or cookies. If the target session is not open in a pane, a notice offers a "载入窗格" button and the target pane flashes three times so you paste into the right place.&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%2Ft9gjm9svt0ykrn1b5pox.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%2Ft9gjm9svt0ykrn1b5pox.png" alt="Handoff prompt" width="800" height="547"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost: CNY estimates with explicit peak/off-peak buckets
&lt;/h3&gt;

&lt;p&gt;Cost is shown as an &lt;strong&gt;estimate in CNY&lt;/strong&gt;, using DeepSeek's official price list, peak hours at 2× (weekdays 09:00–12:00 and 14:00–18:00 Beijing time, excluding holidays), with cache hits broken out. This is an estimate, not a bill.&lt;/p&gt;

&lt;p&gt;A common misconception: this plugin &lt;strong&gt;does not depend on &lt;code&gt;dsh-context&lt;/code&gt;&lt;/strong&gt;. It studied that plugin's design and credits it publicly, but works fine without it — cost is rebuilt from session logs using per-request timestamps for peak/off-peak bucketing, and the numbers reconcile. Both plugins can be installed together.&lt;/p&gt;

&lt;h3&gt;
  
  
  Install
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dsh plugin --profile web add dsh-session-matrix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or search &lt;code&gt;dsh-session-matrix&lt;/code&gt; in the plugin manager. No build step, no restart needed.&lt;/p&gt;

&lt;p&gt;Zero runtime dependencies — the whole plugin is two JS files plus an SVG icon, with no build step. Requires DSH &amp;gt;= 0.2.2-rc.1 and Node ^22.19 or &amp;gt;=24. Verified on Windows 11 with DSH 0.2.2-rc.x; macOS and Linux are not yet tested.&lt;/p&gt;

&lt;p&gt;MIT licensed. Repo: github.com/Wanqiu12345/dsh-session-matrix&lt;/p&gt;

&lt;h3&gt;
  
  
  Closing
&lt;/h3&gt;

&lt;p&gt;If you run several DSH sessions in parallel, give it a try. I'd like to know whether the four-pane workspace or the handoff flow turns out to be more useful in practice.&lt;/p&gt;




</description>
      <category>deepseek</category>
      <category>agents</category>
      <category>opensource</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
