{"slug": "my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed", "title": "My assistant got the same three rules wrong every time. Kiro's conditional steering fixed it.", "summary": "A developer building a reimplementation of Winamp 2 skins and MilkDrop presets used Kiro's conditional steering documents to stop an AI assistant from repeatedly breaking three format-specific rules: treating a 32-bit BMP's fourth byte as alpha, guarding against division by zero in ns-eel, and passing 0–1 audio levels instead of the ~1.0-centered band values presets expect. The steering files load only when files under src/milkdrop/ or src/skin/ are opened, and each rule is written with its observable symptom attached so a model can diagnose silent failures that produce no stack trace.", "body_md": "I spent the last few weeks building a thing where **nothing crashes**.\n\nNot in a good way. It's a reimplementation of two file formats from the late\n\nnineties — Winamp 2 skins and MilkDrop presets — and the complete list of\n\nwhat goes wrong in a codebase like that is:\n\nNot one of those produces a stack trace. Three of the four produce output\n\nthat looks like a design decision.\n\nThat turns out to be an unusual environment to use an AI assistant in, because\n\nthe normal feedback loop — write it, run it, read the error — doesn't fire.\n\nEverything compiles. Everything runs. The picture is just quietly wrong.\n\nI built it with [Kiro](https://kiro.dev), and this post is about which parts\n\nof it earned their keep under those conditions, which parts I had to fix, and\n\none bug that a property test found on submission day that I'd never have\n\nthought to look for.\n\nHere are the rules in this project that an assistant gets wrong **by default, because the default is sensible and these formats are not**:\n\n**1. A 32-bit BMP's fourth byte is not alpha.** Four bytes per pixel: blue,\n\ngreen, red, and a fourth one. Obviously that's alpha. It isn't — in skin\n\nsheets from 1999 it's padding, almost always zero, because the header format\n\nhas no alpha channel and nobody was reading it as one. Honour it and every\n\npixel becomes fully transparent. The skin loads perfectly and is completely\n\ninvisible.\n\n**2. Division by zero yields zero.** Not Infinity, not NaN. In ns-eel — the\n\nlanguage inside a `.milk` preset — `1/0` is `0`, and presets rely on it as a\n\nguard-free `1/x`. Add the guard the author \"forgot\" and you've changed what\n\nthe preset draws.\n\n**3. Audio bands are about 1.0, not 0 to 1.** `bass`, `mid`, `treb` are each\n\ndivided by a twelve-second running average of themselves, so typical music\n\nsits near **1.0** and the range runs to roughly 8. That's why real presets are\n\nfull of `max(0, bass - 1)` — they react to the *delta from normal*, which is\n\nwhat makes a visualiser move with the kick drum instead of with the volume\n\nknob. Pass a 0–1 level and every one of those expressions sits at a constant,\n\nand every preset renders as a still image. Silently.\n\nEvery one of those is a thing a competent engineer, or a competent model, will\n\nget wrong on first contact — and then get wrong again next week, because\n\nnothing about the code reminds you.\n\nKiro's steering documents are markdown files in `.kiro/steering/` with\n\nfrontmatter that decides when they load. Three of mine load always. The\n\ninteresting three don't:\n\n```\n---\ninclusion: fileMatch\nfileMatchPattern: 'src/milkdrop/**|worker/**'\n---\n\n# The preset language\n---\ninclusion: fileMatch\nfileMatchPattern: 'src/{skin,core}/**|tools/make-skin.ts'\n---\n\n# The skin format\n```\n\nThat's the whole mechanism, and it's the thing I'd take to any other project.\n\nThe ns-eel rules arrive **whenever anyone opens a file under\n`src/milkdrop/`**. Not when I remember to paste them. Not in a 4,000-line\n\n`CLAUDE.md` that's 90% irrelevant to the file in front of you.\n\nThe second half of why it works is how the rules are written. Every one of\n\nthem has **the symptom attached**:\n\nGet this wrong in either direction and the symptom is not an error. It is a\n\nstill image.\n\nHonour the zeroed fourth byte and the entire skin goes invisible.\n\nThat's not decoration. In a year I won't remember the rule, but I'll recognise\n\nthe symptom instantly — and so will a model that's reading the file for the\n\nfirst time and trying to work out whether the thing it's looking at is a bug.\n\n**If you take one thing from this post:** a rule without its symptom is\n\ntrivia. A rule with its symptom is a diagnosis.\n\nKiro's specs are `requirements.md` → `design.md` → `tasks.md` per feature,\n\nwith EARS-style acceptance criteria. Mine are four features, twelve files.\n\nThe convention I added, which isn't a Kiro feature but which Kiro's structure\n\nmade obvious: **every design document opens by naming the risk it exists to manage**, and then justifies its decisions against that risk, rejected\n\nThe named risk is a control that LOOKS right and is clickable two pixels to\n\nthe left.\n\nThe payoff is a trick I'll repeat. The test suite **cites the spec by path**:\n\n```\n/*\n * The named risk in .kiro/specs/skin-engine/design.md is a control that LOOKS\n * right and is clickable two pixels to the left.\n */\n```\n\nNow the spec isn't documentation that drifts quietly out of date. It's load-\n\nbearing. Someone reading the test knows *why it exists*, and someone editing\n\nthe spec gets a hook firing at them (more on that in a second). Specs that\n\ndescribe an older version of your code are worse than no specs — they're\n\nconfidently wrong.\n\nAgent hooks are JSON files that fire a prompt on a file event. I have five.\n\nThe one that mattered most fires on edits to my sprite atlas and says, in as\n\nmany words:\n\nRun `npm run make:shots`, then read the PNGs and describe what you actually\n\nsee. **Do not report success from the tests alone** — every layout bug in\n\nthis project was invisible to the tests and obvious in the screenshot.\n\nThat's a hook whose entire job is to **reject a category of evidence**. In a\n\ncodebase where the tests can't see the bug, \"the tests pass\" is not a status\n\nreport, and the hook says so at the moment it's most tempting to accept it.\n\nA second one, `claims-audit`, fires on edits to the README and the submission\n\ndocs, and insists every published number be reproducible by a command next to\n\nit. It exists because I once published \"19 kB gzipped\" that covered JavaScript\n\nonly, against a real total of 24.0 kB. The hook names that specific mistake so\n\nit can't repeat — and on submission day it caught a different one: a claim\n\nthat the repository \"contains no image files\" when it ships twenty generated\n\nscreenshots. The true claim is that no image is an *input*. One word, and the\n\ndifference between a precise claim and a false one.\n\n**Hooks are cheap to write and they are where your scar tissue goes.**\n\nThree custom agents, each a JSON file with a narrow tool list and a scoped\n\nresource list. None of them has a name like \"Senior Architect Alex\". They're\n\nworking postures:\n\n`format-archaeologist`` preset-wright``pixel-inspector`\nThe `resources` array is the part people skip. Scoping an agent to five files\n\nis most of what makes it behave.\n\n`.kiro/settings/mcp.json` wires up `fetch`, `filesystem` and `git`. The\n\ndeliberate part isn't which servers — it's the `autoApprove` lists:\n\n```\n\"filesystem\": {\n  \"autoApprove\": [\"read_file\", \"list_directory\", \"search_files\"]\n},\n\"git\": {\n  \"autoApprove\": [\"git_status\", \"git_diff\", \"git_log\", \"git_show\"]\n}\n```\n\nReads are auto-approved. **Writes are not, and neither is `commit` or\n`push`.** The `git` reads are there because the spec-drift and claims-audit\n\nhooks genuinely need a diff to tell spec-wrong from code-wrong. The absence of\n\nwrites is there so a spec-driven run can't quietly rewrite my sprite atlas\n\nwhile I'm reading something else.\n\nThat split took thirty seconds to configure and is the main reason I let the\n\nhooks run unattended.\n\nThe steering doc for tests specifies property-based testing for anything that\n\nparses untrusted input. The expression compiler takes text from four\n\ndirections — files a user drops in, the bundled corpus, equations a language\n\nmodel wrote, and whatever's in a preset downloaded off the internet — so it\n\ngets twelve properties over arbitrary ASCII, at 300–500 runs each.\n\nThe central one:\n\n``` js\nit('returns a finite double for any source and any register values', () => {\n  fc.assert(fc.property(anySource, fc.array(anyDouble, { maxLength: 24 }),\n    (src, seeds) => {\n      const regs = new Registers();\n      const { program } = tryCompile(src, regs);\n      if (!program) return;\n      // Poison the register file, including with NaN and infinities.\n      for (let i = 0; i < seeds.length && i < regs.values.length; i++) {\n        regs.values[i] = seeds[i]!;\n      }\n      const out = program.run(regs.values, () => 0.5);\n      expect(Number.isFinite(out)).toBe(true);\n    }), { numRuns: 500 });\n});\n```\n\nOn submission day, running the suite to verify a number for a form, I got **68 passing on one run and 67 on the next**. The counterexample was one string:\n\n```\n\"__proto__\"\n```\n\nMy lookup tables for functions and constants were object literals:\n\n``` js\nconst CONSTANTS: Record<string, number> = { pi: Math.PI, e: Math.E };\n// ...\nconst constant = CONSTANTS[name];\nif (constant !== undefined) return () => constant;\n```\n\n`CONSTANTS['__proto__']` doesn't return `undefined`. It returns\n\n`Object.prototype`. So a preset containing that single word compiled into a\n\nprogram that returns **an object** where every caller expects a double —\n\nsailing past my `finite()` guard, because `Number.isFinite` says nothing\n\nuseful about an object, and heading for a GPU uniform. Same for `constructor`,\n\n`toString`, `valueOf`, `hasOwnProperty`.\n\n`__proto__(1)` was worse: the function lookup *succeeded*, `.arity` was\n\n`undefined`, and destructuring it threw a `TypeError` — violating a different\n\nproperty in the same file, the one that promises every malformed input raises\n\n`ExprError` and nothing else.\n\nThe fix is boring (`Map` instead of object literal — no prototype chain to\n\ninherit through). The point is that **no example-based test I would ever have\nwritten contains the string `__proto__`.** Example tests check the inputs you\n\nthought of. This was definitionally an input I didn't think of, in a component\n\nwhose stated threat model is text other people wrote.\n\nIt failed about one run in three. A flaky property is not noise — it's a bug\n\nwith a low reproduction rate, and the only thing that makes it a flake is\n\nlooking away.\n\nThree honest ones:\n\n**I wrote hooks that cited npm scripts that didn't exist.** My hooks happily\n\ntold the agent to run `npm run shots` when the actual script is\n\n`npm run make:shots`. A hook that references a nonexistent command is worse\n\nthan no hook: it produces a confident failure in the middle of a flow you\n\nweren't watching. Check your hook prompts against `package.json`.\n\n**A `fileMatchPattern` that doesn't match is invisible.** There's no error when\n\nyour steering doc never loads. It just silently doesn't help, and you conclude\n\nthe feature doesn't work. Open a file in the directory and confirm the\n\ndocument is actually in context before you trust it.\n\n**I didn't use Powers at all.** Specs, steering, hooks, agents and MCP covered\n\neverything I needed, and I'd rather report the honest list than pad it.\n\nIf your failures are silent — a renderer, a codec, a parser for a format\n\nnobody documented — the ordinary order is backwards. You can't write the code\n\nand then test it, because you won't know which parts were wrong.\n\nSo: decide first how you'll *see* a failure. Then write that decision down\n\nsomewhere that loads itself, with the symptom attached, and put a hook on the\n\nfile where you'd be most tempted to forget it.\n\nKiro's contribution isn't that it writes code. It's that it gave me somewhere\n\nto put the three rules so they arrive with the file, and a way to make a test\n\npoint at the reason it exists.\n\n*Nullwave is MIT-licensed and has zero runtime dependencies. It's an independent reimplementation of two file formats, unaffiliated with Winamp,\nNullsoft or MilkDrop.*\n\n*Built for Kiroween 2026.*", "url": "https://wpnews.pro/news/my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed", "canonical_source": "https://dev.to/rohit_maruriats_860818d7/my-assistant-got-the-same-three-rules-wrong-every-time-kiros-conditional-steering-fixed-it-38o5", "published_at": "2026-12-04 20:55:25+00:00", "updated_at": "2026-12-04 21:14:30.632865+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools", "large-language-models"], "entities": ["Kiro", "Winamp", "MilkDrop", "ns-eel"], "also_reported_by": [], "takeaway": "Scope steering rules to file paths with Kiro's fileMatch frontmatter and attach each rule's observable symptom, so silent failures like invisible skins or frozen presets become diagnosable instead of trivia.", "recommendation": {"advice": "Put format-specific rules in path-scoped steering files that load only for matching directories, and state each rule's symptom so the agent can recognize silent failures.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed", "markdown": "https://wpnews.pro/news/my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed.md", "text": "https://wpnews.pro/news/my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed.txt", "jsonld": "https://wpnews.pro/news/my-assistant-got-the-same-three-rules-wrong-every-time-kiro-s-conditional-fixed.jsonld"}}