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
Swarm: one agent slot per 2 GiB free, the memory each start needs (#1502)
0xken15befebc64d5a1
diff --git a/cli/src/superTabs/contribution.spec.ts b/cli/src/superTabs/contribution.spec.tsindex 7fc4f3291..be3303397 100644--- a/cli/src/superTabs/contribution.spec.ts+++ b/cli/src/superTabs/contribution.spec.ts@@ -42,11 +42,22 @@ describe('one-field machine preparation', () => {})it('uses the lead project on its host and probes all engines without inventing authentication', async () => {const f = fixture()- expect(await f.run()).toEqual({ ok: true, state: 'ready', cwd: '/repo', engines: ['claude', 'pi'], maxAgents: 4 })+ expect(await f.run()).toEqual({ ok: true, state: 'ready', cwd: '/repo', engines: ['claude', 'pi'], maxAgents: 8 })expect(f.request).toHaveBeenCalledWith('engines_probe', { accounts: true }, 20000)expect(f.deps.prepare).not.toHaveBeenCalled()expect(f.close).toHaveBeenCalledOnce()})+ it('offers one slot per 2 GiB free, the memory each start needs, between one and eight', async () => {+ const f = fixture()+ const slots = async (freeBytes: number) => {+ f.deps.capacity.mockResolvedValueOnce({ ok: true, resources: { memoryTotalBytes: 32 * GiB, memoryUsedBytes: 32 * GiB - freeBytes, projectDiskFreeBytes: 100 * GiB } })+ return (await f.run() as { maxAgents?: number }).maxAgents+ }+ // Diego's Mac on 2026-10-21: 32 GiB, about 5.3 GiB free.+ expect(await slots(5.3 * GiB)).toBe(2)+ expect(await slots(GiB)).toBe(1)+ expect(await slots(30 * GiB)).toBe(8)+ })it('prepares the repository on another machine and reuses an existing contribution', async () => {const f = fixture(); (f.state.project as Record<string, unknown>).machineId = 'another'expect(await f.run()).toMatchObject({ cwd: '/clone' })diff --git a/cli/src/superTabs/contribution.ts b/cli/src/superTabs/contribution.tsindex ddf358cc9..50ec514e2 100644--- a/cli/src/superTabs/contribution.ts+++ b/cli/src/superTabs/contribution.ts@@ -1,13 +1,12 @@import type { CoreApi } from '../core/api.js'import { openDaemon } from '../agentClient/daemon.js'import { parseProjectFolder, prepareProjectFolder } from '../lib/projectFolder.js'-import { readCapabilities } from './capacity.js'+import { readCapabilities, START_REQUIREMENTS } from './capacity.js'import { backend, identifier, object } from './host.js'import { mkdir } from 'node:fs/promises'import { join } from 'node:path'type Json = Record<string, unknown>-const GiB = 1024 ** 3/** Owner-only setup. Reuses the regular checkout preparation and engine probe;* it neither launches an agent nor grants the team access to the computer. */@@ -45,9 +44,9 @@ export async function prepareContribution(core: CoreApi, input: Json, deps = {if (capability.ok !== true || typeof resources.projectDiskFreeBytes !== 'number') throw new Error('The project folder is unavailable on this machine.')const available = typeof resources.memoryTotalBytes === 'number' && typeof resources.memoryUsedBytes === 'number'? Math.max(0, resources.memoryTotalBytes - resources.memoryUsedBytes) : 0- // A conservative ceiling; each actual start still reserves measured memory- // and disk and rechecks the engine's current subscription allowance.- const maxAgents = Math.max(1, Math.min(8, Math.floor(available / (4 * GiB))))+ // A ceiling, not a promise: each actual start still needs 2 GiB free at that moment (START_REQUIREMENTS), so it+ // matches that. At 4 GiB a 32 GiB Mac with 5 GiB free offered one slot while it could run two.+ const maxAgents = Math.max(1, Math.min(8, Math.floor(available / START_REQUIREMENTS.memoryBytes)))return { ok: true, state: 'ready', cwd, engines: [...new Set(engines)], maxAgents, ...(swarm ? { scope: 'swarm' } : {}) }} finally { connection.close() }}