Commit Graph

74 Commits

Author SHA1 Message Date
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
grayhook 9d32cdffb1 Phase 4: add expandSkill — skill meta to injectable user text.
Compose readBody, formatBlock, and appendSuffix for reinject and /skill-reinject now (SPEC §5.3).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:31:45 +07:00
grayhook 049a11a7d5 Phase 4: add appendSuffix — optional reinject message suffix.
Configurable trailing note after skill block per settings.suffix (SPEC §5.3).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:31:37 +07:00
grayhook 68b7d018cc Phase 4: add formatBlock — XML skill block matching Pi expand.
Mirror _expandSkillCommand output shape with name, location, and baseDir hint (SPEC §5.3).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:31:21 +07:00
grayhook 584a8fa342 Phase 4: add readSkillBody — SKILL.md read with frontmatter strip.
Mirror agent-session _expandSkillCommand body extraction via public stripFrontmatter API (SPEC §5.3, §10).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:30:58 +07:00
grayhook 69611685d4 TODO: mark phase 3 complete — skill detection helpers and tests.
Phases 0–3 done; next up is expand.ts (phase 4).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 10:25:09 +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