Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

feat(routing): decide contributor connections by their contentUse field

Jack Rudenko07662fffc62a
diff --git a/ai-docs/architecture/providers/meta-muse-code.md b/ai-docs/architecture/providers/meta-muse-code.md
index 671fdd93..6ae306ec 100644
--- a/ai-docs/architecture/providers/meta-muse-code.md
+++ b/ai-docs/architecture/providers/meta-muse-code.md
@@ -371,14 +371,18 @@ expired Muse login answers 400 with the login hint, and the chain never walks on
Jack's decision (2026-10-16): **a contributor wire id is never chosen implicitly, on any route.** A
user who types `provider@<id>-contributor` gets it verbatim.
-`isOptInWireId` (`providers/content-use.ts`, `d9193383`) matches `-contributor` and
-`-contributor-free` on the last path segment. Where catalog data enters memory, the matching
-connections move from `aggregators[]` to `optInConnections[]`, which only exact-id readers
-(`allConnections`) consult. [`routing.md`](../routing.md) lists the entry points and readers.
-
-**Remove the guard when models-index publishes a content-use field on every route (backend M3).**
-It is the one wire-id name rule claudish keeps. The trigger is that field, not Meta: OpenCode Zen's
-`-contributor-free` ids are covered by the same regex.
+Jack's follow-up decision (2026-10-22): a connection's `contentUse` field wins over its wire id.
+`contributor` means opt-in; `standard` never means opt-in, even for an id ending in
+`-contributor`. Without the field, `isOptInWireId` (`providers/content-use.ts`) matches
+`-contributor` and `-contributor-free` on the last path segment. Where catalog data enters
+memory, `splitOptInConnections` applies this connection rule and moves opt-in connections from
+`aggregators[]` to `optInConnections[]`, which only exact-id readers (`allConnections`) consult.
+Readers holding only a wire id keep the suffix rule. [`routing.md`](../routing.md) lists the
+entry points and readers.
+
+**Remove the suffix fallback when models-index publishes `contentUse` on every connection
+(backend M3).** Until then it is the one wire-id name rule claudish keeps. The trigger is field
+coverage, not Meta: OpenCode Zen's `-contributor-free` ids are covered by the same regex.
## Backend tasks (models-index)
@@ -387,13 +391,14 @@ Filed in `ai-docs/reports/BACKEND_TASKS_meta_muse_code_route-20261016.md`, origi
`g-20261021063612126-17350b71`. That generation also publishes a `contentUse` field (`standard` or
`contributor`) on 735 of 1924 connections, including all 11 `-contributor` connections (routes
`meta/direct-api`, `meta/muse-code-subscription`, `opencode/go-subscription`,
-`openrouter/gateway`). claudish does not read it yet: the guard below still matches the suffix.
+`openrouter/gateway`). claudish reads that field first and uses the suffix only where the field
+is absent.
| Task | What | Status / unblocks |
|---|---|---|
| M1 | a subscription route profile on route `meta`, `apis: [responses]`, its own credential profile | published; binding row done (MTL-189) |
| M2 | plan `meta-muse-code` to `supported` with that route | published; membership gating now reads this route binding |
-| M3 | one mapped connection per member, wire id as `/muse-code/models` spells it; contributor ids marked by a field, not only the suffix | mapped connections and `contentUse` published; moving the contributor guard from the suffix to the field is not done |
+| M3 | one mapped connection per member, wire id as `/muse-code/models` spells it; contributor ids marked by a field, not only the suffix | mapped connections and partial `contentUse` published; field-first guard implemented, suffix fallback remains until every connection carries the field |
| M4 | a model record `muse-wonder-full`, wire id `muse-wonder-full-1.0` | bare `muse-wonder-full` |
| M5 | per-connection limits and effort from `/muse-code/models` | the effort and window gaps above |
| M6 | per-tier membership: Wonder Full is Power and Maximum only | no 4xx candidate on a lower tier |
diff --git a/ai-docs/architecture/routing.md b/ai-docs/architecture/routing.md
index 5a1f9843..9c63c589 100644
--- a/ai-docs/architecture/routing.md
+++ b/ai-docs/architecture/routing.md
@@ -332,9 +332,11 @@ in, with nothing on screen to say so.
Jack's decision: a contributor id is never chosen for the user, on any route. One typed exactly
(`[email protected]`) is sent verbatim.
-`isOptInWireId` (`providers/content-use.ts`) matches `-contributor` and `-contributor-free` on the
-last path segment. It is enforced where catalog data enters memory, not at each reader, so a
-reader added later inherits it:
+The connection rule (`providers/content-use.ts`, decision 2026-10-22) reads `contentUse` first:
+`contributor` means opt-in; `standard` never means opt-in, even with a contributor suffix.
+Without the field, `isOptInWireId` matches `-contributor` and `-contributor-free` on the last
+path segment. The connection rule is enforced where catalog data enters memory, not at each
+reader, so a reader added later inherits it:
| Entry point | What it does |
|---|---|
@@ -354,9 +356,10 @@ and shows no drop. Measured on the pinned generation `g-20261016053727894-8a7437
models): three chains changed, and each lost only `zengo@<id>-contributor` (`gemini-4-argon`,
`muse-spark-1.3`, `muse-spark-1.2`).
-**Removal trigger:** models-index publishes a content-use field on every route (backend task M3,
-`ai-docs/reports/BACKEND_TASKS_meta_muse_code_route-20261016.md`). Until then this is the one
-wire-id name rule claudish keeps.
+**Suffix-fallback removal trigger:** models-index publishes `contentUse` on every connection
+(backend task M3, `ai-docs/reports/BACKEND_TASKS_meta_muse_code_route-20261016.md`). Readers with
+only a wire id still use the suffix rule. Until then this is the one wire-id name rule claudish
+keeps.
## Route bindings: which claudish provider a catalog route means
diff --git a/packages/cli/src/providers/content-use.field.test.ts b/packages/cli/src/providers/content-use.field.test.ts
new file mode 100644
index 00000000..7515bd9c
--- /dev/null
+++ b/packages/cli/src/providers/content-use.field.test.ts
@@ -0,0 +1,103 @@
+import { expect, test } from "bun:test";
+import { readFileSync, readdirSync } from "node:fs";
+import { join } from "node:path";
+import type { AggregatorEntry } from "../model-loader.js";
+import museCatalog from "../test-fixtures/catalog-v3/muse-code-g-20261021063612126-17350b71.json";
+import { isOptInWireId, splitOptInConnections } from "./content-use.js";
+
+// MTL-189 follow-up: F — contentUse wins over contributor suffixes (generation g-20261021063612126-17350b71).
+const spark = museCatalog.entries.find((entry) => entry.modelId === "muse-spark-1.3")!;
+type CatalogConnection = (typeof spark.aggregators)[number];
+
+function catalogConnection(row: CatalogConnection): AggregatorEntry & CatalogConnection {
+ return row as AggregatorEntry & CatalogConnection;
+}
+
+const contributor = catalogConnection(
+ spark.aggregators.find(
+ (row) => row.route.routeProfileId === "direct-api" && row.contentUse === "contributor"
+ )!
+);
+const standard = catalogConnection(
+ spark.aggregators.find(
+ (row) => row.route.routeProfileId === "direct-api" && row.contentUse === "standard"
+ )!
+);
+
+test("F1: a real contributor contentUse connection is opt-in", () => {
+ const row = structuredClone(contributor);
+ const result = splitOptInConnections({ aggregators: [row] });
+ expect(result.optInConnections).toEqual([row]);
+ expect(result.aggregators).toEqual([]);
+});
+
+test("F2: a missing contentUse retains the contributor suffix fallback", () => {
+ const { contentUse: _contentUse, ...row } = structuredClone(contributor);
+ const result = splitOptInConnections({ aggregators: [row] });
+ expect(result.optInConnections).toEqual([row]);
+ expect(result.aggregators).toEqual([]);
+});
+
+test("F3: a real standard contentUse connection is not opt-in", () => {
+ const row = structuredClone(standard);
+ const result = splitOptInConnections({ aggregators: [row] });
+ expect(result.aggregators).toEqual([row]);
+ expect(result.optInConnections ?? []).toEqual([]);
+});
+
+test("F4: standard contentUse wins over a contributor suffix", () => {
+ const row = { ...structuredClone(contributor), contentUse: "standard" };
+ const result = splitOptInConnections({ aggregators: [row] });
+ expect(result.optInConnections ?? []).toEqual([]);
+ expect(result.aggregators).toEqual([row]);
+});
+
+test("F5: contributor contentUse is opt-in without a contributor suffix", () => {
+ const row = {
+ ...structuredClone(contributor),
+ externalModelId: contributor.externalModelId.replace(/-contributor$/, ""),
+ };
+ const result = splitOptInConnections({ aggregators: [row] });
+ expect(result.optInConnections).toEqual([row]);
+ expect(result.aggregators).toEqual([]);
+});
+
+function catalogConnections(value: unknown): AggregatorEntry[] {
+ if (!value || typeof value !== "object") return [];
+ if (Array.isArray(value)) return value.flatMap(catalogConnections);
+ return Object.entries(value).flatMap(([key, child]) =>
+ (key === "aggregators" || key === "optInConnections") && Array.isArray(child)
+ ? (child as AggregatorEntry[])
+ : catalogConnections(child)
+ );
+}
+
+const catalogDir = join(import.meta.dir, "..", "test-fixtures", "catalog-v3");
+const catalogFiles = readdirSync(catalogDir)
+ .filter((file) => file.endsWith(".json"))
+ .sort()
+ .map((file) => ({
+ file,
+ connections: catalogConnections(JSON.parse(readFileSync(join(catalogDir, file), "utf8"))),
+ }))
+ .filter(({ connections }) => connections.length > 0);
+
+test("the real catalog test data contains connections carrying contentUse", () => {
+ expect(
+ catalogFiles.flatMap(({ connections }) => connections).filter((row) => "contentUse" in row)
+ .length
+ ).toBeGreaterThan(0);
+});
+
+for (const { file, connections } of catalogFiles) {
+ test(`contentUse and wire-id opt-in rules agree for every field-bearing connection in ${file}`, () => {
+ for (const row of connections.filter((connection) => "contentUse" in connection)) {
+ expect(typeof row.externalModelId).toBe("string");
+ const result = splitOptInConnections({ aggregators: [row] });
+ const optIn = isOptInWireId(row.externalModelId!);
+ const label = `${file}: ${row.route?.routeId}/${row.route?.routeProfileId}/${row.externalModelId}`;
+ expect(result.optInConnections?.includes(row) ?? false, label).toBe(optIn);
+ expect(result.aggregators?.includes(row) ?? false, label).toBe(!optIn);
+ }
+ });
+}
diff --git a/packages/cli/src/providers/content-use.ts b/packages/cli/src/providers/content-use.ts
index d8ac0f48..bd4a80f6 100644
--- a/packages/cli/src/providers/content-use.ts
+++ b/packages/cli/src/providers/content-use.ts
@@ -32,21 +32,27 @@
* lookup, `findConnection`'s exact step, the availability reverse lookup and the
* registry validation.
*
- * This is the ONE wire-id name rule claudish keeps. It is removed when the
- * catalog publishes a content-use field on every route (models-index M3).
+ * The connection's `contentUse` field wins: `contributor` opts in, `standard`
+ * does not (2026-10-22). Missing fields and bare wire ids use the suffix rule,
+ * the ONE wire-id name rule claudish keeps until every connection carries the
+ * field (models-index M3).
*/
import type { AggregatorEntry } from "../model-loader.js";
/**
* A wire id that opts the request's content into the vendor's product-improvement use.
- * Replace with the catalog field when models-index publishes one (M3, every route).
+ * Fallback for a connection without `contentUse`, or a reader holding only a wire id.
*/
export function isOptInWireId(wireId: string): boolean {
return /-contributor(?:-free)?$/i.test(wireId.split("/").pop() ?? wireId);
}
-/** Whether one catalog connection's wire id opts content in. */
+/** Whether one catalog connection opts content in; its field wins over the suffix. */
function isOptInConnection(connection: AggregatorEntry): boolean {
+ if ("contentUse" in connection) {
+ if (connection.contentUse === "contributor") return true;
+ if (connection.contentUse === "standard") return false;
+ }
return (
typeof connection.externalModelId === "string" && isOptInWireId(connection.externalModelId)
);