The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Local models: labelled with the machine's name as Harness Machines shows it
bitcoinbuilder5615d939eb7b
diff --git a/cli/src/backendSocket.spec.ts b/cli/src/backendSocket.spec.tsindex 6cdcb61eb..a13c35a4e 100644--- a/cli/src/backendSocket.spec.ts+++ b/cli/src/backendSocket.spec.ts@@ -2255,6 +2255,24 @@ describe('machine_meta carries the grid name without clobbering it on rename', (await socket.stop()})+ it("keeps the machine's own name, for the models it serves — a rename updates it, a frame without one does not", async () => {+ const socket = new BackendSocket('token')+ const namesSeen: Array<string | null> = []+ socket.onMachineMeta = (n) => { namesSeen.push(n) }+ socket.connect()+ const ws = wsMock.instances[0]+ ws.open()+ expect(socket.machineName()).toBeNull()+ ws.message({ t: 'down', connId: 'web-1', frame: { type: 'machine_meta', payload: { name: ' M2 ', gridName: 'someone-7f3a91c4' } } })+ await vi.waitFor(() => expect(socket.machineName()).toBe('M2'))+ ws.message({ t: 'down', connId: 'web-1', frame: { type: 'machine_meta', payload: { name: 'Studio' } } })+ await vi.waitFor(() => expect(socket.machineName()).toBe('Studio'))+ ws.message({ t: 'down', connId: 'web-1', frame: { type: 'machine_meta', payload: { gridName: 'someone-7f3a91c4' } } })+ await vi.waitFor(() => expect(namesSeen).toHaveLength(3))+ expect(socket.machineName()).toBe('Studio')+ await socket.stop()+ })+it('refuses a machine_meta that arrived over the LOCAL socket — only the backend may name the grid', async () => {const socket = new BackendSocket('token')const namesSeen: Array<string | null> = []diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.tsindex 710a6b4e3..0af8d0ffc 100644--- a/cli/src/backendSocket.ts+++ b/cli/src/backendSocket.ts@@ -366,7 +366,13 @@ async function enrichSubagentStats(events: SessionEvent[], transcriptPath: strinexport class BackendSocket {private readonly gridFleet = new GridFleetRpc()- private readonly localModels = new LocalModels({ stateDir: join(env.ADAPTER_DATA_DIR, 'local-models') })+ private readonly localModels = new LocalModels({+ stateDir: join(env.ADAPTER_DATA_DIR, 'local-models'),+ machineName: () => this.machineDisplayName,+ })+ /** This machine's name as Harness shows it (Machines), from the backend's `machine_meta`. Null+ * until the first one arrives. */+ private machineDisplayName: string | null = nullprivate readonly apiConnections = new ApiConnections(env.ADAPTER_DATA_DIR)private ws: WebSocket | null = nullprivate connecting = false@@ -758,6 +764,9 @@ export class BackendSocket {/** Which grid this machine's agents can be pointed at — for `harness status` and the models RPC. */gridName(): string | null { return this.harnessGridName }+ /** This machine's name as the Machines list shows it — what a model it serves is labelled with. */+ machineName(): string | null { return this.machineDisplayName }+/** The account's private grid, resolved the way the models RPC resolves it — for a harness* workspace that must be told which grid is "yours" rather than work it out or ask. */privateGridName(): Promise<string | null> { return this.resolveGridName() }@@ -1497,6 +1506,8 @@ export class BackendSocket {if ('gridName' in meta) {this.harnessGridName = typeof meta.gridName === 'string' && meta.gridName.trim() ? meta.gridName.trim() : null}+ // The same rule for the name: a frame that does not carry it leaves it as it was.+ if ('name' in meta) this.machineDisplayName = typeof name === 'string' && name.trim() ? name.trim() : nullthis.onMachineMeta?.(typeof name === 'string' && name.trim() ? name.trim() : null)return}diff --git a/cli/src/lib/localModels.spec.ts b/cli/src/lib/localModels.spec.tsindex 0650c7312..495f39a78 100644--- a/cli/src/lib/localModels.spec.ts+++ b/cli/src/lib/localModels.spec.ts@@ -924,3 +924,26 @@ describe('stepping down to the context that actually runs', () => {expect(joinedAt()).toEqual([262144])})})++describe("a model is labelled with the machine's name as Harness shows it", () => {+ // ⚠️ REGRESSION. Started from the Models modal, a model joined with no `--name`, so Grid labelled+ // it with the host name: `mac.lan` under "On your machines" while Machines called it `M2`.+ const joined = () => calls.find(args => args.includes('join'))!++ it('joins under the Harness name', async () => {+ const named = new LocalModels({ stateDir, processEnv: { GRID_HOME: home }, run, request: request as typeof fetch, machineName: () => ' M2 ' })+ await named.act('home', 'org/Small-GGUF', 'start'); await named.settled()+ expect(joined().slice(joined().indexOf('--name'), joined().indexOf('--name') + 2)).toEqual(['--name', 'M2'])+ })++ it.each([+ ['is not known yet', () => null],+ ['would read as a flag', () => '--all'],+ ['carries a control character', () => 'M2\nevil'],+ ])('leaves --name off when the name %s, rather than pass it', async (_case, machineName) => {+ const named = new LocalModels({ stateDir, processEnv: { GRID_HOME: home }, run, request: request as typeof fetch, machineName })+ await named.act('home', 'org/Small-GGUF', 'start'); await named.settled()+ expect(joined()).not.toContain('--name')+ expect((await named.list('home', true)).models[0].operation?.phase).toBe('done')+ })+})diff --git a/cli/src/lib/localModels.ts b/cli/src/lib/localModels.tsindex 2e38d0c9b..c1f633db9 100644--- a/cli/src/lib/localModels.ts+++ b/cli/src/lib/localModels.ts@@ -88,6 +88,10 @@ interface Owned { file: string; selector: string; aliases: string[]; nodeId: strinterface Receipt { spec: 1; grid: string; operation?: ModelOperation }interface Options {stateDir: string; processEnv?: NodeJS.ProcessEnv+ /** This machine's name as Harness shows it. Grid labels an engine with its `--name`, and without+ * one it takes the host name — so a model started here read `mac.lan` under "On your machines"+ * while Machines called the same computer `M2`. */+ machineName?: () => string | null | undefinedrun?: (args: string[], output?: (chunk: string) => void, timeout?: number) => Promise<GridFleetResult>request?: typeof fetch}@@ -570,10 +574,13 @@ export class LocalModels {// optimistic the same way. So the most the model is sized for is tried first, and each size// that cannot compute is taken back down and halved — to the 64K floor, never below it.const first = candidate.context ?? await this.trainedWindow(candidate.file) ?? UNREAD_CONTEXT+ const named = this.options.machineName?.()?.trim()+ const machineName = named && validArg(named) ? named : undefinedlet started = false, outOfMemory = falsefor (const ctx of contextLadder(first)) {const port = await freePort()const joined = await this.run(['--remote', 'join', grid, '--serve', candidate.file,+ ...(machineName ? ['--name', machineName] : []),'--max-concurrency', '1', '--ctx-size', String(ctx), '--endpoint-port', String(port),'--reasoning-budget', '0',...(candidate.aliases ?? []).flatMap(alias => ['--advertise-as', alias])], undefined, 30 * 60_000)diff --git a/store/agents/autonomous-grid/lib/fleet.mjs b/store/agents/autonomous-grid/lib/fleet.mjsindex a3ce29152..f0a2dd50f 100644--- a/store/agents/autonomous-grid/lib/fleet.mjs+++ b/store/agents/autonomous-grid/lib/fleet.mjs@@ -32,6 +32,39 @@ export async function atomicJson(file, value) {} finally { await unlink(temporary).catch(() => {}); }}+/**+ * The name a machine goes by in Harness Machines, read live from `harness machines --json` rows+ * ([rows], as `discoverMachines` returns them), or null when Harness has none for it (an SSH target,+ * or discovery failed). Live because the person renames machines: a name recorded at setup went stale+ * the moment they did.+ */+export function harnessNameFor(machine, rows) {+ if (!machine || !Array.isArray(rows)) return null;+ const row = machine.transport === 'local' ? rows.find(r => r.current)+ : machine.transport === 'harness' ? rows.find(r => r.machineId === machine.machineId) : null;+ const name = typeof row?.name === 'string' ? row.name.trim() : '';+ return name && !name.startsWith('-') && !/[\x00-\x1f]/.test(name) ? name : null;+}++/**+ * [args] for `grid join` with `--name` set to [name], replacing any name the caller gave.+ *+ * ⚠️ Grid labels every engine with `--name`, and that label is what a person reads under the model in+ * every picker. Left to the agent it was invented (`macbookpro-qwen3.6-35b`) or left off (Grid then+ * takes the host name, `mac.lan`) — either way not the name Machines shows for the same computer. So+ * the runner sets it. Anything that is not a join, or no name to set, passes through untouched.+ */+export function nameJoin(args, name) {+ if (!name || args[0] !== 'join') return args;+ const out = [];+ for (let i = 0; i < args.length; i++) {+ if (args[i] === '--name') { i++; continue; }+ if (args[i].startsWith('--name=')) continue;+ out.push(args[i]);+ }+ return [...out, '--name', name];+}+export function validateConfig(raw) {if (!raw || raw.spec !== 1 || !['local', 'remote'].includes(raw.mode)) throw new Error('grid-fleet.json needs spec: 1 and mode: local or remote.');if (raw.grid !== null && (typeof raw.grid !== 'string' || !raw.grid.trim() || raw.grid.length > 240 || raw.grid.startsWith('-') || /[\x00-\x1f]/.test(raw.grid))) throw new Error('grid must be a name, ID, URL, or null.');diff --git a/store/agents/autonomous-grid/skills/grid-operations/SKILL.md b/store/agents/autonomous-grid/skills/grid-operations/SKILL.mdindex a21c4102b..7a45c7e40 100644--- a/store/agents/autonomous-grid/skills/grid-operations/SKILL.md+++ b/store/agents/autonomous-grid/skills/grid-operations/SKILL.md@@ -172,15 +172,18 @@ on disk. When the person asks for text only, rename the projector yourself"$GRID_FLEET" run --machine MACHINE -- pull OWNER/REPO:EXACT_FILE.gguf"$GRID_FLEET" run --machine MACHINE -- join GRID --serve EXACT_FILE.gguf --advertise-as MODEL_ALIAS \- --name MACHINE-MODEL --max-concurrency N --ctx-size CTX --endpoint-port PORT+ --max-concurrency N --ctx-size CTX --endpoint-port PORT-`--advertise-as` is the name the person will see in their model picker; `--name` is the machine's-display name — different things. `--max-concurrency N` is 1 unless they asked for more; don't pass+`--advertise-as` is the name the person will see in their model picker. **Don't pass `--name`:**+the runner sets it on every `join` to the machine's name as Harness Machines shows it right now, and+replaces any you give — it is the label under the model in every picker, and a name made up here+(`macbookpro-qwen3.6-35b`) or Grid's host-name default (`mac.lan`) read as a different computer.+Say the machine by that same name. `--max-concurrency N` is 1 unless they asked for more; don't pass`--parallel` (grid derives the slot count from it) and don't pass `--jinja` (on by default in theengine grid ships). Never pin `--ctx-size` under 65536 — a window that small cannot hold a codingagent's own prompt (a 32K engine here refused an agent's first request of 59,561 tokens). Useexplicit ports when several instances share a host. An existing Ollama, vLLM, MLX or LM Studio-engine can join with `--at URL -m MODEL --name NAME`; do not install a second engine needlessly.+engine can join with `--at URL -m MODEL` (the runner names it too); do not install a second engine needlessly.Choose a reasoning budget deliberately. Grid's GPU default can spend more tokens thinking than asmall output limit permits, yielding no final answer. For an everyday low-latency assistant, startdiff --git a/store/agents/autonomous-grid/test/fleet.test.mjs b/store/agents/autonomous-grid/test/fleet.test.mjsindex 7c5cc38fb..4156d3559 100644--- a/store/agents/autonomous-grid/test/fleet.test.mjs+++ b/store/agents/autonomous-grid/test/fleet.test.mjs@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';import { tmpdir } from 'node:os';import { join } from 'node:path';-import { atomicJson, cliDetail, DEFAULT_CONFIG, execute, gridJson, gridSelect, invocation, operations, runTracked, validateConfig } from '../lib/fleet.mjs';+import { atomicJson, cliDetail, DEFAULT_CONFIG, execute, gridJson, gridSelect, harnessNameFor, invocation, nameJoin, operations, runTracked, validateConfig } from '../lib/fleet.mjs';const temporary = async t => { const dir=await mkdtemp(join(tmpdir(),'grid-harness-test-'));t.after(()=>rm(dir,{recursive:true,force:true}));return dir; };test('inventory accepts explicit targets and refuses duplicates, SSH options and malformed paths',()=>{@@ -87,3 +87,24 @@ test('gridSelect runs the write form of use as a plain command and confirms it bconst failed=await gridSelect(machine,'remote','x',{},{run:async()=>({ok:false,code:2,stdout:'',stderr:'no such grid'}),readJson:async()=>{throw new Error('must not read');}});assert.equal(failed.ok,false);assert.match(failed.error,/grid use failed \(2\)/);});+test('a join is labelled with the machine name Harness shows, whatever the agent passed',()=>{+ // REGRESSION: the agent joined as `macbookpro-qwen3.6-35b` on a Mac Machines calls `macbok test local`.+ assert.deepEqual(nameJoin(['join','g','--serve','m.gguf','--name','macbookpro-qwen3.6-35b','--max-concurrency','1'],'macbok test local'),+ ['join','g','--serve','m.gguf','--max-concurrency','1','--name','macbok test local']);+ assert.deepEqual(nameJoin(['join','g','--name=invented','--serve','m.gguf'],'M2'),['join','g','--serve','m.gguf','--name','M2']);+ // Left off, Grid takes the host name (`mac.lan`): the runner fills it in.+ assert.deepEqual(nameJoin(['join','g','--serve','m.gguf'],'M2'),['join','g','--serve','m.gguf','--name','M2']);+ // Not a join, or no name to give: untouched.+ assert.deepEqual(nameJoin(['leave','g','--engine','x','--name','y'],'M2'),['leave','g','--engine','x','--name','y']);+ assert.deepEqual(nameJoin(['join','g','--name','kept'],null),['join','g','--name','kept']);+});+test('the name is read live for the machine the command targets',()=>{+ const rows=[{machineId:'here',name:'macbok test local',current:true},{machineId:'studio',name:' Studio ',current:false}];+ assert.equal(harnessNameFor({id:'local',transport:'local'},rows),'macbok test local');+ assert.equal(harnessNameFor({id:'s',transport:'harness',machineId:'studio'},rows),'Studio');+ // SSH targets have no Harness name, and discovery that failed says nothing.+ assert.equal(harnessNameFor({id:'gpu',transport:'ssh',host:'gpu'},rows),null);+ assert.equal(harnessNameFor({id:'local',transport:'local'},[]),null);+ // A name that would read as a flag or break an argument is not passed.+ for(const name of ['--all','a\nb',' '])assert.equal(harnessNameFor({id:'local',transport:'local'},[{current:true,name}]),null);+});diff --git a/store/agents/autonomous-grid/toolchain/fleet.mjs b/store/agents/autonomous-grid/toolchain/fleet.mjsindex e5c6e1b01..2d3a34af9 100644--- a/store/agents/autonomous-grid/toolchain/fleet.mjs+++ b/store/agents/autonomous-grid/toolchain/fleet.mjs@@ -1,7 +1,7 @@#!/usr/bin/env nodeimport { verifyModel } from '../lib/verify.mjs';import { join, resolve } from 'node:path';-import { atomicJson, DEFAULT_CONFIG, execute, readConfig, runTracked } from '../lib/fleet.mjs';+import { atomicJson, DEFAULT_CONFIG, execute, harnessNameFor, nameJoin, readConfig, runTracked } from '../lib/fleet.mjs';import { createCollector } from '../lib/telemetry.mjs';import { discoverMachines } from '../lib/harness.mjs';import { connectWorkspace, initializeWorkspace, mergeMachines, readStatus } from '../lib/connect.mjs';@@ -77,7 +77,9 @@ try {if (!machine) throw new Error(`Unknown machine ${machineId}. Add it to grid-fleet.json first.`);const abort = new AbortController();process.once('SIGINT', () => abort.abort()); process.once('SIGTERM', () => abort.abort());- const result = await runTracked(workspace, machine, config.mode, gridArgs, { signal: abort.signal, thinking });+ // A join is labelled with the machine's name as Harness Machines shows it, read now — see nameJoin.+ const named = gridArgs[0] === 'join' ? nameJoin(gridArgs, harnessNameFor(machine, await discoverMachines().catch(() => []))) : gridArgs;+ const result = await runTracked(workspace, machine, config.mode, named, { signal: abort.signal, thinking });if (!result.ok && result.error) console.error(result.error);process.exitCode = result.code;} else {