@tenphi/harnesspm 0.0.0-snapshot.376310a

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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +21 -0
  3. package/README.md +88 -0
  4. package/dist/added.js +189 -0
  5. package/dist/check.js +160 -0
  6. package/dist/cli.js +139 -0
  7. package/dist/commands.js +414 -0
  8. package/dist/config.js +43 -0
  9. package/dist/exec-outputs.js +360 -0
  10. package/dist/exec-units.js +144 -0
  11. package/dist/fetch.js +93 -0
  12. package/dist/frontmatter.js +35 -0
  13. package/dist/homes.js +17 -0
  14. package/dist/lock.js +102 -0
  15. package/dist/manifest.js +154 -0
  16. package/dist/new.js +223 -0
  17. package/dist/outputs.js +453 -0
  18. package/dist/render.js +119 -0
  19. package/dist/resolve.js +396 -0
  20. package/dist/run.js +83 -0
  21. package/dist/sections.js +121 -0
  22. package/dist/user-outputs.js +195 -0
  23. package/dist/util.js +140 -0
  24. package/dist/workspaces.js +61 -0
  25. package/docs/spec/01-overview.md +130 -0
  26. package/docs/spec/02-package-format.md +238 -0
  27. package/docs/spec/03-resolution.md +104 -0
  28. package/docs/spec/04-outputs.md +109 -0
  29. package/docs/spec/05-executables.md +158 -0
  30. package/docs/spec/06-trust.md +72 -0
  31. package/docs/spec/07-added.md +104 -0
  32. package/docs/spec/08-improving.md +77 -0
  33. package/docs/spec/09-cloud.md +47 -0
  34. package/docs/spec/10-cli.md +60 -0
  35. package/docs/spec/11-standards.md +49 -0
  36. package/docs/spec/12-dogfooding.md +51 -0
  37. package/docs/spec/13-open-questions.md +85 -0
  38. package/docs/spec/README.md +33 -0
  39. package/harness/dev.harnesspm/rules/generated-files.md +4 -0
  40. package/harness/dev.harnesspm/rules/harnesspm-config.md +11 -0
  41. package/harness/plugin.json +13 -0
  42. package/harness/skills/harnesspm-export/SKILL.md +39 -0
  43. package/harness/skills/harnesspm-import/SKILL.md +35 -0
  44. package/harness/skills/harnesspm-improve/SKILL.md +38 -0
  45. package/package.json +60 -0
  46. package/schema/harnesspm.schema.json +31 -0
@@ -0,0 +1,72 @@
1
+ # 6. Trust and lock
2
+
3
+ **In short**
4
+
5
+ - Text units (rules, docs, skills, sub-agents) need no trust. Executable units and allow rules do.
6
+ - A project trusts a package in `harnesspm.json`. Adding a harness on top is the person trusting it. Trust never passes through `extends`.
7
+ - An agent never grants permissions through harnesspm: new allow rules, hooks and MCP servers wait for a person.
8
+ - `harnesspm.lock.json` records every unit's hash, so pull requests show what changed.
9
+
10
+ ## 6.1 What needs trust
11
+
12
+ | Unit | Needs trust? | Why |
13
+ | --- | --- | --- |
14
+ | Rules, docs, sub-agent definitions, skills | No | Text. The agent still asks before running commands, unless a permission allows them. |
15
+ | The `Skill(<name>)` allow rule that lets an unattended session run a skill | **Yes** | It removes a prompt. Written only for skills from the project, an added harness or a trusted package. |
16
+ | Scripts, hooks, MCP servers | **Yes** | They run code, some of them automatically. |
17
+ | Allow permissions | **Yes** | They remove a prompt. |
18
+ | Deny and ask permissions | No | They only restrict. |
19
+
20
+ ## 6.2 Trusting a package
21
+
22
+ ```json
23
+ {
24
+ "trust": {
25
+ "@cube-dev/ui-kit": true,
26
+ "some-third-party": "pin"
27
+ }
28
+ }
29
+ ```
30
+
31
+ | Value | Meaning |
32
+ | --- | --- |
33
+ | `true` | Executable units are active, also after upgrades. The lock diff shows changes. For the team's own packages. |
34
+ | `"pin"` | Active only in the version approved in the lock. Adding the entry approves the installed version. A new version stays off until `harnesspm approve`. For packages the team does not control. |
35
+ | missing | Executable units stay off. `harnesspm sync` lists them as **pending** and does not fail. |
36
+
37
+ Rules:
38
+
39
+ 1. Trust MUST NOT pass through `extends`. Trusting UI Kit does not trust Tasty.
40
+ 2. `harnesspm add` is the person's trust decision for that harness. Added harnesses need no `trust` entry.
41
+ 3. `harnesspm run` checks the lock before running a script, so the rules also hold when an agent calls a script directly.
42
+ 4. harnesspm MUST NOT add or widen allow rules, hooks or MCP servers when the agent's model runs it, for example through an install the model starts. Agents keep the model from granting itself permissions, and harnesspm must not be a way around that.
43
+ - Claude Code marks who runs a command: `AI_AGENT` ends in `_agent` for commands the model runs and in `_harness` for hooks and MCP servers. Setup scripts get neither. harnesspm treats `_agent`, or `CLAUDECODE=1` without `AI_AGENT`, as a model run.
44
+ - Codex sets `CODEX_CI=1` and `CODEX_TOOL_CALL_ID` in commands the model runs, and in neither hooks nor commands a person runs. harnesspm treats either as a model run. Codex's workspace-write sandbox also keeps `.codex/` and `~/.codex` read-only for model runs ([research](../research/agent-capabilities.md#codex)).
45
+ - These markers are advisory: a model can unset them. They stop accidents, such as an install the model starts, not a model that works around them.
46
+ - A hook runs from settings a person wrote, so a hook run may add entries.
47
+ - A model run keeps the entries a person granted before, and never removes a deny or ask rule. Held-back entries stay pending until a person runs `harnesspm sync` or `harnesspm approve`, or a setup script or a hook runs harnesspm. Text units, skill links and other removals are written as usual.
48
+
49
+ ## 6.3 The lock
50
+
51
+ `harnesspm.lock.json` is committed. It covers the dependency and project layers and records:
52
+
53
+ - every harness package: name, version, plugin name, tarball URL and integrity, so `harnesspm fetch` can download it without an install; for a `"pin"` package, also the approved version;
54
+ - every unit: ID, kind, content hash;
55
+ - every patch: a hash of each section it replaces or removes, so an upgrade that changes one is reported.
56
+
57
+ The lock holds no per-machine state, so every machine writes the same lock. `harnesspm status` shows which executable units are pending on this machine, and why.
58
+
59
+ People do not edit it. Added harnesses are not locked. They follow their branch or version range, and `harnesspm update` refreshes them.
60
+
61
+ ## 6.4 CI
62
+
63
+ `harnesspm sync --check` and every run with `CI=true` ignore added harnesses. `--check` writes nothing and fails when:
64
+
65
+ - a committed output or the lock is out of date;
66
+ - a `"pin"` package has a version that nobody approved.
67
+
68
+ ## 6.5 Not covered
69
+
70
+ - **A trusted package is compromised.** `true` follows new versions. The lock diff and normal dependency review are the protection. Use `"pin"` for packages the team does not control.
71
+ - **Prompt injection in text units.** Rules and skills are instructions. Review them like code.
72
+ - **An agent ignores a rule.** harnesspm delivers instructions. Hooks and deny permissions can enforce some of them.
@@ -0,0 +1,104 @@
1
+ # 7. Added harnesses
2
+
3
+ **In short**
4
+
5
+ - An **added harness** is an ordinary harness that a person adds on their machine, on top of the repository's. It is never committed.
6
+ - Add any number, in order: for example, your team's shared harness, then your own. A later one wins on a skill name.
7
+ - **User scope** applies a harness in every repository on the machine, including its entries for single repositories. **Local scope** applies it in one repository.
8
+ - Agents can improve an added harness, as described in [08-improving.md](08-improving.md).
9
+
10
+ ## 7.1 What goes in it
11
+
12
+ An added harness holds what should not live in every project repository:
13
+
14
+ | Content | Unit kind | Example |
15
+ | --- | --- | --- |
16
+ | How a team or a person works | Always-on rule | Commit style, review habits, preferred tools |
17
+ | Context the agent reads when needed | Docs (notes) | Which repositories exist and how they relate, environments, people to ask |
18
+ | Repeated workflows | Skills | Releasing a package, preparing a weekly update |
19
+ | Tools | Scripts, hooks, MCP servers | A script that opens a local preview of linked repositories |
20
+ | Changes for one repository | Project entry | A local staging address, a replaced team rule |
21
+
22
+ A team's harness and a person's own harness use the same format and the same commands. Only their owners differ, and each owner's rules decide how its changes are saved ([08-improving.md](08-improving.md#83-the-owner-decides-how-to-save)). To give a harness to everyone who works on a repository, make it a dependency instead (S6).
23
+
24
+ A person's own added harness is the "memory" they keep across projects and machines. Notes that an agent saves by itself, such as Claude Code auto memory, stay with the agent and are not part of harnesspm.
25
+
26
+ ## 7.2 Example
27
+
28
+ ```text
29
+ alex-harness/ a git repository, on any host
30
+ ├── AGENTS.md how to change this repository, including how to save changes
31
+ └── harness/
32
+ ├── plugin.json
33
+ ├── dev.harnesspm/rules/
34
+ │ └── workflow.md always on
35
+ ├── notes/ read on demand
36
+ │ ├── llms.txt index of the notes
37
+ │ └── projects.md repositories and how they relate
38
+ ├── skills/
39
+ │ └── alex-release/SKILL.md
40
+ └── projects/
41
+ └── cube-ui-kit/ same layout as harness/; plugin.json is optional
42
+ └── dev.harnesspm/rules/local-setup.md
43
+ ```
44
+
45
+ ```json
46
+ {
47
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
48
+ "name": "alex",
49
+ "extensions": {
50
+ "dev.harnesspm": {
51
+ "docs": "./notes",
52
+ "projects": {
53
+ "github.com/cube-js/cube-ui-kit": "./projects/cube-ui-kit"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ A project entry is matched by the repository's `origin` remote, written as `<host>/<path>` without `.git`, for SSH and HTTPS URLs alike. So it also works in a fresh clone in a cloud session.
61
+
62
+ Units in an entry belong to the added harness, so their IDs start with its plugin name. An entry's unit wins over one with the same ID in the rest of the harness. The entry's optional `plugin.json` uses the same name and may hold `exclude`, `replace` and `patch` for the repository's units.
63
+
64
+ ## 7.3 Sources
65
+
66
+ | Source | Example | Editable | Where it lives |
67
+ | --- | --- | --- | --- |
68
+ | Git repository | `github:alex/harness`, `git:https://git.example.com/team/harness.git` | yes | A working copy in `~/.harnesspm/harnesses/<name>/` |
69
+ | Folder | `~/dev/alex-harness` | yes | In place |
70
+ | npm package | `npm:@alex/harness` | no | A cache in `~/.harnesspm/cache/` |
71
+
72
+ Git sources work with any host. npm and git sources never touch the project's `package.json` or lockfile.
73
+
74
+ ## 7.4 Scopes and order
75
+
76
+ | Scope | How to add | Recorded in | Outputs |
77
+ | --- | --- | --- | --- |
78
+ | **User** | `npx harnesspm add <source>` | `~/.harnesspm/config.json` | User-level folders, see [04-outputs.md](04-outputs.md#44-outputs-of-added-harnesses-user-scope) |
79
+ | **Local** | `npx harnesspm add <source> --local` | `harnesspm.local.json` in the repository, excluded from git | Project outputs, see [04-outputs.md](04-outputs.md#43-project-outputs) |
80
+
81
+ Both files have one field:
82
+
83
+ ```json
84
+ { "harnesses": ["github:cube-js/frontend-harness", "github:alex/harness"] }
85
+ ```
86
+
87
+ `add` appends, so harnesses apply in the order they were added: user scope first, then local scope. A project entry comes right after its harness. `harnesspm new --to <plugin>` names the harness to write into.
88
+
89
+ ## 7.5 Applying in every repository
90
+
91
+ `harnesspm add` also installs one user-level `SessionStart` hook for each agent. The hook runs `npx -y @tenphi/harnesspm sync` at the start of every session. In a repository that does not use harnesspm, or whose dependencies are not installed yet, `sync` writes only the per-machine outputs of added harnesses, including their project entries, and changes only git-excluded files.
92
+
93
+ - Claude Code runs the hook with `AI_AGENT=…_harness`, so this sync may write hooks and permissions ([06-trust.md](06-trust.md#62-trusting-a-package), rule 4).
94
+ - Claude Code uses what the hook writes in the same session: a `CLAUDE.local.md` and a `.claude/settings.local.json` written by a `SessionStart` hook were both read in cloud sessions.
95
+ - Codex asks the person to review a new hook once, in `/hooks`.
96
+ - `--no-hook` skips the hook. Project entries then apply only where `harnesspm sync` runs.
97
+ - `harnesspm remove` takes the hook away with the last harness with user scope.
98
+
99
+ ## 7.6 Keeping the project clean
100
+
101
+ 1. Added units are never written into tracked files. Per-machine files are excluded through `.git/info/exclude`.
102
+ 2. CI ignores added harnesses.
103
+ 3. `harnesspm status` lists every change that an added harness makes to the repository's units, so it stays visible.
104
+ 4. In a cloud environment shared by several people, add harnesses in your own environment. See [09-cloud.md](09-cloud.md).
@@ -0,0 +1,77 @@
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 harnesspm 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 harnesspm 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
+ ## 8.2 Three owners
27
+
28
+ | Owner | Where the source is | How the agent changes it |
29
+ | --- | --- | --- |
30
+ | 📦 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`. |
31
+ | 🏢 Project | The project repository | Edit the file, like any other change in that repository. |
32
+ | ➕ Added harness | Its working copy or folder | Edit the file there. |
33
+
34
+ To create a new unit instead of changing one, use `npx harnesspm 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.
35
+
36
+ ## 8.3 The owner decides how to save
37
+
38
+ 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.
39
+
40
+ 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:
41
+
42
+ - "Commit and push to `main`."
43
+ - "Open a merge request on our GitLab and assign me."
44
+ - "Leave the change uncommitted. I review it myself."
45
+
46
+ ## 8.4 Default when the owner says nothing
47
+
48
+ 1. Show the person the change and the reason, and ask before going on.
49
+ 2. Create a branch from the default branch, named `harnesspm/<topic>`.
50
+ 3. Commit with a message that says what changed and why.
51
+ 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.
52
+ 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.
53
+
54
+ The agent never pushes to the default branch unless the owner's rules allow it.
55
+
56
+ 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.
57
+
58
+ ## 8.5 Access
59
+
60
+ | Owner | Write access |
61
+ | --- | --- |
62
+ | Dependency | Never. `node_modules` is not a source. |
63
+ | Project | As for any file in the project. |
64
+ | 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. |
65
+
66
+ ## 8.6 Checks before saving
67
+
68
+ 1. Run `npx harnesspm check <harness folder>`. It validates the harness and warns about files that look like secrets.
69
+ 2. Never copy private data from the current project into an added harness without the person's agreement.
70
+
71
+ ## 8.7 Shared working copies
72
+
73
+ 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.
74
+
75
+ ## 8.8 What harnesspm ships for this
76
+
77
+ 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,47 @@
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: when the agent runs it, new hooks, MCP servers and allow rules stay pending ([06-trust.md](06-trust.md#62-trusting-a-package), rule 4).
7
+ - Added harnesses need one command in the container: in the setup script of the person's own environment, or asked of the agent.
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 Adding harnesses
11
+
12
+ ```bash
13
+ npx -y @tenphi/harnesspm add github:alex/harness
14
+ ```
15
+
16
+ | Way | How it works |
17
+ | --- | --- |
18
+ | **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 refreshes the outputs in each one. |
19
+ | **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. |
20
+
21
+ 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.
22
+
23
+ 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.
24
+
25
+ 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 applies project entries and writes per-machine outputs in every session, so the setup script does not depend on the repository.
26
+
27
+ 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.
28
+
29
+ ## 9.2 Private sources
30
+
31
+ | Source | How to reach it |
32
+ | --- | --- |
33
+ | Public git repository or npm package | Works |
34
+ | Private git repository | Add it under the environment's repositories, or attach it to the session. Setup scripts cannot read variables or secrets. |
35
+ | Private npm package | Inside a session only: a network secret for `registry.npmjs.org` |
36
+
37
+ Never write tokens into setup scripts or environment variables: anyone who uses the environment can read them.
38
+
39
+ ## 9.3 Improving from the cloud
40
+
41
+ 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.
42
+
43
+ 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.
44
+
45
+ ## 9.4 What a probe confirmed
46
+
47
+ In November 2026 a probe confirmed in Claude Code cloud sessions every output that added harnesses 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. Details are in [research/agent-capabilities.md](../research/agent-capabilities.md#cloud-sessions). The proof of concept checks them again ([13.11](13-open-questions.md#1311-agent-behavior-not-confirmed-yet)).
@@ -0,0 +1,60 @@
1
+ # 10. CLI
2
+
3
+ **In short**
4
+
5
+ - Projects use `init`, `sync`, `status`, `why`, `approve` and `run`. Jobs that do not install dependencies use `fetch`.
6
+ - Authors use `check` and `new`.
7
+ - People use `add`, `remove` and `update` for harnesses on top of the repository's.
8
+ - Saving changes to a harness is not a harnesspm command. The owner's rules decide it ([08-improving.md](08-improving.md)).
9
+
10
+ The npm package is `@tenphi/harnesspm`, and the command it installs is `harnesspm`. Use `npx harnesspm …` in a project that depends on it. Use `npx -y @tenphi/harnesspm …` anywhere else, so npx downloads the package by its full name. Outputs follow the same split, and an allow rule always has the prefix of the command it allows.
11
+
12
+ ## 10.1 Projects
13
+
14
+ | Command | What it does |
15
+ | --- | --- |
16
+ | `harnesspm init` | Creates `harnesspm.json`, adds `harnesspm sync` to the `postinstall` script of a private package or to `prepare` otherwise, makes `CLAUDE.md` import `AGENTS.md`, then runs `harnesspm sync`. |
17
+ | `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 ([06-trust.md](06-trust.md#62-trusting-a-package)). |
18
+ | `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. |
19
+ | `harnesspm status` | Layers, packages, versions, pending trust, changes that added harnesses make to the repository's units, always-on size per agent. |
20
+ | `harnesspm why <ID>` | Owner, source, repository and whether the unit is editable ([08-improving.md](08-improving.md#81-find-the-source)). |
21
+ | `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. |
22
+ | `harnesspm run [--agent <agent>] <plugin>:<script> [-- args]` | Runs a script ([05-executables.md](05-executables.md#51-scripts)). Hooks pass `--agent`, which sets `HARNESSPM_AGENT`. |
23
+ | `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)). For review bots and CI jobs that do not install dependencies. |
24
+
25
+ Package managers run these scripts on a full install, but not on `npm install <pkg>`, `npm uninstall` or `pnpm add`, so run `npx harnesspm 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](../research/package-managers.md)).
26
+
27
+ `harnesspm mcp [--agent <agent>] <plugin>:<server>` also exists. Agents call it to start stdio MCP servers. People do not need it.
28
+
29
+ ```text
30
+ $ npx harnesspm status
31
+ 📦 dependencies @cube-dev/ui-kit 0.206.1 → @tenphi/tasty 3.17.1, @tenphi/glaze 2.0.0
32
+ 🏢 project harnesspm.json: 1 replace · 1 patch
33
+ ➕ added github:cube-js/frontend-harness (user) · github:alex/harness (user), project entry cube-ui-kit
34
+ ⏳ pending some-third-party: 1 hook (not trusted)
35
+ 📏 always-on Codex 18.4 KiB of 32 KiB · Claude Code 212 lines
36
+ ```
37
+
38
+ ## 10.2 Authors
39
+
40
+ | Command | What it does |
41
+ | --- | --- |
42
+ | `harnesspm check [<folder>]` | Validates a harness ([02-package-format.md](02-package-format.md#210-validation)) and warns about files that look like secrets. Run it at `prepack`. |
43
+ | `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. |
44
+ | `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. |
45
+
46
+ ## 10.3 People
47
+
48
+ | Command | What it does |
49
+ | --- | --- |
50
+ | `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. |
51
+ | `harnesspm remove <source> [--local]` | Removes it and its outputs. With the last harness with user scope, the hook and write access go too. |
52
+ | `harnesspm update` | Fetches new versions of added harnesses and rewrites their outputs. Skips working copies with uncommitted changes or unpushed commits and lists them. |
53
+
54
+ ## 10.4 Exit codes
55
+
56
+ | Code | Meaning |
57
+ | --- | --- |
58
+ | `0` | Success. Pending trust is not an error. |
59
+ | `1` | Error: invalid harness, failed check. |
60
+ | `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. |
@@ -0,0 +1,49 @@
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
+ | [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. |
20
+
21
+ ## 11.2 What no standard covers yet
22
+
23
+ | Need | Standard today | What harnesspm does |
24
+ | --- | --- | --- |
25
+ | Dependencies between plugins | Agent Plugins lists "dependency resolution" as a future consideration | `extends`, resolved through npm |
26
+ | 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 |
27
+ | Always-on and file-scoped rules | None. Each agent has its own format | Markdown rules with `paths` and `description` frontmatter |
28
+ | 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 |
29
+ | 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 |
30
+ | Scripts for agents | Agent Skills allows `scripts/` inside a skill, with no runner or permission model | Named scripts, one runner, generated permissions |
31
+ | Overrides across packages | None | `exclude` and `replace` by unit ID, and `patch` by Markdown section |
32
+ | Harnesses added on top of a repository | None | Added harnesses with two scopes, improved under their owner's rules |
33
+
34
+ ## 11.3 Proposing upstream
35
+
36
+ harnesspm is a working example of what Agent Plugins lists as future work. Once harnesspm has real users, the project SHOULD propose:
37
+
38
+ 1. a `dependencies` (or `extends`) field, based on [03-resolution.md](03-resolution.md);
39
+ 2. a trust and approval model, based on [06-trust.md](06-trust.md);
40
+ 3. feedback on the hooks proposal, based on running the same hooks in two agents.
41
+
42
+ ## 11.4 Watch list
43
+
44
+ | Item | Why it matters | Action when it changes |
45
+ | --- | --- | --- |
46
+ | Agent Plugins 1.1 | May add hooks and other fields | Read the new files. Keep the harnesspm format working during a migration period. |
47
+ | 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). |
48
+ | A standard for rules | Would replace the harnesspm rule format | Map frontmatter, keep IDs. |
49
+ | 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`](../../AGENTS.md) | How to work on this repository, including how to save changes. Ends with the harnesspm block that `npm run sync` writes. |
14
+ | [`CLAUDE.md`](../../CLAUDE.md) | Imports `AGENTS.md` for Claude Code. |
15
+ | [`harnesspm.json`](../../harnesspm.json) | This repository's project configuration. |
16
+ | [`harness/`](../../harness/) | The harness that ships to everyone who installs `harnesspm`. Part of the project layer here, the dependency layer for users. |
17
+
18
+ The proof of concept 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",
38
+ "files": ["dist", "schema", "harness", "docs/spec", "CHANGELOG.md"],
39
+ "scripts": { "prepack": "harnesspm check" }
40
+ }
41
+ ```
42
+
43
+ `harnesspm check` runs 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,85 @@
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 wait for the **proof of concept**. 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. Extend them to skills if people start replacing whole skills to change one step.
22
+
23
+ ### 13.3 Extension namespace
24
+
25
+ **Decision:** `dev.harnesspm`, based on the domain `harnesspm.dev`. Agent Plugins requires the namespace to be based on a domain the client controls.
26
+
27
+ **Before the first public release:** register `harnesspm.dev`. It was not registered when checked through RDAP in November 2026. The namespace cannot change after release, because every published harness uses it as a folder name.
28
+
29
+ ### 13.4 Sub-agents for Codex
30
+
31
+ **Decision:** sub-agents are written for both agents. Codex reads custom agents from `.codex/agents/*.toml` and `~/.codex/agents/` ([research/agent-capabilities.md](../research/agent-capabilities.md)). The format is in [02-package-format.md](02-package-format.md#26-sub-agents).
32
+
33
+ ### 13.5 Plugin output mode
34
+
35
+ **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.
36
+
37
+
38
+ ### 13.6 CI without an install
39
+
40
+ **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`. Without them, as with pnpm and Yarn lockfiles, `fetch` downloads `<name>@<version>` from the registry and says the download is not checked.
41
+
42
+ ### 13.7 Team lock on rules (rejected)
43
+
44
+ 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.
45
+
46
+ ### 13.8 Committed Claude Code settings (settled)
47
+
48
+ 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.
49
+
50
+ ## Waiting for the proof of concept
51
+
52
+ ### 13.9 Upgrade report
53
+
54
+ 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`.
55
+
56
+ ### 13.10 Structured project relations
57
+
58
+ A person's notes describe how repositories relate, such as "UI Kit builds on Tasty". v1 keeps them as plain notes. **Signal:** a task in the proof of concept needs harnesspm itself to act on relations, such as finding local clones of related repositories.
59
+
60
+ ### 13.11 Agent behavior not confirmed yet
61
+
62
+ Every ❓ in [research/agent-capabilities.md](../research/agent-capabilities.md) that v1 relies on must be tested, and the 🔍 rows behind [9.4](09-cloud.md#94-what-a-probe-confirmed) checked again. The Codex Cloud rows are out of scope (13.12). Settled by the proof of concept:
63
+
64
+ - Yarn 4 runs `postinstall` but not `prepare`, so `init` uses `postinstall` in a private package ([research](../research/package-managers.md)).
65
+ - 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.
66
+ - Codex reads `developer_instructions` from a trusted project's `.codex/config.toml`.
67
+ - 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](../research/agent-capabilities.md#claude-code)).
68
+ - 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](../research/agent-capabilities.md#claude-code)). Codex outputs are checked only against its source and docs, because no Codex CLI was available.
69
+
70
+ ## 13.12 Removed in review
71
+
72
+ | Removed | Why | Comes back if |
73
+ | --- | --- | --- |
74
+ | 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. |
75
+ | `include` and `self` in `harnesspm.json` | No scenario needed them. `exclude` covers narrowing. | A project needs an allowlist. |
76
+ | 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). |
77
+ | `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. |
78
+ | `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. |
79
+ | A folder picked up automatically as an added harness | One more rule to learn. `add --local` does the same. | — |
80
+ | A separate lock for added harnesses | Added harnesses follow their branch or range. | People need reproducible setups of added harnesses. |
81
+ | 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. |
82
+ | 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. |
83
+ | 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. | — |
84
+ | 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. |
85
+ | 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](../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). |
@@ -0,0 +1,33 @@
1
+ # harnesspm specification
2
+
3
+ **Version:** 0.7 draft
4
+ **Status:** Under discussion. Everything here can change before the first release.
5
+
6
+ ## Reading order
7
+
8
+ | If you want to | Read |
9
+ | --- | --- |
10
+ | Understand harnesspm in five minutes | [1. Overview](01-overview.md) |
11
+ | Share a harness from a package | [2. Package format](02-package-format.md), then [5. Executables](05-executables.md) if it ships tools |
12
+ | Use harness in a project | [3. Resolution](03-resolution.md), [6. Trust and lock](06-trust.md) |
13
+ | Keep your own workflow and context | [7. Added harnesses](07-added.md), [9. Cloud sessions](09-cloud.md) |
14
+ | Let agents improve a harness | [8. Improving a harness](08-improving.md) |
15
+ | Implement harnesspm | Everything, including [4. Outputs](04-outputs.md) and [10. CLI](10-cli.md) |
16
+
17
+ Also: [11. Standards](11-standards.md), [12. Dogfooding](12-dogfooding.md), [13. Open questions](13-open-questions.md).
18
+
19
+ Every chapter starts with **In short**: the few points an agent or a person needs to act on it.
20
+
21
+ ## Conformance language
22
+
23
+ The words **MUST**, **MUST NOT**, **SHOULD**, **SHOULD NOT** and **MAY** have the meaning given in [RFC 2119](https://www.rfc-editor.org/rfc/rfc2119). They appear only where a rule is meant to be strict.
24
+
25
+ ## Verification markers
26
+
27
+ Statements about how an agent behaves are marked in [research/agent-capabilities.md](../research/agent-capabilities.md):
28
+
29
+ | Marker | Meaning |
30
+ | --- | --- |
31
+ | ✅ | Documented by the agent's vendor |
32
+ | 🔍 | Observed in a real session |
33
+ | ❓ | Not confirmed. The proof of concept must test it |
@@ -0,0 +1,4 @@
1
+ # Files generated by harnesspm
2
+
3
+ - Files and links that harnesspm writes, such as `.claude/agents/`, `.codex/agents/`, `.claude/skills/` and `.agents/skills/`, are outputs like the managed block. Never edit them. Change the source that `npx harnesspm why <ID>` names, with the `harnesspm-improve` skill.
4
+ - After changing `harnesspm.json` or a harness file, or after `npm install <pkg>` or `pnpm add`, run `npx harnesspm sync`.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: How to change harnesspm configuration and harness files safely
3
+ paths: ["harnesspm.json", "harnesspm.local.json", "harness/**"]
4
+ ---
5
+
6
+ # Changing harnesspm configuration
7
+
8
+ - `harnesspm.json` and `harness/` belong to the team and are committed. `harnesspm.local.json` lists harnesses added for this repository only and is never committed.
9
+ - To change a few sections of an upstream rule, create a patch with `npx harnesspm new patch <rule ID>`, keep only the sections you change, and edit them. To change a whole unit, use `replace`. To drop it, use `exclude`. Do not copy the whole upstream harness.
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
+ - After a change, run `npx harnesspm sync`, and `npx harnesspm check <folder>` for a changed harness folder. Fix every reported problem.
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
+ "name": "harnesspm",
4
+ "description": "How to work with harnesspm: generated files, configuration, harness authoring and added harnesses",
5
+ "homepage": "https://github.com/tenphi/harnesspm",
6
+ "repository": "https://github.com/tenphi/harnesspm",
7
+ "keywords": ["harnesspm", "harness", "agents"],
8
+ "extensions": {
9
+ "dev.harnesspm": {
10
+ "docs": "../docs/spec"
11
+ }
12
+ }
13
+ }