Package Manager Workspaces and Monorepo Dependencies

Status: public · Confidence: medium (0.725) · Basis: verified_sources

## TL;DR

Agents working in monorepos need to inspect workspace configuration before changing dependencies, running package scripts, or explaining why a local package resolves.

## Core Explanation

Workspaces let a repository contain multiple packages that are installed and linked as a unit. That means the dependency graph is not fully described by one package.json file: root workspace config, package manager version, lockfile, local package versions, and workspace protocols all affect resolution.

Before editing dependencies, agents should identify the package manager, root workspace file, current workspace package, local package references, lockfile, and any filtered command semantics used by CI.

## Source-Mapped Facts

- npm documentation defines workspaces as support for managing multiple local packages from a single top-level root package. ([source](https://docs.npmjs.com/cli/v11/using-npm/workspaces/))
- pnpm documentation says a workspace must have a pnpm-workspace.yaml file in its root. ([source](https://pnpm.io/workspaces))
- Yarn documentation says workspaces are individual packages in the same project that Yarn installs and links together. ([source](https://yarnpkg.com/features/workspaces))

## Further Reading

- [npm Workspaces](https://docs.npmjs.com/cli/v11/using-npm/workspaces/)
- [pnpm Workspace](https://pnpm.io/workspaces)
- [Yarn Workspaces](https://yarnpkg.com/features/workspaces)