Skip to content
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
5fca512
test: cover Hermes durable restore and pinned hooks
austinywang Aug 4, 2026
0792812
test: cover Hermes hook approval migration
austinywang Aug 4, 2026
b32dfb7
feat: make Hermes a durable first-class agent
austinywang Aug 4, 2026
efd73a3
test: fix Hermes fixture type inference
austinywang Aug 4, 2026
55b4dc3
test: harden Hermes integration fixtures
austinywang Aug 4, 2026
4ff40fe
Harden Hermes hook routing and process matching
austinywang Aug 4, 2026
ed841e0
test: require automatic Hermes hook activation
Aug 4, 2026
25dbdc9
test: reject premature Hermes smart-approval notifications
Aug 5, 2026
5d286ed
feat: activate lifecycle-accurate Hermes hooks
Aug 5, 2026
9f9872e
test: cover Hermes review regressions
austinywang Aug 6, 2026
5252b32
fix: address Hermes lifecycle review findings
austinywang Aug 6, 2026
edce9f5
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 6, 2026
20fe7ba
test: cover remaining Hermes review regressions
austinywang Aug 7, 2026
65e56c4
fix: address remaining Hermes review findings
austinywang Aug 7, 2026
1dcf576
test: cover real Hermes restore and Vault presentation
austinywang Aug 7, 2026
b36be1d
fix: detect installed Hermes runtime and restore its official icon
austinywang Aug 7, 2026
fe7f723
test: cover Hermes deterministic restore review findings
austinywang Aug 7, 2026
2331088
fix: address Hermes deterministic restore review findings
austinywang Aug 7, 2026
dedd6a1
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 7, 2026
af2bc23
fix: close Hermes approval and quit-time review gaps
austinywang Aug 7, 2026
be48d25
test: cover Hermes profile launch review gaps
austinywang Aug 7, 2026
46b95df
fix: complete Hermes profile hook routing
austinywang Aug 7, 2026
4a64c5c
test: cover Hermes review regressions
austinywang Aug 7, 2026
37677f6
fix: address Hermes restore review findings
austinywang Aug 7, 2026
af49efb
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 7, 2026
a9d8d50
test: cover remaining Hermes review regressions
austinywang Aug 7, 2026
6f627a7
fix: close remaining Hermes review gaps
austinywang Aug 7, 2026
872e31f
test: cover Hermes live alias and quit watchdog regressions
austinywang Aug 7, 2026
83e69db
fix: close Hermes live alias and quit watchdog regressions
austinywang Aug 7, 2026
0ab2fe6
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 7, 2026
3d3a4e1
test: cover Hermes TUI lifecycle bridge
austinywang Aug 8, 2026
7d6ba1f
fix: bridge Hermes TUI lifecycle into cmux
austinywang Aug 8, 2026
bbbc367
test: bound Hermes TUI watcher CPU
austinywang Aug 8, 2026
3e263ff
fix: keep Hermes TUI watcher idle
austinywang Aug 8, 2026
656823b
test: cover repeated Hermes TUI completions
austinywang Aug 8, 2026
f568ecb
fix: bridge Hermes hooks into TUI gateway
austinywang Aug 8, 2026
f3dd028
test: cover Hermes TUI approval resume identity
austinywang Aug 8, 2026
40b2796
fix: preserve Hermes TUI resume identity
austinywang Aug 9, 2026
0d5e6e6
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 9, 2026
9578b85
test: cover legacy Hermes restore and Vault indexing
austinywang Aug 9, 2026
e9000dd
fix: repair Hermes restore identity and Vault indexing
austinywang Aug 9, 2026
68d8b5c
test: cover repeated Hermes recovery failures
austinywang Aug 9, 2026
2c6df31
fix: preserve durable Hermes resume recovery
austinywang Aug 9, 2026
62f8762
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 9, 2026
d4e6f5f
fix: deduplicate Hermes completion replays
austinywang Aug 9, 2026
cfe9259
test: cover Hermes Vault profile mismatch
austinywang Aug 9, 2026
6c298ae
fix: pin Hermes Vault resumes to indexed profile
austinywang Aug 9, 2026
ef83242
test: cover default Hermes autoresume profile drift
austinywang Aug 9, 2026
5bf855d
fix: pin Hermes autoresume to session profile
austinywang Aug 9, 2026
12ca7a1
test: cover missing Hermes resume checkpoints
austinywang Aug 9, 2026
c086ce4
test: cover Hermes gateway bootstrap routing
austinywang Aug 9, 2026
8d661ac
fix: recover durable Hermes resume sessions
austinywang Aug 9, 2026
433865d
fix: keep quit snapshot loading off main actor
austinywang Aug 9, 2026
f04e62c
test: cover retired Hermes restore checkpoint
austinywang Aug 9, 2026
8c580ff
fix: rearm retired Hermes restore sessions
austinywang Aug 9, 2026
6822bba
test: cover stale Hermes Python wrapper restore
austinywang Aug 9, 2026
bce2108
fix: reject stale Hermes Python wrappers
austinywang Aug 9, 2026
b6e7b86
test: cover Hermes bridge fallback without watcher
austinywang Aug 9, 2026
ba01c8f
fix: fail open stale Hermes Python bridge
austinywang Aug 9, 2026
c3ec08c
test: cover PATH-shadowed Hermes bash launchers
austinywang Aug 9, 2026
4d743ba
fix: keep Hermes launch shims native
austinywang Aug 9, 2026
fc065ac
test: cover idle Python Hermes autoresume
austinywang Aug 9, 2026
a7ab936
fix: detect venv Hermes resume sessions
austinywang Aug 9, 2026
0cef8a8
test: reject unrelated Python Hermes arguments
austinywang Aug 9, 2026
53539c0
fix: constrain Python Hermes entrypoint detection
austinywang Aug 9, 2026
0ff8b44
Merge remote-tracking branch 'origin/main' into issue-9520-hermes-fir…
austinywang Aug 9, 2026
8ed29f2
test: cover idle Hermes second-launch restore
austinywang Aug 9, 2026
6ddb161
fix: rearm Hermes restore after completed turn
austinywang Aug 9, 2026
969d72f
test: cover reused Hermes resume record
austinywang Aug 9, 2026
021d871
fix: rearm Hermes after hook record reuse
austinywang Aug 9, 2026
9071bbc
test: cover attached Hermes short resume
austinywang Aug 9, 2026
12ea44f
fix: parse attached Hermes short resume
austinywang Aug 9, 2026
c429a0a
test: cover Hermes Vault managed wrapper routing
austinywang Aug 9, 2026
7fda3a8
fix: route Hermes Vault resume through managed wrapper
austinywang Aug 9, 2026
dbddb21
test: cover Hermes app snapshot decoding
austinywang Aug 9, 2026
e5cdb71
fix: decode persisted Hermes registration
austinywang Aug 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ jobs:
CMUX_CLI_BIN="$CLI_BIN" python3 tests/test_cli_socket_autodiscovery.py
python3 tests/test_codex_wrapper_resume_hooks.py
python3 tests/test_claude_wrapper_hooks.py
python3 tests/test_hermes_wrapper_hooks.py
python3 tests/test_claude_wrapper_mutual_shim_loop.py
python3 tests/test_claude_wrapper_shim_root_survives_tmpdir_change.py
python3 tests/test_claude_wrapper_user_binary_resolution.py
Expand Down
8 changes: 3 additions & 5 deletions Assets.xcassets/AgentIcons/HermesAgent.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"images" : [
{
"filename" : "HermesAgent.svg",
"idiom" : "universal"
"filename" : "HermesAgent.png",
"idiom" : "universal",
"scale" : "1x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

2 changes: 1 addition & 1 deletion CLI/AgentHookNotificationPolicy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ enum AgentHookNotificationClassifier {
}

enum AgentHookNotificationPolicy {
static let dedupeEligibleAgents: Set<String> = ["grok", "antigravity"]
static let dedupeEligibleAgents: Set<String> = ["grok", "antigravity", "hermes-agent"]

static func notificationTitle(
agentName: String,
Expand Down
3 changes: 3 additions & 0 deletions CLI/CMUXCLI+AgentHookCatalog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extension CMUXCLI {
.init(agentEvent: "Notification", cmuxSubcommand: "notification"),
.init(agentEvent: "SessionEnd", cmuxSubcommand: "session-end"),
],
dispatch: .pinned(marker: "cmux-grok-hook-v2"),
publishesStopNotification: false,
sessionEndIsTurnBoundary: true,
feedHookEvents: ["PreToolUse"]
Expand Down Expand Up @@ -142,6 +143,7 @@ extension CMUXCLI {
.init(agentEvent: "SessionEnd", cmuxSubcommand: "session-end"),
],
aliases: ["agy"],
dispatch: .pinned(marker: "cmux-antigravity-hook-v2"),
sessionEndIsTurnBoundary: true
),
AgentHookDef(
Expand All @@ -159,6 +161,7 @@ extension CMUXCLI {
AgentHookDef(
name: "hermes-agent", displayName: "Hermes Agent", statusKey: "hermes-agent",
configDir: ".hermes", configFile: "config.yaml", configDirEnvOverride: "HERMES_HOME",
createConfigDirIfMissing: true,
binaryName: "hermes",
sessionStoreSuffix: "hermes-agent", disableEnvVar: "CMUX_HERMES_AGENT_HOOKS_DISABLED",
hookMarker: "cmux hooks hermes-agent", format: .hermesAgentYAML,
Expand Down
44 changes: 30 additions & 14 deletions CLI/CMUXCLI+AgentHookDefinitions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ extension CMUXCLI {
let format: HookFormat
let events: [HookEvent]
let aliases: Set<String>
/// How installed hooks find the cmux instance that owns them.
///
/// `.ambient` is appropriate when an agent preserves the launch environment. `.pinned`
/// embeds the installing CLI and socket, which is required for agents that sanitize hook
/// subprocess environments and keeps callbacks attributed to the correct tagged app.
let dispatch: HookDispatch
let publishesStopNotification: Bool
/// Whether this agent's `SessionEnd`/`session-end` hook fires once per
/// conversation turn rather than at a true session teardown.
Expand Down Expand Up @@ -62,6 +68,11 @@ extension CMUXCLI {
case tomlArrayTable // ~/.kimi/config.toml [[hooks]] array-of-tables
}

enum HookDispatch {
case ambient
case pinned(marker: String)
}

struct HookEvent {
let agentEvent: String
let cmuxSubcommand: String
Expand Down Expand Up @@ -109,6 +120,7 @@ extension CMUXCLI {
sessionStoreSuffix: String, disableEnvVar: String, hookMarker: String,
format: HookFormat, events: [HookEvent],
aliases: Set<String> = [],
dispatch: HookDispatch = .ambient,
publishesStopNotification: Bool = true,
sessionEndIsTurnBoundary: Bool = false,
feedHookEvents: [String] = [],
Expand All @@ -123,6 +135,7 @@ extension CMUXCLI {
self.binaryName = binaryName ?? name
self.sessionStoreSuffix = sessionStoreSuffix; self.disableEnvVar = disableEnvVar
self.hookMarker = hookMarker; self.format = format; self.events = events
self.dispatch = dispatch
self.publishesStopNotification = publishesStopNotification
self.sessionEndIsTurnBoundary = sessionEndIsTurnBoundary
self.aliases = Set(aliases.compactMap { alias in
Expand Down Expand Up @@ -246,15 +259,12 @@ extension CMUXCLI {
return "{ \(command); }"
}

private static let grokPinnedHookMarker = "cmux-grok-hook-v2"
private static let antigravityPinnedHookMarker = "cmux-antigravity-hook-v2"

private static func agentHookShellCommand(
_ command: String,
for def: AgentHookDef,
noOpCommand: String = "echo '{}'"
) -> String {
if usesPinnedHookDispatch(def) {
if case .pinned = def.dispatch {
return pinnedAgentHookShellCommand(command, for: def, noOpCommand: noOpCommand)
}
let routedArguments = command.hasPrefix("cmux ") ? String(command.dropFirst("cmux ".count)) : command
Expand All @@ -272,19 +282,14 @@ extension CMUXCLI {
return "cmux_cli=\"${CMUX_BUNDLED_CLI_PATH:-}\"; if [ -z \"$cmux_cli\" ] || [ ! -x \"$cmux_cli\" ]; then cmux_cli=\"$(command -v cmux 2>/dev/null || true)\"; fi; if [ -n \"$CMUX_SURFACE_ID\" ] && [ \"$\(def.disableEnvVar)\" != \"1\" ] && [ -n \"$cmux_cli\" ]; then if [ -n \"${CMUX_SOCKET_PATH:-}\" ]; then \"$cmux_cli\" --socket \"$CMUX_SOCKET_PATH\" \(routedArguments); else \"$cmux_cli\" \(routedArguments); fi; status=$?; if [ \"$status\" -eq 2 ]; then exit 2; fi; if [ \"$status\" -ne 0 ]; then \(noOpSnippet); fi; else \(noOpSnippet); fi"
}

private static func usesPinnedHookDispatch(_ def: AgentHookDef) -> Bool {
def.name == "grok" || def.name == "antigravity"
}

private static func pinnedHookMarker(for def: AgentHookDef) -> String {
def.name == "antigravity" ? antigravityPinnedHookMarker : grokPinnedHookMarker
}

private static func pinnedAgentHookShellCommand(
_ command: String,
for def: AgentHookDef,
noOpCommand: String = "echo '{}'"
) -> String {
guard case .pinned(let marker) = def.dispatch else {
return agentHookShellCommand(command, for: def, noOpCommand: noOpCommand)
}
let routedArguments = command.hasPrefix("cmux ") ? String(command.dropFirst("cmux ".count)) : command
let socketPath = pinnedAgentHookSocketPath()
let noOpSnippet = shellNoOpSnippet(noOpCommand)
Expand Down Expand Up @@ -324,7 +329,7 @@ extension CMUXCLI {
} else {
dispatch = "command -v cmux >/dev/null 2>&1 && \(fallbackInvocation) || \(noOpSnippet)"
}
return ": \(pinnedHookMarker(for: def)); \(shellTraceStart); printenv \(def.disableEnvVar) | grep -qx 1 && { \(shellTraceDisabled); \(noOpSnippet); } || { \(dispatch); cmux_hook_status=$?; \(shellTraceExit); exit $cmux_hook_status; }"
return ": \(marker); \(shellTraceStart); printenv \(def.disableEnvVar) | grep -qx 1 && { \(shellTraceDisabled); \(noOpSnippet); } || { \(dispatch); cmux_hook_status=$?; \(shellTraceExit); exit $cmux_hook_status; }"
}

private static func pinnedHookInvocation(
Expand Down Expand Up @@ -389,6 +394,17 @@ extension CMUXCLI {
return "/tmp/cmux-debug-\(slug).sock"
}

static func validateHookInstallDispatch(for def: AgentHookDef) throws {
guard case .pinned = def.dispatch,
pinnedAgentHookSocketPath() == nil else {
return
}
throw CLIError(message: String(
localized: "cli.hooks.error.pinnedTargetMissing",
defaultValue: "cmux could not connect this hook installation to a running app. Open a cmux workspace and run this command again."
))
}

private static func pinnedHookShellTraceCommand(
agentName: String,
phase: String,
Expand Down Expand Up @@ -434,7 +450,7 @@ extension CMUXCLI {
}

static func isCmuxOwnedHookCommand(_ command: String, for def: AgentHookDef, includeLegacy: Bool = true) -> Bool {
if usesPinnedHookDispatch(def), command.contains(pinnedHookMarker(for: def)) {
if case .pinned(let marker) = def.dispatch, command.contains(marker) {
return true
}
if def.name == "codex", isCmuxOwnedCodexHookScriptCommand(command) {
Expand Down
29 changes: 17 additions & 12 deletions CLI/CMUXCLI+ExecutableResolution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@ extension CMUXCLI {
return prefix.contains("cmux claude wrapper - injects hooks and session tracking")
}

func isCmuxClaudeCommandShim(at path: String) -> Bool {
func isCmuxAgentCommandShim(at path: String) -> Bool {
let candidate = URL(fileURLWithPath: path, isDirectory: false)
.standardizedFileURL
.path
let environment = ProcessInfo.processInfo.environment
let shimPaths = [
environment["CMUX_CLAUDE_WRAPPER_SHIM"],
]
for shimPath in shimPaths {
guard let shimPath else { continue }
for (key, rawPath) in environment where key.hasSuffix("_WRAPPER_SHIM") {
let shimPath = rawPath.trimmingCharacters(in: .whitespacesAndNewlines)
guard !shimPath.isEmpty else { continue }
let standardizedShim = URL(fileURLWithPath: shimPath, isDirectory: false)
.standardizedFileURL
.path
Expand All @@ -55,16 +53,22 @@ extension CMUXCLI {
}
}

let shimRoots: [String?] = [
environment["CMUX_CLAUDE_WRAPPER_SHIM_ROOT"],
var shimRoots = environment.compactMap { key, rawPath -> String? in
guard key == "CMUX_AGENT_COMMAND_SHIM_ROOT" || key.hasSuffix("_WRAPPER_SHIM_ROOT") else {
return nil
}
return rawPath
}
shimRoots.append(contentsOf: [
URL(fileURLWithPath: environment["TMPDIR"] ?? NSTemporaryDirectory(), isDirectory: true)
.appendingPathComponent("cmux-cli-shims", isDirectory: true)
.standardizedFileURL
.path,
"/tmp/cmux-cli-shims",
]
])
for shimRoot in shimRoots {
guard let shimRoot else { continue }
let shimRoot = shimRoot.trimmingCharacters(in: .whitespacesAndNewlines)
guard !shimRoot.isEmpty else { continue }
let standardizedRoot = URL(fileURLWithPath: shimRoot, isDirectory: true)
.standardizedFileURL
.path
Expand Down Expand Up @@ -94,6 +98,7 @@ extension CMUXCLI {
!isDirectory.boolValue,
FileManager.default.isExecutableFile(atPath: candidate) else { continue }
guard !isBundledProviderExecutable(at: candidate) else { continue }
guard !isCmuxAgentCommandShim(at: candidate) else { continue }
if let skip, skip(candidate) { continue }
return candidate
}
Expand All @@ -109,7 +114,7 @@ extension CMUXCLI {
!isDirectory.boolValue,
FileManager.default.isExecutableFile(atPath: trimmed),
!isBundledProviderExecutable(at: trimmed),
!isCmuxClaudeCommandShim(at: trimmed),
!isCmuxAgentCommandShim(at: trimmed),
!isCmuxClaudeWrapper(at: trimmed) else { continue }
return URL(fileURLWithPath: trimmed, isDirectory: false).standardizedFileURL.path
}
Expand All @@ -121,7 +126,7 @@ extension CMUXCLI {
resolveExecutableInSearchPath(
"claude",
searchPath: searchPath,
skip: { self.isCmuxClaudeCommandShim(at: $0) || self.isCmuxClaudeWrapper(at: $0) }
skip: { self.isCmuxClaudeWrapper(at: $0) }
)
}

Expand Down
Loading