rulesync icon indicating copy to clipboard operation
rulesync copied to clipboard

`models`: one source for model providers and model lists

Open Fe2-O3 opened this issue 2 months ago • 3 comments

rulesync already turns one source into each tool's own files for rules, MCP servers, commands, subagents, skills, hooks, and checks. This tracks one more feature, models. Model providers and their models are declared once in .rulesync/models.jsonc, and rulesync writes each coding tool's provider and model-list config. The source file reuses the field names of models.dev exactly. OpenCode already reads that schema, and it is the only open, cross-tool catalog of providers and models. Nothing new is invented.

Problem

Every coding agent keeps its own provider and model list in its own shape. Anyone with a local model server, a self-hosted proxy, or a subscription endpoint copies the same list into each tool by hand. Context limits drift and names differ between tools. Adding one model means editing five files. This is the same many-copies problem rulesync already solves for MCP servers.

Standards reused

models.dev provider fields (id, name, api, env, npm, doc, models) and model fields (id, name, limit.context, limit.output, tool_call, reasoning, modalities, and the rest). Secrets use the ${VAR} reference form the mcp feature uses, converted per tool (OpenCode gets {env:VAR}). A literal key is never written. Per-tool overrides use tool-scoped blocks ({ "opencode": { ... } }), not the deprecated targets field.

Proposed source file

.rulesync/models.jsonc, inert unless the file exists:

{
  "providers": {
    "local": {
      "name": "Local models",
      "npm": "@ai-sdk/openai-compatible",
      "api": "http://127.0.0.1:5678/v1",
      "env": ["LOCAL_MODELS_KEY"],
      "models": {
        "ollama/qwen3-coder:30b": {
          "id": "ollama/qwen3-coder:30b",
          "name": "Qwen3 Coder 30B",
          "limit": { "context": 131072, "output": 16384 },
          "tool_call": true,
          "reasoning": false
        }
      }
    }
  },
  "default": { "provider": "local", "model": "ollama/qwen3-coder:30b" },
  "opencode": { "default": { "provider": "opencode-go", "model": "glm-5.3" } }
}

Status

One PR is open. Everything else is written, tested, and pushed to my fork, and files one predecessor at a time as merges land. Note: part 1 below is two PRs, 1A and 1B — the OpenCode slice was too big for the line limits as one.

PR State Lines Contains
1A OpenCode schema plus generate Open as #3197 (draft) 966 Source schema plus loader, processor, OpenCode forward mapping, unit coverage
1B OpenCode import plus tables Ready on my fork, files after 1A merges 527 Reverse mapping, import plus convert, end-to-end coverage, file-formats docs, matrix column
2 Hermes Agent Ready on my fork 499 model: block plus custom_providers list, global-only
3 Crush Ready on my fork 394 Legacy JSON providers plus models.large slot
4 Zed Ready on my fork 361 openai_compatible entries, no keys, no default
5 Continue Ready on my fork 326 models list entries, additive capabilities only
6 Goose Ready on my fork 577 Per-provider JSON plus config default, global-only
7 Qwen Code Ready on my fork 328 modelProviders plus protocol mapping
8 Pi Ready on my fork 321 Dedicated global models.json
9 Aider Ready on my fork 294 Metadata map, new aider target
10 models fetch Ready on my fork 251 Copy one provider block from models.dev
11 models discover Ready on my fork 140 Fill ids plus reported limits from live endpoints

Each PR stays under 1,000 added lines. Full unit suite green on every branch.

Not in scope

No stored secrets. No logins or OAuth. No routing or proxying. No new model catalog.

Fe2-O3 avatar Sep 27 '26 19:09 Fe2-O3

Triage note (2026-10-17): no PR for now. A new models feature category is a design decision that only a maintainer can make, and the part-1 PR (#3197) went stale and closed without a review. For reference, the model and provider config surfaces of the tools mentioned here:

  • OpenCode: provider.<id> with npm, options.baseURL, {env:VAR} and per-model limit. Docs
  • Zed: language_models.openai_compatible.<id> with api_url and available_models. Keys live in the keychain or env, never in settings. Docs
  • Continue: models[] with provider, model, apiBase, roles and capabilities. Docs
  • Pi: models.json with providers.<id>.{baseUrl, api, apiKey, models[]}. Docs
  • Qwen Code: modelProviders[id][] with envKey, baseUrl and generationConfig. Docs
  • Crush: crush.json providers are deprecated in favour of crushrc. Repo
  • Source schema candidate: models.dev. Repo

Open questions:

  1. Should rulesync have a models category at all?
  2. Should models.dev be the source schema?
  3. How should secrets be mapped for each tool (env reference vs. keychain vs. command)?
  4. How should global-only targets (Hermes, Goose, Pi) be handled?
  5. Does this need a new aider target?
  6. Are the network-calling models fetch / discover commands in scope?
  7. Is the proposed multi-PR rollout acceptable, and should #3197 be reopened?

dyoshikawa avatar Oct 17 '26 13:10 dyoshikawa

Status (autonomous maintenance run, 2026-11-03): leaving this open; nothing has changed since the last note. Part 1 (#3197) was closed automatically after 14 days without activity — it was never reviewed or rejected on its merits. The open questions from the previous comment are still the blockers: whether rulesync should have a models category at all, whether models.dev should be the source schema, and how secrets should be handled per tool. These need a maintainer decision before any part of the rollout can land; once the scope is settled, part 1 can be reopened or refiled.

dyoshikawa avatar Nov 03 '26 10:11 dyoshikawa

Status (autonomous run 2026-11-26): left open. The tool surfaces in the proposal are real, but a models category adds a whole new public config surface plus secret handling (provider API keys per tool) and possibly network-calling models fetch/discover commands. Those choices (category scope, source schema, secret strategy, global-only targets, an aider target, network commands) are product decisions that should not be made autonomously, especially the secret handling. Part 1 (#3197) was closed as stale without review.

dyoshikawa avatar Nov 26 '26 07:11 dyoshikawa