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(cli): see Hermes, whose name the process table never told us

0xdiego250d779626a778
diff --git a/cli/src/lib/tmux.spec.ts b/cli/src/lib/tmux.spec.ts
index da1683a1c..14420b9ef 100644
--- a/cli/src/lib/tmux.spec.ts
+++ b/cli/src/lib/tmux.spec.ts
@@ -218,6 +218,37 @@ describe('tmux process primitives', () => {
expect(engineProcessMatchScore({ executable: '2.1.246', args: '2.1.246' }, 'claude')).toBe(0)
})
+ it('reads Hermes out of the inline source it runs as', () => {
+ // 0.21.5+2144.g7b761da, copied off `ps` on this machine. The `sh` stub in
+ // `~/.hermes/hermes-agent/.hermes/bin/hermes` execs Hermes' own interpreter with the whole
+ // launcher as `-c` text, so argv names no script and `comm` is a python. Nothing here carried
+ // the engine's name anywhere the matcher looked, and a running Hermes read as absent: its pane
+ // was retained six seconds after New Harness, then failed RESUME_UNCONFIRMED ten minutes later.
+ const python = '/Users/demo/.hermes/tools/python-3.14.7+20260901-darwin-arm64/bin/python3'
+ const launcher = (entry: string) => `${python} -I -c import os, re, sys`
+ + ` sys.path.insert(0, '/Users/demo/.hermes/hermes-agent')`
+ + ` import hermes_bootstrap from ${entry} import main sys.exit(main())`
+ // macOS prints `comm` through a 16-column field beside lstart, so every absolute path arrives
+ // truncated. The interpreter has to be read from argv[0] or this row scores on a home directory.
+ const comm = '/Users/demo'
+ expect(engineProcessMatchScore({ executable: comm, args: launcher('hermes_cli.main') }, 'hermes')).toBe(2)
+ // `hermes-acp` is the other stub in that bin, identical but for its entry module. An ACP adapter
+ // is not the harness's engine, and the sys.path root alone would have claimed it.
+ expect(engineProcessMatchScore({ executable: comm, args: launcher('acp_adapter.entry') }, 'hermes')).toBe(0)
+ // Inline source stays unreadable as an entrypoint for everyone else: a prompt may say anything.
+ expect(engineProcessMatchScore({
+ executable: comm,
+ args: `${python} -I -c print('x') compare hermes_cli and codex`,
+ }, 'hermes')).toBe(0)
+ expect(engineProcessMatchScore({
+ executable: 'python3',
+ args: `python3 worker.py from hermes_cli.main import main /Users/demo/.hermes/hermes-agent'`,
+ }, 'hermes')).toBe(0)
+ // And the shapes that already worked keep working.
+ expect(engineProcessMatchScore({ executable: 'hermes', args: 'hermes --resume 20260728_115628_f2c86a' }, 'hermes')).toBe(3)
+ expect(engineProcessMatchScore({ executable: comm, args: `${python} -m hermes_cli.main` }, 'hermes')).toBe(2)
+ })
+
it('reads an engine through the ori launcher, before and after its exec', () => {
// `ori claude` computes an environment and then execve's the vendor binary away, so for all but the
// first ~100ms the pane row IS `claude` — that case must keep scoring exactly as a bare launch does.
diff --git a/cli/src/lib/tmux.ts b/cli/src/lib/tmux.ts
index 47772096f..56e921a86 100644
--- a/cli/src/lib/tmux.ts
+++ b/cli/src/lib/tmux.ts
@@ -116,6 +116,38 @@ function hasCursorPackageEntrypoint(args: string): boolean {
/cursor-agent[\/\\]versions[\/\\][^/\\]+[\/\\]index\.js$/i.test(token))
}
+/**
+ * Hermes launches itself as inline source, so its argv names no script at all.
+ *
+ * `~/.hermes/hermes-agent/.hermes/bin/hermes` is a `sh` stub that `exec`s Hermes' own vendored
+ * interpreter with the whole launcher as `-c` text:
+ *
+ * ~/.hermes/tools/python-3.14.7+20260901-darwin-arm64/bin/python3 -I -c 'import os, re, sys
+ * …sys.path.insert(0, "<root>/hermes-agent")…from hermes_cli.main import main…sys.exit(main())'
+ *
+ * The stub is exec'd away, so `comm` is `python3`, and `processEntrypoint` correctly refuses to read
+ * inline source as an entrypoint — nothing on this row carries the engine's name anywhere the matcher
+ * looks. Measured on 0.21.5+2144.g7b761da: a New Harness pane was retained six seconds after starting
+ * ("engine process absent after 2 confirmed scans") over a Hermes that was running and drawing its
+ * dashboard, and selecting it again spent the whole readiness budget before RESUME_UNCONFIRMED.
+ *
+ * BOTH markers are required, and each rules out a different false positive. The sys.path root alone is
+ * also in `hermes-acp`, the other stub in that bin, identical but for `from acp_adapter.entry import
+ * main` — an ACP adapter is not the harness's engine. The `hermes_cli` import alone is a word that
+ * could appear in a prompt; a prompt is not python source that has also just put Hermes' own package
+ * root on the path. Together they are the launcher and nothing else, wherever HERMES_HOME puts it.
+ */
+function hermesInlineLauncher(row: Pick<ProcessRow, 'args'>): boolean {
+ // argv[0], not `comm`: macOS prints comm through a 16-column field here, so every absolute path
+ // reaches this parser as `/Users/duynguyen` and its basename names a person, not an interpreter.
+ const tokens = argvTokens(row.args)
+ if (!/^python(?:\d+(?:\.\d+)*)?$/.test(basename(tokens[0] ?? '').toLowerCase())) return false
+ const inline = row.args.search(/\s-(?:c|-command)\s/)
+ if (inline < 0) return false
+ const source = row.args.slice(inline)
+ return /[\/\\]hermes-agent['"]/.test(source) && /\b(?:from|import)\s+hermes_cli\b/.test(source)
+}
+
function agentAliasCandidate(row: Pick<ProcessRow, 'executable' | 'args'>): boolean {
if (basename(row.executable).toLowerCase() === 'agent') return true
return basename(processEntrypoint(row.args)).toLowerCase() === 'agent'
@@ -467,6 +499,9 @@ function heuristicEngineProcessMatchScore(
// Cursor's launcher can retain argv[0]=agent while the Node package path appears later in argv.
if (engine === 'cursor' && hasCursorPackageEntrypoint(row.args)) return 3
+ // Hermes' own launcher, read out of the inline source it runs as. See `hermesInlineLauncher`.
+ if (engine === 'hermes' && hermesInlineLauncher(row)) return 2
+
const signature = ENGINE_PROCESS_SIGNATURES[engine]
if (signature.basenames.some((pattern) => pattern.test(executable) || pattern.test(entrybase))) return 3
if (signature.entrypoints.some((pattern) => pattern.test(entrypoint))) return 2