agent-md-caregiver

A linter for your agent instructions. Checks AGENTS.md, CLAUDE.md and codex.md against the actual repo.

View the Project on GitHub fsystemweb/agent-md-caregiver

AMC004 package-manager-mismatch

Severity: warn

The file tells agents to use a package manager other than the one the repo uses.

What it checks

AMC004 package-manager-mismatch (warn)

The file says `npm install` (or `yarn build`, "always use pnpm", ...) but the repo is set up
for another package manager. The repo tells us which in two places:
  - the `packageManager` field of package.json (wins when present)
  - the lockfile: package-lock.json, pnpm-lock.yaml, yarn.lock, bun.lock / bun.lockb

Python works the same way: `uv.lock` or `[tool.uv]` means uv, `poetry.lock` or `[tool.poetry]`
means Poetry, `Pipfile` means pipenv, `pdm.lock` or `[tool.pdm]` means PDM. A repo with only
requirements files counts as pip, but only commands that need a pyproject.toml (`uv add`,
`poetry install`, ...) are reported there, because uv can run on requirements files too.
Fine in any repo: `pip install -r requirements.txt`, `pip install -e .`, `python -m venv`,
`uvx`, `pipx` and `uv pip`.

An agent that follows the wrong command writes a second lockfile or fails on a missing binary.

Only project-level calls count: install, run, test, start, add, remove and conventional script
names. `npx`, `pnpm dlx`, `npm publish`, global installs (`-g`) and `bun run file.ts` are fine
in any repo. Nothing is reported when the repo has several lockfiles or none, when the line
forbids the manager ("never use npm"), or when the nearest package declares its own manager.

Fix: use the repo's manager in the file. If the repo should use the other one, fix the
lockfile or `packageManager` field instead. Suppress with `<!-- amc-ignore-next-line -->`.

Example

AGENTS.md:

# Dev

- Build: `npm run build`

In the repo: package.json: {"scripts":{"build":"tsc"}}; pnpm-lock.yaml: ``.

Finding:

AGENTS.md:3:11  warn  AMC004  `npm run build`: this repo uses pnpm (pnpm-lock.yaml), not npm
fix: Use `pnpm run build`.

How to fix

Follow the fix: line of the finding, or see the end of the text above.

How to suppress

All rules