Skip to content

feat(lazy-load): slim cache_path pattern for large-response tools#14

Merged
sinh-x merged 1 commit intodevelopfrom
feature/lazy-load-pattern
Mar 17, 2026
Merged

feat(lazy-load): slim cache_path pattern for large-response tools#14
sinh-x merged 1 commit intodevelopfrom
feature/lazy-load-pattern

Conversation

@sinh-x
Copy link
Copy Markdown
Owner

@sinh-x sinh-x commented Mar 17, 2026

Summary

  • Add SlimResponse model to schemas.py with jq paths schema + inline context
  • Add utils/cache.py with shared write_to_cache() helper
  • Add cache_path: str = "" param to all 5 large-response tools: prepare_session, read_claude_session, read_claude_sessions, get_session_timeline, get_daily_jsonl_stats
  • All tools now always return slim response — full JSON auto-cached to cache_path or /tmp/ai-usage-log/<tool>-<ts>.json
  • Update SKILL.md with cache pattern docs and jq examples

Test plan

  • 149 tests pass
  • Compile check clean
  • Manual test: explicit cache_path and auto-tmp fallback both work
  • Pre-commit hooks (ruff) pass

🤖 Generated with Claude Code

… tools

All 5 large-response tools now write full JSON to a cache file and return
a slim response (<1KB) with jq paths schema + inline context metadata.

- Add SlimResponse model to schemas.py
- Add utils/cache.py with write_to_cache() helper
- Add cache_path param to prepare_session, read_claude_session,
  read_claude_sessions, get_session_timeline, get_daily_jsonl_stats
- Auto-tmp fallback: when cache_path is empty, writes to
  /tmp/ai-usage-log/<tool>-<timestamp>.json (same slim pattern)
- Update SKILL.md with cache pattern docs, jq examples, quick ref

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sinh-x sinh-x merged commit 6a76872 into develop Mar 17, 2026
1 check passed
@sinh-x sinh-x deleted the feature/lazy-load-pattern branch March 17, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant