Repository navigation
Description
Destination
The repo is ready to start building Patchy Cloud from. Three things are true: (1) the product vision — patches, runtime tiers 0/1/2, companies and identity, the integration layer — is written down where agents read it (README, the AGENTS.md opening, docs/product.md, the CONTEXT.md glossaries); (2) the inherited PatchPage code has a charted Effect v4 port (its own child map) and its PatchPage-only leftovers are ticketed; (3) the agent DX layer — local dev first, lint, CI hygiene, skills, issue path — is ticketed. Everything as tickets; nothing built under this map.
Notes
- This code is the foundation. Patchy Cloud is built on top of it — adding auth, adding runtimes — never "ported" from PatchPage. "The port" means exactly one thing here: the port to Effect v4.
- Patchy Cloud, product-level. A cloud for internal company tools. People at a company build patches — anything from a static page to a full CRM — and deploy them here. Log in once, reach everything in your company you have access to. A per-company integration layer connects external sources (databases, Google Workspace, Salesforce…). Runtime tiers: tier 0 static, no runtime, no JavaScript (what PatchPage is); tier 1 execution in the browser carrying the user's identity against company APIs and data; tier 2 the patch has its own hosted, server-side runtime. An AI builder comes later and is not in scope.
- Settled while charting (not tickets, so recorded here): multi-tenant SaaS run by Patchy, "private" meaning private to each company (dedicated per-company instances later); patch replaces draft in vocabulary, and the code renames when the port touches it; tiers 0/1/2 are the canonical names, glossed for context; the Effect port is faithful (feature-by-feature disposition happens during the build, not before); Effect 4, everywhere — server and CLI; inherited ADRs are replaced, not preserved — retired as this map and the port map produce Patchy Cloud decisions, because outdated ADRs mislead agents;
CONTEXT.mdglossaries lead and the code follows. - Pre-map decision log.
~/Dev/patchy-agent-dx-decisions.md(kept outside the repo on purpose) holds the agent-DX decisions already made from the t3code and omarchy surveys. Its DO items become issues through the "File the DX backlog" task; the file is discarded once this map closes. Decisions live in this repo in the form they are implemented, not as a planning doc. - Skills. Every grilling ticket: call
grillinganddomain-modeling. Research tickets:research. Readdocs/agents/domain.mdbefore exploring. - Research findings are the closing comment on each research ticket. The full reports were parked on
research/<name>branches while the map ran; those branches were deleted at map close (2026-09-02) because raw research does not belong in the repo, and the ticket comments are the record. - Building blocks we hold credits for. Daytona (sandboxes) and Neon (serverless Postgres) — prefer them wherever they fit, but fit is established by their research tickets (Daytona, Neon) before any decision assumes them.
- Child maps. The Effect v4 port is its own wayfinder map, spawned by the "Chart the Effect v4 port map" task once its research and the local-dev decision are in.
Decisions so far
-
Effect 4 landscape: Effect 4 is a release candidate (
4.0.0-rc.112, 2026-08-25; stable targeted Q3/Q4 2026), living onEffect-TS/effectmain—effect-smolis archived. Platform, HttpApi, SQL and CLI areeffect/unstable/*(may break in minors);@effect/sql-pgstill wrapspgwith a native-client rewrite pending;@effect/vitest,HttpApiTest,@effect/sql-pgliteexist;LLMS.mdships inside every published package asAGENTS.md; no codemod —MIGRATION.mdis the agent's input. -
Effect done well for agents — what t3code does: five stacked mechanisms — a short AGENTS.md pointing at vendored upstream docs,
git subtreevendoring (97 MB, 81% of tracked files, and it drifts),@effect/language-servicediagnostics as errors, custom lint rules (a ratchet and schema hoisting), and a paid prose review agent. Cheap to copy: the AGENTS.md guidance,@effect/vitest, the language-service plugin. Not obviously earned: vendoring and the paid reviewer. -
Comparable platforms — the unit people build, its runtimes, and sharing: the unit is a builder-DB record, a file tree with a URL, or path-addressed files that round-trip — the field is converging on file-shaped. Everyone has three creation routes (hand, builder, agent via MCP/CLI). Versioning is immutable-versions-plus-pointer, working-copy-plus-releases, or git. Builders are private until published; code platforms go live on deploy. Sharing is a four-rung ladder; discovery is a portal filtered by access; retirement separates unpublish from delete with a recovery window.
-
Comparable platforms — companies, identity, and access: one tenant owns everything (its name is arbitrary); a person belongs to many; roles are a short fixed ladder with custom roles paid; the decisive split is builder vs consumer, not admin vs member; per-app access is a level plus an anyone-with-the-link switch; SSO is two products (builders vs consumers); verified email domain is the bridge from person to company; machine credentials come as personal, tenant-owned, or non-human principals; CLIs use device authorization; auth providers converge on app → organizations → memberships → active org in the session.
-
Comparable platforms — integrations and connected sources: each platform has one noun for a connected source; two ownership models — shared service credential vs per-acting-user connected account (only Retool offers both as a switch); sources are workspace-scoped with per-group access; app code is handed raw credentials, an opaque proxy, or tools; browser code never holds the credential; the MCP spec forbids token passthrough. Four independent design axes for Patchy; tier 1 patches can only be handed a proxy or per-user token, tier 2 any of the three.
-
Local dev for a multi-service Effect monorepo — the options: copy t3code's runner shape — a small Effect 4 CLI under
scripts/that owns the plan (ports from a hash of the worktree path, state in<worktree>/.local/dev/, a written.local/dev/envthe CLI ranks above env and config) and delegates toturbo run dev; onePlanschema behind--dry-run --json. Embedded-postgres (~300 msinitdb, no Docker, realpg) for dev servers and tests including CI, template-cloned per test; thedevelopmentexport condition verified to resolvesrc. -
Tier 1 prior art — running app code in the browser with the user's identity: every platform serves third-party code from a Public-Suffix-List-registered origin; none hands browser code the platform session — identity arrives as claims or as brokered "as the user" calls (the BFF pattern); egress is a CSP allowlist declared in a manifest; in-realm sandboxes are the cautionary tales; a patch must be safe as a standalone page, not only as an embed. Tier 1 can promise isolation, brokered scoped access, and declared egress; it cannot promise a patch won't misuse granted access.
-
Tier 2 prior art — hosting per-app server-side runtimes: three boundaries in production — V8 isolate, OS process with namespaces/seccomp, Firecracker microVM — and cold start follows the boundary (~0–5 ms / tens of ms / ≤125 ms + init). Snapshot-restore makes VM-per-app affordable; secrets are write-only; egress is the least standardised control; isolates meter CPU-ms, VMs meter reservations; scale-to-zero is universal. The developer writes a fetch handler, a whole app, or a
main(args). The field's answer for many small tools: handler-shaped TS in a pooled process or isolate by default, plus a microVM from an OCI image for "bring a whole app". -
Daytona — sandboxes as a tier 2 runtime and as agent dev environments: a hosted sandbox API (container by default; VM, Windows, GPU classes) driven through a toolbox API from SDKs, CLI, MCP or REST; the core platform went private in June 2026 and only clients are open. Smallest unit is a 1 vCPU / 1 GiB reservation billed per second while started (≈$49/month always-on, ≈$0.24/month stopped, $0 archived); the "under 90 ms" start is unqualified marketing and wake latency is unpublished; ingress needs Patchy's own proxy for custom domains, auth and wake-on-request; per-sandbox egress policy only from Tier 3 ($500 top-up); secrets are swapped into HTTPS headers only. Fit (a) — viable only for the "bring a whole app" half of tier 2, not for many small tools (no isolate or handler runtime). Fit (b) — a good fit and the cheapest place to spend credits: one sandbox per agent or worktree from a Patchy-built snapshot; forces the decision that the checkout lives in the sandbox, not on this machine; Tier 2 needed for real parallelism.
-
Neon — serverless Postgres as the data layer: ordinary Postgres 14–18 with storage split from compute, now "Lakebase Postgres" under Databricks. The isolation unit Neon actually supports is the project (created by API in under a second, region-fixed, idle compute costs nothing); branches are a versioning primitive, not a tenancy one — branch-per-company is ruled out. Fit (a) production DB — yes: one project with company-scoped rows now, project-per-company reserved for the dedicated-instances promise. Fit (b) Patchy-native DB for patches — viable as beta via the Data API (JWT from any JWKS, RLS sees only
sub). Neon Auth is not our identity system (15-minute JWTs, no custom claims, partial orgs). Fit (c) — branches suit per-PR CI; Neon Local is a cloud-backed proxy, so the inner loop keeps a hermetic local Postgres. Fit (d) — nothing Neon-specific:@effect/sql-pgispgover TCP; the serverless driver cannot back it. Scale-to-zero drops every session (LISTEN/NOTIFY, advisory locks incl. our migrator's) and the pooler is PgBouncer transaction mode — the port must design around both. First open question: which program our credits sit on and when they expire. -
Local dev environment: an Effect 4 runner under
scripts/(pnpm dev) owning aPlan— hashed per-worktree ports, state in<worktree>/.local/dev/, idempotent daemonised start that runs migrations and seeds one dev company + token,stop/reset/status/logsscoped to the worktree,--dry-run --jsonas the only machine contract; ships server + embedded Postgres only. CLI reads.local/dev/envby walking up fromcwd, above env and config. embedded-postgres for dev, tests and CI with no skip gate;exports→src, keep tsx; dev stamp0.0.0-dev.g<sha>[.dirty]. Supervisor undecided → Dev runner supervisor prototype. -
Dev runner supervisor prototype: spawn each service directly with Effect 4
ChildProcess; turbo is off the dev path (kept for build/test/lint). Both supervisors tore down cleanly and isolated worktrees; turbo's strict env mode silently droppedPORT/DATABASE_URL, neededpnpmon PATH, and doubled the log prefixes for no scheduling gain. The runner is one Effect scope owning every handle; teardown is scope closure; a service exit closes the scope;start= detached self-spawn + unref + health poll. -
File the DX backlog from the decisions doc: fourteen
ready-for-agentissues, chore: gitignore .scratch/ and .plans/, review notes go in PR comments #28–feat(cli): patchy delete #41, one per DO item with Allison's reasoning quoted; the four the port inherits carryport-requirement(wire types as Effect Schema, taste-as-lint, Postgres test story, table-tested HTML policy). Release smoke and PatchPage-instance-only items left out. -
Chart the Effect v4 port map: charted as the child map Effect v4 port map — ten decisions settled while charting, eight tickets, destination a spec plus filed build issues; self-hosting dropped entirely along the way.
-
What a patch is: a built unit in a company's cloud — one thing stored, permissioned and provisioned as one, at one address, at one tier (an attribute, never the identity); a file tree whose folder is the patch repo (id, declared tier, config; the tree's structure must not exceed the declared tier); made by a person or their agent through the CLI, SDK and AI builder being the same route; immutable versions + pointer, live on publish, no working copy in the cloud; company-wide by default, tighten or widen by act; identity is the id, human addresses are fog; no expiry — retire and delete are the exits; composition and extensions (a patch plugging into a patch) promised, undefined. Landed in docs(product): define what a patch is #91; follow-ups cli: say patch, not draft, in user-facing copy #92 (CLI draft rename) and patches: drop expiry, add retire and delete with a recovery window #93 (retire/delete replace expiry).
-
Runtime tiers 0 / 1 / 2: a tier is where code runs and nothing else — static / browser / hosted, tiers 3–4 named only; the login door sits in front of the page at every tier and public is allowed everywhere but warned above tier 0; tier 1 acts as the viewer through Patchy only, no direct outbound at all; tier 2 runs only while a viewer has the patch open (sync included, nothing when nobody is looking), handler-shaped, with a patch identity of its own for its primitives and viewer identity for company data; tier is per version, changed by publishing. Deferred: bring-a-whole-app, an egress allowlist, consent. Landing in #94.
-
Company and tenancy: company = the flat, paying tenant with a global handle; user = one account in exactly one company, deactivated vs deleted with the reassignment prompt at deletion; groups = pure grant surfaces ("team"/"department" are labels); admin runs the company, operator holds platform powers only; integration (Patchy ships) vs connection (a company or user holds), personal connections admin-free and dying with the account; sharing-scope addresses
company[/user|/group]/patchon one per-company namespace, first-come, never reserved; dedicated instances get no reserved rules. Landed in #95. -
Identity and access: Clerk holds who a person is (Google / Microsoft / emailed code, no passwords; company SSO self-served, enforced per verified domain, paid), Patchy holds the company, access and machines; invite by default, verified domain for auto-join, no person without a company, one company hard; member and admin only and everyone builds; owner alone changes a patch, admins see everything, inside-the-company or public;
patchy loginis a device login with code confirmation and a named per-machine token (Patchy's own, 90 days absolute / 30 idle, Your machines to revoke), self-service minting retires; agent acts with its user's token; who's-who glossary — the CLI's agent is its driver, operator stays Patchy. Landing in #96. -
Integration layer: integrations are company-scoped primitives — primitives now carry a scope, patch-scoped (own tables, files; provisioned with the patch) or company-scoped (connections, the company database; existing once, owned by none), and a patch's tables are patch-scoped wherever they live; modes (company/personal) fixed per integration by Patchy; company connections named (
postgres/warehouse), many per integration; viewer's own grant is the only check on the viewer path and holding a personal connection suffices — no per-patch consent (the consent the tiers ticket deferred, resolved); connect sits in front of the page like the login door; patch code gets typed SDK clients only — never a credential, no bring-your-own source; dev reaches connections as the user via the machine token. Landed in #98. -
Redraw CONTEXT-MAP.md and retire the inherited ADRs: the map names the product's six contexts — Patches, Serving, Companies, Auth, Integrations, Publishing — each pointing at its package or saying "no code yet"; a codeless context keeps its
CONTEXT.mdat the path its package will take; company- and integration-shaped terms leave Auth forpackages/companiesandpackages/integrations, viewer and patch identity move to Serving; ADR-0000 and ADR-0001 deleted, no new ADRs until a build PR earns one, rule recorded (an ADR is current or gone);docs/product.mdon the read-first list. The CONTEXT-MAP redraw — which contexts Patchy Cloud has #99 closed as a duplicate. Landing in #103. -
Allison writes the AGENTS.md opening and taste section: both hand-written into
AGENTS.md; the rewrite finished in place with a Where to look list and Hit every surface mirrors (docs(agents): where to look, and the surfaces a change must hit #105),docs/product.mdassembled as the product tickets landed, README rewritten in the product voice (docs(readme): say what Patchy Cloud is before how the repo is laid out #109),/llms.txtcopy filed as docs: write the llms.txt copy #108 and deferred.
Not yet specified
- A Runtimes context split out of Serving — when the tier 1 and tier 2 runtimes are built, not before; Serving keeps the tier 0 path. Noted in Serving's glossary by the map redraw.
- Patch-to-patch composition (a tier 1/2 patch calling another) and extensions (a patch that plugs into another patch) — promised on What a patch is, designed with the tier 1/2 runtimes, along with the company database as a shared data surface (company-wide tables several patches read), surfaced on Integration layer.
- Address mechanics — how long an old address redirects after a move, and search over the portal. The scheme itself is decided on Company and tenancy.
/llms.txtcopy — filed as docs: write the llms.txt copy, deferred until a served page an outside agent can land on exists and the access story holds.- Neon branch-per-PR databases in CI (official Actions, schema-only, TTL) — worth it once PR preview deployments exist to point at; the inner loop stays hermetic regardless.
- Identity follow-ons surfaced on Identity and access, each its own later effort: merging a company of one into a company (patches come along); guests — a named outsider with a login; company-owned tokens for CI that is nobody's; a browser-on-the-same-machine loopback fast path for
patchy login; a "can't publish" company setting; what an agent does when a login code expires mid-task; whether request access notifies the owner in-product, by email, or both.
Out of scope
- Detailed designs for auth/accounts, tier 1 and tier 2 runtimes, the integration layer, the AI builder, a Patchy SDK — each is a build-phase effort with its own map.
- Deployment target, hosting infra, release channel (CLI publishing). Release smoke on every PR is wanted — build it when the release structure exists.
- Dedicated per-company instances run by Patchy — after multi-tenant.
- Anything in the PatchPage repo; it is a separate product now.
- Feature-by-feature keep/drop of PatchPage-isms (self-service minting, expiry, reports, pins, quotas, analytics events) — decided while building the systems that supersede them; the port carries them faithfully.
Activity
allisonmahmood commentedon Sep 2, 2026
Closing: the destination holds on
main, and the map went past it — the Effect port was built, not only charted.Destination, checked
docs/product.mdassembled from docs(product): define what a patch is #91, docs(product): define the runtime tiers 0 / 1 / 2 #94, docs(product): define companies and tenancy (#18) #95, docs(product): define identity and access (#19) #96, docs(product): define the integration layer (#20) #98;CONTEXT-MAP.mdand the sixCONTEXT.mdglossaries redrawn in docs(domain): map the product's contexts and delete the inherited ADRs #103; AGENTS.md opening, Where to look and Hit every surface in docs(agents): give agents the product stance and shipping rules #53 and docs(agents): where to look, and the surfaces a change must hit #105; README in the product voice in docs(readme): say what Patchy Cloud is before how the repo is laid out #109.pnpm dev(feat(dev): pnpm dev runs a per-worktree local instance an agent can keep alive #81, fix(dev): pnpm dev status exits 1 unless the instance is healthy #107) with thepatchy-dev-loopskill (feat(dev): patchy-dev-loop skill and a pnpm patchy script to drive the local instance #106). Still open andready-for-agent: feat: agent-shaped issue path: via-agent template, report-a-problem, triage playbook, external label, CONTRIBUTING #32, docs: docs/README.md index grouped by audience #33, feat(server): the agent front door: /llms.txt, an installer and patchy setup #36, feat(server): a request wide event for every route #37, feat(cli): patchy delete #41.PRs that reference no issue, by the item they served: #95, #96 (product doc, item 1); #105, #109 (AGENTS.md and README, item 1); #97, #104, #106, #107 (dev loop and lint, item 3).
Housekeeping at close
research/<name>branches are deleted. The findings comments on the research tickets are the record; raw reports do not live in the repo. The Notes above say so now.patchy-dev-loopline left Not yet specified; it shipped in feat(dev): patchy-dev-loop skill and a pnpm patchy script to drive the local instance #106.Next map. Candidates are the Out of scope list. Recommended first: companies and identity, since every other design leans on the company and the login door, and its decisions are already on #18 and #19. Deployment target has been out of scope of both maps and needs a home in that map or a sibling.