@vibes.diy/prompts 14.3.339 → 14.3.340

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms/access.md CHANGED
@@ -636,6 +636,26 @@ export function bakery(doc, oldDoc, user, ctx) {
636
636
 
637
637
  The order form saves `{ type: "order", senderHandle: me?.userHandle, name, email, items }`, its contact fields on the order itself, because the order lives in the inbox. The menu reads `item` records, the staff screen reads `order` and `itemCost` records, and a signed-in sender's "Your orders" list reads the `order` records their own channel returns.
638
638
 
639
+ **A single business is one object the owner creates.** When the ask names one business as the person's own — my coffee shop, our kitchen, my company — the bakery above is the shape: the app is the business, the owner holds the `owner` role from the start, and staff are a role the owner hands out. When the app keeps a record for the business itself (a shop's profile, a kitchen's hours, a company's hiring area), that record is created under `ctx.requireRole("owner")` and opens on a channel named by its own id, its inbox granted to the owner and staff roles:
640
+
641
+ ```js partial
642
+ if (doc.type === "shop") {
643
+ ctx.requireRole("owner");
644
+ const shop = "shop:" + doc._id;
645
+ return { channels: [shop], grant: { public: [shop], roles: { owner: ["inbox:" + doc._id], staff: ["inbox:" + doc._id] } } };
646
+ }
647
+ ```
648
+
649
+ Visitors reach the business by the id in its link (`#open=<shopId>`, the same `open` key every object link uses), and every order, quote or booking they send carries that id, so it lands in that business's inbox. A colleague the owner brings in is a `member` record the owner writes, and the colleague finds the company in their list. A page each provider sets up for their own visitors — a booking page, office hours — stays the provider's own, as _A page a person sets up for their own visitors_ below describes.
650
+
651
+ **A person's view opens their own object first.** The order is: the object the link names, then the person's own (its `creatorHandle` is theirs), then the one they tap in the list, never the first object in the list. Each shared object shows in that list with `ViewerTag` for its maker, and a shared object waits in the list until they open it, so whatever a person adds or sends goes to the place they chose. With nothing in the link and nothing of their own, the view shows the list and the way to start their own; in a single-business app it shows the owner's one business, the only one there is.
652
+
653
+ ```jsx partial
654
+ const openId = new URLSearchParams(location.hash.slice(1)).get("open");
655
+ const { docs: shops } = useLiveQuery("type", { key: "shop" });
656
+ const shop = shops.find((s) => s._id === openId) ?? shops.find((s) => s.creatorHandle === me?.userHandle);
657
+ ```
658
+
639
659
  **Worked example — a cast everyone can meet: shared characters, private chats (a character chat, a creature gallery, a songbook).** Sharing is the baseline, so an app where people make things ships a way to see them on its first build, even when the ask names nobody else and the invite screen waits for an option. Here every character lands on one always-on public channel, so every visitor meets the whole cast with no step at all, and each maker edits only their own. A one-tap publish per character (the sketches shape above) is an equally good answer; this example shows the always-on one. Each chat, the thread and the story so far, is private to the person having it. Letting a friend join a chat is an option the app can offer later, as a membership on that chat. The app's code holds no notion of an owner. The canned characters the ask starts with are a fixed set of documents in `seed.json`, seeded where everyone reads them, and the app writes no copy of them for each visitor. Adding the seed is the owner's choice, so the app works without it: until then the cast opens empty, inviting the first person to make a character. The screen says who can see the cast ("Anyone with the link can meet the cast") beside a copy-link.
640
660
 
641
661
  ### `access.js`
@@ -780,7 +800,56 @@ export function bookings(doc, oldDoc, user, ctx) {
780
800
 
781
801
  The provider reads their bookings by `pageId` and sees exactly the ones on their pages; a client reads by `clientHandle` and sees exactly their own. The rules never read the vibe owner: the person who made the app sets up a page the same way as the second provider who opens it, and a remix starts with nobody special in it either. A live calendar feed of a page's bookings follows the same line — the provider subscribes to the bookings on the pages they run (the calendar skill's _A page's bookings, for the provider who runs it_).
782
802
 
783
- **Ownership is just the object graph** — whoever authored or created a doc owns it (`doc.authorHandle === user.userHandle`, checked against `oldDoc` on updates). There's no broadcaster shape to reach for by default, and **owner-only publishing is a dead end** — never gate the content itself on `requireRole("owner")`. **A blog, magazine, or publication is public read + author-owned posts, with the owner controlling the _author roster_:** the owner approves authors with a grant doc (`if (doc.type === "author") { ctx.requireRole("owner"); return { channels: ["blog:authors"], grant: { users: { [doc.authorHandle]: ["blog:authors"] }, roles: { owner: ["blog:authors"] } } }; }` — the **one** place `requireRole("owner")` belongs, gating who may author, never the posts); a post then gates on `ctx.requireAccess("blog:authors")` (membership) and is author-owned (`doc.authorHandle === user.userHandle` + the `oldDoc` check), so once approved each author's post is _their own_ object — only they edit it, and they moderate the comments on it (a comment is allowed if it's your comment **or** you own the post: `doc.authorHandle === user.userHandle || doc.postAuthorHandle === user.userHandle`). A personal blog is just this with a roster of one. Always gate write UI on `useVibe(dbName).can`.
803
+ **A business that serves many clients gives each client an object of its own.** A daycare's families, a tutor's students, a coach's athletes, a salon's or a clinic's patients, a landlord's tenants: each client is its own record (`type: "family"`) with its own channel (`family:<id>`), and every record about that client — a child's day, a lesson note, a camera link — carries the client's id and routes to that client's channel. The operator holds every client channel through the `owner` role and the `staff` role the owner hands out, so the operator's screen lists every client and opens each one. A client's invite grants only that client's channel: the `parent` record the staff write names the parent and the family, and grants that parent the one family's channel, so each parent's screen opens on their own child. The same holds for groups: in a bill splitter, a trip planner or a class roster, each group's records ride that group's own channel (`group:<groupId>`), so a group's link opens that group alone. Its friends read it through the invite that lets them into the group, and its channel turns public only when the person asks for everyone with the app's link to see that group.
804
+
805
+ **Worked example — a daycare: one channel per family, and the staff hold them all.** The owner hands out the `staff` role, and the seed carries the owner's own staff grant (`{ "type": "roleGrant", "role": "staff", "userHandle": "@owner" }`) so the demo opens with the owner able to add families.
806
+
807
+ ### `access.js`
808
+ ```js partial
809
+ export function daycare(doc, oldDoc, user, ctx) {
810
+ if (!user?.userHandle) throw { forbidden: "sign in" };
811
+ if (oldDoc && oldDoc.type !== doc.type) throw { forbidden: "a record keeps its type" }; // a delete arrives as the stored record, type and all
812
+
813
+ if (doc.type === "roleGrant") {
814
+ // App-wide authority: the owner holds the owner role from the start and hands out staff.
815
+ ctx.requireRole("owner");
816
+ if (doc.role !== "staff") throw { forbidden: "unknown role" };
817
+ return { channels: ["admin:roles"], members: { staff: [doc.userHandle] }, grant: { roles: { owner: ["admin:roles"] } } };
818
+ }
819
+
820
+ if (doc.type === "family") {
821
+ // One client: its own channel, held by the owner and the staff.
822
+ ctx.requireRole("staff");
823
+ const family = "family:" + doc._id;
824
+ return { channels: [family], grant: { roles: { owner: [family], staff: [family] } } };
825
+ }
826
+
827
+ // Every other record belongs to one family, and keeps it.
828
+ if (typeof doc.familyId !== "string" || doc.familyId === "") throw { forbidden: "a record names its family" };
829
+ if (oldDoc && oldDoc.familyId !== doc.familyId) throw { forbidden: "a record keeps its family" };
830
+ const family = "family:" + doc.familyId;
831
+
832
+ if (doc.type === "parent") {
833
+ // A client's invite: the parent it names reads their own family's channel.
834
+ ctx.requireRole("staff");
835
+ return { channels: [family], grant: { users: { [doc.parentHandle]: [family] }, roles: { owner: [family], staff: [family] } } };
836
+ }
837
+
838
+ if (doc.type === "update") {
839
+ // A child's day, a photo, the camera link: the staff write it, and the family reads it.
840
+ ctx.requireRole("staff");
841
+ return { channels: [family] };
842
+ }
843
+
844
+ throw { forbidden: "unknown document type" };
845
+ }
846
+
847
+ // Summary: the owner names the staff, the staff add each family and its updates, and a parent the staff add reads their own family's updates. A parent record and an update carry their family's id in familyId; a parent record names the parent in parentHandle; a role grant names its member in userHandle.
848
+ ```
849
+
850
+ The staff screen reads `family` records and opens each one, its updates and parents read by that family's id; a parent's screen reads the `family` records their grants return and opens their own, with the updates under it.
851
+
852
+ **Ownership is just the object graph** — whoever authored or created a doc owns it (`doc.authorHandle === user.userHandle`, checked against `oldDoc` on updates). There's no broadcaster shape to reach for by default, and **owner-only publishing is a dead end** — never gate the content itself on `requireRole("owner")`. **A blog, magazine, or publication is public read + author-owned posts, with the owner controlling the _author roster_:** the owner approves authors with a grant doc (`if (doc.type === "author") { ctx.requireRole("owner"); return { channels: ["blog:authors"], grant: { users: { [doc.authorHandle]: ["blog:authors"] }, roles: { owner: ["blog:authors"] } } }; }` — in a publication, `requireRole("owner")` gates who may author, never the posts); a post then gates on `ctx.requireAccess("blog:authors")` (membership) and is author-owned (`doc.authorHandle === user.userHandle` + the `oldDoc` check), so once approved each author's post is _their own_ object — only they edit it, and they moderate the comments on it (a comment is allowed if it's your comment **or** you own the post: `doc.authorHandle === user.userHandle || doc.postAuthorHandle === user.userHandle`). A personal blog is just this with a roster of one. Always gate write UI on `useVibe(dbName).can`.
784
853
 
785
854
  The personal blog's post branch is small — public read is the blog's resting state, declared inline on every post result (readers are the point of publishing):
786
855
 
@@ -304,7 +304,15 @@ const draft = { type: "tool", name: name.trim(), authorHandle: me?.userHandle };
304
304
  const verdict = can.create(draft);
305
305
  // Each reason access.js can give, in the app's own words.
306
306
  const refusalWords = (reason) => (reason === "a tool needs a name" ? "Name the tool to add it" : "Tools come from the shelf's neighbors");
307
-
307
+ // Enter in the field submits the form too, so the handler opens with the same choice as the button.
308
+ const addTool = async (event) => {
309
+ event.preventDefault();
310
+ if (settledSignedOut) return requestLogin();
311
+ if (!verdict.ok) return;
312
+ await database.put(draft);
313
+ };
314
+
315
+ <form onSubmit={addTool}>
308
316
  {settledSignedOut ? (
309
317
  <Button type="button" onClick={requestLogin}>Sign in to add your tool</Button>
310
318
  ) : (
@@ -313,12 +321,43 @@ const refusalWords = (reason) => (reason === "a tool needs a name" ? "Name the t
313
321
  {!verdict.ok && !verdict.pending && <Text size="sm" muted>{refusalWords(verdict.reason)}</Text>}
314
322
  </Stack>
315
323
  )}
324
+ </form>
316
325
  ```
317
326
 
318
327
  The name they typed stays in the field across sign-in, so once they are back Save is one press away, and a signed-in neighbor reads what the tool needs next.
319
328
 
320
329
  The signed-out visitor's half of a refusal is a button: `settledSignedOut` chooses between two controls, the `requestLogin` button and the Save-plus-reason pair, and the reason `Text` speaks only to a signed-in person. Even when the refusal is one line under Save (`{!verdict.ok && …}`), its signed-out branch renders `<Button onClick={requestLogin}>Sign in to add your dish</Button>` there, so a friend who opens the sheet signed out presses it, signs in, and comes back to a working Save.
321
330
 
331
+ A form that opens from a row's button puts the same choice at its Confirm. Claim this dish, Sign up for a shift, RSVP: the row's button opens the fields for everyone, the friend types their name, and the spot where Confirm sits is chosen by `settledSignedOut`, so every press they make answers on screen. The button and the handler read one record and one verdict, and the handler opens with the same signed-out choice, because Enter in the name field submits the form too:
332
+
333
+ ```jsx
334
+ const settledSignedOut = !isViewerPending && !viewer;
335
+ const next = { ...dish, bringer: who.trim(), claimedBy: me?.userHandle };
336
+ const verdict = can.edit(next);
337
+ // refusalWords: the app's words for each reason access.js gives, as in the tool form above.
338
+ const claim = async (event) => {
339
+ event.preventDefault();
340
+ if (settledSignedOut) return requestLogin();
341
+ if (!ready || !next.bringer || !verdict.ok) return;
342
+ setClaiming(false);
343
+ await database.put(next);
344
+ };
345
+
346
+ <form onSubmit={claim}>
347
+ <Field label="Your name">{(id, describedBy) => <Input id={id} describedBy={describedBy} value={who} onChange={setWho} />}</Field>
348
+ {settledSignedOut ? (
349
+ <Button type="button" onClick={requestLogin}>Sign in to claim this dish</Button>
350
+ ) : (
351
+ <Stack gap={1}>
352
+ <Button type="submit" disabled={!next.bringer || !verdict.ok}>Confirm</Button>
353
+ {next.bringer && !verdict.ok && !verdict.pending && <Text size="sm" muted>{refusalWords(verdict.reason)}</Text>}
354
+ </Stack>
355
+ )}
356
+ </form>
357
+ ```
358
+
359
+ The name they typed waits in the field while they sign in, and once they are back Confirm is the next press.
360
+
322
361
  Keep the guest's composed text across sign-in. Draft input lives in component state (or a local draft the app already saves) — and signing in never clears it. The new identity arrives on its own through `viewer`; the words they typed stay where they left them, and they continue from there. A form that resets on identity change makes the guest write everything twice.
323
362
 
324
363
  ## Notes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/prompts",
3
- "version": "14.3.339",
3
+ "version": "14.3.340",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {
@@ -39,10 +39,10 @@
39
39
  "license": "SEE LICENSE IN LICENSE.md",
40
40
  "dependencies": {
41
41
  "@adviser/cement": "~0.5.37",
42
- "@vibes.diy/api-types": "14.3.339",
43
- "@vibes.diy/call-ai-v2": "14.3.339",
44
- "@vibes.diy/identity": "14.3.339",
45
- "@vibes.diy/use-vibes-types": "14.3.339",
42
+ "@vibes.diy/api-types": "14.3.340",
43
+ "@vibes.diy/call-ai-v2": "14.3.340",
44
+ "@vibes.diy/identity": "14.3.340",
45
+ "@vibes.diy/use-vibes-types": "14.3.340",
46
46
  "arktype": "~2.2.9",
47
47
  "json-schema-faker": "~0.6.4"
48
48
  },
@@ -122,7 +122,7 @@ Three things happen in this order on every screen, and the first two happen for
122
122
  ### The first phone screen
123
123
 
124
124
  The person and the platform's screenshot both see one phone screen, so compose it on purpose. The first phone screen holds, in this order: the heading with the one way to add beside or under it, then the view the person asked for or the records at the size the view draws them, then Ask where the app has it, then the share control with its one who-can-see line. The view this turn's ask names — a table, a grid, a total, a board — leads that screen directly under the heading, above every form, settings card and reminder, unless the person said where it goes; a reminder, setting or share they ask for keeps its own place below, and at the top means the top of the opening screen, not of a detail view. The way to add is compact: a lead button that opens the form in a Dialog or Sheet, a single-line entry, or the sentence composer; a whole form stands open only while there is nothing yet to show, its sparkle beside its submit. While the viewer is still resolving, the add keeps its place in the heading as a skeleton or a disabled button, never an empty slot. Where the app has Ask, Ask is one quiet row under the records, or the composer's second action where the composer is the way to add. The share, add-a-friend or invite button with its one line is the footer row that closes the content, and the invite screen opens from it; reminders, settings and rosters wait behind a quiet button under the content. A game's canvas or board fills the screen, its heading and controls over it or beside it, and the look carries onto the play area and every overlay, hotbar and button: its palette, type and shapes, never a stock game palette. A limiting word in the ask — just, only, simple — keeps that kit and shrinks it further into the background. In the kit's components (`@vibes.diy/ui`; another look fills each piece with its own equivalent): the add is a lead-tone `Button` in the heading's `Row`, or one `Input` with its submit; Ask is an `Input` with a quiet send `IconButton` in a `Row`; a row is a `RowCard` a tap opens into its editor, holding its fields and Change by sentence; the share is the footer `Row` shown under _A way to share_, its invite screen a `Sheet`; settings sit in a `Collapsible` or `Sheet`; a game's score and best are separate `Metric` readouts.
125
- **This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example).
125
+ **This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example); and a business that serves many clients (a daycare, a tutor, a coach, a salon, a clinic, a landlord) gives each client its own record and channel, held by the owner and staff roles, with a client's invite granting only that client's channel, as each group in a bill splitter or trip planner keeps its records on its own channel (the daycare example).
126
126
 
127
127
  After your last code block, add a short 1-2 sentence message describing the core workflow the app supports.
128
128
 
@@ -420,6 +420,7 @@ Write this turn's `access.js` against precisely these shapes: the person's own r
420
420
 
421
421
  - **Keep the opening view useful.** The person arrives inside their own tree: the first screen is the app at work, named for the app, with a rename that writes the settings record when they want a name of their own. The header carries the app's name once; a separate name line becomes useful after a rename or a second object. A second-object form joins the object list when useful. Show the person's own tree, each tree a membership lets them into, and the whole readable type-query result of second objects, including ones someone else made; `creatorHandle` identifies their makers.
422
422
  - **A page set up for visitors is a product its provider owns.** "My booking page", "my clients", "my menu" are the words of the service provider speaking — usually the person who made the app, never assumed to be — so every signed-in person can set up pages of their own (`_id: "page-" + crypto.randomUUID()`, a write-once `creatorHandle`), what visitors make on it carries its `pageId` and is read only by that visitor and the page's provider, and each page has its own `#page=<pageId>` link its provider copies to share. Clients can offer services too, by setting up a page of their own. No rule or screen reads who owns the vibe. The access skill's _A page a person sets up for their own visitors_ has the rules.
423
+ - **A single business is the owner's, and a view opens the person's own place.** When the ask names one business as the person's own — my coffee shop, our kitchen, my company — the app is that business: the owner holds the `owner` role from the start, staff are a role the owner hands out, and any record of the business itself (its profile, its hiring area) is created under `ctx.requireRole("owner")`, visitors reaching it by the id in its link. Every view opens the object its link names, then the person's own, then the one they tap in the list, with a shared one waiting there until they open it; the access skill's _A person's view opens their own object first_ has the order.
423
424
  - **Invite with the actual membership candidate.** When the ask names sharing, a group or other people, include `HandleInput` from `useViewer()` and a handler that saves `{ _id: "member:" + place + ":" + handle, type: "member", studioHandle: me.userHandle, userHandle: handle, addedBy: me.userHandle, authorHandle: me.userHandle }` for the person's own tree, or the same record with `loomId` for a loom. Every member record carries the same `studioHandle` as the tree it joins — the field the rules require of every record in a tree — in the `can.create` preview that decides whether the card shows and in the record the invite saves, both built by one `memberFor`. Construct that value after the picker resolves the handle, gate it with `can.create`, then persist the same value. The `member` branch admits exactly that shape: in a tree the writer grants their own channel, on a second object its admin grants that object's channel, and the subject, place and writer stay fixed. A resolved `invite:<id>` is stored as the subject just like a handle. Await a real membership write and readback before saying a named person is in. The friend's side is the other half of the same feature: the app reads `member` records back and lists each tree one names beside the person's own, as the `places` picker above does, and a tree shows its records from every writer, so a friend who opens the app picks the owner's tree and sees everything in it, keyed by the tree's field (`studioHandle`) rather than by who wrote each record. When the app is a person's own collection, this same control is its first-screen share, with the line "Yours alone — add a friend to share it" beside it; otherwise, when sharing was not asked for, offer inviting as a closing option.
424
425
  - **Persist the sharing choice.** A public/follower toggle writes the field its rules read (`isPublic`, `sharedWithFollowers`), with the full edited candidate checked before saving. Its who-can-see line sits beside that control and describes the channel the rules actually share. Follow `access.md` for follower consent and channel granularity.
425
426
  - **Protect supporting records.** A membership record containing contact details or a capability token belongs only to its intended readers; choose its private channel accordingly while its grant admits the recipient to the place's channel. Keep contact/token-bearing types distinct from ordinary content and out of content queries and Ask inputs.
@@ -124,7 +124,7 @@ Target ~40–60 lines. The shell should look like a real app with empty sections
124
124
 
125
125
  **Step 2 — Feature edits.** Wire each feature with SEARCH/REPLACE edits. Each edit gets exactly one prose line (≤25 words) before it. Wire hooks, data, handlers, and `useFireproof` in these edits. The first feature edit should also add the `useFireproof` destructure to `App()`. Keep edits focused — one feature per edit, fully working after it lands.
126
126
 
127
- **This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example).
127
+ **This turn writes the app's `access.js` with the app, every app** — the rules that decide who sees and changes each record: an app the person keeps to themselves gives each signed-in person their own collection keyed on the writer's handle, shared by adding a friend, and an ask for no access control gets rules that admit everyone (keeping it to themselves decides when an ask says both); the access skill doc carries its emit format, placement and worked examples, and the file ends with its one plain-language `// Summary:` line saying what people can do with each record. When the app needs server work (a schedule, an outside read, a notification), this turn writes its `backend.js` too, in the format the backend skill doc teaches. UI copy names the sharing those rules give, in one short line beside the share, invite or publish control: "yours alone — add a friend to share it" beside the add-a-friend control of a collection the rules keep to its person, and an open board says everyone with the link can see it. The title, subtitle and hero say what the app is for. Gate every write surface on `useVibe(dbName).can` — the liveness gate every app carries. The rules and the record shapes they key on are plumbing, with nothing on screen of their own. The object list is part of that plumbing: `App.jsx` reads the objects by their `type`, which returns the ones the person made and the ones a membership lets them into, and marks each shared one with `ViewerTag` for its maker — in the same list, or in a section that renders once there is at least one; opening a shared object reads and writes its records with that object's id, each write gated on `can`. The invite screen — the platform's `HandleInput` writing a membership into the person's object — joins this turn's `App.jsx` when the request names other people, sharing, a group, a team, a family, "we" or "our", or a person by name; a person's own collection carries it on the first screen as its add-a-friend control; every other first build offers it as one of the closing `▸` options, in the app's own words ("Let a friend add pages to your sketchbook"). The invite may wait for an option; the way to share does not: every first build that is not privacy-sensitive ships one on its first screen, and the access skill's rule picks it from what one record is — a record a person keeps for their own life (a check-in, an entry, a line in a list) belongs to a collection that is private to its person and shared by adding a friend, so the add-a-friend control is that app's first-screen share; a piece made for readers (a post, an article, a gallery piece) carries its own draft-then-publish step (the sketches example); a thing made to be seen the moment it exists lands on an always-on shared channel (the character-cast example); and a record a visitor sends the owner (an order, a booking, feedback, a message) routes to the owner's channel and the sender's own (the owner's alone when the sender is signed out), while a public record keeps its private half (contact details, costs, suppliers, who booked) on a sibling record in the owner's channel (the inbox example); and a business that serves many clients (a daycare, a tutor, a coach, a salon, a clinic, a landlord) gives each client its own record and channel, held by the owner and staff roles, with a client's invite granting only that client's channel, as each group in a bill splitter or trip planner keeps its records on its own channel (the daycare example).
128
128
 
129
129
  After your last code block, add a short 1-2 sentence message describing the core workflow the app supports.
130
130
 
@@ -422,6 +422,7 @@ Write this turn's `access.js` against precisely these shapes: the person's own r
422
422
 
423
423
  - **Keep the opening view useful.** The person arrives inside their own tree: the first screen is the app at work, named for the app, with a rename that writes the settings record when they want a name of their own. The header carries the app's name once; a separate name line becomes useful after a rename or a second object. A second-object form joins the object list when useful. Show the person's own tree, each tree a membership lets them into, and the whole readable type-query result of second objects, including ones someone else made; `creatorHandle` identifies their makers.
424
424
  - **A page set up for visitors is a product its provider owns.** "My booking page", "my clients", "my menu" are the words of the service provider speaking — usually the person who made the app, never assumed to be — so every signed-in person can set up pages of their own (`_id: "page-" + crypto.randomUUID()`, a write-once `creatorHandle`), what visitors make on it carries its `pageId` and is read only by that visitor and the page's provider, and each page has its own `#page=<pageId>` link its provider copies to share. Clients can offer services too, by setting up a page of their own. No rule or screen reads who owns the vibe. The access skill's _A page a person sets up for their own visitors_ has the rules.
425
+ - **A single business is the owner's, and a view opens the person's own place.** When the ask names one business as the person's own — my coffee shop, our kitchen, my company — the app is that business: the owner holds the `owner` role from the start, staff are a role the owner hands out, and any record of the business itself (its profile, its hiring area) is created under `ctx.requireRole("owner")`, visitors reaching it by the id in its link. Every view opens the object its link names, then the person's own, then the one they tap in the list, with a shared one waiting there until they open it; the access skill's _A person's view opens their own object first_ has the order.
425
426
  - **Invite with the actual membership candidate.** When the ask names sharing, a group or other people, include `HandleInput` from `useViewer()` and a handler that saves `{ _id: "member:" + place + ":" + handle, type: "member", studioHandle: me.userHandle, userHandle: handle, addedBy: me.userHandle, authorHandle: me.userHandle }` for the person's own tree, or the same record with `loomId` for a loom. Every member record carries the same `studioHandle` as the tree it joins — the field the rules require of every record in a tree — in the `can.create` preview that decides whether the card shows and in the record the invite saves, both built by one `memberFor`. Construct that value after the picker resolves the handle, gate it with `can.create`, then persist the same value. The `member` branch admits exactly that shape: in a tree the writer grants their own channel, on a second object its admin grants that object's channel, and the subject, place and writer stay fixed. A resolved `invite:<id>` is stored as the subject just like a handle. Await a real membership write and readback before saying a named person is in. The friend's side is the other half of the same feature: the app reads `member` records back and lists each tree one names beside the person's own, as the `places` picker above does, and a tree shows its records from every writer, so a friend who opens the app picks the owner's tree and sees everything in it, keyed by the tree's field (`studioHandle`) rather than by who wrote each record. When the app is a person's own collection, this same control is its first-screen share, with the line "Yours alone — add a friend to share it" beside it; otherwise, when sharing was not asked for, offer inviting as a closing option.
426
427
  - **Persist the sharing choice.** A public/follower toggle writes the field its rules read (`isPublic`, `sharedWithFollowers`), with the full edited candidate checked before saving. Its who-can-see line sits beside that control and describes the channel the rules actually share. Follow `access.md` for follower consent and channel granularity.
427
428
  - **Protect supporting records.** A membership record containing contact details or a capability token belongs only to its intended readers; choose its private channel accordingly while its grant admits the recipient to the place's channel. Keep contact/token-bearing types distinct from ordinary content and out of content queries and Ask inputs.