Source fallback on session_compact, steer delivery when not idle, and
kept-window inject entries address lost-reinject second-compact failure.
Co-authored-by: Cursor <cursoragent@cursor.com>
Explain idle vs mid-turn delivery with pi-auto-compact and how to use
debug snapshots when last compaction shows none incorrectly.
Co-authored-by: Cursor <cursoragent@cursor.com>
Record b003-repro and npm test results; full two-compact RPC needs long
session like production repro in lost-reinject.jsonl.
Co-authored-by: Cursor <cursoragent@cursor.com>
Run compaction fallback, kept inject, and mid-turn steer tests; document
lost-reinject.jsonl auto→null source signature from the original bug.
Co-authored-by: Cursor <cursoragent@cursor.com>
Log sourceInferred, isIdle, deliveryBranch on session_compact and
mid_turn_deliver after steer for B-003 troubleshooting.
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover steer delivery clearing pending, empty pending no-op, and skip
consume when steer already ran for the same compaction entry id.
Co-authored-by: Cursor <cursoragent@cursor.com>
When agent is not idle after auto compaction, deliver pending reinject
immediately via steer instead of waiting for before_agent_start.
Co-authored-by: Cursor <cursoragent@cursor.com>
Deliver pending skills on session_compact when agent is not idle, and
skip before_agent_start consume when steer already ran for compaction.
Co-authored-by: Cursor <cursoragent@cursor.com>
Verify inject custom messages count as present in kept slice and are
ignored when compaction firstKeptEntryId starts after them.
Co-authored-by: Cursor <cursoragent@cursor.com>
Treat defer reinject custom_message entries like user skill blocks so
a second compaction does not plan redundant reinject for same skill.
Co-authored-by: Cursor <cursoragent@cursor.com>
Cover session_compact without prior before_compact inferring auto, and
manual /compact preserving manual source with reinject off by default.
Co-authored-by: Cursor <cursoragent@cursor.com>
Safety net when session_before_compact does not run so auto compaction
still sets lastCompactionSource and passes the reinject gate.
Co-authored-by: Cursor <cursoragent@cursor.com>
Extract shared helper so session_before_compact and session_compact can
both infer auto when compaction was not explicitly manual.
Co-authored-by: Cursor <cursoragent@cursor.com>
Document root cause and fix strategy from lost-reinject.jsonl analysis.
Add B-003 to BACKLOG; ignore *.ndjson and *.jsonl session dumps.
Co-authored-by: Cursor <cursoragent@cursor.com>
Defer planning, consume filter, disk fallback, and unit regression gate; short RPC E2E documented in docs/e2e-b002-post-fix.md.
Co-authored-by: Cursor <cursoragent@cursor.com>
Post-fix script and doc: automated tests cover loose defer path; short RPC session keeps skill in kept so compact reinject not triggered.
Co-authored-by: Cursor <cursoragent@cursor.com>
resolveReinjectSkillNames includes tracked skills on disk when requireRegistered is false so /skill-reinject now works without resourceLoader entry.
Co-authored-by: Cursor <cursoragent@cursor.com>
buildReinjectBlocks uses tracked filePath/baseDir when resourceLoader has no entry and requireRegistered is false, completing defer-path B-002 injection.
Co-authored-by: Cursor <cursoragent@cursor.com>
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>
Default false so CLI --skill paths can be re-injected from disk in later Phase 14 items; explicit true restores registered-only behavior.
Co-authored-by: Cursor <cursoragent@cursor.com>
Reflect completed checklist items for Phase 14 so the phase state matches
already-committed implementation and repro evidence.
Co-authored-by: Cursor <cursoragent@cursor.com>
RPC E2E with debug shows registered present at session_compact but planned=[]
because kept still contains the skill block; registered=[] still drops skills
absent from kept. Sync file readSettings avoids RPC hook deadlock on
SettingsManager/isProjectTrusted.
Co-authored-by: Cursor <cursoragent@cursor.com>
Expose settings.debug snapshots on session_compact and before_agent_start
so Phase 14 can see which filter stage drops --skill paths.
Co-authored-by: Cursor <cursoragent@cursor.com>
Закрывает план для BACKLOG B-002: отложенная registered-фильтрация в defer-path, loose fallback по filePath на диске, settings.requireRegistered как opt-out. Чеклист включает диагностический подпункт перед фиксом, чтобы подтвердить гипотезу о фильтре.
Co-authored-by: Cursor <cursoragent@cursor.com>
LiteLLM works via pi-provider-litellm; remaining gap is skill
registration for planReinject when skills load only via --skill CLI.
Co-authored-by: Cursor <cursoragent@cursor.com>
Document implemented status, pi -e installation, /skill-reinject usage,
and coexistence guidance per SPEC §9.1 and §16.7.
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>
Slash commands persist state changes in hasUI=false mode without calling notify; export handler for regression tests.
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>
Wire debug force re-inject through the existing immediate delivery path with registered skills from the session.
Co-authored-by: Cursor <cursoragent@cursor.com>
Persist autoCompactIntegration override in state and wire resolveDeliveryMode plus status delivery line.
Co-authored-by: Cursor <cursoragent@cursor.com>
Write skillReinject.enabled to ~/.pi/agent/settings.json via merge write without clobbering other keys.
Co-authored-by: Cursor <cursoragent@cursor.com>