AGENTS.md directory

Storybook

Workshop for building, documenting and testing UI components in isolation.

Carries a Learned User Preferences section recording corrections from maintainers.

Documents it routes to

This file points the agent at 9 other documents in the repository. Open any of them to read it here, as it was at this commit.


├── .agents
│   ├── guidelines
│   │   └── 
│   └── skills
│       ├── canary
│       │   └── 
│       └── principle-encode-lessons-in-structure
│           └── 
├── code
│   └── core
│       └── src
│           ├── cli
│           │   └── tools
│           │       ├── 
│           │       └── 
│           └── shared
│               └── open-service
│                   └── 
├── CONTRIBUTING
│   └── 
├── 
└── 

By the numbers

419
Lines
3,448
Words
about 16 min read
25.7kB
File size
38
Headings
112
Bullet rules
14
Code blocks
7
Links to other docs
router style
91.1k
Repo stars

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.

Techniques in this file

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.

How the file is organized

  1. 01Repository Overview
  2. 02Repository Structure
  3. 03Architecture
  4. 04Common Commands
  5. 05NX and yarn task
  6. 06How To Work In This Repo
  7. 07Pull Request Requirements
  8. 08Testing Expectations
  9. 09Quality and Logging
  10. 10Commands To Avoid
  11. 11Code Authoring Principles
  12. 12Maintenance Rules For Agents
  13. 13Learned User Preferences
Read the full file on GitHub

Context your AGENTS.md cannot carry

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.