Dev.to AI 🤖 Ai 👁 0 📖 6 min read

Putting an LLM on a leash: how we built a verified robot-fleet controller with Kiro

Built for #KiroweenHackathon26 (Frankenstein category). Live demo: https://igor-leash.pages.dev · Code: https://github.com/MrNK2107/igor-leash · Video: https://youtu.be/aAIGmVbnLLQ The problem: language models

Putting an LLM on a leash: how we built a verified robot-fleet controller with Kiro

Built for #KiroweenHackathon26 (Frankenstein category). Live demo: https://igor-leash.pages.dev · Code: https://github.com/MrNK2107/igor-leash · Video: https://youtu.be/aAIGmVbnLLQ

The problem: language models are confidently wrong some of the time

Ask a language model to turn "clear aisle H with two robots, keep off the racking walkway" into a plan, and most of the time you get a good plan. Some of the time you get a plan that looks just as good and is wrong: a robot cuts through a dock edge where people work, two robots swap cells head-on, or a robot leaves the charger with 31% battery for a job that needs 33%.

Why that is a problem

In a chat window a wrong answer is an annoyance. You read it, you notice, you ask again. When the plan drives a warehouse robot past a loading dock, a wrong answer is an accident. Nobody reads the plan before it runs, and the model sounds exactly as sure when it is wrong as when it is right.

The usual fix is a human who approves every step. That makes the system safe, but it also turns the "agent" back into a form: the operator has to understand coordinates, zones and battery maths, which is the work the model was supposed to remove.

What we wanted was the opposite: anyone can speak plainly to robots, and something deterministic sits between the model and the motors. An unsafe plan cannot run, and the operator is told why in one sentence.

What we built: IGOR, on a leash

IGOR runs six warehouse robots in a 70 x 50 m fulfilment centre. You type or say what you want.

  1. The brain, an LLM, turns the sentence into a plan made of catalog names. It cannot write coordinates or robot ids.
  2. The conscience, Leash, simulates the whole plan and checks nine rules (S1-S9): no-go zones, collisions, cell swaps, racking, speed zones, human zones, battery reserve, plan length and load-aware motion. One violation rejects the plan with a sentence like "Robot 1 would enter the dock edge at dock door 3, which is a no-go zone. This happens at tick 26." Nothing moves.
  3. In ROS 2, the approved plan is signed. A Python gate re-checks it on its own and Z3 proves that each robot's 0.3 m footprint on every straight segment stays clear of every no-go and human area. Only then do the robots move in Gazebo. The lidar collision monitor, the e-stop and a dead-man heartbeat can only slow or stop them.
  4. The memory, an MCAP flight recorder, captures the run, and the website replays the real Gazebo run in the browser.

The IGOR console: a plan checked against S1-S9 in the 3D warehouse

A language model, a rule verifier, an SMT solver, ROS 2, Gazebo and a browser console were never made to work together. Stitching them into one creature is why this was a Frankenstein project, and it is where Kiro earned its place.

How Kiro built it

Kiro CLI, headless, one brief per run

Every line of app, ROS and test code came from 64 numbered Kiro CLI runs, launched headless with kiro-cli chat --no-interactive. Each run got one brief from .kiro/briefs/, implemented it task by task, ran the checks itself and appended a section to LOG.md saying what it built, what it measured and where it deviated. An orchestrator (Claude Code) wrote the specs and briefs and verified each run (typecheck, tests, ROS tests, screenshots) before anything was committed.

We picked the CLI over the IDE on purpose. One brief per run makes every change reviewable and repeatable, and a run that fails can be retried from the same brief.

Specs, not vibes

Nothing was built from a loose prompt. Every feature started as a Kiro spec: EARS requirements, a design and tasks, and every task ends with a checkable "Done when". We had 10 active specs; igor-world, igor-ros2 and igor-amr drove the robot build.

The payoff showed at the seams. The specs pinned the world hash, the ROS message types and the signed-plan format, so the browser, the bridge and the ROS nodes were built in parallel runs without breaking each other.

Steering that says no

Seven steering files (product, tech, structure, safety rules, UI theme, world building, ROS 2) went into every run. Two lines did most of the work:

  • "Never weaken a rule to make a test pass." When a test failed, Kiro had to fix the code or the test, never quietly relax a safety rule.
  • "One safety-field file, never hand-edit the YAML." The Nav2 safety fields are generated from the same world file as everything else.

Hooks as guard rails

Six hooks: typecheck on save, property tests when a rule changes, MCP docs regenerated, a reminder that the leash-v1 skeleton is frozen, ros:export --check when the world changes, and ruff plus pytest when a ROS Python file changes. The world hook matters most: the browser scene, the rules, the Gazebo SDF and the Nav2 fields all come from one world file, and a 64-bit hash checked on every plan proves they have not drifted.

Custom agents, including one that attacks us

We wrote three Kiro agents:

  • leash-builder carries the build rules.
  • rule-auditor is read-only plus MCP. It audited every safety rule against its property test.
  • ros-red-team may use only the ROS and Leash MCP servers and may write only its report.

The red team was the most useful thing we did. Pointed at the live Gazebo robots with no signing key, it made 28 attacks: raw velocity commands, plans through the dock edge, an unauthenticated e-stop, forged and badly signed resets. Robots moved by an attack: 0. It could stop the fleet (the safe direction) but never clear the stop. A follow-up Kiro run turned every attack into a regression test, so the gate itself has to refuse each one.

In an earlier session over MCP, Kiro made 112 calls to our own MCP servers and tried 54 plans built to slip past the rules. Every verdict was correct.

Powers

None. Specs, steering, hooks and three custom agents covered what we needed.

Bugs that specs and tests caught

  • A battery bug that would have switched off a safety rule. Gazebo's battery plugin publishes 0-100; ROS defines 0-1. Read as-is, robot 4's 64% became "battery 6400" and every plan would have passed the battery-reserve rule. A relay now divides by 100 and drops impossible readings, so a bad reading goes stale and the bridge refuses to verify.
  • Float rounding. After that fix, 0.6399999857 became 63% instead of 64%. Safe, but wrong. The bridge rounds now, with tests for both values.
  • A plan that could run twice. A latched ROS topic could replay the last approved plan after a restart. The executor now ignores a plan whose start cells do not match where the robots are.

The numbers

  • 1,110 unit and component tests and 101 property tests passing
  • 21 of 21 rule mutants killed (weaken a rule and a test fails)
  • 255 fixture plans where the TypeScript verifier and the Python gate agree on every verdict; Z3 agrees with an independent oracle on 665 segments
  • 315 colcon tests, a 4/4 headless Gazebo smoke test, and a recorded ROS demo that passed 48 of 48 assertions

What we learned

  • Make the verifier boring. A deterministic check that says no, with a reason, is easier to trust than a clever one that says yes.
  • Units are where stitched systems tear. The worst bug was 0-100 versus 0-1 between two well-documented components.
  • Spec-first pays off at the seams. Pin the interfaces in a spec and parallel builders stop breaking each other.
  • Point an agent at your own system. A Kiro agent with a narrow toolset and a mandate to break things found more than we would have.

You can try it in the browser with nothing installed: https://igor-leash.pages.dev. Everything Kiro used (specs, steering, hooks, agents, briefs and the run log) is in the public repo under /.kiro: https://github.com/MrNK2107/igor-leash

#KiroweenHackathon26

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.