Skip to content

What init pulls from the server: skills, generated types, context and the refresh command #181

Closed

Description

@allisonmahmood

Question

What does the server hand a patch repo, and how does it stay current? To decide: the routes that serve the SDK skills filtered to the company's connected integrations, the catalog (connections the company holds, patches with shared tables the user can open), and the shapes needed to generate typed clients for a repo's declarations; what the generated directory contains and what is committed versus ignored (the patch id and instance must be committed so a clone publishes to the same patch; generated types and dev state ignored); the refresh command's name and what it bumps together (SDK, dev runtime, skills, generated types); how publish and dev detect outdated tooling and what they say; and how the CLI's own bundled patchy skill relates to the per-repo skills.

Context: Code-first config, skills and context served per company, Postgres first, Latest-only tooling, a stable wire contract for deployed patches, and the init prototype's evidence on where a fresh agent went wrong.

Recommendation: one patchy pull-shaped command that is also what init runs last, so there is one code path; the generated directory is fully derivable and ignored; the repo commits patchy.config.ts, the lockfile and a small metadata file with the patch id and instance.

Activity

  1. added
    wayfinder:grilling
    on Sep 6, 2026
  2. allisonmahmood commented on Sep 9, 2026

    @allisonmahmood
    OwnerAuthor

    Resolved 2026-09-09 with Allison, two rounds, each pressure-tested with astra first. Astra's corrections that changed an answer are marked; the one place Allison overruled astra is marked too. This reverses the ticket's own framing on one point: the generated directory is committed, not ignored.

    One package, one release

    patchy is one npm package: the CLI binary, the browser client (patchy/client), the config builders (patchy/config) and the dev runtime, at one version. That version is the release. It replaces the three packages the earlier decisions assumed (@patchy/sdk, a dev runtime, a separately installed CLI); Latest-only tooling and Dev is local stand, with "SDK and dev runtime pinned together" now meaning one line in package.json. Informed by a reference product Allison named whose notes stay outside the repo.

    • Pinned as one devDependency. Inside a repo npx patchy … (or pnpm patchy …) runs the repo's pinned copy, the way vite does; outside a repo npx patchy@latest init fetches the newest. The CLI that built a bundle is the SDK inside it, by construction.
    • Served from the instance at an immutable, unauthenticated, versioned tarball route until public launch, when it moves to npm and only the pin string changes. Lockfiles carry the integrity; bytes at a published URL never change.
    • Subpath exports keep Node and PGlite out of the browser's dependency graph (astra). Package weight (PGlite, ~25 MB on disk) is not bundle weight.
    • refresh hands off to the newly installed CLI before it executes the config against the new SDK (astra); replacing files never upgrades a running process.

    The repo

    Committed: patchy.config.ts; patchy.json = { instance, patch? }, written by init, the id added by the first publish, so a clone publishes to the same patch; package.json and the lockfile; AGENTS.md (agent-owned) and CLAUDE.md (@AGENTS.md); patchy/_generated/; .agents/skills/patchy-*/; fixtures/; source, index.html, vite.config.ts, tsconfig.json.
    Ignored: .patchy/ (dev data, daemon state, per-user identity cache), node_modules, dist.

    The split is per-patch versus per-user (astra, adopted): everything about the patch is committed, so a refresh that changes three warehouse columns is a diff a reviewer reads, a clone typechecks without contacting the instance, and the skills an agent follows have history. Nothing about the person (dev identity, machine key, login) is ever written into a committed file; patchy whoami and patchy dev status print it. Ignoring the generated clients would have protected nothing: the schema listing is in their types.

    Managed files, the only things refresh and add write: the pin in package.json, patchy/_generated/, .agents/skills/patchy-*/, and a fixture stub only when none exists. Never AGENTS.md, never an existing fixture, never other package fields. Server output paths are validated against those roots.

    patchy init

    Authenticates first (reuses a session or enters login; in a non-interactive shell fails with the login instruction, never hangs), prints instance and identity, asks for a one-line purpose (or --purpose), lays down the tree, installs, then runs the generation step below, and prints what it did (installed, generated, which skills) so an agent does not repeat it. The tree typechecks. A company with no connections is fine: core skills, empty declarations, no invented fixtures. AGENTS.md carries the purpose, the layout, the skills to read with their paths, "test with patchy dev", and points at the generated index for anything that changes; it is written once.

    patchy refresh

    Named refresh, not pull: Allison rules out git vocabulary in commands. One command, one transaction bound to one release: fetch the current release; if the pin differs, update it, install, re-exec; execute the config into the manifest; ask the instance to generate; stage the files and activate them as a set; write fixture stubs for declarations that have none; print what changed. A failed refresh leaves the previous set intact, never new packages beside old clients (astra).

    Outdated tooling

    The instance reports one current release. Exact-current, no floor (a floor is a second compatibility promise). patchy dev (new starts only; a running session is never killed by a release) and patchy publish both refuse below it, with one line naming the pinned and current release and patchy refresh. Astra moved dev from warn to refuse: warning lets an agent build against rules publish will reject. The check covers the executing CLI and the loaded dev runtime, not only the pin; a dev start after a refresh restarts an older daemon rather than reporting its URL as current.

    Skills: global and project

    • Global skill: the patchy skill the package bundles today, installed to the person's own skills directory by onboarding. What Patchy is, sign in, tier 0 pages, and now the door: "to build a tool, run patchy init; inside a repo the repo's skills govern".
    • Project skills, under .agents/skills/patchy-*/, served by the instance at the release and committed. Core, present from init: the patch loop (config, dev, publish, discovery with catalog and add), tables and files. Tables are the primitive every patch has, so their guidance is never behind an add (astra; Allison's add table example is covered by this). On demand: one per integration and one for shared tables.
    • Presence is sticky. A skill is present because init put it there, add put it there, or the config uses the thing; refresh re-fetches every present skill at the current release and adds any the config implies, so a hand-edited config never lacks its skill (Allison: "agents are dumb about knowing when to add the skills"). It never deletes a skill on its own; if the release no longer offers a present skill, refresh fails and says so (astra). Only patchy-* directories are managed. Skills say nothing that "is like Convex".

    patchy catalog, patchy add, patchy remove

    • patchy catalog lists what the company holds: connections (handle, integration, admin description) and shared tables the user can open (patch id, patch name, table, schema revision), each with its copy-ready add command and uses line. By default only what is connected, so an agent never builds for what does not exist; its last line says to run patchy catalog --all to see every integration Patchy offers, connected or not, so the agent can tell the person "I could do this; ask your admin to connect it". Serving every offered integration is an explicit widening of Code-first config; skills are still served only for connected ones.
    • patchy add postgres/<handle> [--as <alias>] and patchy add shared-table <patchId>/<table> [--as <alias>] configure and teach in one step (Allison overruled astra, who wanted the CLI never to edit source): insert the declaration into the config's uses object, run the generation step (client, context file, fixture stub, skill). Refused, naming the admin route, when the connection is not connected or the patch not openable. add postgres with one Postgres connection uses it; with several, lists them and stops. The config edit is a TypeScript AST insert; when the uses block is not a shape it can edit, the command fails with the exact line to add rather than half-succeeding.
    • patchy remove <alias> removes the declaration and its generated files, and the integration's skill when no declaration of that integration remains. It leaves the fixture file, which the agent wrote, and says so. Removing a skill by hand while the config still uses it is undone by the next refresh.
    • Shared tables are declared by patch id (names are mutable; a deleted source fails rather than rebinding by name), connections by their immutable handle.

    The generated directory and cross-patch typing

    patchy/_generated/: README.md, the index (every declaration, its alias, the source's revision stamp, the skill and context file that cover it); client.ts, importing the config's type and the manifest's value; one context file per declared connection or shared table. The server generates finished files; the CLI installs, executes the config, sends the declarations and the list of present skills, and writes what comes back, so adding an integration needs no CLI change and output matches the instance by construction. A shared table's client is generated from the source patch's published definition (columns, indexes) stamped with its schema revision and validated at publish per the tables decision; a connection's from its snapshot revision per the integration decision. This graduates the map's cross-patch typing fog.

    When generation runs: patchy dev start regenerates declarations (it already executes the config and reaches the instance for metadata), so "edit the config, run dev, it works" holds; patchy publish builds the committed tree as-is and refuses stale generated files with "declarations changed; run patchy refresh"; refresh does everything.

    patchy dev for agents

    patchy dev starts detached and idempotently, exits 0 only when healthy, prints one URL, the log path and the stop command; patchy dev status, stop, logs, reset (wipes local rows and files, never the baseline), and --foreground for a person who wants to watch. State under .patchy/dev/; daemon identity scoped to the repo and instance; a stale record never kills an unrelated process. This graduates the map's dev runner shape fog.

    The wire

    Four things in packages/api, HTTP routes as the adapter, --json on every command per ADR-0004:

    • release: { release, package: { tarball, integrity }, manifestVersion, wireVersion }, unauthenticated.
    • catalog: connections and shared tables the caller can see, all widening to every offered integration with its connection state.
    • generate: takes the manifest's declarations, the present skill names and the release; returns the managed files with their stamps, or refuses with the same codes publish uses (connection_not_connected, patch_not_openable, release_mismatch).
    • skills is not a separate route; generate serves them, filtered to what the company has connected.

    Vocabulary for the spec

    release (one version of the patchy package; the instance's current release is what it serves and refuses below), managed files, global skill versus project skill, catalog, fixture stub. docs/SKILL_DISTRIBUTION.md and the CLI README are rewritten by the spec; the patchy skill's SKILL.md change refreshes skills-lock.json by hand.

    What other tickets inherit

    • Publish for a patch repo: the release check before typecheck and build; the manifest carrying the release and the generated stamps; first-publish recovery of patchy.json when provisioning succeeded and the write failed; release races across the non-transactional steps; recording the release on the version the way the wire version is recorded.
    • Write the SDK spec: the tree and commands above; the Hit every surface entries for the CLI (README, ADR-0004, the bundled skill and its lock hash) and for docs/SKILL_DISTRIBUTION.md.
  3. allisonmahmood commented on Sep 9, 2026

    @allisonmahmood
    OwnerAuthor

    Resolved above; the map's Decisions so far carries the pointer.

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

Metadata

Metadata

Labels

wayfinder:grilling

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions