Commit Graph

80 Commits

Author SHA1 Message Date
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 7ff7529957 TODO: mark phase 11 complete — /skill-reinject commands, status, and footer line.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:57:51 +07:00
grayhook 5d902349d1 Phase 11: footer status line on·N — SPEC §7.2.
Update skill-reinject status after toggles, clear, skill tracking, and session restore.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:57:38 +07:00
grayhook 00ed5c6253 Phase 11: register /sr and /skills-reinject aliases — SPEC §7.1.
Expose the same handler under optional shorthand command names.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:56:57 +07:00
grayhook 0534093f2c Phase 11: /skill-reinject now delegates to reinjectNow — SPEC §7.1.
Wire debug force re-inject through the existing immediate delivery path with registered skills from the session.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:56:36 +07:00
grayhook 03dcdb22de Phase 11: integration session override — SPEC §7.1, §16.4.
Persist autoCompactIntegration override in state and wire resolveDeliveryMode plus status delivery line.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:56:19 +07:00
grayhook 435c5b3289 Phase 11: list and clear tracked skills — SPEC §7.1.
Show tracked skill names with sources on list; clear skills array without resetting session toggle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:55:47 +07:00
grayhook 5c0eb4d039 Phase 11: global on/off toggle — SPEC §7.1, §7.3.
Write skillReinject.enabled to ~/.pi/agent/settings.json via merge write without clobbering other keys.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:55:19 +07:00
grayhook e55a14e469 Phase 11: session on/off/reset toggle — SPEC §5.1, §7.1.
Persist sessionOverride via saveState and confirm the effective enabled layer after each toggle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:55:07 +07:00
grayhook 7d1c4f031f Phase 11: show /skill-reinject status output — SPEC §7.2.
Format enabled layer, delivery mode, tracked skills, pending queue, and last compaction source on bare command.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:54:47 +07:00
grayhook dc07e516af Phase 11: register /skill-reinject command — SPEC §7.
Wire pi.registerCommand with a minimal handler stub so later subcommands can plug into commands.ts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:52:58 +07:00
grayhook b22ee7fefc TODO: mark phase 10 complete — session restore, branch rescan, and shutdown flush.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:47:18 +07:00
grayhook ecddaf5752 Phase 10: flush persisted state on session_shutdown — SPEC §11.
Append skill-reinject:state before extension teardown so the latest tracked
skills and session override survive quit, reload, and session replacement.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:47:05 +07:00
grayhook a5448b4002 Phase 10: restore session state on session_tree for branch switch — SPEC §6.3, §11.
Extract restoreSessionState for reload/resume/startup and reuse on session_tree
so /tree branch navigation reloads persisted state or rescans like session_start.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:46:44 +07:00
grayhook ee13faf285 Phase 10: rescan branch for tracked skills when state entry missing — SPEC §6.3.
Walk user messages and read tool calls on session_start to rebuild tracked
skills from history when no skill-reinject:state entry exists on the branch.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:45:51 +07:00
grayhook 1a690f921f Phase 10: load persisted state and settings on session_start — SPEC §5.1, §6.3, §16.4.
Restore skill-reinject:state from branch on startup/resume, read merged settings,
and detect pi-auto-compact; reset to initial state when no entry exists.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:40:33 +07:00
grayhook b764acd974 TODO: mark phase 9 complete — tracking hooks, persist, and session_compact reinject wiring.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:35:07 +07:00
grayhook 0e32a498ee Phase 9: wire session_compact to defer and immediate reinject — SPEC §5.2, §8.
Connect compaction source gate with plan/enqueue/send paths and consume deferred queue on before_agent_start for end-to-end auto compaction trigger.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:35:01 +07:00
grayhook 0d274881dd Phase 9: persist state after tracked skill changes — SPEC §6.1.
Call saveState via appendEntry after slash, skill-block, and read-path tracking so session state survives resume.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:31:36 +07:00
grayhook edc01d1079 Phase 9: track read tool paths to SKILL.md on tool_call — SPEC §6.2 #3.
Match read tool paths against registered skills when trackReadPaths is enabled and upsert with source read.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:30:57 +07:00
grayhook 2021ee1293 Phase 9: track skill blocks on message_end for user messages — SPEC §6.2 #2.
Scan finalized user message text for expanded skill XML blocks and upsert tracked skills using registered metadata when available.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:30:17 +07:00
grayhook 86c6837351 Phase 9: track slash /skill:name on input hook — SPEC §6.2 #1.
Wire input handler to detect slash skills and upsert into session state using registered skill metadata from before_agent_start cache or loadSkills fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:28:22 +07:00
grayhook eb911ab7e3 TODO: mark phase 8 complete — compaction source detection state machine and gate.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:04:58 +07:00
grayhook 0f06e0e45b Phase 8: add shouldReinject gate and consume on session_compact — SPEC §8.
Evaluates enabled layer and compaction source, records lastCompactionSource, clears pending flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:04:47 +07:00
grayhook 18dd600d2d Phase 8: mark auto compaction before_compact — default source unless manual.
session_before_compact sets pendingCompactionSource to auto when input did not mark /compact.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:03:33 +07:00
grayhook 7bbe2370d7 Phase 8: mark manual compaction from /compact input — SPEC §8 input hook.
Sets pendingCompactionSource before expansion when user text starts with /compact.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:02:48 +07:00
grayhook cf2eedb85b Phase 8: add compaction runtime state — pendingCompactionSource container for §8.
Transient CompactionRuntime holds pending source between input, before_compact, and session_compact hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 12:01:36 +07:00
grayhook 3bab1f802b TODO: mark phase 7 complete — reinject orchestration plan, defer, immediate, skip missing, now.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:59:32 +07:00
grayhook d637722ea5 Phase 7: add reinjectNow — force immediate re-inject of all tracked skills for debug.
Uses idle vs followUp delivery based on ctx.isIdle(); skips unregistered skills via existing buildReinjectBlocks warnings.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:59:24 +07:00
grayhook 9a197aee10 Phase 7: skip missing skills with ui.notify warning on expand.
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>
2026-06-17 11:59:12 +07:00
grayhook dc73ea9747 Phase 7: add sendImmediateReinjectAllFollowUp — queue all blocks when streaming or willRetry.
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>
2026-06-17 11:58:29 +07:00
grayhook 446a186431 Phase 7: add sendImmediateReinjectIdle — first skill triggers turn, rest as followUp.
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>
2026-06-17 11:58:15 +07:00
grayhook 2059f6033b Phase 7: add defer inject on before_agent_start — combined skill blocks, clear queue.
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>
2026-06-17 11:57:48 +07:00
grayhook e0daa50cce Phase 7: add enqueueDeferredReinjectFromCompact — queue plan on session_compact without sendUserMessage.
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>
2026-06-17 11:55:13 +07:00
grayhook 23d580b6d2 Phase 7: add planReinject — kept-window and registration filter for post-compaction skills.
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>
2026-06-17 11:54:01 +07:00
grayhook ab315d899b TODO: mark phase 6 complete — pi-auto-compact detect, delivery mode, constants, hint.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:47:38 +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 e56f81d25c Phase 6: add resolveDeliveryMode — defer vs immediate from integration table.
Wraps effectiveIntegration with RuntimeFlags.autoCompactDetected so reinject wiring reads delivery mode from one place.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:46:19 +07:00
grayhook 776345a238 Phase 6: add detectPiAutoCompact — detect pi-auto-compact via getCommands.
Uses the public ExtensionAPI command list and caches the result in RuntimeFlags for session_start wiring.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:45:22 +07:00
grayhook b54b8f98bf TODO: mark phase 5 complete — kept-window helpers and tests.
Phase 5 delivers getKeptEntries, presence scan, filter, and kept-window.test.ts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:21:55 +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 a0e6d204a6 Phase 5: add filterSkillsNeedingReinject — kept-window dedup input for pendingReinject.
Returns tracked registered skills absent from kept user messages per SPEC §5.2 and §6.4.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:20:11 +07:00
grayhook 9896e7efa6 Phase 5: add skillsPresentInKeptWindow — detect skill blocks in kept user messages.
Scans kept entries for expanded skill blocks so re-inject skips duplicates per SPEC §6.4.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:19:05 +07:00
grayhook 6ccb580ca1 Phase 5: add getKeptEntries — branch slice from firstKeptEntryId.
Implements kept-window boundary per SPEC §6.4 for dedup before re-inject.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 11:17:30 +07:00
grayhook 1296090909 TODO: mark phase 4 complete — skill block expand helpers and tests.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:32:32 +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