agentleFS
GoogleKnown publishergoogle/xrblocks/AGENTS.md

xrblocks

AGENTS.md527 starsChanged 18 days agoApache-2.0View on GitHub

XR Blocks (xrblocks) is a cross-platform JavaScript/TypeScript SDK for rapidly prototyping AI + XR applications on the open web. It is built on three.js, targets Chrome 136+ with WebXR on Android XR, and ships a desktop simulator so the same code runs in an ordinary browser. The published npm package exposes one ESM bundle (build/xrblocks.js) plus per-addon bundles under build/addons/*. [!IMPORTANT] Only call APIs that exist. The entire public surface is re-exported from src/xrblocks.ts — if a symbol is not…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 35,337 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 repository9 other files it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Barrel export: every public symbol flows through src/xrblocks.ts.

    line 55
  2. Very specific:

    Dependency injection over globals: prefer static dependencies = {...} on a Script (resolved via core.registry) to reaching into singletons, …

    line 68
  3. Distinctive:

    Keep PR diffs focused. Update existing behavioral tests before adding new ones.

    line 70
  4. Distinctive:

    Use Google coding standards: the Google TypeScript Style Guide and Google Engineering Practices.

    line 74
  5. Distinctive:

    Use the Google Developer Documentation Style Guide for prose.

    line 76
  6. Distinctive:

    Follow Google's Testing on the Toilet guidance: Test Behavior, Not Implementation, [Test Behaviors, Not

    line 81
  7. Distinctive:

    Keep only concise tests for crucial behavior, important failures, and known regressions.

    line 86
  8. Distinctive:

    Test one behavior through public APIs and observable results.

    line 88
  9. Very specific:

    Use real SDK and Three.js objects.

    line 90
  10. Distinctive:

    Do not enforce private state, tuning constants, default inventories, importmaps, file layouts, or snapshots unless the detail is an …

    line 92
  11. Distinctive:

    Keep setup small and local.

    line 94
  12. Distinctive:

    Ensure tests fail when behavior breaks.

    line 95
  13. Very specific:

    Add config to the relevant *Options class (or a new one) and register it in Core.init().

    line 99
  14. Very specific:

    Add or adjust the smallest colocated *.test.ts proof and one executable sample or template when the public pattern needs teaching.

    line 103
  15. Distinctive:

    Update the one manual page or agent workflow that owns the changed concept.

    line 105

≈ “Common” is an estimate: at least 1 in 5 of the 45,344 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

Project Overview

XR Blocks (xrblocks) is a cross-platform JavaScript/TypeScript SDK for rapidly prototyping AI + XR applications on the open web. It is built on three.js, targets Chrome 136+ with WebXR on Android XR, and ships a desktop simulator so the same code runs in an ordinary browser. The published npm package exposes one ESM bundle (build/xrblocks.js) plus per-addon bundles under build/addons/*.

[!IMPORTANT] Only call APIs that exist. The entire public surface is re-exported from src/xrblocks.ts — if a symbol is not there, it is internal. The framework's own evaluation found that hallucinated/inconsistent APIs are the #1 cause of broken generated apps. When unsure, grep src/xrblocks.ts and the relevant subfolder, or copy a working pattern from samples/, demos/, or templates/.

[!NOTE] three.js is a peer dependency (^0.186.0). Apps load it via an importmap; never bundle a second copy, and keep the version aligned with package.json.

Build & Test

npm ci                 # install from the lockfile
npm run dev            # rolldown watch + http-server on http://127.0.0.1:8080
npm run build:sdk      # preferred product build for testing without building demos/samples
npm run serve          # serve the repo without rebuilding
npm test               # vitest run
npm run lint           # oxlint src tools
npm run format         # prettier --write

[!IMPORTANT] Run npm run lint, npm run format, and npm test before opening a PR. Tests are colocated *.test.ts files next to the code under test (Vitest, jsdom where DOM is needed).

build/ is generated by Rolldown — never hand-edit it; regenerate with npm run build:sdk.

Architecture

XR Blocks is a singleton engine driven by a script lifecycle:

  • Core (src/core/Core.ts) is a singleton, exposed as xb.core. xb.init(options) builds the renderer, camera, WebXR session, and every subsystem, then runs the frame loop. It owns the dependency-injection Registry.
  • Script (src/core/Script.ts) is the developer extension point — a THREE.Object3D with Unity-MonoBehaviour-style hooks (init, update, onSelectEnd, initPhysics...). Apps are added via xb.add(new MyScript()) before xb.init().
  • Options (src/core/Options.ts) aggregates per-subsystem config and exposes chainable enable*() methods. enableAutomationMode() is the shared desktop simulator and context preset for automation and external runs, also available through ?xrAutomation=1. Separately, ?debug=1 exposes window.xb and window.xbReady for in-page browser drivers.
  • Barrel export: every public symbol flows through src/xrblocks.ts. New public symbols MUST be added there.
  • Build: Rolldown (rolldown.config.js) emits build/xrblocks.js (ESM), .min.js, and .d.ts, plus each addon under build/addons/*. Heavy deps (three, @google/genai, @mediapipe/*, @pmndrs/uikit, Rapier, Spark, lit) stay external.

Conventions

  • TypeScript, strict. Public symbols re-exported via src/xrblocks.ts.
  • Tests: colocated *.test.ts, run with Vitest.
  • Lint/format: Oxlint (.oxlintrc.json) + Prettier (.prettierrc.json).
  • Imports: some intra-src imports carry .js extensions for module resolution — follow the surrounding file rather than "fixing" them ad hoc.
  • Dependency injection over globals: prefer static dependencies = {...} on a Script (resolved via core.registry) to reaching into singletons, so subsystems stay testable.
  • Keep PR diffs focused. Update existing behavioral tests before adding new ones.

Coding and Testing Standards

Use Google coding standards: the Google TypeScript Style Guide and Google Engineering Practices. Use the Google Developer Documentation Style Guide for prose. Keep implementations small, names clear, and types explicit. Remove obsolete code, avoid speculative abstractions and compatibility layers.

Follow Google's Testing on the Toilet guidance: Test Behavior, Not Implementation, Test Behaviors, Not Methods, and Don't Overuse Mocks.

  • Keep only concise tests for crucial behavior, important failures, and known regressions. Extend existing tests before adding coverage; do not chase coverage percentages or every branch.
  • Test one behavior through public APIs and observable results. Name the outcome. Correct internal refactors should leave assertions valid.
  • Use real SDK and Three.js objects. Substitute only unavailable platform or external service boundaries. Keep substitutes minimal; do not mock SDK systems or verify internal call sequences.
  • Do not enforce private state, tuning constants, default inventories, importmaps, file layouts, or snapshots unless the detail is an explicit supported contract.
  • Keep setup small and local.
  • Ensure tests fail when behavior breaks.

Adding a Feature / Subsystem

  1. Add config to the relevant *Options class (or a new one) and register it in Core.init().
  2. Expose a chainable enable*() on Options if it is user-facing.
  3. Wire the subsystem into Core and the frame loop / DI Registry.
  4. Re-export public types from src/xrblocks.ts.
  5. Add or adjust the smallest colocated *.test.ts proof and one executable sample or template when the public pattern needs teaching.
  6. Update the one manual page or agent workflow that owns the changed concept. A new API capability does not require a new skill or blanket edits to every overview.

AI & API-Key Security

[!IMPORTANT] Never commit API keys, and never ship a key in client-side code for production. The ?key= URL parameter and keys.json fallback in src/ai/AI.ts are for local prototyping only — production apps must proxy AI calls through a server you control. AI features (Gemini Live/Flash) send data to Google servers; WebXR and on-device (LiteRT) features process data locally.

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.