feat(compact): add debug subcommand for context window inspection#179
Merged
laynepenney merged 4 commits intomainfrom Jan 26, 2026
Merged
feat(compact): add debug subcommand for context window inspection#179laynepenney merged 4 commits intomainfrom
laynepenney merged 4 commits intomainfrom
Conversation
- Remove duplicate paragraph in Codi's Capabilities section - Remove duplicate non-interactive mode examples from Quick Reference - Fix chaotic feature numbering in Lower Priority section (reordered to 12-31) - Remove redundant security vulnerability paragraph Wingman: Codi <codi@layne.pro>
- Renumbered features from chaotic sequence to clean 1-24 numbering - Removed gap between features 13 and 21 by integrating implemented features - Fixed duplicate entries by properly organizing Lower Priority section - Updated Implementation Priority Recommendation to match feature order - No content removed - only organizational improvements Wingman: Codi <codi@layne.pro>
Adds a new /compact debug subcommand that provides detailed information about the current context window contents including: - Token counts by category (messages, system prompt, tool definitions) - Message breakdown by role (user, assistant, tool results) - Current limits and budget information - Compression status and statistics - Working set file count - Message previews with content length information This helps developers understand what's consuming context space and troubleshoot context-related issues. Wingman: Codi <codi@layne.pro>
Collaborator
Author
Thorough Review Complete ✅\n\n### Code Review Findings\n\n#### ✅ Code Quality\n- Structure: Follows existing command patterns correctly\n- TypeScript: Compiles without errors\n- Formatting: Consistent with codebase style\n- Error Handling: Uses existing command error patterns\n\n#### ✅ Functionality\n- Command Logic: All methods called exist on Agent class\n- JSON Output: Properly structured with formatting\n- Unused Variable: FIXED - removed unused variable\n- Content Preview: Safe truncation logic for message content\n\n#### ✅ Testing\n- Build Validation: ✅ Compiled successfully\n- Test Suite: ✅ All tests pass (no regressions)\n- Integration: ✅ Fits seamlessly into existing command\n\n### Implementation Review\n\n#### Information Provided\n- Token counts by category (messages, system prompt, tool definitions)\n- Message breakdown by role (user, assistant, tool results)\n- Current limits and budget (context window, reserves, tiers)\n- Compression status and statistics\n- Working set file count\n- Message previews with content length\n\n#### Missing Information\n- Conversation summary content (marked as placeholder due to private access)\n- This is correct - agent.conversationSummary is private\n\n### Risk Assessment\n- Low Risk: Read-only operation, no side effects\n- Performance: Minimal overhead (already cached stats)\n- Backwards Compatible: New subcommand, no breaking changes\n\n### Security Assessment\n- Read-Only: Only calls public methods\n- No Data Leaks: Sensitive data is properly filtered\n- Scope Limited: Only exposes aggregated statistics\n\n### Recommendations\n- ✅ Ready for merge\n- Consider adding unit tests in future PR (not blocking)\n- The placeholder for conversation summary is appropriate\n\nVerdict: ✅ Approved |
This was referenced Jan 26, 2026
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.
Summary
Adds a new
/compact debugsubcommand that provides comprehensive debugging information about the current context window contents.Features
Usage
Benefits
This feature helps developers and users understand:
Example Output
The command returns a structured JSON response prefixed with
CONTEXT_DEBUG:containing all relevant context information for troubleshooting.Testing
Built successfully with no TypeScript errors. Follows existing command patterns in the codebase.
Wingman: Codi codi@layne.pro