planDeferredReinject locks pending by kept-window only; defer path in index uses it while immediate keeps registered filter at compact time.
Co-authored-by: Cursor <cursoragent@cursor.com>
Every session_compact replans pendingReinject in defer mode; skipped reinject clears the queue unless manual compaction is waiting for the next user prompt.
Co-authored-by: Cursor <cursoragent@cursor.com>
Optional maxSkills setting sets the warn threshold; when unset, re-injecting more than three tracked skills emits a one-time UI warning without blocking delivery.
Co-authored-by: Cursor <cursoragent@cursor.com>
Duplicate names in resourceLoader resolve to the first skill with a one-time UI warning during re-inject expansion.
Co-authored-by: Cursor <cursoragent@cursor.com>
Stale pendingReinject from auto compaction is blocked until the next user prompt after manual /compact with default settings; a later auto compaction resets the clear flag.
Co-authored-by: Cursor <cursoragent@cursor.com>
Uses idle vs followUp delivery based on ctx.isIdle(); skips unregistered skills via existing buildReinjectBlocks warnings.
Co-authored-by: Cursor <cursoragent@cursor.com>
buildReinjectBlocks checks registration and file presence before expandSkill; warns via ctx.ui when hasUI, no-op in RPC/print mode.
Co-authored-by: Cursor <cursoragent@cursor.com>
Uses deliverAs followUp for every skill block so re-inject does not interrupt an active agent turn or overflow recovery.
Co-authored-by: Cursor <cursoragent@cursor.com>
Extracts buildReinjectBlocks for shared expand logic; immediate delivery when the agent is idle uses sendUserMessage without deliverAs for the first block only.
Co-authored-by: Cursor <cursoragent@cursor.com>
Builds one injected custom message from pendingReinject via expandSkill, clears the queue only after content is built successfully.
Co-authored-by: Cursor <cursoragent@cursor.com>
Defer delivery stores planned skill names in pendingReinject for injection on the next before_agent_start, avoiding races with pi-auto-compact follow-ups.
Co-authored-by: Cursor <cursoragent@cursor.com>
Computes which tracked skills need re-inject after compaction by slicing the kept branch and excluding skills still present in kept user messages or unregistered on disk.
Co-authored-by: Cursor <cursoragent@cursor.com>