File measured on next at commit 5e6fcce. Analysis written 2026-09-14. Star count is a snapshot from September 2026.
What kind of file this is
Covers repository structure, architecture, commands, PR requirements and testing. Two of its sections are about the file itself: one instructs the agent to keep it updated, and one records preferences accumulated from previous work.
Quoted lines are verbatim from the file. Open one to see it where it sits.
A section of accumulated corrections
Learned User Preferences records five specific preferences from earlier sessions: use worktrees for parallel work, avoid premature helpers, keep long interaction tests as a readable flow rather than forcing DRY, put story descriptions in JSDoc above the meta const, and keep telemetry string names stable across versions when renaming.
The file names itself as canonical
Pointing at the source of truth
Other agent entrypoints are directed to reference this file rather than duplicate it, and the agent is instructed to update it when architecture, commands, versions or release flows change. A Maintenance Rules section states both in full.
Principles labelled as observed failure modes
Behavioral framing
The Code Authoring Principles section is introduced as recurring failure modes in agent-authored changes to this repo, and lists verifying environment assumptions with a throwaway probe before encoding them, preferring static checks over tests, and avoiding coverage already guaranteed by types or linting.
An inverted default for component tests
For React components the file directs behavior, accessibility and interaction assertions into stories with play functions, and reserves unit test files for pure utilities, hooks and non-React modules.
A ban on direct global assignment in tests
Hard prohibitions
Assigning a global directly is prohibited, with the mechanism given: Vitest does not restore it, so the assignment leaks into unrelated test files and produces order-dependent flakiness. The replacement API and its cleanup call are both named.
Commands the agent should not run
Two commands are listed under a Commands To Avoid heading, with the reason that they start long-running development servers, which the file describes as the wrong default for an agent.
Takeaways for your own repo
Keep a section for corrections that came up in review. It is the cheapest way to stop repeating the same feedback.
Name the commands that start long-running processes and tell the agent not to run them.
When a test rule exists because of a framework behavior, state the behavior. "Vitest does not restore it" is what makes the rule stick.
If your repo has several agent entrypoints, name one canonical file and make the rest point at it.
Storybook's file tells an agent how the codebase works. It cannot tell it which bug three customers hit this week. Modem keeps that context current and attaches it to the work.