24 Commits

Author SHA1 Message Date
grayhook 84535def76 Phase 15: extend debug diag with compaction source and delivery branch
Log sourceInferred, isIdle, deliveryBranch on session_compact and
mid_turn_deliver after steer for B-003 troubleshooting.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-18 23:01:47 +07:00
grayhook c98a1ff7be Phase 15: add mid-turn steer and before_agent_start dedup tests
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>
2026-06-18 23:00:50 +07:00
grayhook 37dd2211d7 Phase 15: add kept-window tests for skill-reinject:inject entries
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>
2026-06-18 22:58:43 +07:00
grayhook a6fb292dc3 Phase 15: add compaction source fallback regression tests
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>
2026-06-18 22:57:43 +07:00
grayhook 2f6f5477c5 Phase 14: deferred reinject regression tests — loose, strict, missing disk
test/reinject.test.ts gates B-002 defer-path filter and build behavior for requireRegistered and missing SKILL.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 17:35:51 +07:00
grayhook 459b8775f4 Phase 14: reinjectNow loose fallback for --skill paths — B-002 now command
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>
2026-06-17 17:35:19 +07:00
grayhook ebc169c91f Phase 14: build reinject blocks from tracked paths — loose skill disk fallback
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>
2026-06-17 17:34:43 +07:00
grayhook e63041bfc5 Phase 14: filter deferred pending on before_agent_start — registry + disk fallback
filterPendingReinjectForConsume applies fresh registered check at consume time; loose skills pass when requireRegistered is false and tracked SKILL.md exists.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 17:34:06 +07:00
grayhook a81337c08e Phase 14: defer reinject plan without registry at compaction — B-002 stage 1
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>
2026-06-17 17:31:43 +07:00
grayhook fe25e606b8 Phase 14: split kept-window filter from registry gate — defer planning stage
filterSkillsNeedingReinjectByKept tracks absent skills without registeredNames; immediate path keeps the combined filter.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 17:28:32 +07:00
grayhook aca68e73ee Phase 14: add requireRegistered setting — opt-out for strict registry filter
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>
2026-06-17 17:27:09 +07:00
grayhook ef9b7a8c30 Phase 14: B-002 pre-fix RPC repro — filter snapshots and readSettings fix
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>
2026-06-17 15:21:53 +07:00
grayhook 8f48040eac Phase 14: add debug reinject diag logging — B-002 filter visibility
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>
2026-06-17 14:29:56 +07:00
grayhook 09619d9dd8 Phase 12: recalculate pending on each compact — SPEC §16.6.
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>
2026-06-17 13:15:13 +07:00
grayhook 502ca39b3e Phase 12: RPC no-ui command safety — SPEC §11.
Slash commands persist state changes in hasUI=false mode without calling notify; export handler for regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:13:42 +07:00
grayhook 66d9a39a18 Phase 12: maxSkills soft warn — SPEC §15.
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>
2026-06-17 13:12:21 +07:00
grayhook d92c5f827d Phase 12: skill name collision warn — SPEC §11.
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>
2026-06-17 13:11:32 +07:00
grayhook c071f240d3 Phase 12: manual compaction defer clear — SPEC §16.5, §12.3.
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>
2026-06-17 13:10:56 +07:00
grayhook bf862656ae Phase 6: add compaction coexistence hint — one-time notify when both compactors run.
Shows ui.notify once when pi-auto-compact is detected while Pi compaction.enabled stays true.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:47:27 +07:00
grayhook 2e6d36a855 Phase 6: add PI_AUTO_COMPACT_FOLLOW_UP_PREFIXES — document pi-auto-compact phrases.
Constants match SPEC §16.9 for tests and docs; runtime v1 does not match follow-up text.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:46:38 +07:00
grayhook a8e07fdd6f Phase 5: add kept-window tests — slice, presence, filter, empty kept.
Covers kept-window dedup helpers per SPEC §6.4 and §12.1.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:21:38 +07:00
grayhook 1382e3f66f Phase 4: add expand tests — frontmatter strip, paths, suffix.
Cover readSkillBody, formatBlock, appendSuffix, and expandSkill per SPEC §12.1.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:32:23 +07:00
grayhook 6e55990bfb Phase 3: add detect tests — slash, blocks, read match, trackReadPaths gate.
Cover detection helpers from SPEC §6.2 for regression safety.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:24:49 +07:00
grayhook 36cafc4405 Phase 2: add settings tests — defaults, merge, effective helpers.
Covers layered settings merge, incremental global file writes, and
delivery-mode resolution per SPEC §6.5.3.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:13:56 +07:00