This is also possible using the new rule, scripted automation, and the helper libraries, using the core.items module to add/remove Items.
Currently, a ManagedItemProvider is used, so the Items are added into the jsondb (like when added through the UI) and persist after OH restarts. However, I am currently testing an update that adds the option to use a regular ItemProvider so that the Items are no longer available after an OH restart, similar to the functionality of .items files.