Graph — Interactive Terminal Data Visualization
Open a live plotext chart in a side pane and drive it from this conversation. Feed it any file — CSV, JSON, logs, or anything with extractable data — and explore it visually through conversation.
Quick Start
/graph <file> [instructions]
How It Works
- Read the source file to understand its structure
- Read
~/.claude/skills/runtime.jsonto getruntime_diranddata_dir - Choose a name for the graph session (default: source filename without extension)
- Create the session directory:
mkdir -p <runtime_dir>/claude-graph/<name> - Write
current-data.jsonto that directory — a hook auto-opens the renderer pane - Optionally write
current-config.jsonfor custom presentation
That's it. The renderer appears in a right-side pane and updates live on every write.
Named Sessions
Different graph names open separate renderer panes, allowing side-by-side comparison:
/graph latency.csv → writes to claude-graph/latency/
/graph errors.csv → writes to claude-graph/errors/
Both charts coexist as graph/latency and graph/errors panes.
Data Protocol
current-data.json (required)
Column-oriented dataset:
{
"columns": [
{"name": "col_name", "type": "numeric|categorical|datetime|text", "values": [...]}
],
"metadata": {"source_file": "...", "row_count": N}
}
current-config.json (optional)
The renderer infers graph type, axes, title, and labels from column types when no config is provided:
- categorical + numeric → bar chart
- datetime + numeric → line chart
- 2 numerics → line chart
- 1 numeric → histogram
To override or customize, write a config:
{
"graph_type": "bar",
"axes": {"x": "column_name", "y": "column_name"},
"title": "...", "xlabel": "...", "ylabel": "...",
"style": {"theme": "dark", "color_palette": ["green", "red"]},
"options": {"sort_x": "value_desc", "limit": 10, "show_values": true}
}
Renderer-handled options (no agent computation needed):
sort_x:"asc","desc","value_asc","value_desc"— sorts the x-axissort: true— shorthand forsort_x: "value_desc"limit: integer — show only the first N data points (after sorting)show_values: true — display values above bars (toggleable withvkey)- Large numbers on axes are auto-formatted (120000 →
120k)
For multi-series: "y": ["series_a", "series_b"]
Full schema: read references/data-protocol.md
Agent Protocol
You ARE the agent. Follow these rules:
Rule 1: Write-First for Simple Data
For most visualizations, write the JSON files directly using the Write tool:
- Read the source file to understand its structure
- Construct
current-data.jsonwith the columns and values needed - Write it to
<runtime_dir>/claude-graph/<name>/current-data.json - Optionally write
current-config.jsonfor custom presentation
Suitable when:
- The source is CSV, JSON, logs, or structured text
- The file is under ~5000 rows
- No heavy computation is required
Rule 2: Script Fallback for Complex Transforms
When the visualization requires computation:
- Rolling averages, aggregations, resampling, statistical operations
- Very large files (>5000 rows)
- Binary formats (parquet, sqlite, etc.)
For these: check the library manifest, write a Python script, execute via Bash.
- Library:
<data_dir>/claude-graph/library/ - Venv Python:
<data_dir>/claude-graph/venv/bin/python3
Rule 3: Persist Novel Modules
After a successful extraction that required new script code, offer to save new parsers/transforms/extractors to the library.
Decision Guide
| Scenario | Path |
|---|---|
| CSV/JSON, plot specific columns | Write-first |
| Log file, extract and plot a field | Write-first |
| Small dataset, filter and visualize | Write-first |
| Rolling average or aggregation | Script |
| File >5000 rows | Script |
| Binary format (parquet, sqlite) | Script |
Renderer Keybindings
The chart pane accepts direct keypresses:
n— next compatible graph typep— previous compatible graph typev— toggle value labelsr— force reloadq— quit renderer (closes pane)
Dependencies
Python packages (in venv): polars, pandas, numpy, plotext
System: python3.11+, tmux
Skills: pane (used by hook for renderer pane lifecycle)
Setup: run setup.sh once to install hooks
References
references/data-protocol.md— Full JSON schemasreferences/architecture.md— System designreferences/library-guide.md— Library module creation