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.

fix(messages): Agent Messages off means off, a harness it started included (#1210)

Dee980ded740b56
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 234f0ce4f..3fe494289 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -9,7 +9,7 @@
{
"name": "harness",
"source": "./plugins/harness",
- "description": "Start, wait for, read, message and close other coding agents through Harness: the harness skill and Harness's MCP server.",
+ "description": "Start, wait for, read and close other coding agents through Harness: the harness skill and Harness's MCP server.",
"category": "development",
"tags": ["agents", "parallel", "codex", "claude-code", "orchestration"]
}
diff --git a/cli/e2e/agentClient.e2e.ts b/cli/e2e/agentClient.e2e.ts
index 4c3452766..1264413b5 100644
--- a/cli/e2e/agentClient.e2e.ts
+++ b/cli/e2e/agentClient.e2e.ts
@@ -1,8 +1,8 @@
/**
* 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). A harness it starts says so in the pull
+ * it, reads its answer, and closes it; it may not close one it did not start. Neither may message the other while no
+ * tab has Agent Messages on (owner, 2026-10-11: Agent Messages off means off). 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.
@@ -72,7 +72,7 @@ describe('Harness for agents, end to end', () => {
await backend?.close(); backend = undefined
})
- it('an agent sees, starts, waits for, reads, messages and closes a harness of its own', async () => {
+ it('an agent sees, starts, waits for, reads and closes a harness of its own, and may not message it with Agent Messages off', async () => {
const relay = await FakeBackend.start()
backend = relay
relay.addMachine(ME)
@@ -110,6 +110,7 @@ describe('Harness for agents, end to end', () => {
expect(started.code, started.err).toBe(0)
expect(started.out).toContain('Created kid on this computer')
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))
expect(ledger).toEqual([expect.objectContaining({ depth: 1, by: expect.objectContaining({ agentId: lead.id, name: 'lead' }), child: expect.objectContaining({ name: 'kid' }) })])
@@ -122,17 +123,22 @@ describe('Harness for agents, end to end', () => {
expect(shown.out).toContain('kid · Claude Code · ')
expect(shown.out).toContain('· idle · started by you')
expect(shown.out).toContain('asked: [from lead · Claude Code · ')
- expect(shown.out).toContain('the harness that started you. It reads your answer itself; to ask it something while you work: harness send lead "…"]')
+ expect(shown.out).toContain('the harness that started you. It reads your answer itself.]')
+ expect(shown.out).not.toContain('harness send')
expect(shown.out).toContain('hello kid')
expect((await run('ps')).out).toMatch(/\nkid +Claude Code +\w+ +you /)
- // No tab has Agent Messages on, and still the two message each other.
+ // No tab has Agent Messages on: neither messages the other, either way, as for any two harnesses. Since #1180 the
+ // two messaged each other with no tab, and the owner found agents talking before turning Agent Messages on.
+ const off = 'Agent Messages are off in this tab. The person turns them on with the chat icon on the tab'
const sent = await run('send', 'kid', 'Also check the footer.')
- expect(sent.code, sent.out + sent.err).toBe(0)
- expect(sent.out).toMatch(/→ kid: (queued|delivered)/)
+ expect(sent.code, sent.out + sent.err).toBe(1)
+ expect(sent.err).toContain(off)
const kid = ((await client.request<{ agents: Array<Record<string, any>> }>('agents_list', {}, 30_000)).agents).find((a) => a.name === 'kid')!
const back = await harness(d, String(kid.tmuxPane), ['send', 'lead', 'Footer checked.'])
- expect(back.code, back.out + back.err).toBe(0)
+ expect(back.code, back.out + back.err).toBe(1)
+ expect(back.err).toContain(off)
+ expect((await harness(d, String(kid.tmuxPane), ['send'])).err).toContain(off)
// It closes what it started, and only that; the harness it started may not close it.
const own = await run('close', 'lead')
diff --git a/cli/src/agentClient/commands.spec.ts b/cli/src/agentClient/commands.spec.ts
index a2e0dccc5..a963baa29 100644
--- a/cli/src/agentClient/commands.spec.ts
+++ b/cli/src/agentClient/commands.spec.ts
@@ -578,14 +578,17 @@ describe('harness new, run by an agent', () => {
expect(origin.next({})).toBe('')
})
- it('heads the task with who sent it, records what it started, and says how to follow it', async () => {
+ it('heads the task with who sent it, records what it started, and says how to follow it, never to message it', async () => {
const d = new FakeDaemon()
d.frames = [frame('lead', { engine: 'claude' })]
const h = harness(d)
const origin = (await agentOrigin(h.deps))!
expect(d.closed).toBe(true)
await expect(origin.check()).resolves.toBeUndefined()
- expect(origin.prompt('review it', 'm')).toBe('[from lead · Claude Code · studio, the harness that started you. It reads your answer itself; to ask it something while you work: harness send lead "…"]\n\nreview it')
+ // Being started by it is no way to message it (owner, 2026-10-11: Agent Messages off means off): the header
+ // invited the new harness to `harness send` its starter, and agents talked with no tab turned on.
+ expect(origin.prompt('review it', 'm')).toBe('[from lead · Claude Code · studio, the harness that started you. It reads your answer itself.]\n\nreview it')
+ expect(origin.prompt('review it', 'm')).not.toContain('harness send')
expect(origin.prompt('train it', 'mini')).toBe('[from lead · Claude Code · studio, the harness that started you. It reads your answer itself.]\n\ntrain it')
// A task longer than a first message holds: the whole of it in a file, its start in the message.
const long = `Review all of it. ${'x'.repeat(3_000)}`
@@ -600,7 +603,7 @@ describe('harness new, run by an agent', () => {
expect(h.ledger.all()).toEqual([{ at: NOW, depth: 1, by: { machineId: 'm', agentId: 'lead', name: 'lead', engine: 'claude' }, child: { machineId: 'm', agentId: 'kid', name: 'reviewer' } }])
await origin.created('m', { id: 'kid2', name: 7 })
expect(h.ledger.all()[1].child.name).toBe('')
- expect(origin.next({ id: 'kid', name: 'reviewer' })).toBe('Read it: harness show reviewer · wait for it: harness wait reviewer · message it: harness send reviewer "…"')
+ expect(origin.next({ id: 'kid', name: 'reviewer' })).toBe('Read it: harness show reviewer · wait for it: harness wait reviewer')
// A name that is a sentence, or Harness's own stand-in: the id's start instead.
expect(origin.next({ id: 'abcdef123456', name: 'Claude harness 10-11 8:38' })).toContain('harness show abcdef12 ·')
expect(origin.next({ id: 'abcdef123456', name: 'code review' })).toContain('harness show "code review" ·')
diff --git a/cli/src/agentClient/commands.ts b/cli/src/agentClient/commands.ts
index f16fb1b59..f4ec6a876 100644
--- a/cli/src/agentClient/commands.ts
+++ b/cli/src/agentClient/commands.ts
@@ -61,7 +61,7 @@ export const EXIT = { ok: 0, failed: 1, usage: 2, needsInput: 3, stopped: 4, tim
/** Set by `harness mcp` (mcp.ts) for the verbs it runs: their next steps are then named as its tools. */
export const VIA_MCP_ENV = 'HARNESS_VIA_MCP'
-const TOOL_OF = { ps: 'harness_list', show: 'harness_read', wait: 'harness_wait', send: 'harness_send', close: 'harness_close' } as const
+const TOOL_OF = { ps: 'harness_list', show: 'harness_read', wait: 'harness_wait', close: 'harness_close' } as const
/**
* A next step as the caller can take it: the shell's `harness show x`, or the tool `harness mcp` offers for it. An MCP
@@ -69,8 +69,8 @@ const TOOL_OF = { ps: 'harness_list', show: 'harness_read', wait: 'harness_wait'
* clean VM). [option] is a flag and its MCP argument: `--chars 9000` / `chars: 9000`.
*/
export function step(env: NodeJS.ProcessEnv, verb: keyof typeof TOOL_OF, name = '', option?: { flag: string; arg: string }): string {
- if (env[VIA_MCP_ENV] !== '1') return ['harness', verb, name, option?.flag, verb === 'send' ? '"…"' : ''].filter(Boolean).join(' ')
- const args = [name && `${verb === 'send' ? 'to' : verb === 'wait' ? 'names' : 'name'}: "${name}"`, option?.arg].filter(Boolean)
+ if (env[VIA_MCP_ENV] !== '1') return ['harness', verb, name, option?.flag].filter(Boolean).join(' ')
+ const args = [name && `${verb === 'wait' ? 'names' : 'name'}: "${name}"`, option?.arg].filter(Boolean)
return `${TOOL_OF[verb]}${args.length ? ` (${args.join(', ')})` : ''}`
}
@@ -541,9 +541,9 @@ async function liveFor(s: Setup, o: Opened, caller: Caller): Promise<Set<string>
return live
}
-/** How another harness names [caller] to `harness send`: its name when that is a plain word or two, else its id's
- * start. An unnamed harness is called by its session title, which is a sentence ("so we have built harness web,")
- * that a recipient list splits at the comma. */
+/** How a next step names a harness: its name when that is a plain word or two, else its id's start. An unnamed
+ * harness is called by its session title, which is a sentence ("so we have built harness web,") that `wait`'s list
+ * of names splits at the comma. */
export function addressOf(caller: Caller): string {
return /^[\w.-]+( [\w.-]+)?$/.test(caller.name) && caller.name.length <= 40 ? (caller.name.includes(' ') ? `"${caller.name}"` : caller.name) : caller.agentId.slice(0, 8)
}
@@ -579,15 +579,14 @@ export async function agentOrigin(deps: ClientDeps = {}, record: Rpc = messagesR
},
prompt: (text, machineId) => {
// Said once, at the top: the task is from an agent, not the person (the lamp team's tmux paste read as the
- // owner's). The answer route works where the two share a machine (Agent Messages' lineage scope).
+ // owner's). It reads the answer itself (`show`): an invitation to reply had the first eval's agent send its
+ // whole report back as a message as well, which would land in the middle of the starter's own turn. Nor is the
+ // new harness told to message it: being started by it gives no way to, only a tab with Agent Messages on does
+ // (owner, 2026-10-11: "Agent Messages off means off").
const here = machineId === o.where.machineId
- // It reads the answer itself (`show`): an invitation to reply had the first eval's agent send its whole report
- // back as a message as well, which would land in the middle of the starter's own turn. An agent outside Harness
- // has no pane for a message to reach.
- const reply = here && !caller.outside ? ` It reads your answer itself; to ask it something while you work: harness send ${addressOf(caller)} "…"` : ' It reads your answer itself.'
const header = caller.outside
- ? `[from ${caller.name} outside Harness · ${o.machine}, the agent that started you.${reply}]\n\n`
- : `[from ${caller.name} · ${engineName(caller.engine)} · ${o.machine}, the harness that started you.${reply}]\n\n`
+ ? `[from ${caller.name} outside Harness · ${o.machine}, the agent that started you. It reads your answer itself.]\n\n`
+ : `[from ${caller.name} · ${engineName(caller.engine)} · ${o.machine}, the harness that started you. It reads your answer itself.]\n\n`
if (header.length + text.length <= MAX_FIRST_PROMPT_CHARS) return header + text
// A first message holds 2,000 characters (engineLaunch.ts), and a task an agent hands on is often longer: the
// first eval's prompts were refused whole. The task goes in a file the new harness is told to read.
@@ -624,7 +623,7 @@ export async function agentOrigin(deps: ClientDeps = {}, record: Rpc = messagesR
},
next: (agent) => {
const at = addressOf({ machineId: '', agentId: String(agent.id ?? ''), name: String(agent.name ?? ''), engine: '' })
- return `Read it: ${step(s.env, 'show', at)} · wait for it: ${step(s.env, 'wait', at)}${caller.outside ? '' : ` · message it: ${step(s.env, 'send', at)}`}`
+ return `Read it: ${step(s.env, 'show', at)} · wait for it: ${step(s.env, 'wait', at)}`
},
}
}
diff --git a/cli/src/agentClient/ledger.spec.ts b/cli/src/agentClient/ledger.spec.ts
index 8f6fb4635..5c681d785 100644
--- a/cli/src/agentClient/ledger.spec.ts
+++ b/cli/src/agentClient/ledger.spec.ts
@@ -26,7 +26,7 @@ describe('the ledger of who started which harness', () => {
expect(ledger.depthOf({ machineId: 'm', agentId: 'x' })).toBe(0)
})
- it('answers parents, children, depth and links from what was appended', () => {
+ it('answers parents, children and depth from what was appended', () => {
const ledger = fresh()
ledger.append(row('lead', 'a'))
ledger.append(row('lead', 'b'))
@@ -34,11 +34,9 @@ describe('the ledger of who started which harness', () => {
expect(ledger.childrenOf({ machineId: 'm', agentId: 'lead' }).map((r) => r.child.agentId)).toEqual(['a', 'b'])
expect(ledger.parentOf({ machineId: 'm', agentId: 'a1' })?.by.agentId).toBe('a')
expect(ledger.depthOf({ machineId: 'm', agentId: 'a1' })).toBe(2)
- expect(ledger.linked({ machineId: 'm', agentId: 'a' }, { machineId: 'm', agentId: 'lead' })).toBe(true)
- expect(ledger.linked({ machineId: 'm', agentId: 'b' }, { machineId: 'm', agentId: 'a' })).toBe(false)
- expect(ledger.links({ machineId: 'm', agentId: 'a' })).toEqual([{ machineId: 'm', agentId: 'lead' }, { machineId: 'm', agentId: 'a1' }])
// Another machine's harness with the same id is another harness.
- expect(ledger.links({ machineId: 'other', agentId: 'a' })).toEqual([])
+ expect(ledger.childrenOf({ machineId: 'other', agentId: 'lead' })).toEqual([])
+ expect(ledger.parentOf({ machineId: 'other', agentId: 'a1' })).toBeNull()
expect(statSync(ledger.path).mode & 0o777).toBe(0o600)
})
diff --git a/cli/src/agentClient/ledger.ts b/cli/src/agentClient/ledger.ts
index 5fe0afa20..03d44f8e8 100644
--- a/cli/src/agentClient/ledger.ts
+++ b/cli/src/agentClient/ledger.ts
@@ -3,9 +3,9 @@
* agent started with `harness new`, appended by the CLI to the data folder of the daemon that owns the agent's
* pane. A harness with no line was started by the person.
*
- * Read by `harness ps` (who started each), by `new` and `stop` (limits, and which harnesses an agent may stop),
- * and by Agent Messages, which lets a harness and the harnesses it started message each other without a tab.
- * Like Agent Messages it is a collaboration scope, not a sandbox: any process of this user can write the file.
+ * Read by `harness ps` (who started each), and by `new` and `close` (limits, depth, and which harnesses an agent
+ * may close). It never lets two harnesses message each other: only a tab with Agent Messages on does (owner,
+ * 2026-10-11). It is a collaboration scope, not a sandbox: any process of this user can write the file.
*/
import { appendFileSync, mkdirSync, readFileSync, renameSync, statSync } from 'node:fs'
import { dirname, join } from 'node:path'
@@ -95,19 +95,4 @@ export class Ledger {
depthOf(m: LedgerMember): number {
return this.parentOf(m)?.depth ?? 0
}
-
- /** Whether one of the two started the other. */
- linked(a: LedgerMember, b: LedgerMember): boolean {
- return this.all().some((row) => (same(row.by, a) && same(row.child, b)) || (same(row.by, b) && same(row.child, a)))
- }
-
- /** The harnesses [m] may message without a tab: its parent and its children. */
- links(m: LedgerMember): LedgerMember[] {
- const out: LedgerMember[] = []
- for (const row of this.all()) {
- const other = same(row.by, m) ? row.child : same(row.child, m) ? row.by : null
- if (other && !out.some((o) => same(o, other))) out.push({ machineId: other.machineId, agentId: other.agentId })
- }
- return out
- }
}
diff --git a/cli/src/agentClient/mcp.spec.ts b/cli/src/agentClient/mcp.spec.ts
index ecd94cd79..8a00baf54 100644
--- a/cli/src/agentClient/mcp.spec.ts
+++ b/cli/src/agentClient/mcp.spec.ts
@@ -30,6 +30,12 @@ describe('harness mcp', () => {
expect(outside.every((t) => t.argv === undefined)).toBe(true)
expect((await names(true)).map((t) => t.name)).toContain('harness_send')
expect(await answer(call('harness_send', { to: 'x', text: 'y' }), deps())).toMatchObject({ error: { code: -32602 } })
+ // It reaches teammates in a tab with Agent Messages on, and nothing else: not a harness the agent started
+ // (owner, 2026-10-11: Agent Messages off means off).
+ const send = (await names(true)).find((t) => t.name === 'harness_send') as unknown as { description: string }
+ expect(send.description).toMatch(/teammate.*Agent Messages on.*Refused anywhere else, even to a harness you started/)
+ expect(INSTRUCTIONS).toContain('starting a harness does not let you message it')
+ expect(INSTRUCTIONS).not.toContain('Send follow-ups for the same work to the harness you started')
})
it('runs each tool as its verb', async () => {
@@ -75,11 +81,9 @@ describe('harness mcp', () => {
const mcp = { HARNESS_VIA_MCP: '1' }
expect(step(mcp, 'show', 'reviewer')).toBe('harness_read (name: "reviewer")')
expect(step(mcp, 'wait', 'reviewer')).toBe('harness_wait (names: "reviewer")')
- expect(step(mcp, 'send', 'reviewer')).toBe('harness_send (to: "reviewer")')
expect(step(mcp, 'ps')).toBe('harness_list')
expect(step(mcp, 'show', 'reviewer', { flag: '--chars 9000', arg: 'chars: 9000' })).toBe('harness_read (name: "reviewer", chars: 9000)')
expect(step({}, 'show', 'reviewer', { flag: '--chars 9000', arg: 'chars: 9000' })).toBe('harness show reviewer --chars 9000')
- expect(step({}, 'send', 'reviewer')).toBe('harness send reviewer "…"')
expect(step({}, 'ps')).toBe('harness ps')
})
diff --git a/cli/src/agentClient/mcp.ts b/cli/src/agentClient/mcp.ts
index eb280beb6..fcf7ec2fd 100644
--- a/cli/src/agentClient/mcp.ts
+++ b/cli/src/agentClient/mcp.ts
@@ -25,7 +25,7 @@ export const INSTRUCTIONS = `Harness runs coding agents (Claude Code, Codex) in
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.
-List first (harness_list). Send follow-ups for the same work to the harness you started for it, not a new one. Never give work to, or close, a harness you did not start: those are the person's.
+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.
Name every harness. Then wait for it (harness_wait), read its answer (harness_read), and close it when you are done (harness_close). Never ask a harness to publish, deploy, delete or push.`
@@ -93,8 +93,8 @@ export const TOOLS: Tool[] = [
},
{
name: 'harness_send',
- description: 'Send a message to a harness you started, while it works: a follow-up, a correction, more context.',
- inputSchema: schema({ to: { type: 'string', description: 'The harness\'s name.' }, text: { type: 'string' } }, ['to', 'text']),
+ description: 'Send a message to a teammate: a harness in the same tab as you, where the person turned Agent Messages on (the tab\'s chat icon). Refused anywhere else, even to a harness you started.',
+ inputSchema: schema({ to: { type: 'string', description: 'The teammate\'s name.' }, text: { type: 'string' } }, ['to', 'text']),
argv: (a) => ['send', str(a.to), typeof a.text === 'string' ? a.text : ''],
},
{
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 431f02ef7..f63dab283 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -139,8 +139,7 @@ Machine:
harness search <words> find the conversation on this computer that said them: every turn of
every harness, live or stopped (--limit=N, --json)
harness send <name> "text" from an agent's pane: message a teammate in this tab, when Agent Messages
- are on there (the tab's chat icon), or a harness it started;
- \`harness send\` alone lists who is here
+ are on there (the tab's chat icon); \`harness send\` alone lists who is here
harness ps [--all] the harnesses here: state, who started each, what each is about
harness show <name> a harness's state and last turn: what it was asked and what it answered
harness wait <name>[,<name>] wait until they stop working (--any, --timeout 30m); exit 3 = needs the person
diff --git a/cli/src/messages/command.ts b/cli/src/messages/command.ts
index 912fdd1e7..711292b8f 100644
--- a/cli/src/messages/command.ts
+++ b/cli/src/messages/command.ts
@@ -24,8 +24,8 @@ export const SEND_USAGE = `harness send — message your teammates in this tab
harness send <name>[,<name>] "text" message one or more teammates
harness send <name> --text-file PATH a longer message, from a file in the temporary folder (/tmp)
-Run it in your own harness pane. Agent Messages must be on in the tab (the chat icon on the tab), except
-between a harness and the harnesses it started on this machine.
+Run it in your own harness pane. Agent Messages must be on in the tab (the chat icon on the tab), even
+to message a harness you started.
Use --json for structured output.`
export interface SendArgs { names: string[]; text: string; json: boolean }
diff --git a/cli/src/messages/service.spec.ts b/cli/src/messages/service.spec.ts
index e4b05aecb..67ec36f61 100644
--- a/cli/src/messages/service.spec.ts
+++ b/cli/src/messages/service.spec.ts
@@ -9,7 +9,8 @@ import { PaneInbox } from './inbox.js'
import { deliveryKey } from './mailbox.js'
import { LIMITS, MessageError } from './model.js'
import type { Rpc } from './rpc.js'
-import { REMOTE_STATUS_MS, startAgentMessages, STARTED_TAB, SWEEP_AFTER_MS, TICK_MS } from './service.js'
+import { REMOTE_STATUS_MS, startAgentMessages, SWEEP_AFTER_MS, TICK_MS } from './service.js'
+import { MessageStore } from './store.js'
import { Ledger, ledgerPath } from '../agentClient/ledger.js'
let root: string
@@ -156,6 +157,22 @@ describe('harness send', () => {
expect(await down.ask({ action: 'send', pane: '%1', to: 'api', text: 'x' })).toMatchObject({ error: 'DIRECTORY_UNAVAILABLE' })
})
+ it('sends nothing when the tab turns Agent Messages off while it asks another machine for names', async () => {
+ let t: ReturnType<typeof setup>
+ t = setup({ rpc: async (_target, payload) => {
+ if (payload.action === 'who') {
+ t.tabs[0].enabled = false
+ t.notice({ type: 'desk_changed', revision: 5 })
+ await new Promise((settle) => setTimeout(settle, 0))
+ return { agents: [{ agentId: 'phone', name: 'phone', engine: 'claude' }] }
+ }
+ return { statuses: [] }
+ } })
+ expect(await t.ask({ action: 'send', pane: '%1', to: 'api', text: 'x' })).toEqual({ error: 'MESSAGES_OFF', detail: 'api is no longer in a tab with you that has Agent Messages on. Nothing was sent.' })
+ expect(t.delivered).toEqual([])
+ expect((await t.ask({ action: 'history' })).messages).toEqual([])
+ })
+
it('limits how often one harness sends, and tells the windows', async () => {
const t = setup()
for (let i = 0; i < LIMITS.perSender; i++) await t.ask({ action: 'send', pane: '%1', to: 'api', text: `n${i}` })
@@ -189,29 +206,75 @@ describe('harness send', () => {
})
describe('a harness and the harnesses it started', () => {
+ // Agent Messages off means off (owner, 2026-10-11): being started by a harness is no way to message it. Since #1180
+ // the two messaged each other with no tab at all, and the owner found agents talking before turning any tab on.
const start = (by: string, child: string, childMachine = 'm1') => new Ledger(ledgerPath(root)).append({
at: 1, depth: 1, by: { machineId: 'm1', agentId: by, name: by, engine: 'codex' }, child: { machineId: childMachine, agentId: child, name: child },
})
- it('message each other with no tab, both ways; others stay out of reach', async () => {
- const t = setup({ tabs: [{ id: 'app', name: 'app', enabled: false, panes: [{ machineId: 'm1', agentId: 'lead' }, { machineId: 'm1', agentId: 'api' }] }] })
- expect((await t.ask({ action: 'send', pane: '%1', to: 'web', text: 'x' })).error).toBe('MESSAGES_OFF')
+ it('may not message each other where no tab has Agent Messages on, either way', async () => {
+ const t = setup({ tabs: [{ id: 'app', name: 'app', enabled: false, panes: [{ machineId: 'm1', agentId: 'lead' }, { machineId: 'm1', agentId: 'web' }] }] })
+ start('lead', 'web')
+ expect(await t.ask({ action: 'send', pane: '%1', to: 'web', text: 'Also check the footer.' })).toMatchObject({ error: 'MESSAGES_OFF' })
+ expect(await t.ask({ action: 'send', pane: '%3', to: 'lead', text: 'Done: 3 fixes.' })).toMatchObject({ error: 'MESSAGES_OFF' })
+ // Nor does `harness send` alone list them.
+ expect(await t.ask({ action: 'send', pane: '%1' })).toMatchObject({ error: 'MESSAGES_OFF' })
+ const none = setup({ tabs: [] })
+ expect(await none.ask({ action: 'send', pane: '%1', to: 'web', text: 'x' })).toMatchObject({ error: 'MESSAGES_OFF' })
+ expect(t.delivered).toEqual([])
+ expect(none.delivered).toEqual([])
+ })
+
+ it('are refused as any other recipient outside the sender\'s tabs, and listed only as tab teammates', async () => {
+ // lead and api share a tab with Agent Messages on; web, which lead started, is in none.
+ const t = setup()
start('lead', 'web')
- const down = await t.ask({ action: 'send', pane: '%1', to: 'web', text: 'Also check the footer.' })
- expect(down).toMatchObject({ tab: STARTED_TAB.name, recipients: [{ name: 'web', state: 'queued' }] })
- expect(t.delivered.at(-1)).toEqual(['web', `[${String(down.id)} from lead · Codex · studio]\nAlso check the footer.`, expect.any(String)])
- const up = await t.ask({ action: 'send', pane: '%3', to: 'lead', text: 'Done: 3 fixes.' })
- expect(up.recipients).toEqual([{ name: 'lead', state: 'queued' }])
- expect((await t.ask({ action: 'send', pane: '%1', to: 'api', text: 'x' })).error).toBe('UNKNOWN_RECIPIENT')
- expect((await t.ask({ action: 'send', pane: '%2', to: 'web', text: 'x' })).error).toBe('MESSAGES_OFF')
+ start('lead', 'api')
+ const refused = await t.ask({ action: 'send', pane: '%1', to: 'web', text: 'x' })
+ expect(refused).toEqual({ error: 'UNKNOWN_RECIPIENT', detail: 'No teammate named "web" in this tab. Teammates: api, phone.' })
+ expect(await t.ask({ action: 'send', pane: '%3', to: 'lead', text: 'x' })).toMatchObject({ error: 'MESSAGES_OFF' })
const roster = await t.ask({ action: 'send', pane: '%1' })
- expect(roster.roster).toBe('[Harness] The harness that started you, and those you started:\n web Claude Code · studio · web\nMessage them: harness send <name> "…"')
+ expect(roster.roster).toContain('Teammates:')
+ expect(roster.roster).not.toMatch(/\bweb\b/)
+ expect(roster.roster).not.toContain('started you')
+ // A child in the tab is a teammate like any other: reached through the tab, and logged there.
+ const both = await t.ask({ action: 'send', pane: '%1', to: 'api', text: 'sync' })
+ expect(both).toMatchObject({ tab: 'app', recipients: [{ name: 'api', state: 'queued' }] })
+ expect(t.delivered.map(([agentId]) => agentId)).toEqual(['api'])
+ })
+
+ it('a message an older version queued between them under no tab is refused, not delivered', async () => {
+ vi.useFakeTimers()
+ // Queued by 0.3.75 under its `started` log, waiting in web's inbox for its hook.
+ const store = new MessageStore(join(root, 'state'))
+ const message = { id: 'm0000old', tabId: 'started', at: 1, text: 'Also check the footer.',
+ from: { machineId: 'm1', agentId: 'lead', name: 'lead', engine: 'codex', machine: 'studio' }, to: [{ machineId: 'm1', agentId: 'web', name: 'web' }] }
+ store.record(message)
+ store.status({ messageId: message.id, machineId: 'm1', agentId: 'web', state: 'queued', at: 1 })
+ const key = deliveryKey(message.id, 'web')
+ store.state.local.push({ key, messageId: message.id, agentId: 'web', pane: '%3', session: 's-web', state: 'queued', tries: 0, nextTryAt: 0, at: 1 })
+ store.save()
+ new PaneInbox(join(root, 'inbox-root')).put('%3', key, { session: 's-web', text: 'Also check the footer.' })
+ start('lead', 'web')
+ const t = setup()
+ expect(t.inbox.waiting('%3', key)).toBe(true)
+ t.service.start()
+ await vi.advanceTimersByTimeAsync(0)
+ expect(t.inbox.waiting('%3', key)).toBe(false)
+ expect(t.delivered).toEqual([])
+ const history = await t.ask({ action: 'history', tabId: 'started' })
+ expect((history.messages as Array<{ statuses: unknown[] }>)[0].statuses).toEqual([
+ expect.objectContaining({ machineId: 'm1', agentId: 'web', state: 'failed', reason: 'it is no longer in a tab with the sender' }),
+ ])
+ await vi.advanceTimersByTimeAsync(TICK_MS * 2)
+ expect(t.delivered).toEqual([])
+ t.service.stop()
})
- it('reach one another by the start of an id, for a harness whose name is a sentence', async () => {
+ it('reach a tab teammate by the start of its id, for a harness whose name is a sentence', async () => {
const titled = { ...session('abcdef99-1', '%3'), title: 'so we have built it, then' } as unknown as RegisteredSession
- const t = setup({ tabs: [], agents: [session('lead', '%1', 'codex'), titled] })
- start('abcdef99-1', 'lead')
+ const t = setup({ agents: [session('lead', '%1', 'codex'), titled],
+ tabs: [{ id: 'app', name: 'app', enabled: true, panes: [{ machineId: 'm1', agentId: 'lead' }, { machineId: 'm1', agentId: 'abcdef99-1' }] }] })
expect((await t.ask({ action: 'send', pane: '%1', to: 'abcdef', text: 'x' })).recipients).toEqual([{ name: 'so we have built it, then', state: 'queued' }])
// Too short to be an id's start.
expect((await t.ask({ action: 'send', pane: '%1', to: 'abcde', text: 'x' })).error).toBe('UNKNOWN_RECIPIENT')
@@ -227,6 +290,11 @@ describe('a harness and the harnesses it started', () => {
expect((await t.ask({ action: 'started', row: { ...row, by: { ...row.by, machineId: 'm1' } } }, OWNER_REMOTE)).error).toBe('INVALID_RECORD')
expect((await t.ask({ action: 'started' }, OWNER_REMOTE)).error).toBe('INVALID_RECORD')
expect((await t.ask({ action: 'started', row: { ...row, child: { ...row.child, agentId: 'nobody' } } }, OWNER_REMOTE)).error).toBe('UNKNOWN_HARNESS')
+ // The record lets neither message the other: phone is no teammate of web's.
+ const delivered = await t.ask({ action: 'deliver', message: { id: 'm00000bb', tabId: 'started', text: 'hi', at: 5,
+ from: { machineId: 'm2', agentId: 'phone', name: 'phone', engine: 'claude', machine: 'laptop' }, to: [{ machineId: 'm1', agentId: 'web', name: 'web' }] } }, OWNER_REMOTE)
+ expect(delivered.statuses).toEqual([expect.objectContaining({ agentId: 'web', state: 'failed' })])
+ expect(t.delivered).toEqual([])
})
it('stay apart across machines: another machine checks against its own tabs', async () => {
@@ -234,16 +302,6 @@ describe('a harness and the harnesses it started', () => {
start('lead', 'phone', 'm2')
expect((await t.ask({ action: 'send', pane: '%1', to: 'phone', text: 'x' })).error).toBe('MESSAGES_OFF')
})
-
- it('appear once beside their tab teammates, and the roster shows both', async () => {
- const t = setup()
- start('lead', 'api')
- start('lead', 'web')
- const roster = await t.ask({ action: 'send', pane: '%1' })
- expect(roster.roster).toMatch(/Teammates:[\s\S]*api[\s\S]*\n\n\[Harness\] The harness that started you, and those you started:\n web /)
- const both = await t.ask({ action: 'send', pane: '%1', to: 'api,web', text: 'sync' })
- expect(both).toMatchObject({ tab: 'app', recipients: [{ name: 'api' }, { name: 'web' }] })
- })
})
describe('from the owner\'s other machines', () => {
diff --git a/cli/src/messages/service.ts b/cli/src/messages/service.ts
index da219f37a..5fa4e67a0 100644
--- a/cli/src/messages/service.ts
+++ b/cli/src/messages/service.ts
@@ -5,6 +5,8 @@
* - `send`: from `harness send` in an agent's pane, over this machine's socket. The pane names the sender.
* - `deliver`, `status`, `who`: from the owner's other machines, over the paired relay.
* - `history`: the windows' log of a tab.
+ * - `started`: another machine's record of a harness it started here, for the agent client's limits and depth
+ * (agentClient/ledger.ts). It lets no one message anyone: only a tab with Agent Messages on does.
* Deliveries to this machine's agents are the mailbox's (mailbox.ts); a message for another machine's agent is
* handed to that machine's daemon, which owns its delivery and is asked what became of it.
*/
@@ -17,7 +19,7 @@ import type { RegisteredSession } from '../lib/registry.js'
import { MessageDirectory, type Member } from './directory.js'
import { PaneInbox } from './inbox.js'
import { Mailbox, type MailboxAgent } from './mailbox.js'
-import { LIMITS, MessageError, engineName, messageId, note, parseMessage, rendered, type DeliveryStatus, type Message, type Recipient, type Teammate } from './model.js'
+import { LIMITS, MessageError, messageId, note, parseMessage, rendered, type DeliveryStatus, type Message, type Recipient, type Teammate } from './model.js'
import { messagesRpc, type Rpc } from './rpc.js'
import { Ledger, ledgerPath, parseStarted } from '../agentClient/ledger.js'
import { MessageStore, type LocalDelivery } from './store.js'
@@ -30,7 +32,8 @@ export interface MessagesOptions {
rpc?: Rpc
/** The local socket's folder (`ADAPTER_DATA_DIR`) the other machines are reached through. */
dataDir?: string
- /** Who started which harness (agentClient/ledger.ts); an isolated fixture's own. */
+ /** Who started which harness (agentClient/ledger.ts), where another machine's `started` is kept; an isolated
+ * fixture's own. */
ledgerFile?: string
/** Something that decides whether a typed delivery may be written changed: the process tells the core. */
changed?: () => void
@@ -58,9 +61,6 @@ export const SWEEP_AFTER_MS = 10 * 60_000
const PANE = /^%\d{1,9}$/
const key = (m: Member): string => `${m.machineId}/${m.agentId}`
-const same = (a: Member, b: Member): boolean => a.machineId === b.machineId && a.agentId === b.agentId
-/** Where a message between a harness and one it started is kept: they need share no tab. */
-export const STARTED_TAB = { id: 'started', name: 'started' } as const
export function startAgentMessages(core: CoreApi, options: MessagesOptions = {}): AgentMessages {
const now = options.now ?? Date.now
@@ -68,13 +68,10 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
const self = (): string => core.daemon.machineId()
const at = (machineId: string) => ({ port: core.daemon.port, machineId, dataDir: options.dataDir ?? core.dataDir })
const store = new MessageStore(options.stateDir ?? join(core.dataDir, 'agent-messages'))
+ // Who started which harness is the agent client's (limits, depth, who may close what), never a way to message.
+ // Agent Messages off means off: a harness started by another reaches it only through a tab with Agent Messages
+ // on, like any teammate (owner, 2026-10-11, on finding agents messaging each other with no tab turned on).
const lineage = new Ledger(options.ledgerFile ?? ledgerPath(core.dataDir))
- /**
- * The harnesses [me] may message without a tab: the one that started it and those it started
- * (docs/design/2026-10-11-agent-client.md). This machine's only: another machine checks a delivery against its
- * own directory, and has no record of who started what here.
- */
- const linked = (me: Member): Member[] => (me.machineId === self() ? lineage.links(me).filter((m) => m.machineId === self()) : [])
const inbox = new PaneInbox(options.inboxRoot ?? env.HARNESS_AGENT_MESSAGES_DIR)
/** Other machines' names for their agents, with when they were asked. */
const who = new Map<string, { name: string; engine: string; project?: string; at: number }>()
@@ -125,8 +122,9 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
if (!entry) return 'the message is no longer kept'
if (!directory.current()) return null
const recipient = { machineId: self(), agentId: delivery.agentId }
+ // Only a tab with Agent Messages on carries a message: one an older version queued between a harness and one
+ // it started, under no tab (`started`), is refused here like any other.
if (directory.shared(entry.message.from, recipient)) return null
- if (linked(recipient).some((m) => same(m, entry.message.from))) return null
const tab = directory.current()!.tabs.find((t) => t.id === entry.message.tabId)
return tab && !tab.enabled ? 'Agent Messages were turned off in this tab' : 'it is no longer in a tab with the sender'
}
@@ -226,15 +224,6 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
return { recorded: true }
}
- /** The harnesses an agent started, or the one that started it, as `harness send` alone lists them. */
- function linkedNote(links: Member[]): string {
- const mates = links.map(teammate)
- const width = Math.max(...mates.map((t) => t.name.length))
- return ['[Harness] The harness that started you, and those you started:',
- ...mates.map((t) => ` ${t.name.padEnd(width)} ${[engineName(t.engine), t.machine, t.where].filter(Boolean).join(' · ')}`),
- 'Message them: harness send <name> "…"'].join('\n')
- }
-
function withdrawNote(agentId: string): void {
const pending = store.state.notes[agentId]
if (!pending) return
@@ -284,10 +273,8 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
if (!session) throw new MessageError('NOT_A_HARNESS', 'This pane is not a harness Harness knows. Run harness send from an agent\'s pane.')
if (!await directory.refresh()) throw new MessageError('DIRECTORY_UNAVAILABLE', 'Harness could not read which tabs have Agent Messages on. Try again in a moment.')
const me = { machineId: self(), agentId: session.agentId }
- const inTabs = directory.peers(me)
- const links = linked(me).filter((m) => !inTabs.some((p) => same(p, m)))
- const peers = [...inTabs, ...links]
- if (!directory.tabsOf(me).length && !links.length) throw new MessageError('MESSAGES_OFF', 'Agent Messages are off in this tab. The person turns them on with the chat icon on the tab, or the tab\'s right-click menu.')
+ const peers = directory.peers(me)
+ if (!directory.tabsOf(me).length) throw new MessageError('MESSAGES_OFF', 'Agent Messages are off in this tab. The person turns them on with the chat icon on the tab, or the tab\'s right-click menu.')
await learnNames(peers, true)
const mates = peers.map(teammate)
const names = (Array.isArray(payload.to) ? payload.to : typeof payload.to === 'string' ? payload.to.split(',') : [])
@@ -296,10 +283,7 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
// No recipient and no text: who is here, the rules, and this agent's last messages. An agent whose context
// was compacted asks this to learn again what it was told: seen on a real team, one rebuilt it from its team
// history in five commands.
- if (!names.length && !text) {
- const started = links.length ? linkedNote(links) : null
- return { roster: [rosterOf(session.agentId)?.text, started].filter(Boolean).join('\n\n') || 'No teammates in this tab yet.', recent: recentFor(me) }
- }
+ if (!names.length && !text) return { roster: rosterOf(session.agentId)?.text ?? 'No teammates in this tab yet.', recent: recentFor(me) }
if (!names.length) throw new MessageError('USAGE', 'Name who to message: harness send <name> "text"')
if (!text.trim()) throw new MessageError('USAGE', 'Write the message: harness send <name> "text"')
if (text.length > LIMITS.text) throw new MessageError('TOO_LONG', `A message holds at most ${LIMITS.text} characters.`)
@@ -309,7 +293,7 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
const exact = mates.filter((m) => m.name.toLowerCase() === wanted)
const prefix = exact.length ? exact : mates.filter((m) => m.name.toLowerCase().startsWith(wanted))
// Or the start of its id: a name is the session's title until someone names it, and a title can hold a comma,
- // which the recipient list splits on (a harness that started another tells it its id to answer to).
+ // which the recipient list splits on.
const found = prefix.length || wanted.length < 6 ? prefix : mates.filter((m) => m.member.agentId.toLowerCase().startsWith(wanted))
const list = mates.map((m) => m.name).join(', ') || 'nobody yet'
if (!found.length) throw new MessageError('UNKNOWN_RECIPIENT', `No teammate named "${name}" in this tab. Teammates: ${list}.`)
@@ -319,6 +303,10 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
}
}
if (recipients.length > LIMITS.recipients) throw new MessageError('TOO_MANY_RECIPIENTS', `A message goes to at most ${LIMITS.recipients} teammates.`)
+ // The first recipient's tab names the message's log. The directory can change while other machines are asked
+ // for names: a tab turned off, or left, meanwhile leaves none, and nothing is sent.
+ const tab = directory.shared(me, recipients[0])
+ if (!tab) throw new MessageError('MESSAGES_OFF', `${recipients[0].name} is no longer in a tab with you that has Agent Messages on. Nothing was sent.`)
const times = (sent.get(session.agentId) ?? []).filter((t) => now() - t < LIMITS.window)
if (times.length >= LIMITS.perSender) {
core.clients.windows({ type: 'messages_changed', payload: { limited: { machineId: self(), agentId: session.agentId } } })
@@ -328,7 +316,6 @@ export function startAgentMessages(core: CoreApi, options: MessagesOptions = {})
throw new MessageError('MAILBOX_FULL', 'Too many messages are waiting on this machine. Try again once some are delivered.')
}
sent.set(session.agentId, [...times, now()])
- const tab = directory.shared(me, recipients[0]) ?? STARTED_TAB
const message: Message = {
id: messageId(), tabId: tab.id, to: recipients, text, at: now(),
from: { ...me, name: core.agents.displayName(session) || session.agentId.slice(0, 8), engine: session.engine, machine: machineName(self()) },
diff --git a/docs/design/2026-10-11-agent-client.md b/docs/design/2026-10-11-agent-client.md
index 61a69a855..659fcad4a 100644
--- a/docs/design/2026-10-11-agent-client.md
+++ b/docs/design/2026-10-11-agent-client.md
@@ -3,8 +3,8 @@
October 11, 2026. First version built (branch `agent-client`).
Web, desktop, phone and `hn` are Harness for people. This is Harness for the agents running in it: a few
-`harness` verbs an agent calls from its shell to see other harnesses, start one, read it, wait for it, message
-it and close it. Same daemon, no screen.
+`harness` verbs an agent calls from its shell to see other harnesses, start one, read it, wait for it and close
+it. Same daemon, no screen.
## Why
@@ -46,7 +46,7 @@ harness ps [--all] # the harnesses here: state,
harness new [agent] [@machine] [folder] --name N -- <task> # exists; now knows when an agent runs it
harness show <name> [--chars N] # its state, the last ask and the answer
harness wait <name>[,<name>…] [--any] [--timeout 30m]
-harness send <name>[,<name>…] "text" # exists (Agent Messages); now also to what you started
+harness send <name>[,<name>…] "text" # exists (Agent Messages): teammates in a tab with it on, only
harness close <name> [--now] # save its screen and stop it; resumable
```
@@ -87,8 +87,10 @@ and one rule, in its startup note:
1. **Ownership first.** An agent may give work only to a harness it started, or to one in a tab with Agent
Messages on. A harness a person is driving is read-only to agents: `show` and `wait` it, never `send`.
2. **Then sameness.** If a harness it may use is on the same work on the same subject (the router's question),
- and is idle or resumable, send there: it holds the context. Otherwise `new`: unrelated work, work to run in
- parallel, another engine or machine, or the matching harness is busy with something else.
+ is idle or resumable, and is its teammate in a tab with Agent Messages on, send there: it holds the context.
+ Otherwise `new`: a follow-up with the fuller task, unrelated work, work to run in parallel, another engine or
+ machine, or the matching harness is busy with something else. Starting a harness gives no way to message it
+ (below, "Agent Messages off means off").
No Jev: Jev is for ⌘B only.
@@ -106,17 +108,19 @@ windows can show it in the pane header. The registry keeps one fact of it alread
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:
+the person (the lamp team's tmux paste read as the owner's), and that its answer is read where it is:
```
-[from lead · Claude Code · studio, the harness that started you. It reads your answer itself; to ask it something while you work: harness send lead "…"]
+[from lead · Claude Code · studio, the harness that started you. It reads your answer itself.]
Review 3f2a9c1 …
```
-The reply address is the name when it is a plain word or two, else the start of the id: an unnamed harness is
-called by its session title, a sentence that can hold the comma `harness send` splits recipients on (found in the
-live trial: "so we have built harness web,").
+Until October 11 the header went on `; to ask it something while you work: harness send lead "…"`, and `new`
+offered `message it: harness send kid`. Both are gone with the lineage exception (below). The names `new` offers
+for `show` and `wait` are the name when it is a plain word or two, else the start of the id: an unnamed harness is
+called by its session title, a sentence that can hold the comma `wait` splits names on (found in the live trial:
+"so we have built harness web,").
### Agents outside Harness
@@ -130,9 +134,8 @@ session is one caller in the record (`claude-code:<session>`), with the limits a
[from Claude Code outside Harness · studio, the agent that started you. It reads your answer itself.]
```
-It may close only what its session started. Nothing can message it, having no pane, so neither the header nor
-`new` tells anyone to. A person who runs `harness` through their agent (Claude Code's `!`) is that agent here; a
-plain terminal is the person.
+It may close only what its session started. Nothing can message it, having no pane. A person who runs `harness`
+through their agent (Claude Code's `!`) is that agent here; a plain terminal is the person.
An agent that installs Harness starts the daemon from its shell, and a tmux server the daemon starts hands its
environment to every pane: every harness would have been that agent's session, with its messaging token. The
@@ -144,9 +147,9 @@ server's environment as it removes harnessd's own (`lib/agentSessionEnv.ts`).
`harness mcp` serves the verbs as MCP tools on stdin and stdout, for agents that reach tools through MCP rather
than a shell (Claude Desktop, Cursor, Windsurf; Claude Code and Codex with the Harness plugin): `harness_list`,
`harness_start`, `harness_wait`, `harness_read`, `harness_close`, and `harness_send` only in a harness's own pane,
-since nothing can message an agent outside one. Each call runs the verb as `harness` in a process of its own, so
-the rules above decide what it may do, and the tool's answer is the text the verb prints. `initialize` carries the
-when-to-use rules as the server's instructions.
+since nothing can message an agent outside one, and then only to teammates in a tab with Agent Messages on. Each
+call runs the verb as `harness` in a process of its own, so the rules above decide what it may do, and the tool's
+answer is the text the verb prints. `initialize` carries the when-to-use rules as the server's instructions.
The server is one agent's session. An MCP server's environment need not name the session (Codex's does not), so the
server says it: `AI_AGENT` from the client's name in `initialize` (`codex-mcp-client` is Codex, `cursor-vscode`
@@ -243,22 +246,40 @@ No core change, no new service.
holds is asked after by its creation id for up to a minute, so a held launch is not left running with an agent's
task and no record. `new` also stopped printing "Created" for a launch the daemon refused or could not confirm.
Two starts at the same moment from one harness can both pass the limits: they count what was recorded before.
-- **`send`**: Agent Messages lets a harness and the harnesses it started message each other with no tab, on the
- same machine. It also takes the start of an id. Kept in a `started` log beside the tabs' logs. **Open for the
- owner:** these messages pass even when the person has turned Agent Messages off in a tab the two share, and no
- window shows the `started` log yet. Like every Agent Message they need the account's directory read.
+- **`send`**: nothing of its own. A harness messages another only where the person turned Agent Messages on in a
+ tab the two share, like any teammate (`harness send` also takes the start of an id there).
- **Another machine.** `new @mini` works as before; `show`, `wait` and `close` find a harness the caller started
there through its record and reach it over the paired relay.
+### Agent Messages off means off (owner, October 11, 2026)
+
+The first version let a harness and the harnesses it started message each other with no tab at all, on the same
+machine (the lineage exception), kept in a `started` log beside the tabs' logs, and the new harness's header invited
+it to. With CLI 0.3.75 live, the owner found agents messaging each other before turning Agent Messages on
+anywhere, and decided: **Agent Messages off means off; a harness started by another gets no exception.** A harness
+may message another only where the person turned Agent Messages on (the tab's chat icon), like any teammate.
+
+- `messages/service.ts` reads who started what only to keep another machine's record (`started`, for limits and
+ depth); `send`, `harness send` alone and delivery go through the tabs alone. A send to a harness one started, with
+ no shared tab on, is refused with the same words as any other recipient: `MESSAGES_OFF` in a tab with it off,
+ `UNKNOWN_RECIPIENT` ("No teammate named …") otherwise.
+- A message an older version queued under `started` is failed like one whose tab was turned off, its inbox file
+ withdrawn, as soon as the service reads the directory.
+- The record (`agent-client/started.jsonl`) stays: `ps`, the limits, the depth and `close` read it.
+- For a follow-up to a harness it started, an agent starts it with everything in the task, or, where Agent Messages
+ are on in its tab, sends.
+
### Verified
- Unit: the module (47 tests), `harness new` (17), Agent Messages (21, with lineage, id prefixes and the
- `started` record). An independent review found the `done` misreading, the day-long count of other machines'
- harnesses, the limits restarting on another machine, a caller taken for the person on errors, held launches and
- the ledger's compaction losing lines; each is fixed and tested above.
+ `started` record; since October 11 the lineage tests assert the refusal). An independent review found the `done`
+ misreading, the day-long count of other machines' harnesses, the limits restarting on another machine, a caller
+ taken for the person on errors, held launches and the ledger's compaction losing lines; each is fixed and tested
+ above.
- End to end on the real daemon with the fake engines (`e2e/agentClient.e2e.ts`, 10 s): from an agent's pane,
- `ps`, `new` with a task, `wait`, `show` (the header and the echoed answer), `send` both ways with no tab on,
- `close` refused for its own harness and for one its child did not start, then allowed for its child. The fake
+ `ps`, `new` with a task, `wait`, `show` (the header and the echoed answer), `send` both ways with no tab on
+ (refused since October 11), `close` refused for its own harness and for one its child did not start, then allowed
+ for its child. The fake
engine now takes a first message on the command line, as both CLIs do; it used to drop it.
- Live, on the owner's Mac from this session's own pane against the running daemon: `ps` (22 harnesses, 0.8 s),
`new claude --name probe-child -- "Reply with the single word ready"` (0.4 s), `wait` (idle in 7 s), `show`
@@ -291,4 +312,4 @@ answer itself). Not yet run: Codex as the starting agent, a red team, a held-out
An MCP server (a thin wrapper once the CLI holds), agents outside Harness (a Claude Code plugin, `npx`, the MCP
registries), the windows' tree of who started whom, `ps` across all machines (today: this one, and what you
-started elsewhere), parent and child messaging across machines.
+started elsewhere).
diff --git a/plugins/harness/.claude-plugin/plugin.json b/plugins/harness/.claude-plugin/plugin.json
index f36fbf03b..d6d377ed6 100644
--- a/plugins/harness/.claude-plugin/plugin.json
+++ b/plugins/harness/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "harness",
"displayName": "Harness",
- "description": "Start Claude Code, Codex and other coding agents as harnesses the person can watch, then wait for them, read their answers, message them and close them. Uses the Harness CLI.",
+ "description": "Start Claude Code, Codex and other coding agents as harnesses the person can watch, then wait for them, read their answers and close them. Uses the Harness CLI.",
"author": {
"name": "Autonomous",
"url": "https://harness.autonomous.ai"
diff --git a/plugins/harness/README.md b/plugins/harness/README.md
index b49df7a91..002d01f97 100644
--- a/plugins/harness/README.md
+++ b/plugins/harness/README.md
@@ -1,7 +1,7 @@
# Harness plugin for Claude Code, Codex and Cursor
Lets a coding agent use [Harness](https://harness.autonomous.ai/agents): start Claude Code, Codex and other agents
-as harnesses the person can watch, wait for them, read their answers, message them and close them.
+as harnesses the person can watch, wait for them, read their answers and close them.
It holds two things:
diff --git a/plugins/harness/skills/harness/SKILL.md b/plugins/harness/skills/harness/SKILL.md
index 69dd9975b..acee0d936 100644
--- a/plugins/harness/skills/harness/SKILL.md
+++ b/plugins/harness/skills/harness/SKILL.md
@@ -7,7 +7,7 @@ description: Harness runs coding agents (Claude Code, Codex and others) as harne
Harness runs coding agents in sessions of their own, called harnesses, and shows each one to the person in its
desktop, web and phone apps. With the `harness` command (or Harness's MCP tools) you can start harnesses, read
-them, wait for them, message them and close them.
+them, wait for them and close them, and message teammates in a tab where the person turned Agent Messages on.
## Is it here?
@@ -44,9 +44,10 @@ sub-agents: cheaper and faster. Everything you start appears in Harness, where t
2. You may give work only to a harness **you started**, or to a teammate in a tab with Agent Messages on
(`harness send` alone lists them). Never give work to, or close, a harness you did not start: those are the
person's. You may `show` and `wait` on them.
-3. Follow-ups for the same work go to the harness you started for it, if it is idle and you can message it (see
- below). Otherwise start a new one: for unrelated work, for work to run in parallel, for another agent or
- machine, or when the matching one is busy with something else.
+3. Put everything in the task when you start a harness: starting it does not let you message it. A follow-up
+ for the same work goes to it with `harness send` only if it is your teammate in a tab where the person turned
+ Agent Messages on (the tab's chat icon); otherwise start a new harness with the fuller task. Start a new one
+ too for unrelated work, for work to run in parallel, or for another agent or machine.
## The verbs
@@ -55,7 +56,7 @@ harness ps [--all] # the harnesses here
harness new [agent] [@machine] [folder] --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 follow-up to one you started (from inside a harness)
+harness send <name> "text" # a teammate in this tab, when Agent Messages are on there
harness close <name> [--now] # when you are done with one you started
```
@@ -75,8 +76,9 @@ harness close <name> [--now] # when you are done with one
## Inside a harness, or outside
-- **In a harness** (Harness made your terminal pane): `harness send` works, to what you started and to
- teammates in a tab with Agent Messages on, and the harnesses you start are told how to message you.
+- **In a harness** (Harness made your terminal pane): `harness send` works only to teammates in a tab where the
+ person turned Agent Messages on. A harness you started, or the one that started you, is no exception: with
+ Agent Messages off, put everything in the task and read the answer with `show`.
- **Outside Harness** (Claude Code or Codex in a terminal app, an editor or the person's own tmux): Harness tells
you by your session. `harness ps` says "You are Claude Code, outside Harness." and marks what this session
started as `you`; the limits below apply; and you may close only what this session started. Nothing can
diff --git a/website/public/agents/index.html b/website/public/agents/index.html
index e819516ef..b844bc9c4 100644
--- a/website/public/agents/index.html
+++ b/website/public/agents/index.html
@@ -54,7 +54,7 @@
<h1>Harness for agents</h1>
<p class="lead">This page is for coding agents, and for the people who set them up. Harness runs coding agents
(Claude Code, Codex and others) in terminal sessions called harnesses. From its own shell, an agent can start
- harnesses, wait for them, read their answers, message them and close them. The person sees every harness in
+ harnesses, wait for them, read their answers and close them. The person sees every harness in
the Harness app on their desktop, on the web and on their phone, and can watch it, answer it or stop it.</p>
<p class="note">A shorter, plain-text version is at <a href="/llms.txt">/llms.txt</a>.</p>
@@ -128,7 +128,8 @@ curl -fsSL https://raw.githubusercontent.com/autonomous-ai/openharness/main/plug
takes.</td></tr>
<tr><td><code>harness show NAME [--chars N]</code></td><td>Its state, the last thing it was asked, and its answer:
the text after its last tool call, the first 4,000 characters by default.</td></tr>
- <tr><td><code>harness send NAME "text"</code></td><td>A follow-up message to a harness you started. Works from
+ <tr><td><code>harness send NAME "text"</code></td><td>A message to a teammate in your tab, only when the person
+ has turned Agent Messages on there (the tab's chat icon). A harness you started is no exception. Works from
inside a harness.</td></tr>
<tr><td><code>harness close NAME [--now]</code></td><td>Save its screen and stop it. Its conversation is kept, and
the person can resume it. Refused while it is working, unless <code>--now</code>.</td></tr>
@@ -191,8 +192,9 @@ harness close reviewer</code></pre>
# … go on with your own work; harness new returned as soon as the harness started …
harness ps # is it still working?
harness wait reviewer &amp;&amp; harness show reviewer</code></pre>
- <p>To ask the same reviewer a follow-up from inside a harness, <code>harness send reviewer "…"</code>, then wait and
- show again: it still has the context. Otherwise start a new harness with the fuller task.</p>
+ <p>Starting a harness does not let you message it, so put everything in the task. For a follow-up, start a new
+ harness with the fuller task. Only where the person has turned Agent Messages on in the tab you share can you
+ ask it from inside a harness, with <code>harness send reviewer "…"</code>, then wait and show again.</p>
<h2 id="machines">Run on another machine</h2>
<pre><code>harness machines
@@ -202,9 +204,9 @@ harness new codex @mini ~/code/app --name train -- "Run the training script and
<h2 id="where">Inside a harness, or outside Harness</h2>
<ul>
- <li><strong>In a harness</strong> (Harness made your terminal pane): <code>harness send</code> works, to what you
- started and to teammates in a tab with Agent Messages on, and each harness you start is told how to message
- you.</li>
+ <li><strong>In a harness</strong> (Harness made your terminal pane): <code>harness send</code> works only to
+ teammates in a tab where the person turned Agent Messages on. A harness you started, or the one that started
+ you, is no exception.</li>
<li><strong>Outside Harness</strong> (Claude Code or Codex in a terminal app, an editor or the person's own tmux):
Harness tells you by your session, from what your agent sets in its shell. <code>harness ps</code> says
"You are Claude Code, outside Harness." and marks what this session started as <code>you</code>; the limits
@@ -231,7 +233,7 @@ harness new codex @mini ~/code/app --name train -- "Run the training script and
<tr><td><code>harness_read</code></td><td><code>name</code>, <code>chars?</code></td><td><code>harness show</code></td></tr>
<tr><td><code>harness_close</code></td><td><code>name</code>, <code>now?</code></td><td><code>harness close</code></td></tr>
<tr><td><code>harness_send</code></td><td><code>to</code>, <code>text</code>; offered only when the server runs
- inside a harness</td><td><code>harness send</code></td></tr>
+ inside a harness, and only to teammates in a tab with Agent Messages on</td><td><code>harness send</code></td></tr>
</tbody>
</table>
</div>
diff --git a/website/public/llms.txt b/website/public/llms.txt
index bb4e8a804..ef87f3343 100644
--- a/website/public/llms.txt
+++ b/website/public/llms.txt
@@ -1,6 +1,6 @@
# Harness
-> Harness runs coding agents (Claude Code, Codex and others) in terminal sessions called harnesses, on the person's own computers, and shows every one in its desktop, web and phone apps. An agent can start harnesses from its shell, wait for them, read their answers, message them and close them, while the person watches.
+> Harness runs coding agents (Claude Code, Codex and others) in terminal sessions called harnesses, on the person's own computers, and shows every one in its desktop, web and phone apps. An agent can start harnesses from its shell, wait for them, read their answers and close them, while the person watches.
Install on macOS or Linux, then start it. No account is needed for harnesses on this computer:
@@ -18,13 +18,13 @@ harness ps [--all] # the harnesses here: state,
harness new [agent] [@machine] [folder] --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 follow-up to one you started, from inside a harness
+harness send NAME "text" # a teammate in this tab, only when Agent Messages are on there
harness close NAME [--now] # save its screen and stop it; the conversation is kept
```
-`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. 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.
+`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; 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. 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