Repository navigation
feat: opt-in telemetry; why for every unit - #3
Merged
Merged
Conversation
- ci.yml: typecheck, tests and `npm run check` on Node 24, and the built CLI (`--help`, `check`, `sync --check`) on Node 20 for `engines`. - release.yml: every PR publishes `0.0.0-snapshot.<sha>` under `pr_<number>` with a sticky comment; pushes to main open the version PR or publish with provenance, a `v<version>` tag and a GitHub Release. Both jobs use npm trusted publishing in the `release` environment. - Changesets replace the hand-written "Unreleased" line; AGENTS.md describes the new flow. The 0.1.0 notes stay in CHANGELOG.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
npm refuses a provenance statement from a private repository (E422), and with trusted publishing it adds one by itself once the repository is public. Also print the real OIDC availability in the publish jobs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
A re-run builds the same commit, so it got the same snapshot version, and npm never accepts a version twice. Add the attempt number on a re-run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
…ions `harnesspm why` found only rules, skills and docs, so it answered "No unit" for the script IDs the managed block prints. It now finds every unit kind, shows its source file, the command that runs a script, and whether the package of an executable unit is trusted. Test fixtures use `alex`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Contributor
📦 Snapshot releasePublished |
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
5 tasks done
A team turns on `telemetry` in harnesspm.json: which events, and a handler that gets them, a command (JSON on stdin) or a JSON Lines file. harnesspm sends events for script runs, MCP server starts, sync and why. With agent events on, a person's sync writes harnesspm's own async hooks: Claude Code reports reads of harness files, skills it loads and file-scoped rules it loads by itself; Claude Code and Codex report session starts. The hook runs the local binary (`track`), maps the path to a unit with an index that sync writes, hands the event off and exits 0. Events never hold arguments, file contents, prompts or absolute paths, and cover only the dependency and project layers. Sending never waits or fails a command: a command handler runs in a detached process with a 10 s limit. A handler gets events only as a person's sync recorded it in the lock. A model run keeps the recorded handler, so one an agent adds stays held until a person syncs. A person opts out with DO_NOT_TRACK=1 or "telemetry": false in harnesspm.local.json or ~/.harnesspm/config.json. Spec: new chapter 14 (with a rule template for reporting harness problems), terms and scenarios S14 and S15, 3.7, 4.3, 5.1, 6, 10, 11, and removed options in 13.12. Research: hook payloads and async hooks for both agents, from the docs, Codex source and a headless Claude Code probe. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
When a package's `extends` names a package that is not installed, sync warns. A package can now list an extends target as an optional peer dependency (`optional: true` in `peerDependenciesMeta`): projects that install it get its harness through the package, and projects that do not see no warning on every sync. Any other missing extends still warns. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Claude Code matches a `paths` pattern without a leading `/` at any depth. So `harness/**` loaded harnesspm's config rule whenever an agent only read a dependency's harness files in node_modules. A probe with Claude Code 2.1.323 showed that `/harness/**` loads for the project's own folder only, both as a plain file and as a symlink in .claude/rules/. - harnesspm-config: `/harnesspm.json`, `/harnesspm.local.json`, `/harness/**` - pointer lines show patterns without the leading `/` - spec 2.5 and the export skill say how to anchor a pattern - research: the probe result Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV
Merged
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request has four changes:
whyfor every unit. The original fix in this PR.extends. A missing optional peer no longer warns.1. Telemetry
Decisions
harnesspm.json, which is committed.reportcommand. Reporting harness problems is the project's own rule, not a harnesspm feature. Spec 14.8 gives a rule template. Aharnesspm reportcommand is recorded in 13.12 as a removed option, with what would bring it back.Config
{ "telemetry": { "events": "all", "send": { "file": ".harnesspm/events.jsonl" } } }sendis required. It is either a command, which gets each event as JSON on stdin, or{ "file": "<path>" }, which appends JSON Lines.eventsdefaults to"all". It can also be a list of the types below.schema/harnesspm.schema.jsonhas the new field.Events
runexitandduration. A hook's script is arunwith callerhook.mcpsyncsyncwrites outputs. Has packages and versions, unitsadded,removedandchangedsince the last lock, andpendingpackages.whywhyfinds a unit.readvia(toolorauto) and, for docs,page.skillsessionsource.Every event has these common fields:
schema(harnesspm.event/1),time,project,workspace,harnesspm(its version),caller(person,agent,hookorci),agent,session,unit,packageandversion.Events never hold:
Sending never waits or fails
node_modules/.harnesspm/telemetry.log. Nothing is printed, and no exit code changes.Trust
The model is the same as for hooks (spec 6.2, rule 4):
harnesspm.lock.jsonas"telemetry": { "send": … }.sendinharnesspm.jsonmatches the lock.syncandstatussay so, until a person runssyncorapprove.sync --checkfails while the lock andharnesspm.jsondiffer, so a reviewer sees the change.Opting out on one machine. Each of these stops every event, and the next sync removes the hooks:
DO_NOT_TRACK=1(now listed in spec 11);"telemetry": falseinharnesspm.local.json, which sync now keeps out of git;"telemetry": falsein~/.harnesspm/config.json.What agents see
Claude Code. A sync that a person runs writes these entries into
.claude/settings.local.json:PostToolUsewith the matcherRead|Skill;InstructionsLoadedwith the matcherpath_glob_match;SessionStart.All are
"async": true. Each runs<project>/node_modules/.bin/harnesspm track --agent claude, not npx.Codex. Only
SessionStart, in.codex/hooks.json. Codex has no tool that reads a file: it reads through its shell tool, which hooks see asBash. So areadorskillevent cannot be mapped to a unit reliably, and Codex sends neither (sourced in the research doc).How
trackworks.node_modules/.harnesspm/telemetry.json.0, printing nothing.cli.tsloads only the telemetry module fortrack. A call takes about 35 ms, close to a barenodestart (about 30 ms); other commands take about 70 ms.Always-on text is unchanged. The managed block gets nothing new.
Hook facts checked
Readpassestool_input.file_path, andSkillpassestool_input.skill.SessionStartpassessourceandsession_id.asynchooks fire in-pruns, and-pkills async hooks still running at teardown. That is why delivery runs in a detached process.CLAUDE_CODE_SESSION_IDreaches the commands the model runs.SessionStartinput fields, and theasyncfield on hooks.docs/research/agent-capabilities.md, with ✅ or 🔍 marks.End-to-end run
Setup:
npm packof this branch, installed in a scratch project with an isolatedHOME.@acme/kitwith an always-on rule, a file-scoped rule for**/*.tsx, a docs folder, a skill and a script.Steps and results:
initrun by the agent. The handler was held, andstatussaid why.syncrun by a person. It recorded the handler and wrote the async hooks.claude -prun with the prompt "Add a kit Button to src/App.tsx that says Save. Then review the file with the kit-review skill." It sent these events:{"schema":"harnesspm.event/1","type":"run","time":"2026-11-13T15:17:49.159Z","project":"e2e-app","workspace":".","harnesspm":"0.1.1","caller":"agent","agent":"claude","session":"c491e094-…","unit":"kit:scripts/probe","package":"@acme/kit","version":"1.0.0","exit":0,"duration":30}harness-reports.mdwithharnesspm whyoutput. The prompt was "Add a kit Card titled Profile…". The kit's docs listCard, but its probe script does not know it.npx harnesspm whyforkit:docsandkit:scripts/probe.harness-reports.md, reverted its edit and explained.runwithexit: 1, then twowhy.Bash(npx harnesspm why *)allowed. Spec 14.8 says so.Found along the way, and recorded in the research doc:
Readthrough a symlink whose target is outside the project, so afile:dependency's stable path cannot be read in headless runs.pathspattern without a leading/matches at any depth. Fixed for harnesspm's own rule in section 4.Reporting harness problems (spec 14.8)
A copyable rule for the project's harness. Add it with
npx harnesspm new rule reporting-harness-problems:The agent files the ticket with its own tools, such as the Linear MCP server.
Example handlers in spec 14.7:
filelogreceiver that tails the JSON Lines file, with no code in harnesspm.Spec and dogfooding
Spec changes:
14-telemetry.md.harnesspm's own harness:
harnesspm-configrule says agents changetelemetryonly when asked.harnesspm-importskill says how to turn telemetry on.harnesspm.jsondoes not turn telemetry on. That would install hooks on every contributor's machine, so it is the maintainer's call.2.
whyexplains every unit (the original change)The managed block prints an ID for every script, such as
(tasty:scripts/styles). Butharnesspm whylooked up only rules, skills and docs, so it answeredNo unit tasty:scripts/stylesfor those IDs. The Glaze, UI Kit and Tasty pilots all hit this.whynow finds every unit ID in spec 2.8: scripts, hooks, MCP servers, sub-agents and permissions too.hooks.json,mcp.jsonorpermissions.json.yes,pinned, or how to turn it on). This is what an agent needs when a tool does not run. Permissions get no trust row, because deny and ask rules need no trust (6.1).Spec 10: the
whyrow says it works for every unit ID and what it adds for scripts and executable units.3. Optional peers in
extendsextendsmay name an optional peer dependency (optional: trueinpeerDependenciesMeta).extendsstill warns.@tenphi/eslint-plugin-tastythis way. Projects with the lint plugin get its harness through UI Kit, and projects without it see no warning on every sync.4. harnesspm's config rule loads only for the project's own files
Problem.
harnesspm:rules/harnesspm-confighadpaths: ["harnesspm.json", "harnesspm.local.json", "harness/**"]. Claude Code matchedharness/**at any depth. So the rule loaded whenever an agent only read a dependency's harness file, such asnode_modules/.harnesspm/pkgs/@tenphi/tasty/harness/…. Every project that depends on harnesspm got this noise.Probe (headless Claude Code 2.1.323, an
InstructionsLoadedhook that logs each load):vendor/pkg/harness/deep.mdharness/top.mdharness/**, plain fileharness/**, symlink in.claude/rules//harness/**, plain file/harness/**, symlink in.claude/rules/The docs' example says
src/**/*matches only the project'ssrc/. In practice, only a leading/anchors a pattern.Fix:
/harnesspm.json,/harnesspm.local.jsonand/harness/**.AGENTS.mdshow patterns without the leading/, so they read the same as before. A bare/harnesspm.jsoncould look like an absolute path to Codex.harnesspm-exportskill say to start a pattern with/to match only the project's own folder./in the.claude/rules/link but not in the pointer line; and every pattern in harnesspm's own file-scoped rules starts with/or**/.Trade-off. A workspace's own
harness/folder (spec 3.6) no longer triggers this rule. A pattern that matched it would also match a dependency'snode_modules/<package>/harness/. Workspace harnesses are rare; dependency reads happen in every consumer.Verified
npm run typecheck,npm test,npm run checkandnpm run syncpass. There are 65 tests: 7 new for telemetry, 1 for optional peers and 2 for anchored patterns.minorfor telemetry;patchfor optional peers;patchforwhy;patchfor the anchored config rule.🤖 Generated with Claude Code
https://claude.ai/code/session_01Gr8S7Ed6WF7j8cpXBKzCuV