MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / evaluate_cursor_post_tool_use

Function evaluate_cursor_post_tool_use

src/hooks/cursor.rs:358–367  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

356/// dedupe lives in [`cursor_post_tool_use_decision`]; this stays pure for
357/// tests.
358pub 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.

Calls 2

decide_hintFunction · 0.85
cursor_tool_hint_inputFunction · 0.85