feat: add lifecycle-aware compact re-entry for llmdoc - #31
Merged
Conversation
- Introduced a clear distinction between cold start and compact re-entry for llmdoc, ensuring the startup pack is only loaded once at cold start. - Updated documentation to reflect the new lifecycle rules, including the handling of LLMDOC_STATE during context compaction. - Improved routing and indexing strategies to maintain a bounded startup context, with a default size limit of 24 KiB for startup-related documents. - Added new guides and references for lifecycle hooks and context management, ensuring better alignment with Codex integration. - Updated plugin metadata to reflect changes in functionality and improved user guidance. This commit aims to streamline the llmdoc workflow, enhance performance, and ensure clarity in the lifecycle processes.
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description:
Summary
This PR makes llmdoc context loading lifecycle-aware and prevents Codex compaction from repeatedly replaying the entire startup package.
It introduces separate cold-start, resume, and compact re-entry paths, adds a compact LLMDOC_STATE contract, and keeps startup context
bounded for monolith repositories.
Motivation
Previously, the SessionStart hook matched startup, resume, clear, and compact through the same path.
Because Codex runs SessionStart(source=compact) after manual and automatic compaction, every compaction instructed the model to reload:
In large repositories, this repeatedly consumed the restored context window and could trigger additional compactions.
What Changed
Lifecycle-aware context loading
Lifecycle source Behavior
━━━━━━━━━━━━━━━━━━
startup, clear Perform one cold-start read of the skill and startup package
──────────────────
resume Reuse a valid LLMDOC_STATE; fall back to one cold start when unavailable or stale
──────────────────
compact Continue from the compact summary without replaying previously loaded llmdoc content
Compact re-entry now refreshes documentation only when:
Bounded startup context
Codex integration
Validation and documentation
Compatibility and Rollout
There are no breaking command or API changes.
Plugin users should note:
Validation