Which area does this affect?
Provider support (new or existing)
What problem are you trying to solve?
code-insights install-hook currently configures only Claude Code's SessionEnd hook. Cursor users can sync sessions manually, but they do not have an equivalent automatic workflow after an Agent turn completes.
Recent Cursor versions expose native hooks through ~/.cursor/hooks.json. The reliable end-of-turn event is stop, whose payload includes conversation_id, transcript_path, status, token counts, and workspace roots.
Using Cursor's sessionEnd event is currently problematic: it fires when the composer/tab is explicitly closed rather than after each completed turn, and command execution on window_close has a known Cursor lifecycle bug. Running LLM analysis on every stop would also repeatedly consume credits for the same growing session.
Proposed solution
Add provider selection to the hook commands:
code-insights install-hook --cursor
code-insights uninstall-hook --cursor
The Cursor installer should:
- Preserve unrelated settings and hooks in
~/.cursor/hooks.json.
- Install one native
stop command hook.
- Sync only the
transcript_path supplied by Cursor, using the Cursor provider.
- Avoid automatic LLM analysis on every turn; analysis remains explicit or can be added later when Cursor exposes a reliable final-session lifecycle.
- Be idempotent and support symmetric uninstall.
- Continue to leave the existing Claude Code behavior as the default.
The hook entry point should accept Cursor's conversation_id payload field and ignore unsuccessful/non-terminal stop events safely.
Alternatives you've considered
- Use Cursor
sessionEnd: currently unreliable on window close and not an end-of-turn event.
- Run
code-insights sync --source cursor manually: works but loses automatic ingestion.
- Analyze on every
stop: technically possible, but wasteful because a multi-turn session would be re-analyzed repeatedly.
- Replace the Claude hook behavior: rejected because it would break backward compatibility.
Contribution
Which area does this affect?
Provider support (new or existing)
What problem are you trying to solve?
code-insights install-hookcurrently configures only Claude Code'sSessionEndhook. Cursor users can sync sessions manually, but they do not have an equivalent automatic workflow after an Agent turn completes.Recent Cursor versions expose native hooks through
~/.cursor/hooks.json. The reliable end-of-turn event isstop, whose payload includesconversation_id,transcript_path, status, token counts, and workspace roots.Using Cursor's
sessionEndevent is currently problematic: it fires when the composer/tab is explicitly closed rather than after each completed turn, and command execution onwindow_closehas a known Cursor lifecycle bug. Running LLM analysis on everystopwould also repeatedly consume credits for the same growing session.Proposed solution
Add provider selection to the hook commands:
The Cursor installer should:
~/.cursor/hooks.json.stopcommand hook.transcript_pathsupplied by Cursor, using the Cursor provider.The hook entry point should accept Cursor's
conversation_idpayload field and ignore unsuccessful/non-terminal stop events safely.Alternatives you've considered
sessionEnd: currently unreliable on window close and not an end-of-turn event.code-insights sync --source cursormanually: works but loses automatic ingestion.stop: technically possible, but wasteful because a multi-turn session would be re-analyzed repeatedly.Contribution