|
| 1 | +<!-- |
| 2 | +SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | +SPDX-License-Identifier: Apache-2.0 |
| 4 | +--> |
| 5 | + |
| 6 | +<!-- |
| 7 | + MANDATORY FOR ALL AUTOMATED CODING AGENTS (Cursor, Copilot, etc.): |
| 8 | +
|
| 9 | + Before modifying OR creating ANY file under this repository, you MUST use your |
| 10 | + file-reading tools to load EVERY AGENTS.md on the directory paths you will touch |
| 11 | + (see "CRITICAL — mandatory preflight" below). This is NON-OPTIONAL. Skipping it, |
| 12 | + or relying only on chat context without reading those files, is incorrect. |
| 13 | +
|
| 14 | + Before you treat work as finished, you MUST run pre-commit as in |
| 15 | + "Pre-commit — match CI before you stop" and fix all failures. Declaring the task |
| 16 | + done without that run is incorrect. |
| 17 | +
|
| 18 | + If pre-commit/CI fails, or the user corrects you, or you repeat the same class of |
| 19 | + mistake, you MUST record the lesson in AGENTS.md or source comments per |
| 20 | + "Mandatory learning loop" in the same session—not only when the user asks. |
| 21 | +
|
| 22 | + Repository owners: keep this block at the top of this file; do not delete it. |
| 23 | +--> |
| 24 | + |
| 25 | +# IsaacTeleop — agent notes |
| 26 | + |
| 27 | +## CRITICAL — mandatory preflight (do not skip) |
| 28 | + |
| 29 | +**Hard requirement:** Do **not** edit or add code under `IsaacTeleop/` until you have **read** (e.g. with the Read tool) **every** relevant `AGENTS.md` file as defined below. This is **not** optional, **not** "only for large tasks," and **not** satisfiable by inferring from prior conversation. If you have not read those files in **this** session for **this** task, stop and read them first. |
| 30 | + |
| 31 | +**You must:** |
| 32 | + |
| 33 | +1. List the **directories** you expect to edit or create files under (e.g. `src/core/live_trackers/cpp/`, `src/core/deviceio_base/cpp/inc/…`). |
| 34 | +2. For **each** such directory, **read** **`AGENTS.md` in that directory** if it exists. |
| 35 | +3. Walk **up** toward the **IsaacTeleop repo root** and **read** **`AGENTS.md` in every ancestor directory** that has one (e.g. `live_trackers/` → `src/core/` → **`IsaacTeleop/AGENTS.md` (this file)**). |
| 36 | + |
| 37 | +**You must not** assume that reading the single "closest" `AGENTS.md` is enough. **Multiple** `AGENTS.md` files can apply to one change (e.g. both `live_trackers` and `deviceio_base`). |
| 38 | + |
| 39 | +**Listing every `AGENTS.md` in this repo** (no curated table here—add new files under the tree without editing this document): |
| 40 | + |
| 41 | +```bash |
| 42 | +# Run from the IsaacTeleop repository root (the directory that contains this file): |
| 43 | +find . -name AGENTS.md ! -path '*/.git/*' | sort |
| 44 | +``` |
| 45 | + |
| 46 | +If you cannot run a shell, use your search/glob tools on the pattern `**/AGENTS.md` from the same root. That inventory is for orientation; you must still **read** every file that applies to the directories you will touch (steps 1–3 above). |
| 47 | + |
| 48 | +Optional context index: [`src/core/AGENTS.md`](src/core/AGENTS.md) (also on the ancestor walk—read it when working under `src/core/`). |
| 49 | + |
| 50 | +## Pre-commit — match CI before you stop |
| 51 | + |
| 52 | +- From the **IsaacTeleop repo root** (this directory), run pre-commit and **fix all failures** before you treat a change as finished (do not only rely on “should pass” reasoning). |
| 53 | +- **Use the same hook set as GitHub Actions:** `.github/workflows/pre-commit.yaml` runs pre-commit with **`SKIP=check-copyright-year`**. Mirror that locally: |
| 54 | + |
| 55 | + ```bash |
| 56 | + SKIP=check-copyright-year pre-commit run --all-files |
| 57 | + ``` |
| 58 | + |
| 59 | +- **REUSE:** files covered by the REUSE hook need **`SPDX-FileCopyrightText`** and **`SPDX-License-Identifier`** in the form the repo already uses (for example the HTML comment block at the top of `README.md` also applies to **`AGENTS.md`** and similar docs). |
| 60 | +- If a hook failure shows **missing or non-obvious repo policy** (not a one-off typo), you **must** add a **short** reminder under **Mandatory learning loop** rules to the right `AGENTS.md` or adjacent **`//` comments** so the next run does not repeat it—unless it is already documented. |
| 61 | + |
| 62 | +## Mandatory learning loop (AGENTS.md and comments) |
| 63 | + |
| 64 | +**Hard requirement:** When **any** of the following happens, you **must** complete steps 1–3 **before** you end the session or move on as if the work were complete: |
| 65 | + |
| 66 | +1. The **user** is dissatisfied or corrects your approach (wrong layer, scope, style, or a fix that does not stick). |
| 67 | +2. **Pre-commit** or **CI** fails on something you or another agent could hit again (linters, REUSE/SPDX, formatting, policy hooks, etc.). |
| 68 | +3. You **repeat** the same **category** of error after a correction. |
| 69 | + |
| 70 | +**You must:** |
| 71 | + |
| 72 | +1. **Distill** what went wrong into a **short, reusable pattern** (a rule or boundary, not a chat transcript). |
| 73 | +2. **Update** the right artifact in the **same working pass** as the fix: prefer the **most local** `AGENTS.md` for package- or subtree-level rules; use the **repo root** `AGENTS.md` only for expectations that span the whole tree; put **volatile or line-specific** detail in **`//` comments** next to the code. |
| 74 | +3. Respect **scope vs `main`** (below): only add `AGENTS.md` bullets for **this branch’s delta** to **`main`** (or the agreed base), not for behavior that already exists on the base branch. |
| 75 | + |
| 76 | +**You must not** skip documentation updates because the user did not say “update AGENTS.md”—failed checks and repeated mistakes **trigger** this loop automatically. |
| 77 | + |
| 78 | +**What belongs in `AGENTS.md`** |
| 79 | + |
| 80 | +- **High-level** expectations: boundaries between layers, what to avoid, naming or structural conventions, CMake/include policy at a glance, “always / never” rules that stay true across refactors. |
| 81 | +- **Style of work**: how minimal to keep diffs, when to ask for clarification, how this subsystem should relate to OpenXR/schema/deviceio, etc. |
| 82 | + |
| 83 | +**What does *not* belong in `AGENTS.md`** |
| 84 | + |
| 85 | +- **Low-level or volatile detail**: exact call sequences, field-by-field semantics, long checklists tied to one function, anything that will go stale the next time the code moves. |
| 86 | +- Put that in **comments in the source files** where the behavior lives (short `//` notes: intent, invariants, or “do not X because …”). |
| 87 | + |
| 88 | +**Scope — document what *this* branch changes, not main** |
| 89 | + |
| 90 | +- New or updated bullets should capture **learnings from the delta** between **this branch (or commit)** and **`main`** (or whatever long-lived base you are targeting—release branch, parent MR, etc.). |
| 91 | +- Do **not** restate facts that already hold on **`main`** just because this branch touches nearby files. If behavior landed in the **base** history, it belongs in **code comments** next to that code or in **main’s** docs—not as “new” guidance in an `AGENTS.md` introduced only to support a smaller follow-up change. |
| 92 | +- Example: schema- or API-level choices that merged **before** this branch are **out of scope** for `AGENTS.md` edits tied to this branch; they add churn and read like stale noise after merge. |
0 commit comments