Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
fix(hooks): capture Cursor tool observation bodies
AkitaOnRails8bb89e282695
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 269413ff..62b7fcaa 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]### Fixed+- Fixed Cursor tool calls being stored with no title or content: Cursor's own+ hooks, and the Claude Code hooks Cursor also runs, send Claude's+ `tool_name`/`tool_input` fields, but Cursor was missing from the tool-capture+ mapping, so every Cursor tool observation reached the store empty. They now+ get the same tool-family title and output summary as Claude Code's.- Corrected the Claude Desktop documentation: Linux is an Anthropic beta forDebian-based distributions with its config at`~/.config/Claude/claude_desktop_config.json` (pass it todiff --git a/crates/ai-memory-hooks/src/capture_policy.rs b/crates/ai-memory-hooks/src/capture_policy.rsindex e13e8e53..5e317b22 100644--- a/crates/ai-memory-hooks/src/capture_policy.rs+++ b/crates/ai-memory-hooks/src/capture_policy.rs@@ -176,9 +176,12 @@ pub(crate) fn tool_observation_metadata(// `tool_input` shape (#1040) — unverified against a real tool-call id// field, but `tool_use_id` extraction degrades to `None` gracefully// if absent.+ // Cursor's own hooks and its copies of the Claude Code hooks carry+ // `tool_name`/`tool_input`/`tool_use_id` (captured live, Cursor 3.24.9).AgentKind::ClaudeCode| AgentKind::CommandCode| AgentKind::Codex+ | AgentKind::Cursor| AgentKind::Grok| AgentKind::Grizzybot| AgentKind::Zcode@@ -227,6 +230,7 @@ pub(crate) fn tool_observation_metadata(AgentKind::ClaudeCode| AgentKind::CommandCode| AgentKind::Codex+ | AgentKind::Cursor| AgentKind::Grok| AgentKind::Hermes| AgentKind::KiroClidiff --git a/crates/ai-memory-hooks/src/payload.rs b/crates/ai-memory-hooks/src/payload.rsindex 8ac62852..dc5486a7 100644--- a/crates/ai-memory-hooks/src/payload.rs+++ b/crates/ai-memory-hooks/src/payload.rs@@ -813,6 +813,9 @@ const fn closed_tool_agent(agent: AgentKind) -> bool {AgentKind::ClaudeCode| AgentKind::CommandCode| AgentKind::Codex+ // Cursor's own hooks and its copies of the Claude Code hooks carry+ // Claude's snake_case tool aliases.+ | AgentKind::Cursor| AgentKind::OpenCode| AgentKind::Pi| AgentKind::Omp@@ -2802,6 +2805,56 @@ mod tests {);}+ /// Cursor runs the Claude Code hooks too, sending its own payload with+ /// Claude's `tool_name`/`tool_input` aliases and the result as a JSON+ /// string in `tool_output`. The payload marks the event as Cursor's, and+ /// Cursor was absent from `closed_tool_agent`, so its tool observations+ /// were stored with no title or body (captured live from Cursor 3.24.9).+ #[test]+ fn cursor_tool_events_keep_their_family_title_and_output() {+ let post = HookEnvelope::from_query_and_body(+ HookQuery {+ event: "post-tool-use".into(),+ agent: Some("claude-code".into()),+ ..Default::default()+ },+ serde_json::json!({+ "conversation_id": "17689370-2e8e-4dfd-bcd0-7e5bb9cd19ed",+ "session_id": "17689370-2e8e-4dfd-bcd0-7e5bb9cd19ed",+ "hook_event_name": "postToolUse",+ "cursor_version": "3.24.9",+ "tool_name": "Shell",+ "tool_input": {"command": "ls", "cwd": "", "timeout": 30000},+ "tool_output": "{\"output\":\"MARKER_CURSOR_OUTPUT\",\"exitCode\":0}",+ "tool_use_id": "9fc522a1-2a0e-4847-9ffc-24256e023574",+ "cwd": "",+ "workspace_roots": [],+ }),+ );+ assert_eq!(post.agent, AgentKind::Cursor);+ assert_eq!(post.title_hint.as_deref(), Some("tool non-file"));+ let body = post.body_excerpt.expect("cursor post-tool body");+ assert!(body.contains("MARKER_CURSOR_OUTPUT"), "{body:?}");++ let pre = HookEnvelope::from_query_and_body(+ HookQuery {+ event: "pre-tool-use".into(),+ agent: Some("claude-code".into()),+ ..Default::default()+ },+ serde_json::json!({+ "session_id": "17689370-2e8e-4dfd-bcd0-7e5bb9cd19ed",+ "hook_event_name": "preToolUse",+ "cursor_version": "3.24.9",+ "tool_name": "Shell",+ "tool_input": {"command": "ls", "cwd": "", "timeout": 30000},+ "tool_use_id": "9fc522a1-2a0e-4847-9ffc-24256e023574",+ }),+ );+ assert_eq!(pre.title_hint.as_deref(), Some("tool non-file"));+ assert!(pre.body_excerpt.is_some_and(|body| !body.is_empty()));+ }+/// Grok Build CLI posts a `PostToolUse` with Claude Code's snake_case/// aliases (`tool_name` / `tool_input` / `tool_use_id`). It was absent from/// both `closed_tool_agent` and the `tool_observation_metadata` match, so