lerobot-dataset-visualizer
AGENTS.md132 starsChanged 2 months agoApache-2.0View on GitHub
Always use bun (bun install, bun dev, bun run build, bun test). Never use npm or yarn. After making any code changes, always run these commands in order and fix any errors before finishing: Or run them all at once (format first, then the full validate suite): bun run validate runs: type-check → lint → format:check → test Three versions are supported. Version is detected from meta/info.json → codebase_version. src/app/[org]/[dataset]/[episode]/fetch-data.ts → getEpisodeData() dispatches to: Locating an episode (its video URLs…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 5
Always use bun (bun install, bun dev, bun run build, bun test).
- Distinctive: line 9
After making any code changes, always run these commands in order and fix any errors before finishing:
- Very specific: line 59
Create datasets with leRobotDataset(repoId) in fetch-data.ts: it passes the DATASET_URL endpoint and authHeaders().
- Very specific: line 106
Test files live in /__tests__/ directories alongside source
- Very specific: line 134
URDFLoader gotcha: after our loadMeshCb returns, URDFLoader.js does if (obj instanceof THREE.Mesh) obj.material = <urdf-material>, …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — LeRobot Dataset Visualizer
Package manager
Always use bun (bun install, bun dev, bun run build, bun test). Never use npm or yarn.
Post-process — run after every code change
After making any code changes, always run these commands in order and fix any errors before finishing:
bun run format # auto-fix formatting (prettier)
bun run type-check # TypeScript: app + test files
bun run lint # ESLint (next lint)
bun test # unit testsOr run them all at once (format first, then the full validate suite):
bun run format && bun run validatebun run validate runs: type-check → lint → format:check → test
Key scripts
bun dev # Next.js dev server
bun test # Run all unit tests (bun:test)
bun run type-check # tsc --noEmit (app) + tsc -p tsconfig.test.json --noEmit (tests)
bun run lint # next lint
bun run validate # type-check + lint + format:check + testArchitecture
Dataset version support
Three versions are supported. Version is detected from meta/info.json → codebase_version.
| Version | Path pattern | Episode metadata | Video |
| v2.0 | data/{episode_chunk:03d}/episode_{episode_index:06d}.parquet | None (computed from chunks_size) | Full file per episode |
| v2.1 | Same as v2.0 | None | Full file per episode |
| v3.0 | data/chunk-{N:03d}/file-{N:03d}.parquet | meta/episodes/chunk-{N}/file-{N}.parquet | Segmented (timestamps per episode, per camera) |
Routing to parsers
src/app/[org]/[dataset]/[episode]/fetch-data.ts → getEpisodeData() dispatches to:
getEpisodeDataV2()for v2.0 and v2.1getEpisodeDataV3()for v3.0
@huggingface/lerobot
Locating an episode (its video URLs and offsets, its data file and row range) and reading camera sizes go through @huggingface/lerobot. Don't build v3 data, video or episode-metadata paths by hand.
- Create datasets with
leRobotDataset(repoId)infetch-data.ts: it passes theDATASET_URLendpoint andauthHeaders(). episodes({ offset, limit })reads the v3 episode index across every metadata chunk.offsetis a position in the listing, not anepisode_index.episode.data.fromRow/toRoware row offsets insideepisode.data.url, not dataset-wide frame indexes. Pass them straight torowStart/rowEnd; never subtract the file's firstindex.episode.datais optional: it is absent when the data file can't be read.- Episode charts come from
frames()(numeric and boolean series, bookkeeping columns left out).loadEpisodeFramesreads the task and language columns (TEXT_COLUMNS) from the same file alongside it, sinceframes()returns numbers only. - Camera sizes come from
parseInfo(...).cameras. Never read them fromshape[0]/shape[1]: some datasets declare channel-first shapes ([3, H, W]). - To upgrade, bump the version in
package.jsonand runbun install. Read the package's changes first: 0.0.4 changed whatfromRow/toRowmean.
v3.0 specifics
- Integer columns from parquet come out as BigInt — always use
bigIntToNumber()fromsrc/utils/typeGuards.ts - Fallback format uses numeric keys
"0".."9"` when column names are unavailable - Multi-task episodes: episodes carry a
taskslist (list[str]) — prefer it over the legacy singletask_indexlookup.EpisodeMetadataV3.tasks?: string[]exposes it. meta/tasks.parquetlookup: rows are not ordered bytask_index, and the task string lives in a named pandas index (__index_level_0__). Always filter by thetask_indexcolumn (row.task_index === taskIndexNum), never by row position.
v2.x path construction
formatStringWithVars(info.data_path, {
episode_chunk: Math.floor(episodeId / chunkSize)
.toString()
.padStart(3, "0"),
episode_index: episodeId.toString().padStart(6, "0"),
});
// → "data/000/episode_000042.parquet"formatStringWithVars strips :03d format specifiers — padding must be done by the caller.
Key files
| File | Purpose |
src/app/[org]/[dataset]/[episode]/fetch-data.ts | Main data-loading entry point; v2/v3 parsers; computeColumnMinMax |
src/utils/versionUtils.ts | getDatasetInfo, getDatasetVersionAndInfo, buildVersionedUrl |
src/utils/parquetUtils.ts | fetchParquetFile, readParquetAsObjects, formatStringWithVars |
src/utils/dataProcessing.ts | Chart grouping pipeline: buildSuffixGroupsMap → computeGroupStats → groupByScale → flattenScaleGroups → processChartDataGroups |
src/utils/typeGuards.ts | bigIntToNumber, isNumeric, isValidTaskIndex, etc. |
src/utils/constants.ts | PADDING, EXCLUDED_COLUMNS, CHART_CONFIG, THRESHOLDS |
src/types/ | TypeScript types: DatasetVersion, EpisodeMetadataV3, VideoInfo, ChartDataGroup, etc. |
Chart data pipeline
Series keys use " | " as delimiter (e.g. observation.state | 0).
groupRowBySuffix groups by suffix: if two different prefixes share suffix "0" (e.g. observation.state | 0 and action | 0), they are merged under result["0"] = { "observation.state": ..., "action": ... }. A series with a unique suffix stays flat with its full original key.
Testing
- Test files live in
**/__tests__/directories alongside source - Uses
bun:test(built-in, no extra install) - BigInt literals (
42n) requiretsconfig.test.json(target ES2020) — test files are excluded fromtsconfig.json @types/bunis installed as a devDependency forbun:testtype resolution- Mocking fetch:
globalThis.fetch = mock(() => Promise.resolve(new Response(...))) as unknown as typeof fetch - CI:
.github/workflows/test.ymlrunsbun teston push/PR to main
URL structure
All dataset URLs:
https://huggingface.co/datasets/{org}/{dataset}/resolve/main/{path}Built by buildVersionedUrl(repoId, version, path). The version param is accepted but currently unused in the URL (always main revision).
Excluded columns (not shown in charts)
Reserved/bookkeeping columns from lerobot — see EXCLUDED_COLUMNS in src/utils/constants.ts:
- v2.x:
timestamp,frame_index,episode_index,index,task_index,next.reward,next.done,next.truncated - v3.0:
index,task_index,episode_index,frame_index,next.reward,next.done,next.truncated,subtask_index
3D URDF viewer (src/components/urdf-viewer.tsx)
- URDFs and meshes are hosted in the HF bucket
lerobot/robot-urdfs— base URLhttps://huggingface.co/buckets/lerobot/robot-urdfs/resolve(no/mainsegment; buckets are unbranched). Override withNEXT_PUBLIC_URDF_BASE_URLfor local development. - Asset layout under the bucket:
g1/,openarm/,so101/(both SO-100 and SO-101 live here). - URDFLoader gotcha: after our
loadMeshCbreturns,URDFLoader.jsdoesif (obj instanceof THREE.Mesh) obj.material = <urdf-material>, overwriting any material we set. Workaround: wrap the loaded mesh in aTHREE.Groupso theinstanceof Meshcheck fails. DAE returns a Group already; STL must be wrapped explicitly. - STLLoader event ordering:
manager.itemEnd(url)fires before the useronLoadcallback, somanager.onLoadcan fire before meshes are attached to the robot tree. Defer post-load work (auto-fit camera, shadow flags) withsetTimeout(..., 0). Don't try to rebuild materials inmanager.onLoad— pick the archetype color directly insideloadMeshCb. - OpenArm DAE files ship 23 stray
PointLights that drown out scene lighting. Strip non-AmbientLightlights fromcollada.scenebefore adding it to the robot. - Scene setup:
<Canvas shadows>withACESFilmicToneMapping(exposure 0.9), 3-point directional + ambient lights,<Environment preset="studio" background={false} />,<color attach="background" args={["#1a2433"]} />.<OrbitControls makeDefault />is required souseThree().controlsexposes the controls for auto-fit.
Design system
Colours, surfaces and fonts follow the Hub (moon-landing). Tokens live in src/app/globals.css: light values on :root, dark under :root.dark, exposed as Tailwind colours. Never hard-code text-slate-*, border-white/*, bg-white/* or hex colours for UI chrome; use the tokens so both themes work:
- Surfaces:
--bg,--surface-0(chrome),--surface-1(cards),--surface-2— white / gray-50 / gray-100 light, gray-950 / gray-925 / gray-850 dark - Text:
text-fg,text-fg-soft,text-fg-muted,text-fg-faint; accent texttext-accent-fg, flag texttext-flag-fg - Lines and fills:
border-line/border-line-subtle/border-line-strong,bg-fill/bg-fill-strong(hover and control fills) - Charts:
var(--chart-grid),var(--chart-axis),var(--fg-muted)for ticks; CSS variables work in Recharts' SVG attributes. Three.js needs real colours: readuseTheme()fromsrc/utils/theme.ts - Theme:
<html class="dark">, set before paint byTHEME_INIT_SCRIPT(src/utils/theme-init.ts) from?__theme=(what HF Spaces passes), then the saved choice, then the OS;ThemeTogglein the tab bar switches it.dark:utilities target that class - Fonts: Source Sans 3 (Source Sans Pro) and IBM Plex Mono via
next/fontinlayout.tsx, asfont-sans/font-mono - Accent:
--accent #ff9d00, LeRobot orange (the logo colour) — primary interactive colour across UI. Usebg-accent/10,border-accent/30,text-accent-fg(a darker/lighter orange with readable contrast per theme), never rawcyan-*/orange-* - Helpers:
.panel,.panel-raised,.tabular(tabular-nums) - Color semantics: orange (accent) = primary/active; rose (
rose-500,text-flag-fg,.btn-flagged) is reserved for flagged-episode UI only — don't reuse it for generic accents. The annotation role colours (task aug cyan, subtask yellow, …) are semantic and stay as they are. - Playhead: the playback position (chart cursor, annotation timeline) uses
--playhead, a neutral near-white, so it never reads as a series, a role or a flag. - Buttons:
.btn(secondary), plus.btn-activefor a selected toggle,.btn-flaggedfor flag filters/actions and.btn-primaryfor the main action. They live in@layer components, so a utility on the element (size, width) overrides them. - Analysis tabs (Statistics, Filtering, Frames, Action Insights) build on
src/components/ui.tsx:PageHeader,StatCard,InlineLoading/Spinner,Switch;EpisodeHeaderheads every tab that plays an episode. Tab roots arew-full max-w-5xl mx-auto py-6 space-y-6(w-fullmatters:mx-autoin the flex-column content area otherwise sizes the column to its content). Section cards arebg-[var(--surface-1)]/60 rounded-lg p-5 border border-white/10with anh3oftext-sm font-semibold text-slate-200. - Annotations keeps its own skin (
annotations-skin.css) for role colours (subtask yellow, plan blue, …); generic UI in it (focus, selection, primary button) uses the app--accent.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

