There are some edge cases, but generally when you press Return a new item (with new id) is created for the item text that followed the caret, and the text that proceeds the caret keeps the original id.
When a line is merged the first item (that's being merged into) retains it's id, while the second item is deleted.
Undo/Redo should restore the outline to it's original state, including ids.
When you open/close a TaskPaper (plain text) file ids are lost, not preserved. There is a XML serialization (available in the framework) format that does preserve ids, but it's not well tested yet.
I think it does, at least that's my intention