@harnesspm/cli 0.0.0-stage → 0.17.0

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +269 -0
  2. package/LICENSE +21 -0
  3. package/README.md +69 -2
  4. package/dist/added.d.ts +51 -0
  5. package/dist/added.js +192 -0
  6. package/dist/check.d.ts +14 -0
  7. package/dist/check.js +263 -0
  8. package/dist/cli.d.ts +2 -0
  9. package/dist/cli.js +218 -0
  10. package/dist/commands.d.ts +58 -0
  11. package/dist/commands.js +1299 -0
  12. package/dist/config.d.ts +15 -0
  13. package/dist/config.js +45 -0
  14. package/dist/deliver.d.ts +1 -0
  15. package/dist/deliver.js +31 -0
  16. package/dist/doctor.d.ts +18 -0
  17. package/dist/doctor.js +99 -0
  18. package/dist/exec-outputs.d.ts +75 -0
  19. package/dist/exec-outputs.js +425 -0
  20. package/dist/exec-units.d.ts +68 -0
  21. package/dist/exec-units.js +151 -0
  22. package/dist/fetch.d.ts +16 -0
  23. package/dist/fetch.js +145 -0
  24. package/dist/frontmatter.d.ts +16 -0
  25. package/dist/frontmatter.js +49 -0
  26. package/dist/homes.d.ts +7 -0
  27. package/dist/homes.js +21 -0
  28. package/dist/lock.d.ts +47 -0
  29. package/dist/lock.js +245 -0
  30. package/dist/manifest.d.ts +78 -0
  31. package/dist/manifest.js +169 -0
  32. package/dist/new.d.ts +33 -0
  33. package/dist/new.js +228 -0
  34. package/dist/outputs.d.ts +124 -0
  35. package/dist/outputs.js +875 -0
  36. package/dist/parent.d.ts +41 -0
  37. package/dist/parent.js +182 -0
  38. package/dist/render.d.ts +91 -0
  39. package/dist/render.js +221 -0
  40. package/dist/resolve.d.ts +132 -0
  41. package/dist/resolve.js +522 -0
  42. package/dist/reviewed.d.ts +15 -0
  43. package/dist/reviewed.js +41 -0
  44. package/dist/run.d.ts +18 -0
  45. package/dist/run.js +133 -0
  46. package/dist/sections.d.ts +32 -0
  47. package/dist/sections.js +121 -0
  48. package/dist/telemetry-api.d.ts +26 -0
  49. package/dist/telemetry-api.js +60 -0
  50. package/dist/telemetry.d.ts +119 -0
  51. package/dist/telemetry.js +401 -0
  52. package/dist/user-outputs.d.ts +30 -0
  53. package/dist/user-outputs.js +239 -0
  54. package/dist/util.d.ts +137 -0
  55. package/dist/util.js +370 -0
  56. package/dist/workspaces.d.ts +2 -0
  57. package/dist/workspaces.js +62 -0
  58. package/docs/spec/01-overview.md +149 -0
  59. package/docs/spec/02-package-format.md +252 -0
  60. package/docs/spec/03-resolution.md +108 -0
  61. package/docs/spec/04-outputs.md +194 -0
  62. package/docs/spec/05-executables.md +170 -0
  63. package/docs/spec/06-trust.md +88 -0
  64. package/docs/spec/07-added.md +109 -0
  65. package/docs/spec/08-improving.md +79 -0
  66. package/docs/spec/09-cloud.md +68 -0
  67. package/docs/spec/10-cli.md +187 -0
  68. package/docs/spec/11-standards.md +52 -0
  69. package/docs/spec/12-dogfooding.md +51 -0
  70. package/docs/spec/13-open-questions.md +97 -0
  71. package/docs/spec/14-telemetry.md +199 -0
  72. package/docs/spec/README.md +33 -0
  73. package/harness/dev.harnesspm/rules/generated-files.md +9 -0
  74. package/harness/dev.harnesspm/rules/harnesspm-config.md +12 -0
  75. package/harness/plugin.json +13 -0
  76. package/harness/skills/harnesspm-export/SKILL.md +43 -0
  77. package/harness/skills/harnesspm-import/SKILL.md +40 -0
  78. package/harness/skills/harnesspm-improve/SKILL.md +38 -0
  79. package/package.json +71 -4
  80. package/schema/harnesspm.schema.json +58 -0
@@ -0,0 +1,79 @@
1
+ # 8. Improving a harness
2
+
3
+ **In short**
4
+
5
+ - Every unit has an **owner**: a dependency, the project, or an added harness.
6
+ - `harnesspm why <ID>` tells the agent where the source is and whether it can edit it.
7
+ - The owner's own `AGENTS.md` and `CONTRIBUTING.md` decide how a change is saved. Without them, the default is a branch and a pull request.
8
+ - harnesspm finds sources and grants write access. It does not push or talk to git hosts. The agent does that with its own tools.
9
+
10
+ ## 8.1 Find the source
11
+
12
+ ```text
13
+ $ npx -y @harnesspm/cli why tasty:rules/state-maps
14
+ owner dependency @tenphi/tasty 3.17.1 (via @cube-dev/ui-kit)
15
+ source node_modules/.harnesspm/pkgs/@tenphi/tasty/harness/dev.harnesspm/rules/state-maps.md
16
+ repository https://github.com/tenphi/tasty
17
+ editable no. Add a `patch`, `replace` or `exclude` in harnesspm.json, or propose the change upstream.
18
+
19
+ $ npx -y @harnesspm/cli why alex:rules/workflow
20
+ owner added github:alex/harness (user scope)
21
+ source ~/.harnesspm/harnesses/alex/harness/dev.harnesspm/rules/workflow.md
22
+ rules ~/.harnesspm/harnesses/alex/AGENTS.md
23
+ editable yes
24
+ ```
25
+
26
+ An agent also sees the IDs of a project entry's units, in `CLAUDE.local.md` of the repository the entry is for. Where that entry does not apply, such as in another repository or in a folder above the clones, `why` still finds such a unit: it searches the entries of the harnesses added with user scope. The owner line then names the remotes the entry is for, such as `(user scope, entry for github.com/cube-js/cube-ui-kit)`.
27
+
28
+ ## 8.2 Three owners
29
+
30
+ | Owner | Where the source is | How the agent changes it |
31
+ | --- | --- | --- |
32
+ | 📦 Dependency | `node_modules`, read-only | Now: a `patch` for a small change, or a `replace` or `exclude`, in the project (for the team) or in an added harness (for its owner). Later: a proposal to the package's `repository`. |
33
+ | 🏢 Project | The project repository | Edit the file, like any other change in that repository. |
34
+ | ➕ Added harness | Its working copy or folder | Edit the file there. |
35
+
36
+ To create a new unit instead of changing one, use `npx -y @harnesspm/cli new <kind> <name>`: without a flag for the project harness, `--to <plugin>` for an added harness, and `--to <plugin> --entry` for its entry for this repository.
37
+
38
+ ## 8.3 The owner decides how to save
39
+
40
+ A harness is a repository, or lives in one. That repository's root `AGENTS.md` and `CONTRIBUTING.md` are its rules for changes. These are existing conventions, so harnesspm adds no setting for them.
41
+
42
+ Before changing a source, the agent reads those files in the source repository and follows them. They can say anything that fits the owner, for example:
43
+
44
+ - "Commit and push to `main`."
45
+ - "Open a merge request on our GitLab and assign me."
46
+ - "Leave the change uncommitted. I review it myself."
47
+
48
+ ## 8.4 Default when the owner says nothing
49
+
50
+ 1. Show the person the change and the reason, and ask before going on.
51
+ 2. Create a branch from the default branch, named `harnesspm/<topic>`.
52
+ 3. Commit with a message that says what changed and why.
53
+ 4. Push the branch and open a pull request or merge request with the tools the agent has, such as the GitHub CLI or an MCP server for the host.
54
+ 5. If a step is not possible, stop there and tell the person what is done and what is left: the branch, the commit, or the diff itself.
55
+
56
+ The agent never pushes to the default branch unless the owner's rules allow it.
57
+
58
+ For a dependency, the proposal goes to the package's `repository`, following that repository's rules. It is usually an issue or a pull request that the person reviews first.
59
+
60
+ ## 8.5 Access
61
+
62
+ | Owner | Write access |
63
+ | --- | --- |
64
+ | Dependency | Never. `node_modules` is not a source. |
65
+ | Project | As for any file in the project. |
66
+ | Added harness | harnesspm adds the working copy to the agent's writable folders: `permissions.additionalDirectories` for Claude Code, `sandbox_workspace_write.writable_roots` for Codex. |
67
+
68
+ ## 8.6 Checks before saving
69
+
70
+ 1. Run `npx -y @harnesspm/cli check <harness folder>`. It validates the harness and warns about files that look like secrets.
71
+ 2. Never copy private data from the current project into an added harness without the person's agreement.
72
+
73
+ ## 8.7 Shared working copies
74
+
75
+ Several projects and sessions on one machine use the same working copy of an added harness. `harnesspm update` never changes a working copy that has uncommitted changes or unpushed commits. It reports them instead.
76
+
77
+ ## 8.8 What harnesspm ships for this
78
+
79
+ harnesspm's own harness has the skill `harnesspm-improve`, which walks the agent through 8.1 to 8.6. See [12-dogfooding.md](12-dogfooding.md).
@@ -0,0 +1,68 @@
1
+ # 9. Cloud sessions
2
+
3
+ **In short**
4
+
5
+ - v1 supports **Claude Code cloud sessions**. Codex Cloud is not supported in v1 ([13.12](13-open-questions.md#1312-removed-in-review)); Codex on a person's computer is.
6
+ - A cloud session starts from a clean clone. Team outputs appear when the project's install runs `harnesspm sync`, as on a laptop. Run the install in the setup script, by absolute path ([9.1](#91-the-repositorys-harness)): when the agent runs it, new hooks, MCP servers and allow rules stay pending outside the reviewed state ([06-trust.md](06-trust.md#62-trusting-a-package), rule 4). In a cloud session, `sync`, `status` and `doctor` print that line when they hold entries back, instead of asking for a terminal.
7
+ - Added harnesses need one command in the container: in the setup script of the person's own environment, or asked of the agent. The hook that it installs fetches the harness's newest commits at the start of each session, so a cached snapshot never holds an old copy for long.
8
+ - Improving an added harness from the cloud needs push access to its repository. Without it, the agent shows the change in the session.
9
+
10
+ ## 9.1 The repository's harness
11
+
12
+ ```bash
13
+ cd /home/user/<repo> && npm ci
14
+ ```
15
+
16
+ - **By absolute path.** The setup script does not start in the clone, so a path relative to the repository is not found.
17
+ - **A failing script stops the environment.** When the setup script fails, no new session of the environment starts. Optional steps end with `|| true`. An environment that also serves other repositories skips them with `[ -d /home/user/<repo> ] || exit 0`.
18
+ - **A pinned package manager** (`packageManager` in `package.json`) needs `corepack enable` before the install. Default network access does not reach corepack's host for Yarn; `COREPACK_NPM_REGISTRY=https://registry.npmjs.org` does.
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
+ - **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
+
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.
23
+
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
+
26
+ When a cloud session holds entries back, `sync`, `status` and `doctor` print this line for the project: its absolute path, and the install that its lockfile asks for, with corepack when `packageManager` is set. Without a lockfile or `harnesspm.json`, they name "the install".
27
+
28
+ ## 9.2 Adding harnesses
29
+
30
+ ```bash
31
+ npx -y @harnesspm/cli add github:alex/harness
32
+ ```
33
+
34
+ | Way | How it works |
35
+ | --- | --- |
36
+ | **Setup script** of the person's own environment | ✅ Runs after the clone and before Claude Code starts, once per cached snapshot (about 7 days). Later sessions start from the snapshot, and the `SessionStart` hook fetches the harness's newest commits and refreshes the outputs in each one. |
37
+ | **Ask the agent** in a session | ✅ Rules and skills apply at once; Claude Code loads new skills live. Hooks and MCP servers stay pending, because an agent cannot grant itself permissions ([06-trust.md](06-trust.md#62-trusting-a-package)). Built-in tools need no allow rule there; MCP tools do ([05-executables.md](05-executables.md#55-what-the-agents-still-decide)). Tip: a small skill on claude.ai can hold the command, because claude.ai skills load in every cloud session. |
38
+
39
+ Add harnesses in your own environment: anyone who uses an environment can read its setup script and variables. A committed repository hook is not the place either, because it belongs to the team.
40
+
41
+ When the command runs inside a session, it prints the added always-on rules so the agent follows them at once. New sessions read them from the files.
42
+
43
+ In a setup script, `harnesspm add` adds the harness with user scope and installs the `SessionStart` hook ([07-added.md](07-added.md#75-applying-in-every-repository)). The hook fetches the harness, applies project entries and writes per-machine outputs in every session, so the setup script does not depend on the repository. A private source that the session cannot reach is not fetched: the hook warns, and the session starts with the snapshot's copy.
44
+
45
+ A `~/.claude/settings.json` written by the setup script is read in cloud sessions: its `env` values and deny rules apply. Deny rules are the way to restrict a cloud session.
46
+
47
+ ## 9.3 Private sources
48
+
49
+ | Source | How to reach it |
50
+ | --- | --- |
51
+ | Public git repository or npm package | Works |
52
+ | Private git repository | Add it under the environment's repositories, or attach it to the session. Setup scripts cannot read variables or secrets. |
53
+ | Private npm package | Inside a session only: a network secret for `registry.npmjs.org` |
54
+
55
+ Never write tokens into setup scripts or environment variables: anyone who uses the environment can read them.
56
+
57
+ ## 9.4 Improving from the cloud
58
+
59
+ The flow is the one in [08-improving.md](08-improving.md). Pushing needs the added harness's repository attached to the session with push access.
60
+
61
+ A cloud container is discarded later. When the agent cannot push, it shows the full change in the session, so the person can apply it elsewhere.
62
+
63
+ ## 9.5 What real sessions confirmed
64
+
65
+ In November 2026 Claude Code cloud sessions confirmed both paths. Details are in [research/agent-capabilities.md](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#cloud-sessions). They are to be checked again ([13.11](13-open-questions.md#1311-agent-behavior-not-confirmed-yet)).
66
+
67
+ - **Added harnesses**, in a probe: every output they use. User-level rules, skills and settings written by a setup script, `CLAUDE.local.md` and `.claude/settings.local.json` written by a `SessionStart` hook, hooks, MCP servers from the cached snapshot, and skills added during a session.
68
+ - **The repository's harness**, in a rollout in a large Yarn 4 monorepo. The setup script's install wrote the hooks and held nothing back, and a package's edit hook ran in the first session. A setup script named by a relative path failed, and no new session started.
@@ -0,0 +1,187 @@
1
+ # 10. CLI
2
+
3
+ **In short**
4
+
5
+ - Projects use `init`, `sync`, `status`, `doctor`, `why`, `approve` and `run`. Jobs that do not install dependencies use `fetch`.
6
+ - 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
+ - `help <tool>` prints a tool's usage, its answer exit codes and its run command, without running it.
8
+ - Authors use `check` and `new`.
9
+ - People use `add`, `remove` and `update` for harnesses on top of the repository's.
10
+ - Saving changes to a harness is not a harnesspm command. The owner's rules decide it ([08-improving.md](08-improving.md)).
11
+ - The npm package is `@harnesspm/cli`. Up to 0.16 it was `@tenphi/harnesspm`, which harnesspm still recognizes until 1.0 ([below](#moving-from-tenphiharnesspm)).
12
+
13
+ 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
+ `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
+
17
+ ## 10.1 Projects
18
+
19
+ | Command | What it does |
20
+ | --- | --- |
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)). |
23
+ | `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
+ | `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). |
27
+ | `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. |
29
+ | `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
+ | `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)). |
32
+ | `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
+
34
+ ### `-C <dir>`
35
+
36
+ `-C <dir>` goes before the command, as in `git -C`: harnesspm acts as if it started in `<dir>`. It works with every command, such as `help`, `fetch`, `run`, `mcp`, `why`, `status` and `doctor`.
37
+
38
+ ```bash
39
+ npx -y @harnesspm/cli -C work/app help
40
+ npx -y @harnesspm/cli -C work/app run uikit:colors surface
41
+ ```
42
+
43
+ - `run` keeps the caller's folder for the script, so file arguments stay valid. `HARNESSPM_PROJECT_DIR` is the named project. A hook (`run --agent`) from outside the project runs in the project, and not for a file outside it ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)).
44
+ - The `run` event goes to the named project's telemetry handler. Its `run`, `help` and `why` events carry `outside: true` when the caller's folder is outside the project ([14.2](14-telemetry.md#142-events)).
45
+ - Hooks and allow rules of the named project do not apply: the agent reads them only from the folder its session starts in ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#outside-the-start-folder)). A `sync` in that folder writes the project's hooks there ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)).
46
+ - harnesspm runs as the version npx started. It does not hand off to the named project's installed copy.
47
+
48
+ ### The project in `help`
49
+
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.
51
+
52
+ ```text
53
+ This project: app (work/app)
54
+ Paths start at the current folder. The tools run here too, with -C.
55
+
56
+ - @acme/ui — Acme UI. 1 rule, docs, 1 tool, 1 skill: `npx -y @harnesspm/cli -C work/app help @acme/ui`
57
+ ```
58
+
59
+ ### Help for a package, a rule or a tool
60
+
61
+ `help <target>` prints one part of the project's harness. A command name, such as `help sync`, still prints that command's help.
62
+
63
+ | Target | What `help` prints |
64
+ | --- | --- |
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. |
66
+ | 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. |
68
+
69
+ For every target:
70
+
71
+ - Commands carry `-C <dir>` when `help` was given one, and paths start at the caller's folder, as in the project section.
72
+ - In a workspace, `help` and `why` use the rule text resolved for that workspace. At the repository root, they use the root's version when it has one and label differing workspace versions for a rule the root does not use.
73
+ - `help` needs no install: it reads the lock and the fetched packages. When the project has neither an install nor fetched packages, `help` fetches first, which only downloads and checks integrity.
74
+ - Each run sends a `help` event to the project's handler ([14.2](14-telemetry.md#142-events)), so a team can see whether agents follow the block's pointers.
75
+
76
+ Package managers run these scripts on a full install, but not on `npm install <pkg>`, `npm uninstall` or `pnpm add`, so run `npx -y @harnesspm/cli sync` after those. `sync --check` in CI catches a missed one. `postinstall` would also run when others install a published package, so `init` uses it only in a private package; Yarn 2 and later run `postinstall` but not `prepare` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/package-managers.md)).
77
+
78
+ ### The install hook
79
+
80
+ `init` adds this command, after any script that is already there:
81
+
82
+ ```shell
83
+ node -e "try{require.resolve('@harnesspm/cli/package.json');process.exit(1)}catch{}" || harnesspm sync
84
+ ```
85
+
86
+ 1. harnesspm is a dev dependency. An install without dev dependencies, such as `npm ci --omit=dev`, `pnpm install --prod` or `yarn install --production`, still runs the project's own scripts, but has no `harnesspm` command. The `node -e` part ends with success exactly then, so `||` skips the sync and the install goes on.
87
+ 2. When harnesspm is installed, the `node -e` part fails, so the sync runs. A failing sync MUST still fail the install.
88
+ 3. After an existing script, the hook goes in parentheses: `patch-package && (… || harnesspm sync)`. Without them, a failure of `patch-package` would run the sync, and the sync's success would hide it.
89
+ 4. `node -e`, `||` and parentheses work in sh, Windows cmd and Yarn's own shell. `|| true` would not: cmd has no `true` command.
90
+ 5. Older versions of `init` wrote the hook as plain `harnesspm sync`, which fails such an install. `init` replaces that form, alone or after ` && `, and `doctor` warns about it. A script that runs `harnesspm sync` in any other form stays as it is.
91
+ 6. The `node -e` part names the package that the project lists. A project that still lists `@tenphi/harnesspm` gets a hook for that name. A hook for a name the project no longer lists would skip every sync, so `init` replaces it with the hook for the listed name, and `doctor` warns about it.
92
+
93
+ The `node -e` part resolves `@harnesspm/cli/package.json` from the project folder. So the package's `exports` field MUST export `./package.json`. It does, next to `./telemetry` ([14.9](14-telemetry.md#149-events-from-a-projects-own-tools)).
94
+
95
+ `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
+
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
+ ### Moving from `@tenphi/harnesspm`
108
+
109
+ 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:
110
+
111
+ ```shell
112
+ npm i -D @harnesspm/cli && npm rm @tenphi/harnesspm
113
+ npx -y @harnesspm/cli init
114
+ ```
115
+
116
+ A machine with an added harness ([07-added.md](07-added.md)) runs one command once, because its user-level hook still runs the earlier package:
117
+
118
+ ```shell
119
+ npx -y @harnesspm/cli update
120
+ ```
121
+
122
+ `init` updates the install hook; the next `sync` rewrites the rest. Until then, and until harnesspm 1.0, harnesspm treats the earlier name as its own:
123
+
124
+ | Where the earlier name is | What harnesspm does |
125
+ |---|---|
126
+ | The installed CLI file, `node_modules/@tenphi/harnesspm/dist/cli.js` | Hooks and MCP servers start it when `@harnesspm/cli` is not installed ([5.2](05-executables.md#52-hooks)). |
127
+ | Hook commands and allow rules with `npx -y @tenphi/harnesspm` or that file | They grant the same as the current form. So `sync` replaces them even in a run of the agent's model, and nothing is held back ([6.2](06-trust.md#62-trusting-a-package), rule 4). |
128
+ | The user-level `SessionStart` hook, `npx -y @tenphi/harnesspm update` or `sync` | It runs the earlier package, whose versions cannot rewrite it. A person runs `npx -y @harnesspm/cli update` once on each machine with an added harness; that run replaces it with `npx -y @harnesspm/cli update` ([7.5](07-added.md#75-applying-in-every-repository)). A later sync of the new version by a person, a setup script or a hook does the same. |
129
+ | The project's `package.json` | `init` and the `harnesspm` command accept either name. `doctor` warns that the package moved and names the two commands above. |
130
+ | The install hook | See [the install hook](#the-install-hook), point 6. |
131
+ | Both packages installed | They ship the same harness, so `@harnesspm/cli` gives it and the other is left out, with no plugin name clash. |
132
+ | `$schema` in `harnesspm.json` | The earlier URL keeps working, because the registry keeps the earlier package. `doctor` names the current one. |
133
+
134
+ `@tenphi/harnesspm` is deprecated on npm, with a message that names the new package and both commands above. No release of the new code goes out under the earlier name. Its versions stay installable. harnesspm 1.0 drops the earlier name: the list `OLD_PACKAGE_NAMES` in `src/util.ts` holds it.
135
+
136
+ ## 10.2 Authors
137
+
138
+ | Command | What it does |
139
+ | --- | --- |
140
+ | `harnesspm check [<folder>]` | Validates a harness and its project entries ([02-package-format.md](02-package-format.md#210-validation)) and warns about files that look like secrets. Prints the always-on size of the harness and of each entry. Run it at `prepack`. |
141
+ | `harnesspm new <kind> <name> [--to <plugin>] [--entry]` | `<kind>` is `rule`, `skill`, `agent` (a sub-agent), `script`, `hook` or `mcp`. Writes a valid unit from a template, and creates `harness/plugin.json` when the project has none. A skill's name gets the plugin name in front. `--to <plugin>` writes it into an added harness, `--to <plugin> --entry` into its entry for this repository, which holds rules, skills, sub-agents and docs. |
142
+ | `harnesspm new patch <rule ID> [--to <plugin>] [--entry]` | Writes a patch with a copy of the rule's sections, or of the whole rule when it has none, and registers it: in `harness/plugin.json` (file in `harness/dev.harnesspm/patches/`) when the rule reaches the project through its own harness's `extends`, so users get the change too; otherwise in `harnesspm.json` (file in `harnesspm/patches/`); with `--to <plugin>`, in that added harness. Edit the sections to change and delete the others. |
143
+
144
+ ## 10.3 People
145
+
146
+ | Command | What it does |
147
+ | --- | --- |
148
+ | `harnesspm add <source> [--local] [--no-hook]` | Adds a harness on top of the repository's: with user scope, or with `--local` for this repository only. Installs the `SessionStart` hook ([07-added.md](07-added.md#75-applying-in-every-repository)) and prints the added always-on rules. |
149
+ | `harnesspm remove <source> [--local]` | Removes it and its outputs. With the last harness with user scope, the hook and write access go too. |
150
+ | `harnesspm update` | Fetches new versions of added harnesses and rewrites their outputs. Prints what changed for each, such as `updated a1b2c3d → e4f5a6b`. Skips working copies with uncommitted changes or unpushed commits and lists them. The `SessionStart` hook runs it ([7.5](07-added.md#75-applying-in-every-repository)): without a person at a terminal, git never prompts, a fetch stops after 30 seconds, and one that fails is a warning, not an error. |
151
+
152
+ ## 10.4 Exit codes
153
+
154
+ | Code | Meaning |
155
+ | --- | --- |
156
+ | `0` | Success. Pending trust is not an error. |
157
+ | `1` | Error: invalid harness, failed check. |
158
+ | `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
+
160
+ ## 10.5 Doctor
161
+
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?
163
+
164
+ | Group | Check | Fails when |
165
+ | --- | --- | --- |
166
+ | 🔒 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
+ | ➕ 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)). |
170
+
171
+ ```text
172
+ $ npx -y @harnesspm/cli doctor
173
+ 🔒 Local files
174
+ ❌ 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
+ ➕ Harnesses of your own
176
+ ✅ .git/info/exclude can be written, so harnesspm keeps per-machine files out of git
177
+ ✅ Added: alex (github:alex/harness, user)
178
+ 📦 Outputs
179
+ ✅ Committed outputs are up to date
180
+ ✅ 14 per-machine outputs in place
181
+ 🛡️ Trust
182
+ ✅ Nothing waits for trust
183
+
184
+ ❌ 1 problem. Each line above says how to fix it.
185
+ ```
186
+
187
+ `doctor` never edits `.gitignore`, never untracks a file and never writes outputs. `sync` writes, and the person decides the rest.
@@ -0,0 +1,52 @@
1
+ # 11. Standards
2
+
3
+ **In short**
4
+
5
+ - The package format is **Agent Plugins 1.0**. Skills are **Agent Skills**. The main output is **AGENTS.md**. MCP servers use the Agent Plugins `mcp.json`.
6
+ - harnesspm adds only what no standard covers yet: `extends`, trust, rules, hooks, scripts, overrides and added harnesses.
7
+ - harnesspm should propose its additions upstream once they are proven.
8
+
9
+ ## 11.1 Standards harnesspm uses
10
+
11
+ | Standard | Steward | Status (Nov 2026) | How harnesspm uses it |
12
+ | --- | --- | --- | --- |
13
+ | [Agent Plugins](https://agent-plugins.org/) | Vendor-neutral steering committee (Amazon, Cursor, Microsoft, OpenAI, Vercel) | 1.0.0 published; 1.1.0 working draft | **The package format.** `harness/` is a plugin: `plugin.json`, `skills/`, `mcp.json`, `${PLUGIN_ROOT}` and `${PLUGIN_DATA}`. harnesspm data lives in the client-extension namespace, as §8 of the standard requires. |
14
+ | [Agent Skills](https://agentskills.io/specification) | Agentic AI Foundation (Linux Foundation) | Published; contributed to the foundation in Oct 2026 | **Skills.** `SKILL.md` with `name` and `description`. harnesspm never renames a skill, because `name` must match the folder name. |
15
+ | [AGENTS.md](https://agents.md/) | Agentic AI Foundation | Widely adopted | **The main instructions output** for every agent that reads it. harnesspm writes a marked block in it. A harness repository's own `AGENTS.md` is also where its owner says how changes are saved. |
16
+ | `CONTRIBUTING.md` | Community convention, recognized by GitHub and GitLab | Widely used | **How to propose changes** to a harness repository, read together with its `AGENTS.md` ([08-improving.md](08-improving.md#83-the-owner-decides-how-to-save)). |
17
+ | [Model Context Protocol](https://modelcontextprotocol.io/) | Agentic AI Foundation | Published | **MCP servers.** harnesspm does not touch the protocol. It configures servers through the Agent Plugins `mcp.json` format. |
18
+ | [llms.txt](https://llmstxt.org/) | Community convention | Widely used | **Docs index.** A package's `llms.txt` is its docs index. |
19
+ | [JSON Lines](https://jsonlines.org/) | Community convention | Widely used | **Telemetry file handler.** One event per line ([14.1](14-telemetry.md#141-turning-it-on)). |
20
+ | [Console Do Not Track](https://consoledonottrack.com/) | Community convention | Used by many command-line tools | **Opting out of telemetry.** `DO_NOT_TRACK=1` stops every event ([14.6](14-telemetry.md#146-opting-out)). |
21
+ | [Semantic Versioning](https://semver.org/), [SPDX](https://spdx.org/licenses/), [JSON Schema](https://json-schema.org/) | — | Stable | Versions, licenses and the schemas for `harnesspm.json` and the harnesspm extension. |
22
+
23
+ ## 11.2 What no standard covers yet
24
+
25
+ | Need | Standard today | What harnesspm does |
26
+ | --- | --- | --- |
27
+ | Dependencies between plugins | Agent Plugins lists "dependency resolution" as a future consideration | `extends`, resolved through npm |
28
+ | Trust, permissions, approvals | Agent Plugins lists "permission and approval UX" as a future consideration | `trust`, hash locks, allow rules only for a package's own scripts |
29
+ | Always-on and file-scoped rules | None. Each agent has its own format | Markdown rules with `paths` and `description` frontmatter |
30
+ | Hooks | Agent Plugins [PR #89](https://github.com/agentplugins/agent-plugins-spec/pull/89) proposes portable hooks for 1.1. It is open, and one reviewer objects to putting hook execution in the core spec | Hooks in the shape Claude Code and Codex share |
31
+ | Sub-agents | None. Claude Code uses Markdown files, Codex uses TOML files | One Markdown file with portable `name`, `description` and body, plus per-agent keys, converted for each agent |
32
+ | Scripts for agents | Agent Skills allows `scripts/` inside a skill, with no runner or permission model | Named scripts, one runner, generated permissions |
33
+ | Overrides across packages | None | `exclude` and `replace` by unit ID, and `patch` by Markdown section |
34
+ | Harnesses added on top of a repository | None | Added harnesses with two scopes, improved under their owner's rules |
35
+ | Events about how agents use a harness | None. [OpenTelemetry](https://opentelemetry.io/) defines how to send telemetry, not what a harness event is | Small JSON events sent to the project's own handler, which can forward them to OpenTelemetry ([14](14-telemetry.md)) |
36
+
37
+ ## 11.3 Proposing upstream
38
+
39
+ harnesspm is a working example of what Agent Plugins lists as future work. Once harnesspm has real users, the project SHOULD propose:
40
+
41
+ 1. a `dependencies` (or `extends`) field, based on [03-resolution.md](03-resolution.md);
42
+ 2. a trust and approval model, based on [06-trust.md](06-trust.md);
43
+ 3. feedback on the hooks proposal, based on running the same hooks in two agents.
44
+
45
+ ## 11.4 Watch list
46
+
47
+ | Item | Why it matters | Action when it changes |
48
+ | --- | --- | --- |
49
+ | Agent Plugins 1.1 | May add hooks and other fields | Read the new files. Keep the harnesspm format working during a migration period. |
50
+ | Claude Code and Codex reading Agent Plugins directly | harnesspm could then write plugins instead of native files for some units | Re-check [04-outputs.md](04-outputs.md#48-why-native-files-and-not-plugins). |
51
+ | A standard for rules | Would replace the harnesspm rule format | Map frontmatter, keep IDs. |
52
+ | pnpm and the `skills` CLI linking skills from `node_modules` | Overlaps with harnesspm's skill outputs | Avoid double links. harnesspm reads `harness/skills/`, which they do not. |
@@ -0,0 +1,51 @@
1
+ # 12. Dogfooding
2
+
3
+ **In short**
4
+
5
+ - This repository consumes its own harness and publishes it with the npm package.
6
+ - Every project that installs harnesspm gets three skills that match the three flows: `harnesspm-export`, `harnesspm-import` and `harnesspm-improve`.
7
+ - A format change in the spec MUST update these files in the same change.
8
+
9
+ ## 12.1 What this repository has
10
+
11
+ | File | Role |
12
+ | --- | --- |
13
+ | [`AGENTS.md`](https://github.com/tenphi/harnesspm/blob/main/AGENTS.md) | How to work on this repository, including how to save changes. The harnesspm block that `npm run sync` writes comes right after the title, where agents that read only the top of the file see it. |
14
+ | [`CLAUDE.md`](https://github.com/tenphi/harnesspm/blob/main/CLAUDE.md) | Imports `AGENTS.md` for Claude Code. |
15
+ | [`harnesspm.json`](https://github.com/tenphi/harnesspm/blob/main/harnesspm.json) | This repository's project configuration. |
16
+ | [`harness/`](https://github.com/tenphi/harnesspm/tree/main/harness) | The harness that ships to everyone who installs `@harnesspm/cli`. Part of the project layer here, the dependency layer for users. |
17
+
18
+ harnesspm runs on these files: `npm run sync` writes the block and `harnesspm.lock.json`, and `npm run check` validates them. A change to the format MUST keep them working, or change them and this chapter together.
19
+
20
+ ## 12.2 What harnesspm's harness gives its users
21
+
22
+ | Unit | Kind | Purpose |
23
+ | --- | --- | --- |
24
+ | `harnesspm:rules/generated-files` | Always-on rule | Outputs are generated. To change one, find its source with `harnesspm why`. |
25
+ | `harnesspm:rules/harnesspm-config` | File-scoped rule | How to change `harnesspm.json`, `harnesspm.local.json` and harness files safely. |
26
+ | `harnesspm-export` | Skill | Share a harness from a package: units, IDs, `extends`, checks, publishing. |
27
+ | `harnesspm-import` | Skill | Set up harnesspm in a project, trust packages, add a harness on top. |
28
+ | `harnesspm-improve` | Skill | Change any harness: find the owner, edit the source, save under the owner's rules. |
29
+ | Docs index | Docs | This specification, at the installed version. |
30
+
31
+ It is also a small reference example for package authors.
32
+
33
+ ## 12.3 Publishing
34
+
35
+ ```json
36
+ {
37
+ "name": "@harnesspm/cli",
38
+ "files": ["dist", "schema", "harness", "docs/spec", "CHANGELOG.md"],
39
+ "scripts": { "prepack": "npm run build && node dist/cli.js check" }
40
+ }
41
+ ```
42
+
43
+ `prepack` builds the CLI and runs its `check` against the package itself, so a broken harness cannot be published.
44
+
45
+ ## 12.4 Checks
46
+
47
+ | Check | When |
48
+ | --- | --- |
49
+ | `harnesspm check` | Every pull request and `prepack` |
50
+ | `harnesspm sync --check` | Every pull request |
51
+ | `harnesspm sync` on fixture projects, checked for Claude Code and Codex outputs | Every pull request |
@@ -0,0 +1,97 @@
1
+ # 13. Open questions
2
+
3
+ **In short**
4
+
5
+ - 13.1 to 13.8 are **decided**. They stay here as a record of why. A cloud probe settled 13.8.
6
+ - 13.9 to 13.11 are **open**. Each names the test or signal that settles it.
7
+ - 13.12 lists options that were removed and may come back.
8
+
9
+ ## Decided
10
+
11
+ ### 13.1 Memory
12
+
13
+ "Memory" here means everything a person wants agents to know that should live outside a project's repository: how they work, context, how their projects relate. It is the content of a person's own added harness ([07-added.md](07-added.md#71-what-goes-in-it)). Agents keep it current by improving that harness ([08-improving.md](08-improving.md)).
14
+
15
+ Notes that Claude Code or Codex save by themselves (Claude Code auto memory, Codex memories) are part of each agent's own harness. harnesspm does not move or merge them.
16
+
17
+ ### 13.2 Partial edits of rules
18
+
19
+ **Decision:** rules can be patched by Markdown section ([02-package-format.md](02-package-format.md#25-rules)). A patch replaces, adds or removes sections and keeps the rest. Upgrades that change a patched section are reported.
20
+
21
+ Variables and slots were the other options. A patch covers the same cases, including "change a few words", when authors split rules into small sections. One mechanism is enough. Patches work on rules only. `replace` works on rules and skills, the units people adapt as text. Extend patches to skills if people start replacing whole skills to change one step.
22
+
23
+ ### 13.3 Extension namespace
24
+
25
+ **Decision:** `dev.harnesspm`. The namespace cannot change, because every published harness uses it as a folder name.
26
+
27
+ ### 13.4 Sub-agents for Codex
28
+
29
+ **Decision:** sub-agents are written for both agents. Codex reads custom agents from `.codex/agents/*.toml` and `~/.codex/agents/` ([research/agent-capabilities.md](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md)). The format is in [02-package-format.md](02-package-format.md#26-sub-agents).
30
+
31
+ ### 13.5 Plugin output mode
32
+
33
+ **Decision:** not in v1. Native files work in Claude Code cloud sessions, which do not install repository-declared plugins, and they show up in pull request review. Revisit if cloud sessions start installing such plugins, or as an option for local-only use. Codex Cloud may need one: see 13.12.
34
+
35
+
36
+ ### 13.6 CI without an install
37
+
38
+ **Decision:** `harnesspm fetch` downloads only the harness packages in the lock and fills `node_modules/.harnesspm/pkgs/` ([04-outputs.md](04-outputs.md#42-stable-package-paths)). The lock records each package's tarball URL and integrity for this, from `package-lock.json`, `pnpm-lock.yaml` or Yarn 1's `yarn.lock` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/package-managers.md#lockfiles)). Without a URL, `fetch` downloads `<name>@<version>` from the registry. Without integrity, as with Yarn 2 and later, it says for each package that the download is not checked. `run`, `mcp` and `help` use the fetched packages too, so an agent can use a clone's self-contained tools before the clone is installed ([10-cli.md](10-cli.md#-c-dir)).
39
+
40
+ ### 13.7 Team lock on rules (rejected)
41
+
42
+ A team cannot mark a rule as one a person cannot exclude. Nothing could enforce it on a person's machine, and `harnesspm status` already shows the changes that added harnesses make.
43
+
44
+ ### 13.8 Committed Claude Code settings (settled)
45
+
46
+ Not needed. A cloud probe in November 2026 showed that a `.claude/settings.local.json` written in the clone, also by a `SessionStart` hook, is read in the same session: its `env` applies and its hooks fire. Team hooks and permissions stay in that per-machine file.
47
+
48
+ ## Open
49
+
50
+ ### 13.9 Upgrade report
51
+
52
+ After an upgrade, the diff of the managed block and the lock shows what changed. **Signal:** reviewers find the raw diff hard to read. **Then:** add `harnesspm diff`.
53
+
54
+ ### 13.10 Structured project relations
55
+
56
+ A person's notes describe how repositories relate, such as "UI Kit builds on Tasty". v1 keeps them as plain notes. **Signal:** a real task needs harnesspm itself to act on relations, such as finding local clones of related repositories.
57
+
58
+ ### 13.11 Agent behavior not confirmed yet
59
+
60
+ Every ❓ in [research/agent-capabilities.md](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md) that v1 relies on must be tested, and the 🔍 rows behind [9.5](09-cloud.md#95-what-real-sessions-confirmed) checked again. The Codex Cloud rows are out of scope (13.12). Settled so far:
61
+
62
+ - Yarn 4 runs `postinstall` but not `prepare`, so `init` uses `postinstall` in a private package ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/package-managers.md)).
63
+ - Codex marks commands its model runs with `CODEX_CI=1` and `CODEX_TOOL_CALL_ID`, so rule 4 in [6.2](06-trust.md#62-trusting-a-package) covers Codex too.
64
+ - Codex reads `developer_instructions` from a trusted project's `.codex/config.toml`.
65
+ - A real agent improves a harness the intended way. A headless Claude Code run, asked to fix a dependency's rule for the team, used the `harnesspm-improve` skill, `why`, `new patch` and `sync`; asked to remember a preference for all projects, it wrote a rule into the person's added harness with `new rule --to` and saved it the way that harness's `AGENTS.md` said: a commit with the required prefix, pushed to `main` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#claude-code)).
66
+ - Telemetry's agent events work in a headless Claude Code run, and a project rule built from the template in [14.8](14-telemetry.md#148-reporting-harness-problems) led the agent to report a failing harness tool with `harnesspm why` output, unprompted ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#claude-code)).
67
+ - A headless Claude Code run uses what harnesspm writes: hooks, allow and deny rules, local-scope MCP servers, sub-agents, and skills linked from inside or outside the repository ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#claude-code)). Codex outputs are checked only against its source and docs, because no Codex CLI was available.
68
+
69
+ ### 13.13 The reviewed state in hook runs
70
+
71
+ A hook run may add entries ([6.2](06-trust.md#62-trusting-a-package), rule 4). So the `SessionStart` hook that `harnesspm add` installs ([7.5](07-added.md#75-applying-in-every-repository)) grants what the working tree holds, including an agent's edit from an earlier session. Checks 1 and 2 of the reviewed state could apply to hook runs too, but that changes what a hook run may grant. **Signal:** an agent's own harness edit is granted through that hook in a real session. **Then:** apply the reviewed-state check to the repository's entries in hook runs.
72
+
73
+ Since the hook runs `update`, it also grants what arrives through a fetch: a push to an added harness's remote is granted at the next session start, as `"trust": true` grants a team package's upgrade. Holding such entries for one run would not last, because the next session's hook grants what the working copy then holds. A lasting hold needs a per-source record of the commit a person last granted, much like the lock records a `"pin"` approval. **Signal:** people add harnesses whose pushes they do not control, beyond an npm source with a fixed version. **Then:** record the granted commit per git source, and hold executables that arrive through the hook until `approve`.
74
+
75
+ ### 13.14 Entry hooks in a parent folder
76
+
77
+ A session that starts in a parent folder reads the project entries' rules and skills, but not their hooks and permissions, which sit in each repository's `.claude/settings.local.json` ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). Writing them into the parent folder's settings would make them apply to every repository below it, as the projects' own hooks already do there with `-C` and a check of the edited file. **Signal:** a person needs an entry's hook, such as a lint on edit, in sessions with several repositories. **Then:** write entry hooks into the parent folder's settings with `-C <repository>`, as 4.10 does for projects, and leave entry permissions in the repository.
78
+
79
+ ## 13.12 Removed in review
80
+
81
+ | Removed | Why | Comes back if |
82
+ | --- | --- | --- |
83
+ | Four layers, with a global personal layer below dependencies | Hard to explain. Three layers and two scopes say the same thing. | A real case needs a person's defaults that team rules override by ID. |
84
+ | `include` and `self` in `harnesspm.json` | No scenario needed them. `exclude` covers narrowing. | A project needs an allowlist. |
85
+ | Committed Claude Code settings and `.mcp.json` entries | Two rules for two agents. Now: commit only the block and the lock. | Per-machine settings stop working (13.8). |
86
+ | `AGENTS.override.md` as a copy of `AGENTS.md` for Codex | Copies go stale. `developer_instructions` adds rules of added harnesses without a copy. | `developer_instructions` is not read from project config. |
87
+ | `harnesspm personal save`, `push`, `pull`, `diff`, `status`, `extend` and a patch outbox | harnesspm does not need to wrap git. The owner's rules decide how changes are saved, and agents have their own git tools. | Agents turn out unable to follow owner rules reliably. |
88
+ | A folder picked up automatically as an added harness | One more rule to learn. `add --local` does the same. | — |
89
+ | A separate lock for added harnesses | Added harnesses follow their branch or range. | People need reproducible setups of added harnesses. |
90
+ | Variables and slots in rules | Patches by section cover the same cases with one mechanism. | Patches copy most of a rule to change a word. |
91
+ | Options without a scenario: `agents` in `harnesspm.json`, `sync --no-local`, the hook field `agents`, `docs` as an object with `exclude`, a package-root `skills/` folder | Each had a simpler equivalent or served no scenario. | A scenario needs one of them. |
92
+ | A "personal layer" with `personal add`, `remove`, `update`, `sync --personal` and `new --personal` | A team's harness on top of a repository works the same way as a person's own. One general mechanism, "added harnesses", covers both, and `sync` itself handles repositories that do not use harnesspm. | — |
93
+ | Approving a `"pin"` package unit by unit, by hash | A script's hash misses the code it imports. Approving a version is simpler and covers it. | A team needs to approve part of a release. |
94
+ | Built-in telemetry adapters for vendors, such as Linear, PostHog or an OTLP client | One general mechanism, a command or a file, covers every vendor. Vendor code in harnesspm would need its own updates, secrets and trust rules. | Many projects copy the same handler. |
95
+ | A `harnesspm report` command with handlers chosen by the project | Reporting is the project's own rule ([14.8](14-telemetry.md#148-reporting-harness-problems)). Agents file reports with their own tools, and `harnesspm why` already gives the details. | Agents often lack a tool to file with, or reports need the same fields every time, or need counting. |
96
+ | Codex Cloud support | Its agent runs outside the task's VM. In a probe, no file written in the VM during a task reached it, and skills came only from cloud plugins ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#cloud)). A setup step that prepares files never reached a task in five tries. Codex on a person's computer stays supported. | Codex Cloud is shown to load files that the setup prepares, or harnesspm gains a Codex plugin output (13.5). |
97
+ | Committed docs copies, so that a clone has them without an install and without npm access | Copies on each machine serve every clone that runs `sync` or `fetch` ([4.3](04-outputs.md#43-project-outputs), note 8). Committed, they add megabytes to a repository, change with every upgrade of a package, and reach formatters and linters, and principle 2 in [4.1](04-outputs.md#41-principles) commits only what reviewers need. | A team's agents work in clones with neither an install nor access to the npm registry. |