Not every state value belongs in Bitfield. Put state in Bitfield when it coordinates packages. Keep hover, menu, drag, focus, and draft UI details private.
A sidebar has hover state, an editor has unsaved text, a file tree has a selected file, and an assistant panel needs the selected file for context. These are not the same kind of state.The split is simple: Bitfield carries product facts that multiple packages need, while components keep visual-only details close to where they happen.The rule
Traditional mistake
Bitfield shape
The decision table
Four decisions in real product code
Hovered row
Traditional over-globalized answer
Keep hover local
Open command menu
Traditional over-globalized answer
Keep menu state local
Selected file
Traditional under-shared answer
Draft text
Traditional over-shared answer
Keep draft text local
Promotion rules
What this prevents
React is one adapter example. Swift view state, Kotlin state, terminal prompt state, and future shell state follow the same rule: visual-only state stays near the UI that uses it.
Review checklist
Full before and after
Traditional feature request
“When the user clicks a file row, highlight it, open it in the editor, and show the assistant panel context.”Bad implementation
Put each value where its readers are
Review check
Before adding state, classify it:Next
- Learn shared state: Share state between packages
- Learn action requests: Ask another package to do work
- Understand local customer-visible state: Local state