Harness management for npm packages.
Command
shell
npx -y @harnesspm/cli initAsk your agent
text
Run `npx -y @harnesspm/cli init` in this project and do what it prints.Run it once in a project, or ask your agent to. init installs harnesspm and makes every install run harnesspm sync, which updates what your agents read. Then it says what to commit, and which tools wait for your trust.
Without help, an agent in your project guesses how your libraries work, or it remembers an older version. Today the fix is manual:
- Teams paste rules into
AGENTS.md, and the rules drift away from the code. - A library can put docs in its package, but nothing points the agent at them.
- Each agent reads its own files:
CLAUDE.mdand.claude/for Claude Code,.codex/for Codex. - A library that builds on another one copies the upstream rules, and the copies go stale.
A library writes its harness once, and every project that installs the library gets it.
harness/ folder
- Rules and docs
- Skills and sub-agents
- Scripts, hooks and MCP servers
extendsfor the packages it builds on
harnesspm sync
- Finds the harness of each installed version
- Follows
extendschains - Applies your patches and exclusions
- Turns on tools only for trusted packages
Native files
AGENTS.mdCLAUDE.mdboth agents · committed.claude/Claude Code · per machine.codex/.agents/Codex · per machineharnesspm.lock.jsonfor review · committed
AGENTS.md, CLAUDE.md and the lock are committed, so a pull request shows every change. The rest stays on each machine, out of git.Your agent gets short, current instructions, and you can trace each one to its source.
The examples on this site use one app. It depends on @acme/ui, a design system built on @acme/colors and @acme/styles. The packages are made up, and the output is real.
Each rule, docs index or script is a unit with an ID, such as acme-colors:rules/usage. The managed block that harnesspm writes into AGENTS.md names the unit behind every line:
- Every package of this harness: `npx -y @harnesspm/cli help`. A package's rules and tools in full: `npx -y @harnesspm/cli help <package>`. - Run a tool: `npx -y @harnesspm/cli run <tool> [args]`. Its options: `npx -y @harnesspm/cli help <tool>`. - From outside this folder, add `-C <path to this folder>` before `help` or `run`.## @acme/colors (via @acme/ui) - Always-on rule: Acme Colors — Where colors come from, Contrast. Read it with `help @acme/colors` (acme-colors:rules/usage)patched by acme-ui - Docs: .harnesspm/docs/acme-colors/llms.txt (acme-colors:docs) - Tool: `acme-colors:contrast` — Measure the WCAG contrast of a text color on a background (acme-colors:scripts/contrast)## @acme/styles (via @acme/ui) - Always-on rule: Acme Styles — Tokens, States. Read it with `help @acme/styles` (acme-styles:rules/usage) - When editing `**/*.tsx`, read node_modules/.harnesspm/pkgs/@acme/styles/harness/dev.harnesspm/rules/components.md — How to style a component (acme-styles:rules/components) - Docs: .harnesspm/docs/acme-styles/llms.txt (acme-styles:docs) - Tool: `acme-styles:check` — Check the styles in a file (acme-styles:scripts/check)- Edit files with your file tools, not shell commands such as `sed`, so the hook that checks each edit runs (acme-styles:hooks/check-edit)## @acme/ui - Always-on rule: Acme UI — Components, Colors. Read it with `help @acme/ui` (acme-ui:rules/usage) - Docs: .harnesspm/docs/acme-ui/llms.txt (acme-ui:docs) - Tool: `acme-ui:tokens` — Find a color token by a part of its name, with its light and dark values (acme-ui:scripts/tokens)…The app depends only on @acme/ui. @acme/colors comes through it, and a patch from @acme/ui rewrites the first section of its rule for apps on @acme/ui. Lines marked … are cut here.
Each rule, docs index and tool is one line, and skills load when needed, so the always-on text stays small. The commands at the top tell the agent how to get the rest: help @acme/colors prints that package’s rules, with the patch applied, and help acme-ui:tokens prints a tool’s usage. npx -y @harnesspm/cli status shows the size.
Your agent’s knowledge of a library updates when the library does. Rules, docs and tools come from the version in node_modules. Nothing is copied, so nothing drifts. The managed block and the lock are committed, so the pull request shows what changed. Here is an upgrade of @acme/ui from 4.2.0 to 4.3.0, which changed only its tokens script, so only the lock changed:
harnesspm.lock.json
diff
"@acme/ui": {
- "version": "4.2.0",
+ "version": "4.3.0",
"plugin": "acme-ui"
…
"acme-ui:scripts/tokens": {
"kind": "scripts",
- "hash": "54ba39c0298593bc"
+ "hash": "45e6351947d862a9"
}A library passes on the harness of the libraries it builds on, adapted for its users. @acme/ui does this with two fields in its harness/plugin.json:
"extensions": {
"dev.harnesspm": {
"extends": ["@acme/colors", "@acme/styles"],
"patch": {
"acme-colors:rules/usage": "./dev.harnesspm/patches/acme-colors-usage.patch.md"
}
}
}extendsgives every app on@acme/uithe harness of both packages, in the versions that@acme/uiuses.patchchanges one section of the colors rule and keeps the rest.
So an app that installs only @acme/ui gets the rules, docs, skills and tools of all three packages.
You keep one copy of each instruction, not one per agent. Write a rule, skill, sub-agent or hook once. Each agent gets it in its own files: the managed block in AGENTS.md for both, .claude/ for Claude Code, .codex/ and .agents/skills/ for Codex. Other agents that read AGENTS.md and .agents/skills/ get the portable parts. See every file harnesspm writes.
This works before any library ships a harness:
- Your project.
npx -y @harnesspm/cli new rule usagestarts aharness/folder in your repository. - All your repositories. Publish shared rules as a harness-only package, and add it as a dev dependency in each.
Your project has the last word on every unit. One harnesspm.json holds your changes and your trust:
{
"patch": {
"acme-colors:rules/usage": "./harnesspm/patches/acme-colors-usage.patch.md"
},
"exclude": ["acme-styles:hooks/check-edit"],
"trust": {
"@acme/ui": true,
"@acme/styles": true,
"@acme/colors": "pin"
}
}- A patch changes one section of a rule and keeps the rest. When an upgrade changes that section,
syncwarns you. exclude drops a unit or a whole package. replace swaps a unit for your own file. - Rules, docs and skills work at once. Scripts, hooks and MCP servers run only for packages you trust. Trusting
@acme/uidoes not trust@acme/colors. "pin"keeps a new version’s tools off until you runnpx -y @harnesspm/cli approve.- When an agent runs harnesspm, new hooks, MCP servers and allow rules wait until a person reviews and merges them.
- Rules are instructions to your agent. Review their changes in the pull request, like code.
why shows where any unit comes from and every change made to it. Here, the colors rule has a patch from @acme/ui and the app’s own:
ownerdependency @acme/colors 2.1.0 (via @acme/ui) sourcenode_modules/.harnesspm/pkgs/@acme/colors/harness/dev.harnesspm/rules/usage.md patchnode_modules/@acme/ui/harness/dev.harnesspm/patches/acme-colors-usage.patch.md (from @acme/ui) patchharnesspm/patches/acme-colors-usage.patch.md (from harnesspm.json) repositoryhttps://github.com/acme/colors editableno. Add a `patch`, `replace` or `exclude` in harnesspm.json, or propose the change upstream.Agents run the same command. The harnesspm-improve skill takes them from why to a change saved the way the unit’s owner asks.
Your team’s and your own way of working can follow you into every repository, without a commit. add puts a harness on top of the repository’s, on your machine:
npx -y @harnesspm/cli add \
github:<owner>/<repo>It applies in every repository on your machine, and one line in a setup script brings it to Claude Code cloud sessions. npx -y @harnesspm/cli doctor checks that its files stay out of git. Add your own harness shows how to start one.
Every task starts with one command. In any folder, npx -y @harnesspm/cli says what the folder is and names the command for each task, and that command prints the next step:
harnesspm 0.19.0: rules, docs, skills and tools from npm packages, for Claude Code and Codex.This folder (app) does not use harnesspm. 3 dependencies ship a harness: @acme/ui, @acme/colors, @acme/styles. Pick the task, run its command, and follow what it prints: Give this project's agents its dependencies' harness npx -y @harnesspm/cli init Share a harness from this package npx -y @harnesspm/cli new rule usage Add your own or your team's harness, on every repo npx -y @harnesspm/cli add <github:owner/repo | folder> Start a harness of your own, in an empty folder npx -y @harnesspm/cli new rule workflow A person decides what runs: they add a harness and trust a package. An agent asks first.Every command: npx -y @harnesspm/cli --help · Docs: https://harnesspm.tenphi.me Use
Your project gets the harness of its dependencies. One command, then every install keeps it current.
Share
Your library ships rules, docs, skills and tools in its npm package, and passes on the harness of the libraries it builds on.
Add your own
Your team’s or your own workflow, notes and skills, on top of any repository and never committed.
You say what you want, and your agent does the steps. Each of these guides opens with a one-line prompt to give your agent, then has every step, for your agent and for you.
Every format, rule and command is in the specification, on GitHub. It also ships in the npm package, so your agents read the version you installed.
These projects ship a harness. Read them as working examples:
- Glaze, a color toolkit: a rule, docs, a skill and scripts.
- Tasty, a styling library: a rule, docs and a script.
- eslint-plugin-tasty, the lint plugin for Tasty: a rule, docs, a script and a hook.
- Cube UI Kit, a design system that passes on all three. Its harness is a pull request for now.
- harnesspm itself: two rules, three skills and the specification as docs.
harnesspm started with these packages. The motivating case shows the manual work it replaced there. In a recorded run, Claude Code used UI Kit’s docs and tools for a task that named none of them.