When two packages need the same state, do not make one package read another package’s private object. Put the shared product fact in Bitfield and let each package read the view it needs.
A file tree chooses a file, then the editor, breadcrumbs, command palette, and AI context panel all need the active file. That state is no longer a private file-tree detail. It is product coordination state.Every package should see the same selected file without importing the file tree, sharing memory with it, or duplicating its private store.Traditional app shape
Bitfield shape
Code translation
Traditional path
Bitfield path
React adapter example
Review checklist
More examples
One product fact, many readers
The mental model is simple: a product fact is not owned by the first UI that touched it. The file tree might be the place where a user selected a file, but “the selected file” is not the file tree’s private object once the editor, AI panel, breadcrumbs, and command palette all need it.Traditional code turns the first UI into the source every other package imports:React adapter example
Four shared-state situations
Selected file
Private file-tree read
Read the public selected file
Current project
Private workspace read
Read the public project
Selected agent
Private agent setter
Request the selected-agent change
Notification mode
Private notification object
Request the mode change
What not to store as shared state
What this prevents
Common mistake
Do not put every piece of state in Bitfield.Review check
When code imports another package’s store, stop. Ask whether the value is a shared product fact. If yes, read a Bitfield input. If no, keep it private to the package that uses it.Next
- Learn when state should stay private: Keep private UI state private
- Read prepared values: Read data another package prepared
- Look up the React read adapter: Runtime Kit API