feat: sankey diagrams — branching flow ribbons - #198
Merged
Conversation
This was referenced Jul 22, 2026
ethenotethan
added a commit
to researchoors/hermes-agent
that referenced
this pull request
Jul 22, 2026
HermesNative renders ```sankey (researchoors/hermes-native#198) and ```timeline (researchoors/hermes-native#199) blocks natively and captures id-bearing ones as living artifacts. Both kinds replace wholesale on merge (no per-kind merge needed), so only the agent tool's allowlist and schema enum need to know about them — the store already handles unknown kinds by replacement. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The other half of the flow-shaped gap (waterfall covered sequential
where-did-it-go; sankey covers BRANCHING flows): budget allocation,
token/traffic routing, funnels, as a native ```sankey fence.
- SankeySpec: nodes implicit from links [{from, to, value}]; optional
nodes array adds groups for coloring. Self-loops and non-positive
values drop at parse.
- SankeyLayout (pure, tested): cycle-safe longest-path column
assignment (bounded passes — a cyclic link renders adjacent instead
of hanging), node bars sized by throughput on a GLOBAL scale so
heights compare across columns, ribbons stacked without overlap
down each node edge in link order.
- SankeyBlockView: Canvas ribbons (cubic curves, thickness ∝ value)
under node bars, labels as native text (last column leans left).
Click a node → its flows light, rest dim, and a summary shows
in/out totals per link plus an unbalanced-flow Δ warning. Colors
from the shared categorical palette by group (or column).
- Fence routes in chat, captures as a living artifact, renders in the
Artifacts pane and iOS sheet; formatting prompt documents the
contract. PDF-safe by construction (no representables/scroll views).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…outing ```sankey collides with mermaid's sankey diagram language (it's in diagramLanguages). Route by content instead: JSON objects go to the native SankeyBlockView, CSV lines fall through to mermaid. Also wire the PDF exporter — sankey blocks render live (Canvas + native text, no representables) instead of being pre-rendered as mermaid images. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ethenotethan
force-pushed
the
feat/sankey-diagram
branch
from
July 22, 2026 20:13
6bad450 to
f3a965d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The other half of the flow-shaped gap from the chart-type audit — waterfall (#196) covered sequential where-did-it-go; sankey covers branching flows: budget allocation, token/traffic routing, funnels.
nodesarray adds groups for coloring. Self-loops and non-positive values drop at parse.SankeyLayout, unit-tested): cycle-safe longest-path column assignment (bounded passes — a cyclic link renders adjacent instead of hanging), node bars sized by throughput on a global scale so heights compare across columns, ribbons stacked without overlap down each node edge.```mermaid/sankey-betaand keeps its route).Testing
3 suites-worth: parse hygiene (self-loops/zero/negative dropped), layout invariants (topological columns, global-scale proportional spans, no-overlap ribbon stacking), cycle termination. Both targets build,
swiftlint --strictclean.Built in an isolated worktree off main.
🤖 Generated with Claude Code