Skip to content

Add plot_metrics builtin: braille line charts of JSONL streams in the conversation - #920

Draft
wilfred-dore wants to merge 1 commit into
mistralai:mainfrom
wilfred-dore:feat/plot-metrics-tool
Draft

Add plot_metrics builtin: braille line charts of JSONL streams in the conversation#920
wilfred-dore wants to merge 1 commit into
mistralai:mainfrom
wilfred-dore:feat/plot-metrics-tool

Conversation

@wilfred-dore

@wilfred-dore wilfred-dore commented Jul 18, 2026

Copy link
Copy Markdown

Motivation

Vibe Work (web) can chart data in Canvas; Vibe Code (CLI) cannot. Terminal-first data/ML users still have to leave their environment (Jupyter, TensorBoard) just to see whether a training run converges — no terminal coding agent offers this natively today.

This PR adds a minimal, dependency-free visualization capability to the CLI.

What it does

New builtin tool plot_metrics: reads a JSONL stream (one flat JSON object per line, e.g. {"epoch": 3, "loss": 0.42, "accuracy": 0.88}), auto-detects numeric fields, and renders per-series braille line charts directly in the conversation. Read-only (permission = ALWAYS), zero new dependencies.

 2.314 ┤⠣
       │ ⠑⠄
       │  ⠈⠢⡀
       │    ⠈⠢⢄
       │      ⠈⠑⠤⣀⡀
       │          ⠈⠑⠒⠢⠤⣀⣀⡀
0.0238 ┤                 ⠈⠉⠉⠉⠑⠒⠒⠒⠒⠒⠒⠒⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⠤⢄
       └ loss: x ∈ [1, 40]
sequenceDiagram
    participant U as User
    participant V as Vibe agent
    participant T as plot_metrics tool
    U->>V: "train this model, show me the curve"
    V->>V: run training, stream metrics.jsonl
    V->>T: plot_metrics(source="metrics.jsonl")
    T-->>U: braille chart in the conversation
    V-->>U: commentary (trend, convergence)
Loading

The fun part

The rendering reuses render_braille from vibe/cli/textual_ui/widgets/braille_renderer.py — until now used only to animate the mascot and the spinner. This gives that primitive its first product feature. 🐱

Open question for maintainers: this imports cli code from a core tool, which inverts the usual layering. Happy to move render_braille into e.g. vibe/core/utils/ if you'd prefer — kept the diff minimal for review.

Scope & design notes

  • Line charts only, intentionally minimal for a first pass. The dot-cell dedup matters: render_braille sums dot indices, so duplicate dots would overflow past the braille block.
  • Richer kinds (scatter, histograms, bar charts, ANSI-colored heatmaps, live --follow streaming, a colored Textual result widget) are demonstrated out-of-tree in Vibe Pulse, built at the Vibe Hackathon Paris (July 18, 2026) via tool_paths + a skill. A natural follow-up here would be a PlotextPlot-based result widget using textual-plotext, since the TUI is already Textual.

Testing

  • Tool discovered by ToolManager._load_tools_from_file, prompt file loaded.
  • Invoked against a real 40-epoch training stream: both series render, output contains only valid braille + box-drawing characters.

Renders per-series braille line charts of a JSONL metrics stream directly
in the conversation (training curves, benchmarks, monitoring series).
Read-only, zero new dependencies: reuses render_braille, the primitive
that animates the mascot and spinner.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wilfred-dore

wilfred-dore commented Jul 18, 2026

Copy link
Copy Markdown
Author

Full showcase of this capability (extended tool with colors/heatmaps/live follow, ml-trainer skill, W&B-style run tracking & comparison, on-device profiling via Qualcomm AI Hub): https://github.com/wilfred-dore/vibe-pulse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant