Pure decision logic for Cursor `postToolUse` hook events. Returns a soft `additional_context` payload (Cursor's documented `postToolUse` output shape) for exploration tools tracedecay can replace. Invalid or unrelated tool events fail open with no output. Session-level dedupe lives in [`cursor_post_tool_use_decision`]; this stays pure for tests.
(event_json: &str)
| 356 | /// dedupe lives in [`cursor_post_tool_use_decision`]; this stays pure for |
| 357 | /// tests. |
| 358 | pub fn evaluate_cursor_post_tool_use(event_json: &str) -> Option<String> { |
| 359 | let parsed: Value = serde_json::from_str(event_json).ok()?; |
| 360 | let hint = decide_hint(&cursor_tool_hint_input(&parsed))?; |
| 361 | Some( |
| 362 | serde_json::json!({ |
| 363 | "additional_context": format_tool_hint(&hint), |
| 364 | }) |
| 365 | .to_string(), |
| 366 | ) |
| 367 | } |
| 368 | |
| 369 | /// Impure `postToolUse` path: [`evaluate_cursor_post_tool_use`] plus |
| 370 | /// per-session hint dedupe persisted under the project's `.tracedecay/` dir. |