Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

feat(desktop): recommend the localmodels pick on Quick Install

claude-opus-5-5-medium471e4627885e
diff --git a/apps/desktop/AGENTS.md b/apps/desktop/AGENTS.md
index 952ae81e..afe28af9 100644
--- a/apps/desktop/AGENTS.md
+++ b/apps/desktop/AGENTS.md
@@ -114,9 +114,14 @@ Gateway and runs Agents. The daemon exits with the app.
TeamHub and a relay forwards it the same way; a fix needs a check that
the web port belongs to the web process the installer started. Every
existing session cookie for the origin has the same exposure.
- The default AI runtime is the
- installer's recommendation, or Codex when the installer cannot inspect the
- computer. It records the install location, source, origin and engine in
+ Quick Install installs the `recommendation` of the localmodels setup
+ report (`installer.js --inspect`, run once as the setup window opens):
+ `local-models` is the planned model served by Pi, shown with the model,
+ GPU, memory and download; otherwise the named runtime, with the tool's
+ reason for no local model. The page adds no host rule of its own; it waits
+ for the check, and Customize marks the recommended runtime and model. When
+ the check fails the installer picks, or Codex when it cannot inspect the
+ computer either. It records the install location, source, origin and engine in
`desktop/local-server.json` under the default home and, while the window
still uses that origin, restarts the services on launch with
`installer.js --resume`, which also restarts them when the instance's
diff --git a/apps/desktop/src/main/local-server.test.ts b/apps/desktop/src/main/local-server.test.ts
index b0fbcb03..84667267 100644
--- a/apps/desktop/src/main/local-server.test.ts
+++ b/apps/desktop/src/main/local-server.test.ts
@@ -76,12 +76,13 @@ if (args.includes("--inspect")) {
const hardware = { totalMemoryBytes: 64 * 1024 ** 3, diskFreeBytes: 200 * 1024 ** 3, gpus: [{ name: "RTX 4090" }] };
const eligible = !fs.existsSync(path.join(home, "small-computer"));
const estimate = eligible
- ? { model: "qwen3-8b", downloadBytes: 6 * 1024 ** 3, diskBytes: 8 * 1024 ** 3, memoryBytes: 12 * 1024 ** 3 }
+ ? { model: fs.existsSync(path.join(home, "unnamed-model")) ? "" : "qwen3-8b", downloadBytes: 6 * 1024 ** 3, diskBytes: 8 * 1024 ** 3, memoryBytes: 12 * 1024 ** 3 }
: { model: "", downloadBytes: null, diskBytes: null, memoryBytes: null };
process.stderr.write("Checked this computer in 1.5s.\n");
const reasons = eligible ? [] : ["facts-unavailable"];
const reasonMessages = eligible ? [] : ["nvidia-smi was not found"];
- process.stdout.write(JSON.stringify({ hardware, localModels: { eligible, reasons, reasonMessages, estimate } }) + "\n");
+ const recommendation = eligible ? "local-models" : "codex";
+ process.stdout.write(JSON.stringify({ hardware, localModels: { eligible, reasons, reasonMessages, estimate }, recommendation }) + "\n");
process.exit(0);
}
if (args.includes("--resume")) {
@@ -1258,6 +1259,7 @@ describe("LocalServerModule", () => {
diskBytes: 8 * 1024 ** 3,
memoryBytes: 12 * 1024 ** 3,
},
+ recommendation: "local-models",
}),
);
expect(installerArgs(f.home)).toEqual(["--home", f.home, "--inspect"]);
@@ -1268,6 +1270,22 @@ describe("LocalServerModule", () => {
info.mockRestore();
});
+ it("does not recommend a local model it cannot name", async () => {
+ const f = fixture({ checkout: "/src" }, {}, (home) => {
+ mkdirSync(home, { recursive: true });
+ writeFileSync(path.join(home, "unnamed-model"), "");
+ });
+ await f.host.start();
+ f.module.inspect();
+ await vi.waitFor(() =>
+ expect(f.module.status().localModels).toMatchObject({
+ state: "checked",
+ eligible: false,
+ }),
+ );
+ expect(f.module.status().localModels).not.toHaveProperty("recommendation");
+ });
+
it("reports a computer too small for a local model", async () => {
const info = vi.spyOn(silentLog, "info");
const f = fixture({ checkout: "/src" }, {}, (home) => {
@@ -1281,6 +1299,7 @@ describe("LocalServerModule", () => {
state: "checked",
eligible: false,
reasons: ["facts-unavailable: nvidia-smi was not found"],
+ recommendation: "codex",
}),
);
expect(f.module.status().localModels).not.toHaveProperty("model");
diff --git a/apps/desktop/src/main/local-server.ts b/apps/desktop/src/main/local-server.ts
index a7ac5bdb..9fb4266e 100644
--- a/apps/desktop/src/main/local-server.ts
+++ b/apps/desktop/src/main/local-server.ts
@@ -108,8 +108,19 @@ export type LocalModelsCheck =
// Why not, in the localmodels tool's words; present only when not
// eligible.
readonly reasons?: readonly string[];
+ // The localmodels tool's pick for this computer, which Quick Install
+ // installs; the page adds no rule of its own.
+ readonly recommendation?: SetupRecommendation;
};
+export type SetupRecommendation = "local-models" | "codex" | "claude" | "pi";
+const RECOMMENDATIONS: readonly string[] = [
+ "local-models",
+ "codex",
+ "claude",
+ "pi",
+] satisfies readonly SetupRecommendation[];
+
// What to install, chosen on the setup page; the installer applies it at once.
export interface LocalServerPlan {
// "local" runs tasks on an inference model deployed on this computer.
@@ -473,6 +484,9 @@ export class LocalServerModule implements Module {
this.#ctx?.log.info("local_server.inspected", {
ms: Date.now() - started,
eligible: check.state === "checked" && check.eligible,
+ ...(check.state === "checked" && check.recommendation
+ ? { recommendation: check.recommendation }
+ : {}),
...(check.state === "checked" && check.reasons
? { reasons: check.reasons }
: {}),
@@ -528,6 +542,7 @@ export class LocalServerModule implements Module {
child.once("close", () => resolve(text));
});
const report = JSON.parse(output.trim().split("\n").at(-1) ?? "") as {
+ recommendation?: unknown;
localModels?: {
eligible?: unknown;
reasons?: unknown;
@@ -567,6 +582,14 @@ export class LocalServerModule implements Module {
const reasons = strings(report.localModels.reasons).map((code, index) =>
messages[index] ? `${code}: ${messages[index]}` : code,
);
+ const pick = report.recommendation;
+ // The local model is recommended only with a model the page can show.
+ const recommendation =
+ typeof pick === "string" &&
+ RECOMMENDATIONS.includes(pick) &&
+ (pick !== "local-models" || eligible)
+ ? (pick as SetupRecommendation)
+ : undefined;
return {
state: "checked",
eligible,
@@ -587,6 +610,7 @@ export class LocalServerModule implements Module {
}
: {}),
...(!eligible && reasons.length ? { reasons } : {}),
+ ...(recommendation ? { recommendation } : {}),
};
}
diff --git a/apps/desktop/src/shared/setup.ts b/apps/desktop/src/shared/setup.ts
index d003477d..05a88aaf 100644
--- a/apps/desktop/src/shared/setup.ts
+++ b/apps/desktop/src/shared/setup.ts
@@ -96,6 +96,9 @@ export type SetupLocalModelsCheck =
};
// Why not, in the localmodels tool's words; when not eligible.
readonly reasons?: readonly string[];
+ // The localmodels tool's pick, which Quick Install installs:
+ // "local-models" is the model above served by Pi.
+ readonly recommendation?: "local-models" | "codex" | "claude" | "pi";
};
// The AI runtime the installer sets up; "recommended" lets it pick and
diff --git a/apps/desktop/src/shell/setup-page.test.ts b/apps/desktop/src/shell/setup-page.test.ts
index 7d33498d..2cf7db44 100644
--- a/apps/desktop/src/shell/setup-page.test.ts
+++ b/apps/desktop/src/shell/setup-page.test.ts
@@ -8,6 +8,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
import type {
SetupCommand,
SetupLocalAccount,
+ SetupLocalModelsCheck,
SetupState,
} from "../shared/setup.js";
@@ -45,13 +46,16 @@ const state = (
},
});
-// Loads the setup page with a fake main process that starts mid-install.
-const openPage = async () => {
+// Loads the setup page with a fake main process, mid-install by default.
+const openPage = async (
+ initial: SetupState = state("installing"),
+ step = "installing",
+) => {
const [, body] = /<body[^>]*>([\s\S]*)<\/body>/.exec(page)!;
const [, script] = /<script>([\s\S]*)<\/script>/.exec(body!)!;
document.body.innerHTML = body!.replace(/<script>[\s\S]*<\/script>/, "");
let listener: ((next: SetupState) => void) | undefined;
- let current = state("installing");
+ let current = initial;
const run = vi.fn(async (command: SetupCommand) => {
if (command.op === "local.account.show")
current = state("ready", {
@@ -74,7 +78,7 @@ const openPage = async () => {
new Function(script!)();
await vi.waitFor(() =>
expect(
- document.querySelector('section[data-step="installing"].active'),
+ document.querySelector(`section[data-step="${step}"].active`),
).not.toBeNull(),
);
const push = (next: SetupState) => {
@@ -155,3 +159,128 @@ describe("setup page finish screen", () => {
expect($("account-error").textContent).toContain("chmod 600");
});
});
+
+const GB = 1024 ** 3;
+const capable: SetupLocalModelsCheck = {
+ state: "checked",
+ eligible: true,
+ memoryBytes: 64 * GB,
+ diskFreeBytes: 400 * GB,
+ gpu: "RTX 4090",
+ model: {
+ name: "qwen3-8b",
+ downloadBytes: 6 * GB,
+ diskBytes: 8 * GB,
+ memoryBytes: 12 * GB,
+ },
+ recommendation: "local-models",
+};
+const small: SetupLocalModelsCheck = {
+ state: "checked",
+ eligible: false,
+ memoryBytes: 8 * GB,
+ diskFreeBytes: 100 * GB,
+ reasons: ["plan-unavailable: No model fits this computer."],
+ recommendation: "codex",
+};
+const welcome = (localModels: SetupLocalModelsCheck): SetupState => {
+ const base = state("idle");
+ return { ...base, localServer: { ...base.localServer, localModels } };
+};
+const installed = (run: ReturnType<typeof vi.fn>) =>
+ run.mock.calls
+ .map(([command]) => command as SetupCommand)
+ .filter((command) => command.op === "local.start");
+
+describe("setup page Quick Install recommendation", () => {
+ it("installs the local model with Pi when the localmodels tool recommends it", async () => {
+ const { run } = await openPage(welcome(capable), "welcome");
+ expect($("plan-summary").textContent).toBe(
+ "Recommended for this computer: Local model + Pi",
+ );
+ expect($("plan-why").hidden).toBe(false);
+ expect($("plan-why").textContent).toBe(
+ "qwen3-8b · fits RTX 4090 · 64 GB memory · 6 GB download",
+ );
+ expect($("local-install-label").textContent).toBe("Quick Install");
+ $("local-install").click();
+ await vi.waitFor(() =>
+ expect(installed(run)).toEqual([{ op: "local.start", runtime: "local" }]),
+ );
+ });
+
+ it("installs the tool's runtime and says why there is no local model", async () => {
+ const { run } = await openPage(welcome(small), "welcome");
+ expect($("plan-summary").textContent).toBe(
+ "Recommended for this computer: Codex",
+ );
+ expect($("plan-why").textContent).toBe(
+ "No local model: No model fits this computer.",
+ );
+ expect($("local-row").hidden).toBe(true);
+ $("local-install").click();
+ await vi.waitFor(() =>
+ expect(installed(run)).toEqual([{ op: "local.start", runtime: "codex" }]),
+ );
+ });
+
+ it("lets the installer pick when this computer could not be checked", async () => {
+ const { run } = await openPage(
+ welcome({ state: "unavailable" }),
+ "welcome",
+ );
+ expect($("plan-summary").textContent).toBe("Best AI runtime");
+ expect($("plan-why").textContent).toBe(
+ "Couldn't check this computer for a local model.",
+ );
+ $("local-install").click();
+ await vi.waitFor(() =>
+ expect(installed(run)).toEqual([
+ { op: "local.start", runtime: "recommended" },
+ ]),
+ );
+ });
+
+ it("waits for the check before Quick Install", async () => {
+ const { push } = await openPage(welcome({ state: "checking" }), "welcome");
+ expect($("plan-summary").textContent).toBe("Checking this computer…");
+ expect(($("local-install") as HTMLButtonElement).disabled).toBe(true);
+ push(welcome(capable));
+ expect(($("local-install") as HTMLButtonElement).disabled).toBe(false);
+ expect($("plan-summary").textContent).toBe(
+ "Recommended for this computer: Local model + Pi",
+ );
+ });
+
+ it("marks the recommendation under Customize and installs the person's choice", async () => {
+ const { run } = await openPage(welcome(capable), "welcome");
+ $("local-customize").click();
+ const option = (value: string) =>
+ document.querySelector<HTMLButtonElement>(
+ `[data-plan="runtime"] [data-value="${value}"]`,
+ )!;
+ expect(option("pi").dataset.recommended).toBe("true");
+ expect(option("pi").getAttribute("aria-checked")).toBe("true");
+ expect(option("codex").dataset.recommended).toBe("false");
+ expect(option("recommended").hidden).toBe(true);
+ expect($("runtime-sub").textContent).toBe("Recommended: Pi.");
+ expect($("local-sub").textContent).toContain(
+ "Recommended for this computer",
+ );
+ expect($("local-model").getAttribute("aria-checked")).toBe("true");
+ option("claude").click();
+ expect($("local-model").getAttribute("aria-checked")).toBe("false");
+ expect($("local-install-label").textContent).toBe("Install");
+ $("local-install").click();
+ await vi.waitFor(() =>
+ expect(installed(run)).toEqual([
+ { op: "local.start", runtime: "claude" },
+ ]),
+ );
+ $("local-customize").click();
+ expect($("local-install-label").textContent).toBe("Quick Install");
+ expect($("plan-summary").textContent).toBe(
+ "Recommended for this computer: Local model + Pi",
+ );
+ });
+});
diff --git a/apps/desktop/src/shell/setup.html b/apps/desktop/src/shell/setup.html
index 8fc632f7..e3c57335 100644
--- a/apps/desktop/src/shell/setup.html
+++ b/apps/desktop/src/shell/setup.html
@@ -584,6 +584,13 @@
color: var(--faint);
font-size: 12px;
}
+ .plan-why {
+ max-width: 440px;
+ margin-top: 4px;
+ color: var(--faint);
+ font-size: 11.5px;
+ line-height: 1.45;
+ }
.plan-line .sep {
width: 3px;
height: 3px;
@@ -693,6 +700,17 @@
.seg button:hover:not(:disabled) {
color: var(--ink);
}
+ /* The localmodels tool's pick for this computer. */
+ .seg button[data-recommended="true"]::after {
+ content: "";
+ position: absolute;
+ top: 4px;
+ right: 4px;
+ width: 5px;
+ height: 5px;
+ border-radius: 50%;
+ background: #d9822b;
+ }
.seg button[aria-checked="true"] {
color: var(--ink);
cursor: default;
@@ -1418,6 +1436,7 @@
Customize
</button>
</p>
+ <p class="plan-why" id="plan-why" hidden></p>
</div>
<p class="error" id="local-error" role="alert"></p>
<p class="team" id="team">
@@ -1843,12 +1862,22 @@
value.length <= 46
? value
: value.slice(0, 18) + "…" + value.slice(-27);
- // The local model runs tasks through Pi, so choosing it chooses Pi.
- const defaults = () => ({
- runtime: "recommended",
- localModel: false,
- });
+ // Quick Install installs what the localmodels tool recommends for this
+ // computer once it has checked; until then (or when it cannot check)
+ // the installer picks. The local model runs tasks through Pi, so
+ // choosing it chooses Pi.
+ const defaults = () => {
+ const models = state.localServer.localModels;
+ const pick = models.state === "checked" && models.recommendation;
+ if (pick === "local-models" && models.eligible && models.model)
+ return { runtime: "pi", localModel: true };
+ if (pick && pick !== "local-models" && RUNTIMES[pick])
+ return { runtime: pick, localModel: false };
+ return { runtime: "recommended", localModel: false };
+ };
let plan;
+ // Whether the person changed the plan; until then it follows defaults().
+ let picked = false;
let customizing = false;
// Provider keys typed or removed here ("" removes the saved one); kept
// only in the inputs and sent once with Install.
@@ -2088,7 +2117,8 @@
const renderLocal = (busy) => {
const local = state.localServer;
- plan ??= defaults();
+ const recommended = defaults();
+ if (!picked) plan = recommended;
// The local model is offered only once this computer is known to
// serve it; until then its row does not show.
const models = local.localModels;
@@ -2096,6 +2126,12 @@
models.state === "checked" && models.eligible && models.model;
if (!model) plan.localModel = false;
const custom = !isDefaultPlan(local);
+ // Quick Install waits for the check, so it installs what it shows.
+ const checking = models.state === "checking";
+ const known = recommended.runtime !== "recommended";
+ const following = JSON.stringify(plan) === JSON.stringify(recommended);
+ const named = (choice) =>
+ choice.localModel ? "Local model + Pi" : RUNTIMES[choice.runtime];
$("welcome-lead").textContent = local.available
? "Runs on this computer, just for you. Takes a few minutes."
: "Connect this computer to your team's Linger.";
@@ -2114,12 +2150,42 @@
: "Quick Install";
document.querySelector('[data-step="welcome"]').dataset.customizing =
String(customizing && local.available);
- $("plan-summary").textContent = [
- RUNTIMES[plan.runtime] || "Best AI runtime",
- plan.localModel && "Local model",
- ]
- .filter(Boolean)
- .join(" · ");
+ $("local-install").disabled ||= checking;
+ $("plan-summary").textContent = checking
+ ? "Checking this computer…"
+ : following && known
+ ? "Recommended for this computer: " + named(plan)
+ : [
+ RUNTIMES[plan.runtime] || "Best AI runtime",
+ plan.localModel && "Local model",
+ ]
+ .filter(Boolean)
+ .join(" · ");
+ // Why, in the localmodels tool's facts and words.
+ $("plan-why").textContent =
+ !following || checking
+ ? ""
+ : plan.localModel
+ ? [
+ model.name,
+ "fits " + (models.gpu || "this computer"),
+ gigabytes(models.memoryBytes) + " memory",
+ model.downloadBytes != null &&
+ gigabytes(model.downloadBytes) + " download",
+ ]
+ .filter(Boolean)
+ .join(" · ")
+ : models.state === "checked" && !models.eligible
+ ? "No local model: " +
+ // The tool's message, without the "<code>: " the main
+ // process puts before it.
+ (models.reasons?.[0]?.replace(/^[a-z-]+: /, "") ||
+ "this computer can't run one.")
+ : models.state === "unavailable"
+ ? "Couldn't check this computer for a local model."
+ : "";
+ $("plan-why").hidden =
+ !local.available || customizing || !$("plan-why").textContent;
$("plan-line").hidden = !local.available;
$("welcome-eyebrow").hidden = !local.available;
const location = local.location;
@@ -2147,7 +2213,9 @@
$("local-model").hidden = !model;
if (model) {
$("local-sub").textContent = [
- "Runs your tasks on this computer",
+ recommended.localModel
+ ? "Recommended for this computer"
+ : "Runs your tasks on this computer",
models.gpu,
]
.filter(Boolean)
@@ -2168,14 +2236,23 @@
);
$("local-model").disabled = busy;
}
- $("runtime-sub").textContent = plan.localModel
- ? "Pi + local model."
- : "Runs your tasks.";
+ $("runtime-sub").textContent = known
+ ? "Recommended: " + RUNTIMES[recommended.runtime] + "."
+ : plan.localModel
+ ? "Pi + local model."
+ : "Runs your tasks.";
for (const seg of document.querySelectorAll("[data-plan]"))
for (const option of seg.querySelectorAll("button")) {
+ const value = option.dataset.value;
option.setAttribute(
"aria-checked",
- String(plan[seg.dataset.plan] === option.dataset.value),
+ String(plan[seg.dataset.plan] === value),
+ );
+ // With the tool's pick known, it is marked and Auto is not
+ // needed.
+ option.hidden = known && value === "recommended";
+ option.dataset.recommended = String(
+ known && value === recommended.runtime,
);
option.disabled = busy;
}
@@ -2493,7 +2570,7 @@
$("local-customize").addEventListener("click", () => {
customizing = !customizing;
if (!customizing) {
- plan = defaults();
+ picked = false;
clearKeys();
const location = state.localServer.location;
if (location.custom || location.error)
@@ -2504,6 +2581,7 @@
for (const seg of document.querySelectorAll("[data-plan]"))
for (const option of seg.querySelectorAll("button"))
option.addEventListener("click", () => {
+ picked = true;
plan = { ...plan, [seg.dataset.plan]: option.dataset.value };
// Another runtime than Pi does not run the local model.
if (plan.runtime !== "pi") plan.localModel = false;
@@ -2513,6 +2591,7 @@
run({ op: "local.location.pick" }),
);
$("local-model").addEventListener("click", () => {
+ picked = true;
plan = plan.localModel
? { ...plan, localModel: false }
: { ...plan, runtime: "pi", localModel: true };