Skip to content

feat(server): the agent front door: /llms.txt, an installer and patchy setup #36

Closed

Description

@allisonmahmood

Part of the launch (#416). Absorbs #108 (the copy). Design reviewed with GPT 6.1 Sol in codex, 2026-10-02.

Problem

A new beta user's agent has no way to learn how to install Patchy. The CLI is deliberately not on npm: each instance serves its own release (GET /api/release: an immutable tarball URL plus SHA-512). The install steps live only in the repo README and inside the global skill, which ships inside the package it would be installing. Nothing registers that skill with Claude Code, Codex or Cursor. The empty portal says "Ask your agent to publish a page with Patchy" (packages/portal/src/render.ts:323), but the agent has nothing to go on.

The flow

The user pastes one line to their agent:

Set up Patchy using https:///llms.txt

  1. /llms.txt says what Patchy is, gives the install command, and says to read the installed skill next.
  2. The agent runs the instance's installer. On macOS and Linux:
    work=$(mktemp -d) && curl -fsS https://<host>/install.mjs -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url https://<host> --json
    PowerShell does the same with Invoke-WebRequest and patchy.cmd.
  3. Login relays the URL and code to the person as it does today, and saves the instance. --api-url is persisted before confirmation (packages/patchy/src/Login.ts:187), so later commands need no flag.

What to build

  • GET /install.mjs, served by the instance with PATCHY_PUBLIC_BASE_URL baked in, about 100–160 lines in packages/sdk. It checks Node ≥ 22.22.0 and npm. It fetches /api/release, downloads the exact tarball and verifies SHA-512; that catches damaged or mismatched downloads, though it's no defence against a compromised origin. Then it runs npm install --global --ignore-scripts --no-audit --no-fund <file>, calls the newly installed patchy setup --json by absolute path, and returns the executable and skill paths, with actionable errors for PATH and permission problems. Running it again is the upgrade path, and it always reinstalls rather than skipping on a version-string match.
  • patchy setup links the whole bundled skill directory, references included, as ~/.agents/skills/patchy and ~/.claude/skills/patchy: symlinks on POSIX, junctions on Windows. It is idempotent, refuses to replace a directory it doesn't own, and returns the paths so the running agent can read the skill straight away. patchy setup --remove removes only what setup created. Follows ADR-0004 (exit codes, --json).
  • GET /llms.txt: short. The Node requirement, the commands above, the browser handoff, and where the skill is. The bundled skill owns everything after that.
  • Global upgrade guidance. A global CLI on the wrong release is currently told Run: patchy refresh (packages/patchy/src/CliError.ts:127), but refresh updates a repo, not the global CLI. Point the global case at the instance's installer, and keep pnpm patchy refresh for repos.
  • The empty portal gets the copyable line. This is a copy change: per Allison's design rule, publish mocks and get a pick before editing the real page.
  • Surfaces: the global skill and its lock hash, packages/patchy/README.md, docs/SKILL_DISTRIBUTION.md, ADR-0004 for setup, ADR-0011 if the release story changes, and docs/API.md for the two routes.

The invitation and waitlist emails carry the same line, but those are Clerk templates set in the dashboard (#480), not code.

Copy

An agent drafts the /llms.txt and portal copy from README.md and docs/product.md: what Patchy Cloud is, that it's a private beta, and how an agent gets in. Allison edits it in review.

Cut

npm publishing or an npm bootstrapper, npx skills add from GitHub (main can describe a different release than the instance), automatic self-updates, installing Node for the user, agent plugins or MCP, and detecting every agent's skill directory.

Test

Fresh install and upgrade on macOS, Linux and Windows. Also: Node missing or too old; an unwritable npm prefix or patchy missing from PATH; paths with spaces; Windows npm shims; integrity failure before anything installs; a conflicting skill directory; repeated setup and remove; login persistence. #416's clean-machine check runs this flow on production.

Done when

On a clean machine, an agent given only the one line installs Patchy, registers the skill, logs the person in and publishes a page.

Activity

  1. added
    ready-for-agent
    area:server
    on Aug 26, 2026
  2. allisonmahmood commented on Sep 2, 2026

    @allisonmahmood
    OwnerAuthor

    Parked until staging is up and running. The route only earns its keep once there is a served address an outside agent can land on, and the copy (#108) waits on the new auth story for the "how an agent gets in" part anyway. Pick this and #108 up together once staging exists.

  3. allisonmahmood commented on Sep 2, 2026

    @allisonmahmood
    OwnerAuthor

    #37 (version endpoint and request logging) rides along with this and #108: the three land together once staging is up.

  4. added
    area:cli
    area:docs
    on Oct 2, 2026
  5. changed the title [-]feat(server): GET /llms.txt route[/-] [+]feat(server): the agent front door: /llms.txt, an installer and patchy setup[/+] on Oct 2, 2026
  6. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    Rescoped 2026-10-02 for the launch. No longer parked: production is the address an outside agent lands on, and device login is the access story the copy needed. #108's copy is folded in, with an agent drafting and Allison editing in review. #37 is no longer grouped with this.

  7. added
    enhancement
    on Oct 2, 2026
  8. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: enhancement
    Summary: An outside agent given only Set up Patchy using https://<host>/llms.txt installs the instance's CLI, registers the global skill and logs the person in.

    Current behavior:

    • The patchy package is not on a registry. The instance reports its release at the public GET /api/release (release, package.tarball, package.integrity as a sha512-… SRI). package.tarball is a relative path (/sdk/patchy-<release>-<digest>.tgz); refresh resolves it against the instance URL.
    • Install steps exist only as manual prose, in the package README and in the global skill's Publishing section.
    • The global skill ships inside the package at node_modules/patchy/skills/patchy/, but nothing links it into any agent's skill directory.
    • A global CLI on the wrong release gets ReleaseMismatch, whose message says Run: patchy refresh. Static-file publish raises it, but refresh reconciles the patch repo in the working directory and cannot upgrade a global CLI.
    • The empty portal says "Ask your agent to publish a page with Patchy…", which gives the agent nothing to start from.
    • patchy login --api-url <url> saves the instance before confirmation, so later commands need no flag.

    Desired behavior:

    1. GET /llms.txt, public, short: what Patchy Cloud is, that it is a private beta, Node ≥ 22.22.0, the install-and-login commands below for macOS/Linux and PowerShell, the browser handoff, and the installed skill's path to read next. The bundled skill owns everything after login. Draft the copy from the README and docs/product.md; Allison edits it in review.

    2. GET /install.mjs, public, served with the instance's public base URL baked in. A dependency-free Node script of about 100–160 lines, living in the SDK package beside the tarball route. It:

      • refuses Node older than 22.22.0, or a missing npm, with a message naming the fix;
      • fetches /api/release, resolves package.tarball against the base URL, downloads it to a temp directory and verifies SHA-512 against package.integrity before installing anything. This catches damaged or mismatched downloads, not a compromised origin;
      • always runs npm install --global --ignore-scripts --no-audit --no-fund <file>, even on a version match: rerunning the installer is the upgrade path;
      • runs the newly installed patchy setup --json by absolute path under the npm global prefix (patchy on POSIX, patchy.cmd on Windows), then prints the executable and skill paths;
      • names the fix for an unwritable global prefix and for patchy missing from PATH;
      • handles paths with spaces and Windows npm shims.

      The documented POSIX line:

      work=$(mktemp -d) && curl -fsS https://<host>/install.mjs -o "$work/install.mjs" && node "$work/install.mjs" && patchy login --api-url https://<host> --json

      PowerShell does the same with Invoke-WebRequest and patchy.cmd.

    3. patchy setup [--remove] [--json] links the package's whole bundled skill directory, references included, as ~/.agents/skills/patchy and ~/.claude/skills/patchy: symlinks on POSIX, junctions on Windows.

      • Ownership: setup owns a link whose target is a patchy package's skills/patchy directory. It creates missing links and replaces owned links, including links into an old npm prefix after a Node switch. Already-correct links are a no-op. It refuses a real directory, a file or a link to anything else, and names the path.
      • --remove deletes only owned links.
      • Success JSON returns the linked or removed paths and the SKILL.md path. Exit codes and --json follow ADR-0004.
      • Effect's FileSystem symlink takes no link type, so junctions likely need Node fs with a per-file @effect-diagnostics opt-out and a reason.
    4. Upgrade guidance. A stale global CLI with no patch repo in play is told to rerun the instance's installer, and the message includes the instance URL. Inside a patch repo the guidance stays pnpm patchy refresh. Branch on whether a repo is involved, not on ReleaseMismatch.component: cli arises on both paths.

    5. Portal empty state gets the copyable line Set up Patchy using <publicBaseUrl>/llms.txt. Stop before editing the page: build a few distinct static mocks, publish them with the patchpage skill, post the URL on this issue and wait for Allison's pick. The rest of this brief does not wait on the pick. The page edit follows the ui-consistency spec.

    6. Surfaces:

      • the global skill's Publishing section points at the installer instead of the manual tarball steps, and its skills-lock.json hash is refreshed;
      • the package README covers install and setup;
      • ADR-0004 covers setup;
      • docs/SKILL_DISTRIBUTION.md says setup links the global skill (its "does not publish it to a skill directory" line changes);
      • docs/API.md covers the two routes, documented the way the tarball route is.

      ADR-0011 changes only if the release story does; it should not.

    Key interfaces:

    • Release (release, package.tarball, package.integrity): read it, don't change it.
    • The server's public base URL (PATCHY_PUBLIC_BASE_URL): baked into /install.mjs and used in /llms.txt and the portal line.
    • ReleaseMismatch: its global-case guidance changes; it may need the instance URL as a field.
    • A new setup command in the CLI's command table.
    • The API guard already treats non-/api paths as public. Company handles are [a-z0-9-], so dotted root paths cannot collide with them.

    Acceptance criteria:

    • GET /llms.txt and GET /install.mjs answer without a session and carry the instance's base URL; tests cover both.
    • On Linux, with a clean HOME and a fresh npm prefix, the one-liner installs the current release, links both skill paths and leaves patchy login --api-url <host> --json returning the login handoff. A second run reinstalls and keeps the links.
    • An integrity mismatch fails before npm install runs, and nothing is installed.
    • Old Node, missing npm, an unwritable prefix and patchy missing from PATH each fail with a message naming the fix.
    • patchy setup is idempotent, replaces an owned link to a stale package, and refuses a real directory or foreign link with ADR-0004's exit code and JSON error. setup --remove removes only owned links. Tests cover these.
    • Static-file publish with a stale global CLI names the installer command with the instance URL; a patch repo with a stale pin still names pnpm patchy refresh.
    • Portal mocks are published and their URL posted; after the pick, the empty portal shows the copyable line.
    • The surfaces in item 6 are updated, and pnpm verify passes.
    • The PR lists macOS and Windows fresh install and upgrade as hand checks; CI has no runners for them. chore(infra): the first deploy of Patchy to AWS #416's clean-machine check runs the flow on production.

    Out of scope:

    • npm publishing, an npm bootstrapper, or npx skills add from GitHub
    • Automatic self-updates, or installing Node for the user
    • Agent plugins or MCP, and skill directories beyond ~/.agents/skills and ~/.claude/skills
    • Changing GET /api/release or the tarball route
    • The Clerk invitation and waitlist email templates (dashboard, chore(auth): the production Clerk instance on patchyhq.com #480)
  9. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    Portal empty-state mocks for the setup line: https://post.patchyhq.com/d/nu13cerlx61o (public, unlisted)

    • A: today's layout, with the note's instruction swapped for the line to paste
    • B: the empty page leads with the line in a code panel
    • C: three steps (paste, confirm the code, ask for a page or tool)
    • D: agent and terminal side by side

    The portal runs no page script, so "copyable" means one click selects the whole line (copy-address). The rest of #36 is being built now; the page edit waits for your pick.

    Made by Claude Opus 5.5 via Claude Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliarea:docsarea:serverenhancementready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions