Propose team provisioning: Home operator endpoint, Alta app, Team page
Three design documents, unreviewed, no code: - team-provisioning-amendment.md: mount the existing operator engine and verbs behind POST /operator/v1 on each Home role, authenticated by a pinned Alta signature plus an approval window opened by Paul's fresh Home assertion; provenance fence; consumer registry beyond HOME_CONSUMERS' 16. - team-provisioning-app.md: Alta, the Paul-only provisioning app; CARLOS service credentials, deny-by-default per-app recipes, resumable state machine, deprovisioning. - team-members.md: the owner-only Team page with add-by-email resolved on the credential origin, display options, and roster mode for the other five apps.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 files changed,
+898
−0
implementation/team-members.md+226 −0implementation/team-provisioning-amendment.md+375 −0implementation/team-provisioning-app.md+297 −0
CI passed — run details
diff --git a/implementation/team-members.md b/implementation/team-members.md| new file mode 100644 |
| index 0000000..71381f0 |
| --- /dev/null |
| +++ b/implementation/team-members.md |
| @@ -0,0 +1,226 @@ |
| +# π€ Team members: the owner's Team page, and roster mode in every app |
| + |
| +**Status:** PROPOSED, 2026-10-27. Drafted by Claude Opus 5.5 for Paul. Not |
| +reviewed; **no code until a top-model review approves it** (AGENTS.md |
| +"Review"). Base: Home origin/main `e2ec1ab`; Docs `d867db1`, Sheets |
| +`af8deeb`, Slides `ebbb08f`, Calendar `00d8e3d`, Meet/Calls `47afcb9`, |
| +Memoria `521ae24`. |
| +**Implements** spec ruling 23, Β§10 (`memberships` "written only at the |
| +directory origin, by a team owner, behind a fresh-assertion step-up"), Β§14's |
| +step-up row, and gate 21. Companions: `team-provisioning-amendment.md` |
| +(seeds the first owner) and `team-provisioning-app.md`. |
| + |
| +--- |
| + |
| +## 1. Scope |
| + |
| +Part A: an owner-only **Team page** on `https://oficina.works` that lists a |
| +team's members and lets an owner add, remove, promote and demote them. |
| +Part B: the follow-on β **roster team mode** in Sheets, Slides, Calendar, |
| +Calls and Memoria, which only Docs has today. Until Part B lands for an app, |
| +that app ignores the Team page and keeps admitting by its own allowlist. |
| + |
| +## 2. The page |
| + |
| +- **Route:** `GET /team?team=<sqid>` (ruling 22: team views carry `?team=`). |
| + Linked from the springboard's account menu as "Team" **only** when the |
| + signed-in person owns the selected team. |
| +- **Who sees it:** a directory session whose subject has `role = owner` in |
| + `memberships` for that team. **Everyone else β a member, a guest, a |
| + stranger, an unknown or malformed sqid β gets the same 404** as an unknown |
| + route (gate 4's pattern; gate 21). No 403 anywhere on this surface. |
| +- **Reading needs a session; writing needs step-up.** Every POST checks the |
| + directory session's `auth_time` is within 300 s and not in the future |
| + (`fresh-assertion.md`). If it is not, the POST renders the existing |
| + continuation page to `/auth/start?return_to=%2Fteam%3Fteam%3D<sqid>` with |
| + `max_age=300` (handoff `StartFresh`), and the person repeats the action |
| + after returning. The submitted change is **not** retained across the |
| + step-up (same rule as the chooser's expired-session POST). |
| +- **Scriptless.** Every action is a plain form POST with CSRF; estilo's |
| + `busy.js` is the only script, already on Home's closed list. |
| +- **Shape (estilo, Calma door rules β sky only on the team header):** |
| + |
| +``` |
| + Oficina βΎ Lagged [account βΎ] |
| + βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| + Team [Add person] |
| + Till Owner added 27 Oct [Make member] [Remove] |
| + You Owner added 27 Oct [Make member] |
| + (no label) β¦k7q Member added 28 Oct [Make owner] [Remove] [Label] |
| + Changes reach every app in this team within a minute. |
| +``` |
| + |
| +## 3. Rules every write keeps |
| + |
| +1. **Owner only, re-checked inside the write transaction** (the page render |
| + is not authority). |
| +2. **Never zero owners.** Removing or demoting the last owner refuses with |
| + fixed copy. Without this a team's roster becomes unwritable and the only |
| + exit is the operator seed (Β§5.2's "operator reset in all but name"). |
| +3. **One membership row per (team, person).** Adding an existing member |
| + refuses with "already on this team"; role changes use their own button. |
| +4. **Epoch bumps** come from the existing `memberships_epoch_*` triggers; no |
| + second increment. Instances see a change within the roster lease |
| + (refresh due 30 s, hard expiry 60 s β `roster-contract.md`). |
| +5. **Bounds:** 500 members per team (well inside the roster's 10,000 and |
| + 100-per-page limits; a number with a reason: a team page, not a |
| + directory). 30 writes per owner per hour. |
| +6. **Call 2 still cannot write `memberships`**, and nothing here changes |
| + that. |
| + |
| +## 4. Adding someone by email |
| + |
| +**The problem.** The owner knows an address. The roster keys on a person |
| +ref. Turning one into the other needs the pepper, which only the credential |
| +role holds (ruling 4), and `home-operator-seed.md` rules that *"the |
| +directory cannot request address resolution over HTTP."* The directory must |
| +also never see the address at all β it is the origin that renders |
| +account-authored strings and holds the roster. |
| + |
| +**The design: the browser carries the owner to the credential origin, which |
| +resolves and signs.** The address is typed on `id.oficina.works`, never on |
| +`oficina.works`. |
| + |
| +1. **Directory, `POST /team/add` (owner, fresh).** Stores an add-intent row: |
| + hash of a random 32-byte intent id, team id, requester person ref, chosen |
| + role, sealed optional display label (Β§5), expiry 10 minutes. 303s (via |
| + the continuation page) to |
| + `https://id.oficina.works/resolve?consumer=directory&intent=<id>`. |
| +2. **Credential, `GET /resolve`.** Requires a complete credential session. |
| + Renders fixed copy only β "Enter the email address of the person to |
| + add" β **no team name, label or sqid on the page** (origin separation, |
| + gate 5). The intent id rides a sealed `__Host-` cookie, as `/authorize` |
| + does. |
| +3. **Credential, `POST /resolve`.** Normalizes and blind-indexes with the |
| + sign-in helper; finds the person, or mints a person stub exactly as call |
| + 2 does for a never-signed-in guest (Β§6). Rate limited: 20 per subject per |
| + hour, plus the existing per-IP budget. Signs a **member-resolution |
| + receipt**: `{v, purpose:"member-resolve", iss, aud:<directory>, |
| + requester:<session sub>, intent, person_ref, iat, exp β€ 120 s, jti}` with |
| + a new dedicated P-256 key (`HOME_RESOLVE_KEY`, pinned on the directory; |
| + distinct from the assertion, operator and roster keys) under context |
| + `oficina/home/member-resolve/v1`. Auto-POSTs it to the directory with the |
| + existing handoff page (static script, Continue button with script off). |
| + The address is dropped. **The response never says whether the person |
| + already existed.** |
| +4. **Directory, `POST /team/resolved`.** Verifies the receipt (key, context, |
| + `aud`, expiry, single-use `jti` in its own store), loads the intent by |
| + hash, and requires `requester` = intent requester = current directory |
| + session subject. Like the assertion callback it does **not** write here: |
| + it stores the verified result in the sealed inbox and 303s to |
| + `GET /team/confirm`. |
| +5. **Directory, `POST /team/confirm`** (same-origin, CSRF, still fresh): |
| + re-checks owner, writes `(team, person_ref, role)` and the sealed label in |
| + one transaction, deletes the intent. Done. |
| + |
| +**Telling the person.** Two options; recommended (a): |
| + |
| +- (a) The credential role sends one fixed mail from step 3: "Someone added |
| + you to a team on Oficina. Sign in at https://oficina.works." No team name, |
| + no inviter (the credential role never renders an account-authored string; |
| + this keeps mail to the same rule). Outbound mail carrying the address is |
| + inherent and already disclosed (Β§3.4). |
| +- (b) No mail; the owner tells them. |
| + |
| +**What this costs the one rule.** Nothing new at rest: the address is |
| +transient on the credential role, as on every sign-in; the directory holds a |
| +person ref, as it does for every member. Gate 2 gains a fifth path (resolve) |
| +that receives an address and must leave none readable, WAL included. |
| + |
| +## 5. What the page can show |
| + |
| +The directory knows a member only as a person ref. Options: |
| + |
| +| | Shows | New at rest | Verdict | |
| +|---|---|---|---| |
| +| A | Role, "You", a short ref tail (`β¦k7q`), added day | Nothing | Always the fallback; unusable past a few people | |
| +| B | **Owner-chosen label per member** ("Till"), sealed like team display names | A sealed `(team, person_ref) β label` column, owners-only | **Recommended** | |
| +| C | A name each person sets for themselves, suite-wide | A per-person preference; a new assertion-adjacent field (Β§8 says keep that set small) | Later, if ever | |
| +| D | The address, fetched from the team's own instances (they may hold addresses, ruling 5), rendered in RAM | No column, but a new homeβinstance call and a cross-instance join | Reject: grows Home, and Home-only members have no address in any instance | |
| +| E | The address, kept by Home | A readable address | **Forbidden** by the one rule | |
| + |
| +**B in detail.** `membership_labels(team_id, person_ref, sealed_label, |
| +updated_at day)` in the directory DB, sealed with the existing ID-bound |
| +helper and a new purpose. 1β64 UTF-8 bytes; **refuse any value containing |
| +`@`**, and say so in the field hint, so a label is not quietly an address. A |
| +determined owner can still type one; it is sealed, so it is not *readable at |
| +rest*, which is the rule's test β but Β§3.2's "Sealed" list gains "member |
| +labels" and the README's published list says owners can name members. Set at |
| +add time (optional) or later via [Label]; visible to owners only; deleted |
| +with the membership row. Labels never ride an assertion, call 8 or a log. |
| + |
| +## 6. Gates |
| + |
| +- **Gate 21** β every write requires a fresh assertion (`auth_time` 301 s |
| + refuses; future refuses); call 2 cannot write `memberships`; a write |
| + naming a team the caller does not own answers the same 404 as an unknown |
| + team; a member (non-owner) gets 404 on GET and every POST. |
| +- **Gate 4** β owner of Acme opening `/team?team=<beta>` gets 404. |
| +- **Gate 2** β resolve path extended; labels with canary addresses-looking |
| + strings are refused, and canary labels appear only as ciphertext. |
| +- **Gate 5** β `/resolve` renders no account-authored string (scan with a |
| + canary team name and label present in the directory). |
| +- **Gate 9** β no address, label, team name or person ref fragment in logs. |
| +- **Last-owner** β remove/demote the sole owner refuses; with two owners, |
| + either may leave. |
| +- **Cross-origin** β receipt replay, wrong `aud`, wrong requester (another |
| + owner's session), expired intent, a receipt for team A confirmed into team |
| + B, and a directory-only attacker (no credential session) all fail. |
| + |
| +## 7. Part B β roster mode in the other five apps |
| + |
| +**What Docs already does** (`internal/docs/team_config.go`, |
| +`team_access.go`, `teamstate`): `DOCS_TEAM_ID`, `_DIRECTORY_ORIGIN`, |
| +`_PROVISIONING_BASE64`, `_OPERATOR_KEYS_BASE64`, `_ROSTER_TOKEN` (all or |
| +none, and only with `DOCS_HOME_*`); a verified provisioning record; the |
| +`home/roster` cache; tri-state admission (Member / NotMember / Unknown); |
| +grant-only query mode when not a member; lease re-check before every commit |
| +and stream event; a fingerprint marker that refuses to boot back into |
| +allowlist mode. Each port copies that shape with `<APP>_TEAM_*` names and |
| +the same five variables. Shared code to extract first: a small |
| +`home/teammode` helper (config parse, record verification, admission |
| +middleware, fingerprint marker) so five apps do not re-implement Docs' |
| +`team_config.go`. Then per app: |
| + |
| +| App | Admission today | Port work beyond the shared helper | Hard part | |
| +|---|---|---|---| |
| +| Sheets | `SHEETS_OWNERS` (everyone is co-owner) | Member = the team rung; grant-only mode for any per-sheet sharing; close live edit channels at lease expiry | None special | |
| +| Slides | `SLIDES_ALLOWED_ADDRESSES` | As Sheets; presigned GETs are valid one hour β cap them at the lease ceiling (60 s) in team mode, or accept and document | Asset URLs outliving removal | |
| +| Calendar | `CALENDAR_ALLOWED_ADDRESSES` | Published `.ics` feed tokens stay capability links (like Docs public links) and need an owner revoke; reminders need an address | Home-only members have no address in the instance β reminders need an in-app "email for reminders" the instance stores (ruling 5 allows instances to) | |
| +| Calls | `CALLS_ALLOWED_ADDRESSES` | Check standing at room join and on every signaling reconnect; close the signaling socket at lease expiry | Native Mac/iOS clients assume one host; they need a team-host picker and Home sign-in | |
| +| Memoria | `MEMORIA_OWNERS` | Grant-only mode applies to search results and the AI answer's sources; sibling calls already bind to `MEMORIA_TEAM` hosts | AI stays off unless the team owner opts in (see `team-provisioning-app.md` Β§5) | |
| + |
| +**Order:** Sheets, Slides, Memoria, Calendar, Calls β easiest first; Calls |
| +last because of native clients and live media. |
| + |
| +**Until an app is ported**, its `lagged` instance runs Home sign-in plus its |
| +own allowlist holding only the owner's address (Track 1). Alta registers it |
| +as a credential consumer so Home sign-in works, but leaves its directory |
| +`team_instances` row **pending**: `roster-contract.md` forbids marking an |
| +instance live in the chooser before TeamMode passes its gates. Adding someone |
| +on the Team page therefore does nothing in that app until it is ported; |
| +Alta's per-instance allowlist edit (Paul only) is the stopgap. |
| + |
| +**Acceptance per port:** Docs' existing roster test list (two teams, removal |
| +within 60 s under failing refresh, grant-only vs owner shortcut, stream |
| +closure, fingerprint lock-in), plus a readiness probe `GET /api/team` |
| +returning only `{team_mode, consumer, roster:"ok"|"stale"|"unknown"}` for |
| +Alta's activation evidence. Full app CI, top-model review, verified canary. |
| + |
| +## 8. Not in this design |
| + |
| +Guests (unchanged: instance grants, `kind = guest`); per-team 2FA floor |
| +(Β§14); ownership transfer as its own verb (promote + leave covers it); |
| +invitations that wait for acceptance (membership is immediate; standing |
| +does nothing until the person signs in); suite-wide sign-out. |
| + |
| +## 9. Open questions for Paul |
| + |
| +1. Display: **B (owner-chosen sealed labels)**, or A only? |
| +2. Tell the added person by a fixed Home mail (a), or leave it to the owner |
| + (b)? |
| +3. Should members (not only owners) see the member list? Ruling 23 makes |
| + the page owner-only for writes; reads by members are not ruled. This |
| + design says owners only. |
| +4. Port order β Sheets, Slides, Memoria, Calendar, Calls β or follow what |
| + Till actually uses first? |
diff --git a/implementation/team-provisioning-amendment.md b/implementation/team-provisioning-amendment.md| new file mode 100644 |
| index 0000000..18cfca4 |
| --- /dev/null |
| +++ b/implementation/team-provisioning-amendment.md |
| @@ -0,0 +1,375 @@ |
| +# π€ Amendment: the operator endpoint (teams without the maintenance worker) |
| + |
| +**Status:** PROPOSED, 2026-10-27. Drafted by Claude Opus 5.5 for Paul. Not |
| +reviewed. **No code until a top-model review approves this file** (AGENTS.md |
| +"Review") and Paul confirms the open questions at the end. Direction approved |
| +in principle by Paul, 2026-10-27: "the provisioning app creates teams, owners |
| +and consumer registrations through a narrow, authenticated Home endpoint, |
| +instead of the blocked platform-117 maintenance worker." |
| +**Base:** origin/main `e2ec1ab`. Companion files: |
| +`team-provisioning-app.md` (the caller, called **Alta** below) and |
| +`team-members.md` (the owner's Team page). |
| + |
| +--- |
| + |
| +## 1. What changes, in one paragraph |
| + |
| +Every operator verb in `internal/operator` runs today only inside a platform |
| +maintenance worker that does not exist (platform discussion 117). This |
| +mounts **the same engine and verbs** behind one HTTP route per Home role, |
| +callable only by one pinned external signer (Alta) **and** only inside a |
| +short approval window opened by Paul's fresh Home sign-in. It adds consumer |
| +registration and retirement verbs, and moves the credential consumer list |
| +out of the 16-entry `HOME_CONSUMERS` env var into the credential database. |
| +**Home still holds no platform credential** (spec Β§7's load-bearing fact): |
| +Alta creates instances; Home records facts about its own resources. |
| + |
| +## 2. Approved text this supersedes (quoted) |
| + |
| +Each quoted file gains a one-line pointer here when this lands. |
| + |
| +1. `home-provisioner.md`: *"Implement a separate local Go command, |
| + `oficina provision`, callable directly by a human. β¦ Every maintenance |
| + mutation still requires its actual browser session, CSRF, current |
| + account-owner lookup and `requireFreshAuth`."* β Replaced by Β§4: Alta's |
| + signature plus Paul's fresh Home assertion. |
| +2. `home-provisioner.md`, "Signed private operation contract": *"The fixed |
| + operator entry point is enabled only for maintenance execution of the |
| + immutable configured release. Normal HTTP startup does not expose it. Tests |
| + must prove direct app requests cannot invoke it."* β Replaced: normal HTTP |
| + startup exposes `POST /operator/v1` **only when** `HOME_OPERATOR_HTTP` is |
| + configured (Β§3); tests prove it is absent otherwise. |
| +3. `home-operator-seed.md`, "Transport and command boundary": *"Platform |
| + discussion 117 owns stopping traffic and all background work, holding the |
| + database lease β¦ The command never starts an HTTP server, sends mail or |
| + makes network calls."* β Replaced for this path. The engine serializes |
| + with `BEGIN IMMEDIATE` on the serving process's own writer, so |
| + `home-operator-open.md`'s fenced-identity proof is moot here. |
| +4. `roster-contract.md`: *"This module β¦ adds no public bootstrap route and |
| + no runtime operator mutation transport. Live provisioning/restore remains |
| + gated on supported fenced maintenance (platform discussion117) or a |
| + separately reviewed genuinely fresh first-boot path."* β This file is that |
| + separately reviewed transport, for provisioning only. **Restore stays |
| + gated** (Β§6). |
| +5. `home-provisioner.md` step 6: *"Register the exact consumer with credential |
| + Home by updating its bounded immutable HOME_CONSUMERS manifest β¦ Current |
| + source allows16 entries/8192bytes β¦ stop at the bound. Scalable |
| + registration is separate work."* β Replaced by Β§7. |
| +6. `team-entry.md`: *"No request can register or alter a consumer."* and |
| + *"pilot bootstrap is not a web administration endpoint."* β Narrowed: one |
| + signed, approved request type can register or retire a consumer; no |
| + browser request can. |
| +7. `directory-runtime.md`: *"There is currently no exported network writer |
| + that can mark an instance live."* β Now there is exactly one, Β§5. |
| +8. Spec Β§10: the first owner is *"seeded by the drain with the person the |
| + sealed queue payload Β§7 already carries."* β Widened: the owner may also |
| + come from an **operator-authored plan** (Paul types it into Alta), as |
| + `home-provisioner.md` already allowed for synthetic pilots. The queue |
| + (call 4) is untouched and still drained by a human. |
| +9. `operator/verification.go` `ActivationEvidence.EnvironmentBinding` and |
| + `ManifestDigest` were specified as maintenance-environment facts. On this |
| + path they are Alta's observations through the CARLOS console and the |
| + credential role's consumer-registry digest |
| + (`team-provisioning-app.md` Β§7). Same fields, weaker provenance, said so. |
| + |
| +**Rules this touches that only Paul can re-rule:** |
| + |
| +- **Ruling 8's Rejected column:** *"A standing console token in a |
| + web-facing app."* Its reason (Β§7) β an RCE on Home's sign-in surface must |
| + never reach instance creation β still holds: Home holds no CARLOS |
| + credential. But **Alta is a web-facing app holding standing CARLOS |
| + credentials**, the rejected alternative read literally. Paul's 2026-10-27 |
| + direction is taken as re-ruling it for a separate, Paul-only app; record |
| + that in Β§1 rather than leave it implicit. |
| +- **Ruling 7** is unaffected: Alta is the human gate and never auto-drains |
| + the signup queue (Β§14's three conditions are unmet). |
| + |
| +**Not superseded:** Β§0 the one rule; Β§2.2's four never-dos; ruling 4 (the |
| +pepper stays on the credential role); ruling 19 (labels reserved suite-wide); |
| +ruling 23 (roster written only by an owner behind step-up, **or seeded with |
| +the first owner**); `home-operator-seed.md`'s *"The directory cannot request |
| +address resolution over HTTP"* β nothing here lets the directory ask the |
| +credential role anything. |
| + |
| +## 3. Where it lives and how it is switched on |
| + |
| +- **Route:** `POST /operator/v1` and `POST /operator/v1/approve` on each |
| + role's own origin β `id.oficina.works` (credential verbs only) and |
| + `oficina.works` (directory verbs only); `allowedAction` already splits |
| + verbs by role. |
| +- **Off unless configured.** `HOME_OPERATOR_HTTP` (JSON, β€ 8 KiB, closed |
| + fields) per role: `version`, `role`, `origin`, `installation`, `registry`, |
| + `device`, `public_key`, `key_id`, `actions` (β€ 8, subset of Β§5's allowlist), |
| + `operator_subject` (Paul's person ref), `approver_origin` (Alta's exact |
| + origin), `prefilter_token_sha256`. Absent β the route is not mounted (404, |
| + indistinguishable from any unknown path). Malformed β boot refuses. |
| +- **Separate key from every other key.** Alta's operator public key must |
| + differ from the assertion key, owner-seed signer, directory provisioning |
| + signer and roster keys (`NewDirectory`/`NewCredential` already refuse |
| + equality; extend to the HTTP loader). |
| + |
| +## 4. Authentication: two keys, neither sufficient alone |
| + |
| +A request is accepted only if **all** of these hold, checked in this order, |
| +before any database write: |
| + |
| +1. **Not a browser.** Refuse if the request carries `Cookie`, `Origin`, |
| + `Sec-Fetch-Site` or `Sec-Fetch-Mode`. No CORS. `Content-Type: |
| + application/json`, body β€ 64 KiB (existing `BodyLimit`), read with a hard |
| + limit before parsing. |
| +2. **Prefilter bearer** (`Authorization: Bearer`, 32 random bytes, compared by |
| + SHA-256 in constant time). This is a cheap DoS filter so unauthenticated |
| + bodies never reach the verifier. **It is not authority** and is documented |
| + as such. |
| +3. **Alta's signature** β the existing `Verifier.Verify` wrapper, unchanged: |
| + pinned P-256 key, context `oficina/home/operator-input/v1`, β€ 300 s |
| + validity, exact role/origin/installation/registry/device, per-role |
| + sequence = previous + 1 against the role's stored head. |
| +4. **An open approval window covering this operation** (new; replaces "fresh |
| + console approval"). See below. |
| + |
| +**The approval window.** `POST /operator/v1/approve` takes |
| +`{plan, assertion}`: |
| + |
| +- `plan` is a closed JSON object signed by Alta's same key under a new |
| + context `oficina/home/operator-plan/v1`: `plan_id` (32 random bytes), |
| + `role`, `kind` (`create-team` | `add-apps` | `retire-apps` | |
| + `initialize`), `label`, `apps` (subset of the compiled registry), `owner` |
| + (**credential plan only** β the address, transported privately; never |
| + stored, see below), `nonce`, `issued_at`, `expires_at` (β€ 900 s). Alta |
| + signs one plan per role with the same `nonce`; the directory's plan has no |
| + `owner` field, so the address never reaches the directory. |
| +- `assertion` is a normal Home browser assertion (wire v1) that Paul's |
| + browser carried to Alta after a **step-up** (`max_age=300`, |
| + `fresh-assertion.md`). Home verifies it with its own pinned keys: |
| + `iss` = credential origin, `aud` = the configured `approver_origin`, |
| + `sub` = the configured `operator_subject`, `auth_time` within 300 s and not |
| + in the future, `nonce` = `plan.nonce`, `jti` unused in **this role's own** |
| + `operator_approval_jti` table (self-pruning, like every verifier's). |
| +- On success the role stores one `operator_approvals` row: `plan_id`, `kind`, |
| + `label`, `apps`, `expires_at`, and on the credential role |
| + `owner_index` = the **blind index** of the address (the value `people` |
| + already stores; no new column class). The address itself is dropped after |
| + hashing. One open window per role at a time; a second refuses. |
| + |
| +Each `/operator/v1` request then names `plan_id` in a header |
| +(`Oficina-Plan`), and the role checks β inside the engine's transaction β that |
| +the window is open and the verb's decoded input is inside it: the label |
| +matches; the app is in `apps`; for `credential.owner-seed`, the input |
| +address's blind index equals `owner_index`. A window never widens and is never |
| +extended; expiry or `kind` mismatch refuses. |
| + |
| +**Why this shape.** Alta's key alone does nothing without Paul freshly |
| +signing in; Paul's assertion alone does nothing without Alta's key and is |
| +bound to one plan. It is "operator key + fresh console approval" with Home's |
| +own step-up as the console. **Said plainly rather than counted as a fix:** a |
| +compromised Alta *plus* Paul signing in to it opens a window for the |
| +attacker's plan. Β§8 bounds that window. |
| + |
| +## 5. Verbs: reused, new, and refused |
| + |
| +Existing verbs are **reused unchanged** β engine, idempotency by |
| +`operation_id`, sealed results, per-role stream, receipts, 10,000-operation |
| +cap, exactly as in `engine.go`. Each verb and the window kinds admitting it: |
| + |
| +| Role | Verb | Window kinds | |
| +|---|---|---| |
| +| credential | `credential.owner-seed` | create-team | |
| +| directory | `directory.inspect` (signed challenge, read-only) | any | |
| +| directory | `directory.seed-team` | create-team | |
| +| directory | `directory.provision-consumer` | create-team, add-apps | |
| +| directory | `directory.verify-consumer` | create-team, add-apps | |
| +| directory | `directory.activate-consumer` | create-team, add-apps | |
| +| directory | `directory.initialize` | initialize (once per installation) | |
| +| credential | `credential.register-consumer` **(new)** | create-team, add-apps | |
| +| credential | `credential.retire-consumer` **(new)** | retire-apps | |
| +| directory | `directory.disable-consumer` **(new)** | retire-apps | |
| +| both | `<role>.inspect` stream read **(new / extended)** | any | |
| + |
| +`directory.initialize` keeps its own precondition (no generation, no |
| +consumer, no tokens, no bootstrap receipt) and its `baseline_attestation`, |
| +which becomes Paul's explicit typed attestation in Alta, signed in the plan. |
| +It is reachable only under an `initialize` window, as the directory stream's |
| +first operation. |
| + |
| +**One stream per role.** The engine stores a single operator identity per |
| +role (`<role>_operator_state`: installation, registry, device, key) and |
| +refuses any other once one has acted. Whichever signer acts first β Alta |
| +here, or the native Linux command β owns that role's stream. Production has |
| +neither today. Re-enrolment is out of scope, so choosing Alta is choosing it |
| +for restore-time operations too, until a reviewed re-enrolment exists. |
| + |
| +**New verbs** (each with its own review and tests): |
| + |
| +- `credential.register-consumer {consumer_id, origin}` β inserts into the |
| + credential `consumers` table (Β§7); origin must be |
| + `https://<window label>.<window app>.oficina.works`; ID or origin |
| + collision refuses; returns the registry digest |
| + (`oficina/home/consumer-manifest/v1`) for activation evidence. |
| +- `credential.retire-consumer` β marks a table consumer `retired`; |
| + `/authorize` and sign-out refuse it. Env-manifest entries are out of reach. |
| +- `directory.disable-consumer` β `team_instances.state = disabled`, |
| + `roster_consumers.enabled = 0`, receipt with the existing `disable` value. |
| +- `<role>.inspect` β the signed read-only challenge, plus the role's stream |
| + `(sequence, head)`, so an Alta that lost its database can resume. |
| + |
| +The credential role cannot see labels, so a window naming a taken label |
| +could register a credential consumer for a sibling host of an existing team. |
| +It receives only assertions addressed to itself, and the directory fence |
| +below keeps it out of the chooser and roster. Alta seeds the team (which |
| +fails on a taken label) before registering any consumer. |
| + |
| +**Provenance fence (new, load-bearing).** Every directory verb except |
| +`inspect` and `initialize` may touch only a team whose `seed-team` committed |
| +through this HTTP stream, recorded in a new `operator_http_teams(team_id, |
| +operation_id)` table in the same transaction as the seed. **Paul's existing |
| +teams, and any team that existed before this migration, are unreachable |
| +from this endpoint.** That is the code form of Paul's 2026-10-27 ruling that new |
| +people never touch his existing apps. |
| + |
| +**Refused here, permanently or until their own design:** any membership |
| +write other than the seed's first owner (that is the Team page behind |
| +step-up β spec Β§10, `team-members.md`); rename; relabel; restore or generation change; |
| +token rotation; ownership transfer; team deletion; any read of memberships, |
| +names or people; any verb on a team outside the provenance fence. |
| + |
| +## 6. What the endpoint may not do |
| + |
| +- **Return anything readable:** only the engine's existing result JSON |
| + (ids, outcome, epoch, signed record, bearer, owner receipt) β no address, |
| + name or member list. Replay returns the same sealed result. |
| +- **Log content:** a fixed verb label, outcome code and operation-id prefix |
| + only (gate 9). |
| +- **Restore, rotate keys or re-initialize:** restore stays gated on 117. |
| +- **Act for a browser:** no cookie read, no session minted; the approval |
| + assertion is consumed, never exchanged for a session. |
| + |
| +## 7. Consumers beyond the 16-entry limit |
| + |
| +The 16-entry/8 KiB cap exists because the credential origin's CSP names every |
| +manifest origin in `form-action` (`security.go`, `runtime.go:102`). Two |
| +changes remove the cap without widening the CSP: |
| + |
| +1. **Per-response `form-action`.** The handoff page (the only credential page |
| + that posts cross-origin) sets `form-action 'self' <directory> |
| + <that consumer's origin>` for that one response. Every other credential |
| + page keeps `form-action 'self' <directory>`. Sign-out's allowlist reads the |
| + same registry. No wildcard, ever. |
| +2. **A credential-role `consumers` table** β `consumer_id` (PK, existing |
| + `consumerName` rule), `origin` (UNIQUE, exact canonical HTTPS), |
| + `state` (`active` | `retired`), `created_at` (day-coarsened), |
| + `operation_id`. Written only by Β§5's two credential verbs. Loaded at boot |
| + and reloaded in-process after each committed write; the effective registry |
| + is `HOME_CONSUMERS` βͺ table, and an ID or origin present in both refuses |
| + boot. Hard cap 4,096 rows, written in the migration as a CHECK-backed |
| + trigger with its reason (a typo-loop in Alta, not a scale target). |
| + |
| +`HOME_CONSUMERS` keeps the directory and Paul's existing consumers, unchanged. |
| +The directory needs nothing new here: `team_instances` and `roster_consumers` |
| +are already rows with no count cap. **All new tables, both roles, are |
| +additive:** credential `consumers`, `operator_approvals`, |
| +`operator_approval_jti`; directory `operator_approvals`, |
| +`operator_approval_jti`, `operator_http_teams`. |
| + |
| +## 8. Threat model: a compromised provisioner |
| + |
| +Assume an attacker holds Alta's operator key, its prefilter token and its |
| +CARLOS service credentials. |
| + |
| +- **Without Paul's fresh sign-in:** nothing at Home. No window opens. But |
| + Alta's CARLOS `operate` credentials can rewrite **any** environment of |
| + those apps, including the default bundle Paul's own instances run on (an |
| + attacker adds their address to `DOCS_ALLOWED_ADDRESSES`), and `instance` |
| + can delete Paul's instances. **That is the largest risk in the whole |
| + design, and it is not a Home risk** β Home cannot bound it. |
| + `team-provisioning-app.md` Β§3 lists the options (environment-scoped |
| + credentials, or a separate account). |
| +- **With one window (Paul signs in to a compromised Alta):** for 15 |
| + minutes, one label, the plan's apps: one new team with an owner of the |
| + attacker's choosing, consumers at `<that label>.<app>.oficina.works`, |
| + activated. Costs: a squatted label (no release verb yet), person stubs (a |
| + count), audiences valid only at themselves. **Cannot:** touch any existing |
| + team, instance or consumer (provenance fence); add a member anywhere; read |
| + any membership, name, address or content; mint a session; retire |
| + `HOME_CONSUMERS` entries; rename. |
| +- **Phishing, recorded:** a new team's consumer can be an attacker-run |
| + instance; it receives an unreversible `sub` and nothing else Home holds β |
| + the exposure every instance already has. **Replay:** single-sequence |
| + requests, single-use approval `jti`, nonce-bound plans. |
| +- **Compromised Home origins** are unchanged from Β§13a: the credential |
| + origin can sign in as anyone (including as Paul to approve a window β no |
| + worse than its existing power); the directory can already add members. |
| + |
| +## 9. The one rule and gates 1, 2, 9 |
| + |
| +- **No readable address at rest.** The address reaches the credential role |
| + twice (approve, owner-seed), is blind-indexed with the sign-in helper and |
| + dropped. Approval rows hold the blind index; result rows hold |
| + `HMAC(idempotency key, input)` and a sealed, address-free result. The |
| + directory sees only person refs. The falsifiable form gains nothing: |
| + consumers are hostnames, approvals are labels and blind indexes. |
| +- **Gate 1** drives the whole HTTP sequence with canary addresses and names |
| + and scans both databases, WAL and SHM. **Gate 2** gains owner-seed-over- |
| + HTTP and approve as two more address paths β *extended, not replaced*. |
| + **Gate 9** captures every log line and error across the same drive, |
| + hostile refusals included. **Gate 10** covers both routes' responses. |
| + |
| +## 10. Tests required before merge |
| + |
| +1. **Mounting:** route absent without `HOME_OPERATOR_HTTP`; each role |
| + refuses the other's verbs; Host-header spoofing refused. |
| +2. **Transport:** browser markers refuse; > 64 KiB refuses before parse; |
| + wrong content type refuses; bad prefilter β identical fixed 401. |
| +3. **Signature:** wrong key or context, expired, sequence gap, changed input |
| + under a used sequence; exact replay after expiry returns the stored |
| + result and mutates nothing. |
| +4. **Approval:** wrong `aud` or `sub`, `auth_time` 301 s old or in the |
| + future, nonce mismatch, reused `jti`, expired plan, a second window while |
| + one is open, a plan signed by another key. |
| +5. **Scope:** other label, app outside `apps`, owner whose blind index |
| + differs, verb outside `kind`, window expiring mid-run; provenance fence |
| + refuses every directory verb on a pre-existing team with the unknown-team |
| + code. |
| +6. **Registry:** 17th and 4,097th consumer; env/table collision refuses |
| + boot; retired consumer refused at `/authorize` and sign-out; the handoff |
| + page's CSP names exactly one consumer origin. |
| +7. **Mutation:** removing the approval check, the provenance check or the |
| + blind-index comparison each fails a named test. |
| +8. **Privacy and survival:** gates 1, 2, 9, 10 per Β§9; existing sessions, |
| + assertion keys and team ciphertexts survive the additive migrations |
| + (reopen with the old binary). |
| +9. **Canary:** on deployed previews, Alta creates `alpha` and `beta` with |
| + synthetic owners; each owner sees only their team; Paul's existing |
| + consumers keep working throughout. |
| + |
| +## 11. Alternatives rejected |
| + |
| +- **`carlos run` against Home's database** (a `run`-role credential with a |
| + fixed command list). It exists today, but it runs beside the serving |
| + process with no fence and no launch context, `operatorlaunch` would refuse |
| + it, and it is a database edit from outside the app in all but name. |
| +- **Alta writing Home's database directly**, or holding any Home key that |
| + signs assertions, receipts or roster pages. That makes Alta a third Home |
| + origin. |
| +- **Signature only, no approval window.** Simpler; turns Alta's stored key |
| + into a standing ability to mint teams and owners. Kept as open question 1. |
| +- **Waiting for platform 117.** Still blocked at platform `57aec0a` |
| + (`maintenance-exec.md`: final design approval pending; no command, no |
| + route). The native Linux command stays for restore, which this does not |
| + cover. |
| + |
| +## 12. Open questions for Paul |
| + |
| +1. **Two-key approval or signature only?** This file recommends requiring |
| + your fresh Home sign-in per run. Signature-only is simpler but makes |
| + Alta's stored key a standing ability to create teams. |
| +2. **Has production's directory ever been initialized** (a roster |
| + generation)? If not, the first run is an `initialize` plan with your typed |
| + attestation that it never issued one. Alta checks via `inspect` first. |
| +3. **Owner must already exist?** Recommended: Till signs in once at |
| + oficina.works first, and owner-seed runs `existing_only` β a typo then |
| + fails instead of minting an ownerless team. Otherwise a typo needs an |
| + ownership-transfer verb that does not exist. |
| +4. **Label release on retire.** Retiring every app leaves the team, its |
| + roster and its label reserved (ruling 19). Releasing a label needs its own |
| + design; leave it out of the first cut? |
diff --git a/implementation/team-provisioning-app.md b/implementation/team-provisioning-app.md| new file mode 100644 |
| index 0000000..10468ae |
| --- /dev/null |
| +++ b/implementation/team-provisioning-app.md |
| @@ -0,0 +1,297 @@ |
| +# π€ Alta: the team provisioning app |
| + |
| +**Status:** PROPOSED, 2026-10-27. Drafted by Claude Opus 5.5 for Paul. Not |
| +reviewed; **no code until a top-model review approves it and |
| +`team-provisioning-amendment.md`** (Home side). Facts below were read at |
| +origin/main: Home `e2ec1ab`, carlos platform `57aec0a`, Docs `d867db1`, |
| +Sheets `af8deeb`, Slides `ebbb08f`, Calendar `00d8e3d`, Meet/Calls `47afcb9`, |
| +Memoria `521ae24`. It replaces `oficina/teams/provision-team.py` (Track 1, |
| +written today) and keeps that script's central rule: **deny by default β a |
| +team instance inherits nothing from the app's default bundle unless the key |
| +is on that app's SHARED list.** |
| + |
| +--- |
| + |
| +## 1. What it is |
| + |
| +A Paul-only web app that creates a **team**: one CARLOS instance per app, |
| +each with its own config environment and fresh keys, attached at |
| +`<team>.<app>.oficina.works`, registered with Home as a consumer, and a Home |
| +team with its first owner. First run: label `lagged`, owner |
| +`till@lagged.biz`, apps docs, sheets, slides, calendar, calls, memoria. |
| + |
| +- **Name:** **Alta** (*dar de alta*, to enrol). Repo |
| + `/Users/paulcampbell/amadan.net/oficina/alta`, module |
| + `amadan.net/oficina/alta`, CARLOS app `alta`. |
| +- **Host:** `https://alta.oficina.works` (proposed; alternative: only its |
| + `alta.bds.oncarlos.com` route, unlisted). Never in Home's app registry, |
| + never a team instance, never in the chooser. |
| +- **Stack:** rastrillo (`amadan.net/rastrillo/rastrillo`, never the old |
| + github path), estilo chrome and door, Calma rules, attribute spelling, |
| + scriptless except estilo's `busy.js`. One binary, `CGO_ENABLED=0`, |
| + hibernates (it is used a few times a month). |
| +- **Not Home.** It holds the CARLOS credentials Home must never hold (spec |
| + Β§7's load-bearing fact). Home holds only Alta's public key. |
| + |
| +## 2. Who can use it |
| + |
| +- **Sign-in:** Home sign-in only (it is a consumer, `ALTA_HOME_*` via |
| + `home/connect`). No local magic link, no allowlist of addresses. |
| +- **Who:** exactly one person ref, `ALTA_OPERATOR_SUBJECT` (Paul's). Any |
| + other valid Home identity gets the same 404 as an unknown page. |
| +- **Every run needs a step-up** (`max_age=300`): Paul's fresh assertion is |
| + what opens Home's approval window (amendment Β§4). Reading status pages |
| + needs only a session (idle 30 min, absolute 12 h). |
| + |
| +## 3. Credentials it holds, and their reach |
| + |
| +**CARLOS.** A service credential holds exactly one role; `instance` creates, |
| +deletes and attaches domains but cannot write config; `operate` writes config |
| +and restarts but cannot create instances. So Alta holds **two per app**, |
| +minted by Paul (owner-only, never expire, rotatable): |
| + |
| + carlos services create --account oficina --role instance --app docs alta-docs-instance |
| + carlos services create --account oficina --role operate --app docs alta-docs-operate |
| + β¦ for sheets, slides, calendar, calls, memoria (12 credentials) |
| + |
| +Stored as Alta secrets `ALTA_CARLOS_<APP>_INSTANCE` / |
| +`ALTA_CARLOS_<APP>_OPERATE`, presented as `Authorization: Bearer` to |
| +`https://console.carloku.com/api/cli/apps/oficina/<app>/β¦`. |
| + |
| +**Their reach is wider than teams, and this is the design's biggest risk.** |
| +`operate` on an app can `PUT /config` for **any** environment, including the |
| +default bundle Paul's own instance runs on; `instance` can `DELETE` Paul's |
| +instance. Alta's code refuses both (Β§8), but a compromised Alta is not |
| +bound by its code. Options, for Paul (open question 1): |
| + |
| +- (a) Accept, with Alta hardened (Paul-only, two-key Home approval, no |
| + public listing). Fastest. |
| +- (b) **Ask the platform for environment-scoped credentials** (a credential |
| + that may only touch instances and config bound to named environments, and |
| + never the default bundle). Recommended for the long term. |
| +- (c) Put team instances in a separate CARLOS account (`oficina-teams`) |
| + with the same apps released there. Strongest isolation; doubles release |
| + work. |
| + |
| +**Memoria's README deploys with `--account bds`**, the others with |
| +`oficina`. Confirm they are the same account before minting. |
| + |
| +**Home.** `ALTA_OPERATOR_KEY` (P-256, signs operator requests and plans, |
| +context `oficina/home/operator-input/v1` and `β¦/operator-plan/v1`), |
| +`ALTA_OPERATOR_PREFILTER` (32 bytes), plus `ALTA_OPERATOR_INSTALLATION`, |
| +`_REGISTRY`, `_DEVICE` (random, generated once, pinned on Home). |
| + |
| +**Its own:** `ALTA_ORIGIN`, `ALTA_INSTANCE_KEY`, `ALTA_DEK` (seals rows). |
| + |
| +## 4. What it stores |
| + |
| +SQLite, sealed where marked: |
| + |
| +- `teams` β label, sealed display name, team sqid (after seed), state. |
| +- `owner_inputs` β **sealed** owner address, deleted when the team is live. |
| + Alta needs it for owner-seed and for the stopgap allowlists (Β§5); once |
| + both are written it has no further use. |
| +- `runs` / `steps` β the state machine (Β§6): step key, state, attempt count, |
| + CARLOS request ids, Home operation ids, timestamps, a fixed error code. |
| +- `operator_requests` β **sealed** exact signed request bytes per Home |
| + operation, kept so a lost result is recovered by exact replay (Home's |
| + engine returns the stored result and does nothing twice). This is how Alta |
| + avoids storing the roster bearer: it re-fetches it by replay when an app |
| + is ported later. |
| +- `operator_streams` β per Home role: last sequence and head digest. If |
| + Alta's DB is lost, it re-reads both through a signed `inspect` (amendment |
| + Β§5) rather than guessing. |
| + |
| +**Never stored:** generated app keys (sealed straight to the console's |
| +`secrets_pubkey` and sent; existence is checked by key name, never value), |
| +CARLOS tokens (env only), roster bearers, any team content, any log line |
| +with an address, label or key. |
| + |
| +## 5. Per-app recipes |
| + |
| +Each app gets environment `<team>` on that app (environments are per app). |
| +**Rule, enforced in code and re-checked by `audit`:** every key in the app's |
| +default bundle (env and secrets) must, in the team environment, be either |
| +**SET** to a team value, **GENERATED** fresh (32 random bytes, base64), on |
| +the app's **SHARED** list, or **BLANKED** (`""` as an env value). A key not |
| +in the recipe and not blanked is a refusal, not a warning. |
| + |
| +Common to every app (`<P>` = DOCS, SHEETS, SLIDES, CALENDAR, CALLS, |
| +MEMORIA): |
| + |
| +| Key | Treatment | |
| +|---|---| |
| +| `<P>_ORIGIN` | SET `https://<team>.<app>.oficina.works` | |
| +| `<P>_INSTANCE_KEY` | GENERATED | |
| +| `<P>_HOME_ISSUER` | SET `https://id.oficina.works` | |
| +| `<P>_HOME_CONSUMER_ID` | SET `<team>-<app>` (Paul's is never inherited) | |
| +| `<P>_HOME_KEYS_BASE64` | SET from Alta's pinned copy of Home's public assertion keys | |
| +| `<P>_HOME_DEK_BASE64` | GENERATED | |
| +| `HOME_DIRECTORY_ORIGIN` | SET `https://oficina.works` | |
| +| `OFICINA_DASHBOARD_TEAM` | BLANKED (Paul's value binds Paul's team); SET to the new sqid only if Paul says so (question 7) | |
| +| `CARLOS_SMTP_*` | SHARED (platform mail; sender is the suite's) | |
| + |
| +Per app (allowlist = the owner's address only, the Track 1 stopgap, until |
| +the app has roster mode β `team-members.md` Β§7): |
| + |
| +| App | GENERATED | SET | SHARED | Notes | |
| +|---|---|---|---|---| |
| +| Docs | `DOCS_CONTENT_KEY`, `DOCS_TEAM_ROSTER_TOKEN` (from Home, not random) | `DOCS_ALLOWED_ADDRESSES=""` (team mode permits empty); `DOCS_TEAM_ID`=sqid, `DOCS_TEAM_DIRECTORY_ORIGIN`, `DOCS_TEAM_PROVISIONING_BASE64` (signed record), `DOCS_TEAM_OPERATOR_KEYS_BASE64` (directory provisioning public key) | `DOCS_SMTP_*` (Docs reads no `CARLOS_SMTP_*`), `DOCS_SAMPLE_DOCUMENTS` | Team mode writes a fingerprint marker; the instance can never go back to allowlist mode | |
| +| Sheets | `SHEETS_DEK` | `SHEETS_OWNERS`=owner | β | | |
| +| Slides | β (no DEK in Slides) | `SLIDES_ALLOWED_ADDRESSES`=owner | `SLIDES_SMTP_*` if present | **Storage:** `CARLOS_STORE_*` must never be Paul's bucket. With `--private-storage` enabled on the app (person-only, once, needs a storage entitlement), each create gets its own bucket and an environment named after the host's first label (`lagged-slides`); Alta then uses that name. Without it, uploads answer 503 β acceptable until enabled. Bucket stays private (presigned GETs, no public URLs exist in Slides) | |
| +| Calendar | `CALENDAR_DEK` | `CALENDAR_ALLOWED_ADDRESSES`=owner | `CALENDAR_SMTP_*` if present | `CARLOS_CONTROL_SOCKET`/`ADMIN_TOKEN` are platform-set per instance | |
| +| Calls | `CALLS_DEK` | `CALLS_ALLOWED_ADDRESSES`=owner | `CARLOS_RELAY` (TURN, app-level), `CALLS_ZONE`, `CALLS_QUALITY_REPORTS` | APNs vars are not read by `main.go`; BLANKED anyway | |
| +| Memoria | `MEMORIA_DEK` | `MEMORIA_OWNERS`=owner; `MEMORIA_TEAM`=label | β | **AI off:** `MEMORIA_AI` BLANKED, `MEMORIA_TENSORX_KEY` BLANKED (Paul's key never reaches a team), `MEMORIA_SIBLINGS` and every `MEMORIA_SIBLING_TOKEN_*` BLANKED (they point at Paul's apps), `MEMORIA_ALLOW_LOGGED_MAIL` BLANKED. Memoria boots without an origin, so `audit` checks `MEMORIA_ORIGIN` explicitly | |
| + |
| +**Two console facts the recipe depends on** (verify before code): a |
| +named environment can override but **not remove** an inherited key, and an |
| +empty **secret** is refused while an empty **env** value is allowed β so |
| +BLANKED is an env-kind `""` over an inherited secret, as Track 1 does today. |
| +And the environment must be written **before** the instance is created, or |
| +the first boot runs on Paul's inherited keys and allowlist. |
| + |
| +**AI for a team** stays off until that team's owner asks and Paul agrees; |
| +TensorX is ZDR and "treated as local" for Paul's data (ruling 2026-09-19), |
| +which says nothing about another owner's. |
| + |
| +## 6. The state machine |
| + |
| +One **run** per (team, plan). Steps execute in order; each is |
| +**probe β act β verify β record**, so a crash anywhere resumes by probing. |
| +Nothing is inferred from a timeout; nothing is deleted to "clean up". |
| + |
| +| # | Step | Probe (idempotency) | Act | |
| +|---|---|---|---| |
| +| 0 | Preflight | label regex `^[a-z][a-z0-9-]{1,30}[a-z0-9]$`, not reserved; signed `inspect`: generation present, label free; console: env/instance/domain absent **or** already bound to this team | β | |
| +| 1 | Approve | an open window for this plan? | step-up β sign plan β `POST /operator/v1/approve` on both roles | |
| +| 2 | Owner | sealed receipt stored? | `credential.owner-seed` (`existing_only` if Paul agrees) | |
| +| 3 | Team | team sqid stored? | `directory.inspect` β `directory.seed-team` with the receipt | |
| +| per app: | | | | |
| +| 4 | Credential consumer | Home replay of the stored request | `credential.register-consumer` `<team>-<app>` | |
| +| 5 | Directory consumer | replay | `directory.provision-consumer` β signed record + bearer (pending) | |
| +| 6 | Environment | `GET /config?environment=<team>`: keys present, generated keys present by name | `PUT /config` with the recipe; **never regenerate** an existing key (a new DEK orphans sealed data) | |
| +| 7 | Instance | `GET /instances/<team>-<app>.bds.oncarlos.com`: exists and bound to `<team>` | `POST /instances {host, environment:<team>}`; 409 β probe again; bound elsewhere β stop | |
| +| 8 | Domain | `GET /domains`: `state` (never legacy `status`) | `POST /domains {host:<team>.<app>.oficina.works, route:<instance host>}`; poll to `state=live` (β€ 30 min, then park) | |
| +| 9 | Serving | `/api/version` body on the public origin equals the app's current release **and** the instance list's `update_report.serving` agrees (`X-Carlos-Version` alone can run ahead of the process) | `POST /restart/scope {host}` if config changed after start | |
| +| 10 | Verify | roster-mode apps only | `directory.verify-consumer` (600 s window); poll `GET /api/team` until `roster:"ok"` | |
| +| 11 | Activate | roster-mode apps only | `directory.activate-consumer` with evidence (Β§7) | |
| +| 12 | Audit | β | Β§5's rule against the live listings; then delete the sealed owner address | |
| + |
| +Apps without roster mode stop after step 9 with their directory row |
| +**pending** (not in the chooser β `roster-contract.md`), reachable at their |
| +own URL with Home sign-in and the owner allowlist. When an app gains roster |
| +mode, an **add-apps** run replays step 5 for the bearer and continues at 6. |
| + |
| +**Approval windows last 15 minutes**; domains and cold starts can outlast |
| +one. A run that parks after step 8 resumes later under a fresh step-up and a |
| +new window of kind `add-apps` for the same label and apps. |
| + |
| +**Adopting Track 1.** If `lagged` instances already exist from |
| +`provision-team.py` (env `lagged`, owner allowlist, no Home), steps 6β7 |
| +probe them as "bound to this team", keep every existing generated key, and |
| +add the Home keys. Docs switching to team mode then needs Till to **link** |
| +his existing local Docs account to his Home identity (the existing |
| +account-link flow) or his Track 1 documents stay under the old principal. |
| + |
| +## 7. Activation evidence (what step 11 signs) |
| + |
| +The existing `ActivationEvidence` fields, filled without platform 117: |
| +`app_version` from `/api/version`; `artifact_digest` from the instance |
| +record's serving build; `environment_binding` = SHA-256 over Alta's |
| +canonical recipe for this instance (key names, kinds, and SHA-256 of each |
| +SET value β never generated values); `credential_manifest_digest` from step |
| +4's result; `alias_host` from step 8. The amendment records that these mean |
| +"what Alta observed through the console", not a maintenance environment |
| +binding. |
| + |
| +## 8. Guards in Alta's own code |
| + |
| +- Every console call goes through one client that refuses: an empty |
| + environment name (the default bundle); an environment not equal to a |
| + label in `teams`; a host not of the form `<label>-<app>.bds.oncarlos.com` |
| + or `<label>.<app>.oficina.works` for a label in `teams`; any DELETE not in |
| + a deprovision run. Unit-tested with mutation tests. |
| +- Logs carry step keys and fixed codes only. |
| +- One run at a time (a process lock row); Home serializes per role anyway. |
| + |
| +## 9. Deprovisioning ("retire apps") |
| + |
| +Order, each step probe-first: `directory.disable-consumer` (bearer dead, |
| +tile gone) β `credential.retire-consumer` (no more sign-in) β `DELETE |
| +/domains/<team>.<app>.oficina.works` (the platform does not detach a claim |
| +when its instance is deleted) β `DELETE /instances/<host>`. What survives, |
| +and says so on the confirm page: the parked database replica and any private |
| +bucket (purged only by a CARLOS operator; re-creating the same host is |
| +refused until then), the environment bundle (Alta blanks its generated keys |
| +**only** after the purge), and the Home team row, roster and label (ruling |
| +19; no release verb yet). A confirm page names the team, lists each app, and |
| +requires typing the label. |
| + |
| +## 10. One-time setup (Paul, person-only) |
| + |
| +1. Mint the twelve service credentials (Β§3); `carlos secrets set --app alta`. |
| +2. Per app zone: wildcard DNS `*.<app>.oficina.works` β the deployment, and |
| + either a wildcard certificate claim or per-name certificates. Check |
| + whether console.carloku.com runs with `CARLOS_HOST_CLAIM`, which refuses |
| + catch-all and wildcard claims; explicit per-host attach is what Alta uses. |
| +3. Slides: `--private-storage` (needs the storage entitlement). |
| +4. Home: `HOME_OPERATOR_HTTP` on both roles with Alta's public key and |
| + Paul's person ref; enable the directory roster endpoint with its signing |
| + keys; add `alta` to `HOME_CONSUMERS` (it is not a team instance). |
| +5. If `inspect` reports no roster generation, an `initialize` run with |
| + Paul's typed attestation, once. |
| + |
| +## 11. UI sketch (estilo, scriptless) |
| + |
| +``` |
| + Alta [Paul βΎ] |
| + ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ |
| + Teams [New team] |
| + lagged Lagged 6 apps live 4 Β· pending 2 [Open] |
| + |
| + New team |
| + Label [lagged ] β lagged.docs.oficina.works β¦ |
| + Name [Lagged ] |
| + Owner email [till@lagged.biz] (must have signed in once) |
| + Apps [x] Docs [x] Sheets [x] Slides [x] Calendar [x] Calls [x] Memoria |
| + [Review plan] |
| + |
| + Plan Β· lagged (confirm with a fresh sign-in) |
| + Home: seed team "lagged", owner by email, 6 consumers |
| + docs env lagged: set 11 Β· generate 4 Β· shared 6 Β· blank 9 [details] |
| + β¦ |
| + [Sign in again and run] |
| + |
| + Run Β· lagged refresh to update |
| + docs β consumer β env β instance β domain β serving β live |
| + slides β β¦ β· domain issuing-cert (12 min) [Resume] |
| + memoria β β¦ β serving Β· pending (no roster mode yet) |
| + [Audit] [Retire appsβ¦] |
| +``` |
| + |
| +No live updates: the run page is a plain GET; refresh to see progress. |
| + |
| +## 12. Tests before merge |
| + |
| +Recipe: for each app, a fixture default bundle with every key the app reads |
| +plus an unknown key β the unknown key must refuse the plan; generated keys |
| +never regenerate on a second run. State machine: crash injection after |
| +every act, against a fake console and a real Home on a preview β resume |
| +reaches the same end state with no duplicate instance, consumer or team. |
| +Guards: Β§8 mutation tests. Privacy: no address, key or label in logs; |
| +sealed owner address gone after step 12. End to end on previews: two |
| +synthetic teams, both owners sign in, each sees only their team, Paul's |
| +existing instances unchanged (config digest before and after). |
| + |
| +## 13. Open questions for Paul |
| + |
| +1. CARLOS blast radius: accept (a), ask the platform for |
| + environment-scoped credentials (b), or a separate account (c)? |
| +2. Host for Alta: `alta.oficina.works`, or unlisted on oncarlos.com only? |
| +3. Owner must sign in once before the team is created (`existing_only`)? |
| +4. Is Memoria in the same CARLOS account as the other five? |
| +5. Enable Slides private storage now, or ship Slides without uploads first? |
| +6. SMTP: share the suite's relay credentials with team instances (as Track |
| + 1 does), or give each team its own? |
| +7. Dashboard: should a team instance's `OFICINA_DASHBOARD_TEAM` point at |
| + its own team, or stay blank until the dashboard is reviewed for teams? |