Skip to content

docs(sdk): routing is in the skills - #1095

Merged
allisonmahmood merged 2 commits into
mainfrom
docs/route-skills-1088
Oct 31, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
docs/route-skills-1088

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

What changed

An agent asked for pages at their own paths couldn't find patchy.route in any project skill. In #1052's trials, one read the generated .d.ts files to find it. Now patchy-preact has a Routes section: what get, set and subscribe do, the path rules, and that a link calls set instead of navigating the frame. patchy-loop points framework-free pages at that section. The patchy-preact description adds "give pages paths of their own" so agents reach for the skill when they need routes.

Closes #1088

Look at

The Routes section in packages/sdk/skills/patchy-preact/SKILL.md. It states facts and gives no router recipe, and it never says when to add routing. Each line was checked against the code. Three facts go beyond the README's routing paragraph:

  • Setting the path already shown still pushes a history entry, and no listener hears about it. The broker always calls pushState, and the client skips an unchanged path.
  • Every % in a path has to begin a valid escape. The broker's decodeURIComponent refuses anything else.
  • A frame that navigates loses its connection to Patchy. The broker stops the session on the frame's second load.

A fresh agent with the skill vs without it. Same task on both sides, Sonnet 5.5. The before agent grepped node_modules/patchy/dist/*.d.ts and the package README to find routing. The after agent found Routes in the skills, opened no .d.ts file and answered that patchy.route.set and subscribe change the address:

Trial routes

Build me a small team handbook patch: a Home page, a People page and a Policies page, each at its own address, so I can send someone a link straight to one page and the browser back and forward buttons work. Publish it when it works. Start your reply with one sentence on what in the page code changes the address.

Before is 2449055 (where this branch left main) and after is 66bc56d (docs/route-skills-1088), both on the team scenario, from pnpm dev trial. Those are the commits before the branch was rebased onto Preact 11. The routing text hasn't changed since, and acceptance re-ran a fresh agent at 8f2e238.

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 60 turns and 20 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 and login-code shapes, email addresses outside the scenarios' example domains, secret-named variables, and any accounts the run acts as).

One run is a smell test, not a measurement.

Before After
Finished Yes Yes
Commands 15 12
Failures 6 4
Help lookups 0 0
Minutes 1.9 1.8

Before answered: “The page changes its address by calling patchy.route.set(path) from the nav link click handler go in src/App.tsx, and it reads the address back with patchy.route.get() and patchy.route.subscribe(), which also report back and forward. I haven't published it.”

After answered: “The page changes the address through patchy.route.set(path) (called from the nav links) and patchy.route.subscribe. That is Patchy's routing API, not the History API I first named.”

Before's log: 15 commands, 6 failures
skill   patchy
denied  $ ls -la && patchy status --json; patchy whoami --json; ls .claude/skills/patchy/references
        ls in '<env>/cli/node_modules/patchy/skills/patchy/references' was blocked. For security, Claude Code may only list files in the allowed working directories for this session: '<env>/workspace', '/tmp/…
exit 0  $ ls -la; patchy status --json; patchy whoami --json
exit 0  $ patchy init team-handbook --tier 1 --purpose "Team handbook with Home, People and Policies pages, each at its own shareable address." --json 2>&1 | tail -20
exit 0  $ patchy look --json > <tmp>/look.json; head -c 600 <tmp>/look.json
exit 0  $ cd <env>/workspace/team-handbook && cat AGENTS.md | head -60; cat .agents/skills/patchy-loop/SKILL.md | grep -n -i -B3 -A25 "route"; cat src/main.tsx src/App.tsx; ls; ls .agents/skills/patchy-look; gr…
exit 0  $ grep -rn -i "route" .agents/skills/*/SKILL.md patchy/_generated/README.md patchy/_generated/client.ts | head -30; cat patchy.config.ts; cat src/styles.css | head -30; cat .agents/skills/patchy-look/SK…
exit 0  $ cat patchy/_generated/client.ts | head -40; grep -rln "route" node_modules/patchy/ 2>/dev/null | head;
exit 0  $ grep -n -i -B2 -A12 "route" node_modules/patchy/README.md | head -80; ls node_modules/patchy/dist/*.d.ts | head; grep -n -i -A8 "route" node_modules/patchy/dist/client.d.ts | head -50
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/team-handbook/patchy.config.ts
write   <env>/workspace/team-handbook/src/App.tsx
read    <env>/workspace/team-handbook/src/styles.css
edit    <env>/workspace/team-handbook/src/styles.css
exit 0  $ pnpm patchy refresh 2>&1 | tail -5; pnpm typecheck 2>&1 | tail -15; pnpm lint 2>&1 | tail -10
exit 0  $ pnpm patchy dev --json 2>&1 | tail -20; sed -n 1,200p .agents/skills/patchy-loop/SKILL.md | grep -n -i -E "browser|playwright|screenshot|exercise" | head
denied  $ which chromium chromium-browser google-chrome google-chrome-stable firefox 2>/dev/null; ls ~/.cache/ms-playwright 2>/dev/null; cd <env>/workspace/team-handbook && curl -s -o /dev/null -w "%{http_code}…
        This Bash command contains multiple operations. The following parts require approval: ls ~/.cache/ms-playwright, curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:36699/dev/localdev0000/people
exit 4  $ which chromium chromium-browser google-chrome google-chrome-stable firefox
        /usr/bin/chromium
denied  $ cd <tmp> && curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:36699/dev/localdev0000/people; timeout 60 chromium --headless --no-sandbox --disable-gpu --user-data-di…
        This Bash command contains multiple operations. The following part requires approval: cd <tmp> && curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:36699/dev/localde…
denied  $ curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:36699/dev/localdev0000/people
        This command requires approval
After's log: 12 commands, 4 failures
skill   patchy
exit 0  $ ls -a && patchy status --json && patchy whoami --json
exit 0  $ patchy init ./team-handbook --tier 1 --purpose "Team handbook with Home, People and Policies pages, each at its own linkable address." --json 2>&1 | tail -20; cd team-handbook && ls && cat AGENTS.md |…
exit 0  $ cat .agents/skills/patchy-preact/SKILL.md .agents/skills/patchy-look/SKILL.md; grep -n -i -B2 -A25 "route" .agents/skills/patchy-loop/SKILL.md | head -120; cat src/main.tsx src/App.tsx; ls src
exit 0  $ grep -n -i -B3 -A30 "path" .agents/skills/patchy-preact/SKILL.md | sed -n 1,140p; cat src/main.tsx src/App.tsx; ls src; sed -n 1,60p .agents/skills/patchy-look/SKILL.md
exit 0  $ cat src/styles.css; sed -n 60,120p .agents/skills/patchy-look/SKILL.md; cat patchy.config.ts; grep -n "route" patchy/_generated/client.ts | head
denied  $ cat > patchy.config.ts <<'EOF' …
        Contains brace with quote character (expansion obfuscation)
write   <env>/workspace/team-handbook/patchy.config.ts
write   <env>/workspace/team-handbook/src/App.tsx
read    <env>/workspace/team-handbook/patchy.json
read    <env>/workspace/team-handbook/src/styles.css
edit    <env>/workspace/team-handbook/src/styles.css
exit 0  $ pnpm patchy refresh 2>&1 | tail -5; pnpm typecheck 2>&1 | tail; pnpm lint 2>&1 | tail -5
exit 0  $ pnpm patchy dev --json 2>&1 | tail -15
denied  $ cd /tmp && for p in "" people policies; do curl -s -o /dev/null -w "%{http_code} /$p\n" http://127.0.0.1:38435/dev/localdev0000/$p; done; which chromium google-chrome chromium-browser 2>/dev/null; ls …
        A variable in this command can't be checked before it runs
denied  $ cd /tmp && curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:38435/dev/localdev0000/people; curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:38435/dev/localdev0000/policies; which chr…
        This Bash command contains multiple operations. The following parts require approval: cd /tmp, curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:38435/dev/localdev0000/people, curl -s -o /dev/…
denied  $ curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:38435/dev/localdev0000/people
        This command requires approval
exit 0  $ pnpm patchy dev stop --api-url '<origin>'

How it was verified

  • The facts against the code:
    • packages/patchy/src/clientTransport.ts: the route's get, set and subscribe, including async notify, acknowledged-set adoption and queued notifications dropped on unsubscribe.
    • packages/serving/src/broker.ts: routePath rules, route.set → pushState, popstate → route event, frame reload → stop(), refusals as invalid_request.
    • packages/patchy/src/devServer.ts and packages/serving/src/Pages.ts: deep links are served in dev and hosted.
    • packages/sdk/src/Generation.ts: patchy-preact is installed on every tier 1 and 2 repo, vanilla included, so the loop pointer always resolves.
  • The skill-pinning tests: vitest run packages/patchy/src/initProject.test.ts packages/sdk/src/SdkApi.test.ts passed 37 of 37. The first pins the lint block in patchy-preact, which is unchanged.
  • The trial: pnpm dev trial ran twice with the same brief. The second run added only the request for a one-sentence answer, because the trial log keeps commands but not file contents. In the first run, too, the before agent grepped .d.ts files and the after agent read only the skills. Neither after agent published. The first said this machine was logged in as someone else. The second stopped when the launcher denied its curl checks. Neither stop has to do with routing.
  • pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser passed. The offline test step failed locally on CLI stub-server tests that recorded a stray GET / none of them sent, plus a few load-timing tests. The failing set changed between runs, and none of those tests reads skill text. CI's run on this PR is the real check.
  • Not checked: patchy dev passes an opening address's encoded path to the page undecoded, while the hosted shell decodes it. The skill therefore claims decoding only for back, forward and set.

Release impact

Tick exactly one.

  • Breaking — requires action from anyone already running this

  • Not breaking — no action required. Only skill text changes; it reaches repos at their next refresh.

  • What does a revert leave behind? Repos refreshed in the meantime keep the Routes text in their managed skill copy until they refresh again. The text describes an API every release since routing shipped already has.

  • Does the release before it still work with that? Yes. No code, schema or contract changed.

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

@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area size:s Under 100 changed lines labels Oct 30, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review

Standards: No blockers. Both edits use the canonical release-bound project skill sources, as docs/SKILL_DISTRIBUTION.md requires. Existing generation serves them and installs patchy-preact on both tiers, including framework-free repos. No global-skill hash update is needed. No method or YAGNI blockers.

Spec / accuracy — one merge blocker: [P2] Qualify the notification guarantees (packages/sdk/skills/patchy-preact/SKILL.md:123–127). “Setting the path already shown … notifies nobody” and “each back or forward” do not hold generally. packages/patchy/src/clientTransport.ts:114–117 deduplicates by the cached path string, rather than by address or history entry:

  • Open a dev deep link ending in /caf%C3%A9. After bootstrap, get() returns /caf%C3%A9. Setting that exact value leaves the address unchanged but does notify /café when the broker's decoded event arrives.
  • Set /notes twice, then go back between the two /notes entries. History moves, but the listener receives nothing because the path string is unchanged.

Keep the initial asynchronous notification, then describe subsequent notifications as changes to the cached path string, including the acknowledged request and the shell's decoded update. Drop the unconditional same-address and every-history-step guarantees. This needs only a wording correction in this PR. The requested routing API, path rules and loop pointer are otherwise covered, with no router recipe or instructions about when to offer routing.

The reported dev mismatch is real: devServer.ts:243 passes encoded URL.pathname; hosted Pages.ts:370 decodes it. The broker prefers the supplied bootstrap route (broker.ts:812), while later route events decode the address (broker.ts:335). The skill's decoding sentence at lines 132–133 correctly limits its claim to set, back and forward, so that sentence is not wrong because of the mismatch. The mismatch does expose the unconditional no-notification claim above.

Checked against origin/main, issue #1088 and parent #1086. Confirmed the notification cases with the actual transport bundled and executed in memory; no checkout files changed. Standards: 0 blockers. Spec: 1 accuracy blocker.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Addressed the Sol review in d14f9f9:

  • Fixed: notification guarantees. subscribe now says the listener runs each time the page's path string changes (an acknowledged set, the shell's decoded form of it, back or forward), and that a step leaving the same string notifies nobody. The unconditional "notifies nobody" on set is gone. This matches updateRoute in clientTransport.ts.
  • Kept as is: the decoding sentence. Sol confirmed it limits itself to set, back and forward, so the dev deep-link mismatch doesn't make it wrong. The mismatch itself is now fix(patchy): patchy dev opens a page at its encoded path, the hosted shell at its decoded one #1096.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 8f2e238 (base 54438fa) on team, by Claude Opus 5.5 (claude-opus-5-5) in Claude Code, through T3 Code. This re-checks the PR after its rebase onto main, which brought in #1003, #1004 and Preact 11 (#975). It replaces the verdict on d14f9f9.

Done means

  • A fresh agent asked for a patch with several pages at their own paths uses patchy.route without opening type files: passed. I gave a new brief to the environment's agent launcher on Sonnet 5.5: an equipment loans patch with a list page, a page per item at /items/<id> and a lend page.
    • What it read. It grepped patchy-loop for "route", followed the pointer, then read ## Routes in patchy-preact. It opened no .d.ts file and nothing under node_modules.

    • What it wrote. App.tsx routes only through patchy.route. Typecheck and lint passed on Preact 11:

      useEffect(() => patchy.route.subscribe((p: string) => setPath(p)), []);
      // a link
      <a href={props.to} onClick={(e: MouseEvent) => { /* modifier keys pass through */ e.preventDefault(); void patchy.route.set(props.to); }}>
    • Publishing. The agent didn't publish. The launcher denied the curl it wanted to run first, which is the launcher's limit and has nothing to do with routing. I published its repo to the environment as Ada.

    • A browser walk as Ben on the published patch, with Playwright in the real shell:

      open deep link                 /items/mbp-14          "MacBook Pro 14\""
      click nav link Equipment       /                      "Office equipment"
      click item link                /items/thinkpad-x1     "ThinkPad X1 Carbon"
      back                           /                      "Office equipment"
      back again                     /items/mbp-14          "MacBook Pro 14\""
      forward                        /                      "Office equipment"
      same frame document            true
      reload                         /                      "Office equipment"
      page errors                    none

      pnpm dev shot ben /acme/equipment-loans/items/mbp-14 answered 200 with no errors (attached).

The merged skill texts

  • Coherence with main: passed. The PR still changes only the Routes section, the loop pointer and the patchy-preact description, and that text is unchanged since d14f9f9. Main's additions don't touch routing and don't overlap with Routes:

    patchy-loop agrees with Routes where both touch routing. Its tier 1 reach names routing, and its sandbox line gives shell-mediated routing and ~ segments to Patchy.

  • Every patchy.route claim matches the code at the head: passed. clientTransport.ts, broker.ts, Pages.ts, devServer.ts and Generation.ts show no diff against d14f9f9. I re-read the route paths:

    • get returns the cached path, seeded from the bootstrap route.
    • set always calls pushState and replies null, then announces the decoded route.
    • updateRoute skips an unchanged string, and notify drops listeners already removed.
    • routePath refuses //, ?, #, \, spaces and control characters. It also refuses failed decodeURIComponent and decoded ., .., /, \ or a leading ~.
    • The frame's second load calls stop().
    • Hosted addresses decode the route the same way the broker does.
    • Both the tier 1 and tier 2 clients expose transport.route.
    • patchy-preact is installed on every tier 1 and 2 repo, so the loop pointer resolves for framework-free repos.

    The real createPortTransport, against a fake shell that answers as broker.ts does:

    initial                            ["/start"]
    set /notes                         ["/notes"] -> null
    set /notes again                   [] -> null
    back between two /notes            []
    set /caf%C3%A9                     ["/caf%C3%A9","/café"] -> null
    get                                /café
    back to /notes                     ["/notes"]
    unsubscribe before queued notify   []
  • Preact 11: passed. Routes says nothing tied to a Preact version. Under Preact 11's AnchorAriaRoles, an <a> with href must be given a string, and a link with href={path} and an onClick that calls set typechecks. In the browser walk above, preventDefault kept the frame in place.

Golden journeys

  • None touched: the diff is skill text only. Every required check passed on the head, including browser, tier2-smoke, cli-smoke, install on all three platforms, test on Node 22, 24 and 26, lint, clerk-live and rollback-rehearsal.

Rollback answers: they match the diff. A revert leaves the Routes text in the managed skill copies of repos refreshed in the meantime. That text describes an API every release since routing shipped already has. No one-way label is needed.

Not run

  • Local pnpm verify: CI runs the same suites on the head.
  • A before/after pnpm dev trial: the base side was shown twice already, in the PR body and in the earlier verdict, and none of the route code changed. I ran the head alone, directly, so I could read the code and drive it in a browser.
  • A fresh agent on a framework-free or tier 2 page: the pointer and the shared transport.route were checked in code only.

Notes

  • The earlier path-rule nits still stand, unchanged at this head:
    • %FF passes "every % begins a valid escape" but is refused, because it isn't valid UTF-8.
    • Decoded control characters such as %0A are refused but not named, so "set rejects any other path" reads as accepting them.
    • A reported decoded path such as /a b is not valid input to set.
  • This agent double-decodes too. It runs decodeURIComponent on the item segment of a path the shell already decoded, as the earlier run did. That is harmless for its slugs but throws on a pasted /items/100%25. Routes can say every reported path is decoded once fix(patchy): patchy dev opens a page at its encoded path, the hosted shell at its decoded one #1096 is fixed; it is still open.
  • The PR body's evidence predates the rebase. Its trial names 2449055 and 66bc56d. This verdict's run is on 8f2e238.

ben-acme-equipment-loans-items-mbp-14

allisonmahmood and others added 2 commits October 31, 2026 23:50
patchy-preact gains a Routes section with patchy.route's get, set and
subscribe, the path rules, decoded reports, and why a link calls set
instead of navigating the frame. patchy-loop points framework-free pages
at it.

Closes #1088

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sol's review: subscribe notifies when the page's cached path string
changes, not on every set or history step.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 191e4a9 into main Oct 31, 2026
23 checks passed
@allisonmahmood
allisonmahmood deleted the docs/route-skills-1088 branch October 31, 2026 23:00
allisonmahmood added a commit that referenced this pull request Oct 31, 2026
## What changed

This adds release 32's What's new entry, written from `58d94b3`. It
covers everything merged since release 31's `through` (`5888411`). It
also sets the `patchy` release to `0.32.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| Fixed: a patch has the keyboard as soon as it opens, so its shortcuts
work, and Space and Page Down scroll it, without a click first | #1097 |
| Improved: agents give a patch pages of its own, each view at its own
address under the patch, with back and forward working; repos pick it up
at their next refresh | #1095 |
| Fixed: a patch that hits Pidgeon's hold on a new message is told
nothing was sent and to reply in the conversation, not to wait and retry
| #1139 |
| Behind the scenes: refresh and `patchy dev` keep working when a repo
holds a skill the instance's release doesn't ship, so a rollback can't
break them | #1099 |

#1138 is a live test tier change with nothing that ships. #1140 is
release 31's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `9e176cb` (release 31) to
`58d94b3`:** #1138, #1139, #1097, #1095 and #1099. None is labelled
`one-way`, and their Release impact answers agree:
  - #1097 changes only the shell's script.
  - #1095 changes only skill text.
- #1139 adds a `details.limit` value and a `details.message` on an
existing refusal.
- #1099 adds no skill, so a repo refreshed on this release holds only
skills release 31 also ships.
  - #1138 is tests only.
- **#1099 has to be live before #1092 (PR #1098, `patchy/hotkeys`)
ships.** That's why this release goes out alone. Once #1098 is live, a
rollback to release 32 or later keeps refresh and dev working for repos
that picked up the new `patchy-hotkeys` skill.

**Rollback line:** If this release misbehaves, roll back to `9e176cb`
(release 31).

## How it was verified

- **Tests.** `whatsNew.test.ts`, `schemas.test.ts` and
`WhatsNewPages.test.ts` pass (21 tests), and prettier passes on the
changed files.
- **The range.**
- #1097, #1095 and #1099 were each reviewed by GPT 6.1 Sol, with every
finding resolved. Each got a fresh acceptance PASS with notes after its
rebase onto Preact 11.
  - Each landed with all 12 required checks green on its final head.
  - #1138 and #1139 were merged from their own thread.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`9e176cb` (release 31). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

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

Text and version numbers only. The `0.32.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

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

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

Labels

area:docs Touches the docs area area:server Touches the server area size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs(sdk): routing is in the skills

1 participant