Commit Graph

89 Commits

Author SHA1 Message Date
grayhook 2894ed751d TODO: add Phase 14 — re-inject for --skill / non-discovery skills
Закрывает план для BACKLOG B-002: отложенная registered-фильтрация в defer-path, loose fallback по filePath на диске, settings.requireRegistered как opt-out. Чеклист включает диагностический подпункт перед фиксом, чтобы подтвердить гипотезу о фильтре.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 14:25:42 +07:00
grayhook ab4c133a9c BACKLOG: close B-001 (LLM available), open B-002 reinject E2E.
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>
2026-06-17 14:05:19 +07:00
grayhook b819b4bed3 TODO: mark phase 13 complete — README, E2E partial, §13 review.
E2E compaction scenarios remain open in BACKLOG B-001 pending LLM access.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:28:43 +07:00
grayhook 496d7478df Phase 13: §13 acceptance review — unit pass, E2E gaps in B-001.
1 default off + session on: PASS (settings.test, RPC)
2 global on persists: PASS (settings.test, RPC)
3 auto compact reinject: PARTIAL (kept/reinject units; E2E blocked)
4 manual /compact skip: PASS (reinject-manual-defer.test)
5 tracked sources: PASS (detect.test)
6 state /resume: PASS code (loadStateFromBranch); no integration test
7 footer on·N: PASS code (updateSkillReinjectStatusLine); TUI not exercised
8 no duplicate in kept: PASS (kept-window.test)
9 pi-auto-compact defer: PARTIAL (auto-compact.test; race E2E blocked)
10 manual /compact coexist: PARTIAL (manual-defer units; E2E blocked)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:27:23 +07:00
grayhook 074fcdaae5 Phase 13: manual E2E pi-auto-compact partial — detect OK, flow blocked.
§12.3 p.1–2: pi-auto-compact loads with extension; auto-compact command
registered. delivery defer covered by unit tests (auto-compact.test.ts).
§12.3 p.3–7 blocked without LLM — see BACKLOG B-001.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:26:46 +07:00
grayhook 82dc8a7126 Phase 13: manual E2E standalone partial — RPC smoke, backlog B-001.
§12.2 RPC smoke (pi -e, --mode rpc): PASS register skill-reinject/sr/skills-reinject;
PASS /skill-reinject on|list|global on|off|reset|integration defer.
BLOCKED §12.2 p.2–5: no LLM (API key / llama server unreachable) for /skill:name,
auto compaction, and post-compact re-inject verification. Logged as B-001.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:26:26 +07:00
grayhook 08b997848f Phase 13: update README for v1 — install, commands, pi-auto-compact.
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>
2026-06-17 13:20:50 +07:00
grayhook 7d99ab8f1e TODO: mark phase 12 complete — edge cases for manual compact, collisions, and RPC mode.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-17 13:15:22 +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 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