I don’t think I want to store that state with items because you can have multiple views on the same document (File > New Window). Expand/focus state are owned by view not items.
So far I’ve just been saving expanded items state using the macOS “restorable state” system, so that’s why state is restored, but you don’t see anything in file format. I can imagine also storing this view state in
<head> metadata. I think that would work well for most cases, but it gets messy if you are sharing a file with someone on dropbox (which some TaskPaper users do).
I think better way to expose expanded state is through eventual scripting API.