Skip to content

install puts the official skills beside /sheep in every harness - #79

Merged
jamescalam merged 5 commits into
mainfrom
skill-402/official-skills
Nov 30, 2026
Merged

jamescalam merged 5 commits into
mainfrom
skill-402/official-skills

Conversation

@jamescalam

@jamescalam jamescalam commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

spacesheep install now also puts the official skills (@spacesheep/design, @spacesheep/docs, @spacesheep/sheets) beside /sheep in each harness, as native skill folders: ~/.claude/skills/design, ~/.codex/skills/design, ~/.gemini/skills/design, and so on. The harness's own skill picker then sends "design a landing page" to Design. Until now the agent had to follow sheep.md's "a skill from the library comes first" step, and Codex skipped it.

What changed

  • lib/official.js (new). For each skill it makes one card call to learn the current version, then one fetch through doors.takeFolder, the same code as skills get <name> -o <dir>, pinned to that version. The fetched folder is copied into each harness's skills folder and swapped in by rename, so no harness reads half a folder. Next to SKILL.md it writes one file of its own, .spacesheep-skill.json (skill, version label, number, hash). The other files match what the store sends, byte for byte.
  • Ownership. A folder is only replaced or removed when its marker names that same skill. If a person has their own skill with the same name, it's skipped and the output says so. The check runs three times: when the work is chosen, again after the fetch, and once more on the folder after it has been renamed aside, before the swap. A folder that fails any of these goes back untouched.
  • One writer at a time. Install, refresh and uninstall share one lock per machine, official-skills.lock. Install and uninstall wait up to 2 minutes for it. A refresh that finds it held does nothing, so a refresh can't put back a folder an uninstall took out. A lock whose process has gone is taken over.
  • skillTargets now gives each target a skillsDir. A Claude home whose /sheep comes from the plugin or from commands/sheep.md still gets <home>/skills/<name>.
  • Flags. --dry-run reports added, updated or unchanged and writes nothing. --skip takes a harness as before, or a skill name (--skip design). --no-skill leaves out all of them along with /sheep. mcp status and mcp uninstall include them, and --json gains official_skills.
  • Kept current. /sheep checks its version when it starts and replaces itself. These skills compare the same way but are refreshed by the CLI, outside any turn, because a folder fetch takes about 25 s. Doing it in the turn would put that wait before the first canvas, which is the delay this change removes. Refreshes happen:
    • on every install run;
    • once a day at a harness start: mcp (the bridge) and mcp headers (Claude Code's helper) start a detached spacesheep skills refresh, which only updates folders install put there. It runs only where install left its stamp (official-skills-check.json), never in CI, and not with SPACESHEEP_NO_UPDATE_CHECK or SPACESHEEP_NO_SKILL_REFRESH set. Each stamp value can be claimed once, by creating a claim file named after it (wx), so harnesses that start together start only one refresh. The child's error event is handled, so a failed spawn can't take down the harness's process.
  • skills refresh is a local command, like skills lint. The server's table has no verb by that name.

Tested

  • test/official.test.js (new, 11 tests; the 5 race and lock tests fail on fe174e9):
    • first install, a re-run (one card call), and a version bump, after which the old files are gone and every file comes from the pinned version;
    • --dry-run writes nothing;
    • a folder without the marker is left alone, and refresh never adds one;
    • uninstall removes only marked folders;
    • targets for the plugin and command-copy Claude homes;
    • --skip design, and the gate and once-a-day timing of the background refresh;
    • a folder marked for another skill; a folder made, or a refresh's folder removed, during the fetch;
    • the lock and taking over a stale one; one claim per stamp, and a spawn error;
    • --dry-run writing nothing to the config folder.
  • npm test: 406 tests, 403 pass. The 2 failures (start nudge… in talk.test.js, the launchd agent and systemd unit stay down… in machine.test.js) fail the same way on main on this machine. They depend on its PATH and local state. The repo has no lint script, so node --check was run on every file.
  • In a throwaway HOME with a real key:
    • install --dry-run listed 3 skills × 3 harnesses;
    • a real install wrote them (65 s with the fetches in sequence; they now run in parallel);
    • a re-run said "already set up" in 7.8 s;
    • the installed folder matches skills get -o apart from the marker.
  • A first --dry-run in a clean config folder still leaves the doors-table cache. The CLI's command dispatch (door() in bin/spacesheep.js) writes it for every command before the command runs, with or without --no-skill, and this PR doesn't change that.
  • Codex 0.172 with CODEX_HOME in that HOME and the prompt "Design a landing page for Tidewell, three directions on spacesheep. Don't ask." It read ~/.codex/skills/design/SKILL.md first, with no installs list and no live_link. fold.js start ran at 10.4 s and the empty canvas was live at 20.6 s.

Look closely at

  • Whether starting a detached process from mcp headers is acceptable. Claude Code runs that helper on every connect. The cost is one stat and one small JSON read, and the spawn happens only where install left its stamp.
  • If the plugin later carries the official skills too, Claude Code would list both design and spacesheep:design. Installs where the plugin is on may need chosenSkills to skip them then.

jamescalam and others added 5 commits November 29, 2026 22:10
spacesheep install now writes @spacesheep/design, @spacesheep/docs and
@spacesheep/sheets as native skill folders wherever it puts /sheep
(~/.claude/skills/design, ~/.codex/skills/design, ...), fetched with the
same code as `skills get <name> -o <dir>` at the store's current version.
The harness's own skill picker then routes "design a landing page" to
Design without the agent having to follow sheep.md's library step first.

- A folder is replaced or removed only when it holds install's
  .spacesheep-skill.json, so a person's own skill of the same name stays.
- Each skill is fetched once, then copied into each harness and swapped in
  by rename; a re-run at the same version costs one card call per skill.
- --dry-run, --skip (a harness, or a skill: --skip design), --no-skill,
  status and uninstall cover them.
- Kept current like /sheep (compare versions, replace the copy), but by the
  CLI rather than the agent, so a ~25 s fetch never lands before the first
  canvas: each install run, and once a day at a harness start (mcp and
  mcp headers start a detached `skills refresh`) where install put them.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
… an atomic daily claim

- A folder is written only when its marker names this skill (or, for a new
  install, nothing is there), checked when the work is chosen, again after
  the fetch, and once more on the folder moved aside before it's replaced:
  anything else goes back untouched.
- Install, refresh and uninstall hold one lock per machine
  (official-skills.lock): install and uninstall wait for it, a refresh
  that finds it held does nothing, so a refresh can't put back a folder
  an uninstall took out. A lock whose process is gone is taken over.
- The daily refresh is claimed by creating a claim file named for the
  stamp it read (wx), so of harnesses starting together exactly one
  starts it. The child's error event is handled, so a failed spawn can't
  end the harness's process.
- --dry-run reads the server's table without caching it.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
…sh lock is held

The lock was created empty (wx) and its record written after, so a
contender could read it empty, judge it stale and remove it while its
owner went on. The record is now written to a file of the process's own
and hard-linked into place. A lock that can't be read counts as held
until it is 15 minutes old, and a stale lock is moved aside and checked
before removal, so a contender's fresh lock isn't the one taken out.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
…th the file to delete

A lock is no longer removed for being old or for its owner being gone:
a 15-minute holder can be alive, and removing a stale lock races other
contenders. Instead, a lock whose owner isn't running is reported at
once (not waited on). install and uninstall say who holds it and which
file to delete, `mcp status` names it (official_skills_lock in --json),
and a refresh that skips writes official-skills-refresh.log, so a
crashed install can't leave the daily refresh skipping unseen.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
…n is held, not spun on

readLock took any read error for a missing lock, so withLock retried the
link at once, forever, and status reported nothing. Only ENOENT means no
lock now; anything else is the unreadable-lock case, reported with the
file to delete.

Co-authored-by: Pointman <noreply@pointman.ai>
Co-authored-by: Claude <noreply@anthropic.com>
@jamescalam
jamescalam marked this pull request as ready for review November 30, 2026 01:33
@jamescalam
jamescalam merged commit 3105491 into main Nov 30, 2026
6 checks passed
@0-security

0-security Bot commented Nov 30, 2026

Copy link
Copy Markdown

PR Security

PR Security did not run: your free credit is used. A workspace owner or admin can add a card in Usage & billing, then push again.

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.

1 participant