Skip to content

feat: replace for skills; fix sync for subfolder projects and built docs - #63

Merged
tenphi merged 1 commit into
mainfrom
claude/peaceful-maxwell-cu7qs6
Nov 23, 2026
Merged

tenphi merged 1 commit into
mainfrom
claude/peaceful-maxwell-cu7qs6

Conversation

@tenphi

@tenphi tenphi commented Nov 22, 2026

Copy link
Copy Markdown
Owner

In short

#62: a project below the git root

Cause: .git/info/exclude patterns start at the git root, but sync wrote them relative to the project folder (/.claude/… instead of /docs-site/.claude/…).

Fix:

What Before After
Entries /.claude/skills/x /docs-site/.claude/skills/x
Section the root's # BEGIN harnesspm # BEGIN harnesspm in docs-site/ (the root keeps the old name)
State file .git/harnesspm/state.json, shared .git/harnesspm/docs-site/state.json per project
add --local, telemetry file unprefixed line prefixed, via one shared addExclude()
doctor message "a ! pattern … brings it back", always names the real ! pattern and its file, or asks for a sync when no pattern matches
  • Migration: when the git root has no harnesspm.json, its unkeyed team section can only come from an older sync of a subfolder project. The next sync reads it as the project's last entries (so stale links are removed), then drops it.
  • Shared state file: this was a second bug in the same family. Two projects in one repository read each other's owned entries, so one project's sync could delete the other's generated sub-agent files. Now each project has its own file.
  • No doubled hooks: mergeHooks no longer adds a hook entry that's already in the file. So a project's first own state file (or any lost state) cannot double its hooks.

#56: replace for skills

  • A skill ID maps to a folder with its own SKILL.md. It keeps the skill's name, ID and place: links, lock hash, help and why all follow it. why shows replaced and original.
  • The folder is not a skill of its own (like a rule replacement in rules/), so there's no "two skills with one name" warning.
  • 🔐 Trust follows the files. A replaced skill gets the trust of the package that replaced it, or the project's trust for harnesspm.json. Without this, an untrusted package could add allowed-tools through a trusted package's skill. This applies to both the narrowed copy and the Skill(<name>) allow rule.
  • check validates a replacement folder: it needs a SKILL.md, and its name must be the replaced skill's name. replace of any other kind fails check and warns in sync, with a pointer to exclude.
  • I kept the scope to rules and skills: the units people adapt as text. Sub-agents, tools, hooks, MCP servers, permissions and docs have no scenario yet, and each would need its own trust handling.

#54: built docs in the project layer

  • In the project layer, a docs folder that git ignores (while git keeps the package's folder) is no docs unit for sync. A missing folder isn't one either. So the lock and the blocks are the same before and after a build.
  • An exclude of such a unit is silent, so Cookbook's current workaround keeps working without warnings and can be dropped later.
  • check is unchanged and still reads the built pages (check: docs built at prepack go unchecked, and links to files the tarball leaves out pass #52).
  • The dependency layer is unchanged: an installed package still counts whole.

Spec and docs

  • Spec 2.3, 2.4, 2.7 (new rule 6), 3.4, 4.1, 4.7, 6.1, 10.5 and 13.2. Also schema/harnesspm.schema.json, the guides, and the shipped harness rule and skills that said "whole unit".
  • Research: the Cookbook observations in motivating-case.md, and the git behaviors this relies on in package-managers.md (🔍, git 2.43).
  • Changesets: minor for skill replace, patch for the two sync fixes.

Tests

10 new tests, all 133 pass. I checked that each new test fails without its fix:

  • sync.test.ts: the subfolder project end to end (anchored entries, keyed section, migration from 0.9's section, stale link removed, git status clean, a second project at the root, its own state file). Also a middle package replacing an upstream skill, the project replacing it again, and the warnings for non-replaceable kinds.
  • exec.test.ts: a replaced skill takes the replacer's trust, both ways. A deleted state file doesn't double hooks.
  • doctor.test.ts: legacy entries ask for a sync. The subfolder-correct .git/info/exclude hint. The named ! pattern.
  • added.test.ts: add --local in a subfolder.
  • check.test.ts: replacement skill validation.
  • monorepo.test.ts: a built, git-ignored workspace docs folder gives the same lock and blocks before and after a build.

Also ran npm run typecheck, npm run check, npm run sync, npm run build plus the built CLI, build:docs + docs:check, and the issue's own init reproduction in docs-site/.


Generated by Claude Code

replace now works on skills. A skill ID maps to a folder with its own
SKILL.md, which keeps the skill's name, ID and place, so a package that
passes on another package's harness can adapt an upstream skill. The
folder is not a skill of its own. A replaced skill gets the trust of the
package that replaced it, so an untrusted package cannot add
allowed-tools through a trusted package's skill. For other units,
replace warns and check fails, and the spec now says rules and skills.

A project below the git root, such as docs-site/, wrote its
.git/info/exclude entries as if it were the root, so its links and
settings showed up in git status. Entries now start at the git root, in
a section named after the project's folder, and each project keeps its
own state file, so two projects in one repository never touch each
other's entries. A sync moves the entries an older version wrote into
the root's section. A hook already in a settings file is not added
twice, so a missing state file cannot double hooks. doctor names the !
pattern that brings a file back, and asks for a sync when no pattern
matches.

A docs folder of the project layer that a build writes and git ignores
made the lock and the blocks depend on whether a build ran. sync now
leaves it out, built or not, and an exclude of it no longer warns.
check still reads the built pages.

Closes #54
Closes #56
Closes #62

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Gr8S7GHqRx5sRwf2HJbJ8W
@github-actions

Copy link
Copy Markdown
Contributor

📦 Snapshot release

Published 0.0.0-snapshot.fc411e6.

npx @tenphi/[email protected] --help
npm install -D @tenphi/[email protected]

@tenphi
tenphi merged commit d4e2bef into main Nov 23, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 23, 2026

This branch was previously deployed

1 inactive deployment
release — 38b7d55b Deployed Nov 22, 2026 by tenphi via Snapshot release #94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants