Ray's Knowledge Base
Unlock

A Claude Code mod's $ and atoms stay in the declaring file; siblings hold only pure code

FactVerified 2 Oct 2026Holds anywhere
Fact. A statement and the evidence for it.

Statement#

The Claude Code mod engine follows $ and state atoms only inside the file that declares them. When splitting a large mod file such as register.tsx, only constants and pure helpers can move to sibling modules (e.g. format.ts). Anything that uses $ or an atom must stay in the main file, so the split is smaller than a normal refactor.

Cost accepted#

Sibling modules also have to be embedded and written by the installer (rvow: the MOD_MODULES list in install.rs), or the installed plugin breaks.

Evidence#

rvow mod split attempt; the scope limit came from the engine's behavior.

Also found by searching

  • mod engine follows $ and state atoms only inside the file that declares them
  • only constants and pure helpers can move to sibling modules
  • sibling modules must be embedded and written by the installer
  • splitting register.tsx is smaller than a normal refactor