CursorAgentAdapter currently treats every tool_call record as a new tool invocation, but Cursor emits both started and completed subtypes for the same call. Because normalization does not filter by subtype, the adapter can emit duplicate tool events and double count downstream activity.
Observed Findings
src/adapters/cursor-agent.ts handles every record with type === "tool_call" the same way.
- The adapter does not inspect
subtype, even though Cursor records include started and completed variants for the same call_id / model_call_id.
src/limits/max-steps.ts already treats Cursor tool_call records as subtype-aware, counting only subtype === "started".
Suggested Behavior
- Only count or emit the initial tool invocation once per logical call.
- Filter Cursor tool-call processing by
subtype so started and completed are handled intentionally instead of both being treated as separate calls.
- Preserve completion-only data such as tool results without incrementing counts again.
Resolution Summary
- Cursor normalization should not double count tool calls.
- Tool-call handling should be subtype-aware and match Cursor’s event model.
CursorAgentAdapter currently treats every
tool_callrecord as a new tool invocation, but Cursor emits bothstartedandcompletedsubtypes for the same call. Because normalization does not filter bysubtype, the adapter can emit duplicate tool events and double count downstream activity.Observed Findings
src/adapters/cursor-agent.tshandles every record withtype === "tool_call"the same way.subtype, even though Cursor records includestartedandcompletedvariants for the samecall_id/model_call_id.src/limits/max-steps.tsalready treats Cursortool_callrecords as subtype-aware, counting onlysubtype === "started".Suggested Behavior
subtypesostartedandcompletedare handled intentionally instead of both being treated as separate calls.Resolution Summary