@harnesspm/cli 0.0.0-snapshot.cf808a1 โ†’ 0.0.0-snapshot.ebd6c58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,8 @@ export type Group = 'team' | 'added';
5
5
  export interface TrustState {
6
6
  trusted: boolean;
7
7
  reason?: string;
8
+ /** The person's step that turns the units on. */
9
+ action?: string;
8
10
  }
9
11
  /** Trust of a package's executable units (spec 6.2). The project and added harnesses are trusted. */
10
12
  export declare function trustOf(pkg: ResolvedPackage, res: Resolution, lock: Lock | undefined): TrustState;
@@ -17,10 +17,10 @@ export function trustOf(pkg, res, lock) {
17
17
  const approved = lock?.packages[pkg.name]?.approved;
18
18
  if (approved === undefined || approved === pkg.version)
19
19
  return { trusted: true };
20
- return { trusted: false, reason: `version ${pkg.version} is not approved (approved: ${approved}); a person approves it with \`${NPX_ANY} approve ${pkg.name}\`` };
20
+ return { trusted: false, reason: `version ${pkg.version} is not approved; approved: ${approved}`, action: `A person runs \`${NPX_ANY} approve ${pkg.name}\`.` };
21
21
  }
22
- // Trust is the person's decision (spec 6.2). The reason says who acts, so an agent does not take it as its next step.
23
- return { trusted: false, reason: `not trusted; a person turns it on in "trust" in harnesspm.json` };
22
+ // Trust is the person's decision (spec 6.2). The action says who acts, so an agent does not take it as its next step.
23
+ return { trusted: false, reason: 'not trusted', action: `A person adds "${pkg.name}": true to "trust" in harnesspm.json, then runs \`${NPX_ANY} approve\`.` };
24
24
  }
25
25
  export function emptyEntries() {
26
26
  return { claude: { allow: [], deny: [], ask: [], hooks: [], mcp: {} }, codex: { hooks: [], rules: [], mcp: {} }, agentFiles: new Map(), pending: [], warnings: [] };
@@ -170,7 +170,8 @@ export function desiredEntries(res, packages, trust, where) {
170
170
  }
171
171
  for (const [pkg, counts] of pendingCounts) {
172
172
  const what = [...counts].map(([kind, n]) => `${n} ${kind}${n === 1 ? '' : 's'}`).join(', ');
173
- entries.pending.push(`${pkg.name}: ${what} (${trust(pkg).reason})`);
173
+ const state = trust(pkg);
174
+ entries.pending.push(`${pkg.name}: ${what} (${state.reason}). ${state.action}`);
174
175
  }
175
176
  return entries;
176
177
  }
package/dist/run.js CHANGED
@@ -20,7 +20,7 @@ function checkPackage(pkg, res, what) {
20
20
  const lock = readLock(res.projectDir);
21
21
  const trust = trustOf(pkg, res, lock);
22
22
  if (!trust.trusted)
23
- throw new Refused(`${what} of ${pkg.name} is refused: ${trust.reason}`);
23
+ throw new Refused(`${what} of ${pkg.name} is refused: ${trust.reason}. ${trust.action}`);
24
24
  if (pkg.layer === 'dependencies') {
25
25
  const locked = lock?.packages[pkg.name]?.version;
26
26
  // Either side can be stale. A cached environment's install can be older than the lock, and a sync there would
@@ -0,0 +1,18 @@
1
+ export declare const DOCS_URL = "https://harnesspm.tenphi.me";
2
+ /** The version of the running harnesspm. */
3
+ export declare function version(): string;
4
+ /** Who decides, said once under every list of tasks. */
5
+ export declare const PERSON_DECIDES = "A person decides what runs: they add a harness and trust a package. An agent asks first.";
6
+ export declare const EVERY_COMMAND = "Every command: `npx -y @harnesspm/cli --help`";
7
+ /**
8
+ * What the bare command prints in a folder that does not use harnesspm: what the folder is, and the tasks for it, the
9
+ * likeliest first. Each task names the one command that starts it, and that command prints the next step.
10
+ */
11
+ export declare function startText(dir: string): string[];
12
+ /** The steps after `init` wrote and synced: what to commit, the check for CI, and what the agent does now. */
13
+ export declare function afterInit(toCommit: string[], waiting: boolean): string[];
14
+ /**
15
+ * What to do after `new`, by the folder (spec 10.2): an added harness saves the owner's way, a project that uses
16
+ * harnesspm syncs, a package publishes the harness, and a harness of one's own is added by a person.
17
+ */
18
+ export declare function nextAfterNew(projectDir: string, added: boolean): string[];
package/dist/start.js ADDED
@@ -0,0 +1,136 @@
1
+ // Where every task starts (spec 10.1): the bare command's tasks for a folder, and the next steps that `init`, `new` and
2
+ // errors print. One source, so the site only shows the command and the CLI, versioned with the package, holds the steps.
3
+ import * as path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { CONFIG_FILE } from './config.js';
6
+ import { childProjects, isParentFolder } from './parent.js';
7
+ import { resolve } from './resolve.js';
8
+ import { HarnessError, NPX_ANY, PACKAGE_NAME, PACKAGE_NAMES, isDir, isFile, isRecord, readJson, readJsonIfExists, relPosix, shellWord } from './util.js';
9
+ export const DOCS_URL = 'https://harnesspm.tenphi.me';
10
+ /** The version of the running harnesspm. */
11
+ export function version() {
12
+ const pkg = readJson(fileURLToPath(new URL('../package.json', import.meta.url)));
13
+ return isRecord(pkg) && typeof pkg['version'] === 'string' ? pkg['version'] : 'unknown';
14
+ }
15
+ const ADD = { what: "Add your own or your team's harness, on every repo", command: `${NPX_ANY} add <github:owner/repo | folder>` };
16
+ const OWN = { what: 'Start a harness of your own, in an empty folder', command: `${NPX_ANY} new rule workflow` };
17
+ /** Who decides, said once under every list of tasks. */
18
+ export const PERSON_DECIDES = 'A person decides what runs: they add a harness and trust a package. An agent asks first.';
19
+ export const EVERY_COMMAND = `Every command: \`${NPX_ANY} --help\``;
20
+ /** The dependencies of a package folder that ship a harness, harnesspm's own left out. */
21
+ function shipping(dir) {
22
+ try {
23
+ const packages = resolve(dir, { team: true }).packages.filter((p) => p.layer === 'dependencies' && !PACKAGE_NAMES.includes(p.name));
24
+ // The ones the project lists first, then those they pass on.
25
+ const names = [...packages.filter((p) => p.direct), ...packages.filter((p) => !p.direct)].map((p) => p.name);
26
+ if (names.length === 0)
27
+ return isDir(path.join(dir, 'node_modules')) ? 'No installed dependency ships a harness yet.' : 'Its dependencies are not installed yet.';
28
+ return `${names.length === 1 ? '1 dependency ships' : `${names.length} dependencies ship`} a harness: ${names.join(', ')}.`;
29
+ }
30
+ catch (error) {
31
+ if (error instanceof HarnessError)
32
+ return '';
33
+ throw error;
34
+ }
35
+ }
36
+ /**
37
+ * What the bare command prints in a folder that does not use harnesspm: what the folder is, and the tasks for it, the
38
+ * likeliest first. Each task names the one command that starts it, and that command prints the next step.
39
+ */
40
+ export function startText(dir) {
41
+ const name = path.basename(dir);
42
+ const isPackage = isRecord(readJsonIfExists(path.join(dir, 'package.json')));
43
+ const hasHarness = isFile(path.join(dir, 'harness', 'plugin.json'));
44
+ let about;
45
+ let tasks;
46
+ if (isPackage && hasHarness) {
47
+ about = `This package (${name}) shares a harness and does not use harnesspm itself.`;
48
+ tasks = [
49
+ { what: 'Check the harness this package shares', command: `${NPX_ANY} check` },
50
+ { what: "See it as its users' agents will, in AGENTS.md", command: `${NPX_ANY} init` },
51
+ { what: 'Add a rule, skill or tool to it', command: `${NPX_ANY} new <kind> <name>` },
52
+ ADD,
53
+ ];
54
+ }
55
+ else if (isPackage) {
56
+ about = `This folder (${name}) does not use harnesspm. ${shipping(dir)}`.trimEnd();
57
+ tasks = [
58
+ { what: "Give this project's agents its dependencies' harness", command: `${NPX_ANY} init` },
59
+ { what: 'Share a harness from this package', command: `${NPX_ANY} new rule usage` },
60
+ ADD,
61
+ OWN,
62
+ ];
63
+ }
64
+ else if (isParentFolder(dir)) {
65
+ const projects = childProjects(dir).map((p) => path.basename(p));
66
+ about = `This folder is above ${projects.length === 1 ? '1 project' : `${projects.length} projects`} that use harnesspm: ${projects.join(', ')}.`;
67
+ tasks = [
68
+ { what: 'Give sessions that start here their hooks', command: `${NPX_ANY} sync` },
69
+ { what: "List a project's packages from here", command: `${NPX_ANY} -C ${shellWord(projects[0])} help` },
70
+ ADD,
71
+ ];
72
+ }
73
+ else if (hasHarness) {
74
+ about = `This folder (${name}) is a harness, not a project: it has no package.json.`;
75
+ tasks = [
76
+ { what: 'Check it', command: `${NPX_ANY} check` },
77
+ { what: 'Add a rule, skill or tool to it', command: `${NPX_ANY} new <kind> <name>` },
78
+ { what: 'Add it on this machine (a person does this)', command: `${NPX_ANY} add ${shellWord(dir)}` },
79
+ ];
80
+ }
81
+ else {
82
+ about = `This folder (${name}) is not a project: it has no package.json.`;
83
+ tasks = [
84
+ { ...OWN, what: 'Start a harness of your own, in this folder' },
85
+ ADD,
86
+ { what: "Give a project's agents its dependencies' harness, in it", command: `${NPX_ANY} init` },
87
+ { what: 'Share a harness from a package, in it', command: `${NPX_ANY} new rule usage` },
88
+ ];
89
+ }
90
+ const width = Math.max(...tasks.map((t) => t.what.length)) + 3;
91
+ return [
92
+ `harnesspm ${version()}: rules, docs, skills and tools from npm packages, for Claude Code and Codex.`,
93
+ about,
94
+ '',
95
+ 'Pick the task, run its command, and follow what it prints:',
96
+ ...tasks.map((t) => ` ${t.what.padEnd(width)}${t.command}`),
97
+ '',
98
+ PERSON_DECIDES,
99
+ `Every command: ${NPX_ANY} --help ยท Docs: ${DOCS_URL}`,
100
+ ];
101
+ }
102
+ /** The steps after `init` wrote and synced: what to commit, the check for CI, and what the agent does now. */
103
+ export function afterInit(toCommit, waiting) {
104
+ return [
105
+ ...(toCommit.length > 0 ? [`To commit: ${toCommit.join(', ')}`] : []),
106
+ `In CI, after the install: ${NPX_ANY} sync --check`,
107
+ waiting ? 'Agent: report this to the person and wait for their trust decision.' : 'Agent: report this to the person.',
108
+ ];
109
+ }
110
+ /** The harnesspm-export skill: the copy the project installed, else the one that ships with this harnesspm. */
111
+ function exportSkill(projectDir) {
112
+ const rel = path.join('harness', 'skills', 'harnesspm-export', 'SKILL.md');
113
+ const installed = path.join(projectDir, 'node_modules', PACKAGE_NAME, rel);
114
+ return isFile(installed) ? relPosix(projectDir, installed) : fileURLToPath(new URL(`../${rel.split(path.sep).join('/')}`, import.meta.url));
115
+ }
116
+ /**
117
+ * What to do after `new`, by the folder (spec 10.2): an added harness saves the owner's way, a project that uses
118
+ * harnesspm syncs, a package publishes the harness, and a harness of one's own is added by a person.
119
+ */
120
+ export function nextAfterNew(projectDir, added) {
121
+ if (added)
122
+ return [`Next: edit it, run \`${NPX_ANY} sync\`, then save the change the way that harness's own AGENTS.md or CONTRIBUTING.md says.`];
123
+ if (isFile(path.join(projectDir, CONFIG_FILE)))
124
+ return [`Next: edit it, then run \`${NPX_ANY} sync\` and \`${NPX_ANY} check\`.`];
125
+ if (!isFile(path.join(projectDir, 'package.json'))) {
126
+ return [
127
+ `Next: edit it, run \`${NPX_ANY} check\`, and commit.`,
128
+ `A person adds it on their machine, in their own terminal: \`${NPX_ANY} add ${shellWord(projectDir)}\`, or \`add github:<owner>/<repo>\` once it is pushed.`,
129
+ ];
130
+ }
131
+ return [
132
+ `Next: edit it, then run \`${NPX_ANY} check\`.`,
133
+ `To publish it, add "harness" to "files" in package.json, and "prepack": "harnesspm check" with ${PACKAGE_NAME} as a dev dependency.`,
134
+ `Every step, and what goes into a harness: the harnesspm-export skill, ${exportSkill(projectDir)}`,
135
+ ];
136
+ }
@@ -34,14 +34,21 @@ my-lib/
34
34
  โ””โ”€โ”€ rules/โ€ฆ Markdown rules
35
35
  ```
36
36
 
37
+ ### Start
38
+
39
+ ```bash
40
+ npx -y @harnesspm/cli
41
+ ```
42
+
43
+ Every task starts with this one command. In a project it prints the project's report. Elsewhere it says what the folder is and names the command that starts each task, and that command prints the next step ([10.1](10-cli.md#where-every-task-starts)).
44
+
37
45
  ### Use (import)
38
46
 
39
47
  ```bash
40
- npm i -D @harnesspm/cli
41
48
  npx -y @harnesspm/cli init
42
49
  ```
43
50
 
44
- Every full install, such as `npm install` or `pnpm install`, then runs `harnesspm sync`. It finds the harness of each dependency, follows `extends` chains, applies the project's changes, and writes each agent's native files. The project commits the generated block in `AGENTS.md` and `harnesspm.lock.json`, so upgrades show up in pull requests.
51
+ `init` installs `@harnesspm/cli` as a dev dependency, then sets the project up. Every full install, such as `npm install` or `pnpm install`, then runs `harnesspm sync`. It finds the harness of each dependency, follows `extends` chains, applies the project's changes, and writes each agent's native files. The project commits the generated block in `AGENTS.md` and `harnesspm.lock.json`, so upgrades show up in pull requests.
45
52
 
46
53
  ### Add on top
47
54
 
@@ -120,7 +127,7 @@ Every feature serves at least one of these. Each must take as few steps as possi
120
127
  | --- | --- | --- |
121
128
  | S1 | A library shares its harness | Adds `harness/` and lists it in `files`. |
122
129
  | S2 | A library builds on upstream harness | Lists the upstream packages in `extends`, adds its own units. |
123
- | S3 | A project uses the harness of its dependencies | `npm i -D @harnesspm/cli` and `npx -y @harnesspm/cli init`, once. |
130
+ | S3 | A project uses the harness of its dependencies | `npx -y @harnesspm/cli init`, once. It installs harnesspm, and its report says what to commit and what waits for the person. |
124
131
  | S4 | A project changes one upstream rule | One `patch` for a few sections, or one `replace` or `exclude` entry. |
125
132
  | S5 | A project upgrades a dependency | Nothing after a full install. After `npm install <pkg>` or `pnpm add`, `npx -y @harnesspm/cli sync`. The pull request shows what changed. |
126
133
  | S6 | Several repositories share a policy | A harness-only package, added as a dev dependency. |
@@ -133,12 +140,12 @@ Every feature serves at least one of these. Each must take as few steps as possi
133
140
  | S13 | A job reads the harness without an install, such as a review bot | `npx -y @harnesspm/cli fetch`. |
134
141
  | S14 | A team sees how agents use its harnesses | `telemetry` in `harnesspm.json` with a handler, then `npx -y @harnesspm/cli sync`. |
135
142
  | S15 | An agent finds a harness unit that is wrong, missing or failing | Nothing in harnesspm. The project's own rule tells agents where to report, and `harnesspm why` gives the details. |
136
- | S16 | A person checks that a repository is ready for a harness of their own, and that no per-machine file can reach a commit | `npx -y @harnesspm/cli doctor`. |
143
+ | S16 | A person checks that a repository is ready for a harness of their own, and that no per-machine file can reach a commit | `npx -y @harnesspm/cli doctor`, or the bare command in a project, which prints the same report. |
137
144
  | S17 | A teammate's merged change adds a hook, an MCP server or an allow rule | Nothing. The next install writes it on every machine, also when an agent runs the install. |
138
145
  | S18 | An agent clones the repositories its task needs, such as into `work/app`, and uses their harnesses from its own folder | Nothing in the cloning repository. The block commands in the clone's `AGENTS.md` say how: `npx -y @harnesspm/cli -C work/app help` lists its packages, `-C work/app help <package>` prints one, and `-C work/app run <unit>` runs a tool, also before the clone is installed. Hooks of the clone run there only after a `sync` in that folder (S20). |
139
146
  | S19 | A repository has many harness packages or workspaces, and its `AGENTS.md` must stay inside the agents' limits | Nothing. The managed block names each rule and tool in one line. Agents print a package's rules with `help <package>` and a tool's options with `help <tool>`. |
140
147
  | S20 | A session starts in a folder above several repositories, such as a Claude Code cloud session with more than one, a person's folder of clones, or a job runner's work folder | `npx -y @harnesspm/cli sync` in that folder, after the installs: in the environment's setup script, once on a person's machine, or in the runner's checkout step. Each repository's hooks run there, and a block in that folder's `AGENTS.md` names each repository and its `help` command. A later sync of a repository keeps its entries there current. The `SessionStart` hook of an added harness syncs that folder too, so each repository gets its project entry. |
141
- | S21 | An agent looks for a dependency's docs with its search tool, not through the block | One `/.harnesspm/` line in `.gitignore`, so formatters skip the copies. `sync` and `fetch` copy every dependency's docs into `.harnesspm/docs/`, and a `.rgignore` that git ignores lets search tools in. |
148
+ | S21 | An agent looks for a dependency's docs with its search tool, not through the block | Nothing: `init` adds one `/.harnesspm/` line to `.gitignore`, so formatters skip the copies. `sync` and `fetch` copy every dependency's docs into `.harnesspm/docs/`, and a `.rgignore` that git ignores lets search tools in. |
142
149
 
143
150
  ## 1.7 What is committed
144
151
 
@@ -146,4 +153,4 @@ Every feature serves at least one of these. Each must take as few steps as possi
146
153
  | --- | --- |
147
154
  | `harnesspm.json`, `harnesspm.lock.json`, the managed blocks in `AGENTS.md`, the `@AGENTS.md` lines in `CLAUDE.md` files (at the root and next to each nested `AGENTS.md`) | Everything else: links, docs copies, agent settings, `.codex/`, outputs of added harnesses |
148
155
 
149
- Committed files depend only on the dependency and project layers, so every teammate and CI produce the same result. harnesspm never edits `.gitignore`.
156
+ Committed files depend only on the dependency and project layers, so every teammate and CI produce the same result. Only `init` edits `.gitignore`: it adds the one line `/.harnesspm/` when no `.gitignore` ignores that folder, and `.gitignore` is then among the files to commit. `sync` never edits it, and warns while the line is missing.
@@ -14,7 +14,7 @@ Package authors do not need this chapter. It defines what implementations write.
14
14
 
15
15
  1. **Native files only.** No agent has to understand a harnesspm format.
16
16
  2. **Commit only what reviewers need.** The managed block in `AGENTS.md` shows rule changes in pull requests. The lock shows every other unit change. All other outputs are per machine.
17
- 3. **Per-machine outputs are excluded through `.git/info/exclude`.** That file belongs to the clone, is never committed, and is shared by worktrees. harnesspm never edits `.gitignore`. `harnesspm doctor` checks that every per-machine file is ignored and untracked ([10.5](10-cli.md#105-doctor)). Its patterns start at the git root, so a project below it, such as `docs-site/`, puts its folder in front of each entry (`/docs-site/.claude/skills/โ€ฆ`) and keeps them in a section of its own, named after its folder. Two projects in one repository never touch each other's entries.
17
+ 3. **Per-machine outputs are excluded through `.git/info/exclude`.** That file belongs to the clone, is never committed, and is shared by worktrees. Only `init` edits `.gitignore`, with one line for the docs copies (note 8 in [4.3](#43-project-outputs)). `harnesspm doctor` checks that every per-machine file is ignored and untracked ([10.5](10-cli.md#105-the-report)). Its patterns start at the git root, so a project below it, such as `docs-site/`, puts its folder in front of each entry (`/docs-site/.claude/skills/โ€ฆ`) and keeps them in a section of its own, named after its folder. Two projects in one repository never touch each other's entries.
18
18
  4. **Units of added harnesses never enter a tracked file.** harnesspm MUST refuse to write one there.
19
19
  5. **Outputs are marked.** Each generated file or block says it is generated and names the sources to edit.
20
20
  6. **harnesspm edits only its own entries** in files that people or agents also write, and keeps the rest unchanged.
@@ -56,7 +56,7 @@ Notes:
56
56
  7. Claude Code reads a nested `AGENTS.md` only when no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` exists in its folder or above, and the root `CLAUDE.md` that imports the block is one ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#instructions)). So every nested `AGENTS.md` that git tracks, outside `node_modules`, gets an `@AGENTS.md` line in a `CLAUDE.md` in the same folder. harnesspm creates that file, or adds the line at the top of an existing one. A folder whose `.claude/CLAUDE.md` already has `@../AGENTS.md` keeps it and gets no second import. These files are committed outputs: `sync --check` and `doctor` report a missing line.
57
57
  8. Agents also look for docs by searching, not only through the block. Their search tools skip what git ignores and do not follow links, and plain `rg` also skips hidden folders: Claude Code's Grep and plain `rg` found no page in `node_modules`, under `node_modules/.harnesspm/pkgs/`, or behind a committed link into `node_modules` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#search)). So `sync` and `fetch` copy each dependency's pages (`.md`, `.mdx`, a linked one too) and `llms.txt` into `.harnesspm/docs/<plugin name>/` at the project root, leaving out what git ignores ([2.7](02-package-format.md#27-docs)). Other files, such as images, are not copied. A link in a copied page that leaves the docs folder, such as `../README.md`, would lead nowhere in the copy, so the copy points it at that file under `node_modules/.harnesspm/pkgs/<package>/`, in the installed package. The package keeps its own link, which its other readers need: a docs site may render the README as a page, as Tasty's does ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/motivating-case.md#docs-sites)).
58
58
  - Every dependency is copied, a workspace package too, so the committed pointer never depends on whether a package manager links or copies a package.
59
- - The copies sit outside `node_modules`, with the project's own files. Git ignores the folder through `/.harnesspm/` in `.git/info/exclude` (4.1, principle 3). Formatters such as Prettier skip what `.gitignore` lists but not what `.git/info/exclude` lists ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#search)), so `sync` warns until a `.gitignore` in the repository ignores the folder, and names the one in the project folder when the project is below the git root. A global excludes file does not count, since Prettier does not read it.
59
+ - The copies sit outside `node_modules`, with the project's own files. Git ignores the folder through `/.harnesspm/` in `.git/info/exclude` (4.1, principle 3). Formatters such as Prettier skip what `.gitignore` lists but not what `.git/info/exclude` lists ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#search)), so `init` adds `/.harnesspm/` to the `.gitignore` of the project folder, and `sync` warns until a `.gitignore` in the repository ignores the folder, naming the one in the project folder when the project is below the git root. A global excludes file does not count, since Prettier does not read it.
60
60
  - `sync` and `fetch` write the copies only where git ignores the folder `.harnesspm/docs/`, so that an agent's `git add -A` never takes them. They write the copies after `.git/info/exclude`, so a sandbox that keeps `.git` read-only gets copies only when `.gitignore` lists the folder. A pattern that ignores some of the files, such as `*.txt`, does not count. When git fails inside a repository, as in one another user owns, nothing is known to be ignored, so they write no copies.
61
61
  - A sync removes the copies that harnesspm 0.13 wrote in `node_modules/.harnesspm/docs/`.
62
62
  - A `.rgignore` in the project folder lets ripgrep, and the search tools built on it, into that one folder, because its lines outrank git's ignore rules for ripgrep: `!/.harnesspm/`, `/.harnesspm/*` and `!/.harnesspm/docs/`, after a line that says harnesspm wrote it. The rest of `.harnesspm/`, such as a telemetry file, stays out of search. The `.rgignore` is listed in `.git/info/exclude`.
@@ -131,7 +131,7 @@ The commands use `npx -y @harnesspm/cli` in every block. Inside the project, npx
131
131
 
132
132
  Every heading and line of a unit carries its ID, so an agent can find the source with `harnesspm why`.
133
133
 
134
- **Position.** Agents often read only the top of `AGENTS.md`, such as with `head -30` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#outside-the-start-folder)), so the block commands come first. A new file gets the block at its top. In an existing file without markers, the block goes at the end, and a person can move it up: `sync` keeps it where it is. `harnesspm status` and `doctor` warn when a committed block starts past the first 30 lines of its file.
134
+ **Position.** Agents often read only the top of `AGENTS.md`, such as with `head -30` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#outside-the-start-folder)), so the block commands come first. A new file gets the block at its top. In an existing file without markers, the block goes at the end, and a person can move it up: `sync` keeps it where it is. The report of `status` and `doctor` warns when a committed block starts past the first 30 lines of its file.
135
135
 
136
136
  A blank line follows the BEGIN marker and comes before the END marker, so Markdown formatters such as Prettier leave the block as it is. A block written without them, as harnesspm 0.3 did, still counts as up to date, and the next `sync` rewrites it once.
137
137
 
@@ -150,11 +150,11 @@ Both agents have plugin systems. harnesspm does not generate plugins in v1, beca
150
150
  | Codex | `AGENTS.md` files are joined up to `project_doc_max_bytes`, 32 KiB by default. The rest is cut off. |
151
151
  | Claude Code | No hard limit. The vendor advises under about 200 lines per `CLAUDE.md`. |
152
152
 
153
- `harnesspm status` reports the always-on size per agent, warns near a limit, and says when `AGENTS.md` is over Codex's. `harnesspm doctor` warns under Outputs when `AGENTS.md` is over 32 KiB, because Codex then reads only its first 32 KiB.
153
+ The report of `status` and `doctor` gives the always-on size per agent, and warns under Outputs when `AGENTS.md` is close to or over 32 KiB, because Codex then reads only its first 32 KiB.
154
154
 
155
155
  The committed block holds one line per unit, not the text of always-on rules ([4.6](#46-managed-blocks)). The always-on size that `status` reports is that of the files the agents load. The text that agents get with `help <package>` does not count toward it.
156
156
 
157
- Codex reads one file per folder, `AGENTS.override.md` before `AGENTS.md`, from its project root, usually the git root, down to the folder it starts in, and only the files' bytes count toward the limit ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#codex)). So `status` and `doctor` also name each managed block that Codex never reads, or reads only in part, with where it starts or ends in the joined files. Each warning adds that agents can still get what the block holds with `npx -y @harnesspm/cli help <package>`:
157
+ Codex reads one file per folder, `AGENTS.override.md` before `AGENTS.md`, from its project root, usually the git root, down to the folder it starts in, and only the files' bytes count toward the limit ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#codex)). So the report also names each managed block that Codex never reads, or reads only in part, with where it starts or ends in the joined files. Each warning adds that agents can still get what the block holds with `npx -y @harnesspm/cli help <package>`:
158
158
 
159
159
  - a root block after long hand-written text;
160
160
  - a workspace block below a long root `AGENTS.md`;
@@ -55,7 +55,7 @@ Rules:
55
55
  - Without `origin/HEAD` (`git remote set-head origin --auto` sets it), and in a Codex run, a model run holds back as before. Codex's sandbox keeps `.codex/` read-only, and Codex asks a person to review each new hook anyway.
56
56
  - A hook whose command changes only in its prefix, such as `node` with the installed CLI file in place of npx ([5.2](05-executables.md#52-hooks)), runs the same script. A model run writes it too.
57
57
  - A model run also keeps the telemetry handler that the lock has. A new or changed handler is held the same way ([14.5](14-telemetry.md#145-trust)).
58
- - `sync` lists the entries it held back, and why the repository is not in its reviewed state, such as `harnesspm.json differs from origin/main` or `the installed packages do not match harnesspm.lock.json`. So the person knows whether a review or an install is due. `status` and `doctor` list the same entries, counted the same way, with a held telemetry handler first. When the repository is in its reviewed state but this machine lacks entries, they say that a sync writes them. Outside a cloud session, they ask the person to run `sync` or `approve` in their own terminal. In a Claude Code cloud session (`CLAUDE_CODE_REMOTE=true`), the person has no terminal there, so they print the line for the environment's setup script instead ([9.1](09-cloud.md#91-the-repositorys-harness)).
58
+ - `sync` lists the entries it held back, and why the repository is not in its reviewed state, such as `harnesspm.json differs from origin/main` or `the installed packages do not match harnesspm.lock.json`. So the person knows whether a review or an install is due. `status` and `doctor` list the same entries, counted the same way, with a held telemetry handler first, under "Waiting for a person". When the repository is in its reviewed state but this machine lacks entries, they say under Outputs that a sync writes them: that is not a person's step. Outside a cloud session, they name the person's step: `approve`, in their own terminal. In a Claude Code cloud session (`CLAUDE_CODE_REMOTE=true`), the person has no terminal there, so they print the line for the environment's setup script instead ([9.1](09-cloud.md#91-the-repositorys-harness)).
59
59
 
60
60
  ## 6.3 The lock
61
61
 
@@ -103,7 +103,7 @@ Both files have one field:
103
103
 
104
104
  ## 7.6 Keeping the project clean
105
105
 
106
- 1. Added units are never written into tracked files. Per-machine files are excluded through `.git/info/exclude`. `harnesspm doctor` shows whether a repository is ready for a harness of your own, and finds a per-machine file that a commit could include ([10.5](10-cli.md#105-doctor)).
106
+ 1. Added units are never written into tracked files. Per-machine files are excluded through `.git/info/exclude`. `harnesspm doctor` shows whether a repository is ready for a harness of your own, and finds a per-machine file that a commit could include ([10.5](10-cli.md#105-the-report)).
107
107
  2. CI ignores added harnesses. With `CI=true`, `sync` writes only per-machine outputs ([06-trust.md](06-trust.md#64-ci)).
108
108
  3. `harnesspm status` lists every change that an added harness makes to the repository's units, so it stays visible.
109
109
  4. In a cloud environment shared by several people, add harnesses in your own environment. See [09-cloud.md](09-cloud.md).
@@ -19,7 +19,7 @@ cd /home/user/<repo> && npm ci
19
19
  - **Several repositories.** A session with more than one repository starts in `/home/user`, above the clones, and reads no settings from them ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#cloud-sessions)). After the installs, add `cd /home/user && npx -y @harnesspm/cli sync || true`. It writes each repository's hooks and a pointer block for sessions that start there ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). A session with one repository starts in its clone and runs that clone's own hooks. Claude Code also reads the `CLAUDE.md` files above its start folder, so it sees the block, which names the repositories next to it. The hook of an added harness applies its project entries in each clone too: the session reads their rules (`CLAUDE.local.md`) and skills, but not their hooks and permissions, which only a one-repository session gets.
20
20
  - **In every person's environment.** Environments are personal unless an organization Owner shares one. A team commits its script and gives people the lines to paste.
21
21
 
22
- The install runs as a person's would, before Claude Code starts, so nothing is held back, and its hooks work from the first session ([9.5](#95-what-real-sessions-confirmed)). To check, `harnesspm status` in a new session shows no held-back line.
22
+ The install runs as a person's would, before Claude Code starts, so nothing is held back, and its hooks work from the first session ([9.5](#95-what-real-sessions-confirmed)). To check, `harnesspm status` in a new session lists no entries that an agent cannot grant.
23
23
 
24
24
  A later install by the agent, such as after a pull, writes what the default branch records only when the clone has `origin/HEAD` ([06-trust.md](06-trust.md#62-trusting-a-package), rule 4). The cloud clones seen so far had none ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#cloud-sessions)). The setup script can set it without network: `git -C /home/user/<repo> remote set-head origin main || true`, with the repository's default branch.
25
25
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  **In short**
4
4
 
5
+ - Every task starts with one command, `npx -y @harnesspm/cli`. In a project it prints the project's report; elsewhere, what the folder is and the task for it, each with the one command that starts it. Every command's output names the next step ([below](#where-every-task-starts)).
5
6
  - Projects use `init`, `sync`, `status`, `doctor`, `why`, `approve` and `run`. Jobs that do not install dependencies use `fetch`.
6
7
  - From outside a project, such as a repository that cloned it, add `-C <dir>` before the command. `help` lists the project's packages, and `help <package>` prints one in full.
7
8
  - `help <tool>` prints a tool's usage, its answer exit codes and its run command, without running it.
@@ -12,23 +13,52 @@
12
13
 
13
14
  The npm package is `@harnesspm/cli`, and the command it installs is `harnesspm`. `npx -y @harnesspm/cli โ€ฆ` works everywhere: in a project that depends on it, npx runs the installed version, and elsewhere it downloads the package by its full name. Every text, message, block and hook that harnesspm writes uses this one form ([4.6](04-outputs.md#46-managed-blocks)). It never writes the bare `npx harnesspm โ€ฆ`: that works only in a project that depends on harnesspm, and elsewhere npx would fetch whatever is published under the unscoped name, without asking in a hook. An allow rule always has the prefix of the command it allows.
14
15
 
15
- `harnesspm help` lists every command, and `harnesspm <command> --help` shows one. Inside a project, or with `-C`, `help` also lists the project's packages ([below](#the-project-in-help)), and `help <package | rule ID | tool>` prints one of them in full ([below](#help-for-a-package-a-rule-or-a-tool)). A message that names a step for a person, such as trusting a package or approving a version, says that a person takes it. An agent reads every message too, and must not take that step as its own.
16
+ `npx -y @harnesspm/cli --help` lists every command, and `<command> --help` shows one. Inside a project, or with `-C`, `help` lists the project's packages ([below](#the-project-in-help)) and points at `--help`; elsewhere it lists every command. `help <package | rule ID | tool>` prints one of them in full ([below](#help-for-a-package-a-rule-or-a-tool)). A message that names a step for a person, such as trusting a package or approving what an agent could not grant, says that a person takes it, and names `approve` for every step that a person's run of harnesspm takes. An agent reads every message too, and must not take that step as its own.
17
+
18
+ ### Where every task starts
19
+
20
+ `npx -y @harnesspm/cli`, without a command, is where every task starts. The site shows this command, and the CLI, versioned with the package, holds the steps. In a project that uses harnesspm (a `harnesspm.json` in the folder or above it), it prints the project's report ([10.5](#105-the-report)). Elsewhere it writes nothing and prints at most 12 lines: harnesspm's version, what the folder is, its tasks with the likeliest first, each with the one command that starts it, who decides what runs, and where every command and the docs are.
21
+
22
+ | The folder | What it says | Its tasks, in order |
23
+ | --- | --- | --- |
24
+ | A package that does not use harnesspm | Which dependencies ship a harness | `init`, `new rule usage`, `add <source>`, a harness of your own (`new rule workflow`) |
25
+ | A package with `harness/` | It shares a harness | `check`, `init` to see the harness as its users' agents will, `new <kind> <name>`, `add <source>` |
26
+ | A parent folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)) | The projects right below it | `sync`, `-C <project> help`, `add <source>` |
27
+ | A folder with `harness/` and no `package.json` | It is a harness, not a project | `check`, `new <kind> <name>`, `add <the folder>`, which a person runs |
28
+ | Any other folder | It is not a project | `new rule workflow`, `add <source>`, then `init` and `new rule usage` in a project or package |
29
+
30
+ ```text
31
+ $ npx -y @harnesspm/cli
32
+ harnesspm 0.17.0: rules, docs, skills and tools from npm packages, for Claude Code and Codex.
33
+ This folder (app) does not use harnesspm. 3 dependencies ship a harness: @acme/ui, @acme/colors, @acme/styles.
34
+
35
+ Pick the task, run its command, and follow what it prints:
36
+ Give this project's agents its dependencies' harness npx -y @harnesspm/cli init
37
+ Share a harness from this package npx -y @harnesspm/cli new rule usage
38
+ Add your own or your team's harness, on every repo npx -y @harnesspm/cli add <github:owner/repo | folder>
39
+ Start a harness of your own, in an empty folder npx -y @harnesspm/cli new rule workflow
40
+
41
+ A person decides what runs: they add a harness and trust a package. An agent asks first.
42
+ Every command: npx -y @harnesspm/cli --help ยท Docs: https://harnesspm.tenphi.me
43
+ ```
44
+
45
+ The command that a task starts with prints the next step in turn: `init` its report, `new` the steps for the folder (10.2), and an error the command that fixes it. One module, `src/start.ts`, holds these texts.
16
46
 
17
47
  ## 10.1 Projects
18
48
 
19
49
  | Command | What it does |
20
50
  | --- | --- |
21
- | `harnesspm init` | Creates `harnesspm.json`, adds the [install hook](#the-install-hook) to the `postinstall` script of a private package or to `prepare` otherwise, makes `CLAUDE.md` import `AGENTS.md`, then runs `harnesspm sync` and names the committed files ([1.7](01-overview.md#17-what-is-committed)) that git sees as new or changed. It MUST stop before it changes anything when the project's `package.json` does not list `@harnesspm/cli` in `dependencies`, `devDependencies` or `optionalDependencies`: the script it adds calls the `harnesspm` command, so the next install would fail. |
22
- | `harnesspm sync` | Resolves the layers and writes all outputs. Runs on every install. In a repository that does not use harnesspm (it has no `harnesspm.json`), or whose dependencies are not installed, it writes only the per-machine outputs of added harnesses, so it never wipes the committed block. When an agent runs it, new allow rules, hooks and MCP servers stay pending outside the reviewed state, and the held-back line says what differs ([06-trust.md](06-trust.md#62-trusting-a-package)). With `CI=true`, it writes only the per-machine outputs and leaves the committed ones to `sync --check` ([06-trust.md](06-trust.md#64-ci)). In a parent folder, which is not in a git repository and has projects right below it, it writes their hooks and a pointer block for sessions that start there, and a project's sync keeps its entries there current. With added harnesses, it also writes their per-machine outputs in each git repository right below the folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). |
51
+ | `harnesspm init` | Sets up the project, in this order. (1) When its `package.json` does not list `@harnesspm/cli` in `dependencies`, `devDependencies` or `optionalDependencies`, it installs the package as a dev dependency, at its own version or a later compatible one, with the project's package manager: the one of its lockfile, else of its `packageManager` field, else npm (`npm i -D`, `pnpm add -D`, `yarn add -D`, `bun add -d`; `-w` at a pnpm workspace root, `-W` at a Yarn 1 one). The script that `init` adds calls the `harnesspm` command, so the next install would fail without the package. (2) It creates `harnesspm.json`, adds the [install hook](#the-install-hook) to the `postinstall` script of a private package or to `prepare` otherwise, makes `CLAUDE.md` import `AGENTS.md`, and adds `/.harnesspm/` to the `.gitignore` of the project folder when no `.gitignore` ignores that folder ([4.3](04-outputs.md#43-project-outputs), note 8). (3) It runs `harnesspm sync`. (4) It reports what it wrote, the tools of each package that is not trusted, with what each does and whether it runs without a prompt, the committed files ([1.7](01-overview.md#17-what-is-committed)) that git sees as new or changed, the check for CI, and what the agent does next. It MUST stop before it changes anything when the install fails, and when the project uses Yarn Plug'n'Play, which writes no `node_modules`. An agent's run installs too: the person asked for the setup. Trust and the entries that only a person grants stay with the person ([06-trust.md](06-trust.md#62-trusting-a-package)). |
52
+ | `harnesspm sync` | Resolves the layers and writes all outputs. Runs on every install. In a repository that does not use harnesspm (it has no `harnesspm.json`), or whose dependencies are not installed, it writes only the per-machine outputs of added harnesses, so it never wipes the committed block. When an agent runs it, new allow rules, hooks and MCP servers stay pending outside the reviewed state, and the line under "Waiting for a person" says what differs and names `approve` ([06-trust.md](06-trust.md#62-trusting-a-package)). With `CI=true`, it writes only the per-machine outputs and leaves the committed ones to `sync --check` ([06-trust.md](06-trust.md#64-ci)). In a parent folder, which is not in a git repository and has projects right below it, it writes their hooks and a pointer block for sessions that start there, and a project's sync keeps its entries there current. With added harnesses, it also writes their per-machine outputs in each git repository right below the folder ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). |
23
53
  | `harnesspm sync --check` | Writes nothing and ignores added harnesses, as every run with `CI=true` does. Fails when a committed output or the lock is out of date. For CI. |
24
54
  | `harnesspm sync --write` | Writes the committed outputs with `CI=true` too, for a job that commits them. `init`, `approve` and `new` always write them. |
25
- | `harnesspm status` | Layers, packages, versions, pending trust, entries an agent's sync would hold back (the list `sync` prints), changes that added harnesses make to the repository's units, always-on size per agent, managed blocks that Codex does not reach ([4.9](04-outputs.md#49-size-limits)), and whether telemetry is on, held or off on this machine. Points to `doctor` when a per-machine file has a problem. |
26
- | `harnesspm doctor` | Checks that the repository is ready for harnesses, its own and a person's. It changes nothing. Each problem names the command that fixes it. Exits `1` when a check fails; warnings, such as pending trust, do not fail. See [10.5](#105-doctor). |
55
+ | `harnesspm status` | The project's report ([10.5](#105-the-report)): layers, packages and versions, changes that added harnesses make, always-on size per agent, telemetry, the checks that the repository is ready for harnesses, its own and a person's, and everything that waits for a person. The bare command prints it in a project. Exits `0`. |
56
+ | `harnesspm doctor` | The same report. Exits `1` when a check fails; what waits for a person does not fail. |
27
57
  | `harnesspm why <ID>` | Owner, source, repository and whether the unit is editable ([08-improving.md](08-improving.md#81-find-the-source)). Works for every unit ID ([2.8](02-package-format.md#28-unit-ids)), also for a unit of a project entry that does not apply here ([8.1](08-improving.md#81-find-the-source)). For a script, also the command that runs it; for a script, hook, MCP server or sub-agent of a dependency, whether its package is trusted. |
28
- | `harnesspm approve [<package>]` | Writes the entries that a model run left pending, and records a `"pin"` package's new version as approved in the lock. A person runs it, not an agent. |
58
+ | `harnesspm approve [<package>]` | The person's step. Writes the entries that a model run held back, and the tools of a package that a person just added to `trust`, then records a `"pin"` package's new version as approved in the lock. It syncs as a person's `sync` does. A person runs it, not an agent. |
29
59
  | `harnesspm run [--agent <agent>] <plugin>:<script> [-- args]` | Runs a script ([05-executables.md](05-executables.md#51-scripts)) in the caller's folder. Hooks pass `--agent`, which sets `HARNESSPM_AGENT`. Without an install, it runs the script from the [fetched packages](01-overview.md#15-terms). When there are none, it says so and names `fetch` and the install, not `No script`. |
30
60
  | `harnesspm fetch` | Downloads only the harness packages in the lock, without a full install, and checks their integrity ([04-outputs.md](04-outputs.md#42-stable-package-paths)). Writes their docs copies, which search tools find ([4.3](04-outputs.md#43-project-outputs), note 8). For review bots and CI jobs that do not install dependencies, and for a clone that an agent uses without installing it. |
31
- | `harnesspm help` | Every command. Inside a project, or with `-C`, also the project's packages, one line each ([below](#the-project-in-help)). |
61
+ | `harnesspm help` | Inside a project, or with `-C`, the project's packages, one line each ([below](#the-project-in-help)), and a pointer to `--help`. Elsewhere, every command, as `--help` prints. |
32
62
  | `harnesspm help <package \| rule ID \| tool>` | A package's rules, docs, tools, MCP servers, skills and hooks in full, one rule, or a tool's usage and run command ([below](#help-for-a-package-a-rule-or-a-tool)). Needs no install. |
33
63
 
34
64
  ### `-C <dir>`
@@ -47,13 +77,16 @@ npx -y @harnesspm/cli -C work/app run uikit:colors surface
47
77
 
48
78
  ### The project in `help`
49
79
 
50
- Inside a project, or with `-C`, `help` ends with a "This project" section. It gives each package of the dependency and project layers one line, across all workspaces: what it covers (its `description` in `plugin.json`, else the titles of its always-on rules), how many rules, tools, MCP servers, skills and hooks it has, and the `help <package>` command that prints the rest.
80
+ Inside a project, or with `-C`, `help` prints a "This project" section. It gives each package of the dependency and project layers one line, across all workspaces: what it covers (its `description` in `plugin.json`, else the titles of its always-on rules), how many rules, tools, MCP servers, skills and hooks it has, and the `help <package>` command that prints the rest.
51
81
 
52
82
  ```text
53
83
  This project: app (work/app)
54
84
  Paths start at the current folder. The tools run here too, with -C.
55
85
 
56
86
  - @acme/ui โ€” Acme UI. 1 rule, docs, 1 tool, 1 skill: `npx -y @harnesspm/cli -C work/app help @acme/ui`
87
+
88
+ A tool's options: `npx -y @harnesspm/cli -C work/app help <tool>`. Run a tool: `npx -y @harnesspm/cli -C work/app run <tool> [args]`.
89
+ Every command: `npx -y @harnesspm/cli --help`.
57
90
  ```
58
91
 
59
92
  ### Help for a package, a rule or a tool
@@ -62,9 +95,9 @@ Paths start at the current folder. The tools run here too, with -C.
62
95
 
63
96
  | Target | What `help` prints |
64
97
  | --- | --- |
65
- | A package, by its npm name or plugin name | Everything it contributes, with the project's `patch`, `replace` and `exclude` applied, and nothing left out: each rule in full, with how it becomes active and who changed it; its docs index; its tools, each with its description, its `usage` and the exact `run` command; its MCP servers; its skills, with the path of each `SKILL.md`; the hooks it registers. When the package is not trusted, the tools, MCP servers and hooks carry a line that says so. |
98
+ | A package, by its npm name or plugin name | Everything it contributes, with the project's `patch`, `replace` and `exclude` applied, and nothing left out: each rule in full, with how it becomes active and who changed it; its docs index; its tools, each with its description, its `usage`, the exact `run` command and `no prompt` when it asks to run without one (`allow`, [5.4](05-executables.md#54-permissions)); its MCP servers; its skills, with the path of each `SKILL.md`; the hooks it registers. When the package is not trusted, the tools, MCP servers and hooks carry a line that says so. |
66
99
  | A rule ID, such as `acme-ui:rules/usage` | That rule in full. |
67
- | A tool, as `<plugin>:<script>` or by its ID | Its description, its `usage` ([5.1](05-executables.md#51-scripts)), its `answers` and the exact `run` command. Without a `usage`, it says that none is declared. With `answers`, an `Exit:` line says that those codes are answers, such as "found problems", not a broken tool. The tool line in `help <package>` and the managed block stays one line and leaves them out. It never runs the script, so it works without an install. |
100
+ | A tool, as `<plugin>:<script>` or by its ID | Its description, its `usage` ([5.1](05-executables.md#51-scripts)), whether it runs without a prompt, its `answers` and the exact `run` command. Without a `usage`, it says that none is declared. With `answers`, an `Exit:` line says that those codes are answers, such as "found problems", not a broken tool. The tool line in `help <package>` and the managed block stays one line and leaves them out. It never runs the script, so it works without an install. |
68
101
 
69
102
  For every target:
70
103
 
@@ -94,16 +127,6 @@ The `node -e` part resolves `@harnesspm/cli/package.json` from the project folde
94
127
 
95
128
  `harnesspm mcp [--agent <agent>] <plugin>:<server>` also exists. Agents call it to start stdio MCP servers. `harnesspm track --agent <agent>` is the command of harnesspm's own telemetry hooks ([14.4](14-telemetry.md#144-agent-events)). People do not need either.
96
129
 
97
- ```text
98
- $ npx -y @harnesspm/cli status
99
- ๐Ÿ“ฆ dependencies @cube-dev/ui-kit 0.206.1 โ†’ @tenphi/tasty 3.17.1, @tenphi/glaze 2.0.0
100
- ๐Ÿข project harnesspm.json: 1 replace ยท 1 patch
101
- โž• added github:cube-js/frontend-harness (user) ยท github:alex/harness (user), project entry cube-ui-kit
102
- โณ pending some-third-party: 1 hook (not trusted)
103
- ๐Ÿ“ always-on Codex 18.4 KiB of 32 KiB ยท Claude Code 212 lines
104
- ๐Ÿ“ก telemetry run, mcp, sync, why, read, skill, session โ†’ file .harnesspm/events.jsonl
105
- ```
106
-
107
130
  ### Moving from `@tenphi/harnesspm`
108
131
 
109
132
  Up to version 0.16, the package was `@tenphi/harnesspm`. From 0.17 it is `@harnesspm/cli`, with the same command, `harnesspm`, and the same versions, so a project moves with one install:
@@ -157,31 +180,36 @@ npx -y @harnesspm/cli update
157
180
  | `1` | Error: invalid harness, failed check. |
158
181
  | `2` | `harnesspm run` refused a script ([05-executables.md](05-executables.md#51-scripts)). When a hook calls it, `2` also blocks the event: harnesspm fails closed. |
159
182
 
160
- ## 10.5 Doctor
183
+ ## 10.5 The report
184
+
185
+ `npx -y @harnesspm/cli status`, `doctor` and the bare command in a project print one report. It answers three questions: what the project gives its agents, whether a person can work here with harnesses, the repository's and their own, without per-machine files reaching a commit, and what waits for a person.
161
186
 
162
- `npx -y @harnesspm/cli doctor` answers one question: can a person work here with harnesses, the repository's and their own, without per-machine files reaching a commit?
187
+ It opens with one line each for the dependencies, the project's changes, the units that added harnesses change (`โœ๏ธ changed here`), the always-on size per agent, and telemetry when the project configures it: on, held or off on this machine. The checks follow:
163
188
 
164
189
  | Group | Check | Fails when |
165
190
  | --- | --- | --- |
166
191
  | ๐Ÿ”’ Local files | Every per-machine file on disk is ignored by git and not tracked. The files are the ones harnesspm lists in `.git/info/exclude`, plus `harnesspm.local.json`, `CLAUDE.local.md`, `.claude/settings.local.json` and a telemetry file. Git answers, so `.gitignore`, `.git/info/exclude` and a global excludes file all count. | A file is tracked (fix: `git rm --cached`), or not ignored (fix: `sync` for a file harnesspm writes, otherwise a `.gitignore` entry). When a `!` pattern brings a file back, it names the pattern and its file. Outside a git repository it only warns. |
167
192
  | โž• Harnesses of your own | The clone's exclude file can be written. Each added harness is on this machine. | The exclude file cannot be written, or an added harness is missing. |
168
- | ๐Ÿ“ฆ Outputs | Committed outputs are up to date, as `sync --check` checks. Per-machine links and generated files are in place. `AGENTS.md` fits in Codex's 32 KiB, and Codex reaches every managed block ([4.9](04-outputs.md#49-size-limits)). | A committed output or the lock is out of date. Four problems only warn: missing per-machine outputs, because `sync` writes them; an `AGENTS.md` over 32 KiB; a managed block that Codex never reads, or reads only in part; and an [install hook](#the-install-hook) in the old form, which fails an install without dev dependencies. |
169
- | ๐Ÿ›ก๏ธ Trust | Entries that wait for trust or for a person, with a held telemetry handler: the list that `sync` prints. | Never: these are warnings ([10.4](#104-exit-codes)). |
193
+ | ๐Ÿ“ Outputs | Committed outputs are up to date, as `sync --check` checks. Per-machine links and generated files are in place, with the entries that the default branch records ([6.2](06-trust.md#62-trusting-a-package), rule 4). `AGENTS.md` fits in Codex's 32 KiB, and Codex reaches every managed block ([4.9](04-outputs.md#49-size-limits)). | A committed output or the lock is out of date. These only warn: missing per-machine outputs and entries, because `sync` writes them; an `AGENTS.md` over or close to 32 KiB; a managed block that Codex never reads, or reads only in part, or that starts past line 30; and an [install hook](#the-install-hook) in the old form, which fails an install without dev dependencies. |
194
+ | โณ Waiting for a person | Packages that are not trusted, `"pin"` versions that are not approved, and entries that an agent's run held back, a held telemetry handler first: the list that `sync` prints. Each line names the person's step: trust, then `approve`; in a Claude Code cloud session, the line for the setup script ([9.1](09-cloud.md#91-the-repositorys-harness)). | Never: these are not problems ([10.4](#104-exit-codes)). |
170
195
 
171
196
  ```text
172
197
  $ npx -y @harnesspm/cli doctor
198
+ ๐Ÿ“ฆ dependencies @acme/ui 4.2.0 โ†’ @acme/colors 2.1.0, @acme/styles 3.4.1
199
+ ๐Ÿข project harnesspm.json: no changes
200
+ ๐Ÿ“ always-on Codex 1.7 KiB of 32 KiB ยท Claude Code 31 lines
173
201
  ๐Ÿ”’ Local files
174
202
  โŒ CLAUDE.local.md is tracked by git, so a commit can include this machine's files, and harnesspm writes no added harnesses into it. Run `git rm --cached CLAUDE.local.md` and commit.
175
203
  โž• Harnesses of your own
176
204
  โœ… .git/info/exclude can be written, so harnesspm keeps per-machine files out of git
177
205
  โœ… Added: alex (github:alex/harness, user)
178
- ๐Ÿ“ฆ Outputs
206
+ ๐Ÿ“ Outputs
179
207
  โœ… Committed outputs are up to date
180
- โœ… 14 per-machine outputs in place
181
- ๐Ÿ›ก๏ธ Trust
182
- โœ… Nothing waits for trust
208
+ โœ… 40 per-machine outputs in place
209
+ โณ Waiting for a person
210
+ - @acme/styles: 1 script, 1 hook (not trusted). A person adds "@acme/styles": true to "trust" in harnesspm.json, then runs `npx -y @harnesspm/cli approve`.
183
211
 
184
212
  โŒ 1 problem. Each line above says how to fix it.
185
213
  ```
186
214
 
187
- `doctor` never edits `.gitignore`, never untracks a file and never writes outputs. `sync` writes, and the person decides the rest.
215
+ `status` exits `0`. `doctor` exits `1` when a check fails, so a job can gate on it. The report never edits `.gitignore`, never untracks a file and never writes outputs. `sync` writes, and the person decides the rest.
@@ -8,5 +8,5 @@ paths: ["/harnesspm.json", "/harnesspm.local.json", "/harness/**"]
8
8
  - `harnesspm.json` and `harness/` belong to the team and are committed. `harnesspm.local.json` lists harnesses added for this repository only, and a person's telemetry opt-out. It is never committed.
9
9
  - To change a few sections of an upstream rule, create a patch with `npx -y @harnesspm/cli new patch <rule ID>`, keep only the sections you change, and edit them. To change a whole rule, or a whole skill with a folder of your own, use `replace`. To drop a unit, use `exclude`. Do not copy the whole upstream harness.
10
10
  - Executable units (scripts, hooks, MCP servers, allow permissions) run only for trusted packages. Do not add a package to `trust` without the user's agreement.
11
- - `telemetry` sends events about harness use to the team's handler. Change it only when the user asks. A handler you add or change waits until the user runs `npx -y @harnesspm/cli sync` in their own terminal.
11
+ - `telemetry` sends events about harness use to the team's handler. Change it only when the user asks. A handler you add or change waits until the user runs `npx -y @harnesspm/cli approve` in their own terminal.
12
12
  - After a change, run `npx -y @harnesspm/cli sync`, and `npx -y @harnesspm/cli check <folder>` for a changed harness folder. Fix every reported problem.
@@ -39,5 +39,5 @@ Keep always-on rules short. One topic per file, split into small `##` sections,
39
39
  1. If `package.json` has a `files` field, make sure it lists `harness` and the docs folder, if used.
40
40
  2. Run `npx -y @harnesspm/cli check`. Fix every problem.
41
41
  3. Add `"prepack": "harnesspm check"` to the `package.json` scripts.
42
- 4. Add a short note to the README: the package ships a harness for coding agents, and a project gets it with `npm i -D @harnesspm/cli` and `npx -y @harnesspm/cli init`. A project that does not use harnesspm gets nothing by itself.
42
+ 4. Add a short note to the README: the package ships a harness for coding agents, and a project gets it with `npx -y @harnesspm/cli init`. A project that does not use harnesspm gets nothing by itself.
43
43
  5. To see the harness as users' agents will, run `npx -y @harnesspm/cli init` in this repository. Its own harness then shows in its `AGENTS.md` block.