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.

⌘B: take Jev's clear lead, and offer stopped sessions from the last week (#1143)

Deeedc2ed9df846
diff --git a/cli/src/lib/routeDecide.spec.ts b/cli/src/lib/routeDecide.spec.ts
index 1fb87e160..bffe55c1c 100644
--- a/cli/src/lib/routeDecide.spec.ts
+++ b/cli/src/lib/routeDecide.spec.ts
@@ -1,11 +1,11 @@
-// Where a typed task goes: Jev alone, asked once (sure at 0.6 → its session, or new work; else new work; not
+// Where a typed task goes: Jev alone, asked once (sure at 0.6, or a clear lead → its session, or new work; else new work; not
// asked at all → nothing decided), how a new harness is set up, what Jev is asked, and what is logged when it
// fails. Jev is a fake here: the question it is put and the answer it gives are the contract.
import { describe, expect, it, vi } from 'vitest'
import type { JevChoice, JevChoiceAnswer } from './jev/jevClient.js'
import { JevUnavailable } from './jev/jevClient.js'
-import { decideRoute, JEV_SURE_P, jevPick, type RouteDeps, type RouteInput, type RouteOption, type RouteSession } from './routeDecide.js'
+import { decideRoute, JEV_LEAD_OPTIONS, JEV_LEAD_P, JEV_LEAD_RATIO, JEV_SURE_P, jevPick, type RouteDeps, type RouteInput, type RouteOption, type RouteSession } from './routeDecide.js'
/** A choice of [choice] at [p] over [options], the rest shared evenly among the others. */
function said(choice: string, p: number, options: string[]): JevChoiceAnswer {
@@ -39,6 +39,31 @@ describe('Jev\'s pick', () => {
expect(jevPick(said('s0', 0.59, ['s0', 'new']), ['s0', 'new'])).toBeUndefined()
})
+ it('is a session below 0.6 when it leads clearly over six options or more: 0.4 or more, and twice the next, new work included', () => {
+ expect([JEV_LEAD_P, JEV_LEAD_RATIO, JEV_LEAD_OPTIONS]).toEqual([0.4, 2, 6])
+ const options = ['s0', 's1', 's2', 's3', 's4', 'new']
+ const lead = (p: number[]) => jevPick({ choice: 's0', probabilities: Object.fromEntries(options.map((id, i) => [id, p[i]])) }, options, true)
+ // The owner's desk, 2026-10-10: the right session at 0.45, the rest spread thin.
+ expect(lead([0.45, 0.15, 0.1, 0.05, 0.05, 0.2])).toBe('s0')
+ expect(lead([0.4, 0.2, 0.1, 0.05, 0.05, 0.2])).toBe('s0')
+ // Torn with new work, or with a session like it: new work.
+ expect(lead([0.45, 0.1, 0.05, 0.05, 0, 0.35])).toBeUndefined()
+ expect(lead([0.5, 0.3, 0.05, 0.05, 0, 0.1])).toBeUndefined()
+ // Never below 0.4, however thin the rest.
+ expect(lead([0.39, 0.01, 0.01, 0.01, 0.01, 0.01])).toBeUndefined()
+ // A "choice" that is not Jev's likeliest is not a lead.
+ expect(lead([0.45, 0.5, 0.05, 0, 0, 0])).toBeUndefined()
+ })
+
+ it('takes no lead over fewer than six options, or where it was not asked for', () => {
+ // 0.4 of four options is 0.6 somewhere else: no spread to excuse it.
+ const four = ['s0', 's1', 's2', 'new']
+ expect(jevPick({ choice: 's0', probabilities: { s0: 0.45, s1: 0.2, s2: 0.15, new: 0.2 } }, four, true)).toBeUndefined()
+ // The project and the agent fall back to the pane the person is in: the bar stands for them.
+ const six = ['p0', 'p1', 'p2', 'p3', 'p4', 'p5']
+ expect(jevPick({ choice: 'p0', probabilities: { p0: 0.45, p1: 0.15, p2: 0.1, p3: 0.1, p4: 0.1, p5: 0.1 } }, six)).toBeUndefined()
+ })
+
it('is nothing for an answer that is not a whole one over those options', () => {
expect(jevPick(undefined, ['s0'])).toBeUndefined()
expect(jevPick({ choice: 's0' } as unknown as JevChoiceAnswer, ['s0'])).toBeUndefined()
@@ -57,7 +82,7 @@ describe('where a task goes', () => {
const remote = jev({ target: said('s1', 0.8, TARGETS), project: said('p1', 0.9, ['p0', 'p1']), agent: said('a1', 0.9, ['a0', 'a1']) })
const verdict = await decideRoute(input({ projects: PROJECTS, agents: AGENTS }), { jev: remote })
// A session needs no project or agent: Jev's picks of them are not part of the verdict.
- expect(verdict).toEqual({ kind: 'session', id: 'a2', p: 0.8, trace: '2 sessions · jev: "Prometheus alerts" 0.80' })
+ expect(verdict).toEqual({ kind: 'session', id: 'a2', p: 0.8, trace: '2 sessions · jev: "Prometheus alerts" 0.80, then "billing retries" 0.10' })
expect(remote).toHaveBeenCalledOnce()
const [state, questions] = remote.mock.calls[0]!
expect(state).toEqual({ message: 'the prometheus alert fired again' })
@@ -165,7 +190,7 @@ describe('where a task goes', () => {
agent: said('a0', 0.65, ['a0', 'a1']),
})
const verdict = await decideRoute(input({ text: 'rename my photos by date', projects: PROJECTS, agents: AGENTS }), { jev: remote })
- expect(verdict).toEqual({ kind: 'new', project: '/code/infra', agent: 'claude', via: 'jev', why: 'Jev: new work', trace: '2 sessions · jev: "new" 0.90' })
+ expect(verdict).toEqual({ kind: 'new', project: '/code/infra', agent: 'claude', via: 'jev', why: 'Jev: new work', trace: '2 sessions · jev: "new" 0.90, then "billing retries" 0.05' })
})
it('leaves the project and the agent to the caller when Jev is not sure of them, or did not answer them', async () => {
@@ -175,7 +200,7 @@ describe('where a task goes', () => {
agent: said('a1', 0.4, ['a0', 'a1']),
})
const verdict = await decideRoute(input({ projects: PROJECTS, agents: AGENTS }), { jev: remote })
- expect(verdict).toEqual({ kind: 'new', via: 'jev', why: 'Jev: new work', trace: '2 sessions · jev: "new" 0.90' })
+ expect(verdict).toEqual({ kind: 'new', via: 'jev', why: 'Jev: new work', trace: '2 sessions · jev: "new" 0.90, then "billing retries" 0.05' })
const silent = await decideRoute(input({ projects: PROJECTS, agents: AGENTS }), { jev: jev({ target: said('new', 0.9, TARGETS) }) })
expect(silent).not.toHaveProperty('project')
expect(silent).not.toHaveProperty('agent')
@@ -183,22 +208,43 @@ describe('where a task goes', () => {
it('is new work when Jev is not sure where it goes, still in the project and with the agent Jev is sure of', async () => {
const remote = jev({
- target: said('s0', 0.5, TARGETS),
+ target: { choice: 's0', probabilities: { s0: 0.5, s1: 0.3, new: 0.2 } },
project: said('p0', 0.9, ['p0', 'p1']),
agent: said('a1', 0.8, ['a0', 'a1']),
})
const verdict = await decideRoute(input({ projects: PROJECTS, agents: AGENTS }), { jev: remote })
- expect(verdict).toEqual({ kind: 'new', project: '/code/billing', agent: 'codex', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "billing retries" 0.50' })
+ expect(verdict).toEqual({ kind: 'new', project: '/code/billing', agent: 'codex', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "billing retries" 0.50, then "Prometheus alerts" 0.30' })
})
it('is new work Jev was not sure of when Jev leans to new work below the bar', async () => {
- const verdict = await decideRoute(input(), { jev: jev({ target: said('new', 0.55, TARGETS) }) })
- expect(verdict).toEqual({ kind: 'new', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "new" 0.55' })
+ const verdict = await decideRoute(input(), { jev: jev({ target: { choice: 'new', probabilities: { s0: 0.35, s1: 0.1, new: 0.55 } } }) })
+ expect(verdict).toEqual({ kind: 'new', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "new" 0.55, then "billing retries" 0.35' })
+ })
+
+ it('goes to a session Jev leads with clearly below 0.6, and traces how far ahead it was', async () => {
+ const desk = [...DESK, session('a3', 'lamp GTM'), session('a4', 'Memories'), session('a5', 'onboarding')]
+ const answer = (s1: number, other: number) => ({ target: { choice: 's1', probabilities: { s0: 0.05, s1, s2: 0.05, s3: 0.05, s4: 0.05, new: other } } })
+ expect((await decideRoute(input({ sessions: desk }), { jev: jev(answer(0.45, 0.35)) })).kind).toBe('new')
+ const led = await decideRoute(input({ sessions: desk }), { jev: jev(answer(0.57, 0.23)) })
+ expect(led).toEqual({ kind: 'session', id: 'a2', p: 0.57, trace: '5 sessions · jev: "Prometheus alerts" 0.57, then "new" 0.23' })
+ // Two sessions and new work are three options: the bar stands.
+ expect((await decideRoute(input(), { jev: jev({ target: { choice: 's1', probabilities: { s0: 0.2, s1: 0.57, new: 0.23 } } }) })).kind).toBe('new')
+ })
+
+ it('tells Jev which sessions are stopped, and how long ago they were last active', async () => {
+ const remote = jev({ target: said('new', 0.9, ['s0', 's1', 's2', 'new']) })
+ const stopped = (id: string, name: string, stoppedAgoMs: number): RouteSession => ({ ...session(id, name), stoppedAgoMs })
+ await decideRoute(input({ sessions: [stopped('a1', 'lamp v1', 3 * 86_400_000), stopped('a2', 'lamp v2', 5 * 3_600_000), stopped('a3', 'notes', 60_000)] }), { jev: remote })
+ expect(remote.mock.calls[0][1].target.criteria).toMatchObject({
+ s0: 'lamp v1 — stopped, last active 3 days ago',
+ s1: 'lamp v2 — stopped, last active 5 hours ago',
+ s2: 'notes — stopped, last active 1 minute ago',
+ })
})
it('traces what Jev said even when it is no session on the desk, or nothing', async () => {
const strange = await decideRoute(input(), { jev: jev({ target: { choice: 's7', probabilities: { s0: 0.5, s1: 0.5 } } }) })
- expect(strange).toEqual({ kind: 'new', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "s7" 0.00' })
+ expect(strange).toEqual({ kind: 'new', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: "s7" 0.00, then "billing retries" 0.50' })
const silent = await decideRoute(input(), { jev: jev({}) })
expect(silent).toEqual({ kind: 'new', via: 'unsure', why: 'Jev was not sure', trace: '2 sessions · jev: no answer' })
})
diff --git a/cli/src/lib/routeDecide.ts b/cli/src/lib/routeDecide.ts
index fca9e6369..319966783 100644
--- a/cli/src/lib/routeDecide.ts
+++ b/cli/src/lib/routeDecide.ts
@@ -2,9 +2,9 @@
* Where a typed task goes, decided without asking the person (docs/design/2026-10-09-auto-router.md).
*
* Jev 1.13, through OpenRouter (~0.6 s), is asked once: which session the task is for (or none — new
- * work), and, for new work, which project and which agent. Its pick is taken at JEV_SURE_P or more; below
- * that Jev is unsure and the task is new work. A project or agent Jev is unsure of is left to the caller,
- * which uses the pane the person is in.
+ * work), and, for new work, which project and which agent. Its pick is taken at JEV_SURE_P or more, or when
+ * it still leads clearly (`jevPick`); otherwise Jev is unsure and the task is new work. A project or agent
+ * Jev is unsure of is left to the caller, which uses the pane the person is in.
*
* Jev alone, owner's call 2026-10-10. It started as a ladder with julia-1, a local model, deciding first:
* every task sent to a wrong session — on the benchmark and on the owner's desk ("how is lamp v2 going"
@@ -26,6 +26,8 @@ export interface RouteSession {
* again in 24 hours" names nothing, and neither did the newest summary; the two before it said
* "activation and repeat use" — which is what "what's d30 retention" is about. */
about?: string
+ /** How long ago a stopped session was last active; absent for a live one. Sending to it resumes it. */
+ stoppedAgoMs?: number
}
/** A project a new harness could start in; [id] is the caller's, handed back untouched. */
export interface RouteOption { id: string; name: string }
@@ -59,15 +61,39 @@ const JEV_OPTIONS = 40
const LABEL_CHARS = 600
/** A follow-up names nothing; who the person was just talking to is what Jev gets to go on. */
const CONTINUITY_MS = 10 * 60_000
-/** Below this Jev is unsure, and the task is new work. */
+/** At this or more Jev is sure. */
export const JEV_SURE_P = 0.6
+/**
+ * Below JEV_SURE_P, a session is still picked when it leads clearly: JEV_LEAD_P or more, and JEV_LEAD_RATIO
+ * times the next option, "new" included — over JEV_LEAD_OPTIONS options or more. Jev's numbers are spread
+ * over every session it is shown, so a right answer among forty can read 0.45. On the owner's desk
+ * (2026-10-10) every task that missed its session did so this way, Jev's top pick right at 0.45 and 0.57;
+ * on the 43-prompt benchmark a lower bar added only right sends. The lead keeps what the bar was for: a pick
+ * torn with new work, or with a second session much like it, is still new work, which costs a harness,
+ * never a wrong conversation. Over a few options there is no spread to excuse — 0.4 of four is 0.6
+ * somewhere else — so the bar stands there, and for the project and the agent, where the pane the person
+ * is in is the fallback.
+ */
+export const JEV_LEAD_P = 0.4
+export const JEV_LEAD_RATIO = 2
+export const JEV_LEAD_OPTIONS = 6
+
+/** The likeliest of [options] other than [choice], for the log: how far ahead the pick was. */
+function runnerUp(p: Record<string, number>, choice: string, options: string[]): string | undefined {
+ return options.filter((id) => id !== choice && typeof p[id] === 'number').sort((a, b) => p[b] - p[a])[0]
+}
-/** Jev's pick when it is a whole answer over exactly [options] and Jev gives it JEV_SURE_P or more. */
-export function jevPick(answer: JevChoiceAnswer | undefined, options: string[]): string | undefined {
+/** Jev's pick when it is a whole answer over exactly [options] and Jev is sure of it, or, with [lead], when
+ * it leads clearly over enough options. */
+export function jevPick(answer: JevChoiceAnswer | undefined, options: string[], lead = false): string | undefined {
const p = answer?.probabilities
if (!answer || !p || !options.includes(answer.choice)) return undefined
if (options.some((id) => typeof p[id] !== 'number' || !Number.isFinite(p[id]))) return undefined
- return p[answer.choice] >= JEV_SURE_P ? answer.choice : undefined
+ const top = p[answer.choice]
+ if (top >= JEV_SURE_P) return answer.choice
+ if (!lead || options.length < JEV_LEAD_OPTIONS) return undefined
+ const next = runnerUp(p, answer.choice, options)
+ return top >= JEV_LEAD_P && top >= JEV_LEAD_RATIO * (next === undefined ? 0 : p[next]) ? answer.choice : undefined
}
/** An error and what caused it: fetch's own message ("fetch failed") says nothing by itself. */
@@ -81,10 +107,18 @@ const label = (text: string): string => {
return clean.length <= LABEL_CHARS ? clean : `${clean.slice(0, LABEL_CHARS - 1)}…`
}
-/** A session as Jev reads it: its name, the person's last prompt and what its last turns were about. */
+/** "3 days", "5 hours", "20 minutes": how long ago, as a person says it. */
+function ago(ms: number): string {
+ const [n, unit] = ms >= 2 * 86_400_000 ? [Math.round(ms / 86_400_000), 'day'] : ms >= 2 * 3_600_000 ? [Math.round(ms / 3_600_000), 'hour'] : [Math.max(1, Math.round(ms / 60_000)), 'minute']
+ return `${n} ${unit}${n === 1 ? '' : 's'}`
+}
+
+/** A session as Jev reads it: its name, whether it is stopped, the person's last prompt and what its last
+ * turns were about. */
function describe(session: RouteSession): string {
return label([
session.name,
+ session.stoppedAgoMs === undefined ? '' : `stopped, last active ${ago(session.stoppedAgoMs)} ago`,
session.asks[0] ? `asked: ${session.asks[0].slice(0, 120)}` : '',
session.about ? `lately: ${session.about.slice(0, 420)}` : '',
].filter(Boolean).join(' — '))
@@ -137,10 +171,14 @@ export async function decideRoute(input: RouteInput, deps: RouteDeps, signal?: A
return { kind: 'unavailable', why: (error as Error).message, trace: [...trace, 'jev: failed'].join(' · ') }
}
const said = answers.target
- const named = said?.choice === 'new' ? 'new' : sessions[Number(said?.choice?.slice(1))]?.name
- trace.push(`jev: ${said ? `"${named ?? said.choice}" ${(said.probabilities[said.choice] ?? 0).toFixed(2)}` : 'no answer'}`)
+ const targets = [...sessions.map((_, i) => `s${i}`), 'new']
+ const name = (id: string | undefined): string | undefined => id === 'new' ? 'new' : sessions[Number(id?.slice(1))]?.name
+ const odds = (id: string): string => (said!.probabilities[id] ?? 0).toFixed(2)
+ const next = said ? runnerUp(said.probabilities, said.choice, targets) : undefined
+ // The runner-up too: whether a pick led clearly is what the next change to the bar is measured from.
+ trace.push(`jev: ${said ? `"${name(said.choice) ?? said.choice}" ${odds(said.choice)}${next ? `, then "${name(next)}" ${odds(next)}` : ''}` : 'no answer'}`)
- const target = jevPick(said, [...sessions.map((_, i) => `s${i}`), 'new'])
+ const target = jevPick(said, targets, true)
if (target && target !== 'new') {
const session = sessions[Number(target.slice(1))]
return { kind: 'session', id: session.id, p: said!.probabilities[target], trace: trace.join(' · ') }
diff --git a/cli/src/services/router.spec.ts b/cli/src/services/router.spec.ts
index 90c5ce45b..eacbba2c3 100644
--- a/cli/src/services/router.spec.ts
+++ b/cli/src/services/router.spec.ts
@@ -107,6 +107,12 @@ describe('what a client sends', () => {
expect(routeInput({ text: 'go', projects: options })!.projects[0]).not.toHaveProperty('extra')
})
+ it('says how long ago a stopped session was last active, when that is a time', () => {
+ const sent = (stoppedAgoMs: unknown) => routeInput({ text: 'go', sessions: [{ id: 'a1', name: 'lamp v1', stoppedAgoMs }] })?.sessions[0]
+ expect(sent(3_600_000)).toEqual({ id: 'a1', name: 'lamp v1', asks: [], stoppedAgoMs: 3_600_000 })
+ for (const odd of [undefined, -1, Number.NaN, Number.POSITIVE_INFINITY, '3600000']) expect(sent(odd), String(odd)).toEqual({ id: 'a1', name: 'lamp v1', asks: [] })
+ })
+
it('says where the last task went only with a session id and a finite time', () => {
const last = (value: unknown) => routeInput({ text: 'go', last: value })!
expect(last({ id: 'a1', agoMs: 0 }).last).toEqual({ id: 'a1', agoMs: 0 })
@@ -141,7 +147,7 @@ describe('the router', () => {
const { router: made, lines } = router({ jev })
expect(await startRouter(fakeCore(), made).route_decide!({ text: 'refund it', sessions: DESK }, OWNER))
.toEqual({ decided: 'session', id: 'a1', via: 'jev' })
- expect(lines).toEqual(['session — 2 sessions · jev: "billing retries" 0.80'])
+ expect(lines).toEqual(['session — 2 sessions · jev: "billing retries" 0.80, then "Prometheus alerts" 0.10'])
// Jev was asked the task as the client sent it, trimmed.
expect(jev).toHaveBeenCalledWith({ message: 'refund it' }, expect.objectContaining({ target: expect.any(Object) }), undefined)
})
@@ -160,15 +166,15 @@ describe('the router', () => {
agents: [{ id: 'claude', name: 'Claude Code' }, { id: 'codex', name: 'Codex' }],
}, OWNER)
expect(answer).toEqual({ decided: 'new', via: 'jev', reason: 'Jev: new work', project: '/Users/me/Pictures', agent: 'claude' })
- expect(lines).toEqual(['new (Jev: new work) — 2 sessions · jev: "new" 0.90'])
+ expect(lines).toEqual(['new (Jev: new work) — 2 sessions · jev: "new" 0.90, then "billing retries" 0.05'])
})
it('answers new work with no project or agent when Jev was not sure, for the client to place', async () => {
- const jev = vi.fn(async () => ({ target: said('s1', 0.5, ['s0', 's1', 'new']) }))
+ const jev = vi.fn(async () => ({ target: { choice: 's1', probabilities: { s0: 0.3, s1: 0.5, new: 0.2 } } }))
const { router: made, lines } = router({ jev })
expect(await startRouter(fakeCore(), made).route_decide!({ text: 'go', sessions: DESK }, OWNER))
.toEqual({ decided: 'new', via: 'unsure', reason: 'Jev was not sure' })
- expect(lines).toEqual(['new (Jev was not sure) — 2 sessions · jev: "Prometheus alerts" 0.50'])
+ expect(lines).toEqual(['new (Jev was not sure) — 2 sessions · jev: "Prometheus alerts" 0.50, then "billing retries" 0.30'])
// And decides the same without a log.
expect(await startRouter(fakeCore(), { jev }).route_decide!({ text: 'go', sessions: DESK }, OWNER))
.toEqual({ decided: 'new', via: 'unsure', reason: 'Jev was not sure' })
diff --git a/cli/src/services/router.ts b/cli/src/services/router.ts
index 2fea6b257..33fb443e2 100644
--- a/cli/src/services/router.ts
+++ b/cli/src/services/router.ts
@@ -35,10 +35,11 @@ function options(raw: unknown): RouteOption[] {
function sessions(raw: unknown): RouteSession[] {
if (!Array.isArray(raw)) return []
return raw.slice(0, MAX_SESSIONS).flatMap((row) => {
- const { id, name, asks, about } = (row ?? {}) as { id?: unknown; name?: unknown; asks?: unknown; about?: unknown }
+ const { id, name, asks, about, stoppedAgoMs } = (row ?? {}) as { id?: unknown; name?: unknown; asks?: unknown; about?: unknown; stoppedAgoMs?: unknown }
if (typeof id !== 'string' || typeof name !== 'string' || id.length > 4200 || name.length > 300) return []
const said = Array.isArray(asks) ? asks.filter((ask): ask is string => typeof ask === 'string').slice(0, 3).map((ask) => ask.slice(0, 500)) : []
- return [{ id, name, asks: said, ...(typeof about === 'string' && about.trim() ? { about: about.slice(0, 500) } : {}) }]
+ const stopped = typeof stoppedAgoMs === 'number' && Number.isFinite(stoppedAgoMs) && stoppedAgoMs >= 0 ? { stoppedAgoMs } : {}
+ return [{ id, name, asks: said, ...(typeof about === 'string' && about.trim() ? { about: about.slice(0, 500) } : {}), ...stopped }]
})
}
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 7a9c88266..e19aa2d85 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -4180,12 +4180,20 @@ class AppNotifier extends ChangeNotifier {
/// own door on any machine (`deliverTask`). [stillWanted] is asked just before the words are typed:
/// the pane comes forward first, and a person who sees the wrong one and presses Esc stops the send.
/// Returns what went wrong, or null.
+ ///
+ /// A stopped session is resumed first, its own conversation, and its pane comes forward only once its
+ /// terminal is up — as ⌘P opens one, so a resume that fails leaves no pane behind and says why, and
+ /// an Esc while it resumes sends nothing.
Future<String?> sendTaskToSession(
String machineId,
String agentId,
String task, {
bool Function()? stillWanted,
}) async {
+ if (await resumeStoppedSession(machineId, agentId) case final failure?) {
+ return failure;
+ }
+ if (stillWanted != null && !stillWanted()) return 'Nothing was sent.';
bringSessionForward(machineId, agentId);
return deliverTask(
this,
@@ -4199,8 +4207,12 @@ class AppNotifier extends ChangeNotifier {
/// The session's own pane, wherever it is: its tab comes forward and the pane takes focus. Only a
/// session with no pane in any tab gets a new one, here. 2026-10-10: a task for "Personal AI
/// Computer" opened a second pane on it in the current tab while its own sat in the Backlog tab.
+ ///
+ /// The pane revealed is then selected, as a click on it would: a pane in a tab behind this one that has
+ /// no terminal yet (restored after a restart, say, or a session just resumed) is attached here, since
+ /// nothing attaches a pane in a tab nobody was looking at.
void bringSessionForward(String machineId, String agentId) {
- if (revealAgentView(machineId, agentId)) return;
+ revealAgentView(machineId, agentId);
unawaited(selectAgent(machineId, agentId));
}
@@ -11718,9 +11730,7 @@ class AppNotifier extends ChangeNotifier {
!models.sections.any(
(section) =>
section.name == choices['gridName'] &&
- section.models.any(
- (model) => model.id == choices['gridModel'],
- ),
+ section.models.any((model) => model.id == choices['gridModel']),
)) {
return creation._complete(
'The selected model is unavailable. Refresh models or use your subscription.',
@@ -12561,6 +12571,60 @@ class AppNotifier extends ChangeNotifier {
AgentRestartAttempt? pendingAgentRestart(String machineId, String agentId) =>
_agentRestarts[(machineId, agentId)];
+ /// Resume a stopped session's own conversation and wait for its terminal: null once it is up, or when
+ /// the session was not stopped; otherwise why not. ⌘P opens a stopped session this way, and ⌘B sends to
+ /// one, so both wait alike and fail alike.
+ Future<String?> resumeStoppedSession(String machineId, String agentId) async {
+ final agent = stateOf(machineId)?.agents
+ .where((agent) => agent.id == agentId)
+ .firstOrNull;
+ if (agent?.isStopped != true) return null;
+ final machine = stateOf(machineId);
+ final terminalReady = Completer<void>();
+ void observeRuntime() {
+ if (terminalReady.isCompleted ||
+ !identical(machine, stateOf(machineId)) ||
+ pendingAgentStop(machineId, agentId) != null) {
+ return;
+ }
+ final current = stateOf(machineId)?.agents
+ .where((row) => row.id == agentId)
+ .firstOrNull;
+ // This opens a view of the allocated terminal, not a claim that history
+ // has loaded. The native CLI may need login or hook review before it can
+ // confirm the conversation; the receipt keeps verifying in the background.
+ //
+ // The conversation has to be the one asked for — unless none was: a resume
+ // that was always going to open a new one (an engine with no resume argv, a
+ // harness paused with nothing recorded) reports a different id because it
+ // did as it was told, and the tile it opened is still this harness's.
+ final fresh =
+ agent?.resumesFreshConversation == true ||
+ current?.resumesFreshConversation == true;
+ if (current?.terminalAvailable == true &&
+ (fresh || current?.sessionId == agent!.sessionId) &&
+ current?.launchState != 'failed' &&
+ current?.isStopped == false) {
+ terminalReady.complete();
+ }
+ }
+
+ addListener(observeRuntime);
+ try {
+ final confirmed = resumeAgent(
+ machineId,
+ agentId,
+ ).then((result) => result.error);
+ observeRuntime();
+ return await Future.any<String?>([
+ confirmed,
+ terminalReady.future.then((_) => null),
+ ]);
+ } finally {
+ removeListener(observeRuntime);
+ }
+ }
+
/// Attach to a running harness or resume its saved conversation immediately.
Future<RestartAgentResult> resumeAgent(String machineId, String agentId) {
if (pendingAgentPause(machineId, agentId) != null) {
diff --git a/desktop/lib/state/swarm_navigation.dart b/desktop/lib/state/swarm_navigation.dart
index 001abf257..0aff2c8a5 100644
--- a/desktop/lib/state/swarm_navigation.dart
+++ b/desktop/lib/state/swarm_navigation.dart
@@ -448,56 +448,8 @@ Future<void> _resumeStoppedDestination(
final machineId = destination.machineId;
final agentId = destination.agentId;
if (machineId == null || agentId == null) return;
- final agent = app
- .stateOf(machineId)
- ?.agents
- .where((agent) => agent.id == agentId)
- .firstOrNull;
- if (agent?.isStopped != true) return;
- final machine = app.stateOf(machineId);
- final terminalReady = Completer<void>();
- void observeRuntime() {
- if (terminalReady.isCompleted ||
- !identical(machine, app.stateOf(machineId)) ||
- app.pendingAgentStop(machineId, agentId) != null) {
- return;
- }
- final current = app
- .stateOf(machineId)
- ?.agents
- .where((row) => row.id == agentId)
- .firstOrNull;
- // This opens a view of the allocated terminal, not a claim that history
- // has loaded. The native CLI may need login or hook review before it can
- // confirm the conversation; the receipt keeps verifying in the background.
- //
- // The conversation has to be the one asked for — unless none was: a resume
- // that was always going to open a new one (an engine with no resume argv, a
- // harness paused with nothing recorded) reports a different id because it
- // did as it was told, and the tile it opened is still this harness's.
- final fresh =
- agent?.resumesFreshConversation == true ||
- current?.resumesFreshConversation == true;
- if (current?.terminalAvailable == true &&
- (fresh || current?.sessionId == agent!.sessionId) &&
- current?.launchState != 'failed' &&
- current?.isStopped == false) {
- terminalReady.complete();
- }
- }
-
- app.addListener(observeRuntime);
- try {
- final confirmed = app.resumeAgent(machineId, agentId).then((result) {
- if (result.error case final error?) {
- throw SwarmResumeFailure(destination, error);
- }
- });
- observeRuntime();
- await Future.any([confirmed, terminalReady.future]);
- } finally {
- app.removeListener(observeRuntime);
- }
+ final failure = await app.resumeStoppedSession(machineId, agentId);
+ if (failure != null) throw SwarmResumeFailure(destination, failure);
}
({String text, String terminalText, int? branchOffset}) _harnessDetail(
diff --git a/desktop/lib/state/task_route.dart b/desktop/lib/state/task_route.dart
index 6a79e2dd5..6cf9b5f4d 100644
--- a/desktop/lib/state/task_route.dart
+++ b/desktop/lib/state/task_route.dart
@@ -34,6 +34,8 @@ class TaskRouteChoices {
'name': value.name,
'asks': value.asks,
if (value.about != null) 'about': value.about,
+ if (value.stoppedFor case final stopped?)
+ 'stoppedAgoMs': stopped.inMilliseconds,
},
],
'projects': [
@@ -64,7 +66,16 @@ bool _usable(String folder) =>
const _sessionCap = 40;
-TaskRouteChoices taskRouteChoices(AppNotifier app) {
+/// How long a stopped session stays one a task can be for. The rail keeps every stopped session it ever
+/// ran; a week is what a person picks back up ("the lamp work from Tuesday"), and past it the list only
+/// spreads Jev thinner over work nobody is coming back to.
+const stoppedSessionsWithin = Duration(days: 7);
+
+Duration _atLeastZero(Duration d) => d.isNegative ? Duration.zero : d;
+
+/// The sessions, projects and agents ⌘B's router chooses from. [now] is for tests.
+TaskRouteChoices taskRouteChoices(AppNotifier app, {DateTime? now}) {
+ final since = (now ?? DateTime.now()).subtract(stoppedSessionsWithin);
final machines =
[
...app.machineStates.values.where((m) => m.isLocalMachine),
@@ -113,16 +124,19 @@ TaskRouteChoices taskRouteChoices(AppNotifier app) {
: p.basename(row.folder),
),
};
- // Live sessions only, the most recently active first, and at most [_sessionCap]: the rail keeps every
- // stopped session it ever ran, and the first try sent all two hundred — the one the task was for was
- // not among the forty Jev was shown.
+ // Live sessions, and stopped ones active in the last [stoppedSessionsWithin] that can resume their own
+ // conversation — a follow-up typed into a fresh one would land with none of what it follows. The most
+ // recently active first, and at most [_sessionCap]: the first try sent all two hundred the rail keeps,
+ // and the one the task was for was not among the forty Jev was shown.
final live =
[
for (final machine in machines)
for (final agent in machine.agents)
if (agent.engine != null &&
!isTerminalEngine(agent.engine) &&
- !agent.isStopped)
+ (!agent.isStopped ||
+ (agent.canResumeConversation &&
+ agent.lastActivityAt?.isAfter(since) == true)))
(machine: machine, agent: agent),
]..sort((a, b) {
final at = a.agent.lastActivityAt, bt = b.agent.lastActivityAt;
@@ -152,6 +166,12 @@ TaskRouteChoices taskRouteChoices(AppNotifier app) {
about:
_recent[app]?['${machine.machine.machineId}\n${agent.id}']?.about ??
_about(_preview(app, machine.machine.machineId, agent)),
+ // Never less than nothing: a machine whose clock runs ahead would otherwise read as live.
+ stoppedFor: agent.isStopped
+ ? _atLeastZero(
+ (now ?? DateTime.now()).difference(agent.lastActivityAt!),
+ )
+ : null,
),
};
final engines = <String>{'claude', 'codex'};
@@ -260,6 +280,10 @@ typedef TaskRouteSession = ({
String engine,
List<String> asks,
String? about,
+
+ /// How long ago a stopped session was last active; null for a live one. Jev is told, so a live "lamp
+ /// v2" is not mistaken for the stopped "lamp v1" of last week.
+ Duration? stoppedFor,
});
SessionPreview? _preview(AppNotifier app, String machineId, Agent agent) =>
diff --git a/desktop/test/route_card_test.dart b/desktop/test/route_card_test.dart
index 539defefb..fa2952887 100644
--- a/desktop/test/route_card_test.dart
+++ b/desktop/test/route_card_test.dart
@@ -154,7 +154,12 @@ Future<(TaskRouteDecision?, _Daemon)> _decided(Object Function() answer) async {
..connectionStatus = ConnectionStatus.connected
..agentLoadStatus = AgentLoadStatus.loaded
..agents = const [
- Agent(id: 'a0', name: 'Analyze', engine: 'codex', terminalAvailable: true),
+ Agent(
+ id: 'a0',
+ name: 'Analyze',
+ engine: 'codex',
+ terminalAvailable: true,
+ ),
];
final decision = await app.routeDecide('go', taskRouteChoices(app));
return (decision, daemon);
@@ -200,18 +205,22 @@ Future<void> _say(WidgetTester tester, String text) async {
const _session = 'm\na0';
-Agent _agent(String id, {String status = 'idle', int minutesAgo = 0}) => Agent(
+final _now = DateTime(2026, 10, 10, 12);
+
+Agent _agent(
+ String id, {
+ String status = 'idle',
+ int minutesAgo = 0,
+ String engine = 'claude',
+ String? sessionId,
+}) => Agent(
id: id,
name: 'Session $id',
- engine: 'claude',
+ engine: engine,
status: status,
- terminalAvailable: true,
- lastActivityAt: DateTime(
- 2026,
- 10,
- 10,
- 12,
- ).subtract(Duration(minutes: minutesAgo)),
+ sessionId: sessionId,
+ terminalAvailable: status != 'stopped',
+ lastActivityAt: _now.subtract(Duration(minutes: minutesAgo)),
);
void main() {
@@ -237,12 +246,71 @@ void main() {
app.machineStates['off'] = MachineState(away)
..nodeOnline = false
..agents = [_agent('far')];
- final ids = taskRouteChoices(app).sessions.values
- .map((s) => s.agentId)
- .toList();
+ final ids = taskRouteChoices(
+ app,
+ now: _now,
+ ).sessions.values.map((s) => s.agentId).toList();
expect(ids, [for (var i = 0; i < 40; i++) 'a$i']);
});
+ test('a stopped session is offered for a week, when it can resume its own conversation', () {
+ final app = _App();
+ addTearDown(app.dispose);
+ const day = 24 * 60;
+ app.machineStates['m']!.agents = [
+ _agent('live', minutesAgo: 30 * day),
+ _agent(
+ 'tuesday',
+ status: 'stopped',
+ sessionId: 'c-1',
+ minutesAgo: 4 * day,
+ ),
+ _agent(
+ 'lastweek',
+ status: 'stopped',
+ sessionId: 'c-2',
+ minutesAgo: 8 * day,
+ ),
+ // Nothing of its conversation to go back to: a follow-up would land in a new one.
+ _agent('unsaved', status: 'stopped', minutesAgo: 60),
+ _agent(
+ 'other',
+ status: 'stopped',
+ sessionId: 'c-3',
+ engine: 'gemini',
+ minutesAgo: 60,
+ ),
+ const Agent(
+ id: 'undated',
+ name: 'Undated',
+ engine: 'claude',
+ status: 'stopped',
+ sessionId: 'c-4',
+ ),
+ ];
+ final ids = taskRouteChoices(
+ app,
+ now: _now,
+ ).sessions.values.map((s) => s.agentId).toList();
+ expect(ids, ['tuesday', 'live']);
+ // Jev is told it is stopped, and since when; a live one says nothing of the kind.
+ final sent = {
+ for (final row
+ in taskRouteChoices(app, now: _now).toPayload()['sessions'] as List)
+ (row as Map)['id']: row['stoppedAgoMs'],
+ };
+ expect(sent, {
+ 'm\ntuesday': const Duration(days: 4).inMilliseconds,
+ 'm\nlive': null,
+ });
+ // A machine whose clock runs ahead still reads as stopped, never as live.
+ final ahead = taskRouteChoices(
+ app,
+ now: _now.subtract(const Duration(days: 5)),
+ );
+ expect(ahead.sessions['m\ntuesday']?.stoppedFor, Duration.zero);
+ });
+
test(
'new work in a Git project starts in a fresh worktree of its repository',
() async {
@@ -281,12 +349,15 @@ void main() {
expect(start?.request, isNull);
});
- test('a folder that could not be read is nowhere to start, not a plain folder', () async {
- final app = _App();
- addTearDown(app.dispose);
- app.gitProjectReaderForTest = (_, _) async => {'error': 'UNAVAILABLE'};
- expect(await newWorkFolder(app, 'm', '/repos/harness'), isNull);
- });
+ test(
+ 'a folder that could not be read is nowhere to start, not a plain folder',
+ () async {
+ final app = _App();
+ addTearDown(app.dispose);
+ app.gitProjectReaderForTest = (_, _) async => {'error': 'UNAVAILABLE'};
+ expect(await newWorkFolder(app, 'm', '/repos/harness'), isNull);
+ },
+ );
testWidgets('each session goes with what it was last asked and last did', (
tester,
@@ -444,11 +515,16 @@ void main() {
},
);
- test('a daemon without the router hands the card back to the old one', () async {
- final (decision, daemon) = await _decided(() => _refused('UNSUPPORTED'));
- expect(decision, isNull);
- expect(daemon.asked, 1);
- });
+ test(
+ 'a daemon without the router hands the card back to the old one',
+ () async {
+ final (decision, daemon) = await _decided(
+ () => _refused('UNSUPPORTED'),
+ );
+ expect(decision, isNull);
+ expect(daemon.asked, 1);
+ },
+ );
});
testWidgets('when Jev cannot be asked, the box says so and sends nothing', (
diff --git a/desktop/test/route_screen_test.dart b/desktop/test/route_screen_test.dart
index 9841877d3..0b5426e53 100644
--- a/desktop/test/route_screen_test.dart
+++ b/desktop/test/route_screen_test.dart
@@ -84,7 +84,8 @@ Future<_Connection> _routeNewWork(
final _taskField = find.byWidgetPredicate(
(widget) =>
- widget is TextField && widget.decoration?.hintText == 'Describe the work…',
+ widget is TextField &&
+ widget.decoration?.hintText == 'Describe the work…',
);
void main() {
@@ -108,8 +109,10 @@ void main() {
) async {
final connection = await _routeNewWork(
tester,
- before: (app) => app.agentPreference.successfulLaunch =
- const LaunchSetup(engine: 'codex', permissionMode: 'ask'),
+ before: (app) => app.agentPreference.successfulLaunch = const LaunchSetup(
+ engine: 'codex',
+ permissionMode: 'ask',
+ ),
);
final create = connection.asked['agent_create']!;
expect(create['permissionMode'], 'ask');
@@ -151,4 +154,29 @@ void main() {
expect(app.allPanes.length, panes);
},
);
+
+ testWidgets(
+ 'a pane brought forward from a tab behind with no terminal yet is attached',
+ (tester) async {
+ final app = createApp(connectionForTest: (_) => _Connection());
+ app.machineStates['m']!
+ ..nodeOnline = true
+ ..connectionStatus = ConnectionStatus.connected;
+ await app.addAgentToSwarm('m', 'a0');
+ final pane = app.allPanes.firstWhere((p) => p.agentId == 'a0');
+ // Restored after a restart, or its session just resumed: nothing has attached it.
+ pane.session = null;
+ app.newSwarm(name: 'Work', newTabPage: true);
+ app.machineStates['m']!.terminalCapabilityAvailable = true;
+
+ app.bringSessionForward('m', 'a0');
+ await tester.pump();
+
+ expect(app.focusedPane?.agentId, 'a0');
+ expect(pane.session, isNotNull);
+ // The terminal it opened keeps an open deadline: let it lapse with the app.
+ app.dispose();
+ await tester.pump(const Duration(minutes: 1));
+ },
+ );
}
diff --git a/desktop/test/route_send_test.dart b/desktop/test/route_send_test.dart
new file mode 100644
index 000000000..d8accc070
--- /dev/null
+++ b/desktop/test/route_send_test.dart
@@ -0,0 +1,148 @@
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/terminal/terminal_session.dart';
+
+import 'support/restart_connection.dart';
+import 'swarm_state_test.dart' show createApp;
+
+/// ⌘B's send (docs/design/2026-10-09-auto-router.md): the task goes into the session's own pane once it
+/// takes input, and a stopped session is resumed first, as ⌘P opens one.
+class _Pane extends TerminalSession {
+ _Pane(String agentId)
+ : super(
+ machineId: 'm',
+ agentId: agentId,
+ agentName: agentId,
+ engineId: 'claude',
+ send: (_, _) async => true,
+ sendBinary: (_) async => true,
+ ) {
+ status = TerminalSessionStatus.controlling;
+ streamId = 's-$agentId';
+ }
+
+ final typed = <String>[];
+
+ @override
+ bool get acceptsInput => true;
+
+ @override
+ Future<bool> sendComposerText(String text, {String? tabId}) async {
+ typed.add(text);
+ return true;
+ }
+}
+
+const _saved = Agent(
+ id: 'saved',
+ name: 'Lamp v1',
+ engine: 'claude',
+ sessionId: 'lamp-conversation',
+ status: 'stopped',
+ project: AgentProject(name: 'lamp', cwd: '/work/lamp'),
+);
+
+/// Claude Code: a pane that takes input is ready (Codex's would also wait for its own prompt).
+const _live = Agent(
+ id: 'live',
+ name: 'Lamp v2',
+ engine: 'claude',
+ terminalAvailable: true,
+);
+
+/// The machine's receipt for a resume of [_saved] into [sessionId].
+Map<String, dynamic> _resumed(String sessionId) {
+ final receipt = restartReceipt(
+ connection.requests.single['creationId'] as String,
+ agentId: 'saved',
+ name: 'Lamp v1',
+ sessionId: sessionId,
+ );
+ return {
+ ...receipt,
+ 'agent': {...receipt['agent'] as Map<String, dynamic>, 'engine': 'claude'},
+ };
+}
+
+late RestartConnection connection;
+
+void main() {
+ TestWidgetsFlutterBinding.ensureInitialized();
+ late AppNotifier app;
+ setUp(() {
+ connection = RestartConnection();
+ app = createApp(connectionForTest: (_) => connection, connected: true);
+ app.machineStates['m']!.agents.addAll([_saved, _live]);
+ });
+ tearDown(() => app.dispose());
+
+ bool hasPane(String agentId) =>
+ app.allPanes.any((pane) => pane.agentId == agentId);
+
+ test(
+ 'a live session\'s pane is handed the task once it takes input',
+ () async {
+ final pane = _Pane('live');
+ app.adoptSessionForTest(pane);
+ expect(await app.sendTaskToSession('m', 'live', 'and the chart'), isNull);
+ expect(pane.typed, ['and the chart']);
+ expect(connection.types, isEmpty);
+ },
+ );
+
+ test('a stopped session is resumed before its pane comes forward, then given the task', () async {
+ final sending = app.sendTaskToSession(
+ 'm',
+ 'saved',
+ 'pick the lamp work back up',
+ );
+ await Future<void>.delayed(Duration.zero);
+ expect(connection.types, ['agent_resume']);
+ expect(connection.requests.single['agentId'], 'saved');
+ // Nothing is opened for it until its own conversation is back.
+ expect(hasPane('saved'), isFalse);
+ connection.restartReplies.single.complete(_resumed('lamp-conversation'));
+ await Future<void>.delayed(Duration.zero);
+ expect(hasPane('saved'), isTrue);
+ // Its terminal arrives and takes input: the task is typed there.
+ final pane = _Pane('saved');
+ app.allPanes.firstWhere((p) => p.agentId == 'saved').session = pane;
+ app.notifyListeners();
+ expect(await sending, isNull);
+ expect(pane.typed, ['pick the lamp work back up']);
+ });
+
+ test('a session that resumes into another conversation is not sent to, and leaves no pane', () async {
+ final sending = app.sendTaskToSession(
+ 'm',
+ 'saved',
+ 'pick the lamp work back up',
+ );
+ await Future<void>.delayed(Duration.zero);
+ connection.restartReplies.single.complete(
+ restartReceipt(
+ connection.requests.single['creationId'] as String,
+ agentId: 'saved',
+ sessionId: 'some-other-conversation',
+ ),
+ );
+ expect(await sending, isNotNull);
+ expect(hasPane('saved'), isFalse);
+ });
+
+ test('Esc while it resumes sends nothing and opens nothing', () async {
+ var wanted = true;
+ final sending = app.sendTaskToSession(
+ 'm',
+ 'saved',
+ 'pick the lamp work back up',
+ stillWanted: () => wanted,
+ );
+ await Future<void>.delayed(Duration.zero);
+ wanted = false;
+ connection.restartReplies.single.complete(_resumed('lamp-conversation'));
+ expect(await sending, 'Nothing was sent.');
+ expect(hasPane('saved'), isFalse);
+ });
+}
diff --git a/docs/design/2026-10-09-auto-router.md b/docs/design/2026-10-09-auto-router.md
index 4c80581b1..d5e9b2ef5 100644
--- a/docs/design/2026-10-09-auto-router.md
+++ b/docs/design/2026-10-09-auto-router.md
@@ -36,12 +36,16 @@ not part of the core and not part of the devices: the desktop is one client of i
and the phone, the web, the TUI and the dial are meant to be the others.
It only **decides**. A client sends the task with the sessions it can see (live
-sessions on connected machines, most recently active first, at most forty, each
+sessions on connected machines, and stopped ones active in the last seven days that
+can resume their own conversation; most recently active first, at most forty, each
with its last prompts and its last three turn summaries), the person's project
folders and the agents they use (`desktop/lib/state/task_route.dart`). The router
answers "this session" or "new work, in this project, with this agent". The client
acts through its own doors: the desktop types the task into the session's pane
-(`deliverTask`), or creates the harness (`_createFromTask`). So the router needs
+(`deliverTask`), or creates the harness (`_createFromTask`). A stopped session is
+resumed first and its pane comes forward once its terminal is up
+(`resumeStoppedSession`, shared with ⌘P), so a resume that fails leaves no pane and
+says why. So the router needs
nothing from the core, keeps no session list, and reaches no other machine.
Request (`ROUTER_REQUESTS` in `cli/src/core/api.ts`): `route_decide`. A daemon
@@ -55,8 +59,20 @@ One request to **Jev 1.13** through OpenRouter's Decisions API
(`cli/src/lib/jev/jevClient.ts`, `cli/src/lib/routeDecide.ts`): "A person typed
this message to continue their work. Which of their ongoing sessions is it for?"
(or "none of them: new, unrelated work"), which project and which agent. A pick is
-taken at 0.6 or more; below that the task is new work, and a project or agent Jev
-is unsure of comes from the pane the person is in. The session the person last sent
+taken at 0.6 or more. A session is also taken below that when it leads clearly over
+six options or more: 0.4 or more and at least twice the next option, "new" included.
+Otherwise the task is new work, and a project or agent Jev is unsure of (under 0.6)
+comes from the pane the person is in. A stopped session is described to Jev as
+stopped, with how long ago it was last active.
+
+Why the lead: a wrong send costs a conversation, a needless new harness costs a
+harness, so the bar leans to new work. But Jev's probabilities are spread over every
+session it is shown, and on the owner's desk every miss was Jev's right pick at 0.45
+or 0.57. A pick that is twice anything else is Jev preferring it clearly; a pick
+torn with new work, or with a session much like it, still becomes new work. Over
+fewer than six options there is no spread to excuse a low pick (0.4 of four is 0.6
+elsewhere), so the bar stands. The log
+records the runner-up with every decision, to set these numbers from real use. The session the person last sent
to (within ten minutes) is told to Jev, so a short follow-up finds it.
The key is the person's OpenRouter key (`OPENROUTER_API_KEY`, `ori login`, or
@@ -82,5 +98,5 @@ every answer.
- The other clients: the phone, the web, the TUI and the dial still use their own
routing. Voice through the desktop already uses this box.
-- Whether to take Jev's top session pick below 0.6 (it was right in both misses
- above) is open.
+- The lead rule (0.4, twice the runner-up) is set from two misses and a benchmark;
+ the runner-up in the log is how to tune it.