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.

harness new: an agent is told when Claude Code or Codex would ask the person to trust its folder (#1211)

Deeed1718ae8fc5
diff --git a/cli/e2e/agentClient.e2e.ts b/cli/e2e/agentClient.e2e.ts
index 1264413b5..3eb4f3449 100644
--- a/cli/e2e/agentClient.e2e.ts
+++ b/cli/e2e/agentClient.e2e.ts
@@ -9,7 +9,7 @@
*/
import { execFileSync, spawn } from 'node:child_process'
import { createInterface } from 'node:readline'
-import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
+import { appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import { join } from 'node:path'
import { afterEach, describe, expect, it, onTestFailed } from 'vitest'
import { LocalClient } from './harness/client.js'
@@ -103,12 +103,10 @@ describe('Harness for agents, end to end', () => {
expect(ps.out).toMatch(/^You are "lead" \(/)
expect(ps.out).toMatch(/\nlead +Claude Code +\w+ +person \(you\)/)
- // It starts a harness with a task, which reads who sent it.
- const kidDir = join(d.projectsDir, 'kid')
- mkdirSync(kidDir, { recursive: true })
- const started = await run('new', 'claude', kidDir, '--name', 'kid', '--', 'hello kid')
+ // It starts a harness with a task, which reads who sent it, in a project Harness makes for it.
+ const started = await run('new', 'claude', 'kid', '--name', 'kid', '--', 'hello kid')
expect(started.code, started.err).toBe(0)
- expect(started.out).toContain('Created kid on this computer')
+ expect(started.out).toContain(`Created kid on this computer in ${join(d.env.HOME!, 'harnesses', 'kid')}.`)
expect(started.out).toContain('Read it: harness show kid · wait for it: harness wait kid')
expect(started.out).not.toContain('harness send')
const ledger = readFileSync(join(d.dataDir, 'agent-client', 'started.jsonl'), 'utf8').trim().split('\n').map((line) => JSON.parse(line))
@@ -197,9 +195,7 @@ describe('Harness for agents, end to end', () => {
const ps = await run('ps')
expect(ps.code, ps.err).toBe(0)
expect(ps.out.split('\n')[0]).toBe('You are Claude Code, outside Harness.')
- const dir = join(d.projectsDir, 'helper')
- mkdirSync(dir, { recursive: true })
- const started = await run('new', 'claude', dir, '--name', 'helper', '--', 'check it')
+ const started = await run('new', 'claude', 'helper', '--name', 'helper', '--', 'check it')
expect(started.code, started.out + started.err).toBe(0)
// Nothing can message an agent with no pane: no `send` in what to do next.
expect(started.out).toContain('Read it: harness show helper · wait for it: harness wait helper')
@@ -244,11 +240,16 @@ describe('Harness for agents, end to end', () => {
const tools = (await server.request('tools/list')).result.tools.map((t: { name: string }) => t.name)
expect(tools).toEqual(['harness_list', 'harness_start', 'harness_wait', 'harness_read', 'harness_close'])
- const dir = join(d.projectsDir, 'mcp-kid')
- mkdirSync(dir, { recursive: true })
- const started = await server.call('harness_start', { task: 'hello from mcp', folder: dir, name: 'mcpkid' })
+ // An empty folder of its own: refused, with the project it can ask for instead.
+ const scratch = join(d.root, 'tmp', 'mcp-scratch')
+ mkdirSync(scratch, { recursive: true })
+ const scratchRefused = await server.call('harness_start', { task: 'hello from mcp', folder: scratch, name: 'mcpkid' })
+ expect(scratchRefused).toEqual({ isError: true, text: `Claude Code would ask the person to trust ${scratch} before it starts, and it is empty: `
+ + 'for scratch or new work give a project name instead — harness_start (project: "mcpkid", …) (Harness makes ~/harnesses/mcpkid, '
+ + 'which needs no approval). Nothing was started.' })
+ const started = await server.call('harness_start', { task: 'hello from mcp', project: 'mcp-kid', name: 'mcpkid' })
expect(started.isError, started.text).toBe(false)
- expect(started.text).toContain('Created mcpkid on this computer')
+ expect(started.text).toContain(`Created mcpkid on this computer in ${join(d.env.HOME!, 'harnesses', 'mcp-kid')}.`)
// Its next steps are named as the tools: an MCP client may have no shell to run `harness show` in.
expect(started.text).toContain('Read it: harness_read (name: "mcpkid") · wait for it: harness_wait (names: "mcpkid")')
const ledger = readFileSync(join(d.dataDir, 'agent-client', 'started.jsonl'), 'utf8').trim().split('\n').map((line) => JSON.parse(line))
@@ -269,6 +270,53 @@ describe('Harness for agents, end to end', () => {
client.close()
})
+ it('an agent is told, not left waiting, when Claude Code or Codex would ask the person to trust its folder', async () => {
+ // A Codex harness asked for a second opinion from Claude Code made `mktemp -d /tmp/shell-opinion.XXXX` and started
+ // Claude Code there, which stopped on its trust question: the agent could only report that it was waiting (a clean
+ // VM, CLI 0.3.75, 2026-10-11). The fake engines ask as the real ones do, of a folder their settings do not trust.
+ const d = await IsolatedDaemon.create({ trustPrompt: true })
+ daemon = d
+ onTestFailed(() => { console.log(`---- daemon log\n${d.log().split('\n').slice(-150).join('\n')}`) })
+ // Both engines have run here before: their settings exist, which is when Harness adds the folders it makes.
+ writeFileSync(join(d.env.HOME!, '.claude.json'), '{}')
+ appendFileSync(join(d.env.CODEX_HOME!, 'config.toml'), '')
+ await d.start()
+ // Codex in a terminal app: no pane, the session its shell names.
+ const run = (...args: string[]) => harness(d, '', args, { CODEX_THREAD_ID: 'lead-thread' })
+
+ // An empty folder of its own: refused before anything starts, with what to run instead.
+ const scratch = join(d.root, 'tmp', 'shell-opinion.e0ynGN')
+ mkdirSync(scratch, { recursive: true })
+ const refused = await run('new', 'claude', scratch, '--name', 'opinion', '--', 'a second opinion on the shell script')
+ expect(refused.code, refused.out).toBe(1)
+ expect(refused.err.trim()).toBe(`Claude Code would ask the person to trust ${scratch} before it starts, and it is empty: for scratch or new work `
+ + 'give a project name instead — harness new claude opinion --name opinion -- … (Harness makes ~/harnesses/opinion, which needs no '
+ + 'approval). Nothing was started.')
+ expect(JSON.parse((await run('ps', '--json')).out).harnesses).toEqual([])
+
+ // The project it names instead: Harness makes it, answers the question for it, and the work is done with nobody asked.
+ const started = await run('new', 'claude', 'opinion', '--name', 'opinion', '--', 'a second opinion on the shell script')
+ expect(started.code, started.out + started.err).toBe(0)
+ expect(started.out).toContain(`Created opinion on this computer in ${join(d.env.HOME!, 'harnesses', 'opinion')}.`)
+ expect(started.out).not.toContain('trust')
+ const waited = await run('wait', 'opinion', '--timeout', '2m')
+ expect(waited.out.trim(), waited.err).toBe('opinion: idle · read it: harness show opinion')
+ expect((await run('show', 'opinion')).out).toContain('a second opinion on the shell script')
+
+ // A folder with something in it may be just what the work needs: it starts, and the agent is told it waits for the person.
+ const work = join(d.root, 'work')
+ mkdirSync(work, { recursive: true })
+ writeFileSync(join(work, 'README.md'), 'the person\'s work\n')
+ const asked = await run('new', 'codex', work, '--name', 'checker', '--', 'check the readme')
+ expect(asked.code, asked.out + asked.err).toBe(0)
+ expect(asked.out).toContain(`Codex will ask the person to trust ${work} before it starts, so it waits for them until they answer `
+ + '(harness wait exits 3). For new work, a project name avoids this: harness new codex checker --name checker -- …')
+ const held = await run('wait', 'checker', '--timeout', '2m')
+ expect(held.code, held.out + held.err).toBe(3)
+ expect(held.out.trim()).toMatch(/^checker: needs-input · /)
+ expect((await run('close', 'opinion')).code).toBe(0)
+ })
+
it('an agent may not start a harness once the person turns that off', async () => {
const d = await IsolatedDaemon.create()
daemon = d
@@ -318,13 +366,13 @@ describe('Harness for agents, end to end', () => {
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)
+ expect((await run('new', 'claude', '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)
+ expect((await run('new', 'codex', 'kidx', '--name', 'kidx', '--', 'hello kidx')).code).toBe(0)
const kidx = await live('kidx')
// Codex, started by it: told how to use Harness, then told as Codex is told its own attribution, in one value.
expect(await commandsIn(d, String(kidx.tmuxPane))).toMatch(new RegExp(`-c developer_instructions="${ascii(HARNESS_INSTRUCTIONS)}.*When you create or update a pull request, .*\`${ascii(AGENT_ATTRIBUTION_LINE)}\``))
@@ -341,7 +389,7 @@ describe('Harness for agents, end to end', () => {
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)
+ expect((await run('new', 'claude', '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')
diff --git a/cli/packages/harness-mcp/README.md b/cli/packages/harness-mcp/README.md
index 235bf432f..74cf49608 100644
--- a/cli/packages/harness-mcp/README.md
+++ b/cli/packages/harness-mcp/README.md
@@ -9,7 +9,7 @@ harnesses, wait for them, read their answers and close them:
| Tool | What it does |
|---|---|
| `harness_list` | the harnesses here: state, who started each, what each is about |
-| `harness_start` | start an agent on a task in a folder, by name |
+| `harness_start` | start an agent on a task in a folder or a new project, by name |
| `harness_wait` | wait until harnesses stop working |
| `harness_read` | a harness's last ask and its answer |
| `harness_close` | close a harness you started |
diff --git a/cli/packages/harness-mcp/mcpb/manifest.json b/cli/packages/harness-mcp/mcpb/manifest.json
index 5f070c20d..dc8270d72 100644
--- a/cli/packages/harness-mcp/mcpb/manifest.json
+++ b/cli/packages/harness-mcp/mcpb/manifest.json
@@ -32,7 +32,7 @@
},
{
"name": "harness_start",
- "description": "Start a new harness: an agent in a session of its own, working on a task in a folder. Returns at once."
+ "description": "Start a new harness: an agent in a session of its own, working on a task in a folder, or in a new project Harness makes for it. Returns at once."
},
{
"name": "harness_wait",
diff --git a/cli/src/agentClient/mcp.spec.ts b/cli/src/agentClient/mcp.spec.ts
index 8a00baf54..118f19147 100644
--- a/cli/src/agentClient/mcp.spec.ts
+++ b/cli/src/agentClient/mcp.spec.ts
@@ -1,4 +1,5 @@
import { PassThrough } from 'node:stream'
+import { parseNewArgs } from '../lib/newCommand.js'
import { step } from './commands.js'
import { describe, expect, it } from 'vitest'
import { agentOfClient, answer, callerEnv, INSTRUCTIONS, mcpCommand, PROTOCOL_VERSIONS, result, type McpDeps, type Ran } from './mcp.js'
@@ -66,6 +67,31 @@ describe('harness mcp', () => {
])
})
+ it('starts a harness in a new project Harness makes when asked for one, or when given no folder', async () => {
+ // A folder was required, so Codex as an MCP client could only name one of its own: Claude Code, started in an empty
+ // ~/work, waited on its trust question (a clean VM, CLI 0.3.75, 2026-10-11).
+ const listed = ((await answer({ jsonrpc: '2.0', id: 1, method: 'tools/list' }, deps()))!.result as { tools: Array<{ name: string; inputSchema: { required: string[]; properties: Record<string, unknown> } }> })
+ .tools.find((tool) => tool.name === 'harness_start')!
+ expect(listed.inputSchema.required).toEqual(['task', 'name'])
+ expect(listed.inputSchema.properties).toHaveProperty('project')
+ expect(INSTRUCTIONS).toContain('For scratch or new work give it a project name (project), not a folder of your own')
+ const r = runner()
+ const d = deps({ run: r.run })
+ await answer(call('harness_start', { task: 'a second opinion', project: 'opinion', name: 'opinion' }), d)
+ await answer(call('harness_start', { task: 'go', name: 'quick', agent: 'codex', machine: 'mini' }), d)
+ await answer(call('harness_start', { task: 'go', name: 'both', folder: 'app', project: 'p' }), d)
+ expect(r.calls.map((c) => c.argv)).toEqual([
+ ['new', 'claude', '--new', 'opinion', '--name', 'opinion', '--task', 'a second opinion'],
+ ['new', 'codex', '@mini', '--new', '--name', 'quick', '--task', 'go'],
+ ['new', 'claude', '/work/here/app', '--new', 'p', '--name', 'both', '--task', 'go'],
+ ])
+ // As `harness new` reads them: a new project, one named by the clock, and a refusal to guess between the two.
+ const words = { cwd: '/work/here', home: '/home/me' }
+ expect(parseNewArgs(r.calls[0].argv.slice(1), words)).toMatchObject({ agent: 'claude', cwd: null, projectName: 'opinion', name: 'opinion' })
+ expect(parseNewArgs(r.calls[1].argv.slice(1), words)).toMatchObject({ agent: 'codex', machine: 'mini', cwd: null, projectName: '' })
+ expect(() => parseNewArgs(r.calls[2].argv.slice(1), words)).toThrow('Name a folder or a new project, not both.')
+ })
+
it('says whose session it is when the agent did not, and leaves a harness pane and a named session alone', () => {
const via = { HARNESS_VIA_MCP: '1' }
expect(callerEnv(deps({ env: { PATH: '/bin' } }), 'cursor-vscode')).toEqual({ PATH: '/bin', AI_AGENT: 'cursor', HARNESS_AGENT_SESSION: 'mcp-1', ...via })
diff --git a/cli/src/agentClient/mcp.ts b/cli/src/agentClient/mcp.ts
index fcf7ec2fd..7026dc3a9 100644
--- a/cli/src/agentClient/mcp.ts
+++ b/cli/src/agentClient/mcp.ts
@@ -23,7 +23,7 @@ export const PROTOCOL_VERSIONS = ['2025-11-25', '2025-06-18', '2025-03-26', '202
/** What an agent is told once, as it connects: when Harness is the right tool, and whose harnesses are whose. */
export const INSTRUCTIONS = `Harness runs coding agents (Claude Code, Codex) in sessions of their own, on this computer or the person's other machines. The person can watch and join every one in the Harness app.
-Start a harness (harness_start) for work that can run beside yours, needs another agent's view (a review, a second opinion from Codex), takes long, or belongs in its own folder. Do small, quick work yourself.
+Start a harness (harness_start) for work that can run beside yours, needs another agent's view (a review, a second opinion from Codex), takes long, or belongs in its own folder. Do small, quick work yourself. For scratch or new work give it a project name (project), not a folder of your own: Claude Code and Codex ask the person to trust a folder Harness did not make.
List first (harness_list). Put everything in the task: starting a harness does not let you message it. A follow-up goes by harness_send only to a teammate in a tab where the person turned Agent Messages on; otherwise start a new harness with the fuller task. Never give work to, or close, a harness you did not start: those are the person's.
@@ -55,17 +55,23 @@ export const TOOLS: Tool[] = [
},
{
name: 'harness_start',
- description: 'Start a new harness: an agent in a session of its own, working on [task] in [folder]. Returns at once; wait for it with harness_wait and read its answer with harness_read.',
+ description: 'Start a new harness: an agent in a session of its own, working on [task] in an existing [folder], or in a new [project] Harness makes for it. Returns at once; wait for it with harness_wait and read its answer with harness_read.',
inputSchema: schema({
task: { type: 'string', description: 'The whole task, as you would write it to a colleague: what to do, where, and what to answer with.' },
- folder: { type: 'string', description: 'The folder to work in: an absolute path, or one relative to where this server runs.' },
+ folder: { type: 'string', description: 'An existing folder to work in: an absolute path, or one relative to where this server runs. Claude Code and Codex ask the person to trust a folder Harness did not make, and wait until they answer.' },
+ project: { type: 'string', description: 'For scratch or new work, instead of folder: a name for a new project folder Harness makes (~/harnesses/<name>), which needs no approval. With neither, Harness names one.' },
name: { type: 'string', description: 'A short name to call it by (e.g. "reviewer"). Always give one.' },
agent: { type: 'string', enum: ['claude', 'codex'], description: 'Claude Code (default) or Codex.' },
machine: { type: 'string', description: 'Another of the person\'s machines, by name, to run it there.' },
- }, ['task', 'folder', 'name']),
+ }, ['task', 'name']),
argv: (a, cwd) => {
- const folder = str(a.folder)
- return ['new', str(a.agent) || 'claude', ...(str(a.machine) ? [`@${str(a.machine)}`] : []), isAbsolute(folder) || folder.startsWith('~') ? folder : resolve(cwd, folder || '.'),
+ // A folder was required, and a relative one was resolved against this server's folder, so an MCP agent could not
+ // ask for a project Harness makes: Codex started Claude Code in an empty ~/work, which waited on its trust question
+ // (a clean VM, CLI 0.3.75, 2026-10-11). Both given, `harness new` says to name one.
+ const folder = str(a.folder), project = str(a.project)
+ const where = folder ? [isAbsolute(folder) || folder.startsWith('~') ? folder : resolve(cwd, folder)] : []
+ return ['new', str(a.agent) || 'claude', ...(str(a.machine) ? [`@${str(a.machine)}`] : []), ...where,
+ ...(project || !folder ? ['--new', ...(project ? [project] : [])] : []),
'--name', str(a.name), '--task', typeof a.task === 'string' ? a.task : '']
},
},
diff --git a/cli/src/lib/newCommand.spec.ts b/cli/src/lib/newCommand.spec.ts
index 2da7d06f8..ec8015efa 100644
--- a/cli/src/lib/newCommand.spec.ts
+++ b/cli/src/lib/newCommand.spec.ts
@@ -1,6 +1,9 @@
import { describe, expect, it } from 'vitest'
import { EventEmitter } from 'node:events'
-import { newAgentPayload, newCommand, NewUsageError, parseNewArgs, resolveNewMachine, type NewCommandDeps, type NewSocket } from './newCommand.js'
+import { mkdirSync, mkdtempSync, realpathSync, symlinkSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { newAgentPayload, newCommand, NewUsageError, parseNewArgs, resolveNewMachine, trustAsked, type NewCommandDeps, type NewSocket } from './newCommand.js'
const env = { cwd: '/work/repo', home: '/home/me' }
@@ -131,6 +134,8 @@ function deps(argv: string[], socket: FakeSocket, over: Partial<NewCommandDeps>
],
connect: () => socket,
output: (line) => out.push(line), error: (line) => err.push(line),
+ // Never the engines' settings of whoever runs the tests.
+ env: { HOME: '/nonexistent/home', CODEX_HOME: '/nonexistent/codex' },
timeoutMs: 200, out, err, ...over,
}
}
@@ -327,3 +332,174 @@ describe('harness new: the daemon', () => {
expect(stopped.err[0]).toMatch(/harness start/)
})
})
+
+/** A computer's folders and its engines' settings under a throwaway root: Claude Code's `.claude.json` in its home and
+ * Codex's config.toml in its CODEX_HOME, as each has them once it has run. */
+function computer() {
+ const root = mkdtempSync(join(tmpdir(), 'new-trust-'))
+ const home = join(root, 'home'), codex = join(root, 'codex')
+ mkdirSync(join(home, 'harnesses'), { recursive: true })
+ mkdirSync(codex)
+ const claudeTrusts = (...folders: string[]) => writeFileSync(join(home, '.claude.json'),
+ JSON.stringify({ projects: Object.fromEntries(folders.map((folder) => [folder, { hasTrustDialogAccepted: true }])) }))
+ const codexTrusts = (...folders: string[]) => writeFileSync(join(codex, 'config.toml'),
+ folders.map((folder) => `[projects.${JSON.stringify(folder)}]\ntrust_level = "trusted"\n`).join('\n'))
+ claudeTrusts()
+ codexTrusts()
+ const folder = (name: string, ...files: string[]) => {
+ const dir = join(root, name)
+ mkdirSync(dir, { recursive: true })
+ for (const file of files) writeFileSync(join(dir, file), '')
+ return dir
+ }
+ return { root, home, env: { HOME: home, CODEX_HOME: codex }, claudeTrusts, codexTrusts, folder }
+}
+
+/** An agent starting harnesses, as agentClient/commands.ts `agentOrigin` is to `harness new`. */
+const agentStarting = () => {
+ const created: string[] = []
+ return {
+ created,
+ origin: {
+ check: async () => {},
+ prompt: (text: string) => text,
+ created: async (_machineId: string, agent: Record<string, unknown>) => { created.push(String(agent.id)); return null },
+ next: () => 'Read it: harness show it',
+ },
+ }
+}
+
+const creating = (agent: Record<string, unknown>) => new FakeSocket((frame) => frame.type === 'agent_create' ? { state: 'created', agent } : null)
+
+describe('harness new: a folder the engine would ask about', () => {
+ it('reads whether Claude Code or Codex will ask the person to trust a folder before it starts', async () => {
+ const c = computer()
+ const scratch = c.folder('scratch')
+ const work = c.folder('work', 'README.md')
+ for (const engine of ['claude', 'codex']) {
+ expect(await trustAsked(engine, scratch, c.home, c.env)).toBe('empty')
+ expect(await trustAsked(engine, work, c.home, c.env)).toBe('content')
+ // Empty and directly inside the projects root: Harness answers for it as the engine starts.
+ expect(await trustAsked(engine, c.folder('home/harnesses/review'), c.home, c.env)).toBeNull()
+ }
+ // Further down, it is the engine's question again.
+ expect(await trustAsked('claude', c.folder('home/harnesses/review/deeper'), c.home, c.env)).toBe('empty')
+ // Nothing to ask: an engine with no such question, a store harness's name, a folder that is not there (the machine says).
+ expect(await trustAsked('opencode', scratch, c.home, c.env)).toBeNull()
+ expect(await trustAsked('owner/kit', scratch, c.home, c.env)).toBeNull()
+ expect(await trustAsked('claude', join(c.root, 'missing'), c.home, c.env)).toBeNull()
+ })
+
+ it('takes the trust an engine has: by the path typed or the one it resolves to, from above, and by the repository', async () => {
+ const c = computer()
+ // macOS's /tmp is /private/tmp: a folder reached through a link, trusted as it resolves, or as it was typed.
+ const real = c.folder('real-scratch')
+ const typed = join(c.root, 'typed-scratch')
+ symlinkSync(real, typed)
+ c.claudeTrusts(realpathSync(real))
+ c.codexTrusts(typed)
+ expect(await trustAsked('claude', typed, c.home, c.env)).toBeNull()
+ expect(await trustAsked('codex', typed, c.home, c.env)).toBeNull()
+ // Claude Code's trust covers every folder below; Codex's is the folder's own, or its repository's.
+ c.claudeTrusts(realpathSync(c.root))
+ expect(await trustAsked('claude', c.folder('anywhere/below'), c.home, c.env)).toBeNull()
+ expect(await trustAsked('codex', c.folder('anywhere/else'), c.home, c.env)).toBe('empty')
+ const repo = c.folder('repo/.git').replace(/\/\.git$/, '')
+ const src = c.folder('repo/src', 'a.ts')
+ const worktree = c.folder('wt', 'a.ts')
+ writeFileSync(join(worktree, '.git'), `gitdir: ${realpathSync(repo)}/.git/worktrees/wt\n`)
+ const relative = c.folder('wt2', 'a.ts')
+ writeFileSync(join(relative, '.git'), 'gitdir: ../repo/.git/worktrees/wt2\n')
+ const submodule = c.folder('sub', 'a.ts')
+ writeFileSync(join(submodule, '.git'), 'gitdir: ../repo/.git/modules/sub\n')
+ for (const folder of [src, worktree, relative, submodule]) expect(await trustAsked('codex', folder, c.home, c.env)).toBe('content')
+ c.codexTrusts(realpathSync(repo))
+ for (const folder of [src, worktree, relative]) expect(await trustAsked('codex', folder, c.home, c.env)).toBeNull()
+ expect(await trustAsked('codex', submodule, c.home, c.env)).toBe('content')
+ })
+
+ it('refuses an agent an empty folder of its own, in words it can act on, before anything is started', async () => {
+ // A Codex harness asked for a second opinion from Claude Code made `mktemp -d /tmp/shell-opinion.XXXX` and started
+ // Claude Code there, which stopped on its trust question (a clean VM, CLI 0.3.75, 2026-10-11).
+ const c = computer()
+ const scratch = c.folder('shell-opinion.e0ynGN')
+ const { origin, created } = agentStarting()
+ const socket = new FakeSocket(() => null)
+ const shell = deps(['claude', scratch, '--name', 'opinion', '--', 'a second opinion'], socket, { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(shell)).toBe(1)
+ expect(shell.err).toEqual([`Claude Code would ask the person to trust ${scratch} before it starts, and it is empty: for scratch or new work `
+ + 'give a project name instead — harness new claude opinion --name opinion -- … (Harness makes ~/harnesses/opinion, which needs no '
+ + 'approval). Nothing was started.'])
+ expect(socket.sent.map((frame) => frame.type)).toEqual(['machine_select'])
+ expect(created).toEqual([])
+ // Through `harness mcp`: its tool, by the name it gave.
+ const viaMcp = deps(['codex', scratch, '--name', 'Second opinion', '--', 'a second opinion'], new FakeSocket(() => null),
+ { origin: async () => origin, env: { ...c.env, HARNESS_VIA_MCP: '1' }, home: c.home })
+ expect(await newCommand(viaMcp)).toBe(1)
+ expect(viaMcp.err).toEqual([`Codex would ask the person to trust ${scratch} before it starts, and it is empty: for scratch or new work `
+ + 'give a project name instead — harness_start (project: "Second-opinion", …) (Harness makes ~/harnesses/Second-opinion, which '
+ + 'needs no approval). Nothing was started.'])
+ // Unnamed, and asked for JSON.
+ const json = deps(['codex', scratch, '--json', '--', 'go'], new FakeSocket(() => null), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(json)).toBe(1)
+ expect(JSON.parse(json.out[0]!)).toEqual({ ok: false, error: expect.stringContaining('— harness new codex review -- … (Harness makes ~/harnesses/review,') })
+ // Trusted already, it starts.
+ c.claudeTrusts(realpathSync(scratch))
+ const trusted = deps(['claude', scratch, '--', 'go'], creating({ id: 'a1', name: 'opinion' }), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(trusted)).toBe(0)
+ expect(trusted.out).toEqual([`Created opinion on this computer in ${scratch}.`, 'Read it: harness show it'])
+ })
+
+ it('starts an agent\'s harness in a folder with content, and says it will wait for the person to trust it', async () => {
+ const c = computer()
+ const work = c.folder('work', 'README.md')
+ const { origin, created } = agentStarting()
+ const shell = deps(['codex', work, '--name', 'reviewer', '--', 'review it'], creating({ id: 'a1', name: 'reviewer' }), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(shell)).toBe(0)
+ expect(shell.out).toEqual([
+ `Created reviewer on this computer in ${work}.`,
+ `Codex will ask the person to trust ${work} before it starts, so it waits for them until they answer (harness wait exits 3). `
+ + 'For new work, a project name avoids this: harness new codex reviewer --name reviewer -- …',
+ 'Read it: harness show it',
+ ])
+ expect(created).toEqual(['a1'])
+ const viaMcp = deps(['claude', work, '--name', 'reviewer', '--', 'review it'], creating({ id: 'a2', name: 'reviewer' }),
+ { origin: async () => origin, env: { ...c.env, HARNESS_VIA_MCP: '1' }, home: c.home })
+ expect(await newCommand(viaMcp)).toBe(0)
+ expect(viaMcp.out[1]).toBe(`Claude Code will ask the person to trust ${work} before it starts, so it waits for them until they answer `
+ + '(harness_wait says needs-input). For new work, a project name avoids this: harness_start (project: "reviewer", …)')
+ const json = deps(['codex', work, '--json', '--', 'go'], creating({ id: 'a3', name: 'x' }), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(json)).toBe(0)
+ expect(JSON.parse(json.out[0]!)).toMatchObject({ ok: true, agent: { id: 'a3' }, note: expect.stringContaining('Codex will ask the person to trust') })
+ // Trusted: nothing to say.
+ c.codexTrusts(realpathSync(work))
+ const trusted = deps(['codex', work, '--', 'go'], creating({ id: 'a4', name: 'x' }), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(trusted)).toBe(0)
+ expect(trusted.out).toEqual([`Created x on this computer in ${work}.`, 'Read it: harness show it'])
+ })
+
+ it('leaves the person at a terminal, another machine, and a store harness\'s empty folder as they were', async () => {
+ const c = computer()
+ const scratch = c.folder('scratch')
+ const work = c.folder('work', 'README.md')
+ const { origin } = agentStarting()
+ // The person is there to answer the question.
+ const person = deps(['claude', scratch], creating({ id: 'p1', name: 'mine' }), { origin: async () => null, env: c.env, home: c.home })
+ expect(await newCommand(person)).toBe(0)
+ expect(person.out).toEqual([`Created mine on this computer in ${scratch}.`, 'Open it in Harness with ⌘O.'])
+ // Another machine's folders and settings are not here to read.
+ const far = deps(['claude', '@mini', scratch], creating({ id: 'f1', name: 'far' }), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(far)).toBe(0)
+ expect(far.out).toEqual([`Created far on Mac mini in ${scratch}.`, 'Read it: harness show it'])
+ // A store harness lays its template into an empty folder, which is then trusted; one with content is still asked about.
+ const store = (folder: string) => new FakeSocket((frame) => frame.type === 'dsh_list' ? { dsh: [{ id: 'owner/kit', engine: 'claude', installed: true }] }
+ : frame.type === 'agent_create' ? { state: 'created', agent: { id: 's1', name: 'kit' } } : null)
+ const empty = deps(['owner/kit', scratch], store(scratch), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(empty)).toBe(0)
+ expect(empty.out).toEqual([`Created kit on this computer in ${scratch}.`, 'Read it: harness show it'])
+ const full = deps(['owner/kit', work], store(work), { origin: async () => origin, env: c.env, home: c.home })
+ expect(await newCommand(full)).toBe(0)
+ expect(full.out[1]).toBe(`Claude Code will ask the person to trust ${work} before it starts, so it waits for them until they answer `
+ + '(harness wait exits 3). For new work, a project name avoids this: harness new owner/kit review -- …')
+ })
+})
diff --git a/cli/src/lib/newCommand.ts b/cli/src/lib/newCommand.ts
index a138d5949..2d4671fbd 100644
--- a/cli/src/lib/newCommand.ts
+++ b/cli/src/lib/newCommand.ts
@@ -1,8 +1,13 @@
import { randomUUID } from 'node:crypto'
-import { isAbsolute, join, resolve } from 'node:path'
+import { readdir, readFile, realpath } from 'node:fs/promises'
+import { dirname, isAbsolute, join, resolve } from 'node:path'
+import { VIA_MCP_ENV } from '../agentClient/commands.js'
+import { folderTrust } from '../engines/launchPrep.js'
import { ENGINES, type AgentEngine } from '../engines/types.js'
+import { engineName } from '../messages/model.js'
import { projectFolderSlug } from './agentNames.js'
import { permissionModeFlags } from './engineLaunch.js'
+import { projectsRoot } from './projectFolder.js'
/** Engine names, so an unknown word is judged rather than cast (the shape `registry.ts` uses). */
const ENGINE_NAMES: ReadonlySet<string> = new Set(ENGINES)
@@ -51,7 +56,9 @@ export const NEW_USAGE = [
' folder a path (/abs, ~/x, ./x, .): work there. Left out: the current directory.',
' With @machine, a path under THIS home is read as the same path under its home,',
' because the shell has already turned ~/x into /Users/you/x by the time it gets here',
- ' project-name any other second word: a new project ~/harnesses/<name> on that machine',
+ ' project-name any other second word: a new project ~/harnesses/<name> on that machine.',
+ ' For scratch or new work give one (harness new codex review -- …), not a folder',
+ ' of your own: Claude Code and Codex ask the person to trust a folder Harness did not make',
'',
' --new [name] a new project, named <name> or after the agent and the time',
' --mode <mode> auto (default), ask, plan or full, where the agent has it',
@@ -229,6 +236,9 @@ export interface NewCommandDeps {
/** Who is starting it, when an agent runs this from its pane (agentClient/commands.ts `agentOrigin`). */
origin?: () => Promise<NewOrigin | null>
sleep?: (ms: number) => Promise<void>
+ /** The caller's environment: whether `harness mcp` runs this, and where its engines keep their folder trust.
+ * This process's when left out. */
+ env?: NodeJS.ProcessEnv
}
/** An agent starting a harness (docs/design/2026-10-11-agent-client.md): its limits, the header its task carries,
@@ -262,6 +272,60 @@ function holdReason(result: Record<string, unknown>): string {
return typeof held?.detail === 'string' ? held.detail.replace(/[\x00-\x1f\x7f]/g, ' ').trim().slice(0, 500) : ''
}
+/**
+ * The other folders an engine may hold [real]'s trust under: the root of the git repository it is in, and a worktree's
+ * main repository. Codex keys a folder in a repository by that root, and a worktree by its main repository; read by the
+ * folder alone, every worktree of a repository Codex trusts would be said to be one it asks about.
+ */
+async function repositoryRoots(real: string): Promise<string[]> {
+ for (let dir = real; ; dir = dirname(dir)) {
+ // A directory is a repository's own `.git`; a file is a worktree's, naming its main repository's.
+ const dotGit = await readFile(join(dir, '.git'), 'utf8').catch((error: NodeJS.ErrnoException) => error.code === 'EISDIR' ? '' : null)
+ if (dotGit !== null) {
+ const gitdir = /^gitdir:\s*(.+?)\s*$/m.exec(dotGit)?.[1]
+ const main = gitdir ? /^(.+)\/\.git\/worktrees\/[^/]+\/?$/.exec(resolve(dir, gitdir))?.[1] : undefined
+ return main ? [dir, main] : [dir]
+ }
+ if (dirname(dir) === dir) return []
+ }
+}
+
+/**
+ * Whether [engine] will stop on its "Do you trust this folder?" question before it starts in [cwd] on this computer:
+ * 'empty' for an empty folder, 'content' for one with something in it. Null when it will not ask (it trusts the folder,
+ * asks no such question, or Harness answers it as the engine starts) and when the folder cannot be read, which the
+ * machine then says.
+ *
+ * Harness answers the question only for a folder it made empty, directly inside its projects root (core/agents/
+ * launches.ts): never for a folder anyone merely named, since Claude Code's trust is inherited downward and an empty
+ * `~/code` trusted once would cover every repository cloned under it later (OH-14). So an agent that made a scratch
+ * folder of its own (`mktemp -d`) started Claude Code on a question only the person could answer, and could only
+ * report that it was waiting (a clean VM, CLI 0.3.75, 2026-10-11).
+ */
+export async function trustAsked(engine: string, cwd: string, home: string, environment: NodeJS.ProcessEnv): Promise<'empty' | 'content' | null> {
+ const trust = ENGINE_NAMES.has(engine) ? folderTrust(engine as AgentEngine, null, environment) : null
+ if (!trust) return null
+ let real: string
+ let names: string[]
+ try { real = await realpath(cwd); names = await readdir(real) } catch { return null }
+ // By the path it is sent, as the daemon judges it.
+ if (names.length === 0 && dirname(cwd) === projectsRoot(home)) return null
+ // Typed or resolved: on macOS /tmp is /private/tmp, and an engine may hold either.
+ const keys = new Set([cwd, real, ...await repositoryRoots(real)])
+ if ([...keys].some((key) => trust.trusts(key))) return null
+ return names.length === 0 ? 'empty' : 'content'
+}
+
+/** [path] under [home] as `~/…`. */
+const tildeOf = (path: string, home: string): string => (path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path)
+
+/** How the caller starts [args] in a new project [project] instead: the shell's words, or the tool `harness mcp` offers. */
+function projectStep(args: NewArgs, project: string, env: NodeJS.ProcessEnv): string {
+ if (env[VIA_MCP_ENV] === '1') return `harness_start (project: "${project}", …)`
+ const name = args.name === null ? '' : ` --name ${/^[\w.-]+$/.test(args.name) ? args.name : JSON.stringify(args.name)}`
+ return `harness new ${args.agent} ${project}${name} -- …`
+}
+
/** One loopback session with the daemon: select the machine, then ask, one request at a time. */
export function daemonSession(deps: Pick<NewCommandDeps, 'port' | 'connect' | 'timeoutMs'>, machineId: string): Promise<{
request: (type: string, payload: Record<string, unknown>) => Promise<Record<string, unknown>>
@@ -327,15 +391,18 @@ export async function newCommand(deps: NewCommandDeps): Promise<number> {
deps.error('Harness is not running on this computer. Start it with `harness start`.')
return 1
}
+ const env = deps.env ?? process.env
try {
const origin = (await deps.origin?.()) ?? null
await origin?.check()
let machineId = deps.localMachineId
let machineLabel = 'this computer'
+ let local = true
if (args.machine !== null) {
const machine = resolveNewMachine(args.machine, await deps.listMachines())
machineId = machine.machineId
machineLabel = machine.current ? 'this computer' : machine.label
+ local = machine.current
}
if (!machineId) {
deps.error('This computer is not signed in to Harness. Run `harness login`.')
@@ -361,6 +428,30 @@ export async function newCommand(deps: NewCommandDeps): Promise<number> {
if (entry.installed === false) throw new Error(`Install it first: harness dsh install ${args.agent}`)
if (typeof entry.engine === 'string' && entry.engine) baseEngine = entry.engine
}
+ // An agent naming a folder Harness did not make: its engine may stop on a question only the person can answer.
+ // Read here, where the engine's settings are; another machine's are not, and the person at a terminal is there
+ // to answer it.
+ let trustNote: string | null = null
+ if (origin && local && cwd !== null) {
+ const store = args.agent.includes('/')
+ const engine = store ? baseEngine : args.agent
+ const asks = await trustAsked(engine, cwd, deps.home, env)
+ const project = projectFolderSlug(args.name ?? '') ?? 'review'
+ const instead = projectStep(args, project, env)
+ // Empty, it holds nothing the new harness needs: a project of its own does the same with no one asked. A store
+ // harness lays its template into an empty folder, and the folder is then trusted as it starts.
+ if (asks === 'empty' && !store) {
+ throw new Error(`${engineName(engine)} would ask the person to trust ${cwd} before it starts, and it is empty: `
+ + `for scratch or new work give a project name instead — ${instead} (Harness makes `
+ + `${tildeOf(join(projectsRoot(deps.home), project), deps.home)}, which needs no approval). Nothing was started.`)
+ }
+ // With content it may be just what the work needs, so it starts; the agent is told it will wait for the person.
+ if (asks === 'content') {
+ trustNote = `${engineName(engine)} will ask the person to trust ${cwd} before it starts, so it waits for them until `
+ + `they answer (${env[VIA_MCP_ENV] === '1' ? 'harness_wait says needs-input' : 'harness wait exits 3'}). `
+ + `For new work, a project name avoids this: ${instead}`
+ }
+ }
const asked = origin && args.prompt ? { ...args, prompt: origin.prompt(args.prompt, machineId) } : args
// 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' } : {}) }
@@ -409,12 +500,13 @@ export async function newCommand(deps: NewCommandDeps): Promise<number> {
const agent = (result.agent ?? {}) as Record<string, unknown>
const warning = await origin?.created(machineId, agent)
if (warning) deps.error(warning)
- if (args.json) deps.output(JSON.stringify({ ok: true, machineId, agent }))
+ if (args.json) deps.output(JSON.stringify({ ok: true, machineId, agent, ...(trustNote ? { note: trustNote } : {}) }))
else {
const project = (agent.project ?? {}) as Record<string, unknown>
const where = typeof project.cwd === 'string' ? ` in ${project.cwd}` : cwd ? ` in ${cwd}` : ''
const name = String(agent.name ?? agent.id ?? 'a harness')
deps.output(`Created ${name} on ${machineLabel}${where}.`)
+ if (trustNote) deps.output(trustNote)
deps.output(origin ? origin.next(agent) : 'Open it in Harness with ⌘O.')
}
return 0
diff --git a/plugins/harness/skills/harness/SKILL.md b/plugins/harness/skills/harness/SKILL.md
index acee0d936..236a55d09 100644
--- a/plugins/harness/skills/harness/SKILL.md
+++ b/plugins/harness/skills/harness/SKILL.md
@@ -53,7 +53,7 @@ sub-agents: cheaper and faster. Everything you start appears in Harness, where t
```
harness ps [--all] # the harnesses here
-harness new [agent] [@machine] [folder] --name <name> -- <task>
+harness new [agent] [@machine] [folder | project] --name <name> -- <task>
harness wait <name>[,<name>…] [--any] [--timeout 30m]
harness show <name> [--chars N] # its state, the last ask and its answer
harness send <name> "text" # a teammate in this tab, when Agent Messages are on there
@@ -64,6 +64,8 @@ harness close <name> [--now] # when you are done with one
changes. Every verb also takes the start of an id.
- `agent` is `claude` (the default), `codex`, or another agent installed on that machine. The folder defaults
to the current directory.
+- For scratch or new work, give a project name (`harness new codex review -- …`, which makes `~/harnesses/review`)
+ rather than a folder of your own: Claude Code and Codex ask the person to trust a folder Harness did not make.
- Put the whole task in `-- <task>`: what to do, where, what done looks like, and what to answer with. A task
holds 2,000 characters; for a longer one, write it to a file and name the file in the task.
- `wait` exits 0 when it is idle, 3 when it needs the person (a question or a permission: only the person
@@ -101,7 +103,7 @@ the answer. For several at once, start each with its own name and wait on all of
## Harness's MCP tools
If Harness's MCP server (`harness mcp`) is connected, its tools are the same verbs under the same rules:
-`harness_list` (ps), `harness_start` (new: task, folder and name, `agent` claude or codex, `machine`),
+`harness_list` (ps), `harness_start` (new: task, name, `folder` or `project`, `agent` claude or codex, `machine`),
`harness_wait` (up to 120 seconds by default and 600 at most; if they are still working, call it again),
`harness_read` (show), `harness_close` (close), and `harness_send` (send), offered only inside a harness.
diff --git a/website/public/agents/index.html b/website/public/agents/index.html
index b844bc9c4..9aa1257d8 100644
--- a/website/public/agents/index.html
+++ b/website/public/agents/index.html
@@ -119,9 +119,11 @@ curl -fsSL https://raw.githubusercontent.com/autonomous-ai/openharness/main/plug
<tr><td><code>harness ps [--all]</code></td><td>The harnesses on this machine: name, agent, state, who started it,
when it was last active, its folder and what it is about. <code>--all</code> adds the ones stopped in the
last week.</td></tr>
- <tr><td><code>harness new [agent] [@machine] [folder] --name NAME -- TASK</code></td><td>Start a harness and give
+ <tr><td><code>harness new [agent] [@machine] [folder | project] --name NAME -- TASK</code></td><td>Start a harness and give
it a task. <code>agent</code> is <code>claude</code> (the default), <code>codex</code>, or another agent
- installed there. The folder is the current directory when left out.</td></tr>
+ installed there. The folder is the current directory when left out. For scratch or new work, give a project
+ name (<code>harness new codex review -- …</code>) rather than a folder of your own: Claude Code and Codex ask
+ the person to trust a folder Harness did not make.</td></tr>
<tr><td><code>harness wait NAME[,NAME…] [--any] [--timeout 30m]</code></td><td>Wait until each harness stops
working. <code>--any</code> returns when the first one does. The timeout takes <code>90s</code>,
<code>30m</code> or <code>2h</code> (30 minutes by default); <code>0</code> waits as long as it
@@ -226,8 +228,9 @@ harness new codex @mini ~/code/app --name train -- "Run the training script and
<thead><tr><th>Tool</th><th>Arguments</th><th>Same as</th></tr></thead>
<tbody>
<tr><td><code>harness_list</code></td><td><code>all?</code></td><td><code>harness ps</code></td></tr>
- <tr><td><code>harness_start</code></td><td><code>task</code>, <code>folder</code>, <code>name</code>,
- <code>agent?</code> (<code>claude</code> or <code>codex</code>), <code>machine?</code></td><td><code>harness new</code></td></tr>
+ <tr><td><code>harness_start</code></td><td><code>task</code>, <code>name</code>, <code>folder?</code> or
+ <code>project?</code> (a new project for scratch or new work), <code>agent?</code> (<code>claude</code> or
+ <code>codex</code>), <code>machine?</code></td><td><code>harness new</code></td></tr>
<tr><td><code>harness_wait</code></td><td><code>names</code>, <code>any?</code>, <code>timeout_seconds?</code>
(120 by default, 600 at most; if they are still working, call it again)</td><td><code>harness wait</code></td></tr>
<tr><td><code>harness_read</code></td><td><code>name</code>, <code>chars?</code></td><td><code>harness show</code></td></tr>
diff --git a/website/public/llms.txt b/website/public/llms.txt
index ef87f3343..8dc5b846b 100644
--- a/website/public/llms.txt
+++ b/website/public/llms.txt
@@ -15,7 +15,7 @@ The commands an agent uses:
```
harness ps [--all] # the harnesses here: state, who started each, what each is about
-harness new [agent] [@machine] [folder] --name NAME -- TASK
+harness new [agent] [@machine] [folder | project] --name NAME -- TASK
harness wait NAME[,NAME…] [--any] [--timeout 30m] # exits 0 idle, 3 needs the person, 4 stopped or gone, 124 timed out
harness show NAME [--chars N] # its state, the last ask and its answer
harness send NAME "text" # a teammate in this tab, only when Agent Messages are on there
@@ -24,7 +24,7 @@ harness close NAME [--now] # save its screen and stop i
`harness mcp` serves the same as MCP tools over stdio (command `harness`, arguments `["mcp"]`): `harness_list`, `harness_start`, `harness_wait`, `harness_read`, `harness_close`, and `harness_send` inside a harness (teammates in a tab with Agent Messages on only). For clients that start servers with npx, `npx -y @autonomous-ai/harness-mcp` runs `harness mcp`, or, where Harness is not installed, offers one tool, `harness_setup`, that says how to install it.
-Start a harness for work that can run beside yours, needs another agent's view (a review, a second opinion from Codex), takes long, or belongs in its own folder; do small, quick work yourself. List first, name every harness, then wait, read and close it. Give work only to harnesses you started, and close only those; starting one does not let you message it, so put everything in the task; never answer a harness's question or permission prompt, and never ask one to publish, deploy, delete or push. An agent outside Harness (Claude Code or Codex in a terminal app or editor) is recognized by its session: it gets the same limits, may close only what its session started, and cannot be messaged.
+Start a harness for work that can run beside yours, needs another agent's view (a review, a second opinion from Codex), takes long, or belongs in its own folder; do small, quick work yourself. For scratch or new work, give a project name (`harness new codex review -- …`) rather than a folder of your own: Claude Code and Codex ask the person to trust a folder Harness did not make. List first, name every harness, then wait, read and close it. Give work only to harnesses you started, and close only those; starting one does not let you message it, so put everything in the task; never answer a harness's question or permission prompt, and never ask one to publish, deploy, delete or push. An agent outside Harness (Claude Code or Codex in a terminal app or editor) is recognized by its session: it gets the same limits, may close only what its session started, and cannot be messaged.
## For agents