Standard Library is LLM Proof
I think anyone that has attempted to build a new IF platform will tell you one of the harder problems is building the standard library in a cohesive manner. All 40+ actions have to work in a similar fashion. New actions must be easily created. This has to be seamless.
I've probably tried to let Claude do lawnmower refactors against all 40+ actions ten or more times. Each time I discover new patterns and improve the set, but when I do a deeper review, some actions are implemented better than others. Some are not following all of the patterns I've defined (but still working properly).
I finally had to erase the last refactor branch and go back to main to look more deeply at all of the actions in the standard library. I decided to do this one at a time. Each action must work how I want them to work. No exceptions, no assumptions.
We started with TAKE, which translates to the event 'if.action.taking'. This led to some long-winded discussions about missing data, dirty data construction, and minor, but annoying engineering issues.
The result is we're adding a shared data property to the action context, so our three-phase format (validate -> execute -> report) can add/read data in validate and execute for report to have everything it needs. The other thing is that World Model will report some of the mutations in the event source (like moveEntity) so report and Text Service has everything it needs, replacing some platform events.
Sample timeline of an action executing (timings are examples):
Turn 5, Time 0ms: execute() starts
Turn 5, Time 1ms: world.moveEntity() called
Turn 5, Time 2ms: world.entity.moved EMITTED ← World event
Turn 5, Time 3ms: execute() completes
Turn 5, Time 4ms: report() called
Turn 5, Time 5ms: report() returns events array
Turn 5, Time 6ms: if.event.taken PROCESSED ← Action event
This will definitely slow me down, and that's a good thing. I've now reached the point where larger refactors are detrimental to the code base and I'm reaching in and refining things at a molecular level. This will improve the quality of the standard library significantly. I suspect I'll need 2-4 hours for each action, which is going to require several weeks of focused work.
[Update August 31, 2025]
- Refactored taking, opening, and about.