Install
$ agentstack add skill-wolframresearch-system-modeler-ai-toolkit-validate-modelica ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Validate Modelica Model
This skill validates Modelica models (.mo files) by flattening them with WSMKernelX, which checks for structural errors (equations, types, connections). A successful flatten means the model is structurally valid.
Before you run anything
This skill drives WSMKernelX through the shared launcher ../scripts/wsm_run.py. Read [the shared-conventions appendix at the end of this file](#appendix-shared-conventions-for-the-modelica-skills) first — launcher resolution, the Windows-vs-Unix shell/Python rules, the temp-dir and cleanup conventions, the JSON-array output gotcha, and the MSL 4.x dialect notes that every step below assumes.
The launcher writes everything into _wsm_validate_temp/ next to the .mo file and leaves validate.out.json there for you to parse. Tell the user: "Working in temporary directory _wsm_validate_temp/. This will be deleted after validation."
Workflow
1. Identify the model file and name
Identify the .mo file and extract the model name — see [Appendix → Picking the model name](#picking-the-model-name). For a directory-form (multi-file) library, point --model at the library folder (not one class file) and pass the full dotted --name — see [Appendix → Directory-form (multi-file) libraries](#directory-form-multi-file-libraries).
2. Run the launcher
python3 "/wsm_run.py" --mode validate \
--model "" --name ModelName --timeout 60
The launcher auto-detects whether the model needs the Modelica Standard Library and loads the right MSL version; force it with --msl yes|no or pin a version with --msl-version 4.1.0. If the model uses an installed non-MSL library (e.g. Hydraulic), add --load-library — see [Appendix → Using non-MSL libraries](#using-non-msl-libraries-hydraulic-and-other-installed-libraries). Timeout: allow up to 60 seconds — complex models with many components can take a while to flatten.
If the launcher can't find the System Modeler install, see [Appendix → When the install or compiler isn't found](#when-the-install-or-compiler-isnt-found).
3. Parse the output
WSMKernelX writes structured results to validate.out.json in the temp directory — a JSON array; take the first element. status.flatten ("Pass"/"Fail") is the primary result; flat_model holds the flattened class (useful for debugging). Field reference: [Appendix → Reading the JSON output](#reading-the-json-output).
4. Report results
Summarize clearly:
- Pass: State the model validated successfully. Mention any warnings if present.
- Fail: Show the errors. Include relevant parts of the flattened model if it helps diagnose the issue.
5. Clean up
Remove _wsm_validate_temp/ entirely — commands per OS: [Appendix → Temporary directories](#temporary-directories).
Edge cases
- Packages / name mismatches: parse the actual
model/packagedeclaration, not the filename — see [Appendix → Picking the model name](#picking-the-model-name). Unknown library: Xon a multi-file library: you pointed--modelat a single class file; point it at the library folder instead — see [Appendix → Directory-form (multi-file) libraries](#directory-form-multi-file-libraries).- WSMKernelX not found: see [Appendix → When the install or compiler isn't found](#when-the-install-or-compiler-isnt-found).
- MSL dialect /
Element not found: this toolchain ships MSL 4.x — author with the 4.x names; the 3.2 names and misremembered paths flatten with confusing "not found" errors. Look the correct path up withsearch-modelica-docs(don't grep the install tree). See [Appendix → MSL 4.x dialect](#msl-4x-dialect).
Appendix: shared conventions for the Modelica skills
> Shared by every Modelica skill that drives WSMKernelX through the > bundled launcher; inlined here at release time. For the CLI/option > reference, environment variables (WSM_HOME, WSM_VSDEVCMD), > install discovery, and the analysis scripts, see > [../scripts/README.md](../scripts/README.md).
Locating the launcher
` (used throughout the skills) is the shared scripts/` folder. Some installs symlink the skill directories without it, so resolve it in this order and use the first that exists:
$WSM_SKILLS_SCRIPTS(bash) or$env:WSM_SKILLS_SCRIPTS(PowerShell), if set.../scriptsrelative to the skill directory — in a normal install
../scripts/wsm_run.py already exists, so use that path directly; do not run a shell probe to "resolve" it.
- The repo checkout you installed from, e.g.
.../agentskills/scripts. - Last resort, search the home directory:
- PowerShell:
Get-ChildItem $HOME -Recurse -Filter wsm_run.py -ErrorAction SilentlyContinue | Select-Object -First 1 - bash/zsh:
find ~ -name wsm_run.py -path '*scripts*' 2>/dev/null | head -1
If only #4 finds it, the install is missing the scripts/ link — tell the user to run install.sh (or install.ps1) from the repo, which links scripts/ too.
Shell and Python
On Windows, use PowerShell. The Git-Bash/cygwin layer may be broken (even ls/find can be absent, giving a misleading "exit 127 / command not found"). Run wsm_run.py with python (not python3); those calls are single-line and shell-agnostic. For cleanup use Remove-Item -Recurse -Force, not rm -rf. On macOS/Linux any POSIX shell is fine and python3 is the usual name.
Let the launcher own .mos/.bat and paths
Do not hand-write .mos scripts, .bat files, or hardcode install/compiler paths. The bundled scripts/wsm_run.py handles every OS difference — it finds the System Modeler install and kernel binary (macOS / Windows / Linux), finds and loads the right MSL files, generates the .mos, and runs the kernel with a working compiler environment per platform (system clang/gcc on macOS/Linux; the Visual Studio dev environment via VsDevCmd.bat on Windows). See [../scripts/README.md](../scripts/README.md) for WSM_HOME, the Windows compiler prerequisites, and the full option table.
When the install or compiler isn't found
The launcher searches each OS's standard install locations. If it prints ERROR: Could not locate a Wolfram System Modeler installation, the install is in a non-standard place — ask the user for it and re-run with --wsm-home "" (or have them set WSM_HOME).
Building and simulating also need a C++ toolchain:
- Windows: Visual Studio Build Tools. The launcher locates
VsDevCmd.bat
itself; if it reports the compiler environment is missing, pass --vsdevcmd "" (or set WSM_VSDEVCMD) and make sure Build Tools are installed.
- macOS: the Xcode command-line tools (
xcode-select --install). - Linux: gcc/g++.
Run python3 "/wsm_run.py" --mode info to see what the launcher discovered.
Temporary directories
The launcher works in a _wsm__temp/ directory next to the .mo file (_wsm_validate_temp/, _wsm_simulate_temp/, _wsm_diagnose_temp/) and leaves its outputs there. Tell the user, e.g.: "Working in temporary directory _wsm__temp/. This will be deleted afterwards." Pass --tempdir to reuse one directory across models in a session.
Clean up by removing the whole directory — use the user's shell:
rm -rf "/_wsm__temp" # macOS / Linux
# PowerShell: Remove-Item -Recurse -Force "\_wsm__temp"
Picking the model name
- The user may provide a path to a
.mofile, or you may already be working with
one in context.
- Extract the model name: the identifier after
modelon the first non-comment
line, e.g. model FooBar → FooBar. The filename does not always match the model name — parse the actual model/package declaration.
- For packages or nested models, use the top-level model name.
- Pick an instantiable model, not a package, for any kernel call. A
package
cannot be validated or simulated ("Invalid instantiation … is a package") — use a nested model's full dotted name, e.g. Package.Model.
- Pass an absolute path to
--model(relative paths break as the working
directory shifts between calls).
Directory-form (multi-file) libraries
A directory-form library stores one class per file with a package.mo at each level. You cannot validate such a class by handing the launcher only its own .mo file — the class's within Lib; clause needs the whole package loaded, and loading the single file alone fails with Internal error: ... expandLibNode: Unknown library: Lib. Instead point --model at the library folder (or its top package.mo, or any class file inside it) and pass the full dotted class name via --name:
python3 "/wsm_run.py" --mode validate \
--model "/abs/path/InvertedPendulum" \
--name InvertedPendulum.Controller
The launcher resolves any of those forms up to the library's root package.mo and loads the entire package (following package.order) before instantiating --name. It prints a NOTE: telling you which package.mo it loaded. Do not try to work around the unknown-library error by --load-ing individual files.
Reading the JSON output
The kernel writes .out.json into the temp dir. **It is a JSON array — take the first element**, then read:
status.flatten:"Pass"/"Fail"(the primary result forvalidate).status.build:"Pass"/"Fail"— C++ compilation/linking (simulate).status.result: simulation result status (simulate).messages.errors/messages.warnings/messages.notifications:
arrays (empty if none).
flat_model(validate) /simulation.resultFile(simulate): the
flattened class / path to the .mat.
See [../scripts/README.md](../scripts/README.md) (wsm_run.py section) for the full field reference.
MSL 4.x dialect
This toolchain ships MSL 4.x. When authoring models, use the 4.x names — the 3.2 names flatten with confusing "not found" errors:
- units:
Modelica.Units.SI.*(notModelica.SIunits.*) - source frequency parameter:
f(notfreqHz), e.g.SineVoltage(V=.., f=..) - declare the dependency as
annotation(uses(Modelica(version="4.0.0")))
Run python3 "/wsm_run.py" --mode info to confirm the exact MSL version. wsm_run.py also warns on stderr if it spots a 3.2 name in the model.
When a flatten fails with Element not found ... in Modelica..., the MSL component path is wrong (a misremembered name, not a missing install). Resolve the correct path with the search-modelica-docs skill — e.g. sine is Modelica.Blocks.Sources.Sine (not Math.Sine), difference is Math.Feedback (not Math.Subtract), and saturation is Nonlinear.Limiter (not Nonlinear.Saturation). Do not grep or walk the System Modeler install tree to hunt for the class.
Using non-MSL libraries (Hydraulic, and other installed libraries)
MSL is automatic (--msl). For any other library a model uses — Hydraulic, or anything the user installed from the Library Store — the launcher can find it for you. Two steps, no guessing at paths:
- See what is installed (bundled with System Modeler, user-installed archives, and
any custom folders configured in Model Center):
``bash python3 "/wsm_run.py" --mode libraries # add --json for a machine-readable array; each row has name/version/source/package ``
To get just one library's package path (e.g. for a manual --load): --mode libraries --library Hydraulic (add --library-version 2.1 to pin a version).
- Load it into a build by name — add
--load-libraryto a validate /
simulate / diagnose run (repeatable; pin a version with Name==Ver):
``bash python3 "/wsm_run.py" --mode validate \ --model "/M.mo" --name M --load-library Hydraulic ``
The launcher resolves the library (bundled → user-installed → Model-Center custom path, newest version wins) and loadFiles it before the model. A library usually pulls in MSL, so keep MSL on (auto, or --msl yes). Override a lookup with $WSM_LIBRARY_ (e.g. WSM_LIBRARY_HYDRAULIC=/path/to/package.moe), or fall back to an explicit --load .
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: WolframResearch
- Source: WolframResearch/system-modeler-ai-toolkit
- License: MIT
- Homepage: https://www.wolfram.com/system-modeler/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.