A monorepo holds many packages with different rules. An agent that is told “fix the bug” may read a lot of unrelated code and apply the wrong conventions.
Narrow the task
- Name the package and the folder in the first message.
- Start the session in the package folder when the tool allows.
- List the paths that are out of scope.
Rules close to the code
Keep root instructions for what applies everywhere. Put package-specific commands and conventions in that package. Some tools read instruction files in subfolders when they work there; check how yours behaves before you rely on it.
Give each package its commands
# at the root
npm test -w @acme/billing
npm run typecheck -w @acme/billingA command that runs everything is slow and noisy. A command for one package gives a fast, clear result.
Share what crosses packages
Decisions that span packages, such as an API contract, are easy to lose. Record them once against the issue, so the agent that works on the other package finds them. See decision records for agent teams.