Skip to content

feat(cli): wire Cursor /summarize for hub-driven context compaction #738

@heavygee

Description

@heavygee

Summary

Cursor has context summarization (/summarize, auto-summarize near window limit) in the product, but HAPI does not route slash/special commands for the Cursor agent flavor. Peer relocate and post-fork parent compaction depend on queuing /summarize (or equivalent) through the hub message path — today that only works reliably for Claude (/compact) and Codex.

Gap: integration, not missing Cursor capability. See fork dogfood: docs/plans/peer-relocate-dogfood-1.md and peer-agent spec §4.4.1.

Current behavior

  • shared/src/slashCommands.ts: BUILTIN_SLASH_COMMANDS.cursor is [] (empty).
  • cli/src/cursor/cursorRemoteLauncher.ts: hub messages go to agent -p … --resume … with no parseSpecialCommand handling (unlike cli/src/claude/runClaude.ts + claudeRemote.ts).
  • Web may list slash commands from session metadata, but Cursor builtins are not seeded.

Desired behavior

  1. Builtin slash list for cursor — at minimum: summarize (and document whether IDE /summarize works headless via -p).
  2. parseSpecialCommand parity in cursorRemoteLauncher (or shared remote path):
    • /summarize → trigger Cursor context summarization with optional trailing instructions (peer relocate compact prompt).
    • Consider /clear if supported by Cursor CLI.
  3. Hub spawn-peer parentContext — when parentContext.policy=compact and flavor is cursor, queue /summarize … and observe token-count / usage drop (target 40% utilization per product spec).
  4. Tests — unit tests for command parsing; optional integration note in cursorRemoteLauncher tests.

Related

Acceptance criteria

  • getBuiltinSlashCommands('cursor') includes summarize with accurate description.
  • User/hub message /summarize … on a Cursor session is handled intentionally (not passed as opaque prompt only — or documented if opaque pass-through is sufficient and verified).
  • Peer relocate dogfood can set parentCompact.reachedTarget on Cursor after summarize (measure via existing token-count events).
  • No regression to normal Cursor message delivery.

Investigation notes for implementer

  • Verify Cursor headless CLI: does -p "/summarize" or -p "/summarize <instructions>" invoke the same summarization as IDE?
  • Forum reports: /summarize exists; quality varies; may compress ~190k → ~1k tokens.
  • If slash pass-through works without parser, document and add tests; else wire explicit branch like Claude /compact.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions