oficina / home Public

Clone
git clone https://amadan.net/oficina/home

Plain git — no account needed to clone.

Download

Download this file

1# Existing canonical app adoption
2
3Status: Home capability design approved by independent GPT-6 Astra,
42026-11-02, after rollback, observation and scope revisions. Production
5activation remains gated on the reviewed observation runner and confirmations.
6Base: d82341c. Amended 2026-11-16 for 522 Plan 1 digests and the Plan 2
7waiver (see the observation recipe). Amended 2026-11-17 (Paul, discussion
8103): the waiver's delivery evidence is the runner's automated check, and
9the negative live checks are dropped for this adoption. Implements
10agent-access task 5 and Home discussion 103. Amended 2026-11-20 by Paul’s
11approved Equipo native Oficina ID spec, part 3 / E4: Equipo joins canonical
12adoption as the seventh app; its app-side contract must be deployed first.
13Amended 2026-11-23 (Paul: Base production is https://base.oficina.works):
14Base joins as the eighth. Its instance must already serve that host, and
15its `base` consumer must be in the credential env manifest with that origin,
16before an adoption plan names it.
17
18The eight existing canonical instances need directory membership and routing
19without creating replacement instances, changing their keys, or converting
20their existing item permissions to TeamMode. Agent adapters already support
21this combination: Home controls delegated team admission; each app resolves
22the Home subject and enforces its current local resource permissions. A new
23directory membership never grants access to existing content by itself.
24
25## Scope and authority
26
27Extend the signed operator plan with optional `existing_team` (the actual
28team SQID, not the dashboard label). It is valid only for create-team or
29add-apps plans and only for the eight compiled canonical apps. Both roles show
30an explicit existing-app adoption description. The directory requires label
31`oficina`, shows the exact canonical hosts, and binds seeding and every
32subsequent operation to the plan's SQID. The credential plan binds owner-seed
33and the signed provisioning record to that same SQID. Existing-only owner
34lookup, typed owner confirmation, two-role fresh authentication, signed
35stream ordering, expiration and exact retries remain required.
36
37Add an `existing_team` column to each role's operator_plans using new
38additive migrations. Store only the bounded opaque SQID; no signed plan or
39address. The field defaults empty for old plans. Ordinary plan behavior is
40unchanged except that `oficina` is reserved: ordinary create-team plans and
41native seeding refuse that label. Ordinary add-apps also refuses that label;
42only canonical adoption can add apps there. An ordinary retire-apps window
43may disable a directory binding, but cannot retire an env-manifest consumer.
44Adoption's SQID must decode to exactly one
45positive signed-64-bit team ID and re-encode identically.
46
47Rollback is forward-compatible only after adoption: a pre-adoption binary
48rejects canonical live rows and can make the whole chooser fail. Keep an
49adoption-capable build as the rollback target. Before any adoption writes,
50an older build is permitted only after every adoption window/pending plan
51expires. After canonical bindings exist, do not downgrade, restore an old
52snapshot, or delete rows to force a downgrade. Disabling delegated access
53is the immediate incident response; a separate reviewed recovery is needed
54if no adoption-capable binary is usable. App local access and data remain
55available independently of the new connection service.
56
57The canonical binding table is compiled and closed: docs, sheets, slides,
58memoria, calendar and calls each use consumer ID equal to app slug and
59origin `https://<app>.oficina.works`. Their only label is `oficina`.
60Directory read policy admits these exact stored tuples, alongside ordinary
61label.app destinations. Merely broadening hostname validation is not the
62write path: directory.provision-consumer refuses canonical origins unless
63ExecuteHTTP supplies an open adoption window matching the exact tuple and
64SQID. Native provision never supplies that authorization. Ordinary HTTP
65plans cannot write canonical tuples; adoption plans cannot write new-team
66tuples. Existing unique origin/consumer constraints prevent another team
67claiming an adopted instance. Provenance fence and owner membership remain.
68
69Credential register-consumer under an adoption window verifies the
70directory signature, exact issuer/directory/app/consumer/origin and pinned
71team, then requires that exact ID/origin pair in the immutable env manifest.
72It returns the existing union manifest digest without inserting, replacing
73or retiring a registration. Partial matches, table consumers, missing env
74entries and ordinary windows all refuse. Sign-in registrations and keys
75remain unchanged. Ordinary registration continues rejecting env collisions.
76
77## Activation and existing access
78
79Provisioning still creates pending directory/roster bindings and a signed
80record, with the existing operation ledger and bounded verification attempt.
81Canonical activation uses explicit policy
82`oficina/existing-app-activation/v1` under an adoption window; ordinary
83activation keeps `oficina/team-activation/v1`. Policy/route mismatch refuses,
84including native activation. Both paths retain all attempt, owner, epoch,
85record, generation, build, artifact, manifest and configuration digest checks.
86
87The adoption observation attests the canonical host's exact build, unchanged
88existing consumer registration, unchanged storage and identity keys, and
89agent configuration bound to the actual team. It does not attest a fresh
90isolated database or TeamMode conversion. No TEAM_* settings are enabled,
91no content is copied, no existing memberships are inferred, and no existing
92local user access is removed. The UI explicitly says that connecting an app
93preserves its existing content permissions. This narrows the activation
94claim and is a deliberate amendment to team-provisioning-amendment.md §2.6,
95§5 and its new-instance-only threat model, not a fake TeamMode probe.
96
97This implementation adds Home's capability and reviewable operator tooling;
98Alta's ordinary instance-creation recipe must not be used for adoption.
99Production activation still needs actual signed plans, Home's fresh browser
100confirmation, and the historical never-provisioned attestation before the
101initial generation. Existing deployment authorization does not stand in for
102these product-level confirmations. No production mutation is done by tests.
103
104Typed owner confirmation applies to create-team only. An add-apps adoption
105plan has no owner field; both fresh confirmations instead identify the
106existing SQID, exact app hosts and preservation of local permissions.
107
108### Observation recipe and activation gate
109
110The activation evidence is the operator's signed observation; neither Home
111nor the platform attests that arbitrary digest fields describe real checks.
112The adoption runner must obtain two supported CARLOS snapshots, before any
113configuration write and after the process adopts the intended configuration.
114Each snapshot records account/app/instance ID, canonical alias and its
115target, named/default environment identity, persistent storage identity,
116Home issuer/consumer ID, and the complete effective configuration.
117
118The runner reads configuration only through carlos/platform 522 Plan 1
119(spec `2026-11-02-config-receipts-design.md`, approved rev 6), under an
120account-owner `Operate` or `Admin` credential. The doors, all under
121`/api/cli/apps/{account}/{app}`:
122
123- `GET /config?environment=<name>` (omit `environment` for the default
124 bundle). Returns the layer `version` (`cv1:` plus SHA-256 of the stored
125 bytes; `none` for an absent layer) and, for every var, `key`, `kind` and
126 `digest`. Plain vars also carry `value`; secrets never carry their
127 envelope.
128- `GET /config/effective?host=<canonical host>`. Returns the applicable layer
129 versions (`default`, `environment`, `overlay`; `default` is absent for an
130 owned environment) and the merged vars, each
131 with `digest`, `from` and `shadows`. This is the snapshot of the complete
132 effective configuration and shows if a higher layer covers a key. It shows
133 stored layers only, not an exec route's `<host>.env` file.
134- `PUT /config` with `if_version` set to the baseline layer version,
135 setting only `AGENT_ISSUER` and `AGENT_TEAM`. Answers with a `receipt`:
136 `version_before`, `version_after`, `changed`, exact `set`, `unset`,
137 `unset_absent`, and `digests` for the keys just set. The console must
138 support atomic conditional puts (S3); otherwise it refuses `if_version`
139 with 400 and the runner stops. A 412 is a refusal with nothing written.
140 `if_version` is one non-empty JSON string in the body; there is no
141 `If-Match`, and it cannot be combined with `exec_delivery`.
142
143Preservation is proved with 522's `vd1:` per-key digests, not with
144HMACs of secret plaintext. A `vd1:` digest is SHA-256 over a var's stored
145kind, value, sealed envelope and sealed-to fingerprint. For a secret the
146input is the sealed envelope, so the digest says nothing about the plaintext,
147and the runner never holds or hashes any secret plaintext. This is sufficient
148because the question the gate asks is "has this key changed since the
149runner observed it", not "does it equal a value the runner holds". Any write
150to an identity or data key stores a new envelope and so a new digest; an
151unchanged digest means those stored bytes were not written. Sealing is
152randomised, so even re-setting the same plaintext reads as a change, and the
153check fails closed. The cost is that the runner cannot confirm that the
154stored key is the right key, only that it is the one it first saw. The
155before snapshot establishes which key that is, and adoption does not claim
156more. Digests of plain vars are as sensitive as their values, since they
157let someone test a guess; they stay in the operator journal and are not
158pasted into reports or tickets.
159
160The baseline is the before snapshot's per-key digests and layer versions.
161It is captured once, sealed before durable storage, and never rebaselined on
162retry. The write and every retry follow 522 spec §4.7. After a 200, require
163the receipt's `set` to be exactly `AGENT_ISSUER` and `AGENT_TEAM`, `unset`
164empty, and each receipt digest equal to the digest of what was sent. After a
165lost answer or a 412, read again and take the first matching branch: all
166preserved digests equal the baseline and the new keys equal what was sent
167(landed, done); preserved equal and new keys absent (retry with the version
168just read); any preserved key changed or gone (stop); new keys partly
169present or with another digest or kind (stop and report, do not overwrite).
170The after snapshot must preserve every old setting's digest except the
171explicitly enumerated AGENT_ISSUER and AGENT_TEAM additions. No TEAM_*
172setting may be active before or after; no instance creation or storage swap.
173The 522 receipt and digests describe the stored layer. They do not show that
174the process has them; see the delivery evidence below.
175
176Compute environment_binding as base64url SHA256 of a canonical JSON array:
177context `oficina/existing-app-observation/v1`, exact account/app/instance,
178environment and storage identities, canonical alias target, sorted before
179configuration entries with their `vd1:` digests, sorted after entries with
180their `vd1:` digests, the layer versions of each snapshot, actual team SQID, connection issuer, reviewed artifact SHA256, and
181observed version. Require the canonical HTTPS /api/version body and
182X-Carlos-Version to equal that reviewed version, without redirects, and
183/healthz success. Fetch the existing credential manifest digest through the
184verified adoption registration result. The signed activation retains these
185digests and the current bounded verification attempt.
186
187#### Delivery evidence: 522 Plan 2 waived for this adoption
188
189522 Plan 2 (evidence from the running instance that it has the stored
190configuration) is not built. Paul ruled on 2026-11-16 (oficina/home
191discussion 103 and carlos/platform 522) that it is waived for this Oficina
192existing-team adoption only. It is not a precedent for any other adoption,
193which still needs Plan 2 or its own ruling. Nothing else in the gate is
194waived: Plan 1 snapshots, digests and receipts still apply.
195
196In its place, delivery evidence is a check per app, made by the runner
197after the app restarts with the new configuration. Paul ruled on
1982026-11-17 (discussion 103) that this automated check replaces his
199witnessed sign-in; there is no typed confirmation. The check passes only
200if:
201
202- the canonical HTTPS `/api/version` body and `X-Carlos-Version` are
203 unchanged from the before snapshot and are the reviewed version, with
204 no redirect;
205- `/healthz` succeeds;
206- `GET /api/v1/operations` now answers with agent-access's response,
207 which shows that the app runs the delegated-access code with the new
208 configuration. That is a move from 404 to 401 or 200. Slides and Calls
209 already answer 401 from their own middleware, so for them the 401 must
210 become agent-access's own challenge (a `Bearer` `WWW-Authenticate`,
211 `Cache-Control: no-store` and a body whose `error.code` is
212 `unauthenticated`).
213
214For Base only (Paul, 2026-11-23, oficina/alta discussion 5), the third
215bullet is held rather than moved: `GET /api/v1/operations` must answer the
216same agent-shaped 401 before and after configure's restart, because it is
217Base's own door for Equipo's Assistant and Base reads no agent settings;
218every other delivery check is kept (Alta's `docs/base-adoption.md`).
219
220The runner records the check bound to the identity, delivered version and
221configuration it observed; it is void if any of them changes. The check is
222part of the signed observation: environment_binding carries it in the
223place the witness had. Production activation of an app is blocked until
224its check is recorded and still current.
225
226#### Approved redeploy after configure (amendment, 2026-11-19)
227
228Status: proposed, for Paul's approval. It changes the first bullet
229above for one case only.
230
231During the production run, docs, slides, calls and memoria were
232redeployed to new releases after `configure` had landed their agent keys,
233restarted them and recorded their checks. Paul approved those releases,
234and the runner's config now names their artifacts. Each stored check is
235void, because the served version changed. A new check cannot be made,
236because the bullet above requires the version to be unchanged from the
237before snapshot. A rollback does not help: `configure` refuses once a
238rollback is recorded, and the baseline is never retaken.
239
240So `configure`, run again for an app whose write has landed and whose
241after snapshot exists, may record a new check on a release other than
242the before snapshot's. It reads only: it sends no write and no restart.
243It records the check only if all of these hold on one fresh observation:
244
245- the served release changed: the `/api/version` body and
246 `X-Carlos-Version` both differ from the before snapshot's. If they do
247 not, the check is the ordinary one above, unchanged;
248- `X-Carlos-Version` hashes to the app's reviewed artifact in the
249 runner's config (the release Paul approved), the body and header name
250 the same release, there is no redirect, and `/healthz` is 200;
251- `GET /api/v1/operations` gives agent-access's own answer, as in the
252 bullet above, which shows the new process runs with the agent keys;
253- the journal's write is landed, and both agent keys are plain vars in
254 the write layer holding the values it sent;
255- every other key and every untouched layer is preserved from the
256 before snapshot, and the config equals the after snapshot exactly. A
257 config change that came with the redeploy, including a new key, is
258 refused;
259- the identity equals the before and after snapshots': the same
260 instance record and record sequence, environment, storage and
261 canonical domain route. A redeploy keeps the instance record.
262
263The check records the redeploy with it: the before snapshot's release,
264the new one, the approved artifact and the reason. environment_binding
265commits to that record as part of the check; a check with no redeploy
266binds exactly as before. The activation gate accepts such a check only
267if its record is still true: it starts from the before snapshot's
268release, ends at the release the check observed, names the artifact the
269config approves now, and the fresh probe passes the rules above. The
270ordinary freshness rule still applies, so any later change to the
271release, identity or config voids the check, and an unapproved release
272is refused as before. Anything else gets the ordinary refusal.
273
274What this does not change: a release that did not change is checked
275exactly as before; no new write or restart is allowed; the baseline is
276never retaken. One known effect: `rollback-config` waits for the before
277snapshot's version, so after a redeploy a rollback's restart cannot
278complete. A rollback after a redeploy needs its own reviewed procedure.
279
280#### Negative live checks: dropped for this adoption
281
282This document required the runner to check, against oficina-connect, that
283a real Home member lacking local app permission stays refused, and that
284revoking directory membership or a connection refuses an existing
285delegated connection without removing normal local access. Paul ruled on
2862026-11-17 (discussion 103) that these live checks, with their test member
287and owner revocation, are dropped for this Oficina adoption. His reason:
288revocation is covered by Home's and oficina-connect's own tests. As with
289the Plan 2 waiver, this is not a precedent for any other adoption.
290
291What stays: Plan A's two fresh confirmations, and the Calendar canary.
292Plan B activates calendar alone. Plan C, the other six apps, is gated
293only on Plan B having activated calendar successfully, and stays refused
294if calendar has since been rolled back or disabled. Base, added on
2952026-11-23, is not covered by this waiver: a plan naming `base` runs the
296negative live checks above normally. Synthetic proof of
297refusal and revocation stays in integration tests. Until the reviewed
298snapshot/observation runner exists, production activation is blocked even
299if Home capability is deployed. This document does not authorize
300hand-constructing observation digests or bypassing a missing snapshot
301facility.
302
303Adoption and Alta share exactly one operator signer, installation, registry
304and device on both roles. No native command enrolls a competing stream.
305Directory initialize must be sequence 1, before any adoption. Its actual
306four-table guard checks roster_generation, roster_consumers, roster_tokens
307and roster_operator_receipts; the preflight also checks teams, memberships,
308team_instances and both operator streams. Use the shared team-keygen output
309only after its own review and CI pass. Existing consumer aliases are checked
310against their exact env manifest; no second signer or regenerated keyset is
311introduced for the adoption tool.
312
313This supersedes team-provisioning-amendment.md §4's label.app-only rendering
314for adoption plans, §2.6/§5's new-instance activation policy, and §8's claim
315that a confirmed provisioner cannot affect existing canonical hosts. An
316adoption window explicitly allows binding those eight pre-existing hosts to
317one confirmed team, changing directory discovery and delegated admission.
318It grants no local content permission and cannot change credential env
319registrations, existing storage or keys. The operator signer can falsely
320attest observations; that trust is explicit and bounded by confirmation.
321
322## Required evidence
323
324- Signed plan roundtrip/persistence, invalid kind/label/app/SQID, changed
325 signature and scope, expiry; actual confirmation rendering on both roles.
326- Full initialize, owner seed, team seed, canonical provision, existing
327 registration verification, verify and activate flow with fresh fixtures.
328- Ordinary/native provision refusal, other label/team/app/consumer/origin,
329 new-team origin in adoption mode, registration table/env partial matches,
330 wrong signature, activation policy substitution and window mismatch.
331- Exact replay retains one team/record; no registry duplication; existing
332 registration and existing local-content authority preserved.
333- Directory/agent discovery exposes only live routes for current members;
334 membership removal revokes discovery. Privacy gates cover plan fields and
335 no new address/content storage. Existing migrations/gates remain intact.
336- Upgrade old pending/open plans, restart and expire new adoption plans;
337 demonstrate old-reader incompatibility after activation and verify the
338 forward-compatible rollback build. Observer rejects changed storage,
339 identity keys, agent team, TeamMode and version body/header mismatch.
340- Per app, the runner's automated post-restart delivery check (version
341 body/header, healthz, /api/v1/operations 404 or app 401 to agent-access's
342 answer) recorded in place of 522 Plan 2, and Plan C gated on Plan B.
343- Independent source/evidence review, meaningful adverse mutations, full
344 required CI, deployed isolated canary and exact canonical version checks.
345
346No claim of four-client live acceptance follows from these gates. That is a
347subsequent authenticated test after actual team setup and connection rollout.
348