The Operations Pro plugin
A plugin for Claude Code that sets up, checks, changes and explains a JMRI Operations Pro railroad, and tells you why a car will not move. It built an invented railroad as its own test, and a 43-case walkthrough came out of that.
JMRI Operations Pro can run a whole railroad's freight traffic: cars, loads, schedules, trains, staging. It is also hard to read when it fails. A car sits on a track and nothing says why. A train will not build and the report runs to hundreds of lines.
The Operations Pro plugin is an attempt at that problem. To test it, it was used to build a small invented railroad from a blank folder, and the result was written up as a walkthrough you can follow in your own copy of JMRI.
Start here
Forty-three cases on the Juniper Falls & Northern, each one something you can build on your own railroad, shown working. You read what it gives you, why you'd want it and how to set it up, find it on the railroad, ask Claude to show it working, and can break it on purpose.
01What it is
It is a plugin for Claude Code, an AI coding assistant. You ask in plain words and it does the work with a set of tools made for Operations Pro. It has two parts. A written skill carries the rules the program applies, such as the order in which the train builder tests a car. The tools do the work at the level of the railroad, not one field at a time, so a change that spans many screens is made in one step.
The rules were checked against the JMRI 5.16 source or tested in JMRI 5.16, except where a reference file says a point was not checked. That is the version it is written for. Other versions may differ.
Its status is in development. At the time of writing the README counts 85 actions and 21 tools. It has not been checked on versions of JMRI other than 5.16.
02What it can do
- Set up from nothing
- Audit a railroad
- Change files safely
- Run trains in JMRI
- Explain a build
- Explain a stuck car
- Set up a railroad from nothing. Locations, tracks, industries with schedules, routes, trains, loads, cars, locomotives, train days and paperwork settings, in the order the program needs. A folder with no Operations files starts as an empty railroad.
- Audit one.
ops_auditlooks across the railroad for faults such as a car type no train can carry, a locomotive no train takes, or a schedule with only one destination. - Change the files safely, with JMRI exited. JMRI holds Operations data in memory and writes whole files, so an edit made while it runs can be overwritten. Every change is a plan you see first, then a backup, the change, an audit, and a restore if anything fails. Move counts are kept, because they steer the builder.
- Run trains in a running JMRI. Build, move, terminate and reset trains through a small agent that JMRI runs from its startup scripts.
- Explain what the builder did.
ops_explain_buildreads the build report JMRI writes and names the gate behind each refusal, the tracks tried, and the screen that changes it. - Explain why a car will not move.
ops_why_notwalks each requirement in the builder's order and names the setting that blocks the car.
It can also check a change against JMRI's own builder: ops_build_check builds copies of your files several times each side of a change and compares the results, and ops_dry_run builds and terminates every enabled train on a copy.
03One case, up close
Case R02 in the walkthrough is a car that needs two trains. JFN 5201 starts at Carrow Packing and has to reach Cold Store at Northwood. The train EAST FREIGHT does not call at Northwood after the car's stop, so on its own it cannot deliver the car.
Asked about that move with EAST FREIGHT named, ops_why_not reports that the car can move. The router found the route: two trains through the interchange Ferris Exchange, EAST FREIGHT then NORTH JOB. Its direct check, the one-train reading, fails at gate D1, "no stop at Northwood after the car's stop on this route". That is the reason one train alone cannot do it.
The guide then says what real JMRI 5.16 did. In session 1 the car is left on Ferris Exchange with load Produce. In session 2 it reaches Cold Store, and the schedule turns it into an empty. The guide's "Try this" shows the other side: tell the interchange it may only send cars to Linden, and the same question fails at G12, "no chain of trains found". In a build the car stays at Carrow Packing with no destination.
That is the pattern in every case: what you can build, why you'd want it, how it works, how to set it up, where to find it, how to see it work, and a change to try.
04How it built the demo
The Juniper Falls & Northern is invented, with invented towns, industries and roads. It has no connection to any real layout. It has 15 locations, 18 trains, 118 cars and 7 locomotives. It was built by the plugin itself, as the test of the plugin.
The brief was to build a railroad that works, where every train builds and every car goes where the design intends. Its cases were drawn from setups that people on a model railroad user list found hard, shown set up correctly, plus every kind of routing the plugin's skill covers.
In the first stage, the design was tried on throwaway railroads in real JMRI 5.16, using plugin actions only. What it proved shaped the plan, such as the way two trains that share a staging track take turns unless the track has planned pick ups. The second stage built a shared skeleton in one plan: the locations, the 18 routes and trains, and the global options.
The third stage built the cases in six batches, A to F, each owning its own locations and tracks so a pointer in the guide names one thing. The batches were then replayed in order on a fresh skeleton. The batches were applied with the plugin's actions, and a car's final destination with ops_deliver_car. In places this went through the plugin's server functions from a script, which is why the next stage exists. The record lists no hand edits to the Operations files.
In the fourth stage, every step of every batch was applied again through the plugin's native tools on a fresh copy, by helpers that were not allowed to write scripts. The six Operations XML files from that copy were byte for byte the same as the scripted replay, before JMRI's own save was merged in. The shipped folder is that replay, one real JMRI load and save, and a real build of every train, which gives each train a build report in the folder.
05What the demo gives you
Each case is a setup you can open, read and copy to your own railroad. Between them the cases cover:
- Cars with a purpose. Schedules, custom loads, industries that receive empties, and one schedule shared by several spurs.
- Staging. Departure staging with generated custom loads, two staging tracks swapping full trains, and a fiddle yard of virtual spurs.
- Routing. From one train direct to chains of three, through interchanges and yards, with alternates and overflow.
- Running a session. Train days, automations, paperwork, passenger blocking, track pools, hazmat and buffer cars, and a RIP track.
Each case records what JMRI really did, so the demo also shows behaviour that is easy to miss:
- Default empties go wherever they are accepted. Boxcars of other cases were drawn onto three Carrow spurs until road lists fenced them out.
- An automation that waits for a train it has itself terminated never finishes in JMRI 5.16. Here a second automation,
Close Out, does the terminating. - Staging trains use up their departure track. Four of the demo's trains have nothing to run in later sessions, by design, and the guide shows why.
The same questions work on your own railroad. Ask why a car will not move or why a build failed, and the answer names the setting behind it.
06How far to trust it
What a case says is what real JMRI 5.16 did on that railroad, and each case has a test that runs JMRI. An independent review then checked 201 claims in the guide, and the guide was corrected from what it found. You can repeat any case with the plugin's own tools.
The demo improved the plugin too. Building it showed where the tools' answers differed from what JMRI did, and those faults were resolved, so the diagnosis has been compared with real builds.
Three limits remain, listed in the guide. ops_why_not does not follow a load generated for a staging-to-staging move. A locomotive with no terminal track shows as not checked, though that build fails. Overlapping staging pool dates also show as not checked.
07Using the walkthrough
The walkthrough has 43 cases in two parts. U cases are use-cases, things to build, from industries that receive empties to a RIP track. R cases are routing variations, from one train direct to a staging-to-staging turn.
- Copy the railroad. Copy the
operations/folder into a scratch JMRI profile, or open it with the plugin's reading tools. Nothing in it needs changing. - Pick a case. The index at the top of the guide links each one.
- Read, find, ask. Read What you can build, Why you'd want it, How it works and Set it up, find the objects named under Find it, then ask Claude the question under See it work. Name the train when you ask about a car.
- Break it, if you like. Try this names one change to make on the scratch copy, and says what the tool then reports. Never run it on the shipped folder.
The guide itself is the plugin's own file, shown on this site without changes. It sits beside the railroad in the plugin's repository, which is the master.
Open the walkthrough
43 cases: 24 use-cases and 19 routing variations. Keep the railroad's operations/ folder beside you.
08Get it
The plugin is public and free, under the MIT licence: github.com/lnevo/model-railroad-skills/plugins/operations-pro. It is a separate install from the read-only skills in the same repository, because it changes your data. Add the repository as a plugin marketplace in Claude Code, then install it:
claude plugin marketplace add lnevo/model-railroad-skills claude plugin install operations-pro@model-railroad-skills
Then point it at your Operations folder with the OPS_DIR setting, or pass the folder with each call. A few tools run JMRI's own builder on copies, and those need JMRI installed.
To run trains in a live JMRI, add a startup item for the web server in JMRI's preferences, exit JMRI, run ops_install_agent and apply its plan, then start JMRI.
Know before you use it
- Status: in development. Rules are written for JMRI 5.16.
- File changes need JMRI fully exited. The tools check the computer they run on, but cannot see another computer that has the same folder open.
- It does not write a train's build or terminate script, change a track's type, set a car's final destination, or print. JMRI's own importer errors are not diagnosed. Moving between JMRI versions is outside what was checked.
- Take a backup first. The plugin takes its own before each change, in JMRI's
backupsfolder, but your own copy is cheap.
NotesReferences
- model-railroad-skills, the public Claude Code plugin repository (GitHub). github.com/lnevo/model-railroad-skills
- The Operations Pro plugin README (GitHub). plugins/operations-pro
- The showcase walkthrough, master copy (GitHub). examples/showcase/GUIDE.md. Read it on this site: the walkthrough
- JMRI, Java Model Railroad Interface. jmri.org
More: The walkthrough · Bringing the Railroad Together · STL Studio · Behind the Scenes