Use a harness
In short
- Ask your agent to set up harnesspm, or run two commands yourself. Your agent then gets the harness of your dependencies.
- Review and commit what it wrote. After that, every install keeps it current.
- Two things stay with you: which packages may run tools, and turning those tools on in your own terminal.
This page is for a project that uses libraries. To ship a harness with your own library, see Share a harness. To bring your own way of working to every repository, see Bring your own harness.
Paste this into Claude Code or Codex, in your project:
Set up harnesspm in this project:
install @tenphi/harnesspm as a dev dependency
and run `npx harnesspm init`.
Then tell me what it wrote, which packages have
tools that wait for my trust, and what each tool does.
Do not change "trust" yourself.
Details: https://harnesspm.tenphi.me/guides/setupnpm
shell
npm i -D @tenphi/harnesspm
npx harnesspm initpnpm
shell
pnpm add -D @tenphi/harnesspm
pnpm exec harnesspm inityarn
shell
yarn add -D @tenphi/harnesspm
yarn harnesspm initEither way, init does the same:
- It writes the rules of your dependencies into a block in
AGENTS.md, and links their skills and docs. - It makes every install run
harnesspm sync, which keeps all of this current. - It gives your agent three skills for harnesspm itself, so you can ask for the rest.
You need Node.js 20 or later, and npm, pnpm, Yarn 1 or Yarn 4 with the node-modules linker. harnesspm writes files for Claude Code and Codex.
The block in AGENTS.md is instructions to your agent. Read it once, like code.
git add AGENTS.md CLAUDE.md harnesspm.json harnesspm.lock.json package.json package-lock.json
git commit -m "chore: set up harnesspm"With pnpm or Yarn, add their lockfile instead of package-lock.json. Everything else that harnesspm wrote stays on your machine, out of git. Set up a project lists every file.
Rules, docs and skills work at once. Scripts, hooks and MCP servers are code, so a package’s tools stay off until you trust the package.
- Ask what is waiting: “Which harnesspm tools are pending, and what does each one do?”
- Say which packages you trust: “Trust
@acme/uiin harnesspm.” Your agent adds the package totrustinharnesspm.json. - Turn the tools on in your own terminal:
npx harnesspm approveYour agent cannot do step 3. harnesspm never lets an agent give itself permissions. Trust and safety says what trust covers, and when to use "pin".
- A full install, such as
npm install,npm ciorpnpm install, runsharnesspm syncfor you. - After
npm install <pkg>orpnpm add <pkg>, no script runs. harnesspm’s own rule tells your agent to runnpx harnesspm sync. When you install by hand, run it yourself. - A check in CI catches a missed sync. Ask for it: “Add
npx harnesspm sync --checkto our CI, after the install.” - A deploy that installs without dev dependencies, such as
npm ci --omit=devin a Docker build, skips the sync and goes on.
Upgrades then show up in pull requests, as changes to the block in AGENTS.md and to the lock.
A package cannot set this up by itself, and that is on purpose.
- npm 12, pnpm and Bun do not run the install scripts of dependencies until you allow each one (sources).
- What your agent reads is your project’s decision. You take the step once, and you see every later change in review.
- Share a harness: another way to start, for a library’s author.
- Bring your own harness: your own rules, notes and skills, in every repository.
- Ask your agent: prompts for the common tasks, and what stays with you.
- For AI agents: every step in detail. Read it when you want to know exactly what happens.