oficina / home Public

Specify explicit adoption of existing canonical apps

codex agent, operated by paul@keymail.dev pushed by paul@keymail.dev 53f616ae0361ad2896f2ad4ddf62a48083f8d9e2 parent d82341c
1 file changed, +97 −0
  • implementation/existing-team-adoption.md +97 −0

CI cancelled — superseded by a newer push — run details

Intent

Human

Ok. Keep going?

diff --git a/implementation/existing-team-adoption.md b/implementation/existing-team-adoption.md
new file mode 100644
index 0000000..07e09b1
--- /dev/null
+++ b/implementation/existing-team-adoption.md
@@ -0,0 +1,97 @@
+# Existing canonical app adoption
+
+Status: draft for independent highest-capability review, 2026-11-02.
+Base: d82341c. Implements agent-access task 5 and Home discussion 103.
+
+The six existing canonical instances need directory membership and routing
+without creating replacement instances, changing their keys, or converting
+their existing item permissions to TeamMode. Agent adapters already support
+this combination: Home controls delegated team admission; each app resolves
+the Home subject and enforces its current local resource permissions. A new
+directory membership never grants access to existing content by itself.
+
+## Scope and authority
+
+Extend the signed operator plan with optional `existing_team` (the actual
+team SQID, not the dashboard label). It is valid only for create-team or
+add-apps plans and only for the six compiled canonical apps. Both roles show
+an explicit existing-app adoption description. The directory requires label
+`oficina`, shows the exact canonical hosts, and binds seeding and every
+subsequent operation to the plan's SQID. The credential plan binds owner-seed
+and the signed provisioning record to that same SQID. Existing-only owner
+lookup, typed owner confirmation, two-role fresh authentication, signed
+stream ordering, expiration and exact retries remain required.
+
+Add an `existing_team` column to each role's operator_plans using new
+additive migrations. Store only the bounded opaque SQID; no signed plan or
+address. The field defaults empty for old plans. Ordinary plan behavior is
+unchanged. An older binary must not be rolled back over a pending/open
+adoption window: let it expire first, since older code cannot display or
+enforce this additional scope.
+
+The canonical binding table is compiled and closed: docs, sheets, slides,
+memoria, calendar and calls each use consumer ID equal to app slug and
+origin `https://<app>.oficina.works`. Their only label is `oficina`.
+Directory read policy admits these exact stored tuples, alongside ordinary
+label.app destinations. Merely broadening hostname validation is not the
+write path: directory.provision-consumer refuses canonical origins unless
+ExecuteHTTP supplies an open adoption window matching the exact tuple and
+SQID. Native provision never supplies that authorization. Ordinary HTTP
+plans cannot write canonical tuples; adoption plans cannot write new-team
+tuples. Existing unique origin/consumer constraints prevent another team
+claiming an adopted instance. Provenance fence and owner membership remain.
+
+Credential register-consumer under an adoption window verifies the
+directory signature, exact issuer/directory/app/consumer/origin and pinned
+team, then requires that exact ID/origin pair in the immutable env manifest.
+It returns the existing union manifest digest without inserting, replacing
+or retiring a registration. Partial matches, table consumers, missing env
+entries and ordinary windows all refuse. Sign-in registrations and keys
+remain unchanged. Ordinary registration continues rejecting env collisions.
+
+## Activation and existing access
+
+Provisioning still creates pending directory/roster bindings and a signed
+record, with the existing operation ledger and bounded verification attempt.
+Canonical activation uses explicit policy
+`oficina/existing-app-activation/v1` under an adoption window; ordinary
+activation keeps `oficina/team-activation/v1`. Policy/route mismatch refuses,
+including native activation. Both paths retain all attempt, owner, epoch,
+record, generation, build, artifact, manifest and configuration digest checks.
+
+The adoption observation attests the canonical host's exact build, unchanged
+existing consumer registration, unchanged storage and identity keys, and
+agent configuration bound to the actual team. It does not attest a fresh
+isolated database or TeamMode conversion. No TEAM_* settings are enabled,
+no content is copied, no existing memberships are inferred, and no existing
+local user access is removed. The UI explicitly says that connecting an app
+preserves its existing content permissions. This narrows the activation
+claim and is a deliberate amendment to team-provisioning-amendment.md §2.6,
+§5 and its new-instance-only threat model, not a fake TeamMode probe.
+
+This implementation adds Home's capability and reviewable operator tooling;
+Alta's ordinary instance-creation recipe must not be used for adoption.
+Production activation still needs actual signed plans, Home's fresh browser
+confirmation, and the historical never-provisioned attestation before the
+initial generation. Existing deployment authorization does not stand in for
+these product-level confirmations. No production mutation is done by tests.
+
+## Required evidence
+
+- Signed plan roundtrip/persistence, invalid kind/label/app/SQID, changed
+ signature and scope, expiry; actual confirmation rendering on both roles.
+- Full initialize, owner seed, team seed, canonical provision, existing
+ registration verification, verify and activate flow with fresh fixtures.
+- Ordinary/native provision refusal, other label/team/app/consumer/origin,
+ new-team origin in adoption mode, registration table/env partial matches,
+ wrong signature, activation policy substitution and window mismatch.
+- Exact replay retains one team/record; no registry duplication; existing
+ registration and existing local-content authority preserved.
+- Directory/agent discovery exposes only live routes for current members;
+ membership removal revokes discovery. Privacy gates cover plan fields and
+ no new address/content storage. Existing migrations/gates remain intact.
+- Independent source/evidence review, meaningful adverse mutations, full
+ required CI, deployed isolated canary and exact canonical version checks.
+
+No claim of four-client live acceptance follows from these gates. That is a
+subsequent authenticated test after actual team setup and connection rollout.