Skip to content

feat(cursor): support preCompact lifecycle hook - #2

Open
RaminGe wants to merge 1 commit into
develop212:mainfrom
RaminGe:feat/cursor-precompact
Open

RaminGe wants to merge 1 commit into
develop212:mainfrom
RaminGe:feat/cursor-precompact

Conversation

@RaminGe

@RaminGe RaminGe commented Oct 20, 2026

Copy link
Copy Markdown

Summary

Brings the Cursor adapter to parity with Claude Code by supporting Cursor's preCompact lifecycle hook when context compaction occurs.

  • Hook Mapping: Handles preCompact in adapters/cursor.mjs to transition the agent to thinking with activity "Tidying up memory".
  • Auto-relax to idle (10s): Unlike Claude Code (which immediately proceeds into an agent loop turn), Cursor allows users to trigger compaction manually via the "Summarize" UI button while idle. Cursor sends no follow-up stop or completion event for manual summarization. To prevent the agent from being indefinitely stuck in the thinking state, bin/agent-floor.mjs safely transitions the agent back to idle after 10 seconds if no subsequent event arrived.
  • Config & Docs: Adds preCompact to cursorHooks() in bin/agent-floor.mjs and updates the snippet in docs/integrations.md.
  • Tests: Adds test coverage in test/protocol.test.mjs.

Verification

  • npm test: 10/10 tests passing.
  • npm run typecheck: 0 errors.
  • npm run build: builds cleanly.

- Handle preCompact in cursor adapter to display memory compaction status
- Auto-relax agent back to idle after 10s if no subsequent event arrives
- Add preCompact to cursorHooks setup list and docs snippet
- Add test coverage in test/protocol.test.mjs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant