agentleFS
Hugging FaceKnown publisherhuggingface/lerobot-dataset-visualizer/AGENTS.md

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.

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
  1. Very specific:

    Always use bun (bun install, bun dev, bun run build, bun test).

    line 5
  2. Distinctive:

    After making any code changes, always run these commands in order and fix any errors before finishing:

    line 9
  3. Very specific:

    Create datasets with leRobotDataset(repoId) in fetch-data.ts: it passes the DATASET_URL endpoint and authHeaders().

    line 59
  4. Very specific:

    Test files live in /__tests__/ directories alongside source

    line 106
  5. Very specific:

    URDFLoader gotcha: after our loadMeshCb returns, URDFLoader.js does if (obj instanceof THREE.Mesh) obj.material = <urdf-material>, …

    line 134

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 tests

Or run them all at once (format first, then the full validate suite):

bun run format && bun run validate

bun 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 + test

Architecture

Dataset version support

Three versions are supported. Version is detected from meta/info.json → codebase_version.

VersionPath patternEpisode metadataVideo
v2.0data/{episode_chunk:03d}/episode_{episode_index:06d}.parquetNone (computed from chunks_size)Full file per episode
v2.1Same as v2.0NoneFull file per episode
v3.0data/chunk-{N:03d}/file-{N:03d}.parquetmeta/episodes/chunk-{N}/file-{N}.parquetSegmented (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.1
  • getEpisodeDataV3() 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) in fetch-data.ts: it passes the DATASET_URL endpoint and authHeaders().
  • episodes({ offset, limit }) reads the v3 episode index across every metadata chunk. offset is a position in the listing, not an episode_index.
  • episode.data.fromRow / toRow are row offsets inside episode.data.url, not dataset-wide frame indexes. Pass them straight to rowStart / rowEnd; never subtract the file's first index. episode.data is 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). loadEpisodeFrames reads the task and language columns (TEXT_COLUMNS) from the same file alongside it, since frames() returns numbers only.
  • Camera sizes come from parseInfo(...).cameras. Never read them from shape[0] / shape[1]: some datasets declare channel-first shapes ([3, H, W]).
  • To upgrade, bump the version in package.json and run bun install. Read the package's changes first: 0.0.4 changed what fromRow / toRow mean.

v3.0 specifics

  • Integer columns from parquet come out as BigInt — always use bigIntToNumber() from src/utils/typeGuards.ts
  • Fallback format uses numeric keys "0".."9"` when column names are unavailable
  • Multi-task episodes: episodes carry a tasks list (list[str]) — prefer it over the legacy single task_index lookup. EpisodeMetadataV3.tasks?: string[] exposes it.
  • meta/tasks.parquet lookup: rows are not ordered by task_index, and the task string lives in a named pandas index (__index_level_0__). Always filter by the task_index column (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

FilePurpose
src/app/[org]/[dataset]/[episode]/fetch-data.tsMain data-loading entry point; v2/v3 parsers; computeColumnMinMax
src/utils/versionUtils.tsgetDatasetInfo, getDatasetVersionAndInfo, buildVersionedUrl
src/utils/parquetUtils.tsfetchParquetFile, readParquetAsObjects, formatStringWithVars
src/utils/dataProcessing.tsChart grouping pipeline: buildSuffixGroupsMap → computeGroupStats → groupByScale → flattenScaleGroups → processChartDataGroups
src/utils/typeGuards.tsbigIntToNumber, isNumeric, isValidTaskIndex, etc.
src/utils/constants.tsPADDING, 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) require tsconfig.test.json (target ES2020) — test files are excluded from tsconfig.json
  • @types/bun is installed as a devDependency for bun:test type resolution
  • Mocking fetch: globalThis.fetch = mock(() => Promise.resolve(new Response(...))) as unknown as typeof fetch
  • CI: .github/workflows/test.yml runs bun test on 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 URL https://huggingface.co/buckets/lerobot/robot-urdfs/resolve (no /main segment; buckets are unbranched). Override with NEXT_PUBLIC_URDF_BASE_URL for local development.
  • Asset layout under the bucket: g1/, openarm/, so101/ (both SO-100 and SO-101 live here).
  • URDFLoader gotcha: after our loadMeshCb returns, URDFLoader.js does if (obj instanceof THREE.Mesh) obj.material = <urdf-material>, overwriting any material we set. Workaround: wrap the loaded mesh in a THREE.Group so the instanceof Mesh check fails. DAE returns a Group already; STL must be wrapped explicitly.
  • STLLoader event ordering: manager.itemEnd(url) fires before the user onLoad callback, so manager.onLoad can fire before meshes are attached to the robot tree. Defer post-load work (auto-fit camera, shadow flags) with setTimeout(..., 0). Don't try to rebuild materials in manager.onLoad — pick the archetype color directly inside loadMeshCb.
  • OpenArm DAE files ship 23 stray PointLights that drown out scene lighting. Strip non-AmbientLight lights from collada.scene before adding it to the robot.
  • Scene setup: <Canvas shadows> with ACESFilmicToneMapping (exposure 0.9), 3-point directional + ambient lights, <Environment preset="studio" background={false} />, <color attach="background" args={["#1a2433"]} />. <OrbitControls makeDefault /> is required so useThree().controls exposes 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 text text-accent-fg, flag text text-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: read useTheme() from src/utils/theme.ts
  • Theme: <html class="dark">, set before paint by THEME_INIT_SCRIPT (src/utils/theme-init.ts) from ?__theme= (what HF Spaces passes), then the saved choice, then the OS; ThemeToggle in the tab bar switches it. dark: utilities target that class
  • Fonts: Source Sans 3 (Source Sans Pro) and IBM Plex Mono via next/font in layout.tsx, as font-sans / font-mono
  • Accent: --accent #ff9d00, LeRobot orange (the logo colour) — primary interactive colour across UI. Use bg-accent/10, border-accent/30, text-accent-fg (a darker/lighter orange with readable contrast per theme), never raw cyan-*/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-active for a selected toggle, .btn-flagged for flag filters/actions and .btn-primary for 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; EpisodeHeader heads every tab that plays an episode. Tab roots are w-full max-w-5xl mx-auto py-6 space-y-6 (w-full matters: mx-auto in the flex-column content area otherwise sizes the column to its content). Section cards are bg-[var(--surface-1)]/60 rounded-lg p-5 border border-white/10 with an h3 of text-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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.