$npx -y skills add matlab/matlab-agentic-toolkit --skill roadrunner-coreFoundation skill for all RoadRunner workflows: MATLAB path setup, connection, project/scene/scenario lifecycle, world settings, handle management, status, and close. Use when connecting to RoadRunner, managing projects/scenes/scenarios, setting world origin, checking status, clos
| 1 | # RoadRunner Core |
| 2 | |
| 3 | Foundation skill for all RoadRunner agent workflows. Manages the RoadRunner connection, project/scene/scenario lifecycle, and handle management from MATLAB. Produces the `rrApp` handle used by all downstream RoadRunner skills. |
| 4 | |
| 5 | Execution: all MATLAB code runs via `evaluate_matlab_code` MCP tool. Never `matlab -batch`. |
| 6 | |
| 7 | ## When to Use |
| 8 | |
| 9 | - Connecting to or launching RoadRunner from MATLAB |
| 10 | - Creating, opening, or saving projects, scenes, or scenarios |
| 11 | - Setting world origin or scene extents |
| 12 | - Checking RoadRunner status |
| 13 | - Closing RoadRunner safely |
| 14 | - Any downstream RoadRunner skill needs `rrApp` initialization |
| 15 | |
| 16 | ## When NOT to Use |
| 17 | |
| 18 | - **RoadRunner is not installed** — this skill requires a working RoadRunner installation; it cannot install the product |
| 19 | - **MATLAB version below R2022a** — the `roadrunner` class and related APIs are not available in earlier releases |
| 20 | - **`rrApp` already exists and is valid** — re-running `rrCoreInitialize` is safe (it's idempotent) but unnecessary; prefer checking `exist('rrApp','var')` first to avoid the overhead |
| 21 | - **User has not provided installation or project paths** when first-time setup is needed — ask the user first, do not guess paths |
| 22 | - **RoadRunner is intentionally closed** — do not reconnect or relaunch without explicit user permission |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## 1. How the Agent Uses This Skill |
| 27 | |
| 28 | ### First-time setup (once per machine — two-tier resolution) |
| 29 | |
| 30 | `rrCoreInitialize` handles setup automatically using a two-tier approach: |
| 31 | |
| 32 | | Tier | Condition | What happens | |
| 33 | |------|-----------|--------------| |
| 34 | | 1 | Settings valid + `roadrunner` class on path | Setup skipped — already configured | |
| 35 | | 2 | Agent has `installFolder` and `projectPath` variables | Programmatic setup: `addpath`, `savepath`, writes MATLAB settings. No GUI. | |
| 36 | |
| 37 | **Just run `rrCoreInitialize`.** The script automatically: |
| 38 | 1. Connects to a running instance (`roadrunner.connect()`) |
| 39 | 2. If that fails, launches a new instance (`roadrunner()`) using saved settings |
| 40 | 3. If not configured, errors with `PathsRequired` — then ask the user for `installFolder` and `projectPath`, set them, and re-run |
| 41 | |
| 42 | Once setup succeeds, it persists forever (across MATLAB sessions). Never needed again. |
| 43 | |
| 44 | **No GUI dialogs.** This skill never calls `roadrunnerSetup`. All configuration is done programmatically. |
| 45 | |
| 46 | ### First call in a session |
| 47 | |
| 48 | 1. **Add the skill scripts to the MATLAB path** (required before `rrCoreInitialize` can be found): |
| 49 | ```matlab |
| 50 | addpath("<absolute-path-to-this-skill>/scripts"); |
| 51 | ``` |
| 52 | Replace `<absolute-path-to-this-skill>` with the actual filesystem path to this skill's directory (the folder containing this SKILL.md file). |
| 53 | 2. Run `rrCoreInitialize` → it handles everything: connects to a running instance, or launches one using saved settings, or errors with a clear message if not configured. |
| 54 | 3. If it errors with `PathsRequired` → ask the user for `installFolder` and `projectPath`, set them as variables, re-run `rrCoreInitialize`. |
| 55 | 4. Proceed with the user's request. |
| 56 | |
| 57 | ### Subsequent calls |
| 58 | |
| 59 | 1. Check `exist('rrApp','var')` — if missing, re-run `rrCoreInitialize` |
| 60 | 2. Look up the operation in the Decision Logic table (Section 3) |
| 61 | 3. Copy the exact pattern from `scripts/rrCoreCommands.m` under the matching `%%` heading |
| 62 | 4. Substitute placeholders with actual values |
| 63 | 5. Execute via `evaluate_matlab_code` |
| 64 | |
| 65 | ### Key principle |
| 66 | |
| 67 | **Never improvise API calls.** Before every RoadRunner operation, **read the matching `%%` section** from `rrCoreCommands.m` and reproduce it exactly. Do not guess function names, argument syntax, or parameter orders from memory. This prevents hallucinated function names, missing guard rails, and forgotten handle invalidation. |
| 68 | |
| 69 | If you are unsure of the correct syntax for any operation, **stop and read the pattern file** before attempting the call. |
| 70 | |
| 71 | --- |
| 72 | |
| 73 | ## 2. Files |
| 74 | |
| 75 | | File | Role | |
| 76 | |------|------| |
| 77 | | `scripts/rrCoreInitialize.m` | **Runs directly.** Bootstraps path + connection + validation. | |
| 78 | | `scripts/rrCoreCommands.m` | **Pattern reference.** Agent reads `%%` section, substitutes placeholders, executes. | |
| 79 | |
| 80 | ### Deployment |
| 81 | |
| 82 | On first use, the agent ensures the RoadRunner API is on the MATLAB path (one-time `savepath`). The scripts in this skill are pattern references — the agent reads them and reproduces the patterns via `evaluate_matlab_code`. |
| 83 | |
| 84 | --- |
| 85 | |
| 86 | ## 3. Decision Logic |
| 87 | |
| 88 | | User Intent | Pattern (`%%` section) | Placeholders to substitute | |
| 89 | |--------- |