Add persistent AI cache for TLDRs and chat with 7-day expiry - #25
Merged
Conversation
- Store TLDR summaries in ~/.cache/hn-cli/tldr-cache.json with 7-day expiry - Store chat sessions in ~/.cache/hn-cli/chat-cache.json with 7-day expiry - Both caches survive app restarts and system reboots - Expired entries are automatically cleaned up on load - Users can regenerate TLDRs by pressing 't' again
- Add setPersistentCachePaths() for test path injection - Add comprehensive tests for TLDR and chat cache functions - Improve merge behavior comment explaining precedence logic - Export AI_CACHE_TTL_MS constant for test verification Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
brianlovin
force-pushed
the
claude/cache-post-summaries-JgBn7
branch
from
January 26, 2026 15:45
116e4a5 to
8da929f
Compare
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
Implements persistent caching for AI-generated content (TLDRs and chat sessions) that survives application restarts. These caches are stored in the user's home directory with a 7-day expiration policy, while the existing session cache remains in the temp directory.
Key Changes
~/.cache/hn-cli/instead of temp directory, allowing them to persist across rebootsImplementation Details
loadTLDRCache()andsaveTLDRCache()functions to manage TLDR persistenceloadChatCache()andsaveChatCache()functions to manage chat session persistenceCachedTLDR,PersistentChatSession,TLDRCache, andChatCachewith timestamp tracking