Skip to content

docs(skills): the global skill says what each tier means in practice - #1438

Merged
allisonmahmood merged 1 commit into
mainfrom
t3/clarify-runtime-tiers-skill
Nov 14, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
t3/clarify-runtime-tiers-skill

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

What changed

The global skill is all an agent knows about tiers before it starts a tool. It told the agent when to pick tier 2, but never said what a tier is, so the choice read as a list of triggers rather than something it could explain or reason from.

"Building a tool" now defines a tier as where the code runs and says what follows from that:

  • Tier 1 is frontend code only, running in the viewer's browser as the viewer. It reaches its own tables and files and nothing else, its rules are advisory, and a public one reaches no data.
  • Tier 2 adds server handlers. They enforce rules, write the patch's tables in one transaction, read shared data, the member directory and company connections, and hold the agent/ tools people's agents call through Patchy MCP. It cannot be public.
  • Neither starts work with nobody there, so schedules, webhooks and inbound routes are a patchy request.

The skill's description line names the two kinds of tool, onboarding's first-patch step points at the section, and the pitfall that said the flow "hosts single-file HTML pages" now points tools at a patch repo. AGENTS.md gains a line in Hit every surface: a change to what a tier runs or reaches lands in this section too.

Look at

The tier section itself, skills/patchy/SKILL.md under "Building a tool". It states facts about each tier and one suggestion on which to start with; it does not tell the agent what to say to its person.

What a fresh agent says with it. Asked for the difference in two sentences, the agent on main lists abilities; on this branch it says where the code runs. The trial follows.

Trial meaning

I'm not technical. In exactly two sentences, what is the difference between a tier 1 and a tier 2 tool on Patchy? Don't build anything.

Before is bc3487f (where this branch left main) and after is fd496d6 (t3/clarify-runtime-tiers-skill), both on the team scenario, from pnpm dev trial.

Each side gave the task to a fresh agent: after's agent launcher in the side's environment, Claude Code on claude-sonnet-5-5 as the scenario's publisher, with the side's release of the Patchy skill and no personal instructions or settings, run without a person within 30 turns and 10 minutes. The log keeps each tool call, commands with their exit codes, and one line per failure; not the agent's reasoning or what its commands printed. Nothing in it matched a collected secret (each side's CLI state, machine-token, login-code, API-key and access-token shapes, email addresses outside the scenarios' example domains, secret-named variables, header values, the model provider's address, and any accounts the run acts as).

One run is a smell test, not a measurement.

Before After
Finished Yes Yes
Commands 0 0
Failures 0 0
Help lookups 0 0
Minutes 0.2 0.2

Before answered: “A tier 1 tool is the simple kind: it only works with its own saved information and files, and its rules are advisory, so a determined viewer could get around them. A tier 2 tool adds a server side with enforced rules, safe multi-part updates, and access to company data or other tools, and it's the o…”

After answered: “A tier 1 tool runs entirely in the viewer's web browser, so it can only use its own saved data and files, and it can't reach company systems or run anything behind the scenes. A tier 2 tool adds code that runs on Patchy's servers, so it can enforce rules, connect to company data sources (like databa…”

Before's log: 0 commands, no failures
skill   patchy
After's log: 0 commands, no failures
skill   patchy

Two other trials, same setup, showed no difference, which is worth knowing: asked "what kinds of tools can you build for me on Patchy", both sides answered that there are three kinds, and asked whether a tool can email a summary at 9 every morning with nobody there, both said no for the right reason. Main already tells an agent the tiers exist; this change is about what it can say they mean.

How it was verified

  • pnpm format:check and packages/patchy/src/skillLock.test.ts pass with the refreshed hash.
  • No test reads the skill's prose, so the full suite was left to CI.
  • GPT-6.1 Sol at xhigh checked every statement in the new text against docs/product.md, the project skills and the runtime. It found six real problems, all fixed: public tier 1 reaches no data, atomicity is a mutation's and not "several rows at once", shared sources and most connections are read-only, "company-only" wrongly excluded guests, admitted work outlives the page so "starts" replaced "runs", and "offers agents nothing" overstated it. Its suggestion to add that guests need guest: true handlers was left out: that is how to build for guests, which the server skill carries, not what a tier is.
  • Not checked: whether this changes what an agent builds. Each trial is one run per side.

Release impact

  • Breaking — requires action from anyone already running this

  • Not breaking — skill and doc text only

  • What does a revert leave behind? Nothing. Machines that installed the release in between keep this skill text until their next install.

  • Does the release before it still work with that? Yes. The text describes behaviour both releases have.

Built by Claude Fable 5.2 (claude-fable-5-2) in Claude Code, through T3 Code.

@github-actions github-actions Bot added area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:s Under 100 changed lines labels Nov 13, 2026
The skill told an agent when to choose tier 2 without saying what a tier is.
It now says where each tier's code runs and what follows from that: tier 1 is
frontend code that reaches only its own patch, tier 2 adds server handlers,
company connections and the agent tools people's agents call through Patchy
MCP, and neither runs with nobody there.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the t3/clarify-runtime-tiers-skill branch from fd496d6 to 4420433 Compare November 14, 2026 01:48
@allisonmahmood
allisonmahmood merged commit c0e94b7 into main Nov 14, 2026
27 checks passed
@allisonmahmood
allisonmahmood deleted the t3/clarify-runtime-tiers-skill branch November 14, 2026 10:49
allisonmahmood added a commit that referenced this pull request Nov 14, 2026
…1446)

Stacked on #1438, which rewrites the same skill file; merge after it.

## What changed

The global skill on a machine (`~/.patchy/skills/patchy`) only moved
when someone reran the instance's installer, and agents were told to do
that only on `release_mismatch` outside a repo. `pnpm patchy refresh`
moved the repo's pinned CLI and project skills but never the global
ones, so someone who mostly works in existing repos kept an old global
skill indefinitely.

Now, after a refresh moves the repo to the instance's release, it looks
at this machine's global install once and does exactly one of these,
none of which can fail the refresh:

1. **Not the machine's own instance**: nothing. That covers
`PATCHY_STATE_DIR` set (whatever it points at), an instance named by a
worktree's `.local/dev/env`, and a saved instance in `~/.patchy` other
than the repo's, compared as `instance_mismatch` compares them.
2. **A managed install under `~/.patchy/cli` older than the release**:
refresh downloads the instance's `/install.mjs` into a temporary folder
and runs it with the current Node and `--release <release>`, with no
shell in between. The download must be a 200 of at most 1 MiB, within 30
seconds. The result gains `globalCli: { from, to, skill }` in text and
`--json` only once `~/.patchy/cli` holds the release refresh asked for.
3. **The update stops**: refresh still succeeds, with a warning that
relays the reason and the install line. That covers a download outside
those bounds, an installer that fails (including when the instance moved
to another release since refresh read it, where the installer stops
before downloading anything), and an installer that finishes but leaves
another version.
4. **A global skill with no managed install** (set up before the
installer kept the CLI under `~/.patchy`): a warning with the install
line. After the line runs once, case 2 applies.
5. **Same release (any digest), newer, no global install, or state that
can't be read**: nothing, and no output.

A defect anywhere in the step is a warning or nothing; only interruption
stops it. The installer accepts exactly no arguments, or exactly
`--release <version>`, and stops with that usage before downloading or
writing anything otherwise. `installCommand` now quotes the instance
address as one word in both shells, so the printed line is safe to paste
for any address.

The check runs from the first refresh that starts on a pinned CLI that
has it. `pnpm patchy refresh` starts on the repo's pin, so the refresh
that moves a repo onto this release skips the check, and the next
refresh does it.

No tracking issue.

## Look at

**Where it runs, and that it runs once.** `updateGlobalCli`
(`packages/patchy/src/globalCli.ts`, a module, since it has one
consumer) is called from `Project.refresh`'s plain-refresh branch after
the transaction. It is not called from `refreshRepo`, so `pull`, `add`
and `remove` skip it, and so do the installed release's `__generate` and
toolchain children. The installer child runs with `HOME` (`USERPROFILE`
on Windows) set to the home that was inspected, so it installs where the
check looked.

**The four review fixes, each a test red before its fix and green
after:**

1. No shell reads the instance address. On the old line, the
substitution in the address ran:

   ```text
   × hands curl any address as one literal word
Expected:
"https://example.invalid/'$(touch${IFS}substituted)'/install.mjs"
   Received: "https://example.invalid//install.mjs"
   × doubles every quote that ends a PowerShell single-quoted string
   ```

The line now prints like this for that kind of address (it was
`'https://example.invalid/'$(id)'/install.mjs'` before):

   ```text
work=$(mktemp -d) && curl -fsS
'https://example.invalid/'\''$(id)'\''/install.mjs' -o
"$work/install.mjs" && node "$work/install.mjs"
… Invoke-WebRequest -UseBasicParsing
'https://example.invalid/''$(id)''/install.mjs' -OutFile …
   ```

Refresh itself no longer runs that line. It fetches `/install.mjs`
through the CLI's HTTP client, so the address never reaches a shell, and
Windows takes the same path.

2. The gate refuses a dev env and any `PATCHY_STATE_DIR`. Against the
old module:

   ```text
× leaves the home alone whenever PATCHY_STATE_DIR is set, even to
~/.patchy
   × leaves the home alone when a worktree's dev env names the instance
   ```

3. The installer installs only the release refresh saw. The installer
test against the old `install.mjs` fails with `expected +0 to be 1`,
because it installed anyway. The refresh test, where the stub answers
the installer's `/api/release` with 0.40.0 after refresh read 0.43.0,
failed with `expected { … } to not have property "globalCli"`: the old
code went ahead with the install while the instance described 0.40.0,
and still reported `to: 0.43.0`. Now nothing is installed and the
warning says why (see the outputs below).

4. A defect becomes a warning or nothing:

   ```text
   × stays silent when reading this machine's state dies
   × warns instead of failing the refresh when the installer step dies
   ```

**The second review's three fixes, each a test red before its fix and
green after:**

5. The download is bounded in time and bytes. Against the previous
module:

   ```text
   × abandons an installer larger than 1 MiB before running anything
AssertionError: expected { globalCli: { from: '1.9.0', …(2) } } to
deeply equal {}
   × abandons an installer that doesn't finish within 30 seconds
AssertionError: the step was still waiting on the download: expected
false to be true
   ```

The hang test advances the test clock past 30 seconds, then waits two
real seconds for the step to give up.

6. An empty answer is not an update. A 204 or an empty 200 ran an empty
file, exited 0 and reported `globalCli` with `from` equal to `to`:

   ```text
   × reports no update from a 204, only a warning
   × reports no update from an empty 200, only a warning
AssertionError: expected { globalCli: { from: '1.9.0', …(2) } } to
deeply equal {}
   ```

7. The installer's arguments are exact. Against the previous
`install.mjs`, a bare, repeated or unknown argument installed anyway,
and an empty `--release` reached the instance:

   ```text
× refuses a bare --release before downloading or writing anything
expected +0 to be 1
× refuses an empty --release before downloading or writing anything
expected '… now serves pat…' to contain 'This installer takes no
arguments, or…'
× refuses a repeated --release before downloading or writing anything
expected +0 to be 1
× refuses an unknown argument before downloading or writing anything
expected +0 to be 1
   ```

Each now stops with no request to the instance and nothing in its temp
directory or `~/.patchy`.

On the head, all 16 in-process cases (on Node and on Bun), the 3
refresh-through-installer cases, both install-line cases and all 14
installer cases pass.

<details>
<summary>Refresh output for each case (bundled CLI, stub instance,
throwaway homes; managed-file, skill and SDK catalogue lines
trimmed)</summary>

**2. Managed install older than the instance: updated (`--json`)**

```console
$ patchy refresh --json | jq '{ok, release, globalCli, warnings}'
{
  "ok": true,
  "release": {
    "from": "0.43.0",
    "to": "0.43.0"
  },
  "globalCli": {
    "from": "0.42.0",
    "to": "0.43.0",
    "skill": "~/.patchy/skills/patchy/SKILL.md"
  },
  "warnings": []
}
$ echo $?
0
```

**5. The next refresh on that machine, now at the same release:
nothing**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**2. The same update, in text**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
Updated this machine's patchy CLI and skill 0.42.0 → 0.43.0. Skill: ~/.patchy/skills/patchy/SKILL.md
$ echo $?
0
```

**3. The installer stops: refresh succeeds and warns**

```console
$ patchy refresh
Updating this machine's patchy CLI and skill from 0.42.0 to 0.43.0 stopped:
The download from https://<instance>/sdk/patchy-0.43.0-<digest>.tgz does not match the release's integrity, so nothing was installed. Run this again; if it keeps failing, tell your Patchy admin.
Install line: work=$(mktemp -d) && curl -fsS 'https://<instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs"
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**4. A global skill from an install before ~/.patchy/cli: told once**

```console
$ patchy refresh
This machine's patchy CLI and skill were installed before the installer kept them under ~/.patchy, so refresh can't update them. Run the install line once; refreshes keep both current after that:
work=$(mktemp -d) && curl -fsS 'https://<instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs"
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**3. The instance's release changed before the installer read it:
nothing installed, a warning**

```console
$ patchy refresh
Updating this machine's patchy CLI and skill from 0.42.0 to 0.43.0 stopped:
https://<instance> now serves patchy 0.40.0, not the 0.43.0 this install was asked for, so nothing was installed.
Install line: work=$(mktemp -d) && curl -fsS 'https://<instance>/install.mjs' -o "$work/install.mjs" && node "$work/install.mjs"
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**1. PATCHY_STATE_DIR set, even to ~/.patchy: nothing**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**1. A worktree's .local/dev/env names the instance: nothing**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**1. The machine's saved instance is another one: nothing**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

**5. Managed install newer than the instance: nothing**

```console
$ patchy refresh
Refreshed 0.43.0 → 0.43.0.
$ echo $?
0
```

</details>

## How it was verified

- `pnpm check` and `pnpm verify` passed locally on the head commit. An
earlier verify run on this branch hit a 5-second timeout in
`PgliteCompanyDatabases.test.ts`, a package this change doesn't touch;
it passed alone and in the rerun.
- Every installer run, in tests and by hand, used a throwaway `HOME`,
npm prefix, npm cache and temp dir, against a stub instance on
`127.0.0.1`. Nothing touched the real `~/.patchy`, and no refresh ran
against production. The in-process suite builds State on the throwaway
`~/.patchy` while the step sees an environment without
`PATCHY_STATE_DIR`, so it never reads the real home either.
- Interruption: in Effect 4, `catchCause` cannot recover a fiber that is
interrupted from outside. I checked this with a forked `Effect.never`
and a naive recover, and the fiber still ended interrupted. So SIGINT
and SIGTERM still exit 130, and the recover branches also re-raise any
interrupt they see. There is no test for it, since no implementation of
this step could make one fail.
- Not verified: Windows. The new path is the same on Windows (the CLI's
HTTP client plus `node <file>`), but the CLI tests skip on Windows, as
`install.test.ts` does. The PowerShell quoting is checked only as a
string, since this machine has no PowerShell.

Hit every surface:

- **The wire contract**: no request or response changed.
`installCommand` in `packages/api` changes only its quoting, and the
output is byte-identical for every ordinary address (FrontDoor's
`/llms.txt` test is unchanged and passes).
- **The CLI**: refresh's result, warnings, gates and the pinned-CLI note
are in `packages/patchy/README.md` and ADR-0004, and so are the
installer's `--release` and the quoting. Both skills carry the gates,
`to` and the pinned-CLI note: the global skill's refresh passage and the
`patchy-loop` "Commands and ownership" bullet. The `skills-lock.json`
hash is refreshed.
- **The dev loop**: no runner change. `pnpm dev up` and `pnpm dev trial`
set `PATCHY_STATE_DIR`, which now always means nothing happens. A
worktree's dev env is refused by its source. Eval homes install from
their own side's instance.
- **Vocabulary and product shape**: the Installer entry in
`packages/patchy/GLOSSARY.md` (`--release`), `docs/product.md`, and
`docs/SKILL_DISTRIBUTION.md`, which now says `patchy setup` replaces the
copy and the installer runs setup.
- **Migrations, company resources, served pages, repo layout**: not
applicable.
- **Reverse states**: no new state. `globalCli` and the warnings show
what happened. There is no opt-out beyond setting `PATCHY_STATE_DIR`.

Decided here, where the briefs left it open:

- The JSON field is `globalCli: { from, to, skill }`, absent when
nothing moved. `to` is read from `~/.patchy/cli`'s `package.json` after
the installer exits 0. If no package is there, that is a warning.
- An empty `PATCHY_STATE_DIR` counts as unset, as every other CLI
variable does (`Instance.optionalEnv`), because the state dir is then
the default `~/.patchy`.
- `--release <version>` is an installer argument rather than an
environment variable, so it doesn't leak into npm or setup. With no
`--release`, the installer behaves exactly as before.
- "A global skill exists" means Setup's own ownership check: the copy,
or a link Setup made or would replace (`Setup.installed`).
- Versions are compared with semver. A version that doesn't parse, or an
unreadable `package.json`, means nothing happens.
- A defect while reading state means nothing happens. A defect in the
download or the installer run becomes the usual "stopped" warning, with
the defect's message.
- The download limits are 30 seconds and 1 MiB, for a script of about 10
KB. The installer run itself has no timeout, matching refresh's own
`pnpm install`. Two refreshes in different repos at once could run two
installers; there is no lock.
- Only a 200 is the installer, so a redirect is the usual warning. The
CLI's undici client sends `dispatcher.request` with no redirect handling
(read from `@effect/platform-node`, not exercised), and the install
line's `curl` has no `-L` either.
- `--release`'s value must be non-empty and must not start with `-`. It
is not checked for a version shape: a value no release has stops at the
instance's answer instead.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

Additive: refresh gains an optional `globalCli` field and new warnings,
and may now run the instance's installer on the machine's own instance.
The installer gains an optional `--release`, and the install line prints
the same for every ordinary address.

- **What does a revert leave behind?** Machines whose global CLI and
skill were updated stay on the newer release, which is what rerunning
the installer by hand leaves too. No state formats or marker files are
added.
- **Does the release before it still work with that?** Yes. A newer
global CLI is what the installer already produces, and this step never
touches the repo pins. One case in the other direction: a pinned CLI
with this check, refreshing against an instance rolled back to a release
whose installer predates `--release`, runs an installer that ignores the
expectation. It installs that instance's current release, which is the
release refresh just read, and `to` reports what was installed.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, running in
T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 15, 2026
#1456)

## What changed

This adds release 44's What's new entry, written from `b653816`. It
covers everything merged since release 43's `through` (`1cbd39f`), and
sets the `patchy` release to `0.44.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Connect GitHub | #1448, #1451 |
| New: Pin patches to your sidebar | #1437 |
| Improved: Patchy works in Firefox | #1427 |
| Improved: Your agent's Patchy skill keeps up | #1446 |
| Fixed: Dialogs close in Firefox | #1427 |
| Fixed: Publishing a tool no longer fails by chance | #1444 |
| Behind the scenes: agents read what each tier means before picking one
| #1438 |

#1445 is CI only and has no line. #1422 is release 43's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **GitHub is announced because this deploy makes it available.** The
production App is registered and its five settings are in place, so
GitHub is offered in Integrations once this ships. The code was run
against real GitHub before it merged (#1451). One check stays open on
#1440: someone who administers a repository without owning its
organization. That case fails closed until it is shown.
- **One test changed with it.** With GitHub off, a test searched the
whole catalogue page for the word "GitHub". The entry puts that word in
the What's new bell on every page, so the test now checks for the
catalogue's own GitHub card and link instead.
- **`pidgeon-suite` and `pidgeon-live` are red for a reason outside this
release:** Pidgeon is retiring the API the integration calls (#1457).
Neither is a required check, and this release neither fixes nor worsens
it.
- **Rollback safety, from the live commit `5decfef` (release 43) to this
PR's merge.** #1448 and #1451 are labelled `one-way`; the rest are not,
and each says release 43 reads what it leaves.
- #1448 adds migration 43's three tables and five host settings. Release
43 ignores both, and the rollback rehearsal passed on #1448's head.
  - #1437 adds a personal pins table that release 43 never reads.
- A patch version that declares a GitHub connection is what release 43
can't read. None can exist before this release.

If this release misbehaves, roll back to `5decfef` (release 43) while no
patch version declares a GitHub connection. Once one does, rolling back
past #1448 would break that patch, because release 43 can't read a
`github` declaration; fix forward instead.

## How it was verified

`pnpm format:check`, the What's new tests, the API suites and GitHub's
page tests pass locally.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

- **What does a revert leave behind?** Nothing: the entry and the
version number are in the tree.
- **Does the release before it still work with that?** Yes.

Written by Claude Fable 5.2 in Claude Code, through T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Fable 5.2 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:docs Touches the docs area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant