oneshotlm
Compare all models on this prompt →

Force-directed graph · claude-opus-4.8

Output generated Cost / run $0.1246 Runtime 47.5s

Prompt for this run

Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.

⛨ sandboxed Open in new tab ↗

TAKE IT TO CODE

A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.

RUN

modelclaude-opus-4.8
vendorAnthropic · Claude
harnesspi-agent
generated2026-07-08

METRICS

runtime47.5s
tokens in16k
tokens out3.3k
cached8.4k
cost / run$0.1246
Transcript · 8 messages
user

Using the pre-provided d3.min.js (global d3), render an interactive force-directed graph of about 40 nodes in several clusters with draggable nodes, hover highlighting of neighbors, and zoom/pan. Define the sample nodes and links inline.

assistant
thinking
I'm setting up the HTML file with a d3 force-directed graph visualization and verifying that the d3 library file is available.
→ bash {"command":"ls -la /workspace"}
toolResult

total 324 drwxrwxrwx 3 node node 96 Jul 8 02:59 . drwxr-xr-x 1 root root 4096 Jul 8 02:59 .. -rw-r--r-- 1 node node 279706 Jul 8 02:59 d3.min.js

assistant
thinking
Now I'm setting up the HTML file.
→ write /workspace/index.html (5751 bytes)
toolResult

Successfully wrote 5751 bytes to /workspace/index.html

assistant
→ bash {"command":"cd /workspace && node -e \"const d3=require('./d3.min.js'); console.log('d3 loaded', typeof d3.forceSimulation)\" 2>&1 | head"}
toolResult

d3 loaded function

assistant

Done. `index.html` is a self-contained single-page app that loads the local `d3.min.js` and renders an interactive force-directed graph. Features implemented: - **~40 nodes** across 5 clusters (Core, Frontend, Backend, Data, Ops), color-coded, defined inline. - **Links** generated inline: intra-cluster (hub star + chain) plus inter-cluster bridges. - **Draggable nodes** — drag pins a node while the simulation reheats, releases on drop. - **Hover highlighting** — hovering fades everything except the node's neighbors and colors the connecting edges. - **Zoom/pan** — scroll to zoom (0.2×–5×), drag the background to pan. - Responsive to window resize, no external resources or network calls.