oficina / alta Public

Spec: the team bundle (Equipo, Base, house TensorX, hosted runner), draft for Paul

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev bc74724272442db8891952f8971ac2909a3a9bbc parent 43bf19d
1 file changed, +457 −0
  • docs/superpowers/specs/2026-11-29-team-bundle-design.md +457 −0
diff --git a/docs/superpowers/specs/2026-11-29-team-bundle-design.md b/docs/superpowers/specs/2026-11-29-team-bundle-design.md
new file mode 100644
index 0000000..7f7ab9c
--- /dev/null
+++ b/docs/superpowers/specs/2026-11-29-team-bundle-design.md
@@ -0,0 +1,457 @@
+# The team bundle: Equipo, Base, a house model and a hosted runner
+
+Status: draft for Paul, 2026-11-29. Written by Claude (Opus 5.5) from
+Alta main 43bf19d, Equipo origin/main 57f370c5, Base origin/main 5105b89,
+Memoria origin/main and CARLOS platform origin/main 4799995f7. Not
+reviewed. Nothing is built. Where a fact was not read from code or a
+spec it is marked **unverified**.
+
+## 0. The problem and the shape of the answer
+
+Paul wants to set up a team, for example `carlos`, `tito` or
+`campbells`, and have it work on the first day. That means:
+
+- the Oficina apps;
+- its own Equipo and its own Base;
+- agents that run before anyone brings a subscription, on TensorX and
+ on a machine nobody in the team has to own.
+
+Alta already creates the six-app part (Docs, Sheets, Slides, Calendar,
+Calls, Memoria). That path is covered by its own rollout and is out of
+scope here. This spec covers four missing pieces:
+
+1. an Alta recipe for a fresh Equipo per team;
+2. an Alta recipe for a fresh Base per team;
+3. a house TensorX connection with a cap per team, and the handover to
+ the person's own subscription;
+4. a hosted runner per team.
+
+The shape in short:
+
+- **Equipo and Base** become two more Alta recipes, on the same
+ team-scoped CARLOS credentials as the six. Base's first cut has no
+ Store.
+- **TensorX** for Paul's own teams starts as one TensorX key per team on
+ Paul's account, with a small balance and no top-up. A metering gateway
+ comes before any team that is not Paul's. It needs a ruling because it
+ reverses Memoria decision 13.
+- **The hosted runner** is one cloud VM per team. An operator command on
+ Paul's Mac creates it, never Alta's web process. The runner on it is
+ enrolled to the team owner, as runners are today.
+- **Isolation between teams** is the central question (§5). The VM
+ boundary is the answer. A shared host with one Unix user per team is
+ not.
+
+## 1. Equipo per team
+
+### 1.1 Current state
+
+- Alta lists Equipo as adoption-only. `provision/apps.go:107` marks it
+ `AdoptionOnly: true`, and `CreateTeam` and `AddApps` refuse it as
+ `unknown-app` (`provision/engine.go:165`, `:217`). Equipo joined the
+ `oficina` team only through `alta-adopt` (`docs/equipo-adoption.md`).
+- One Equipo instance holds one team
+ (`internal/equipo/chat/housekeeping.go:130`: "one instance belongs to
+ one team"). Owners come from `EQUIPO_OWNERS` and are seeded only when
+ the database has no team (`internal/equipo/config.go:104`, `:123`).
+ After that, Equipo's own People screen keeps the roster.
+- Equipo has no Home roster team mode. Its config reads no
+ `EQUIPO_TEAM_*` keys, and `teammode` is not imported anywhere in
+ `internal/`. Alta's non-roster apps "stop at 10 with their directory
+ row pending" (`provision/apps.go:69-70`). Home's
+ `/api/native/teams` lists only `live` rows (`native-levelup/ALTA-ROLLOUT.md`
+ §0, from Home `directorydata/store.go`). So a fresh team Equipo would
+ not reach the native apps' team list.
+- Agents need a runner. A chat lane without one fails with
+ `ErrNoRunner` (`internal/equipo/chat/lane.go:25`). A person's runner
+ must belong to an active **owner**
+ (`internal/equipo/chat_wiring.go:153-158`). Teammate execution is
+ denied until its own authority boundary is designed (thin v1 spec §5).
+ So in today's code a non-owner member gets no agents.
+- Execution needs `EQUIPO_EXECUTION_ENABLED=1`, and deploys then need
+ `--swap hold` (Equipo `README.md:79`). Whether an Alta-created
+ instance can be held the same way on a later release is
+ **unverified**.
+
+### 1.2 Proposed design
+
+An Equipo recipe in `provision/apps.go`, with these keys:
+
+| Key | Class | Value |
+|---|---|---|
+| `EQUIPO_ORIGIN` | set | `https://<label>.equipo.oficina.works` (`PublicOrigin`) |
+| `EQUIPO_INSTANCE_KEY` | generated | 32 random bytes |
+| `EQUIPO_HOME_ISSUER`, `_CONSUMER_ID`, `_KEYS_BASE64` | set | as for the six |
+| `EQUIPO_HOME_DEK_BASE64` | generated | as for the six |
+| `EQUIPO_OWNERS` | set | the owner's address (see question 2) |
+| `EQUIPO_ASSISTANT_HOSTS` | set | the team's Base origin, if Base is in the run |
+| `EQUIPO_AGENT_ISSUER`, `EQUIPO_AGENT_TEAM` | set | as adoption writes them |
+| `EQUIPO_EXECUTION_ENABLED` | set | `1` only once the team's runner exists (§4) |
+
+- Mail comes from CARLOS submission, under `CARLOS_SMTP`, as the registry
+ already declares (`apps.go:107`).
+- One more `ALTA_CARLOS_EQUIPO` team credential, scope `alta`.
+- Activation: Equipo needs a way past step 10 so its row goes `live`.
+ There are two routes (question 2).
+
+### 1.3 Alternatives
+
+- **Roster team mode for Equipo now.** This is the same port Sheets,
+ Slides, Calendar, Calls and Memoria had. Equipo's roster is richer
+ (roles, invites, runner ownership), so this is the largest single
+ piece of Equipo work here.
+- **Seed with `EQUIPO_OWNERS`, then roster mode later.** This is the
+ quickest. It writes the owner's address into the environment. The
+ six apps' recipes avoid doing that now, but the lagged stopgap did it.
+ Alta's AGENTS.md rule "no address at rest once it is no longer needed"
+ allows it only for a recipe that needs it.
+ The directory row needs a non-roster activation from Home, which does
+ not exist yet (**unverified** whether Home would accept one).
+
+## 2. Base per team
+
+### 2.1 Current state
+
+- Alta lists Base as adoption-only (`provision/apps.go:108`).
+- Base's design is one Base per CARLOS account, "the business's own"
+ (Base first-slice spec, line 72). Its Store installs apps as instances
+ in that account. For that it needs two **account-wide** service tokens,
+ `instance` and `operate` (Base `README.md`, "To install apps";
+ `internal/config/config.go:71-72`).
+- In Paul's shared `oficina` account, an account-wide `operate` token
+ in a team's Base could act on every app in the account, Paul's
+ included. That is not acceptable.
+- Without those tokens Base still runs. It logs that installs are off
+ (`cmd/base/main.go:61`). Sign-in, Home tiles (`BASE_OFICINA_APPS`),
+ People and Ask all work without them, as read from the README.
+- Ask needs Equipo (`BASE_EQUIPO_ORIGIN`), and that Equipo must list the
+ Base in `EQUIPO_ASSISTANT_HOSTS`. Ask's answers come from the Equipo
+ Assistant lane, so Ask also needs the runner.
+
+### 2.2 Proposed design
+
+A Base recipe with **no Store** in the first cut:
+
+- `BASE_ORIGIN = https://<label>.base.oficina.works`;
+- `BASE_OWNER` is the owner. Base requires it (README, "Settings").
+ That puts an address at rest in the environment. Alta's AGENTS.md
+ allows that only for a recipe that needs it, and since roster mode no
+ recipe does. So this needs Paul's ruling (question 2), or Base reads
+ its owner from Home's roster instead.
+- `BASE_NAME` is the team's name. `BASE_SLUG` is the label (at most 19
+ characters, checked at step 0).
+- `BASE_INSTANCE_KEY` and `BASE_HOME_DEK_BASE64` are generated, and
+ `BASE_HOME_*` is set as for the six.
+- `BASE_OFICINA_APPS` lists the team's own app hosts that the run
+ created.
+- `BASE_EQUIPO_ORIGIN` is the team's Equipo.
+- There are no `BASE_PLATFORM_*` tokens and no `BASE_ASSERTION_KEY`.
+- One more `ALTA_CARLOS_BASE` team credential.
+- Base's held operations door, which Paul approved on 2026-11-23,
+ carries over as adoption does it.
+
+### 2.3 Alternatives
+
+- **One CARLOS account per team.** This matches Base's own design, and
+ the Store then works as written. It also isolates billing and blast
+ radius. But it leaves Alta's model, where team environments live
+ inside the `oficina` account. Whether an account can be created by
+ API is **unverified**.
+- **Store on team-scoped credentials.** Base would use team doors
+ limited to its owned environment. Team credentials are per app
+ (`carlos services create --role team --app <app>`, Alta `README.md`
+ §Deploying step 3). So Base would need one credential per Store app,
+ and code changes to use the team doors. This is a real design of its
+ own.
+
+## 3. A house TensorX connection
+
+### 3.1 Current state
+
+- **Memoria.** Alta never writes the key. Paul sets
+ `MEMORIA_TENSORX_KEY` and `MEMORIA_AI=on` by hand on his own teams
+ (`provision/apps.go`, `OperatorKeys`). The base URL is a constant "per
+ decision 13": a configurable URL "lets whoever sets it interpose a
+ proxy" (Memoria `internal/memoria/provider/provider.go:32-36`).
+- **Equipo.**
+ - A TensorX connection is a key the person pastes. It is sealed in the
+ page to the runner, and it lives in the connection's home on the
+ runner (Equipo `internal/wire/metered.go:5-11`; connections spec
+ §2.4).
+ - The provider's URL is fixed (`metered.go:72`), and egress allows
+ only `api.tensorx.ai` (connectors spec §2.2).
+ - Equipo keeps only a **soft** daily and monthly budget from reported
+ usage. The connectors spec says plainly that the provider's limit
+ is the only hard cap (§2.1, §2.3).
+ - A command the model runs can read the harness's environment and
+ spend the key at the provider's host. That is "stated, not
+ mitigated, in v1" (connectors spec §2.1). The gateway that would
+ fix it was cut from v1 (connectors spec, history, revision 3).
+- **TensorX.** The hard cap is the prepaid balance. Whether TensorX
+ has per-key spend limits or automatic top-up is not documented
+ (connectors spec §2.1 table, source T3).
+
+### 3.2 Proposed design
+
+**Phase A, Paul's own teams only:**
+
+- one TensorX key per team, on Paul's TensorX account;
+- the balance kept small, with top-up confirmed off;
+- the key installed as an operator-provisioned **house connection** on
+ the team's runner, owned by the team owner, with Equipo's soft budget
+ pre-filled;
+- Memoria given the same key by hand, as today.
+
+The accepted risk is that the balance is shared. A key leaked from one
+team can spend what the others would have used, up to the balance.
+
+**Phase B, before any team that isn't Paul's:**
+
+- A metering gateway, as a CARLOS app, holds the house key.
+- Each team gets its own bearer, and the gateway enforces a hard cap per
+ team before it forwards a request.
+- The house key never reaches a runner, so a model that reads its
+ environment gets only its own team's bearer.
+- The gateway must keep no request bodies, not even in logs, to keep
+ the zero-retention position.
+- Memoria and Equipo must both accept the gateway's address. That
+ reverses Memoria decision 13 and widens Equipo's egress table. The
+ gateway is ours, so the "second party" that decision 13 guards
+ against is us (question 4).
+
+**Handover to the person's own subscription.** Equipo already lets a
+person add Claude, Codex and other connections from the app
+(connections spec §2). Two additions are needed:
+
+- the house connection is marked `house`, so Usage shows it as the
+ team's, not the person's;
+- an owner can turn it off once a subscription is connected, and
+ selection prefers a healthy subscription over a metered connection
+ (connectors spec §7 rule 1 already moves a kept metered session to a
+ subscription).
+
+Memoria stays on the house key. The handover is for agents only.
+
+### 3.3 Alternatives
+
+- **One TensorX account per team.** This gives a real hard cap with no
+ gateway. Whether TensorX offers organisations or sub-accounts, and
+ what signing up for each team needs, is **unverified**.
+- **No house model; each person brings a key or subscription first.**
+ This is simplest, but it is not "works on day one".
+
+## 4. A hosted runner per team
+
+### 4.1 Current state
+
+- **Enrolment.** `equipo-runner enrol <origin>` prints a URL, and the
+ owner approves it in the browser, checking a fingerprint (thin v1
+ spec §6). The runner installs a user unit (Equipo
+ `packaging/equipo-runner.service`).
+- **Platforms.** The installer accepts only `Linux/x86_64` and
+ `Darwin/arm64` (`packaging/install/install-v1.sh:93-96`). The Linux
+ release is `linux/amd64` only (`install-v1.sh:47-50`). The CARLOS
+ gVisor spike ran on `t4g` Graviton boxes (CARLOS gVisor design,
+ header). Today's runner build does not run on those.
+- **Containment** is bubblewrap with owned namespaces, a private
+ network namespace and an egress relay limited to provider hosts (thin
+ v1 spec §5; bwrap nesting probe of 2026-11-03).
+ - The probe says plainly that this "does not justify treating an
+ entire shared UID as isolated from malicious host peers".
+ - Credential homes are mounted only to the harness.
+ - There is no push credential inside the namespace.
+- **The forge credential** is a file on the runner: one Amadan agent
+ account, with optional per-repository entries
+ (`internal/runner/forge/credential_file.go:15-24`). GitHub
+ connections belong to the team and are sealed on the instance
+ (migration `0102_forge_connections.sql`).
+- **Today's runners** are machines people enrol: docs-t1 (Linux) and
+ tito-studio as the Mac worker (Mac runners spec §0). Previews use a
+ CARLOS devbox (`thin/run.go:366`, the `Devbox` field).
+- **Hosting on CARLOS itself.** Isolated exec puts each instance in a
+ mount namespace in a systemd unit (CARLOS isolated-exec spec). gVisor
+ covers only anonymous demos and leaves networked instances out
+ (gVisor design §3). Whether bubblewrap's user namespaces work inside
+ either is **unverified**. A CARLOS instance is also not a
+ long-running machine with a persistent home, which is what the runner
+ expects.
+
+### 4.2 Proposed design
+
+**One cloud VM per team, linux/amd64:**
+
+- It runs `equipo-runner` as it runs on docs-t1.
+- It has one Unix user per owner who wants agents, each with their own
+ runner enrolled as that owner's primary.
+- Nothing on the VM belongs to another team.
+
+**`alta-runner`, an operator command on Paul's Mac**, as `alta-adopt` is.
+It is never part of Alta's web process, because creating VMs needs a
+cloud credential, and ruling 8 was only relaxed for CARLOS team-scoped
+credentials. It:
+
+- creates the VM from a pinned image (bubblewrap, harness binaries,
+ runner release);
+- starts enrolment and prints the approval link for the owner;
+- installs the house connection (§3);
+- writes a per-team forge credential, if the team has one (question 6);
+- sets `EQUIPO_EXECUTION_ENABLED=1` on the team's Equipo through Alta's
+ credential.
+
+The VM's own firewall allows outbound HTTPS only, plus the instance's
+WebSocket. It has no inbound ports. Previews are out of scope for the
+first cut.
+
+**Teardown is part of the same command:**
+
+- revoke the runner;
+- remove the house key;
+- destroy the VM and its disk;
+- record the outcome in Alta's audit.
+
+Alta's `retire-apps` refuses to retire Equipo while a runner VM for the
+team still exists.
+
+### 4.3 Alternatives
+
+- **A shared runner host with one Unix user per team.** This is cheaper,
+ but it is a kernel boundary only, between teams' subscriptions and
+ forge credentials. The bwrap probe already declines that claim for a
+ shared UID, and different UIDs on one kernel are better but not a VM.
+ Not recommended for teams with other people in them.
+- **The runner as a CARLOS workload.** This fits the platform best, but
+ it needs CARLOS work: networked sandboxes, user namespaces or another
+ inner sandbox, persistent homes, and an arm64 runner build. It is a
+ platform design of its own, so it comes later if at all.
+- **No hosted runner; the owner enrols their own machine.** This is
+ today's model, and it remains the fallback for any team.
+
+## 5. Isolation between teams (the central question)
+
+What a team's runner VM holds:
+
+- every owner's subscription tokens (Claude, Codex and others);
+- the team's house TensorX key or bearer;
+- the team's forge credential;
+- clones of the team's repositories.
+
+A model on it can be steered by content it reads: issues, web pages,
+documents. Equipo's containment limits what a model can reach inside
+the VM, but the connectors spec accepts that a model can spend the
+metered key it runs with (§2.1).
+
+The design's rules:
+
+1. **One VM per team.** A team's secrets and code never share a
+ kernel with another team's. That is the boundary this spec relies
+ on, and §4.3 explains why the cheaper options are refused.
+2. **No cross-team credentials anywhere on the VM.** There is a forge
+ credential for this team only, a TensorX key or bearer for this team
+ only, and no CARLOS credential at all. Equipo's instance, not the
+ runner, holds CARLOS-facing state.
+3. **Phase B before outsiders.** Until the gateway exists, a leaked
+ house key spends the shared balance. That is acceptable only while
+ every team is Paul's.
+4. **The team's Equipo is the trust root for its runner.** The
+ connections spec §2.4 accepts that whoever controls the instance can
+ substitute the seal key. Per-team instances keep that inside the
+ team.
+5. **Operator access is total.** Paul, and any agent with the cloud
+ credential, can read every VM. The spec states that; it does not
+ mitigate it. Members should be told plainly.
+6. **Within a team, owners share a VM but not a Unix user.** A model
+ on one owner's runner could still try to reach another owner's
+ files through a kernel bug, which is the same risk as rule 1's
+ rejected option, but inside one team. Question 5 asks whether that
+ is acceptable or whether each owner gets their own VM.
+7. **Teardown is proven.** The VM and disk are destroyed, the runner is
+ revoked on the instance, and the house key or bearer is revoked at
+ TensorX or the gateway.
+
+## 6. Questions for Paul
+
+1. **Base without a Store for teams in the first cut?** *Recommend:
+ yes.* A Store with team doors, or one CARLOS account per team, is a
+ later design.
+2. **How do a fresh Equipo and Base get their owner and join the
+ directory?** Both read the owner's address from their environment
+ (`EQUIPO_OWNERS`, `BASE_OWNER`). (a) seed with
+ `EQUIPO_OWNERS` plus a new non-roster activation at Home, or (b) port
+ Equipo to roster team mode first. *Recommend: (a) for Paul's teams
+ now, (b) before outside teams*, since (b) also lets members other
+ than the owner be added from Home.
+3. **House TensorX, phase A: one key per team on your account, small
+ balance, no top-up, Paul's teams only?** *Recommend: yes.* The risk
+ is a shared balance.
+4. **Phase B gateway: may Memoria and Equipo accept our gateway's
+ address, reversing Memoria decision 13?** *Recommend: yes, with the
+ gateway forbidden to keep request bodies,* because it is the only
+ way to a hard cap per team without one TensorX account per team.
+5. **Runner VMs: one per team, or one per owner?** *Recommend: one per
+ team, one Unix user per owner,* for Paul's own teams; one per owner
+ if a team's owners don't trust each other.
+6. **Forge for each team.** `carlos` and `tito` would each get their own
+ Amadan agent account limited to their repositories. `campbells` gets
+ no forge. *Recommend: yes.* Equipo with no repositories still runs
+ the Assistant; what else works without a forge is **unverified**.
+7. **Members who are not owners get no agents until teammate execution
+ is designed.** Is that acceptable for the family team? *Recommend:
+ make each adult an owner of `campbells`* rather than design teammate
+ execution now.
+8. **Where VMs run.** *No recommendation:* the provider and region are
+ yours to name. The CARLOS AWS account is one candidate. Each needs
+ your scoped approval for the resources and cost.
+
+## 7. Slices, in build order
+
+Every slice gets a Fable review of the design and of the whole branch,
+hub CI green, and Paul's go before anything is deployed.
+
+1. **Equipo recipe (Alta) and the non-roster activation (Home).** Gate:
+ a canary team on a throwaway label reaches `live` for Equipo, and the
+ audit shows no key beyond the recipe.
+2. **Base recipe (Alta), no Store.** Gate: the canary team's Base signs
+ in with Oficina ID, lists only its own team's apps, and Ask is
+ reachable once a runner exists.
+3. **House connection kind (Equipo).** An operator-installed
+ connection, marked `house`, with a soft budget and an owner's off
+ switch. Gate: Astra security review, plus a probe that the person's
+ subscription is preferred once healthy.
+4. **`alta-runner` (Alta repo, operator command).** Create, enrol,
+ install and tear down one VM. Gate: Paul's scoped approval for the
+ cloud resources; a canary VM created, enrolled, used for one task and
+ destroyed, with teardown proven (§5 rule 7).
+5. **Paul's three teams.** Run Alta with Equipo and Base, then
+ `alta-runner`, for `carlos`, `tito` and `campbells`. Gate: each
+ team's own check-through, and Paul's go for each.
+6. **Phase B gateway (new CARLOS app), the Memoria and Equipo changes,
+ and Equipo roster mode.** Gate: Astra security review of the gateway
+ and of the decision-13 reversal. Required before the first team that
+ isn't Paul's.
+
+Slices 1 and 2 depend on the six-app rollout (mail submission on, Alta
+deployed). Slice 4 can be built alongside them.
+
+## 8. Unknowns
+
+- **TensorX limits.** Per-key spend limits and automatic top-up are
+ undocumented (connectors spec §2.1). Sub-accounts or organisations are
+ unknown. Paul's memory note on zero retention records that no account
+ terms or DPA had been read on 2026-09-19. Restore that clause in
+ Memoria's spec when they are.
+- **Provider terms for hosted subscriptions.** Whether Claude, ChatGPT
+ and the other consumer subscriptions allow a person's login on a
+ machine we operate for them has not been read.
+- **CARLOS as a runner host.** Bubblewrap inside isolated exec or
+ gVisor, outbound networking under gVisor, persistent homes and an
+ arm64 runner build are all unverified or not built.
+- **Equipo deploys under `--swap hold`** for instances Alta creates.
+- **Native apps.** Whether Equipo's and Base's native apps choose
+ among several teams' origins, as Docs native does, is unverified.
+- **The 11-26 path-based ruling** names the document apps. Whether
+ Equipo and Base keep per-team hosts, like Contra, is not ruled. This
+ spec assumes per-team hosts.
+- **Cost.** VM cost per team, TensorX spend per team, and two more
+ CARLOS instances per team are not estimated.
+- **Teammate execution.** It is unchanged here and stays denied
+ (question 7).