Skip to content

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.

Agent-started harnesses say so in the pull requests they open (#1194)

Dee80523d21ed74
diff --git a/cli/e2e/agentClient.e2e.ts b/cli/e2e/agentClient.e2e.ts
index 4486fd0ea..0afa2b3db 100644
--- a/cli/e2e/agentClient.e2e.ts
+++ b/cli/e2e/agentClient.e2e.ts
@@ -2,11 +2,12 @@
* Harness for agents on the real daemon (docs/design/2026-10-11-agent-client.md): an agent, from its own pane, runs
* the `harness` verbs as it would through its shell tool. It lists the harnesses, starts one with a task, waits for
* it, reads its answer, messages it without any tab having Agent Messages on, and closes it; it may not close one it
- * did not start. The fake engines answer by echoing (harness/fakeEngine.mjs).
+ * did not start. The fake engines answer by echoing (harness/fakeEngine.mjs). A harness it starts says so in the pull
+ * requests it opens: in the arguments its engine is launched with, each launch, until the person turns it off.
*
* Signed in to the fake backend, which answers the account's tabs: none has Agent Messages on.
*/
-import { spawn } from 'node:child_process'
+import { execFileSync, spawn } from 'node:child_process'
import { createInterface } from 'node:readline'
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join } from 'node:path'
@@ -15,6 +16,8 @@ import { LocalClient } from './harness/client.js'
import { CLI_ROOT, IsolatedDaemon, until } from './harness/daemon.js'
import { FakeBackend, type FakeMachine } from './harness/fakeBackend.js'
+/** The line (lib/agentAttribution.ts), as a reader of the pull request sees it. */
+const AGENT_ATTRIBUTION_LINE = '🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.'
const ME: FakeMachine = { machineId: 'b8'.repeat(16), computerId: 'e2e-computer-0000-0000-0000000000b8', name: 'studio', token: 'e2e-token-agent-client' }
const signIn = (d: IsolatedDaemon) => writeFileSync(join(d.root, 'auth', 'session.json'), JSON.stringify({
version: 1, accessToken: ME.token, autonomousEnv: 'prod', computerId: ME.computerId,
@@ -274,6 +277,81 @@ describe('Harness for agents, end to end', () => {
expect(JSON.parse(listed.out).harnesses).toEqual([])
// The setting is the daemon's, as the window reads it.
const read = await fetch(`http://127.0.0.1:${d.port}/api/agent-settings`)
- expect(await read.json()).toEqual({ agentsStartAgents: false })
+ expect(await read.json()).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ })
+ it('a harness an agent starts says so in the pull requests it opens, on every launch, until the person turns it off', async () => {
+ const relay = await FakeBackend.start()
+ backend = relay
+ relay.addMachine(ME)
+ relay.agentMessages = { revision: 1, machines: [{ machineId: ME.machineId, name: 'studio' }], tabs: [] }
+ const d = await IsolatedDaemon.create({ env: {
+ BACKEND_WS_URL: relay.wsUrl, WEB_URL: relay.httpUrl, ADAPTER_COMPUTER_ID: ME.computerId,
+ HARNESSD_SERVICE_INITIAL_BACKOFF_MS: '200', HARNESSD_SERVICE_MAX_BACKOFF_MS: '1000',
+ } })
+ daemon = d
+ onTestFailed(() => { console.log(`---- daemon log\n${d.log().split('\n').slice(-150).join('\n')}`) })
+ signIn(d)
+ await d.start()
+ const client = await LocalClient.connect(d, { machineId: ME.machineId })
+ const live = (name: string) => until(`${name} to be up`, async () => {
+ const row = ((await client.request<{ agents: Array<Record<string, any>> }>('agents_list', {}, 30_000)).agents).find((a) => a.name === name)
+ return row?.sessionId && row.status === 'active' ? row : null
+ }, 60_000, 500)
+ const folder = (name: string) => { const dir = join(d.projectsDir, name); mkdirSync(dir, { recursive: true }); return dir }
+
+ // The person's own harness: no line.
+ const made = await client.request('agent_create', { engine: 'claude', cwd: folder('lead'), bypassPermission: true, name: 'lead' }, 90_000)
+ expect(made.error, JSON.stringify(made)).toBeUndefined()
+ const lead = await live('lead')
+ expect(await commandsIn(d, String(lead.tmuxPane))).not.toContain('--settings')
+ const run = (...args: string[]) => harness(d, String(lead.tmuxPane), args)
+
+ // Claude Code, started by it: Claude Code's own pull request line kept, and Harness's after it.
+ expect((await run('new', 'claude', folder('kid'), '--name', 'kid', '--', 'hello kid')).code).toBe(0)
+ const kid = await live('kid')
+ // `ps` may print the emoji and the dash as it likes; the rest is as the engine was given it.
+ expect(await commandsIn(d, String(kid.tmuxPane))).toMatch(new RegExp(`--settings \\{"attribution":\\{"pr":"${ascii('🤖 Generated with [Claude Code](https://claude.com/claude-code)')}\\\\n${ascii(AGENT_ATTRIBUTION_LINE)}"\\}\\}`))
+
+ // Codex, started by it: told as Codex is told its own attribution.
+ expect((await run('new', 'codex', folder('kidx'), '--name', 'kidx', '--', 'hello kidx')).code).toBe(0)
+ const kidx = await live('kidx')
+ expect(await commandsIn(d, String(kidx.tmuxPane))).toMatch(new RegExp(`-c developer_instructions="When you create or update a pull request, .*\`${ascii(AGENT_ATTRIBUTION_LINE)}\``))
+
+ // A restart launches it again from its row: the line comes back with it.
+ const restarted = await client.request('agent_restart', { agentId: kid.id }, 90_000)
+ expect(restarted.error, JSON.stringify(restarted)).toBeUndefined()
+ await until('kid to come back with its line', async () => {
+ const row = await live('kid')
+ return row.tmuxPane && (await commandsIn(d, String(row.tmuxPane))).includes('"attribution"') ? row : null
+ }, 60_000, 500)
+
+ // Turned off by the person: the next one an agent starts has no line.
+ const off = await harness(d, '', ['settings', 'pull-request-line', 'off'])
+ expect(off.code, off.err).toBe(0)
+ expect(off.out.trim()).toBe('pull-request-line is off.')
+ expect((await run('new', 'claude', folder('quiet'), '--name', 'quiet', '--', 'hello quiet')).code).toBe(0)
+ const quiet = await live('quiet')
+ const command = await commandsIn(d, String(quiet.tmuxPane))
+ expect(command).toContain('hello quiet')
+ expect(command).not.toContain('--settings')
+ client.close()
})
})
+
+/** [text] as a pattern that matches it whatever `ps` prints for a character outside ASCII. */
+const ascii = (text: string): string => [...text].map((ch) => /[ -~]/.test(ch) ? ch.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') : '.+?').join('')
+
+/** The command lines of the processes in [pane], as `ps` prints them: the engine's carries the arguments it was launched
+ * with (the fake engines' process title is their engine's name, then their arguments, as a CLI's is). */
+async function commandsIn(d: IsolatedDaemon, pane: string): Promise<string> {
+ const panes = (await d.tmux.run('list-panes', '-a', '-F', '#{pane_id} #{pane_pid}')).split('\n').map((line) => line.split(' '))
+ const root = Number(panes.find(([id]) => id === pane)?.[1])
+ const table = execFileSync('ps', ['-A', '-o', 'pid=,ppid=,command='], { encoding: 'utf8' }).split('\n')
+ .map((line) => line.trim().match(/^(\d+)\s+(\d+)\s+(.*)$/)).filter((match): match is RegExpMatchArray => !!match)
+ const tree = new Set([root])
+ for (let grew = true; grew;) {
+ grew = false
+ for (const [, pid, ppid] of table) if (tree.has(Number(ppid)) && !tree.has(Number(pid))) { tree.add(Number(pid)); grew = true }
+ }
+ return table.filter(([, pid]) => tree.has(Number(pid))).map(([, , , command]) => command).join('\n')
+}
diff --git a/cli/e2e/harness/fakeEngine.mjs b/cli/e2e/harness/fakeEngine.mjs
index e6ab0b43e..2fa78b960 100644
--- a/cli/e2e/harness/fakeEngine.mjs
+++ b/cli/e2e/harness/fakeEngine.mjs
@@ -1735,9 +1735,10 @@ export async function run(engine, config = {}, { native = false } = {}) {
}
/** The options both CLIs read a value after, and Codex's `resume <id>` and `fork <id>`: the word after one is not a
- * prompt. */
+ * prompt. `--settings <file-or-json>` carries the pull request line of a harness another agent started
+ * (lib/agentAttribution.ts), last on a relaunch, where no first message follows it. */
const TAKES_VALUE = new Set(['--model', '-m', '--permission-mode', '--resume', '-r', '--session-id', '--append-system-prompt',
- '--mcp-config', '--effort', '-c', '--config', '-s', '--sandbox', '-a', '--ask-for-approval', 'resume', 'fork'])
+ '--mcp-config', '--effort', '--settings', '-c', '--config', '-s', '--sandbox', '-a', '--ask-for-approval', 'resume', 'fork'])
/** The prompt at the end of the command line, when there is one. */
function firstPromptOf(args) {
diff --git a/cli/src/agentClient/settings.spec.ts b/cli/src/agentClient/settings.spec.ts
index c1751cebd..3a06bead4 100644
--- a/cli/src/agentClient/settings.spec.ts
+++ b/cli/src/agentClient/settings.spec.ts
@@ -14,7 +14,10 @@ describe('harness settings', () => {
const out: string[] = [], err: string[] = []
const run = (...argv: string[]) => settingsCommand(argv, dir, (l) => out.push(l), (l) => err.push(l))
expect(run()).toBe(0)
- expect(out.pop()).toBe('agents-start-agents on agents may start, wait for and close harnesses of their own')
+ expect(out.pop()).toBe([
+ 'agents-start-agents on agents may start, wait for and close harnesses of their own',
+ 'pull-request-line on a harness another agent starts says so in the pull requests it opens',
+ ].join('\n'))
expect(run('agents-start-agents', 'off')).toBe(0)
expect(out.pop()).toBe('agents-start-agents is off.')
expect(readAgentSettings(dir).agentsStartAgents).toBe(false)
@@ -22,6 +25,9 @@ describe('harness settings', () => {
expect(out.pop()).toMatch(/^agents-start-agents +off /)
expect(run('agents-start-agents', 'on')).toBe(0)
expect(readAgentSettings(dir).agentsStartAgents).toBe(true)
+ expect(run('pull-request-line', 'off')).toBe(0)
+ expect(out.pop()).toBe('pull-request-line is off.')
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true, pullRequestLine: false })
})
it('refuses what it does not know with the usage, and prints it for --help', () => {
diff --git a/cli/src/agentClient/settings.ts b/cli/src/agentClient/settings.ts
index be6656afd..6b4f09507 100644
--- a/cli/src/agentClient/settings.ts
+++ b/cli/src/agentClient/settings.ts
@@ -10,10 +10,13 @@ import { AGENT_SETTING_NAMES, readAgentSettings, writeAgentSettings, type AgentS
export const SETTINGS_USAGE = `Usage: harness settings [<name> on|off]
What agents may do on this computer, as Settings ▸ Agents shows it:
- agents-start-agents agents may start, wait for and close harnesses of their own, and are told how (on by default)`
+ agents-start-agents agents may start, wait for and close harnesses of their own, and are told how (on by default)
+ pull-request-line a harness another agent starts says so in the pull requests it opens: one line beside the
+ engine's own (on by default)`
const ABOUT: Record<keyof AgentSettings, string> = {
agentsStartAgents: 'agents may start, wait for and close harnesses of their own',
+ pullRequestLine: 'a harness another agent starts says so in the pull requests it opens',
}
export function settingsCommand(argv: readonly string[], dataDir: string, out: (line: string) => void = console.log, err: (line: string) => void = console.error): number {
diff --git a/cli/src/architecture.spec.ts b/cli/src/architecture.spec.ts
index 93151d127..c50d50c42 100644
--- a/cli/src/architecture.spec.ts
+++ b/cli/src/architecture.spec.ts
@@ -408,7 +408,7 @@ describe('the daemon\'s shape', () => {
// are read with the session stores' declarations (lib/engineHomes.ts), data as well.
for (const entry of ['lib/engineLaunch.ts', 'lib/launchOverrides.ts', 'engines/launches.ts', 'engines/kit/launchArgs.ts',
'engines/kit/launchStartup.ts', 'dsh/adapters.ts', 'engines/launchPrep.ts', 'engines/kit/folderTrust.ts',
- 'engines/kit/resumeRepair.ts', 'dsh/runtime.ts', 'lib/apiInstructions.ts']) {
+ 'engines/kit/resumeRepair.ts', 'dsh/runtime.ts', 'lib/apiInstructions.ts', 'engines/kit/attribution.ts', 'lib/agentAttribution.ts']) {
expect([...closureOf(entry).keys()].filter(file => /^engines\/(claude|codex)\//.test(file) && !contracts.has(file)
&& !SESSION_STORES.has(file) && file !== 'engines/codex/hookContract.ts'), entry).toEqual([])
}
diff --git a/cli/src/backendSocket.ts b/cli/src/backendSocket.ts
index 3c5cfead3..ff99caeb0 100644
--- a/cli/src/backendSocket.ts
+++ b/cli/src/backendSocket.ts
@@ -29,6 +29,7 @@ import { gridCliPresence } from './lib/gridBinary.js'
import { GRID_FLEET_PROTOCOL, GRID_FLEET_MAX_TIMEOUT_MS } from './lib/gridFleetProtocol.js'
import { isApiLaunch, parseGridLaunchOverride, type GridLaunchOverride } from './lib/gridLaunchWire.js'
import type { ScmLaunchRecord } from './scm/types.js'
+import type { StartedBy } from './lib/agentAttribution.js'
import { probeEngines } from './lib/engineProbe.js'
import { engineInstallRecipe } from './lib/engineInstall.js'
import { agentFrame, type AgentDshContext, type AgentFrame } from './lib/agentFrame.js'
@@ -164,6 +165,9 @@ export class BackendSocket {
/** What the SCM that prepared `cwd` needs on every relaunch (registry `scmLaunch`). Present only
* when this create prepared a folder, and null when no SCM made it (a new folder, a clone). */
scmLaunchRecord?: ScmLaunchRecord | null
+ /** `agent` when another agent started it (`harness new` from its pane); absent for the person. Kept on the
+ * row: every launch of it adds a line to the pull requests it opens (lib/agentAttribution.ts). */
+ startedBy?: StartedBy | null
}) =>
Promise<{ ok: true; session: RegisteredSession } | { ok: false; error: string; detail?: string }>) | null = null
/** Called on `remote_terminal_handoff` — cli.ts names the agent whose tile is that tmux pane, or null. */
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 6d7265e2a..4890ce12d 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -144,7 +144,7 @@ Machine:
harness wait <name>[,<name>] wait until they stop working (--any, --timeout 30m); exit 3 = needs the person
harness close <name> [--now] save a harness's screen and stop it; an agent closes only what it started
harness mcp the agent verbs as an MCP server on stdin/stdout, for agents that use MCP
- harness settings [<name> on|off] what agents may do here (agents-start-agents), as Settings ▸ Agents
+ harness settings [<name> on|off] what agents may do here (agents-start-agents, pull-request-line), as Settings ▸ Agents
harness machines delete <id> remove ANOTHER machine (refuses this one; use \`harness logout\`)
harness remote from a Harness terminal tile: open a terminal on another of your machines and move this tile to it
harness version print the installed version (v${VERSION})
diff --git a/cli/src/core/agents/create.spec.ts b/cli/src/core/agents/create.spec.ts
index bd86e933a..c16c3487a 100644
--- a/cli/src/core/agents/create.spec.ts
+++ b/cli/src/core/agents/create.spec.ts
@@ -26,6 +26,7 @@ import { installOpencodePlugin } from '../../engines/nativeHooks.js'
import type { NativeLaunch } from '../../engines/nativeLaunch.js'
import { projectsRoot } from '../../lib/projectFolder.js'
import { NativeFiles } from '../../engines/kit/nativeFiles.js'
+import { startedByAgentArgs } from '../../lib/agentAttribution.js'
vi.mock('../../lib/projectFolder.js', async real => {
const actual = await real<typeof import('../../lib/projectFolder.js')>()
@@ -72,6 +73,10 @@ vi.mock('../../engines/launchPrep.js', () => ({ folderTrust: (engine: string, pr
? { trusts: (path: string) => trust.claudeTrusts(path), record: (path: string) => trust.preTrustClaudeProject(path) }
: engine === 'codex' ? { trusts: (path: string) => trust.codexTrusts(path, profile), record: (path: string) => trust.preTrustCodexProject(path, profile) } : null }))
vi.mock('../../lib/createAgentPane.js', () => ({ createAndRegisterPane: vi.fn() }))
+// The pull request line (lib/agentAttribution.ts) reads the person's engine settings: never this machine's here.
+vi.mock('../../lib/agentAttribution.js', () => ({
+ startedByAgentArgs: vi.fn((_engine: string, startedBy: string | null | undefined) => startedBy === 'agent' ? ['--settings', '{"attribution":{}}'] : []),
+}))
vi.mock('../../lib/engineBin.js', async (real) => ({ ...await real<object>(), enginePathOverride: vi.fn(() => null) }))
vi.mock('../../lib/engineInstall.js', async (real) => ({ ...await real<object>(), engineInstallRecipe: vi.fn(() => ({ install: 'recipe' })) }))
vi.mock('../../lib/engineLaunch.js', async (real) => ({
@@ -625,6 +630,19 @@ describe('creating an agent', () => {
expect(deps.watchNewPane).toHaveBeenCalledWith('claude', pending, expect.anything(), ['claude'], undefined, undefined)
})
+ it('started by another agent: its pull request line after every other argument, and who started it on the row', async () => {
+ const { create } = setup()
+ const cwd = folder()
+ await create(request({ cwd, agent: 'reviewer', startedBy: 'agent' }))
+ expect(vi.mocked(startedByAgentArgs)).toHaveBeenCalledWith('claude', 'agent', { cwd, profile: null, environment: undefined })
+ expect((vi.mocked(buildEngineLaunchArgv).mock.calls[0][1] as Record<string, unknown>).extraArgs).toEqual(['--agent', 'reviewer', '--settings', '{"attribution":{}}'])
+ expect(vi.mocked(createAndRegisterPane).mock.calls[0][0]).toMatchObject({ startedBy: 'agent' })
+ // The person's: no line, and nothing recorded.
+ await create(request())
+ expect((vi.mocked(buildEngineLaunchArgv).mock.calls[1][1] as Record<string, unknown>).extraArgs).toBeUndefined()
+ expect(vi.mocked(createAndRegisterPane).mock.calls[1][0]).toMatchObject({ startedBy: null })
+ })
+
diff --git a/cli/src/core/agents/create.ts b/cli/src/core/agents/create.ts
index a368862c8..dd7a816bc 100644
--- a/cli/src/core/agents/create.ts
+++ b/cli/src/core/agents/create.ts
@@ -29,6 +29,7 @@ import {
refusePermissionFlagIfUnsupported, supportsFirstPrompt, supportsNamedAgent, NamedAgentUnsupportedError,
} from '../../lib/engineLaunch.js'
import { setUpWithin } from '../../lib/setUpWithin.js'
+import { startedByAgentArgs } from '../../lib/agentAttribution.js'
import { writeGridConfigDir } from '../../lib/gridConfigDir.js'
import { describeGridLaunch, gridConflictingEnvToClear, type GridLaunchAnswer, type GridLaunchMachine, type GridLaunchRequest, type GridWebSearchStatus } from '../../lib/gridLaunchWire.js'
import { profileEnvironment } from '../../lib/engineHomes.js'
@@ -98,7 +99,7 @@ export function createAgentCreator({
if (input.resumeSessionId) return { ok: true, dispatch: () => externalResume(input) }
const stale = () => ({ ok: false as const, error: 'LAUNCH_AUTHORITY_CHANGED', unavailable: 'launch', detail: 'Waiting for the original launch request’s authority.' })
if (!authority.current()) return stale()
- let { engine, cwd, bypassPermission, permissionMode, grid, codexHome, dsh, prompt, name, agent, scmLaunchRecord } = input
+ let { engine, cwd, bypassPermission, permissionMode, grid, codexHome, dsh, prompt, name, agent, scmLaunchRecord, startedBy } = input
if (!tmuxBackend) return { ok: false, error: 'TMUX_UNAVAILABLE' }
if (blocksFolder(cwd)) return { ok: false, error: 'WORKTREE_BUSY' }
const workspaceIdentity = () => { const info = statSync(cwd); return `${info.dev}:${info.ino}:${realpathSync(cwd)}` }
@@ -318,7 +319,10 @@ export function createAgentCreator({
// The named agent takes the same argv slot on every relaunch (`buildLaunchOverrides` appends it
// from the row's `agent`, after the grid's and the DSH's argv, exactly as here). The engine was
// checked for a contract at the wire (AGENT_UNSUPPORTED, opencode v2 included), so this cannot throw.
- const extraArgs = [...(gridLaunch?.args ?? []), ...dshArgs, ...(agent ? namedAgentArgs(engine, agent, native ? native.opencodeMajor : opencode ? await opencode.opencodeMajorVersion() : null) : [])]
+ // A harness another agent started says so in the pull requests it opens (lib/agentAttribution.ts), last, as every
+ // relaunch appends it (`buildLaunchOverrides`), and read from the person's settings where this launch reads them.
+ const attribution = startedByAgentArgs(engine, startedBy, { cwd, profile: codexHome, environment: native?.environment })
+ const extraArgs = [...(gridLaunch?.args ?? []), ...dshArgs, ...(agent ? namedAgentArgs(engine, agent, native ? native.opencodeMajor : opencode ? await opencode.opencodeMajorVersion() : null) : []), ...attribution]
// The first prompt is a launch option only — never part of `extraArgs`, which the registry row
// carries into a relaunch (engineLaunch.ts, `firstPrompt`).
const firstPrompt = prompt
@@ -364,6 +368,7 @@ export function createAgentCreator({
permissionMode,
defaultName: name,
label: dshLabel,
+ startedBy: startedBy ?? null,
})
if (!result.ok) return { ok: false, error: result.error, detail: result.detail }
const { spawned, pending } = result
diff --git a/cli/src/core/agents/fork.spec.ts b/cli/src/core/agents/fork.spec.ts
index f1287720b..5acd3756b 100644
--- a/cli/src/core/agents/fork.spec.ts
+++ b/cli/src/core/agents/fork.spec.ts
@@ -268,10 +268,12 @@ describe('forking an agent', () => {
ok: true as const,
overrides: { env: { CODEX_HOME: '/codex', MODEL_ENV: 'x' }, extraArgs: ['-c', 'model_provider="openai"', '-m', 'gpt-6'], clearEnv: ['HARNESS_DSH'] },
}))
- const row = source({ engine: 'codex', codexHome: '/codex', subscriptionModel: 'gpt-6', dsh: 'blender', agent: 'reviewer' } as Partial<RegisteredSession>)
+ const row = source({ engine: 'codex', codexHome: '/codex', subscriptionModel: 'gpt-6', dsh: 'blender', agent: 'reviewer', startedBy: 'agent' } as Partial<RegisteredSession>)
await setup(row, { relaunchOverrides }).fork({ agentId: 'a1', name: null, prompt: null })
- // The harness's runtime is the fork's own and so is its named agent: neither is rebuilt from the row.
- expect(relaunchOverrides).toHaveBeenCalledWith(row, expect.objectContaining({ codexHome: '/codex', subscriptionModel: 'gpt-6', dsh: null, agent: null }), expect.any(Function), undefined, expect.stringContaining('harness-codex-'))
+ // The harness's runtime is the fork's own and so is its named agent: neither is rebuilt from the row. The fork
+ // is the forker's, not the agent's that started its source: it carries no pull request line for that.
+ expect(relaunchOverrides).toHaveBeenCalledWith(row, expect.objectContaining({ codexHome: '/codex', subscriptionModel: 'gpt-6', dsh: null, agent: null, startedBy: null }), expect.any(Function), undefined, expect.stringContaining('harness-codex-'))
+ expect(vi.mocked(createAndRegisterPane).mock.calls[0][0]).not.toHaveProperty('startedBy')
expect(vi.mocked(buildEngineLaunchArgv).mock.calls[0][1]).toMatchObject({
extraArgs: ['-c', 'model_provider="openai"', '-m', 'gpt-6', '--dsh', '--agent', 'reviewer'],
// What the harness's launch provides is never cleared under it.
diff --git a/cli/src/core/agents/fork.ts b/cli/src/core/agents/fork.ts
index 93a34f573..7c7f1f47a 100644
--- a/cli/src/core/agents/fork.ts
+++ b/cli/src/core/agents/fork.ts
@@ -120,8 +120,9 @@ export function createAgentForker({
// engines/codex/launch.ts) and the model it had before the grid (`-m`), and a profile gets
// its hooks. A fork was launched without any of them, and came back on Codex's default model where a
// restart of its source came back on the source's own (e2e/forks.e2e.ts). The harness and the named
- // agent are the fork's own (a new runtime, above and below), so they are not rebuilt here.
- const built = await relaunchOverrides(source, { ...source, dsh: null, agent: null }, owner, native, label)
+ // agent are the fork's own (a new runtime, above and below), so they are not rebuilt here. A fork is started by
+ // whoever forks it, not by the agent that started its source: its pull requests carry no line for that.
+ const built = await relaunchOverrides(source, { ...source, dsh: null, agent: null, startedBy: null }, owner, native, label)
if (!current()) return changed
if (!built.ok) return built
if (built.overrides.native && prepareNative && !await prepareNative(built.overrides.native, owner,
diff --git a/cli/src/core/agents/launch.spec.ts b/cli/src/core/agents/launch.spec.ts
index 29cd50361..851ff1935 100644
--- a/cli/src/core/agents/launch.spec.ts
+++ b/cli/src/core/agents/launch.spec.ts
@@ -110,7 +110,15 @@ describe('relaunch helpers', () => {
}), 'a1', expect.any(Function), undefined)
const grid = { networkId: 'grid-1', networkName: 'Home grid' }
await helpers.relaunchOverrides(session({ dsh: undefined, dshRuntime: undefined, agent: undefined } as Partial<RegisteredSession>), { gridLaunch: grid } as never)
- expect(buildLaunchOverrides).toHaveBeenLastCalledWith(deps.launchOverridesDeps, 'claude', expect.objectContaining({ dsh: null, agent: null, gridLaunch: grid }), 'a1', expect.any(Function), undefined)
+ expect(buildLaunchOverrides).toHaveBeenLastCalledWith(deps.launchOverridesDeps, 'claude', expect.objectContaining({ dsh: null, agent: null, startedBy: null, gridLaunch: grid }), 'a1', expect.any(Function), undefined)
+ })
+
+ it('keeps who started it from the row, so a harness another agent started keeps its pull request line', async () => {
+ const { deps, helpers } = setup()
+ const grid = { networkId: 'grid-1', networkName: 'Home grid' }
+ // A retarget's source is the new grid alone: who started the harness is still the row's.
+ await helpers.relaunchOverrides(session({ startedBy: 'agent' }), { gridLaunch: grid } as never)
+ expect(buildLaunchOverrides).toHaveBeenLastCalledWith(deps.launchOverridesDeps, 'claude', expect.objectContaining({ startedBy: 'agent', gridLaunch: grid }), 'a1', expect.any(Function), undefined)
})
it('records the web-search decision a relaunch made, when it made one', () => {
diff --git a/cli/src/core/agents/launch.ts b/cli/src/core/agents/launch.ts
index 6d800fc87..c275adfc8 100644
--- a/cli/src/core/agents/launch.ts
+++ b/cli/src/core/agents/launch.ts
@@ -43,8 +43,8 @@ export interface LaunchHelperDeps {
export function createLaunchHelpers({ authority, prepareApiTools, launchOverridesDeps, setGridLaunch, setTail }: LaunchHelperDeps) {
// Whatever the source (the row itself, or a grid override the desktop just sent), the agent's DSH,
- // workspace and named agent come from the row: a retarget must not silently drop the harness the
- // agent is, or bring a pane opened as `harness-compute` back as a general session.
+ // workspace, named agent and who started it come from the row: a retarget must not silently drop the harness
+ // the agent is, or bring a pane opened as `harness-compute` back as a general session.
// An agent on a saved API's model relaunches with that API's endpoint and key as saved now, so a key
// pasted since takes effect, and a removed API is refused rather than kept on its old key: the models
// service reads them as it builds the launch (`buildLaunchOverrides`, `refresh`).
@@ -54,7 +54,7 @@ export function createLaunchHelpers({ authority, prepareApiTools, launchOverride
session = structuredClone(session)
const changed = { ok: false, error: 'AGENT_CHANGED', detail: 'The harness changed or stopped during launch preparation.' } as const
if (!current()) return changed
- const result = await buildLaunchOverrides(launchOverridesDeps, session.engine, { dsh: session.dsh ?? null, dshRuntime: session.dshRuntime ?? null, cwd: session.cwd, agent: session.agent ?? null, scmLaunch: session.scmLaunch ?? null, ...source, gridLaunch: source.gridLaunch ?? null }, configKey, current, native)
+ const result = await buildLaunchOverrides(launchOverridesDeps, session.engine, { dsh: session.dsh ?? null, dshRuntime: session.dshRuntime ?? null, cwd: session.cwd, agent: session.agent ?? null, scmLaunch: session.scmLaunch ?? null, startedBy: session.startedBy ?? null, ...source, gridLaunch: source.gridLaunch ?? null }, configKey, current, native)
if (!current()) return changed
if (!result.ok && (result.unavailable || result.error === 'AGENT_CHANGED')) return result
// Saved-API instructions remain available after an ordinary semantic refusal, as before.
diff --git a/cli/src/core/agents/launches.spec.ts b/cli/src/core/agents/launches.spec.ts
index 1c2662eda..806c7ac3a 100644
--- a/cli/src/core/agents/launches.spec.ts
+++ b/cli/src/core/agents/launches.spec.ts
@@ -312,6 +312,14 @@ describe('agent_create, refused before any pane exists', () => {
expect(await ask({ engine: 'claude', cwd: '/w', resumeSessionId: 'ses_abc', takeOver: 'later' })).toStrictEqual(takeOver)
expect(create).not.toHaveBeenCalled()
})
+
+ it('a starter that is not another agent: absent is the person, anything else is refused', async () => {
+ const { ask, create } = setup()
+ const refused = { error: 'INVALID_STARTED_BY', detail: 'startedBy is agent, or absent for the person' }
+ expect(await ask({ engine: 'claude', cwd: '/w', startedBy: 'person' })).toStrictEqual(refused)
+ expect(await ask({ engine: 'claude', cwd: '/w', startedBy: true })).toStrictEqual(refused)
+ expect(create).not.toHaveBeenCalled()
+ })
})
describe('agent_create, launched', () => {
@@ -327,6 +335,15 @@ describe('agent_create, launched', () => {
expect(Object.keys(vi.mocked(create!).mock.calls[0][0])).toEqual(['engine', 'cwd', 'bypassPermission', 'permissionMode', 'grid', 'codexHome', 'dsh', 'prompt', 'name', 'agent', 'resumeSessionId', 'takeOver'])
})
+ it('hands on that another agent started it, and nothing for the person, so their receipts\' fingerprints stay as they were', async () => {
+ const { ask, create } = setup()
+ await ask({ engine: 'claude', cwd: '/w', startedBy: 'agent' })
+ await ask({ engine: 'claude', cwd: '/w', startedBy: null })
+ const [byAgent, byPerson] = vi.mocked(create!).mock.calls.map(([input]) => input)
+ expect(byAgent).toMatchObject({ engine: 'claude', cwd: '/w', startedBy: 'agent' })
+ expect(Object.keys(byPerson!)).not.toContain('startedBy')
+ })
+
it('opens a terminal in the home folder, bypasses permission unless told not to, and takes blank choices as none', async () => {
const { ask, create } = setup()
vi.mocked(parseGridLaunchOverride).mockReturnValueOnce({ state: 'absent' } as never).mockReturnValueOnce({ state: 'ok', override: { networkId: 'g' } } as never)
diff --git a/cli/src/core/agents/launches.ts b/cli/src/core/agents/launches.ts
index 7b4c88c96..112bb728e 100644
--- a/cli/src/core/agents/launches.ts
+++ b/cli/src/core/agents/launches.ts
@@ -336,6 +336,11 @@ export function createLaunchRequests({ receipts, createAgent, prepareCreate, for
}
takeOver = payload.takeOver
}
+ // Another agent started it (`harness new` from its pane, agentClient/commands.ts `agentOrigin`): its pull requests
+ // say so (lib/agentAttribution.ts). Refused, not ignored, when it is anything else: absent is the person.
+ if (payload.startedBy !== undefined && payload.startedBy !== null && payload.startedBy !== 'agent') {
+ reply({ error: 'INVALID_STARTED_BY', detail: 'startedBy is agent, or absent for the person' }); return
+ }
const input = {
engine,
cwd: typeof cwd === 'string' ? cwd : terminal ? homedir() : '',
@@ -350,6 +355,8 @@ export function createLaunchRequests({ receipts, createAgent, prepareCreate, for
agent,
resumeSessionId,
takeOver,
+ // Only when set: a person's create keeps the fingerprint its receipt was recorded with before the field.
+ ...(payload.startedBy === 'agent' ? { startedBy: 'agent' as const } : {}),
}
const fingerprintInput = model.state === 'ok' ? { ...input, modelSelection: model.selection } : input
if (creationId !== undefined) {
diff --git a/cli/src/engines/__fixtures__/launch-argv.golden.json b/cli/src/engines/__fixtures__/launch-argv.golden.json
index bc6146610..8958d3dcb 100644
--- a/cli/src/engines/__fixtures__/launch-argv.golden.json
+++ b/cli/src/engines/__fixtures__/launch-argv.golden.json
@@ -1140,7 +1140,18 @@
"codex · profile · moved home, trailing slash": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"/profiles/work"},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig /profiles/work/config.toml","installCodexHooks /profiles/work"]},
"codex · own login · the daemon home's file": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"from-file\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
"codex · profile · the profile's file": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"<root>/profile-home"},"extraArgs":["-c","model_provider=\"profile-file\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["installCodexHooks <root>/profile-home"]},
- "codex · profile without a file": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"<root>/no-such-profile"},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["installCodexHooks <root>/no-such-profile"]}
+ "codex · profile without a file": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"<root>/no-such-profile"},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["installCodexHooks <root>/no-such-profile"]},
+ "claude · started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
+ "claude · started by an agent, a harness on a grid as a named agent": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/grid-abc/relay","ANTHROPIC_AUTH_TOKEN":"gridkey-abc123","ANTHROPIC_MODEL":"gpt-5","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--system-prompt-snapshot","off","--append-system-prompt","This session has no web tools. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; tell the user the web cannot be searched or read from here instead.","--studio","--append-system-prompt","Read the harness context at \"/work/studio/.harness/runtime/agent-0001/CONTEXT.md\" before working.","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unavailable"}}},"calls":["dshLaunch acme/studio /work/studio claude agent-0001"]},
+ "codex · started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\"","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig <home>/.codex/config.toml"]},
+ "codex · started by an agent, a harness on a grid as a named agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/grid-abc/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-m","gpt-5","--studio","-c","shell_environment_policy.set.HARNESS_DSH=\"acme/studio\"","-c","shell_environment_policy.set.HARNESS_WORKSPACE=\"/work/studio\"","-c","shell_environment_policy.set.HARNESS_CONTEXT_FILE=\"/work/studio/.harness/runtime/agent-0001/CONTEXT.md\"","-c","shell_environment_policy.set.STUDIO_MODE=\"pro \\\"x\\\"\"","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unavailable"}}},"calls":["dshLaunch acme/studio /work/studio codex agent-0001"]},
+ "opencode · started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
+ "opencode · started by an agent, a harness on a grid as a named agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","OPENCODE_CONFIG":"/state/grid-engine-config/agent-0001/opencode.json","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["-m","team-grid/gpt-5","--studio","--agent","harness-compute"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unavailable"},"sessionModel":"team-grid/gpt-5"}},"calls":["dshLaunch acme/studio /work/studio opencode agent-0001","writeGridConfigDir agent-0001 opencode.json"]},
+ "claude · started by an agent, the folder's own pull request text": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["--settings","{\"attribution\":{\"pr\":\"Made in the app\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
+ "claude · started by an agent, attribution hidden": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
+ "codex · started by an agent, the person's own instructions": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\"","-c","developer_instructions=\"Be terse.\\n\\nWhen you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig <home>/.codex/config.toml"]},
+ "codex · profile, started by an agent, instructions it cannot keep exactly": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"/profiles/work"},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig /profiles/work/config.toml","installCodexHooks /profiles/work"]},
+ "claude · not started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]}
},
"adapters": {
"claude": {"instructionFiles":["CLAUDE.md"],"contextArgs":["--append-system-prompt","Read the harness context at \"/work/my \\\"studio\\\"/.harness/runtime/agent-1/CONTEXT.md\" before working."],"envArgs":null,"envArgsEmpty":null},
diff --git a/cli/src/engines/__fixtures__/launch-shapes.golden.json b/cli/src/engines/__fixtures__/launch-shapes.golden.json
index 44b83beca..1753f7ab1 100644
--- a/cli/src/engines/__fixtures__/launch-shapes.golden.json
+++ b/cli/src/engines/__fixtures__/launch-shapes.golden.json
@@ -38,7 +38,11 @@
"copilot · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w36","copilot"],"script":"cf114508370b186a","env":{"COPILOT_PROVIDER_BASE_URL":"http://127.0.0.1:<port>/v1","COPILOT_PROVIDER_API_KEY":"stale-key","COPILOT_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Router (api:router) · vendor/model-a · web search unavailable"]},
"claude · grid · an old tmux": {"result":{"ok":false,"error":"TMUX_TOO_OLD_FOR_GRID","detail":"this machine's tmux is older than 3.2, which is the first version that can give a new session its own environment — so claude could not have been pointed at grid Home. Upgrade tmux, or create this agent without a grid selected."},"pane":null,"config":null,"folder":{},"logged":["[agent] create claude refused · this machine's tmux is older than 3.2, which is the first version that can give a new session its own environment — so claude could not have been pointed at grid Home. Upgrade tmux, or create this agent without a grid selected."]},
"claude · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w38","claude"],"script":"d3f8b8a35d872741","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"51edaf2d9021f9c1","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+ "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"51edaf2d9021f9c1","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w40","claude","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"script":"d3f8b8a35d872741","env":{},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w41","codex","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"script":"51edaf2d9021f9c1","env":{},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w42","opencode"],"script":"7ff052bd4280633e","env":{"OPENCODE_CONFIG_CONTENT":"{\"permission\":\"ask\",\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"small_model\":\"opencode/muse-spark-1.3-contributor-free\",\"provider\":{\"opencode\":{\"models\":{\"muse-spark-1.3-contributor-free\":{\"options\":{\"reasoningEffort\":\"xhigh\"}}}}},\"agent\":{\"build\":{\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"variant\":\"xhigh\"},\"plan\":{\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"variant\":\"xhigh\"}}}"},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · grid · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w43","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead.","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"script":"0fd89f463aa4e0e9","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"startedBy":"agent"},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]}
},
"relaunch": {
"claude · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
@@ -101,7 +105,13 @@
"claude · restart on a removed API": {"result":{"ok":false,"error":"API_UNAVAILABLE","detail":"This API is not saved. Add it in Models → APIs."},"retargetLine":null,"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"codex · restart on an API with no Bearer key": {"result":{"ok":false,"error":"API_UNAVAILABLE","detail":"Keyed does not take a Bearer key, so coding agents cannot run on it."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"codex · restart on a grid · an old tmux": {"result":{"ok":false,"error":"TMUX_TOO_OLD_FOR_GRID","detail":"this machine's tmux is older than 3.2, which is the first version that can give a pane its own environment — so codex could not be pointed at grid Home."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "opencode · restart as a named agent on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+ "opencode · restart as a named agent on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · restart, started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · retarget onto a grid, started by an agent": {"result":{"ok":true,"overrides":{"env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"extraArgs":["--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead.","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"clearEnv":["ANTHROPIC_API_KEY","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] claude -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · fork of one an agent started": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · restart, started by an agent": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\"","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · retarget onto a grid, started by an agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · fork of one an agent started": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
},
"other": {
"validate · claude · grid": {"ok":true},
@@ -197,7 +207,11 @@
"copilot · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w35","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"1e83a0f95c1669fd","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
"copilot · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w36","copilot"],"script":"bdbea8aa1d3e4b33","env":{"COPILOT_PROVIDER_BASE_URL":"http://127.0.0.1:<port>/v1","COPILOT_PROVIDER_API_KEY":"stale-key","COPILOT_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Router (api:router) · vendor/model-a · web search unavailable"]},
"claude · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w38","claude"],"script":"6dc5fd2b979b6e45","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"1ff40fd30d1478c3","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]}
+ "codex · own login": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w39","codex"],"script":"1ff40fd30d1478c3","env":{},"grid":null,"gridLaunchRecord":null},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w40","claude","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"script":"6dc5fd2b979b6e45","env":{},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "codex · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w41","codex","-c","developer_instructions=\"When you create or update a pull request, its body must include this exact line once, near the end and after any other attribution line: `🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.` It says another agent started this session in Harness. Do not add it to commit messages.\""],"script":"1ff40fd30d1478c3","env":{},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "opencode · own login · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w42","opencode"],"script":"ba08f0832f2d5eeb","env":{"OPENCODE_CONFIG_CONTENT":"{\"permission\":\"ask\",\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"small_model\":\"opencode/muse-spark-1.3-contributor-free\",\"provider\":{\"opencode\":{\"models\":{\"muse-spark-1.3-contributor-free\":{\"options\":{\"reasoningEffort\":\"xhigh\"}}}}},\"agent\":{\"build\":{\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"variant\":\"xhigh\"},\"plan\":{\"model\":\"opencode/muse-spark-1.3-contributor-free\",\"variant\":\"xhigh\"}}}"},"grid":null,"gridLaunchRecord":null,"startedBy":"agent"},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "claude · grid · started by an agent": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w43","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead.","--settings","{\"attribution\":{\"pr\":\"🤖 Generated with [Claude Code](https://claude.com/claude-code)\\n🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.\"}}"],"script":"72fe6c9b6937e258","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"startedBy":"agent"},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]}
},
"relaunch": {
@@ -220,6 +234,7 @@
"607ab05ca64c3b45": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:30000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Codex' 20 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Codex is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Codex is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-codex.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-codex-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'codex'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Codex' 20 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Codex could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Codex was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
"6dc5fd2b979b6e45": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Claude Code is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Claude Code is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-claude.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-claude-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'claude'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Claude Code could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Claude Code was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"72fe6c9b6937e258": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Claude Code is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Claude Code is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-claude.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-claude-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'claude'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Claude Code could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Claude Code was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "7ff052bd4280633e": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: opencode exited ('\"$harness_status\"'). This pane is a shell now — run opencode again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'opencode' '<root>/home/.opencode/bin/opencode' '<root>/home/.local/bin/opencode'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'opencode'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: OpenCode is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'OpenCode is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-opencode.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-opencode-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'opencode'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://opencode.ai/install | bash' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nharness_try_fallback=0\nif [ -z \"$harness_engine_bin\" ] && [ \"$harness_status\" -ne 130 ]; then\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then\n harness_try_fallback=1\n harness_status=0\n [ \"$harness_quiet\" -eq 1 ] || printf '\\n%s\\n' 'harness: that install did not finish; trying the npm package instead' 'harness: $ npm install -g opencode-ai' ''\n [ \"$harness_quiet\" -eq 0 ] || printf '%s\\n' 'harness: that install did not finish; trying the npm package instead' >>\"$harness_install_log\"\n fi\nfi\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai') || harness_status=$?\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'OpenCode could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'OpenCode was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"80b2123b0f8552a1": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: hermes exited ('\"$harness_status\"'). This pane is a shell now — run hermes again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL GRID_MCP_AUTHORIZATION GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'hermes' '<root>/home/.local/bin/hermes' '/usr/local/bin/hermes'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n return 1\n}\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Hermes' 15 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Hermes is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Hermes is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-hermes.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-hermes-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'hermes'\nif ! harness_find_engine \"$1\"; then\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash' ''\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (eval 'curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Hermes' 15 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Hermes could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Hermes was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"8bb2d44e0c77d3b8": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: pi exited ('\"$harness_status\"'). This pane is a shell now — run pi again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'pi' '<root>/home/.local/bin/pi'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'pi'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Pi' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Pi is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Pi is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-pi.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-pi-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'pi'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g --ignore-scripts @earendil-works/pi-coding-agent' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Pi' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Pi could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Pi was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"8f855b51ab6b35e6": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: codex exited ('\"$harness_status\"'). This pane is a shell now — run codex again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nharness_codex_probe() {\n harness_codex_mode=0\n harness_codex_seen=$('<daemon-node>' -e 'const {execFileSync}=require('\"'\"'node:child_process'\"'\"');try { const h=execFileSync(process.argv[1],['\"'\"'--help'\"'\"'],{timeout:30000,maxBuffer:1048576,encoding:'\"'\"'utf8'\"'\"',stdio:['\"'\"'ignore'\"'\"','\"'\"'pipe'\"'\"','\"'\"'pipe'\"'\"']});process.exit(/--no-daemon(?:[^A-Za-z0-9-]|$)/.test(h)?0:64); } catch { process.exit(2); }' \"$1\") || harness_codex_mode=$?\n case \"$harness_codex_mode\" in\n 0) harness_codex_no_daemon=1 ;;\n 64) harness_codex_no_daemon= ;;\n *) printf '%s\\n' 'harness: could not verify Codex startup options. Please try opening this session again.' >&2; exit 1 ;;\n esac\n}\nharness_codex_check() {\n '<daemon-node>' -e 'const { execFileSync } = require('\"'\"'node:child_process'\"'\"');\nconst { createHash } = require('\"'\"'node:crypto'\"'\"');\nconst [mode, tmux, pane, baseline] = process.argv.slice(1);\ntry {\n if (!/^%\\d+$/.test(pane)) process.exit(1);\n const screen = execFileSync(tmux, ['\"'\"'capture-pane'\"'\"', '\"'\"'-p'\"'\"', '\"'\"'-J'\"'\"', '\"'\"'-S'\"'\"', '\"'\"'-10'\"'\"', '\"'\"'-t'\"'\"', pane], {\n timeout: 2000, maxBuffer: 1024 * 1024, encoding: '\"'\"'utf8'\"'\"', stdio: ['\"'\"'ignore'\"'\"', '\"'\"'pipe'\"'\"', '\"'\"'ignore'\"'\"'],\n });\n const last = screen.trimEnd().split('\"'\"'\\n'\"'\"').at(-1)?.trim() ?? '\"'\"''\"'\"';\n const hash = createHash('\"'\"'sha256'\"'\"').update(last).digest('\"'\"'hex'\"'\"');\n if (mode === '\"'\"'before'\"'\"') {\n process.stdout.write(JSON.stringify({ at: Date.now(), hash }));\n } else {\n const before = JSON.parse(baseline);\n const elapsed = Date.now() - before.at;\n const error = '\"'\"'Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery timed out (code -32603)'\"'\"';\n const fresh = Number.isFinite(elapsed) && elapsed >= 0 && /^[a-f0-9]{64}$/.test(before.hash) && before.hash !== hash;\n const matches = mode === '\"'\"'after-update'\"'\"'\n ? /^(?:🎉\\s*)?Update ran successfully! Please restart Codex\\.$/.test(last)\n : mode === '\"'\"'after'\"'\"' && elapsed <= 30000 && last === error;\n process.exit(fresh && matches ? 0 : 1);\n }\n} catch { process.exit(1); }' \"$@\"\n}\nharness_codex_start() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_before=\n if [ -n \"${TMUX_PANE:-}\" ]; then harness_codex_before=$(harness_codex_check before '<tmux>' \"$TMUX_PANE\") || harness_codex_before=; fi\n harness_codex_probe \"$1\"\n harness_status=0\n}\nharness_codex_next() {\n [ \"$harness_codex_go\" = 1 ] || return 0\n harness_codex_go=0\n if [ \"$harness_status\" -eq 0 ] && [ \"$harness_codex_updated\" -eq 0 ] && [ -n \"$harness_codex_before\" ] &&\n harness_codex_seen=$(harness_codex_check after-update '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\"); then\n harness_codex_updated=1\n printf '\\n%s\\n' 'harness: Codex updated. Continuing startup…'\n harness_codex_go=1\n return 0\n fi\n [ \"$harness_status\" -eq 1 ] && [ \"$harness_codex_attempt\" -lt 3 ] && [ -n \"$harness_codex_before\" ] || return 0\n harness_codex_seen=$(harness_codex_check after '<tmux>' \"$TMUX_PANE\" \"$harness_codex_before\") || return 0\n harness_codex_delay=$((harness_codex_attempt * 2))\n harness_codex_attempt=$((harness_codex_attempt + 1))\n harness_codex_cancelled=0\n trap 'harness_codex_cancelled=1' INT\n printf '\\n%s\\n' \"harness: Codex account lookup timed out. Retrying startup ($harness_codex_attempt/3) in ${harness_codex_delay}s; Ctrl-C cancels.\"\n harness_codex_seen=$(sleep \"$harness_codex_delay\") || harness_codex_cancelled=1\n trap : INT\n if [ \"$harness_codex_cancelled\" -eq 1 ]; then harness_status=130; return 0; fi\n harness_codex_go=1\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'codex' '<root>/home/.local/bin/codex'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'codex'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Codex' 20 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Codex is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Codex is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-codex.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-codex-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'codex'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @openai/codex' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @openai/codex'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Codex' 20 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Codex could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Codex was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_codex_attempt=1\nharness_codex_updated=0\nharness_codex_go=1\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_codex_start \"$harness_engine_bin\"\n[ \"$harness_codex_go\" != 1 ] || \"$harness_engine_bin\" ${harness_codex_no_daemon:+--no-daemon} \"$@\" || harness_status=$?\nharness_resume\nharness_codex_next\nharness_after",
@@ -227,6 +242,7 @@
"a73d03074982c240": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Claude Code is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Claude Code is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-claude.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-claude-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'claude'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Claude Code could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Claude Code was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"acd3863e35e5c432": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: opencode exited ('\"$harness_status\"'). This pane is a shell now — run opencode again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'opencode' '<root>/home/.opencode/bin/opencode' '<root>/home/.local/bin/opencode'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'opencode'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: OpenCode is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'OpenCode is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-opencode.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-opencode-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'opencode'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://opencode.ai/install | bash' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nharness_try_fallback=0\nif [ -z \"$harness_engine_bin\" ] && [ \"$harness_status\" -ne 130 ]; then\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then\n harness_try_fallback=1\n harness_status=0\n [ \"$harness_quiet\" -eq 1 ] || printf '\\n%s\\n' 'harness: that install did not finish; trying the npm package instead' 'harness: $ npm install -g opencode-ai' ''\n [ \"$harness_quiet\" -eq 0 ] || printf '%s\\n' 'harness: that install did not finish; trying the npm package instead' >>\"$harness_install_log\"\n fi\nfi\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai') || harness_status=$?\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'OpenCode could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'OpenCode was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"b444c6de9ed73b6b": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Claude Code is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Claude Code is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-claude.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-claude-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'claude'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Claude Code could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Claude Code was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
+ "ba08f0832f2d5eeb": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: opencode exited ('\"$harness_status\"'). This pane is a shell now — run opencode again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'opencode' '<root>/home/.opencode/bin/opencode' '<root>/home/.local/bin/opencode'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'opencode'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: OpenCode is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'OpenCode is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-opencode.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-opencode-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'opencode'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ curl -fsSL https://opencode.ai/install | bash' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'curl -fsSL https://opencode.ai/install | bash'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nharness_try_fallback=0\nif [ -z \"$harness_engine_bin\" ] && [ \"$harness_status\" -ne 130 ]; then\n hash -r 2>/dev/null || true\n if ! harness_find_engine \"$1\"; then\n harness_try_fallback=1\n harness_status=0\n [ \"$harness_quiet\" -eq 1 ] || printf '\\n%s\\n' 'harness: that install did not finish; trying the npm package instead' 'harness: $ npm install -g opencode-ai' ''\n [ \"$harness_quiet\" -eq 0 ] || printf '%s\\n' 'harness: that install did not finish; trying the npm package instead' >>\"$harness_install_log\"\n fi\nfi\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai') || harness_status=$?\n[ \"$harness_try_fallback\" -eq 0 ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g opencode-ai'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'OpenCode' 10 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'OpenCode could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'OpenCode was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"bdbea8aa1d3e4b33": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: copilot exited ('\"$harness_status\"'). This pane is a shell now — run copilot again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'copilot' '<root>/home/.local/bin/copilot'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'copilot'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Copilot' 15 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Copilot is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Copilot is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-copilot.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-copilot-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'copilot'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @github/copilot' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @github/copilot'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Copilot' 15 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Copilot could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Copilot was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"bed4505fbce71ce3": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: claude exited ('\"$harness_status\"'). This pane is a shell now — run claude again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_API_KEY GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: on macOS, grant Full Disk Access to the app that started tmux (and to Harness), then run: tmux kill-server' 'harness: or pick a folder outside Documents, Desktop and Downloads (System Settings › Privacy & Security).' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'claude' '<root>/home/.local/bin/claude'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'claude'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Claude Code is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Claude Code is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-claude.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-claude-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'claude'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g @anthropic-ai/claude-code' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g @anthropic-ai/claude-code'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Claude Code' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Claude Code could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Claude Code was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
"c59f64c9c100f673": "rm -f -- '<root>/data/launch/<script>.sh'\nharness_nofile=$(ulimit -S -n 2>/dev/null) || harness_nofile=unlimited; if [ \"$harness_nofile\" != unlimited ] && [ \"$harness_nofile\" -lt 65536 ] 2>/dev/null; then ulimit -S -n 65536 2>/dev/null || ulimit -S -n \"$(ulimit -H -n)\" 2>/dev/null || true; fi; unset harness_nofile\nharness_stopped() {\n [ \"$harness_status\" -gt 128 ] 2>/dev/null || return 1\n harness_signal=$(kill -l \"$harness_status\" 2>/dev/null) || return 1\n case $harness_signal in\n STOP|TSTP|TTIN|TTOU|SIGSTOP|SIGTSTP|SIGTTIN|SIGTTOU) jobs %% >/dev/null 2>&1 ;;\n *) return 1 ;;\n esac\n}\nharness_fg() {\n harness_now=$(date +%s 2>/dev/null) || harness_now=0\n if [ $((harness_now - harness_resumed)) -le 1 ]; then harness_quick=$((harness_quick + 1)); else harness_quick=0; fi\n harness_resumes=$((harness_resumes + 1))\n case $harness_signal in *TTIN|*TTOU) harness_stuck=$harness_quick ;; *) harness_stuck=0 ;; esac\n if [ \"$harness_stuck\" -ge 5 ] || { [ -z \"${ZSH_VERSION:-}\" ] && [ \"$harness_resumes\" -ge 1000 ]; }; then\n kill -9 %% 2>/dev/null\n harness_status=137\n return 0\n fi\n if [ \"$harness_quick\" -ge 3 ]; then harness_waited=$(sleep 1) || :; fi\n harness_resumed=$(date +%s 2>/dev/null) || harness_resumed=0\n harness_status=0\n fg >/dev/null || harness_status=$?\n}\nharness_resume() {\n if [ -n \"${ZSH_VERSION:-}\" ]; then\n while harness_stopped; do harness_fg; done\n return 0\n fi\n harness_stopped || return 0\n harness_fg\n harness_resume\n}\nharness_resumed=0\nharness_quick=0\nharness_resumes=0\nharness_after() {\n if [ \"$harness_status\" -eq 127 ]; then exit 127; fi\n [ -n \"${TMUX_PANE:-}\" ] && { '<tmux>' set-option -p -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1 || '<tmux>' set-option -w -t \"$TMUX_PANE\" @harness_engine_exit \"$harness_status\" >/dev/null 2>&1; } || true\n if ! [ -t 0 ]; then exit \"$harness_status\"; fi\n if harness_tty=$(stty -g 2>/dev/null) && stty -icanon -echo min 0 time 3 2>/dev/null; then\n while harness_waiting=$(dd bs=65536 count=1 2>/dev/null | wc -c) && [ \"$((harness_waiting))\" -gt 0 ]; do :; done\n stty \"$harness_tty\" 2>/dev/null || true\n fi\n if [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\n printf '\\n%s\\n' 'harness: pi exited ('\"$harness_status\"'). This pane is a shell now — run pi again, or stop the pane.'\n exec '/bin/zsh' -l\n}\nunset ANTHROPIC_API_KEY ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL ANTHROPIC_MODEL OPENAI_API_KEY OPENAI_BASE_URL XAI_API_KEY GROK_MODELS_BASE_URL COPILOT_PROVIDER_API_KEY COPILOT_PROVIDER_BASE_URL COPILOT_MODEL HERMES_INFERENCE_MODEL GRID_MCP_AUTHORIZATION HERMES_MANAGED_DIR GROK_HOME HARNESS_DSH HARNESS_DSH_DIR HARNESS_WORKSPACE HARNESS_CONTEXT_FILE HARNESS_SKILLS_DIR HARNESS_PRIVATE_GRID\nGRID_NO_UPDATE_CHECK=1\nexport GRID_NO_UPDATE_CHECK\nif [ \"${HARNESS_DEVELOPER_DIR:-}\" = 1 ]; then unset DEVELOPER_DIR HARNESS_DEVELOPER_DIR; fi\nif [ -x '/usr/bin/xcode-select' ] && [ -z \"${DEVELOPER_DIR:-}\" ] && [ ! -d '/Library/Developer/CommandLineTools/usr/bin' ] && [ ! -e '/var/db/xcode_select_link' ] && ! harness_devtools=$('/usr/bin/xcode-select' -p 2>/dev/null); then\n DEVELOPER_DIR='/Library/Developer/CommandLineTools'\n HARNESS_DEVELOPER_DIR=1\n export DEVELOPER_DIR HARNESS_DEVELOPER_DIR\nfi\nif ! cd -- \"$1\"; then printf '%s\\n' 'harness: the selected working directory is unavailable.' >&2; exit 1; fi\nif ! [ -r . ]; then printf '%s\\n' \"harness: cannot read $PWD — the agent was not started.\" 'harness: check the folder'\"'\"'s permissions for this user.' >&2; exit 1; fi\nshift\nif [ -n \"${ZSH_VERSION:-}\" ]; then setopt monitor 2>/dev/null || :; else set -m 2>/dev/null || :; fi\ntrap : INT QUIT\nresolve_engine() {\n candidate=\"$1\"\n resolved=\"\"\n case \"$candidate\" in\n */*) resolved=\"$candidate\" ;;\n *) resolved=\"$(command -v \"$candidate\" 2>/dev/null)\" || true ;;\n esac\n [ -n \"$resolved\" ] && [ -f \"$resolved\" ] && [ -x \"$resolved\" ]\n}\nharness_find_engine() {\n harness_engine_bin=\n for candidate in \"$1\" 'pi' '<root>/home/.local/bin/pi'; do\n if resolve_engine \"$candidate\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n npm_prefix=\"$(npm prefix -g 2>/dev/null)\" || true\n if [ -n \"$npm_prefix\" ]; then\n for bin in 'pi'; do\n if resolve_engine \"$npm_prefix/bin/$bin\"; then harness_engine_bin=\"$resolved\"; return 0; fi\n done\n fi\n return 1\n}\nif ! command -v node >/dev/null 2>&1 || ! command -v npm >/dev/null 2>&1; then\n for harness_node_bin in '<daemon-node-dir>'; do\n if [ -x \"$harness_node_bin/node\" ] && [ -x \"$harness_node_bin/npm\" ]; then\n PATH=\"$harness_node_bin${PATH:+:$PATH}\"\n export PATH\n hash -r 2>/dev/null || true\n break\n fi\n done\nfi\nharness_wait_download() {\n harness_dl_pid=$(cat \"$HOME/.harness/run/downloading-$1\" 2>/dev/null) || return 0\n case \"$harness_dl_pid\" in ''|*[!0-9]*) return 0 ;; esac\n kill -0 \"$harness_dl_pid\" 2>/dev/null || return 0\n ps -p \"$harness_dl_pid\" -o command= 2>/dev/null | grep -q harness-download || return 0\n if [ \"$harness_quiet\" -eq 1 ]; then\n harness_dl_w=$( ( harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do sleep 0.5; harness_dl_i=$((harness_dl_i + 1)); done ) | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Pi' 12 \"$harness_install_log\" 0 >&2 ) || :\n else\n printf '%s\\n' 'harness: Pi is downloading in the background; waiting for it'\n harness_dl_i=0; while kill -0 \"$harness_dl_pid\" 2>/dev/null && [ \"$harness_dl_i\" -lt 1200 ]; do harness_dl_w=$(sleep 0.5) || :; harness_dl_i=$((harness_dl_i + 1)); done\n fi\n if kill -0 \"$harness_dl_pid\" 2>/dev/null; then printf '\\n%s\\n' 'Pi is still downloading. Try again in a minute.'; exit 1; fi\n hash -r 2>/dev/null || true\n}\nharness_quiet=0\nharness_install_log=\"$HOME/.harness/logs/install-pi.log\"\nharness_install_rc=\"$HOME/.harness/logs/install-pi-$$.rc\"\n[ -x '<daemon-node>' ] && mkdir -p \"$HOME/.harness/logs\" 2>/dev/null && harness_quiet=1\nharness_find_engine \"$1\" || harness_wait_download 'pi'\nif ! harness_find_engine \"$1\"; then\n if ! command -v npm >/dev/null 2>&1; then\n printf '%s\\n' 'harness: npm is unavailable and the managed Node.js/npm runtime could not be used.'\n exit 1\n fi\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: engine is missing — installing it in this terminal' 'harness: $ npm install -g --ignore-scripts @earendil-works/pi-coding-agent' ''\n [ \"$harness_quiet\" -eq 1 ] || printf '%s\\n' 'harness: installing for this user in <root>/home/.local'\nfi\nharness_status=0\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 1 ] || (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent') || harness_status=$?\n[ -n \"$harness_engine_bin\" ] || [ \"$harness_quiet\" -eq 0 ] || ( ( (export npm_config_prefix='<root>/home/.local' NPM_CONFIG_PREFIX='<root>/home/.local'; eval 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent'); printf %s $? >\"$harness_install_rc\" ) 2>&1 | '<daemon-node>' -e 'const fs=require(\"fs\");const [label,sec,log,waiting]=process.argv.slice(1);const E=Number(sec)*1000;const t0=Date.now();const out=fs.openSync(log,\"a\");fs.writeSync(out,\"\\n--- \"+new Date().toISOString()+\" installing \"+label+\"\\n\");process.stdin.on(\"data\",(d)=>fs.writeSync(out,d));const rows=waiting===\"1\"?3:2;let drawn=false;const draw=()=>{const t=Date.now()-t0;const f=Math.min(0.97,Math.max(0.04,1-1/(1+2.4*t/E)));const n=Math.round(f*24);const left=Math.round((E-t)/1000);const when=t>3*E?\"still working, this can take a while\":left>3?\"about \"+left+\" s\":\"almost there\";const lines=[\"Installing \"+label+\"… \"+when,\"█\".repeat(n)+\"░\".repeat(24-n)].concat(waiting===\"1\"?[\"Your message goes as soon as it starts.\"]:[]);let text=drawn?\"\\x1b[\"+rows+\"F\":\"\";for(const l of lines)text+=\"\\r\\x1b[2K\"+l+\"\\n\";drawn=true;process.stdout.write(text);};draw();const tick=setInterval(draw,500);process.stdin.on(\"end\",()=>{clearInterval(tick);fs.closeSync(out);});' 'Pi' 12 \"$harness_install_log\" 0; harness_rc=\"$(cat \"$harness_install_rc\" 2>/dev/null || echo 130)\"; rm -f \"$harness_install_rc\"; exit \"$harness_rc\" ) || harness_status=$?\nharness_resume\nif [ -z \"$harness_engine_bin\" ]; then\n if [ \"$harness_status\" -ne 0 ] && [ \"$harness_quiet\" -eq 1 ]; then printf '\\n%s\\n\\n' 'Pi could not be installed.'; tail -n 12 \"$harness_install_log\"; printf '\\n%s\\n' \"Full details: $harness_install_log\"; exit 1; fi\n if [ \"$harness_status\" -ne 0 ]; then printf '\\n%s\\n' 'harness: the install failed, so the agent was not started. The command is above; fix it and create the agent again.'; exit 1; fi\n hash -r 2>/dev/null || true\n if [ \"$harness_quiet\" -eq 1 ] && ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'Pi was installed but could not be started.' \"Full details: $harness_install_log\"; exit 1; fi\n if ! harness_find_engine \"$1\"; then printf '\\n%s\\n' 'harness: the install completed, but its executable could not be found. Check the installer output and PATH above.'; exit 1; fi\nfi\nshift\nharness_status=0\n\"$harness_engine_bin\" \"$@\" || harness_status=$?\nharness_resume\nharness_after",
diff --git a/cli/src/engines/claude/launch.ts b/cli/src/engines/claude/launch.ts
index 570148ceb..000ac6539 100644
--- a/cli/src/engines/claude/launch.ts
+++ b/cli/src/engines/claude/launch.ts
@@ -25,4 +25,19 @@ export const launch: EngineLaunch = {
home: { variable: 'CLAUDE_CONFIG_DIR', otherwise: 'home' }, file: '.claude.json',
format: 'json', projects: 'projects', accepted: 'hasTrustDialogAccepted', entry: { allowedTools: [] },
},
+ /**
+ * Claude Code's `attribution.pr`: the text it adds to a pull request it opens. Set, it replaces Claude Code's own
+ * line, so the value keeps that line first (2.1.296 `rro`: `pr: h.pr ?? <own line>`). `--settings` overrides the
+ * person's user, project and local settings key by key (lodash `mergeWith`), so their `attribution.commit` stays.
+ * `attribution: false`, a `pr` of "" and the older `includeCoAuthoredBy: false` each hide the line: nothing is added
+ * then, and the last would otherwise bring the commit trailer back (setting `pr` ends it).
+ */
+ attribution: {
+ kind: 'setting',
+ home: { variable: 'CLAUDE_CONFIG_DIR', otherwise: { folder: '.claude' } }, file: 'settings.json',
+ folder: ['.claude/settings.json', '.claude/settings.local.json'],
+ key: 'attribution', field: 'pr', legacy: { key: 'includeCoAuthoredBy', until: ['commit', 'pr'] },
+ own: '🤖 Generated with [Claude Code](https://claude.com/claude-code)',
+ args: ['--settings', '{settings}'],
+ },
}
diff --git a/cli/src/engines/codex/launch.ts b/cli/src/engines/codex/launch.ts
index c1f5d22e3..11dbde19b 100644
--- a/cli/src/engines/codex/launch.ts
+++ b/cli/src/engines/codex/launch.ts
@@ -99,4 +99,17 @@ export const launch: EngineLaunch = {
},
},
},
+ /**
+ * Codex 0.162.1 has no setting for its attribution's text: its own line ("Generated with [Codex](…)") is an
+ * instruction in its developer message (`<git_attribution>`), on or off by workspace. `developer_instructions` is
+ * the config key that adds to that message, so ours is worded as Codex words its own, and stays beside it.
+ */
+ attribution: {
+ kind: 'instruction',
+ home: { setting: 'CODEX_HOME' }, file: 'config.toml', folder: '.codex/config.toml', key: 'developer_instructions',
+ instruction: 'When you create or update a pull request, its body must include this exact line once, near the end and '
+ + 'after any other attribution line: `{line}` It says another agent started this session in Harness. Do not add it '
+ + 'to commit messages.',
+ args: ['-c', 'developer_instructions={value}'],
+ },
}
diff --git a/cli/src/engines/facets/launch.ts b/cli/src/engines/facets/launch.ts
index fe3226b91..9351f6f2a 100644
--- a/cli/src/engines/facets/launch.ts
+++ b/cli/src/engines/facets/launch.ts
@@ -91,10 +91,11 @@ export interface StartupContract {
/**
* Where an engine keeps its own settings for a launch made now. `setting`: the folder a daemon setting names,
* unless the person's shell moves it, unless the agent has a profile of its own (Codex's CODEX_HOME).
- * `variable`: the folder a variable the person's shell sets names, else their home folder (Claude Code's
- * CLAUDE_CONFIG_DIR). Resolved by lib/engineHomes.ts `launchHomeOf`.
+ * `variable`: the folder a variable the person's shell sets names, else their home folder, or `folder` in it
+ * (Claude Code's CLAUDE_CONFIG_DIR: `.claude.json` is in the home folder itself, `settings.json` in `~/.claude`).
+ * Resolved by lib/engineHomes.ts `launchHomeOf`.
*/
-export type LaunchHome = { setting: FolderSetting } | { variable: string; otherwise: 'home' }
+export type LaunchHome = { setting: FolderSetting } | { variable: string; otherwise: 'home' | { folder: string } }
/**
* An engine's answer to "do you trust this folder?", which it asks the first time it opens one, kept in `file`
@@ -139,6 +140,61 @@ export interface ResumeRepairContract {
names: { file: string; history: string; items: string }
}
+/**
+ * How an engine is told to add a line to the pull requests it opens: a harness another agent started says so
+ * (lib/agentAttribution.ts). Applied by kit/attribution.ts on each launch of one, its relaunches included. The
+ * person's choices stay theirs: the engine's own line is kept beside it, an instruction of theirs is never
+ * replaced, and where they hid the engine's attribution nothing is added.
+ */
+export type AttributionContract = SettingAttribution | InstructionAttribution
+
+/**
+ * An engine with a setting for the text it adds to a pull request, in JSON settings files that a settings object
+ * on its command line overrides key by key (Claude Code's `attribution.pr` and `--settings`, 2.1.296). The
+ * setting's text replaces the engine's own line, so it is given the line the engine would have added, then ours.
+ */
+export interface SettingAttribution {
+ kind: 'setting'
+ /** The person's settings files, lowest precedence first: `file` in `home`, then each of `folder` in the harness's folder. */
+ home: LaunchHome
+ file: string
+ folder: readonly string[]
+ /** The setting: an object at `key` whose `field` is the pull request's text. `false` at `key` hides every line. */
+ key: string
+ field: string
+ /**
+ * An older setting that, `false`, hides every line while `key` sets none of `until` (Claude Code's
+ * `includeCoAuthoredBy`). Setting `field` would end that and bring back the engine's commit line, so a person
+ * who set it gets nothing added.
+ */
+ legacy?: { key: string; until: readonly string[] }
+ /** The engine's own line, where the person set no text. */
+ own: string
+ /** The argv; `{settings}` is the settings object, as JSON. */
+ args: readonly string[]
+}
+
+/**
+ * An engine with no setting for its attribution's text, which it gives its model as an instruction (Codex 0.162.1:
+ * `<git_attribution>` in the developer message), and which takes more instructions in a config key `-c` sets
+ * (`developer_instructions`). `-c` replaces the person's own value, so theirs comes first and ours after it; one
+ * that cannot be read exactly, or one a folder's own config sets, is left alone and nothing is added.
+ */
+export interface InstructionAttribution {
+ kind: 'instruction'
+ /** The person's config: `file` in the agent's profile, else the home `home` names. */
+ home: LaunchHome
+ file: string
+ /** A folder's own config, looked for in the harness's folder and each folder above it, up to the home folder. */
+ folder: string
+ /** The top-level key the instructions are in. */
+ key: string
+ /** What the model is told; `{line}` is the line. */
+ instruction: string
+ /** The argv; `{value}` is the instructions, as a JSON string, which TOML reads as the same string. */
+ args: readonly string[]
+}
+
/** Literal argv contracts copied from the existing launch paths. No engine version behavior changes. */
export interface EngineLaunch {
permissionModes: Readonly<Record<string, readonly string[]>>
@@ -158,4 +214,5 @@ export interface EngineLaunch {
instructionImport?: { file: string; line: string }
trust?: TrustContract
resumeRepair?: ResumeRepairContract
+ attribution?: AttributionContract
}
diff --git a/cli/src/engines/kit/attribution.spec.ts b/cli/src/engines/kit/attribution.spec.ts
new file mode 100644
index 000000000..e1184b527
--- /dev/null
+++ b/cli/src/engines/kit/attribution.spec.ts
@@ -0,0 +1,210 @@
+/**
+ * The pull request line of a harness another agent started, as Claude Code's and Codex's launch contracts declare it
+ * (claude/launch.ts, codex/launch.ts) and the kit applies it (kit/attribution.ts), composed as a launch asks for it
+ * (launches.ts `attributionArgs`). The files are a map, never this machine's settings.
+ *
+ * What is worth pinning is where it must add NOTHING: the person hid the engine's attribution, or set a value that
+ * the line would replace and that cannot be kept exactly.
+ */
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import type { InstructionAttribution, SettingAttribution } from '../facets/launch.js'
+import { launch as claude } from '../claude/launch.js'
+import { launch as codex } from '../codex/launch.js'
+import { attributionArgs } from '../launches.js'
+import { attributionArgsIn, type AttributionFiles } from './attribution.js'
+import { topLevelEntry } from './launchArgs.js'
+
+const shell = vi.hoisted(() => ({ env: {} as NodeJS.ProcessEnv }))
+vi.mock('../../lib/loginShellEnv.js', () => ({ loginShellEnvironment: () => shell.env }))
+afterEach(() => { shell.env = {} })
+
+const LINE = '🤝 Started by another agent in [Harness](https://example.test) — test.'
+const CLAUDE_OWN = '🤖 Generated with [Claude Code](https://claude.com/claude-code)'
+const claudeContract = claude.attribution as SettingAttribution
+const codexContract = codex.attribution as InstructionAttribution
+
+/** The files a launch reads, by path; a path not in the map is absent. */
+function filesOf(files: Record<string, string>, place: Partial<AttributionFiles> = {}): AttributionFiles & { asked: string[] } {
+ const asked: string[] = []
+ return {
+ home: '/home/me/.claude', personal: '/home/me', cwd: '/home/me/code/app', ...place, asked,
+ read: (path) => { asked.push(path); return files[path] ?? null },
+ }
+}
+
+/** The `attribution.pr` a Claude Code launch is given, or null for no `--settings`. */
+function claudePr(files: Record<string, string>, place: Partial<AttributionFiles> = {}): string | null {
+ const args = attributionArgsIn(claudeContract, LINE, filesOf(files, place))
+ if (!args.length) return null
+ expect(args[0]).toBe('--settings')
+ expect(args).toHaveLength(2)
+ const settings = JSON.parse(args[1]!) as { attribution: Record<string, unknown> }
+ // Only the pull request's text: the person's commit attribution is theirs, kept by the engine's merge.
+ expect(Object.keys(settings)).toEqual(['attribution'])
+ expect(Object.keys(settings.attribution)).toEqual(['pr'])
+ return settings.attribution.pr as string
+}
+
+const USER = '/home/me/.claude/settings.json'
+const PROJECT = '/home/me/code/app/.claude/settings.json'
+const LOCAL = '/home/me/code/app/.claude/settings.local.json'
+const json = (value: unknown): string => JSON.stringify(value)
+
+describe('Claude Code: attribution.pr', () => {
+ it('keeps Claude Code\'s own line first, then the line, where the person set nothing', () => {
+ expect(claudePr({})).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ expect(claudePr({ [USER]: json({ hooks: {} }) })).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ })
+
+ it('keeps the person\'s own pull request text, from whichever file wins', () => {
+ expect(claudePr({ [USER]: json({ attribution: { pr: 'Made by me' } }) })).toBe(`Made by me\n${LINE}`)
+ // Project over user, local over project, as Claude Code merges them.
+ expect(claudePr({ [USER]: json({ attribution: { pr: 'user' } }), [PROJECT]: json({ attribution: { pr: 'project' } }) })).toBe(`project\n${LINE}`)
+ expect(claudePr({ [PROJECT]: json({ attribution: { pr: 'project' } }), [LOCAL]: json({ attribution: { pr: 'local' } }) })).toBe(`local\n${LINE}`)
+ // Merged key by key: a commit text in one file and nothing for pull requests elsewhere is still Claude's line.
+ expect(claudePr({ [USER]: json({ attribution: { commit: 'Co-Authored-By: me' } }), [PROJECT]: json({ attribution: { sessionUrl: false } }) }))
+ .toBe(`${CLAUDE_OWN}\n${LINE}`)
+ })
+
+ it('adds nothing where the person hid the attribution', () => {
+ expect(claudePr({ [USER]: json({ attribution: false }) })).toBeNull()
+ expect(claudePr({ [USER]: json({ attribution: { pr: '' } }) })).toBeNull()
+ expect(claudePr({ [USER]: json({ attribution: { pr: 'user' } }), [LOCAL]: json({ attribution: { pr: '' } }) })).toBeNull()
+ expect(claudePr({ [USER]: json({ attribution: { pr: 'user' } }), [PROJECT]: json({ attribution: false }) })).toBeNull()
+ })
+
+ it('adds nothing under the older includeCoAuthoredBy: false, which setting pr would end', () => {
+ // Setting `pr` makes Claude Code ignore `includeCoAuthoredBy` and bring back its commit trailer.
+ expect(claudePr({ [USER]: json({ includeCoAuthoredBy: false }) })).toBeNull()
+ expect(claudePr({ [USER]: json({ includeCoAuthoredBy: false, attribution: { sessionUrl: false } }) })).toBeNull()
+ // Once `attribution` names a commit or pull request text, Claude Code already ignores it.
+ expect(claudePr({ [USER]: json({ includeCoAuthoredBy: false, attribution: { commit: '' } }) })).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ expect(claudePr({ [USER]: json({ includeCoAuthoredBy: false }), [PROJECT]: json({ attribution: { pr: 'p' } }) })).toBe(`p\n${LINE}`)
+ expect(claudePr({ [USER]: json({ includeCoAuthoredBy: true }) })).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ })
+
+ it('an object after false, a file that is not an object, and one that does not parse, as Claude Code reads them', () => {
+ expect(claudePr({ [USER]: json({ attribution: false }), [PROJECT]: json({ attribution: { pr: 'back' } }) })).toBe(`back\n${LINE}`)
+ expect(claudePr({ [USER]: '[1, 2]', [PROJECT]: '{ not json', [LOCAL]: 'null' })).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ expect(claudePr({ [USER]: json({ attribution: { pr: 42 } }) })).toBe(`${CLAUDE_OWN}\n${LINE}`)
+ })
+
+ it('adds the line once: text that already has it is left as it is', () => {
+ expect(claudePr({ [USER]: json({ attribution: { pr: `Mine\n${LINE}` } }) })).toBeNull()
+ })
+
+ it('reads only the person\'s own settings for a harness with no folder', () => {
+ const files = filesOf({ [USER]: json({ attribution: { pr: 'u' } }) }, { cwd: null })
+ expect(attributionArgsIn(claudeContract, LINE, files)).toEqual(['--settings', json({ attribution: { pr: `u\n${LINE}` } })])
+ expect(files.asked).toEqual([USER])
+ })
+})
+
+const CODEX_CONFIG = '/home/me/.codex/config.toml'
+const instructionOf = (line: string): string => codexContract.instruction.split('{line}').join(line)
+
+/** The `developer_instructions` a Codex launch is given, or null for no `-c`. */
+function codexInstructions(files: Record<string, string>, place: Partial<AttributionFiles> = {}): string | null {
+ const args = attributionArgsIn(codexContract, LINE, filesOf(files, { home: '/home/me/.codex', ...place }))
+ if (!args.length) return null
+ expect(args[0]).toBe('-c')
+ expect(args).toHaveLength(2)
+ const [key, value] = [args[1]!.slice(0, args[1]!.indexOf('=')), args[1]!.slice(args[1]!.indexOf('=') + 1)]
+ expect(key).toBe('developer_instructions')
+ // A JSON string, which TOML reads as the same string.
+ return JSON.parse(value) as string
+}
+
+describe('Codex: developer_instructions', () => {
+ it('tells Codex to add the line to a pull request, as it is told its own', () => {
+ expect(codexInstructions({})).toBe(instructionOf(LINE))
+ expect(instructionOf(LINE)).toContain(`\`${LINE}\``)
+ expect(instructionOf(LINE)).toContain('Do not add it to commit messages.')
+ })
+
+ it('keeps the person\'s own instructions first', () => {
+ expect(codexInstructions({ [CODEX_CONFIG]: 'model = "gpt-5"\ndeveloper_instructions = "Be terse."\n' })).toBe(`Be terse.\n\n${instructionOf(LINE)}`)
+ expect(codexInstructions({ [CODEX_CONFIG]: "developer_instructions = 'Say \"done\".' # mine\n" })).toBe(`Say "done".\n\n${instructionOf(LINE)}`)
+ expect(codexInstructions({ [CODEX_CONFIG]: 'developer_instructions = ""\n' })).toBe(instructionOf(LINE))
+ // A profile's own key is that profile's, not the top level's.
+ expect(codexInstructions({ [CODEX_CONFIG]: '[profiles.work]\ndeveloper_instructions = "Work."\n' })).toBe(instructionOf(LINE))
+ })
+
+ it('adds nothing where it cannot keep the person\'s instructions exactly', () => {
+ expect(codexInstructions({ [CODEX_CONFIG]: 'developer_instructions = """\nBe terse.\n"""\n' })).toBeNull()
+ expect(codexInstructions({ [CODEX_CONFIG]: "developer_instructions = '''\nBe terse.\n'''\n" })).toBeNull()
+ expect(codexInstructions({ [CODEX_CONFIG]: 'developer_instructions = "Line one\\nline two"\n' })).toBeNull()
+ expect(codexInstructions({ [CODEX_CONFIG]: 'developer_instructions = 42\n' })).toBeNull()
+ })
+
+ it('adds nothing where a folder\'s own config sets them, which `-c` would replace', () => {
+ expect(codexInstructions({ '/home/me/code/app/.codex/config.toml': 'developer_instructions = "Project rules."\n' })).toBeNull()
+ expect(codexInstructions({ '/home/me/code/.codex/config.toml': 'developer_instructions = """\nx\n"""\n' })).toBeNull()
+ expect(codexInstructions({ '/home/me/code/app/.codex/config.toml': 'model = "gpt-5"\n' })).toBe(instructionOf(LINE))
+ })
+
+ it('looks for a folder\'s config up to the home folder, not in it, and past it for a folder outside it', () => {
+ const inside = filesOf({}, { home: '/home/me/.codex' })
+ attributionArgsIn(codexContract, LINE, inside)
+ expect(inside.asked).toEqual(['/home/me/code/app/.codex/config.toml', '/home/me/code/.codex/config.toml', CODEX_CONFIG])
+ const outside = filesOf({ '/srv/.codex/config.toml': 'developer_instructions = "srv"\n' }, { home: '/home/me/.codex', cwd: '/srv/app' })
+ expect(attributionArgsIn(codexContract, LINE, outside)).toEqual([])
+ expect(outside.asked).toEqual(['/srv/app/.codex/config.toml', '/srv/.codex/config.toml'])
+ // A home moved into the project: its config is the person's own, read as theirs.
+ const moved = filesOf({ '/home/me/code/app/.codex/config.toml': 'developer_instructions = "Mine."\n' }, { home: '/home/me/code/app/.codex' })
+ expect(JSON.parse(attributionArgsIn(codexContract, LINE, moved)[1]!.split('=').slice(1).join('='))).toBe(`Mine.\n\n${instructionOf(LINE)}`)
+ const nowhere = filesOf({}, { home: '/home/me/.codex', cwd: null })
+ attributionArgsIn(codexContract, LINE, nowhere)
+ expect(nowhere.asked).toEqual([CODEX_CONFIG])
+ })
+
+ it('adds the line once', () => {
+ expect(codexInstructions({ [CODEX_CONFIG]: `developer_instructions = "Always end with ${LINE}"\n` })).toBeNull()
+ })
+})
+
+describe('topLevelEntry', () => {
+ it('absent, set or unreadable, at the top level only', () => {
+ expect(topLevelEntry('', 'k')).toEqual({ state: 'absent' })
+ expect(topLevelEntry('# k = "x"\nother = 1', 'k')).toEqual({ state: 'absent' })
+ expect(topLevelEntry('[t]\nk = "x"', 'k')).toEqual({ state: 'absent' })
+ expect(topLevelEntry('k="x"', 'k')).toEqual({ state: 'set', value: 'x' })
+ expect(topLevelEntry("k = 'a # b' # c", 'k')).toEqual({ state: 'set', value: 'a # b' })
+ expect(topLevelEntry('k = "a\\"b"', 'k')).toEqual({ state: 'unreadable' })
+ expect(topLevelEntry('k = true', 'k')).toEqual({ state: 'unreadable' })
+ // Another key that starts with the same letters is not it.
+ expect(topLevelEntry('kk = "x"', 'k')).toEqual({ state: 'absent' })
+ })
+})
+
+describe('attributionArgs, composed from the launch contracts', () => {
+ it('nothing for an engine that declares no way to add the line', () => {
+ expect(attributionArgs('opencode', LINE, { cwd: '/w', read: () => { throw new Error('read nothing') } })).toEqual([])
+ expect(attributionArgs('terminal', LINE, { cwd: null })).toEqual([])
+ })
+
+ it('Claude Code\'s settings in the CLAUDE_CONFIG_DIR the launch sets, else ~/.claude', () => {
+ const asked: string[] = []
+ const read = (path: string): string | null => { asked.push(path); return null }
+ attributionArgs('claude', LINE, { cwd: '/w', environment: { HOME: '/home/me', CLAUDE_CONFIG_DIR: '/cfg/claude' }, read })
+ attributionArgs('claude', LINE, { cwd: null, environment: { HOME: '/home/me' }, read })
+ // The daemon's launch environment when the launch has none of its own: the login shell's over the daemon's.
+ shell.env = { HOME: '/home/shell', CLAUDE_CONFIG_DIR: '/shell/claude' }
+ attributionArgs('claude', LINE, { cwd: null, read })
+ expect(asked).toEqual(['/cfg/claude/settings.json', '/w/.claude/settings.json', '/w/.claude/settings.local.json',
+ '/home/me/.claude/settings.json', '/shell/claude/settings.json'])
+ })
+
+ it('Codex\'s config in the agent\'s profile, else the CODEX_HOME the launch sets', () => {
+ const asked: string[] = []
+ const read = (path: string): string | null => { asked.push(path); return null }
+ attributionArgs('codex', LINE, { cwd: null, profile: '/profiles/work', environment: { HOME: '/home/me', CODEX_HOME: '/moved' }, read })
+ attributionArgs('codex', LINE, { cwd: null, environment: { HOME: '/home/me', CODEX_HOME: '/moved' }, read })
+ expect(asked).toEqual(['/profiles/work/config.toml', '/moved/config.toml'])
+ })
+
+ it('reads the real file when no reader is given', () => {
+ const args = attributionArgs('claude', LINE, { cwd: null, environment: { HOME: '/nonexistent-home', CLAUDE_CONFIG_DIR: '/nonexistent-claude' } })
+ expect(args).toEqual(['--settings', json({ attribution: { pr: `${CLAUDE_OWN}\n${LINE}` } })])
+ })
+})
diff --git a/cli/src/engines/kit/attribution.ts b/cli/src/engines/kit/attribution.ts
new file mode 100644
index 000000000..85bdc9b1d
--- /dev/null
+++ b/cli/src/engines/kit/attribution.ts
@@ -0,0 +1,89 @@
+/**
+ * The argv that has an engine add a line to the pull requests it opens (facets/launch.ts `AttributionContract`), for
+ * a harness another agent started (lib/agentAttribution.ts). Shared mechanics on the declaration alone, run in core
+ * with the rest of a launch's argv. The person's own settings are read as the engine reads them, at each launch: the
+ * line goes beside the engine's own, never replaces a value of theirs, and is not added where they hid the
+ * engine's attribution.
+ */
+import { dirname, join, parse, resolve } from 'node:path'
+import type { AttributionContract, InstructionAttribution, SettingAttribution } from '../facets/launch.js'
+import { fill, topLevelEntry } from './launchArgs.js'
+
+/** Where a launch's settings are, found by the caller (engines/launches.ts `attributionArgs`). */
+export interface AttributionFiles {
+ /** The engine's home for this launch: the person's own settings are in it. */
+ home: string
+ /** The person's home folder: a folder's own config is looked for up to it, never in it. */
+ personal: string
+ /** The harness's folder, or null where it has none. */
+ cwd: string | null
+ /** A file's text, or null when it is absent or cannot be read. */
+ read: (path: string) => string | null
+}
+
+/** The argv for `line`, or none where the person's settings say not to add it. */
+export function attributionArgsIn(contract: AttributionContract, line: string, files: AttributionFiles): string[] {
+ return contract.kind === 'setting' ? settingArgs(contract, line, files) : instructionArgs(contract, line, files)
+}
+
+const isRecord = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value)
+
+/** A later file's value over an earlier one's, objects merged key by key: how Claude Code merges its settings files. */
+const merged = (into: unknown, value: unknown): unknown => isRecord(into) && isRecord(value)
+ ? { ...into, ...Object.fromEntries(Object.entries(value).map(([key, child]) => [key, merged(into[key], child)])) }
+ : value
+
+function jsonObject(text: string | null): Record<string, unknown> | null {
+ if (text === null) return null
+ try {
+ const value: unknown = JSON.parse(text)
+ return isRecord(value) ? value : null
+ } catch {
+ // The engine reports a file it cannot parse and goes on without it; so does this.
+ return null
+ }
+}
+
+function settingArgs(contract: SettingAttribution, line: string, files: AttributionFiles): string[] {
+ const paths = [join(files.home, contract.file), ...(files.cwd ? contract.folder.map((name) => join(files.cwd!, name)) : [])]
+ let setting: unknown
+ let legacy: unknown
+ for (const path of paths) {
+ const settings = jsonObject(files.read(path))
+ if (!settings) continue
+ if (Object.hasOwn(settings, contract.key)) setting = merged(setting, settings[contract.key])
+ if (contract.legacy && Object.hasOwn(settings, contract.legacy.key)) legacy = settings[contract.legacy.key]
+ }
+ // Hidden by the person: every line, the pull request's, or every line by the older setting.
+ if (setting === false) return []
+ const named = isRecord(setting) ? setting : {}
+ const text = named[contract.field]
+ if (text === '') return []
+ if (contract.legacy && legacy === false && !contract.legacy.until.some((field) => named[field] !== undefined)) return []
+ const theirs = typeof text === 'string' ? text : contract.own
+ if (theirs.includes(line)) return []
+ const settings = JSON.stringify({ [contract.key]: { [contract.field]: `${theirs}\n${line}` } })
+ return contract.args.map((arg) => fill(arg, 'settings', settings))
+}
+
+function instructionArgs(contract: InstructionAttribution, line: string, files: AttributionFiles): string[] {
+ const config = join(files.home, contract.file)
+ // A folder's own config: the engine reads it over the person's, and `-c` would replace it. Left alone. Looked for
+ // up to the home folder, not in it: `~/.codex/config.toml` is the person's own config, not a folder's.
+ if (files.cwd) {
+ const personal = resolve(files.personal)
+ for (let dir = resolve(files.cwd); dir !== personal && dir !== parse(dir).root; dir = dirname(dir)) {
+ const path = join(dir, contract.folder)
+ if (path === config) continue
+ const toml = files.read(path)
+ if (toml !== null && topLevelEntry(toml, contract.key).state !== 'absent') return []
+ }
+ }
+ const toml = files.read(config)
+ const theirs = toml === null ? { state: 'absent' as const } : topLevelEntry(toml, contract.key)
+ if (theirs.state === 'unreadable') return []
+ if (theirs.state === 'set' && theirs.value.includes(line)) return []
+ const instruction = fill(contract.instruction, 'line', line)
+ const value = theirs.state === 'set' && theirs.value ? `${theirs.value}\n\n${instruction}` : instruction
+ return contract.args.map((arg) => fill(arg, 'value', JSON.stringify(value)))
+}
diff --git a/cli/src/engines/kit/launchArgs.ts b/cli/src/engines/kit/launchArgs.ts
index cc1d28d5e..a566b97ac 100644
--- a/cli/src/engines/kit/launchArgs.ts
+++ b/cli/src/engines/kit/launchArgs.ts
@@ -1,14 +1,15 @@
/**
* The argv an engine's launch contract declares as templates (facets/launch.ts): its harness context flag,
* its session variables as flags, and the provider it goes back to off a grid. Shared mechanics, run in core
- * on the declaration alone: a launch is session control and waits on no engine worker.
+ * on the declaration alone: a launch is session control and waits on no engine worker. The pull request line
+ * of a harness another agent started is kit/attribution.ts's, with the readers here.
*/
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { ContextArgsTemplate, EnvArgsTemplate, OwnProviderContract } from '../facets/launch.js'
/** `{key}` in `text` replaced by `value`, as written: never read as a `$` replacement pattern. */
-const fill = (text: string, key: string, value: string): string => text.split(`{${key}}`).join(value)
+export const fill = (text: string, key: string, value: string): string => text.split(`{${key}}`).join(value)
/** The context flag's argv for `file`. */
export function contextArgsOf(template: ContextArgsTemplate): (file: string) => string[] {
@@ -43,6 +44,25 @@ export function topLevelString(toml: string, key: string): string | null {
return null
}
+/**
+ * A top-level `key` of a TOML file as it is written, for a caller about to replace it: `absent`, or `set` to a value
+ * read exactly, or `unreadable`. Exactly is a one-line literal string (`'…'`) or a one-line basic string with no
+ * escape (`"…"`); any other value (a multi-line string, an escape, not a string) is `unreadable`, since a copy that
+ * reads it wrong would replace the person's value with another. The same small reader as `topLevelString`.
+ */
+export function topLevelEntry(toml: string, key: string): { state: 'absent' } | { state: 'set'; value: string } | { state: 'unreadable' } {
+ const named = new RegExp(`^${key.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\s*=(.*)$`)
+ for (const raw of toml.split('\n')) {
+ const line = stripComment(raw).trim()
+ if (line.startsWith('[')) break
+ const value = named.exec(line)?.[1]?.trim()
+ if (value === undefined) continue
+ const exact = /^'([^']*)'$/.exec(value) ?? /^"([^"\\]*)"$/.exec(value)
+ return exact ? { state: 'set', value: exact[1]! } : { state: 'unreadable' }
+ }
+ return { state: 'absent' }
+}
+
/** Drop a trailing `#` comment, but not one inside a quoted value. */
function stripComment(line: string): string {
let quote: string | null = null
@@ -56,7 +76,7 @@ function stripComment(line: string): string {
}
/** Read a config file; an unreadable or absent one is "nothing configured", not an error. */
-function readConfig(path: string): string | null {
+export function readConfig(path: string): string | null {
try { return readFileSync(path, 'utf8') } catch { return null }
}
diff --git a/cli/src/engines/launchArgv.golden.spec.ts b/cli/src/engines/launchArgv.golden.spec.ts
index 17606e827..5acf03ded 100644
--- a/cli/src/engines/launchArgv.golden.spec.ts
+++ b/cli/src/engines/launchArgv.golden.spec.ts
@@ -452,6 +452,23 @@ async function overridesCases(): Promise<Record<string, unknown>> {
cases['codex · profile · the profile\'s file'] = await run('codex', { codexHome: profile }, null, { readCodexConfig: undefined })
cases['codex · profile without a file'] = await run('codex', { codexHome: join(root, 'no-such-profile') }, null, { readCodexConfig: undefined })
rmSync(join(daemonHome, 'config.toml'))
+ // Started by another agent: the pull request line last, from the person's settings as each engine reads them
+ // (lib/agentAttribution.ts, kit/attribution.ts), and none for an engine with no way to say it.
+ const settings = (files: Record<string, string>) => ({ readAttribution: (path: string) => files[path.split(homedir()).join('<home>')] ?? null })
+ for (const engine of ['claude', 'codex', 'opencode'] as const) {
+ cases[`${engine} · started by an agent`] = await run(engine, { startedBy: 'agent', cwd: '/work/app' }, null, settings({}))
+ cases[`${engine} · started by an agent, a harness on a grid as a named agent`] = await run(engine,
+ { startedBy: 'agent', gridLaunch: GRID, dsh: 'acme/studio', cwd: '/work/studio', agent: 'harness-compute' }, null, settings({}))
+ }
+ cases['claude · started by an agent, the folder\'s own pull request text'] = await run('claude', { startedBy: 'agent', cwd: '/work/app' }, null,
+ settings({ '/work/app/.claude/settings.json': '{"attribution":{"pr":"Made in the app"}}' }))
+ cases['claude · started by an agent, attribution hidden'] = await run('claude', { startedBy: 'agent', cwd: '/work/app' }, null,
+ settings({ '<home>/.claude/settings.json': '{"attribution":false}' }))
+ cases['codex · started by an agent, the person\'s own instructions'] = await run('codex', { startedBy: 'agent', cwd: '/work/app' }, null,
+ settings({ '<home>/.codex/config.toml': 'developer_instructions = "Be terse."\n' }))
+ cases['codex · profile, started by an agent, instructions it cannot keep exactly'] = await run('codex', { startedBy: 'agent', codexHome: '/profiles/work', cwd: '/work/app' }, null,
+ settings({ '/profiles/work/config.toml': 'developer_instructions = """\nmine\n"""\n' }))
+ cases['claude · not started by an agent'] = await run('claude', { startedBy: null, cwd: '/work/app' }, null, settings({}))
return cases
}
diff --git a/cli/src/engines/launchShapes.golden.spec.ts b/cli/src/engines/launchShapes.golden.spec.ts
index b30277765..2500a53a2 100644
--- a/cli/src/engines/launchShapes.golden.spec.ts
+++ b/cli/src/engines/launchShapes.golden.spec.ts
@@ -182,19 +182,22 @@ const rest = () => ({
privateGridName: async () => null,
})
-async function createCase(engine: AgentEngine, grid: GridLaunchOverride | null, machine = M1): Promise<unknown> {
+async function createCase(engine: AgentEngine, grid: GridLaunchOverride | null, machine = M1, over: Record<string, unknown> = {}): Promise<unknown> {
pane.calls.length = 0
rmSync(configRoot(), { recursive: true, force: true })
const cwd = work()
const { value, lines } = await logged(() => shapes(machine).create(rest() as never)({
engine, cwd, bypassPermission: false, permissionMode: null, grid, codexHome: null, dsh: null, prompt: null, name: null, agent: null,
- resumeSessionId: null, takeOver: null,
+ resumeSessionId: null, takeOver: null, ...over,
} as never))
const call = pane.calls[0]
const label = typeof call?.sessionLabel === 'string' ? call.sessionLabel : undefined
return norm({
result: value,
- pane: call ? { argv: call.argv, script: scriptOf(call.argv, label), env: call.env, grid: call.grid, gridLaunchRecord: call.gridLaunchRecord } : null,
+ pane: call ? {
+ argv: call.argv, script: scriptOf(call.argv, label), env: call.env, grid: call.grid, gridLaunchRecord: call.gridLaunchRecord,
+ ...(call.startedBy ? { startedBy: call.startedBy } : {}),
+ } : null,
config: tree(configRoot()),
folder: tree(cwd),
logged: lines.filter((line) => /grid|refused|\[apis\]/i.test(line)),
@@ -214,6 +217,11 @@ async function createCases(): Promise<Record<string, unknown>> {
pane.tmux = true
cases['claude · own login'] = await createCase('claude', null)
cases['codex · own login'] = await createCase('codex', null)
+ // Started by another agent: the pull request line last (lib/agentAttribution.ts), none for an engine with no way to say it.
+ for (const engine of ['claude', 'codex', 'opencode'] as const) {
+ cases[`${engine} · own login · started by an agent`] = await createCase(engine, null, M1, { startedBy: 'agent' })
+ }
+ cases['claude · grid · started by an agent'] = await createCase('claude', GRID, M1, { startedBy: 'agent' })
return cases
}
@@ -256,6 +264,12 @@ async function relaunchCases(): Promise<Record<string, unknown>> {
cases['codex · restart on a grid · an old tmux'] = await relaunchCase('codex', session('codex', { gridLaunch: GRID }))
pane.tmux = true
cases['opencode · restart as a named agent on a grid'] = await relaunchCase('opencode', session('opencode', { gridLaunch: GRID, agent: 'reviewer' }))
+ // Started by another agent: every relaunch keeps the line; a fork of it is the forker's and has none.
+ for (const engine of ['claude', 'codex'] as const) {
+ cases[`${engine} · restart, started by an agent`] = await relaunchCase(engine, session(engine, { startedBy: 'agent' }))
+ cases[`${engine} · retarget onto a grid, started by an agent`] = await relaunchCase(engine, session(engine, { startedBy: 'agent' }), { gridLaunch: GRID })
+ cases[`${engine} · fork of one an agent started`] = await relaunchCase(engine, session(engine, { startedBy: 'agent' }), { dsh: null, agent: null, startedBy: null })
+ }
return cases
}
diff --git a/cli/src/engines/launches.ts b/cli/src/engines/launches.ts
index 0642884a6..e50a74f83 100644
--- a/cli/src/engines/launches.ts
+++ b/cli/src/engines/launches.ts
@@ -2,8 +2,9 @@ import type { EngineLaunch } from './facets/launch.js'
import type { AgentEngine } from './types.js'
import { launch as claude } from './claude/launch.js'
import { launch as codex } from './codex/launch.js'
-import { contextArgsOf, envArgsOf, ownProviderArgs } from './kit/launchArgs.js'
-import { launchHome } from '../lib/engineHomes.js'
+import { attributionArgsIn } from './kit/attribution.js'
+import { contextArgsOf, envArgsOf, ownProviderArgs, readConfig } from './kit/launchArgs.js'
+import { launchHome, launchHomeOf, launchPersonalHome } from '../lib/engineHomes.js'
/**
* Launch metadata has no transcript imports: preparing argv must not load transcript readers. The contracts
@@ -52,3 +53,28 @@ export function ownLoginProviderArgs(
const own = launchContract(engine)?.ownProvider
return own ? ownProviderArgs(own, launchHome(own.home, profile, deps.env), deps.read) : []
}
+
+/** Where a launch reads the person's settings from, for `attributionArgs`. */
+export interface AttributionPlace {
+ /** The harness's folder, or null where it has none. */
+ cwd: string | null
+ /** The agent's own engine home (a Codex agent's profile), where the engine's home takes one. */
+ profile?: string | null
+ /** The launch's environment as its shell set it (a native launch's); the daemon's launch environment when absent. */
+ environment?: NodeJS.ProcessEnv
+ /** A seam, like `readCodexConfig`: a spec's launch reads no settings of the machine it runs on. The real file when absent. */
+ read?: (path: string) => string | null
+}
+
+/**
+ * The argv that has `engine` add `line` to the pull requests it opens (`EngineLaunch.attribution`), from the person's
+ * settings as this launch would read them: nothing for an engine that declares no way to, or where they hid the
+ * engine's own attribution (kit/attribution.ts). Read at each launch, as the person may change them in between.
+ */
+export function attributionArgs(engine: AgentEngine | string, line: string, place: AttributionPlace): string[] {
+ const contract = launchContract(engine)?.attribution
+ return contract ? attributionArgsIn(contract, line, {
+ home: launchHomeOf(contract.home, place.profile, place.environment), personal: launchPersonalHome(place.environment),
+ cwd: place.cwd, read: place.read ?? readConfig,
+ }) : []
+}
diff --git a/cli/src/hookServer.spec.ts b/cli/src/hookServer.spec.ts
index 144e4a4ff..e3e482479 100644
--- a/cli/src/hookServer.spec.ts
+++ b/cli/src/hookServer.spec.ts
@@ -365,10 +365,11 @@ describe('what the person lets agents do', () => {
const routes = agentSettingsRoutes(dataDir)
const { base } = await start({ onAgentSettingsRead: routes.read, onAgentSettingsWrite: routes.write })
const patch = (body: string, local = true) => fetch(`${base}/api/agent-settings`, { method: 'PATCH', headers: { 'content-type': 'application/json', ...(local ? { 'x-adapter-local': '1' } : {}) }, body })
- expect(await (await fetch(`${base}/api/agent-settings`)).json()).toEqual({ agentsStartAgents: true })
+ expect(await (await fetch(`${base}/api/agent-settings`)).json()).toEqual({ agentsStartAgents: true, pullRequestLine: true })
expect((await patch('{"agentsStartAgents":false}', false)).status).toBe(403)
- expect(await (await patch('{"agentsStartAgents":false}')).json()).toEqual({ agentsStartAgents: false })
- expect(await (await fetch(`${base}/api/agent-settings`)).json()).toEqual({ agentsStartAgents: false })
+ expect(await (await patch('{"agentsStartAgents":false}')).json()).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ expect(await (await patch('{"pullRequestLine":false}')).json()).toEqual({ agentsStartAgents: false, pullRequestLine: false })
+ expect(await (await fetch(`${base}/api/agent-settings`)).json()).toEqual({ agentsStartAgents: false, pullRequestLine: false })
expect((await patch('{"other":1}')).status).toBe(400)
expect((await patch('{bad')).status).toBe(400)
} finally { rmSync(dataDir, { recursive: true, force: true }) }
diff --git a/cli/src/lib/agentAttribution.spec.ts b/cli/src/lib/agentAttribution.spec.ts
new file mode 100644
index 000000000..eb2eae3ae
--- /dev/null
+++ b/cli/src/lib/agentAttribution.spec.ts
@@ -0,0 +1,34 @@
+import { mkdtempSync, rmSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { afterEach, beforeEach, describe, expect, it } from 'vitest'
+import { AGENT_ATTRIBUTION_LINE, startedByAgentArgs } from './agentAttribution.js'
+import { writeAgentSettings } from './agentSettings.js'
+
+let dataDir = ''
+beforeEach(() => { dataDir = mkdtempSync(join(tmpdir(), 'agent-attribution-')) })
+afterEach(() => rmSync(dataDir, { recursive: true, force: true }))
+
+/** A Claude Code launch that reads no settings: nothing the person set, so Claude Code's own line and ours. */
+const place = { cwd: null, read: () => null }
+const claudeArgs = ['--settings', JSON.stringify({ attribution: { pr: `🤖 Generated with [Claude Code](https://claude.com/claude-code)\n${AGENT_ATTRIBUTION_LINE}` } })]
+
+describe('the pull request line of a harness another agent started', () => {
+ it('is the line the owner chose', () => {
+ expect(AGENT_ATTRIBUTION_LINE).toBe('🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.')
+ })
+
+ it('is given to a harness another agent started, and not to the person\'s', () => {
+ expect(startedByAgentArgs('claude', 'agent', place, dataDir)).toEqual(claudeArgs)
+ expect(startedByAgentArgs('claude', null, place, dataDir)).toEqual([])
+ expect(startedByAgentArgs('claude', undefined, place, dataDir)).toEqual([])
+ })
+
+ it('is not given once the person turned it off, and nothing is read for it; on again, it is', () => {
+ writeAgentSettings(dataDir, { pullRequestLine: false })
+ expect(startedByAgentArgs('claude', 'agent', { cwd: '/w', read: () => { throw new Error('read nothing') } }, dataDir)).toEqual([])
+ // Turning agents starting agents off is another setting: the line follows its own.
+ writeAgentSettings(dataDir, { pullRequestLine: true, agentsStartAgents: false })
+ expect(startedByAgentArgs('claude', 'agent', place, dataDir)).toEqual(claudeArgs)
+ })
+})
diff --git a/cli/src/lib/agentAttribution.ts b/cli/src/lib/agentAttribution.ts
new file mode 100644
index 000000000..896aba0fd
--- /dev/null
+++ b/cli/src/lib/agentAttribution.ts
@@ -0,0 +1,25 @@
+/**
+ * A harness another agent started says so in the pull requests it opens: one line beside the engine's own
+ * ("🤖 Generated with Claude Code"), so every reader of the pull request, and their agents, sees it was made in
+ * Harness (docs/design/2026-10-11-agent-client.md, "Pull requests"). A harness a person started is not marked.
+ *
+ * Who started a harness is its row's (`startedBy`, sent by `harness new` when an agent runs it); how each engine is
+ * told is its launch contract's (`EngineLaunch.attribution`, engines/launches.ts `attributionArgs`). The person turns
+ * it off for a computer with `harness settings pull-request-line off` (lib/agentSettings.ts), read at each launch, so
+ * a relaunch follows it too.
+ */
+import { env } from '../config/env.js'
+import { attributionArgs, type AttributionPlace } from '../engines/launches.js'
+import { readAgentSettings } from './agentSettings.js'
+
+/** The line: short and plain, as the engines' own are, and linked to Harness's site. */
+export const AGENT_ATTRIBUTION_LINE = '🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.'
+
+/** Who started a harness, as `agent_create` takes it and its row keeps it: another agent; absent, the person. */
+export type StartedBy = 'agent'
+
+/** A launch's argv for the line: for a harness another agent started, while the person has it on; else none. */
+export function startedByAgentArgs(engine: string, startedBy: StartedBy | null | undefined, place: AttributionPlace,
+ dataDir: string = env.ADAPTER_DATA_DIR): string[] {
+ return startedBy === 'agent' && readAgentSettings(dataDir).pullRequestLine ? attributionArgs(engine, AGENT_ATTRIBUTION_LINE, place) : []
+}
diff --git a/cli/src/lib/agentSettings.spec.ts b/cli/src/lib/agentSettings.spec.ts
index c90880722..42ae5f86b 100644
--- a/cli/src/lib/agentSettings.spec.ts
+++ b/cli/src/lib/agentSettings.spec.ts
@@ -10,22 +10,31 @@ afterEach(() => rmSync(dir, { recursive: true, force: true }))
describe('what the person lets agents do', () => {
it('lets agents start agents until the person turns it off', () => {
- expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true })
- expect(writeAgentSettings(dir, { agentsStartAgents: false })).toEqual({ agentsStartAgents: false })
- expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: false })
- expect(JSON.parse(readFileSync(agentSettingsPath(dir), 'utf8'))).toEqual({ version: 1, agentsStartAgents: false })
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true, pullRequestLine: true })
+ expect(writeAgentSettings(dir, { agentsStartAgents: false })).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ expect(JSON.parse(readFileSync(agentSettingsPath(dir), 'utf8'))).toEqual({ version: 1, agentsStartAgents: false, pullRequestLine: true })
expect(statSync(agentSettingsPath(dir)).mode & 0o777).toBe(0o600)
expect(AGENT_SETTING_NAMES['agents-start-agents']).toBe('agentsStartAgents')
})
+ it('adds a line to the pull requests of a harness another agent started until the person turns it off', () => {
+ expect(writeAgentSettings(dir, { pullRequestLine: false })).toEqual({ agentsStartAgents: true, pullRequestLine: false })
+ expect(readAgentSettings(dir).pullRequestLine).toBe(false)
+ // A file written before the setting existed: the default for it, and the other kept.
+ writeFileSync(agentSettingsPath(dir), '{"version":1,"agentsStartAgents":false}')
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ expect(AGENT_SETTING_NAMES['pull-request-line']).toBe('pullRequestLine')
+ })
+
it('applies only booleans it knows, and reads a broken file as the defaults', () => {
expect(writeAgentSettings(dir, null)).toBeNull()
expect(writeAgentSettings(dir, 'off')).toBeNull()
expect(writeAgentSettings(dir, { agentsStartAgents: 'no', other: true })).toBeNull()
- expect(writeAgentSettings(dir, { agentsStartAgents: false, other: true })).toEqual({ agentsStartAgents: false })
- writeFileSync(agentSettingsPath(dir), '{"agentsStartAgents": "nope"}')
- expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true })
+ expect(writeAgentSettings(dir, { agentsStartAgents: false, other: true })).toEqual({ agentsStartAgents: false, pullRequestLine: true })
+ writeFileSync(agentSettingsPath(dir), '{"agentsStartAgents": "nope", "pullRequestLine": 0}')
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true, pullRequestLine: true })
writeFileSync(agentSettingsPath(dir), 'not json')
- expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true })
+ expect(readAgentSettings(dir)).toEqual({ agentsStartAgents: true, pullRequestLine: true })
})
})
diff --git a/cli/src/lib/agentSettings.ts b/cli/src/lib/agentSettings.ts
index 7d9e5bb28..ad8b69858 100644
--- a/cli/src/lib/agentSettings.ts
+++ b/cli/src/lib/agentSettings.ts
@@ -2,7 +2,8 @@
* What the person lets agents do with Harness (docs/design/2026-10-11-agent-client.md), kept by the daemon in its data
* folder: `agent-settings.json`. Settings ▸ Agents writes it through the daemon (`/api/agent-settings`), `harness
* settings` from a terminal, and the daemon and the CLI read it: the daemon when it starts an agent (whether its
- * instructions say how to start others), `harness new` when an agent runs it (whether it may).
+ * instructions say how to start others, and whether one another agent started says so in its pull requests),
+ * `harness new` when an agent runs it (whether it may).
*
* Agents may start agents unless the person turns it off: some want every agent to work alone, under their eye.
* A file that is missing or that cannot be read is the defaults, never a refusal to work.
@@ -13,19 +14,23 @@ import { join } from 'node:path'
export interface AgentSettings {
/** Agents may start, wait for and close harnesses of their own, and are told how as they start. */
agentsStartAgents: boolean
+ /** A harness another agent started adds a line to the pull requests it opens (lib/agentAttribution.ts). Read at
+ * each launch of one, so a harness running when it is turned off keeps its line until it restarts. */
+ pullRequestLine: boolean
}
-export const AGENT_SETTINGS_DEFAULTS: AgentSettings = { agentsStartAgents: true }
+export const AGENT_SETTINGS_DEFAULTS: AgentSettings = { agentsStartAgents: true, pullRequestLine: true }
/** Each setting's name in `harness settings`, and its key. */
-export const AGENT_SETTING_NAMES: Record<string, keyof AgentSettings> = { 'agents-start-agents': 'agentsStartAgents' }
+export const AGENT_SETTING_NAMES: Record<string, keyof AgentSettings> = { 'agents-start-agents': 'agentsStartAgents', 'pull-request-line': 'pullRequestLine' }
export const agentSettingsPath = (dataDir: string): string => join(dataDir, 'agent-settings.json')
export function readAgentSettings(dataDir: string): AgentSettings {
try {
const saved = JSON.parse(readFileSync(agentSettingsPath(dataDir), 'utf8')) as Record<string, unknown>
- return { agentsStartAgents: typeof saved.agentsStartAgents === 'boolean' ? saved.agentsStartAgents : AGENT_SETTINGS_DEFAULTS.agentsStartAgents }
+ return Object.fromEntries(Object.entries(AGENT_SETTINGS_DEFAULTS)
+ .map(([key, fallback]) => [key, typeof saved[key] === 'boolean' ? saved[key] : fallback])) as unknown as AgentSettings
} catch {
return { ...AGENT_SETTINGS_DEFAULTS }
}
@@ -54,7 +59,7 @@ export function agentSettingsRoutes(dataDir: string): { read: () => Promise<{ st
read: async () => ({ status: 200, body: { ...readAgentSettings(dataDir) } }),
write: async (body) => {
const next = writeAgentSettings(dataDir, body)
- return next ? { status: 200, body: { ...next } } : { status: 400, body: { error: { code: 'BAD_REQUEST', message: 'Nothing to change: send {"agentsStartAgents": true|false}.' } } }
+ return next ? { status: 200, body: { ...next } } : { status: 400, body: { error: { code: 'BAD_REQUEST', message: 'Nothing to change: send {"agentsStartAgents": true|false} or {"pullRequestLine": true|false}.' } } }
},
}
}
diff --git a/cli/src/lib/createAgentPane.ts b/cli/src/lib/createAgentPane.ts
index 7cfa597a7..23045beab 100644
--- a/cli/src/lib/createAgentPane.ts
+++ b/cli/src/lib/createAgentPane.ts
@@ -20,6 +20,7 @@ import type { TerminalBackend } from './terminalBackend.js'
import type { TerminalCreateResult, TmuxRuntimeRef } from './terminalTypes.js'
import { terminalRouteKey } from './terminalRuntime.js'
import type { ExternalResumeIntent } from './externalResume.js'
+import type { StartedBy } from './agentAttribution.js'
const DEFAULT_MAX_ATTEMPTS = 3
@@ -44,6 +45,7 @@ export interface CreateAgentPaneDeps {
label?: string | null
forkedFrom?: ForkOrigin | null
externalResume?: ExternalResumeIntent
+ startedBy?: StartedBy | null
}) => RegisteredSession | null }
nativeToken?: string
engine: AgentEngine
@@ -78,6 +80,9 @@ export interface CreateAgentPaneDeps {
agent?: string | null
/** The agent this pane is a fork of (`agent_fork`), recorded on the row; null otherwise. */
forkedFrom?: ForkOrigin | null
+ /** `agent` when another agent started it, recorded on the row so every relaunch keeps its pull request line
+ * (lib/agentAttribution.ts). Already in `argv`: this is the record, not the launch. */
+ startedBy?: StartedBy | null
externalResume?: ExternalResumeIntent
/** Rechecked by the backend after its gates and immediately before process dispatch. */
current?: () => boolean
@@ -128,6 +133,7 @@ export async function createAndRegisterPane(deps: CreateAgentPaneDeps): Promise<
label: deps.label,
forkedFrom: deps.forkedFrom,
...(deps.externalResume ? { externalResume: deps.externalResume } : {}),
+ ...(deps.startedBy ? { startedBy: deps.startedBy } : {}),
})
if (pending) return { ok: true, spawned, pending }
console.warn(`[agent] create ${deps.engine} registration failed · pane ${spawned.runtime.paneId} · `
diff --git a/cli/src/lib/engineHomes.ts b/cli/src/lib/engineHomes.ts
index 81a8d5002..e7e39ee54 100644
--- a/cli/src/lib/engineHomes.ts
+++ b/cli/src/lib/engineHomes.ts
@@ -360,7 +360,14 @@ export function launchClaudeConfigDir(environment: NodeJS.ProcessEnv = launchEnv
/** The home an engine's launch contract declares (engines/facets/launch.ts `LaunchHome`), for a launch made now. */
export function launchHomeOf(home: LaunchHome, profile: string | null | undefined, environment: NodeJS.ProcessEnv = launchEnvironment()): string {
- return 'setting' in home ? launchHome(home.setting, profile, environment) : movedHome(environment[home.variable]) || movedHome(environment.HOME) || homedir()
+ if ('setting' in home) return launchHome(home.setting, profile, environment)
+ const personal = launchPersonalHome(environment)
+ return movedHome(environment[home.variable]) || (home.otherwise === 'home' ? personal : join(personal, home.otherwise.folder))
+}
+
+/** The person's home folder for a launch made now: the HOME its shell sets, else this process's. */
+export function launchPersonalHome(environment: NodeJS.ProcessEnv = launchEnvironment()): string {
+ return movedHome(environment.HOME) || homedir()
}
/** The environment that runs an agent on its own profile `home`, for an engine whose sessions follow one (its
diff --git a/cli/src/lib/launchOverrides.spec.ts b/cli/src/lib/launchOverrides.spec.ts
index 4da279c65..5cb87a5c5 100644
--- a/cli/src/lib/launchOverrides.spec.ts
+++ b/cli/src/lib/launchOverrides.spec.ts
@@ -4,6 +4,7 @@ import { buildLaunchOverrides, prepareLaunchOverrides, validateLaunchOverrides,
import { DSH_SESSION_ENV } from '../dsh/launch.js'
import { GRID_CONFLICTING_ENV_VARS, type GridLaunchOverride } from './gridLaunch.js'
import { gridLaunchInProcess } from '../testing/gridLaunchInProcess.js'
+import { AGENT_ATTRIBUTION_LINE } from './agentAttribution.js'
const GRID: GridLaunchOverride = {
networkId: 'grid-abc',
@@ -324,6 +325,32 @@ describe('buildLaunchOverrides — a pane opened as a named agent comes back as
})
})
+describe('buildLaunchOverrides — a harness another agent started keeps its pull request line', () => {
+ const pr = (args: string[]) => JSON.parse(args[args.indexOf('--settings') + 1]!).attribution.pr as string
+
+ it('appends it after everything else, on its own login and on a grid, read from the settings the relaunch reads', async () => {
+ const read = vi.fn((path: string) => path === '/workspace/.claude/settings.json' ? '{"attribution":{"pr":"Mine"}}' : null)
+ const own = await buildLaunchOverrides(deps({ readAttribution: read }).d, 'claude', { startedBy: 'agent', cwd: '/workspace' }, 'a')
+ expect(own.ok).toBe(true)
+ if (!own.ok) return
+ expect(own.overrides.extraArgs[0]).toBe('--settings')
+ expect(pr(own.overrides.extraArgs)).toBe(`Mine\n${AGENT_ATTRIBUTION_LINE}`)
+ expect(read).toHaveBeenCalledWith('/workspace/.claude/settings.local.json')
+ const grid = await buildLaunchOverrides(deps({ readAttribution: () => null }).d, 'codex', { startedBy: 'agent', gridLaunch: GRID, cwd: null }, 'a')
+ expect(grid.ok).toBe(true)
+ if (!grid.ok) return
+ expect(grid.overrides.extraArgs.at(-2)).toBe('-c')
+ expect(grid.overrides.extraArgs.at(-1)).toMatch(/^developer_instructions=".*Started by another agent in \[Harness\]/)
+ })
+
+ it('adds nothing for the person\'s harness, or for an engine with no way to say it', async () => {
+ const read = vi.fn(() => null)
+ expect(await buildLaunchOverrides(deps({ readAttribution: read }).d, 'claude', { startedBy: null, cwd: '/w' }, 'a')).toMatchObject({ ok: true, overrides: { extraArgs: [] } })
+ expect(await buildLaunchOverrides(deps({ readAttribution: read }).d, 'opencode', { startedBy: 'agent', cwd: '/w' }, 'a')).toMatchObject({ ok: true, overrides: { extraArgs: [] } })
+ expect(read).not.toHaveBeenCalled()
+ })
+})
+
describe('buildLaunchOverrides — opencode v2', () => {
const v2 = () => deps({ machine: () => ({ hermesSystemManaged: false, opencodeMajor: 2 }) }).d
diff --git a/cli/src/lib/launchOverrides.ts b/cli/src/lib/launchOverrides.ts
index c1407e2ad..adc97537f 100644
--- a/cli/src/lib/launchOverrides.ts
+++ b/cli/src/lib/launchOverrides.ts
@@ -33,6 +33,7 @@ import { harnessEnvToClear } from '../dsh/launch.js'
import type { DshLaunchAnswer } from '../dsh/launchWire.js'
import { scmLaunchEnv } from '../scm/scmProjects.js'
import type { ScmLaunchRecord } from '../scm/types.js'
+import { startedByAgentArgs, type StartedBy } from './agentAttribution.js'
import type { CreationAuthority } from './agentCreationReceipt.js'
import type { publishGridConfigDir } from './publishedGridConfig.js'
import { nativeHookLocations } from '../engines/kit/nativeLocations.js'
@@ -102,6 +103,9 @@ export interface LaunchOverridesDeps {
/** Prepare the saved harness context before restarting. Missing or broken packages refuse the
* relaunch: starting a plain agent would silently change the user's chosen harness. */
dshLaunch?: (dsh: string, workspace: string, engine: AgentEngine, runtimeKey: string) => Promise<DshLaunchAnswer>
+ /** Read an engine's settings for the pull request line (engines/launches.ts `attributionArgs`). A seam, like
+ * `readCodexConfig`: absent ⇒ the real file. */
+ readAttribution?: (path: string) => string | null
}
/** Where the agent should come back: the registry row, or an override the desktop just sent. */
@@ -132,6 +136,8 @@ export interface LaunchSource extends NativeLaunchSource {
* comes back as `harness-compute`, not as a general session with that agent's history.
*/
agent?: string | null
+ /** `agent` when another agent started it (the row's `startedBy`): every relaunch keeps its pull request line. */
+ startedBy?: StartedBy | null
}
/** Fresh each time: callers hand `env` to tmux and may extend it, and a shared object would carry
@@ -271,6 +277,12 @@ export async function prepareLaunchOverrides(
if (source.agent && supportsNamedAgent(engine, opencodeMajor)) {
overrides = { ...overrides, extraArgs: [...overrides.extraArgs, ...namedAgentArgs(engine, source.agent, opencodeMajor)] }
}
+ // A harness another agent started keeps its pull request line on every relaunch, in the slot `agent_create`
+ // gave it: last. Read again each time, with the person's switch and settings as they are now.
+ const attribution = startedByAgentArgs(engine, source.startedBy, {
+ cwd: source.cwd ?? null, profile: source.codexHome, environment: native?.environment, read: deps.readAttribution,
+ })
+ if (attribution.length) overrides = { ...overrides, extraArgs: [...overrides.extraArgs, ...attribution] }
return { ok: true, overrides: { ...overrides, ...(native ? { native, env: { ...overrides.env, ...native.environment } } : {}), clearEnv: [...overrides.clearEnv, ...harnessEnvToClear(overrides.env)] } }
} }
}
diff --git a/cli/src/lib/newCommand.spec.ts b/cli/src/lib/newCommand.spec.ts
index 56014a88b..2e19fbeac 100644
--- a/cli/src/lib/newCommand.spec.ts
+++ b/cli/src/lib/newCommand.spec.ts
@@ -226,6 +226,8 @@ describe('harness new: the daemon', () => {
const d = deps(['codex', '--name', 'reviewer', '--', 'review', 'it'], socket, { origin: async () => origin })
expect(await newCommand(d)).toBe(0)
expect(socket.sent[1]!.payload.prompt).toBe('[from lead on m2]\n\nreview it')
+ // The machine records that an agent started it: the pull requests it opens say so (lib/agentAttribution.ts).
+ expect(socket.sent[1]!.payload.startedBy).toBe('agent')
expect(created).toEqual([['m2', { id: 'a9', name: 'reviewer' }]])
expect(d.out[1]).toBe('Read it: harness show reviewer')
// No task: nothing to head.
@@ -244,9 +246,11 @@ describe('harness new: the daemon', () => {
expect(await newCommand(far)).toBe(0)
expect(far.err).toEqual(['its limits start from zero'])
// A person at a terminal: no origin, the old words.
- const person = deps(['codex'], new FakeSocket((frame) => frame.type === 'agent_create' ? { state: 'created', agent: { id: 'c1', name: 'x' } } : null), { origin: async () => null })
+ const atTerminal = new FakeSocket((frame) => frame.type === 'agent_create' ? { state: 'created', agent: { id: 'c1', name: 'x' } } : null)
+ const person = deps(['codex'], atTerminal, { origin: async () => null })
expect(await newCommand(person)).toBe(0)
expect(person.out[1]).toBe('Open it in Harness with ⌘O.')
+ expect(atTerminal.sent[1]!.payload).not.toHaveProperty('startedBy')
})
it('turns the machine\'s refusal into words, and a usage slip into the usage', async () => {
diff --git a/cli/src/lib/newCommand.ts b/cli/src/lib/newCommand.ts
index 8514bcd78..1c56ac553 100644
--- a/cli/src/lib/newCommand.ts
+++ b/cli/src/lib/newCommand.ts
@@ -354,7 +354,8 @@ export async function newCommand(deps: NewCommandDeps): Promise<number> {
if (typeof entry.engine === 'string' && entry.engine) baseEngine = entry.engine
}
const asked = origin && args.prompt ? { ...args, prompt: origin.prompt(args.prompt, machineId) } : args
- const payload = newAgentPayload(asked, cwd, baseEngine)
+ // Started by an agent: the machine records it, and the pull requests it opens say so (lib/agentAttribution.ts).
+ const payload: Record<string, unknown> = { ...newAgentPayload(asked, cwd, baseEngine), ...(origin ? { startedBy: 'agent' } : {}) }
let result = await session.request('agent_create', payload)
// A launch the daemon holds (a native launch waiting its turn) is still on its way: asked after until it is not,
// for a minute. Given up on at once, it could start later with an agent's task and no record of who started it
diff --git a/cli/src/lib/registry.spec.ts b/cli/src/lib/registry.spec.ts
index 6e9ba08bc..8e69b509f 100644
--- a/cli/src/lib/registry.spec.ts
+++ b/cli/src/lib/registry.spec.ts
@@ -2244,6 +2244,56 @@ describe('lastOpenedAt: when an app last opened the agent, on the daemon clock',
})
})
+describe('who started it', () => {
+ beforeEach(() => { dataDir = mkdtempSync(join(tmpdir(), 'adapter-startedby-')) })
+ afterEach(() => {
+ rmSync(dataDir, { recursive: true, force: true })
+ delete process.env.ADAPTER_DATA_DIR
+ delete process.env.CLAUDE_PROJECTS_DIR
+ delete process.env.CODEX_HOME
+ delete process.env.CURSOR_HOME
+ })
+
+ it('keeps a harness another agent started as one, on the row, on disk and after a reload; the person\'s has none', async () => {
+ const { registry, strictPersistedRow } = await loadRegistryModule()
+ registry.load()
+ const byAgent = registry.openPendingAgent({ engine: 'claude', runtimes: [{ backend: 'tmux', paneId: '%5' }], cwd: '/tmp/w', startedBy: 'agent' })!
+ const byPerson = registry.openPendingAgent({ engine: 'claude', runtimes: [{ backend: 'tmux', paneId: '%6' }], cwd: '/tmp/w', startedBy: null })!
+ expect(byAgent.startedBy).toBe('agent')
+ expect(byPerson).not.toHaveProperty('startedBy')
+ expect(strictPersistedRow(JSON.parse(JSON.stringify(byAgent)))?.startedBy).toBe('agent')
+ const { registry: reloaded } = await loadRegistryModule()
+ reloaded.load()
+ expect(reloaded.byAgent(byAgent.agentId)?.startedBy).toBe('agent')
+ expect(reloaded.byAgent(byPerson.agentId)).not.toHaveProperty('startedBy')
+ })
+
+ it('survives the hook that rebuilds the row, so a restart keeps the pull request line', async () => {
+ const transcriptPath = join(dataDir, 'session-started.jsonl')
+ writeFileSync(transcriptPath, '{}\n')
+ const { registry } = await loadRegistryModule()
+ registry.load()
+ const pending = registry.openPendingAgent({ engine: 'claude', runtimes: [{ backend: 'tmux', paneId: '%8' }], cwd: '/tmp/demo', startedBy: 'agent' })!
+ const bound = registry.register({ sessionId: 'session-started', transcriptPath, tmuxPane: '%8', cwd: '/tmp/demo' })
+ expect(bound?.entry.agentId).toBe(pending.agentId)
+ expect(bound?.entry.startedBy).toBe('agent')
+ expect(registry.byAgent(pending.agentId)?.startedBy).toBe('agent')
+ })
+
+ it('drops anything but another agent from a hand-edited row', async () => {
+ const { registry, strictPersistedRow } = await loadRegistryModule()
+ registry.load()
+ const entry = registry.openPendingAgent({ engine: 'claude', runtimes: [{ backend: 'tmux', paneId: '%7' }], cwd: '/tmp/w' })!
+ const row = JSON.parse(JSON.stringify(entry))
+ expect(strictPersistedRow({ ...row, startedBy: 'person' })).not.toHaveProperty('startedBy')
+ writeFileSync(join(dataDir, 'registry.json'), JSON.stringify([{ ...row, startedBy: 'someone' }]), { mode: 0o600 })
+ const { registry: reloaded } = await loadRegistryModule()
+ reloaded.load()
+ expect(reloaded.byAgent(entry.agentId)).toBeTruthy()
+ expect(reloaded.byAgent(entry.agentId)).not.toHaveProperty('startedBy')
+ })
+})
+
describe('fork origin record', () => {
beforeEach(() => { dataDir = mkdtempSync(join(tmpdir(), 'adapter-forkorigin-')) })
afterEach(() => {
diff --git a/cli/src/lib/registry.ts b/cli/src/lib/registry.ts
index fe701cf10..2970e6090 100644
--- a/cli/src/lib/registry.ts
+++ b/cli/src/lib/registry.ts
@@ -57,6 +57,7 @@ import { hardenPrivateStateFileIfPresent, readPrivateStateFile, secureStateDirec
import { mergeTerminalRuntimes, processIdentityKey, sameProcessIdentity, terminalPlacementKey, terminalRouteKey } from './terminalRuntime.js'
import type { HookTerminalHint, ProcessIdentity, TerminalRuntimeRef } from './terminalTypes.js'
import { externalReservations, externalResumePending, externalResumeIds, parseExternalResume, type ExternalResumeIntent } from './externalResume.js'
+import type { StartedBy } from './agentAttribution.js'
export type { ProcessIdentity } from './terminalTypes.js'
@@ -239,6 +240,12 @@ export interface RegisteredSession {
* other agent.
*/
forkedFrom?: ForkOrigin | null
+ /**
+ * `agent` when another agent started this harness (`harness new` from its pane); absent when the person did.
+ * Recorded once at creation and carried into every relaunch (`launchOverrides.ts`), whose argv then has the
+ * engine add a line to the pull requests it opens (lib/agentAttribution.ts). Never re-derived from the process.
+ */
+ startedBy?: StartedBy
/** Legacy launcher-owned snapshots may still contain this field. New records never write it. */
launcherId?: string
transcriptPath: string | null
@@ -607,7 +614,7 @@ export function strictPersistedRow(raw: unknown): RegisteredSession | null {
// Taken out of the spread and put back only when it is a real moment: the spread would otherwise
// carry a hand-edited string or a negative number straight into the frame's `toISOString()`.
// `forkedFrom` is out too, so an invalid one is dropped rather than spread back in as-is.
- const { identityHold: _identityHold, evidenceRevision: _revision, interpretationHold: _interpretation, admissionHold: _admission, lastOpenedAt: rawOpenedAt, closePlan: rawClosePlan, forkedFrom: rawForkedFrom, scmLaunch: rawScmLaunch, externalResume: _externalResume, ...rest } = row
+ const { identityHold: _identityHold, evidenceRevision: _revision, interpretationHold: _interpretation, admissionHold: _admission, lastOpenedAt: rawOpenedAt, closePlan: rawClosePlan, forkedFrom: rawForkedFrom, scmLaunch: rawScmLaunch, externalResume: _externalResume, startedBy: rawStartedBy, ...rest } = row
const lastOpenedAt = normalizedOpenedAt(rawOpenedAt)
// Out of the spread for the same reason: a half-formed record is dropped, never relaunched with.
const scmLaunch = parseScmLaunchRecord(rawScmLaunch)
@@ -628,6 +635,8 @@ export function strictPersistedRow(raw: unknown): RegisteredSession | null {
defaultName: normalizedDefaultName(row.defaultName),
agent: normalizedAgentName((row as { agent?: unknown }).agent),
...normalizedForkedFrom(rawForkedFrom),
+ // Out of the spread too: only `agent` is a harness another agent started; anything else is the person's.
+ ...(rawStartedBy === 'agent' ? { startedBy: 'agent' as const } : {}),
cwd: typeof row.cwd === 'string' ? row.cwd : null,
runtimes,
primaryRuntimeKey: normalizedPrimary,
@@ -1289,6 +1298,7 @@ class Registry {
...(raw.bypassPermission === true ? { bypassPermission: true } : {}),
...(permissionModeName(raw.permissionMode) ? { permissionMode: raw.permissionMode } : {}),
...(raw.terminalHost === true || engine === 'terminal' ? { terminalHost: true } : {}),
+ ...(raw.startedBy === 'agent' ? { startedBy: 'agent' as const } : {}),
transcriptPath,
defaultName: normalizedDefaultName(raw.defaultName),
title: titleDisplayName(typeof raw.title === 'string' ? raw.title : null),
@@ -1592,6 +1602,8 @@ class Registry {
/** The agent this one is a fork of — see RegisteredSession.forkedFrom. */
forkedFrom?: ForkOrigin | null
externalResume?: ExternalResumeIntent
+ /** Who started it — see RegisteredSession.startedBy. */
+ startedBy?: StartedBy | null
}): RegisteredSession | null {
if (this.writeBlocked) return null
const externalResume = input.externalResume === undefined ? undefined : parseExternalResume(input.externalResume)
@@ -1628,6 +1640,7 @@ class Registry {
...(permissionModeName(input.permissionMode) ? { permissionMode: input.permissionMode } : {}),
...(isTerminalEngine(input.engine) ? { terminalHost: true } : {}),
...normalizedForkedFrom(input.forkedFrom),
+ ...(input.startedBy === 'agent' ? { startedBy: 'agent' as const } : {}),
transcriptPath: null,
projectDir: basename(input.cwd ?? '') || agentId,
cwd: input.cwd ?? null,
@@ -1970,6 +1983,9 @@ class Registry {
dsh: existing?.dsh ?? null,
dshRuntime: existing?.dshRuntime ?? null,
agent: existing?.agent ?? null,
+ // Carried forward like `agent`: dropped at the first hook, a restart of a harness another agent started came
+ // back without its pull request line (found by e2e/agentClient.e2e.ts).
+ ...(existing?.startedBy ? { startedBy: existing.startedBy } : {}),
...(existing?.bypassPermission ? { bypassPermission: true } : {}),
...(existing?.permissionMode ? { permissionMode: existing.permissionMode } : {}),
...(existing?.resumeOnly ? { resumeOnly: true, launch: { state: 'ready' as const } } : {}),
diff --git a/docs/design/2026-10-11-agent-client.md b/docs/design/2026-10-11-agent-client.md
index 67b79c54a..f093799d3 100644
--- a/docs/design/2026-10-11-agent-client.md
+++ b/docs/design/2026-10-11-agent-client.md
@@ -89,7 +89,8 @@ limits, `close` and measurement read it.
It is a file the CLI appends to, not a field in the core's registry, so this first version changes nothing in the
core and can be removed whole. Like Agent Messages it is a collaboration scope, not a sandbox: any process of the
same user can write it. If agents use this, the record moves into the registry beside `forkedFrom`, and the
-windows can show it in the pane header.
+windows can show it in the pane header. The registry keeps one fact of it already, for the pull request line below:
+the row's `startedBy` is `agent`. Who, and the depth, stay in the file.
The task a harness is started with carries one header line, so the new harness knows it is from an agent and not
the person (the lamp team's tmux paste read as the owner's), and how to answer:
@@ -146,6 +147,38 @@ mcp_servers.harness…`) each listed the harnesses through it and were told "You
Signed out, all of this works: the daemon runs as this computer, and `harness new` now asks for that identity as
`harness start` does (#1183). It used to read the sign-in file alone and refuse.
+### Pull requests
+
+A harness an agent started adds one line to the pull requests it opens, beside the engine's own, so every reader of
+the pull request, and their agents, sees where it was made: the loop that spread "Generated with Claude Code"
+(approved by the owner, October 11). A harness the person started adds nothing.
+
+```
+🤖 Generated with [Claude Code](https://claude.com/claude-code)
+🤝 Started by another agent in [Harness](https://harness.autonomous.ai) — agents that run agents.
+```
+
+`harness new` from an agent's pane sends `startedBy: agent` with `agent_create`; the row keeps it, and every launch
+of that harness (create, restart, resume, restore, retarget) is given the line, read again each time
+(`lib/agentAttribution.ts`). A fork is the forker's and gets none. Each engine is told in its own words, declared on
+its launch contract (`EngineLaunch.attribution`) and applied by `engines/kit/attribution.ts`:
+
+- **Claude Code**: its own setting, `attribution.pr`, given with `--settings`. Set, it replaces Claude Code's line
+ (2.1.296: `pr: h.pr ?? <own line>`), so the value is Claude Code's line, or the person's own text, then ours.
+ `--settings` merges over the person's settings key by key, so their `attribution.commit` stays. Nothing is added
+ where they hid the line: `attribution: false`, `pr: ""`, or the older `includeCoAuthoredBy: false`, which setting
+ `pr` would end, bringing Claude Code's commit trailer back.
+- **Codex** has no setting for the text (0.162.1): its own line is an instruction in its developer message
+ (`<git_attribution>`), on or off by workspace. Ours goes the same way, `-c developer_instructions=…`, worded as
+ Codex words its own. `-c` replaces the person's value, so theirs comes first; one Harness cannot read exactly (a
+ multi-line string, an escape), or one a folder's own `.codex/config.toml` sets, is left alone and nothing is added.
+- Pull requests only: no commit trailer.
+
+The person turns it off per computer with `harness settings pull-request-line off`: `pullRequestLine` in
+`<data>/agent-settings.json`, beside `agentsStartAgents`, on by default and read at each launch, so a harness running
+then keeps its line until it restarts. `/api/agent-settings` reads and writes it too; Settings ▸ Agents does not show it
+yet, as a setting in the apps needs an agreed mockup first. Not covered yet: the other eleven engines (no contract),
+the orchestrator's harnesses, and a machine whose daemon predates `startedBy`, which ignores it.
## Limits