You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
patches: a Patchy source store so a lost repo can be pulled back #229
Publish stores only the built HTML bundle and the manifest per version. No source tree lives in the cloud. A person whose machine is gone has a running tool nobody can change again, and an agent cannot pull a colleague's patch to work on it.
Idea
Patchy runs its own source management: a git-backed store the CLI pushes to on publish (or explicitly), and patchy pull <patch> restores a working repo for the owner. No cloud working copy, branches, merges or collaborative editing; version-bound snapshots that recover a repo where patchy dev runs.
Decisions this needs before it is built:
what "pull" guarantees: editable source, or a repo where patchy dev runs (package pin, generated files, fixtures, release compatibility)
the archive boundary: project skills and config live in dotfiles, so "no dotfiles" breaks it; tracked files can hold secrets, so an inspectable upload inventory rather than promised secret detection
authority: public HTML never means public source; whether an admin or a reassigned owner may pull
publish coupling: whether a failed source push fails the publish
historical gaps: existing versions and file-born patches have no source
retention: snapshots take part in retire, restore and permanent delete
Why not now
Ruled out of the portal map (deployed-stage spec, 2026-09-12) so that map stays on finding and managing patches. The SDK map had already ruled out Patchy as a source-control tool; this issue narrows that to recovery.
To simplify it (just for commenting. SOmething around the lines of save button, input gets saved (enough of it to remake it anywhere else easily), user can access download and hook it up to cli
See, the inherent problem is you can't just save the prompt (aka the input). Because then the recreated "saved progress" dashboard will probably not look like the original. ON the other hand, we can't save everything otherwise our database is gonna be overcrowded with useless junk.
What matters at the end of the day:
say we talk to it similar to grill me, what matters the most will be the decisions we make at the end of the day. When we make say a dashboard and we choose what goes in it and what doesn't etc.
We need to know the libraries it used, configurations, integrations, etc
This is what we need to recreate it on another computer. The original prompt would not be enough and the full agent convo might be a lot of overhead. At the end of the day the main issue is that we need to preserve enough to keep building it.**
From my understanding, the final out put is basically a folder with a lot of files (i know ) and 1 or 2 of those files are the things we need to run the patch inside and actually upload.
Basically, we have a local folder with source code, configuration, agent instructions, and supporting files.
We then edit that project
Then we run "Patchy publish", which builds it into **one self-contained HTML file, then uploads that and a manifest describing the patch. And we retain a copy of it on our laptop
Alternatively, we can also publish the HTML file directly, without creating a project folder.
A markdown file with all the useful shit would make sense but it still might rebuild the thing differently, so thats an issue, so we need the files there as well. Tradeoffs
what we want at the end of the day is for the user say to go on a different computer and resume their progress or if they quit a patch for whatever reason (on their own laptop) and go to a different patch and start working on that and decide they want to go back to the patch they quit for whatever reason and they lost the downloaded copy. Those are the usecases i can think on top of my head.
Couple solutions: The idea of a git type thing where a user can "pull" from if shit goes wrong is not bad because at the end of the day we need the project files if we don't wanna rebuild every fucking time.
The alternative in this case would be letting the user rebuild every time with a markdown file but then it probably won't be exact to the original build. While a markdown would have important context, it will not be exact, which is a requirement in this case
The biggest issue I can see with the git thing is that we have to be very active in deleting old content. Perhaps a timer where we delete after 30 days?
Another solution is an external git repo connected to our database thats going to be really tacky when you consider cloud accounts and stuff. Not really necessary to be this complex right now, but something to keep in mind in the future.
I think the best compromise here is something around the lines of “recover my project and keep editing,” in that sense, straightforward storage. So what would happen is that the cli packages source code, assets, configuration, dependency versions, agent md file, etc and stores it. This is what we would pull.
Because if the project is already compiled (aka they have a draft and still editing it) and the user wants to keep editing it, we have to keep that exact version and a snapshot for reference.
We can't just have a Markdown file and have the agent replicate it because it wouldn't be the same thing, even with a snapshot alongside it. So maybe a zip file to preserve the patch's contents and folder structure, similar to a git snapshot.
For the database:
Now I am thinking of deleting removed patches permanently after 30 days as to control overhead., keep the latest source snapshot/files, remove everything linked to the patch if its deleted (not archived) (we should have a trash button where we can restore deleted patches but that can come later) .
Alternatively, since the user might want to go back to a previous version, we could keep the latest snapshot while the patch exists; keep the older snapshots for 30 days (previous versions) and then delete them.
upload the finished HTML, manifest, and a source snapshot stored as an archive or through Git.
store code, configuration, dependency versions, assets, and agent instructions, including useful Markdown context.
the user runs patchy pull on another computer. It restores the project and sets it up for patchy dev, still targeting the same patch and its existing cloud resources.
edit and publish the next version.
The database and zip file are seperate. What this means is we have a seperate database and a different storage for the zip file. The database just tracks its location and metadata.
How I would build it.
It's more as lets go along and build it along the way.
But the way I would go about building it is
CLI: build HTML and archive source -> Authenticated publish API -> Content storage: HTML and ZIP -> Postgres: version and snapshot metadata (what I mean by seperate database and storage- > api pull request- > cli restores project
Basically we have two artifacts in this case when we publish: carry the source archive alongside the HTML and manifest and the postgres layer would hold a small record of stuff like patch_id, created, etc and this would point to the zip in the existing content storage area. Obviously lot of smaller decisions but this is how I would go about it on a top level.
Specifically and technically speaking (before you get mad at me)
I have theories on how I would go about the CLI packaging and publish contract and how I would include all the necessary files and how I would expand the already to wire the database to access the previously written versions and objects
Also how I would do source retrieval (this should be simple, just adding an authentication route would do in theory). Basically, the server resolves authorization through the current patch owner, checks patch availability, and returns:content type and zip file.
And how I would go about retention and deletion. However these are things I should probably test and try out firsthand as these are much smaller decisions. . Aka I should go about this one at a time and test shit out starting with the zip storage and CLI packaging.
Plan: every version keeps its repo, and patchy pull gets it back
Decided with Allison on 2026-10-29, then reviewed by GPT 6.1 Sol. This is #546's step 1 ("every version carries its source") on the content store, without waiting for Versie. Versie can later import these snapshots as its first checkpoints.
Decisions
One request. A publish from a repo carries the repo's files inside the same request as the bundle, so the publish key and payload digest cover them, and no version the CLI publishes exists without them.
Who can pull: anyone the patch is openable for, which today is every member of its company. Publish stays owner-only. Public sharing never exposes the repo: pull is a machine-token API read, like every other one, and guest openability must never widen it.
What goes in: everything except .gitignored paths (nested .gitignores honoured), .git/, any node_modules/, .patchy/, patchy/_generated/, .agents/skills/patchy-*/, .env, .env.* and .DS_Store.
The caps are 10 MiB of file bytes and 2,000 files. Over either, publish refuses and names the five largest top-level entries, so the agent adds them to .gitignore.
Symlinks are skipped with a warning naming them. Publish refuses when a file the CLI needs (package.json, patchy.config.ts, patchy.json, index.html, vite.config.ts) is ignored.
patchy pull <patch> [dir] gets the served version, and --version N gets another.
It writes the files and stamps patchy.json: this instance, the patch id, the version and the cloud description.
It then runs refresh's own sequence: managed pin, install, generation, workerd pin and second install, toolchain check, fixture-preserving activation. patchy dev works on today's release straight away.
For a patch that isn't live, or when setup fails (for example a connection that was removed), it keeps the files and names the reason and the next step.
A file-born tier 0 page pulls as its one HTML file, under a sanitized name.
Stale copies.patchy.json records the version a copy was published as or pulled from. Publishing from a copy older than the patch's newest version refuses with behind, naming that version and who published it.
The check runs before upload and again under the patch row lock.
patchy publish --allow-behind publishes anyway. It is separate from --force, which also overrides the protection for dependants.
CLI and API only in v1. A portal line comes later, with mocks first.
Term
Repo snapshot: the files of the patch repo one version was published from, minus managed files and what .gitignore excludes. Columns and objects are repo_*. Avoid calling it "source", which already names shared-resource sources, connected sources and source_ip.
Wire
PublishRequest.repo?: { path, contents (base64) }[]. Paths are relative POSIX, have no ./../empty segments and no control characters, and are at most 1,024 bytes. The server refuses:
duplicates under NFC and case folding
a path that is both a file and a directory
more than the limits publish.repo.files and publish.repo.bytes (413)
PublishRequest.baseVersion?: int. The --allow-behind override sends no new field: it omits baseVersion.
The publish response gains artifacts.repo: { files, bytes }, with bytes counting the decoded file bytes.
GET /api/patches/:patchRef/repo?version=N&state=… (pull) uses detail's resolution, openability and state filter. It returns the version, owner, description, kind: repo | file and the files.
A version with no snapshot answers 404 no_repo, naming the owner.
PatchDetail.repo describes the served version's snapshot, or null.
Server
Migration 0029: repo_object_key, repo_content_hash, repo_file_size and repo_file_count on patch_versions, all or none, with a unique index.
The snapshot is stored as canonical JSON at patches/<id>/versions/<ver>.repo.json through the existing pending-object intent path. It is part of intent consumption at commit, of the expired-intent claim and of the purge queue.
Delivery
Three stacked PRs:
Server: versions keep a repo snapshot, and members can read it. Nothing sends one yet, so it ships alone.
It is labelled one-way: once a later release stores snapshots, rolling back past it would let the old purge drop version rows without queueing their repo objects. That leaves company code in the object store after its deletion.
So it deploys in its own release before PR 2 ships.
CLI: publish sends the repo, patchy pull restores it, and patchy list says whether it can. It also writes the version into patchy.json passively.
Publish refuses a copy behind the newest version.
Each PR updates the docs and skills it touches (API and limits docs, README, ADR-0004, global and project skills, the AGENTS.md template, both glossaries, docs/product.md).
Not in v1
Portal surfaces.
Per-file dedup.
Drafts or saves outside publish.
Rebuilding repos for versions published before this ships.
Pulling into an existing folder.
A git export.
Secret scanning beyond the fixed exclusions.
Filed by Claude Opus 5.5 via Claude Code for Allison.
A patch built in a repo before release 29 has no snapshot until its owner publishes it once with patchy 0.29.0. Pages published from one HTML file pull back as that file already. The plan's "Not in v1" list above is still unbuilt, starting with a portal line.
Activity
vsrikar08 commentedon Sep 14, 2026
To simplify it (just for commenting. SOmething around the lines of save button, input gets saved (enough of it to remake it anywhere else easily), user can access download and hook it up to cli
vsrikar08 commentedon Sep 14, 2026
See, the inherent problem is you can't just save the prompt (aka the input). Because then the recreated "saved progress" dashboard will probably not look like the original. ON the other hand, we can't save everything otherwise our database is gonna be overcrowded with useless junk.
vsrikar08 commentedon Sep 14, 2026
What matters at the end of the day:
say we talk to it similar to grill me, what matters the most will be the decisions we make at the end of the day. When we make say a dashboard and we choose what goes in it and what doesn't etc.
We need to know the libraries it used, configurations, integrations, etc
This is what we need to recreate it on another computer. The original prompt would not be enough and the full agent convo might be a lot of overhead. At the end of the day the main issue is that we need to preserve enough to keep building it.**
vsrikar08 commentedon Sep 14, 2026
From my understanding, the final out put is basically a folder with a lot of files (i know ) and 1 or 2 of those files are the things we need to run the patch inside and actually upload.
Basically, we have a local folder with source code, configuration, agent instructions, and supporting files.
We then edit that project
Then we run "Patchy publish", which builds it into **one self-contained HTML file, then uploads that and a manifest describing the patch. And we retain a copy of it on our laptop
Alternatively, we can also publish the HTML file directly, without creating a project folder.
vsrikar08 commentedon Sep 14, 2026
A markdown file with all the useful shit would make sense but it still might rebuild the thing differently, so thats an issue, so we need the files there as well. Tradeoffs
vsrikar08 commentedon Sep 14, 2026
what we want at the end of the day is for the user say to go on a different computer and resume their progress or if they quit a patch for whatever reason (on their own laptop) and go to a different patch and start working on that and decide they want to go back to the patch they quit for whatever reason and they lost the downloaded copy. Those are the usecases i can think on top of my head.
vsrikar08 commentedon Sep 14, 2026
Couple solutions: The idea of a git type thing where a user can "pull" from if shit goes wrong is not bad because at the end of the day we need the project files if we don't wanna rebuild every fucking time.
The alternative in this case would be letting the user rebuild every time with a markdown file but then it probably won't be exact to the original build. While a markdown would have important context, it will not be exact, which is a requirement in this case
The biggest issue I can see with the git thing is that we have to be very active in deleting old content. Perhaps a timer where we delete after 30 days?
Another solution is an external git repo connected to our database thats going to be really tacky when you consider cloud accounts and stuff. Not really necessary to be this complex right now, but something to keep in mind in the future.
I think the best compromise here is something around the lines of “recover my project and keep editing,” in that sense, straightforward storage. So what would happen is that the cli packages source code, assets, configuration, dependency versions, agent md file, etc and stores it. This is what we would pull.
Because if the project is already compiled (aka they have a draft and still editing it) and the user wants to keep editing it, we have to keep that exact version and a snapshot for reference.
We can't just have a Markdown file and have the agent replicate it because it wouldn't be the same thing, even with a snapshot alongside it. So maybe a zip file to preserve the patch's contents and folder structure, similar to a git snapshot.
vsrikar08 commentedon Sep 14, 2026
For the database:
Now I am thinking of deleting removed patches permanently after 30 days as to control overhead., keep the latest source snapshot/files, remove everything linked to the patch if its deleted (not archived) (we should have a trash button where we can restore deleted patches but that can come later) .
Alternatively, since the user might want to go back to a previous version, we could keep the latest snapshot while the patch exists; keep the older snapshots for 30 days (previous versions) and then delete them.
vsrikar08 commentedon Sep 14, 2026
to summarize
upload the finished HTML, manifest, and a source snapshot stored as an archive or through Git.
store code, configuration, dependency versions, assets, and agent instructions, including useful Markdown context.
the user runs
patchy pullon another computer. It restores the project and sets it up forpatchy dev, still targeting the same patch and its existing cloud resources.edit and publish the next version.
The database and zip file are seperate. What this means is we have a seperate database and a different storage for the zip file. The database just tracks its location and metadata.
vsrikar08 commentedon Sep 14, 2026
How I would build it.
It's more as lets go along and build it along the way.
But the way I would go about building it is
CLI: build HTML and archive source -> Authenticated publish API -> Content storage: HTML and ZIP -> Postgres: version and snapshot metadata (what I mean by seperate database and storage- > api pull request- > cli restores project
Basically we have two artifacts in this case when we publish: carry the source archive alongside the HTML and manifest and the postgres layer would hold a small record of stuff like patch_id, created, etc and this would point to the zip in the existing content storage area. Obviously lot of smaller decisions but this is how I would go about it on a top level.
vsrikar08 commentedon Sep 14, 2026
Specifically and technically speaking (before you get mad at me)
I have theories on how I would go about the CLI packaging and publish contract and how I would include all the necessary files and how I would expand the already to wire the database to access the previously written versions and objects
Also how I would do source retrieval (this should be simple, just adding an authentication route would do in theory). Basically, the server resolves authorization through the current patch owner, checks patch availability, and returns:content type and zip file.
And how I would go about retention and deletion. However these are things I should probably test and try out firsthand as these are much smaller decisions. . Aka I should go about this one at a time and test shit out starting with the zip storage and CLI packaging.
allisonmahmood commentedon Oct 28, 2026
Plan: every version keeps its repo, and
patchy pullgets it backDecided with Allison on 2026-10-29, then reviewed by GPT 6.1 Sol. This is #546's step 1 ("every version carries its source") on the content store, without waiting for Versie. Versie can later import these snapshots as its first checkpoints.
Decisions
.gitignored paths (nested.gitignores honoured),.git/, anynode_modules/,.patchy/,patchy/_generated/,.agents/skills/patchy-*/,.env,.env.*and.DS_Store..gitignore.package.json,patchy.config.ts,patchy.json,index.html,vite.config.ts) is ignored.patchy pull <patch> [dir]gets the served version, and--version Ngets another.patchy.json: this instance, the patch id, the version and the cloud description.patchy devworks on today's release straight away.patchy.jsonrecords the version a copy was published as or pulled from. Publishing from a copy older than the patch's newest version refuses withbehind, naming that version and who published it.patchy publish --allow-behindpublishes anyway. It is separate from--force, which also overrides the protection for dependants.Term
Repo snapshot: the files of the patch repo one version was published from, minus managed files and what
.gitignoreexcludes. Columns and objects arerepo_*. Avoid calling it "source", which already names shared-resource sources, connected sources andsource_ip.Wire
PublishRequest.repo?: { path, contents (base64) }[]. Paths are relative POSIX, have no./../empty segments and no control characters, and are at most 1,024 bytes. The server refuses:publish.repo.filesandpublish.repo.bytes(413)PublishRequest.baseVersion?: int. The--allow-behindoverride sends no new field: it omitsbaseVersion.artifacts.repo: { files, bytes }, withbytescounting the decoded file bytes.GET /api/patches/:patchRef/repo?version=N&state=…(pull) uses detail's resolution, openability and state filter. It returns the version, owner, description,kind: repo | fileand the files.no_repo, naming the owner.PatchDetail.repodescribes the served version's snapshot, or null.Server
0029:repo_object_key,repo_content_hash,repo_file_sizeandrepo_file_countonpatch_versions, all or none, with a unique index.patches/<id>/versions/<ver>.repo.jsonthrough the existing pending-object intent path. It is part of intent consumption at commit, of the expired-intent claim and of the purge queue.Delivery
Three stacked PRs:
one-way: once a later release stores snapshots, rolling back past it would let the old purge drop version rows without queueing their repo objects. That leaves company code in the object store after its deletion.patchy pullrestores it, andpatchy listsays whether it can. It also writes the version intopatchy.jsonpassively.Each PR updates the docs and skills it touches (API and limits docs, README, ADR-0004, global and project skills, the AGENTS.md template, both glossaries,
docs/product.md).Not in v1
Filed by Claude Opus 5.5 via Claude Code for Allison.
feat(patchy): publish keeps the repo, and patchy pull gets it back
feat(patches): publish refuses a copy behind the newest version
feat(patches): publish refuses a copy behind the newest version
feat(patches): each version keeps its repo snapshot, and members can …
docs(whats-new): Patchy keeps the repo each version came from (#1104)
feat(patchy): publish keeps the repo, and patchy pull gets it back (#…
feat(patches): publish refuses a copy behind the newest version (#1004)
docs(whats-new): pick up a patch someone else built (#1116)
allisonmahmood commentedon Oct 31, 2026
Shipped in production as two releases:
6a73bea): feat(patches): each version keeps its repo snapshot, and members can read it #996. Each version can keep its repo snapshot, and members who can open a patch can read it.1d7eca8): feat(patchy): publish keeps the repo, and patchy pull gets it back #1003 addspatchy pull, and every repo publish now keeps the repo. feat(patches): publish refuses a copy behind the newest version #1004 makes publish refuse a copy behind the newest version unless the agent passes--allow-behind.A patch built in a repo before release 29 has no snapshot until its owner publishes it once with
patchy0.29.0. Pages published from one HTML file pull back as that file already. The plan's "Not in v1" list above is still unbuilt, starting with a portal line.