oficina / equipo Public

spec: models chosen per step (revision 3.3 proposed, §16)

Paul, at the TensorX model picker: the coordinator or some process
should choose the model too. A metered connection becomes its key plus
an allowed set of priced, tiered models, all ticked by default. Decide
picks the model per step from a committed tier table: the strongest
for Engineering, another family for Review, cheaper as the budget
fills, a question on its session's model. Each model is probed on first
use. New slice S5b, after S5 and before Vibe.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev a0fc42a1319d13a11c7b55dcdcdfc7480bfeed04 parent f5d1d67
1 file changed, +140 −2
  • docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md +140 −2

CI passed — run details

diff --git a/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md b/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md
index a15e0a44..62d55aca 100644
--- a/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md
+++ b/docs/superpowers/specs/2026-11-12-equipo-connectors-and-token-scheduling.md
@@ -1,6 +1,11 @@
# Equipo connectors and token-aware scheduling
-Status: approved, **revision 3.2** (2026-11-12, the controller's rulings
+Status: **revision 3.3 proposed** (2026-11-12): §16, models chosen per
+step, on Paul's question at the TensorX model picker. Revision 3.2 below
+is approved and unchanged elsewhere, except that §2.2's "one model per
+connection" is superseded by §16.
+
+Revision 3.2: approved (2026-11-12, the controller's rulings
#7 and #8 on S3's review). S1 (metered connections), S2 (Pi on TensorX)
and S3 (the scheduler) are built and merged: `S1-METERED-PROGRESS.md`,
`S2-PI-PROGRESS.md`, `S3-SCHEDULER-PROGRESS.md`. S4 (Usage and advice)
@@ -184,7 +189,8 @@ gateway, which is later (§5).
table keyed by `(harness, provider)`. There is no other network.
- **Health (round 3, finding 10):** the runner, outside the namespace,
calls `GET /v1/models` with the key, and Paul picks the connection's
- one model from the list on the connect card. A second model is a
+ one model from the list on the connect card (superseded by §16: an
+ allowed set, with the model chosen per step). A second model is a
second connection, since rev 3's model-pair routing is unbuilt. The
connection is `healthy` only after a **one-token completion** on the
selected model (`POST …/chat/completions`, `max_tokens: 1`, at the
@@ -886,3 +892,135 @@ findings are folded into 3.1:
The round 3 statuses it gave "NOT RESOLVED" for round 1 items (#4,
#7, #12, #15 to #17, #20, #21, #25) are these ten findings, and are
answered above.
+
+## 16. Models chosen per step (revision 3.3)
+
+Paul, at the Connect TensorX model picker ("Pick the model this
+connection uses. Another model needs another connection."): "Surely the
+co-ordinator or some other process would choose the model too, no?" He
+is right. This section replaces "one model per connection" (§2.2). It is
+its own slice, S5b, built after S5 and before Vibe. Everything else in
+revisions 3.1 and 3.2 stands.
+
+### 16.1 A connection is a key and an allowed set
+
+- **The allowed set.** A metered connection is its key plus a set of
+ allowed models, a subset of the models the key lists (`GET /v1/models`)
+ that are both priced (§2.3) and tiered (§16.2).
+ - A listed model without a price or a tier is shown greyed with "No
+ price yet" and cannot be allowed.
+ - On the add screen, every model that can be allowed is ticked by
+ default, and Paul can untick any. At least one must stay ticked.
+ - The connection row says "Models: 9 of 10" and opens the same list.
+- **Changing the set.** A change is a revision-checked, owner-only call,
+ audited, delivered to the runner as a durable `models{connection,
+ allowed[], revision}` frame. It replaces S1's `model` frame and is
+ applied on ack, as budgets are. A model removed from the set is never
+ admitted again. A step already running on it finishes.
+- **Migration.** Every existing connection gets the allowed set `{its
+ one model}`. Its probe status carries over.
+
+### 16.2 The model table
+
+A committed table beside the price table: per `(provider, model)`, a
+`family` (`glm`, `kimi`, `deepseek`, `qwen`, `minimax`, `mistral`, …)
+and a `tier` (`strong`, `standard` or `cheap`). It has its own version
+with a source and date, as `tensorx-2026-11-12` has. The Usage page's
+source line names both tables' dates.
+
+- A test fails if a priced model has no tier entry, or a tier entry has
+ no price.
+- The tiers are Equipo's judgement, recorded in the table and changed by
+ commit; no model output ever sets them.
+
+### 16.3 The choice, inside `Decide`
+
+`Decide` (§7) still picks the connection by its rules, unchanged. For a
+metered connection it then picks the model with a pure `pickModel`.
+Its inputs are:
+
+- the role;
+- the allowed set;
+- each model's tier, family, price and probe state;
+- the family Engineering actually used (for Review);
+- the connection's **fill**, the larger of reported spend ÷ budget for
+ the day and for the month.
+
+The **tier cap** narrows as the fill grows: fill below 0.5 allows
+`strong`, below 0.8 `standard`, and at or above 0.8 `cheap` only. A
+model is **eligible** when it is allowed, not `unhealthy` (§16.4), and
+within the cap. When no model is within the cap, the cheapest allowed
+healthy model is eligible.
+
+- **Engineering, a first pass or a fix round without a kept session:**
+ the eligible model with the highest tier. Ties go to the lower output
+ price, then the model id, bytewise.
+- **Engineering, a fix round on a kept session:** the session's own
+ model while it is still allowed and not unhealthy (§7 rule 1:
+ sessions keep their binding). Otherwise the round starts afresh, with
+ the rule above.
+- **Review:**
+ 1. among eligible models whose family differs from the family
+ Engineering actually ran, the same ordering as Engineering (label
+ `other_family`);
+ 2. if none is allowed, the same ordering over all eligible models
+ (label `same_family`).
+
+ This applies across connections too. `Decide`'s Review family rule
+ now compares the recorded Engineering family with each
+ `(connection, model)` pair's family, where it used to compare
+ connections.
+- **Questions:** a question resumes its step's own session (rev 3 §3),
+ so it uses that session's model and is never re-chosen. This is the
+ one deliberate exception to "questions use the cheapest model": moving
+ a question to another model would lose the session it asks about. A
+ question with no kept session to resume (none exists today) would take
+ the cheapest eligible model.
+- **Probes and housekeeping:** the cheapest eligible model (lowest
+ output price, then input price, then id). Housekeeping still never
+ uses a metered connection (§7), so in practice this rule covers
+ probes.
+- **Recorded.** The chosen model, its tier, family and `price_version`
+ are recorded on the step attempt and its usage rows. The routing line
+ reads, for example, "Review on TensorX, kimi-k3.1-pro (other family)",
+ and the Usage page shows the model.
+- **The model never chooses itself.** No tool, prompt or harness setting
+ lets a model name or change the model it runs on. The harness is
+ launched with the chosen model fixed (Pi `--model` and `models.json`
+ with exactly that model, and the same for OpenCode), and the policy
+ check refuses any other.
+
+### 16.4 Probing each model on first use
+
+- **First use.** A model with no probe record is probed before the
+ first step that would run on it. The one-token completion (§2.2) runs
+ through the connection's slot as its own attempt, is charged as role
+ `probe`, and must be answered by that model.
+- **The cache.** The result is cached per `(connection, model)`:
+ `healthy` with its time, or `unhealthy` with a reason. Unhealthy
+ models are not eligible. A model is probed again on Check again, or
+ when it was `unhealthy` more than 24 hours ago. A `healthy` model
+ whose step fails with an authentication or model-not-found error
+ becomes `unhealthy`.
+- **Accounting.** The probe is admitted by the same budget and leave-to-
+ spend bars as the step it precedes. It runs only when the step itself
+ would be admitted, and both are charged. If the probe fails, `Decide`
+ runs again without that model.
+
+### 16.5 Invariants (property tests)
+
+- (a) The chosen model is allowed, priced, tiered and not unhealthy.
+- (b) For Review, a different family is chosen whenever an eligible
+ model of a different family is allowed on an eligible connection.
+- (c) At equal inputs except fill, a higher fill never yields a higher
+ tier.
+- (d) A kept session keeps its model while it is allowed and healthy,
+ and a question always uses its session's model.
+- (e) The same input gives the same model.
+- (f) No harness is launched with a model other than the chosen one.
+
+### 16.6 Slice S5b
+
+| # | Slice | Finish line | Sec | Size |
+|---|---|---|---|---|
+| S5b | Allowed sets with migration, the model table, `pickModel` inside `Decide`, per-model probes and their cache, the `models` frame (next free protocol, with a downgrade step and frozen-schema tests), the add screen and row ("Models: 9 of 10"), and the model shown on steps and Usage | With fakes: a first Engineering pass on a fresh connection probes and then runs the strongest allowed model; at 0.8 fill the next pass runs a cheap one; Review of a GLM step runs Kimi; unticking Kimi makes Review run GLM labelled same family; a question stays on its session's model; a migrated single-model connection behaves exactly as before | **Sec** (it sets what is spent) | 2 |