Skip to content

Latest commit

 

History

History
131 lines (97 loc) · 9.65 KB

AGENTS.md

File metadata and controls

131 lines (97 loc) · 9.65 KB

AGENTS.md

This file provides guidance to AI coding agents (Claude Code, OpenAI Codex, etc.) when working with code in this repository.

Project

Isaac Lab-Arena is a composable environment-creation and policy-evaluation library for robotics simulation, built on Isaac Sim 6.2 and Isaac Lab 3.0. Status: alpha (v0.3.x); APIs are unstable. main is the active development branch.

Skill library

Recurring multi-step workflows are captured as Agent Skills under skills/, grouped by audience. When a task matches a skill, prefer invoking it over re-deriving the procedure from this file.

The canonical skill sources live under skills/developer/ and skills/user/. These folders describe the primary audience and validation owner; they do not restrict which workflows may reuse a skill. Codex discovers the skills through flat symlinks in .agents/skills/; Claude Code reads the same aliases through the committed .claude/skills symlink. Keep the canonical sources and flat discovery aliases synchronized when adding, removing, or renaming a skill.

Fresh-clone setup (run once):

pre-commit install    # on the host — registers git pre-commit hooks

Environment authoring and feature discovery

For creating or changing environments, scenes, tasks, success conditions, or randomization, read author-environment before implementing. Use run-experiment when executing an existing evaluation.

Runtime environment

Commands that touch Isaac Sim or Arena's package code (tests, training, evaluation, runtime scripts) run in the checkout's ready runtime: the native uv environment at .venv/bin/python or the local clone's Docker container. Either route is sufficient on its own. Before running such a command, use the arena-runtime skill to select the route and build the command, and don't use a bare python.

Lint and format tooling (pre-commit and the hooks it runs — black, flake8, isort, pyupgrade, codespell) runs on the host.

Repository layout

  • isaaclab_arena/ — core package: tasks/, policy/, evaluation/, embodiments/, scene/, assets/, tests/
  • isaaclab_arena_environments/, isaaclab_arena_examples/ — first-party extension packages
  • isaaclab_arena_embodiments/ — robot-specific support packages (isaaclab_arena_g1), such as controllers and teleop; embodiment definitions stay in isaaclab_arena/embodiments/
  • isaaclab_arena_policies/ — policy integration packages (isaaclab_arena_gr00t, isaaclab_arena_openpi, …)
  • isaaclab_arena_embodiments/ and isaaclab_arena_policies/ are plain folders, so import names are unchanged
  • docker/ — container build and run scripts
  • submodules/ — vendored dependencies (IsaacLab, Isaac-GR00T, …)
  • osmo/ — OSMO policy-runner workflow
  • docs/ — Sphinx documentation

Coding style

  • Name functions and describe behavior using the specific operation, result, or responsibility. Avoid vague uses of "compose", "resolve", "normalize", "materialize", and "plumbing" when a more precise description is available. Preserve established technical meanings, such as quaternion normalization, transform composition, and Hydra configuration composition.
  • For data conversions, name the destination representation, such as _env_ids_to_list(). For coordinate transforms, follow Coordinate-frame naming.
  • Keep comprehensions simple. When they contain nested loops, filtering, or multiple transformations that make them hard to read, use explicit loops and named intermediate variables instead.
  • Keep __init__.py files free of eager imports or re-exports
  • Use assert condition, "message" for internal invariants and for validating user input (CLI arguments, files, config). An assert terminates the program and nothing more, so never put code that has to run inside one (assert x.pop(...)), and never catch AssertionError to recover (raise an explicit exception such as ValueError where callers need to handle the failure). Asserting on input is a deliberate simplification: it avoids try/except boilerplate everywhere but is not ideal long-term.
  • Read .github/pull_request_template.md before writing a PR description and follow its guidance.
  • Attribute docstrings should be included below the attribute, rather than in the class-level docstring.
  • Copyright headers: a newly created file uses the current year alone (e.g. 2026); a file created earlier and edited this year uses a range (e.g. 2025-2026). Don't copy a neighbouring file's year — the pre-commit hooks (insert-license, fix-new-file-copyright-year) set and enforce this, so you generally don't hand-edit it.

Docstrings style

  • Prefer one line; a 2–3 line paragraph may follow if needed.
  • The docstring should describe the function’s calling syntax and its semantics, but generally not its implementation details, unless those details are relevant to how the function is to be used.
  • Describe what the code is and does, not who calls it or which features use it. Caller lists go stale. For callbacks and hooks, when the framework invokes them is part of their semantics and belongs in the docstring.
  • Document Args and Returns, but not Raises. Omit Returns when it only returns None or the summary already covers it.
  • Don't use Sphinx-style cross-references.

Conventions

Coordinate-frame naming

Use active target-source notation for Arena-owned poses and transforms:

  • T_A_B maps points from frame B into frame A.
  • T_A_B = (t_A_B, q_A_B) consists of translation t_A_B and rotation q_A_B, with the rotation represented as a quaternion.
  • For example, T_W_O maps points from object frame O into world frame W.
  • Transform composition follows T_C_A = T_C_B * T_B_A.
  • Frame letters are contextual. Define each near its first use when its meaning is not obvious.
  • Preserve external API names such as Isaac Lab's root_pose_w. Its lowercase _w, _e, and _b suffixes denote the simulation world, local environment, and robot base frames, respectively.
  • A lowercase API suffix names only the frame in which a quantity is expressed. When both source and target frames matter in Arena calculations, bind the value to an explicit transform name, for example T_W_O = object.data.root_pose_w.

Name Arena-owned spatial quantities after their frames instead of generic names such as position, rotation, or axis:

  • Rotations name both frames, for example q_W_B for the rotation from body frame B into world frame W. Not something generic like rotation.
  • Translations, points, and other vectors name the frame they are expressed in, for example t_W for a body's translation in world frame W, axis_R, or forces_W. Not something generic like position.
  • When a single frame is ambiguous, for example when composing offsets between several frames, name the source, target, and expressed-in frames explicitly: t_A_B (B's origin relative to A, in A) or t_A_B_in_C (expressed in C). See isaaclab_arena/variations/camera_extrinsics_variation.py.
  • Fields of a frame-carrying type such as Pose keep their names (position_xyz, rotation_xyzw); the variable holding the pose names the frames.

Wrapped Environment

ArenaEnvBuilder.make_registered() returns the gym-wrapped env (not the base env). Use env.unwrapped explicitly to access Isaac Lab-specific attributes (cfg, device, step_dt, etc.) that are not forwarded by gymnasium's OrderEnforcing wrapper:

env = arena_builder.make_registered()   # wrapped env
env.step(actions)                       # goes through OrderEnforcing
env.unwrapped.cfg                       # access Isaac Lab config
env.unwrapped.device                    # access Isaac Lab device

Writing Tests

Simulation tests use an inner/outer function pattern to handle Isaac Sim's process lifecycle:

def _test_foo(simulation_app):  # runs inside SimulationApp
    from isaaclab_arena.X import Y  # deferred imports after sim init
    ...
    return True  # indicates pass

def test_foo():  # pytest-visible outer function
    result = run_function_with_persistent_simulation_app(_test_foo)
    assert result
  • Don't call CLI paths that may invoke sys.exit—such as argparse --help, invalid arguments, or parser.error()—directly inside pytest. After Isaac Sim starts, catching SystemExit still leaves Kit shutdown queued.
  • Instead, run the CLI with subprocess.run([TestConstants.python_path, ...]) and assert the child result. Use with_subprocess only when the child starts Isaac Sim; the marker does not create a child process.

Boundaries

  • Never force-push to main or release/*. Instead, push to a <username>/<type>/<short-description> branch (<type> ∈ feature, fix, docs, refactor, chore, ci) and open a PR against main.
  • Never add AI-attribution lines to commits (no Co-Authored-By: Claude…, no Generated with…). Instead, sign off with git commit -s — DCO is the only required trailer.
  • Never overwrite a PR description or commit message from a local or remembered copy; the author may have edited it since. Instead, fetch the current text (e.g. gh pr view <n> --json body), change only the parts your update affects, and keep the author's wording elsewhere.
  • Never commit models, datasets, or secrets. Instead, keep them on the host and mount them via ./docker/run_docker.sh -d <datasets> -m <models> -e <eval>.
  • Ask first before changing docker/, .github/workflows/, .pre-commit-config.yaml, or submodules/ — these affect every contributor. Instead of pushing directly, open a draft PR or raise it in the relevant channel before merging.