I stopped letting the AI decide anything in my roast app except the writing
Ember tracks five categories (sleep, fitness, discipline, focus, spending). My code picks which one gets asked next. My code compares your new answer to your last one and works out how the grade changed. My code decides when an achievement unlocks. The model gets those results and writes the roast around them, and it’s only allowed to quote numbers that actually changed. For example, if your sleep grade went from C to B, that’s the fact it gets. It doesn’t get to guess.
I’m not claiming this makes it perfect. But when a roast looks wrong, I know where to look: is the data the model received wrong (my bug), or did it write badly from correct data?
One related bug I hit: achievements kept un-unlocking themselves because three parts of the code wrote to the same row without checking each other. The fix was a compare-and-swap write, so the write succeeds only if the row is still what it was expected to be.
Where do you draw the line between what the model decides and what plain code decides?
Replies
Same line in my song app. Code decides everything that touches money or state: which engine runs, what falls back when it fails, how many credits get taken, and only the backend can write credits at all. The model writes the lyrics, the title and the cover prompt. One thing I'd add to your setup: I let the model write the title only after the song comes back, from what was actually generated, not from the request. Before that, titles described songs that never happened. Your "only quote numbers that changed" rule is the same idea, feed it facts after the fact. The compare and swap fix is a good catch too, three writers on one row is a classic.