Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(hooks): report the outcome of Gemini CLI tool calls

João Matheusae0db8ead31b
diff --git a/crates/ai-memory-hooks/src/capture_policy.rs b/crates/ai-memory-hooks/src/capture_policy.rs
index f26cb1f0..2ec7e1b7 100644
--- a/crates/ai-memory-hooks/src/capture_policy.rs
+++ b/crates/ai-memory-hooks/src/capture_policy.rs
@@ -472,6 +472,17 @@ pub(crate) fn tool_observation_outcome(agent: AgentKind, raw: &Value) -> ToolOut
Some(false) => ToolOutcome::Error,
None => ToolOutcome::Unknown,
},
+ // Gemini CLI's AfterTool `tool_response` has an `error` object only
+ // when the call failed: "If this property is present, the tool call
+ // is considered a failure" (`ToolResult`, packages/core/src/tools/
+ // tools.ts, v0.66.0). A payload without `tool_response` proves nothing.
+ AgentKind::GeminiCli => match raw.get("tool_response").and_then(Value::as_object) {
+ Some(response) => match response.get("error") {
+ None | Some(Value::Null) => ToolOutcome::Success,
+ Some(_) => ToolOutcome::Error,
+ },
+ None => ToolOutcome::Unknown,
+ },
AgentKind::AntigravityCli
if raw
.get("error")