@harnesspm/cli 0.0.0-snapshot.412a718 → 0.0.0-stage

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/README.md +2 -69
  2. package/package.json +4 -71
  3. package/CHANGELOG.md +0 -259
  4. package/LICENSE +0 -21
  5. package/dist/added.d.ts +0 -51
  6. package/dist/added.js +0 -192
  7. package/dist/check.d.ts +0 -14
  8. package/dist/check.js +0 -263
  9. package/dist/cli.d.ts +0 -2
  10. package/dist/cli.js +0 -218
  11. package/dist/commands.d.ts +0 -58
  12. package/dist/commands.js +0 -1299
  13. package/dist/config.d.ts +0 -15
  14. package/dist/config.js +0 -45
  15. package/dist/deliver.d.ts +0 -1
  16. package/dist/deliver.js +0 -31
  17. package/dist/doctor.d.ts +0 -18
  18. package/dist/doctor.js +0 -99
  19. package/dist/exec-outputs.d.ts +0 -75
  20. package/dist/exec-outputs.js +0 -425
  21. package/dist/exec-units.d.ts +0 -68
  22. package/dist/exec-units.js +0 -151
  23. package/dist/fetch.d.ts +0 -16
  24. package/dist/fetch.js +0 -145
  25. package/dist/frontmatter.d.ts +0 -16
  26. package/dist/frontmatter.js +0 -49
  27. package/dist/homes.d.ts +0 -7
  28. package/dist/homes.js +0 -21
  29. package/dist/lock.d.ts +0 -47
  30. package/dist/lock.js +0 -245
  31. package/dist/manifest.d.ts +0 -78
  32. package/dist/manifest.js +0 -169
  33. package/dist/new.d.ts +0 -33
  34. package/dist/new.js +0 -228
  35. package/dist/outputs.d.ts +0 -124
  36. package/dist/outputs.js +0 -875
  37. package/dist/parent.d.ts +0 -41
  38. package/dist/parent.js +0 -182
  39. package/dist/render.d.ts +0 -91
  40. package/dist/render.js +0 -221
  41. package/dist/resolve.d.ts +0 -132
  42. package/dist/resolve.js +0 -522
  43. package/dist/reviewed.d.ts +0 -15
  44. package/dist/reviewed.js +0 -41
  45. package/dist/run.d.ts +0 -18
  46. package/dist/run.js +0 -133
  47. package/dist/sections.d.ts +0 -32
  48. package/dist/sections.js +0 -121
  49. package/dist/telemetry-api.d.ts +0 -26
  50. package/dist/telemetry-api.js +0 -60
  51. package/dist/telemetry.d.ts +0 -119
  52. package/dist/telemetry.js +0 -401
  53. package/dist/user-outputs.d.ts +0 -30
  54. package/dist/user-outputs.js +0 -239
  55. package/dist/util.d.ts +0 -137
  56. package/dist/util.js +0 -370
  57. package/dist/workspaces.d.ts +0 -2
  58. package/dist/workspaces.js +0 -62
  59. package/docs/spec/01-overview.md +0 -149
  60. package/docs/spec/02-package-format.md +0 -252
  61. package/docs/spec/03-resolution.md +0 -108
  62. package/docs/spec/04-outputs.md +0 -194
  63. package/docs/spec/05-executables.md +0 -170
  64. package/docs/spec/06-trust.md +0 -88
  65. package/docs/spec/07-added.md +0 -109
  66. package/docs/spec/08-improving.md +0 -79
  67. package/docs/spec/09-cloud.md +0 -68
  68. package/docs/spec/10-cli.md +0 -181
  69. package/docs/spec/11-standards.md +0 -52
  70. package/docs/spec/12-dogfooding.md +0 -51
  71. package/docs/spec/13-open-questions.md +0 -97
  72. package/docs/spec/14-telemetry.md +0 -199
  73. package/docs/spec/README.md +0 -33
  74. package/harness/dev.harnesspm/rules/generated-files.md +0 -9
  75. package/harness/dev.harnesspm/rules/harnesspm-config.md +0 -12
  76. package/harness/plugin.json +0 -13
  77. package/harness/skills/harnesspm-export/SKILL.md +0 -43
  78. package/harness/skills/harnesspm-import/SKILL.md +0 -40
  79. package/harness/skills/harnesspm-improve/SKILL.md +0 -38
  80. package/schema/harnesspm.schema.json +0 -58
@@ -1,149 +0,0 @@
1
- # 1. Overview
2
-
3
- **In short**
4
-
5
- - A library ships a `harness/` folder in its npm package. A project installs harnesspm. After every install, Claude Code and Codex see the harness of the versions that are installed.
6
- - There are three layers: **dependencies**, **project** and **added** harnesses. Each layer can add units, and replace, patch or drop units of the layers below.
7
- - An agent can improve any harness: a dependency's (upstream), the project's (in the repository), or a person's (in that person's own repository). The owner's own rules decide how a change is saved.
8
-
9
- ## 1.1 Problem
10
-
11
- A library knows how it should be used. An agent that works in a project using that library does not, unless someone tells it. Today that knowledge travels by hand:
12
-
13
- - Rules are copied between repositories and drift apart.
14
- - Docs are reached through hand-made symlinks and hand-written indexes that fall behind.
15
- - A library that builds on another library restates or vendors the upstream material.
16
- - The same rule is written once per agent.
17
- - A developer's own workflow and context live in places that cloud sessions and other projects cannot see.
18
-
19
- [research/motivating-case.md](https://github.com/tenphi/harnesspm/blob/main/docs/research/motivating-case.md) shows these problems in a real chain of packages.
20
-
21
- ## 1.2 How it works
22
-
23
- ### Share (export)
24
-
25
- A library adds a folder and publishes as usual.
26
-
27
- ```text
28
- my-lib/
29
- ├── package.json "files": [..., "harness"], "prepack": "harnesspm check"
30
- └── harness/
31
- ├── plugin.json name, and which packages it builds on ("extends")
32
- ├── skills/… Agent Skills
33
- └── dev.harnesspm/
34
- └── rules/… Markdown rules
35
- ```
36
-
37
- ### Use (import)
38
-
39
- ```bash
40
- npm i -D @harnesspm/cli
41
- npx -y @harnesspm/cli init
42
- ```
43
-
44
- Every full install, such as `npm install` or `pnpm install`, then runs `harnesspm sync`. It finds the harness of each dependency, follows `extends` chains, applies the project's changes, and writes each agent's native files. The project commits the generated block in `AGENTS.md` and `harnesspm.lock.json`, so upgrades show up in pull requests.
45
-
46
- ### Add on top
47
-
48
- ```bash
49
- npx -y @harnesspm/cli add github:alex/harness
50
- ```
51
-
52
- The person's workflow rules, context notes and skills now apply to every project on this machine, and project-specific entries to their projects. The project repository does not change.
53
-
54
- ### Improve
55
-
56
- ```bash
57
- npx -y @harnesspm/cli why tasty:rules/state-maps
58
- ```
59
-
60
- `why` names the unit's owner and source. The agent edits the source and proposes the change the way the owner's rules say. The default is a branch and a pull request.
61
-
62
- ## 1.3 Goals
63
-
64
- 1. **One folder to share.** Standard formats. No new runtime dependency for the library.
65
- 2. **Harness passes through dependency chains**, and each package can change what it passes on.
66
- 3. **Install once, stay current**, at the installed versions.
67
- 4. **One source, every agent.** Native files for Claude Code and Codex first.
68
- 5. **Executables are first-class and safe:** scripts, hooks, MCP servers and permissions behind an explicit trust model.
69
- 6. **Added harnesses**, such as a team's or a person's own, that never change the project's repository and also work in Claude Code cloud sessions.
70
- 7. **Every harness can be improved by an agent**, under its owner's rules.
71
- 8. **Standards first. harnesspm uses itself.**
72
-
73
- ## 1.4 Non-goals
74
-
75
- - **A registry.** npm, git and folders are the sources.
76
- - **A new rule language.** Rules are Markdown. Skills follow Agent Skills.
77
- - **The agent's own memory.** Notes that Claude Code or Codex save by themselves stay with the agent. A person's workflow and context belong in their own added harness.
78
- - **Git hosting.** harnesspm does not call GitHub, GitLab or any other host. Agents use their own tools to push and open pull requests.
79
- - **Sandboxing.** Agents keep their own sandboxes and approval prompts.
80
- - **Codex Cloud, in v1.** Codex is supported on a person's computer. See [13.12](13-open-questions.md#1312-removed-in-review).
81
-
82
- ## 1.5 Terms
83
-
84
- | Term | Meaning |
85
- | --- | --- |
86
- | **Harness** | Everything an agent needs for a codebase: rules, docs, skills, sub-agents, scripts, hooks, MCP servers, permissions. |
87
- | **Harness package** | An npm package, git repository or folder that has a `harness/` folder. |
88
- | **Plugin name** | The `name` in a harness's `plugin.json`. It starts every unit ID of that harness. |
89
- | **Unit** | One item in a harness, such as one rule or one script. Each unit has an ID, such as `uikit:rules/forms`. |
90
- | **Patch** | A Markdown file that replaces, adds or removes sections of a rule and keeps the rest. |
91
- | **Layer** | Where units come from: dependencies, project or added harnesses. A higher layer can drop, replace or patch units of the layers below. |
92
- | **Added harness** | A harness that a person adds on their machine, on top of the repository's, such as a team's or their own. Never committed. Several can be stacked. |
93
- | **Scope** | Where an added harness applies: **user** (every repository on the machine) or **local** (one repository). |
94
- | **Owner** | The harness a unit comes from: a dependency, the project, or an added harness. The owner's rules decide how its units change. |
95
- | **Source** | Where something is read from: the file of a unit, or the git repository, folder or npm package of an added harness. Outputs are generated from sources. |
96
- | **Project entry** | A folder in an added harness with units for one repository, matched by its git remote. |
97
- | **Output** | A file or block harnesspm writes for an agent. Never edited by hand. |
98
- | **Managed block** | The part of a Markdown file that harnesspm writes, between `BEGIN:harnesspm` and `END:harnesspm` markers. |
99
- | **Block commands** | The lines at the top of a committed managed block. They say how to list the harness, print a package's rules and tools with `help <package>`, print a tool's options with `help <tool>`, run a tool, and add `-C <path>` from another folder, such as a repository that cloned this one. |
100
- | **Fetched package** | A harness package that `harnesspm fetch` downloaded into `node_modules/.harnesspm/fetched/`, without its dependencies. A project without an install reads and runs its harness from fetched packages. |
101
- | **Docs copy** | A copy of a dependency's docs pages in `.harnesspm/docs/<plugin name>/` at the project root, which `sync` and `fetch` write on each machine. Agents' search tools skip what git ignores and hidden folders, so a `.rgignore` lets them into that one folder ([4.3](04-outputs.md#43-project-outputs), note 8). Never committed. |
102
- | **Install hook** | The command that `init` adds to the project's `postinstall` or `prepare` script. It runs `harnesspm sync` on every full install, and skips it when harnesspm is not installed. |
103
- | **Lock** | `harnesspm.lock.json`: the committed record of harness packages and unit hashes. |
104
- | **Executable unit** | A script, hook, MCP server or allow permission. Needs trust. |
105
- | **Trust** | A project's consent, in `harnesspm.json`, for a package's executable units to run. |
106
- | **Pending** | An executable unit that harnesspm does not write yet: its package is not trusted, a `"pin"` package has a new version, or the agent's model started the run outside the reviewed state. |
107
- | **Reviewed state** | The repository's trust inputs as the remote default branch has them, with the lock that the install reproduces. A run by the agent's model may write what it records. |
108
- | **Event** | A record of one harness interaction, such as a script run or an agent reading a rule. Sent only when the project turns on telemetry. |
109
- | **Answer** | An exit code that a script declares as the tool doing its job, not failing, such as `1` for a lint that found problems or `2` for a hook that blocks. Listed in the script's `answers`. |
110
- | **Handler** | The command or file that gets a project's events. Named in `harnesspm.json`, and active only as a person's sync recorded it in the lock. |
111
- | **Telemetry** | The events a project collects about how agents and people use its harness. Off unless the project turns it on. |
112
- | **Parent folder** | A folder that is not in a git repository, with projects or other git repositories right below it, such as `/home/user` in a Claude Code cloud session with several repositories, or a person's folder of clones. A session that starts there reads no settings of the projects, so `sync` in it writes their hooks there, and applies the added harnesses in each repository below it ([4.10](04-outputs.md#410-sessions-that-start-in-a-parent-folder)). |
113
- | **Worktree** | A second checkout of a repository that `git worktree add` makes, with its own folder and branch, such as the one the Claude Code desktop app makes for a session. Its `.git` is a file that points into the main checkout's `.git/worktrees/`. |
114
-
115
- ## 1.6 Base scenarios
116
-
117
- Every feature serves at least one of these. Each must take as few steps as possible.
118
-
119
- | # | Scenario | What the person does |
120
- | --- | --- | --- |
121
- | S1 | A library shares its harness | Adds `harness/` and lists it in `files`. |
122
- | S2 | A library builds on upstream harness | Lists the upstream packages in `extends`, adds its own units. |
123
- | S3 | A project uses the harness of its dependencies | `npm i -D @harnesspm/cli` and `npx -y @harnesspm/cli init`, once. |
124
- | S4 | A project changes one upstream rule | One `patch` for a few sections, or one `replace` or `exclude` entry. |
125
- | S5 | A project upgrades a dependency | Nothing after a full install. After `npm install <pkg>` or `pnpm add`, `npx -y @harnesspm/cli sync`. The pull request shows what changed. |
126
- | S6 | Several repositories share a policy | A harness-only package, added as a dev dependency. |
127
- | S7 | A monorepo | Nothing. Each workspace gets the harness of its own dependencies. |
128
- | S8 | A library ships a tool for agents | A script in the harness. Projects that trust the package can run it. |
129
- | S9 | A person adds a harness on top, such as their team's or their own | `npx -y @harnesspm/cli add <source>`, once per machine. |
130
- | S10 | A person keeps workflow and context outside project repositories | Rules and notes in their own added harness, with project entries. |
131
- | S11 | An agent improves a harness | Edits the source that `harnesspm why` names, then saves under the owner's rules. |
132
- | S12 | A person works in a Claude Code cloud session | The project's install in the environment's setup script, by absolute path. For an added harness, the same `add` there, or asked of the agent. |
133
- | S13 | A job reads the harness without an install, such as a review bot | `npx -y @harnesspm/cli fetch`. |
134
- | S14 | A team sees how agents use its harnesses | `telemetry` in `harnesspm.json` with a handler, then `npx -y @harnesspm/cli sync`. |
135
- | S15 | An agent finds a harness unit that is wrong, missing or failing | Nothing in harnesspm. The project's own rule tells agents where to report, and `harnesspm why` gives the details. |
136
- | S16 | A person checks that a repository is ready for a harness of their own, and that no per-machine file can reach a commit | `npx -y @harnesspm/cli doctor`. |
137
- | S17 | A teammate's merged change adds a hook, an MCP server or an allow rule | Nothing. The next install writes it on every machine, also when an agent runs the install. |
138
- | S18 | An agent clones the repositories its task needs, such as into `work/app`, and uses their harnesses from its own folder | Nothing in the cloning repository. The block commands in the clone's `AGENTS.md` say how: `npx -y @harnesspm/cli -C work/app help` lists its packages, `-C work/app help <package>` prints one, and `-C work/app run <unit>` runs a tool, also before the clone is installed. Hooks of the clone run there only after a `sync` in that folder (S20). |
139
- | S19 | A repository has many harness packages or workspaces, and its `AGENTS.md` must stay inside the agents' limits | Nothing. The managed block names each rule and tool in one line. Agents print a package's rules with `help <package>` and a tool's options with `help <tool>`. |
140
- | S20 | A session starts in a folder above several repositories, such as a Claude Code cloud session with more than one, a person's folder of clones, or a job runner's work folder | `npx -y @harnesspm/cli sync` in that folder, after the installs: in the environment's setup script, once on a person's machine, or in the runner's checkout step. Each repository's hooks run there, and a block in that folder's `AGENTS.md` names each repository and its `help` command. A later sync of a repository keeps its entries there current. The `SessionStart` hook of an added harness syncs that folder too, so each repository gets its project entry. |
141
- | S21 | An agent looks for a dependency's docs with its search tool, not through the block | One `/.harnesspm/` line in `.gitignore`, so formatters skip the copies. `sync` and `fetch` copy every dependency's docs into `.harnesspm/docs/`, and a `.rgignore` that git ignores lets search tools in. |
142
-
143
- ## 1.7 What is committed
144
-
145
- | Committed | Per machine (excluded through `.git/info/exclude`) |
146
- | --- | --- |
147
- | `harnesspm.json`, `harnesspm.lock.json`, the managed blocks in `AGENTS.md`, the `@AGENTS.md` lines in `CLAUDE.md` files (at the root and next to each nested `AGENTS.md`) | Everything else: links, docs copies, agent settings, `.codex/`, outputs of added harnesses |
148
-
149
- Committed files depend only on the dependency and project layers, so every teammate and CI produce the same result. harnesspm never edits `.gitignore`.
@@ -1,252 +0,0 @@
1
- # 2. Package format
2
-
3
- **In short**
4
-
5
- - A harness is a `harness/` folder at the package root. It is an [Agent Plugins 1.0](https://agent-plugins.org/) plugin: `plugin.json`, `skills/`, `mcp.json`.
6
- - Everything harnesspm adds lives in the standard's extension namespace: the `dev.harnesspm` field in `plugin.json` and the folder of the same name.
7
- - Every unit has an ID, `<plugin name>:<kind>/<name>`, used to exclude, replace or patch it.
8
-
9
- The smallest harness is two files:
10
-
11
- ```text
12
- harness/
13
- ├── plugin.json {"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "mylib"}
14
- └── dev.harnesspm/rules/usage.md one rule, always on
15
- ```
16
-
17
- The portable parts (skills and MCP servers) work in any Agent Plugins client, even without harnesspm.
18
-
19
- ## 2.1 Location
20
-
21
- 1. A package MUST put its harness in a folder named `harness/` at the package root.
22
- 2. If `package.json` has a `files` field, it MUST include `harness`.
23
- 3. harnesspm MUST NOT run any code from a package to discover its harness. Discovery reads files only.
24
- > pnpm 12.11 and later link package-root `skills/` folders from direct dependencies by themselves. harnesspm reads only `harness/skills/`, so the two never link the same skills twice.
25
-
26
- ## 2.2 Layout
27
-
28
- A package that uses every unit kind:
29
-
30
- ```text
31
- harness/
32
- ├── plugin.json ← Agent Plugins manifest (required)
33
- ├── skills/ ← Agent Skills, one folder each
34
- │ └── uikit-review/
35
- │ └── SKILL.md
36
- ├── mcp.json ← Agent Plugins MCP configuration
37
- └── dev.harnesspm/ ← harnesspm extension folder
38
- ├── rules/
39
- │ ├── forms.md
40
- │ └── state-maps.md
41
- ├── agents/
42
- │ └── uikit-reviewer.md
43
- ├── scripts/
44
- │ ├── probe.mjs
45
- │ └── check-styles.mjs
46
- ├── hooks.json
47
- └── permissions.json
48
- ```
49
-
50
- Every file is optional except `plugin.json`. A package that has only one rule is valid.
51
-
52
- The extension folder name is the harnesspm namespace, `dev.harnesspm`. See [13-open-questions.md](13-open-questions.md#133-extension-namespace).
53
-
54
- ## 2.3 Manifest
55
-
56
- `plugin.json` follows Agent Plugins 1.0. Its schema is closed, so all harnesspm fields go under `extensions["dev.harnesspm"]`.
57
-
58
- ```json
59
- {
60
- "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
61
- "name": "uikit",
62
- "description": "Rules, docs and tools for building UIs with @cube-dev/ui-kit",
63
- "extensions": {
64
- "dev.harnesspm": {
65
- "extends": ["@tenphi/tasty", "@tenphi/glaze"],
66
- "docs": "../docs/components",
67
- "scripts": {
68
- "probe": {
69
- "file": "./dev.harnesspm/scripts/probe.mjs",
70
- "description": "Capture a story's DOM and computed CSS",
71
- "allow": true
72
- },
73
- "check-styles": { "file": "./dev.harnesspm/scripts/check-styles.mjs" }
74
- },
75
- "exclude": ["tasty:rules/legacy-tokens"],
76
- "replace": { "tasty:rules/lint-comments": "./dev.harnesspm/rules/lint-comments.md" }
77
- }
78
- }
79
- }
80
- ```
81
-
82
- ### Core fields (Agent Plugins)
83
-
84
- | Field | Required | Notes |
85
- | --- | --- | --- |
86
- | `$schema` | yes | The Agent Plugins schema identifier. |
87
- | `name` | yes | The **plugin name**. Lowercase letters, digits, `-` and `.`. harnesspm uses it as the prefix in unit IDs and script names. |
88
- | `version` | no | If missing, harnesspm uses `version` from `package.json`. |
89
- | `description`, `author`, `homepage`, `repository`, `license`, `keywords` | no | Metadata, as defined by Agent Plugins. |
90
-
91
- ### harnesspm extension fields
92
-
93
- | Field | Type | Meaning |
94
- | --- | --- | --- |
95
- | `extends` | string[] | Packages whose harness this harness passes on. Resolved from this package's own folder. See [03-resolution.md](03-resolution.md#33-extends). |
96
- | `exclude` | string[] | Units or whole packages to drop from what this harness passes on. |
97
- | `replace` | object | Rule or skill ID → path of what takes that unit's place: a rule file, or a skill folder with its `SKILL.md`. See [3.4](03-resolution.md#34-priority). |
98
- | `patch` | object | Rule ID → path of a patch that changes some of its sections. See [2.5](#25-rules). |
99
- | `docs` | string | The folder with the package's docs. See [2.7](#27-docs). |
100
- | `scripts` | object | Script name → script definition. See [05-executables.md](05-executables.md#51-scripts). |
101
- | `projects` | object | Git remote → folder with units for that repository. Read only in added harnesses. See [07-added.md](07-added.md#72-example). |
102
-
103
- Unknown fields inside the extension MUST make `harnesspm check` fail, so typos do not ship.
104
-
105
- ## 2.4 Unit kinds
106
-
107
- | Kind | Location | Format | Activation |
108
- | --- | --- | --- | --- |
109
- | Rule | `<ns>/rules/*.md` | Markdown with optional frontmatter | Always on, file-scoped, or on demand. See [2.5](#25-rules). |
110
- | Skill | `skills/<name>/SKILL.md` | [Agent Skills](https://agentskills.io/specification) | The agent loads it when relevant or when asked. |
111
- | Sub-agent | `<ns>/agents/*.md` | Markdown: `name` and `description` frontmatter, instructions in the body. See [2.6](#26-sub-agents). | The agent starts it. |
112
- | Doc | The folder named in `docs` | Markdown | Listed in an index. The agent reads a page when needed. |
113
- | Script | Named in `scripts` | Any executable file | Run through `harnesspm run`. |
114
- | Hook | `<ns>/hooks.json` | See [05-executables.md](05-executables.md#52-hooks) | The agent runs it on an event. |
115
- | MCP server | `mcp.json` | Agent Plugins MCP configuration | The agent starts it. |
116
- | Permission | `<ns>/permissions.json`, and `allow` on scripts | See [05-executables.md](05-executables.md#54-permissions) | The agent applies it. |
117
-
118
- `<ns>` is the extension folder, `dev.harnesspm`. A file or folder that `replace` or `patch` names is not a unit of its own, even inside `rules/` or `skills/`.
119
-
120
- An agent picks a skill by its `description`. Say what the skill does, then, after "Use when", the situations and the words people use when they need it. Being picked is likely, not certain. When a skill must run in a situation, also add an always-on rule that names it: "To trace UI text, use the `uikit-text-origin` skill."
121
-
122
- ## 2.5 Rules
123
-
124
- A rule is one Markdown file about one topic. Small files make overrides simple: a consumer replaces or drops a whole file, or patches a few of its sections.
125
-
126
- ```markdown
127
- ---
128
- description: How to write state maps in Tasty styles
129
- paths: ["**/*.tsx", "**/*.ts"]
130
- ---
131
-
132
- # State maps
133
-
134
- - Put every state of one property in one map.
135
- - …
136
- ```
137
-
138
- | Frontmatter | Activation |
139
- | --- | --- |
140
- | none | **Always on.** The text goes into the agent's main instructions. |
141
- | `paths`, with or without `description` | **File-scoped.** Active when the agent works on matching files. The description, if any, is the text of the pointer line. |
142
- | `description` only | **On demand.** Listed with its description. The agent reads it when relevant. |
143
-
144
- `paths` are globs from the project root, as Claude Code reads them. A pattern without a leading `/` also matches at any depth, so `harness/**` also matches a dependency's `node_modules/<package>/harness/` when the agent only reads it there. Start a pattern with `/`, such as `/harness/**`, to match only at the root ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#claude-code)). Pointer lines show patterns without the `/`.
145
-
146
- Always-on rules cost context in every session. A package SHOULD keep them short and move details into on-demand rules, docs or skills. `harnesspm check` reports the size of a package's always-on text.
147
-
148
- The committed `AGENTS.md` block names an always-on rule in one line: its title and its `##` and `###` headings ([4.6](04-outputs.md#46-managed-blocks)). Agents read the text with `harnesspm help <package>`. So a heading SHOULD say what its section asks, such as "Never edit outputs".
149
-
150
- A package SHOULD split a rule into small sections with `##` headings, so that others can change one section with a patch.
151
-
152
- ### Patches
153
-
154
- A patch changes some sections of a rule and keeps the rest. It is a Markdown file:
155
-
156
- ```markdown
157
- ---
158
- remove: ["Legacy tokens"]
159
- ---
160
-
161
- ## Disable comments
162
-
163
- Use `oxlint-disable-next-line`. `eslint-disable` comments are ignored in this project.
164
- ```
165
-
166
- 1. A **section** is a heading and everything up to the next heading of the same or a higher level.
167
- 2. Each section in the patch **replaces** the section with the same heading text and level in the rule.
168
- 3. A section whose heading the rule does not have is **added** at the end.
169
- 4. Text before the first heading of the patch is **added** at the end of the rule.
170
- 5. `remove` in the frontmatter lists headings whose sections are **removed**.
171
-
172
- A patch keeps the rule's ID. `harnesspm why` lists the patches applied to a unit. Patches work on rules only. Where patches come from and in which order they apply is defined in [03-resolution.md](03-resolution.md#34-priority).
173
-
174
- ## 2.6 Sub-agents
175
-
176
- ```markdown
177
- ---
178
- name: uikit-reviewer
179
- description: Reviews UI changes against UI Kit rules. Use for UI pull requests.
180
- claude: { tools: "Read, Grep, Glob", model: "sonnet" }
181
- codex: { model_reasoning_effort: "medium" }
182
- ---
183
-
184
- Review the change like an owner. Do not edit files.
185
- ```
186
-
187
- | Part | Claude Code | Codex |
188
- | --- | --- | --- |
189
- | `name`, `description` | frontmatter | `name`, `description` |
190
- | Body | the prompt | `developer_instructions` |
191
- | `claude:` | copied into the frontmatter | ignored |
192
- | `codex:` | ignored | copied into the TOML file |
193
-
194
- Only `name`, `description` and the body are portable. Agent-specific settings, such as models and tool limits, go under the agent's own key. Keys that widen what the agent may do are written only for the project, added harnesses and trusted packages ([6.1](06-trust.md#61-what-needs-trust)): `permissionMode`, `hooks` and `mcpServers` for Claude Code, which ignores the same keys in plugin sub-agents for security ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/agent-capabilities.md#skills-sub-agents-mcp-memory)), and `sandbox_mode` and `approval_policy` for Codex.
195
-
196
- ## 2.7 Docs
197
-
198
- ```json
199
- "docs": "../docs"
200
- ```
201
-
202
- 1. The path is relative to `harness/`. It MAY point outside `harness/` but MUST stay inside the package.
203
- 2. If `<dir>/llms.txt` exists, harnesspm uses it as the index. Its format is the [llms.txt](https://llmstxt.org/) convention: a Markdown list of links with short descriptions.
204
- 3. Otherwise harnesspm builds the index from every `.md` and `.mdx` page. A page's title is its frontmatter `title`, else its first heading, else its file name. Its frontmatter `description` follows the link. A page with invalid frontmatter is listed without it, and `sync` warns: it MUST NOT fail, because a project cannot fix a dependency's page. To leave pages out, write an `llms.txt`.
205
- 4. A dependency's index points at the files of the **installed** version, through a copy of its pages and `llms.txt` that search tools find ([4.3](04-outputs.md#43-project-outputs), note 8). Links between pages keep working when they are relative. A link to another file of the package, such as an image, does not reach the copy: other files are not copied.
206
- 5. A file that git ignores is not part of the docs: the index and the lock leave it out. Such a file, like an agent's local plan next to the pages, never reaches another clone, so counting it would make one machine's lock differ from CI's. This applies when the docs folder is in a git work tree and git does not ignore the folder itself. An installed package in `node_modules` counts whole. `check` reads the docs as the tarball has them instead ([2.10](#210-validation)), so it also checks pages built at `prepack`, which git ignores but npm packs.
207
- 6. In the project layer, a docs folder that git ignores, while it keeps the package's folder, is no docs unit for `sync`: a build writes it, so counting it would make the lock and the managed blocks depend on whether a build ran. A docs folder that does not exist is no unit either. An `exclude` that names such a unit gives no warning. `check` still reads the built pages.
208
-
209
- ## 2.8 Unit IDs
210
-
211
- Every unit has an ID: `<plugin name>:<kind>/<name>`.
212
-
213
- | Unit | ID |
214
- | --- | --- |
215
- | `harness/dev.harnesspm/rules/state-maps.md` in plugin `tasty` | `tasty:rules/state-maps` |
216
- | `harness/skills/uikit-review/` in plugin `uikit` | `uikit:skills/uikit-review` |
217
- | script `probe` in plugin `uikit` | `uikit:scripts/probe` |
218
- | server `docs` in `mcp.json` of plugin `uikit` | `uikit:mcp/docs` |
219
- | hook entry with `"id": "check-styles"` | `uikit:hooks/check-styles` |
220
- | `harness/dev.harnesspm/agents/uikit-reviewer.md` | `uikit:agents/uikit-reviewer` |
221
- | the docs of plugin `uikit` | `uikit:docs` |
222
- | `permissions.json` of plugin `uikit` | `uikit:permissions` |
223
-
224
- `exclude` also accepts a package name, such as `@tenphi/glaze`, to drop a whole package.
225
-
226
- Commands name scripts and MCP servers in a short form, `<plugin name>:<name>`: `harnesspm run uikit:probe`, `harnesspm mcp uikit:docs`. Agents see an MCP server as `<plugin name>-<server>`, such as `uikit-docs`.
227
-
228
- ## 2.9 Naming rules
229
-
230
- 1. Plugin names MUST be unique within one resolved graph. On a clash, harnesspm stops and names both packages. The consumer can then exclude one of them.
231
- 2. **harnesspm never renames a skill.** The Agent Skills format requires a skill's `name` to match its folder name, and agents look skills up by that name.
232
- 3. Skill names SHOULD start with the plugin name, such as `uikit-review`, so names from different packages do not collide. `harnesspm check` warns when they do not.
233
- 4. When two layers ship a skill with the same name, the higher layer wins and harnesspm prints a warning.
234
- 5. Script names MUST be unique within a plugin. Agents call them as `<plugin name>:<script>`, such as `uikit:probe`.
235
-
236
- ## 2.10 Validation
237
-
238
- `harnesspm check` runs at `prepack` and fails when:
239
-
240
- - `plugin.json` or `mcp.json` breaks the Agent Plugins schema;
241
- - a skill breaks the Agent Skills format;
242
- - a harnesspm extension field is unknown or has the wrong type;
243
- - a path points outside the package, or at a file the npm tarball would not include;
244
- - a link in a rule, skill or doc points at a file that will not be published;
245
- - a docs page in a generated index ([2.7](#27-docs)) has invalid frontmatter;
246
- - a rule or skill of a [project entry](07-added.md#72-example) breaks these rules, or the entry's `plugin.json` has another `name` than the harness, which `sync` refuses too.
247
-
248
- `check` reads each entry folder once, also when several remotes map to it, and prints its always-on size next to the harness's: in its repository, the entry's always-on rules add to the harness's.
249
-
250
- `check` judges a package by what its tarball would hold. It reads `files` in `package.json` as npm does: a listed path, a folder and what is in it, or a glob with `*`, `**` and `?`, less the `!` entries, plus the files npm always packs (`package.json`, the README, the license, `main` and `bin`). The docs pages are the docs folder's files that `files` packs, git-ignored or not, and a link in a `.md` or `.mdx` file must lead to a file that ships. `check` never runs npm for this: `npm pack --dry-run` runs the package's `prepare` script even with `--ignore-scripts` ([research](https://github.com/tenphi/harnesspm/blob/main/docs/research/package-managers.md#what-a-package-ships)). Without `files`, or with a pattern it does not read, such as braces, `check` reads the files on disk, without the docs files git ignores.
251
-
252
- A link in a code sample is text, so `check` skips it. Code samples are fenced code blocks and code spans, as [CommonMark](https://spec.commonmark.org/) reads them. A fence may be indented, as in a list item. A fence that is never closed runs to the end of the page. A link in an indented code block still counts: put a sample link in a fence.
@@ -1,108 +0,0 @@
1
- # 3. Resolution
2
-
3
- **In short**
4
-
5
- - Three layers, lowest to highest: **dependencies**, **project**, **added** harnesses.
6
- - A dependency passes on the harness of other packages only through `extends`.
7
- - A higher layer changes units below it only through `exclude`, `replace` and `patch`. Unit IDs never clash between packages, because plugin names are unique.
8
-
9
- ## 3.1 Layers
10
-
11
- | Layer | Source | Committed outputs? |
12
- | --- | --- | --- |
13
- | 📦 **Dependencies** | Harness packages in the project's dependencies, and what they `extends` | yes |
14
- | 🏢 **Project** | `harnesspm.json` and the project's own `harness/` | yes |
15
- | ➕ **Added** | Harnesses a person adds on top (see [07-added.md](07-added.md)). User scope first, then local scope, each in the order added | no |
16
-
17
- Committed outputs MUST be computed from the dependency and project layers only. Two teammates with different added harnesses produce identical committed files.
18
-
19
- ## 3.2 Discovery
20
-
21
- For each workspace, harnesspm starts from its `dependencies`, `devDependencies` and `optionalDependencies`:
22
-
23
- 1. Resolve each one from the workspace folder, the way Node.js does.
24
- 2. Keep it if it has a `harness/` folder.
25
- 3. Follow `extends` of every kept package (see [3.3](#33-extends)).
26
-
27
- harnesspm reads files only. It never runs code from a dependency during discovery. Every dependency with a harness is included unless the project excludes it.
28
-
29
- ## 3.3 Extends
30
-
31
- `extends` lets a package pass on the harness of packages it builds on.
32
-
33
- ```json
34
- "extends": ["@tenphi/tasty", "@tenphi/glaze"]
35
- ```
36
-
37
- 1. Each name MUST be resolved **from the folder of the package that declares it**, so the version is the one that package uses. When copies with different versions remain, [3.5](#35-one-package-several-versions) picks one.
38
- 2. harnesspm follows `extends` recursively and stops with an error on a cycle.
39
- 3. Only `extends` passes harness on. A library's other dependencies, including its development tools, never reach its users.
40
- 4. A package's `exclude`, `replace` and `patch` change what it passes on. A middle package can fix an upstream rule for all its users.
41
- 5. An entry may name an optional peer dependency (`optional: true` in `peerDependenciesMeta`), which harnesspm skips quietly when it is not installed; any other entry that is not installed gives a warning.
42
-
43
- Example: an app depends only on `@cube-dev/ui-kit`, which extends Tasty and Glaze. The app gets all three, in the versions UI Kit installed.
44
-
45
- ## 3.4 Priority
46
-
47
- Packages in the dependency layer are ordered **upstream first**: a package comes after the packages it extends. Unrelated packages are ordered by name.
48
-
49
- | Situation | Result |
50
- | --- | --- |
51
- | A project entry repeats a unit ID of its own harness | The entry's unit wins. |
52
- | `exclude` names a unit or a package | It is dropped, with everything only it extends. |
53
- | `replace` names a rule or a skill | The new rule file, or the new skill folder, takes the unit's ID and place. A skill's new `SKILL.md` keeps the skill's `name`. Other units can't be replaced: exclude them and add one of your own. |
54
- | `patch` names a rule | Its sections change as defined in [02-package-format.md](02-package-format.md#25-rules). |
55
- | Two skills have the same name | The later one wins, with a warning. |
56
- | An override names a unit that does not exist | Warning. It usually means an upstream unit was renamed. |
57
-
58
- For one rule, harnesspm takes the original or the highest `replace`, then applies every patch from the layers above it, lowest layer first. A patch from a layer below the winning `replace` is dropped with a warning. For one skill, it takes the original or the highest `replace`. A replaced skill runs the files of the package that replaced it, so that package's trust applies to it ([6.1](06-trust.md#61-what-needs-trust)).
59
-
60
- When an upgrade changes a section that a patch replaces or removes, `harnesspm sync` warns and names the section, because the patch may now be out of date. The lock stores a hash of each such section to detect this.
61
-
62
- ## 3.5 One package, several versions
63
-
64
- Outputs point at one stable path per package ([04-outputs.md](04-outputs.md#42-stable-package-paths)), so harnesspm uses one version of each package in a repository:
65
-
66
- 1. A direct dependency of a workspace wins.
67
- 2. Otherwise the copy closest to a workspace in the `extends` chain wins.
68
- 3. Among equals, the highest version wins.
69
-
70
- harnesspm warns and names the versions.
71
-
72
- ## 3.6 Monorepos
73
-
74
- Workspaces come from the `workspaces` field of the root `package.json` or from `pnpm-workspace.yaml`.
75
-
76
- 1. Each workspace is resolved on its own dependencies, from its own folder. Backend workspaces do not get frontend rules.
77
- 2. Units that the root reaches, or that every workspace shares, are written once at the root. A rule with different text across workspaces is written in the workspaces that use it.
78
- 3. A workspace's own `harness/` belongs to that workspace. A workspace that another workspace depends on is still the project's own code, so it is in the project layer and trusted.
79
- 4. Executable units are written at the root, where both agents read them.
80
- 5. One version per package applies to the whole repository ([3.5](#35-one-package-several-versions)).
81
- 6. For a rule, a package's `patch` or `replace` applies where that package passes on the rule through `extends`. Root rules are available in every workspace, and each workspace gets its own overrides. Overrides from the root's own harness, `harnesspm.json` and added harnesses still apply across the repository within their usual scope.
82
- 7. Each agent gets one version of a skill, linked at the root. If its consumers resolve different replacements, or some resolve the original, harnesspm keeps the original and warns. `harnesspm why <skill ID>` explains which workspaces disagreed.
83
-
84
- ## 3.7 Project configuration
85
-
86
- `harnesspm.json` is committed. Every field is optional.
87
-
88
- ```json
89
- {
90
- "$schema": "https://unpkg.com/@harnesspm/cli/schema/harnesspm.schema.json",
91
- "exclude": ["@tenphi/glaze"],
92
- "patch": { "tasty:rules/lint-comments": "./harnesspm/patches/tasty-lint-comments.patch.md" },
93
- "trust": { "@cube-dev/ui-kit": true }
94
- }
95
- ```
96
-
97
- | Field | Default | Meaning |
98
- | --- | --- | --- |
99
- | `$schema` | — | The JSON schema, for editors. |
100
- | `exclude` | `[]` | Packages or unit IDs to drop. |
101
- | `replace` | `{}` | Rule or skill ID → path of a project file, or skill folder, that takes its place. |
102
- | `patch` | `{}` | Rule ID → path of a project patch that changes some of its sections. |
103
- | `trust` | `{}` | Which packages may run executable units. See [06-trust.md](06-trust.md). |
104
- | `telemetry` | off | Which events to send, and the handler that gets them. See [14-telemetry.md](14-telemetry.md). |
105
-
106
- The project's own `harness/`, if it has one, resolves like any harness package: its `extends` bring packages into the dependency layer, and its `exclude`, `replace` and `patch` apply here as they do for its users. `harnesspm.json` applies after it, for this repository only. So contributors see what users see, plus the repository's own changes.
107
-
108
- harnesspm writes outputs for both Claude Code and Codex. Outputs for an agent a person does not use cost nothing: they are per machine and excluded from git.