Skip to content

refactor: remove interval-based (20th message) cache control#1227

Merged
lewis617 merged 2 commits into
mainfrom
remove-20th-message-cache
Jun 12, 2026
Merged

refactor: remove interval-based (20th message) cache control#1227
lewis617 merged 2 commits into
mainfrom
remove-20th-message-cache

Conversation

@lewis617

Copy link
Copy Markdown
Collaborator

Summary

Removes the interval-based (20th message) cache control logic to simplify the cache strategy.

Changes

Code (cacheControlUtils.ts):

  • Removed findIntervalMessageIndex function
  • Removed addCacheControlToLastToolCall function (only used by interval logic)
  • Removed interval block from transformMessagesForClaudeCache
  • Kept: system message caching, tool definition caching

Tests (aiService.cacheControl.test.ts):

  • Removed 14 interval-related tests
  • 45 tests passing

Spec (spec.md):

  • Removed User Story 2 (Interval-Based Message Cache)
  • Removed FR-003 through FR-006, FR-011
  • Renumbered remaining FRs (001-006)

Spec Companion Files:

  • Updated plan.md, research.md, data-model.md, tasks.md, quickstart.md, cache-control-api.md

Remaining Cache Control

  1. System message — first system message gets cache_control: { type: "ephemeral" }
  2. Tool definitions — last tool definition gets cache control

Testing

All 3078 agent-sdk tests pass.

lewis617 added 2 commits June 12, 2026 18:07
This function was only used by the removed interval caching logic.
- Add cache_control to last user message in transformMessagesForClaudeCache
- Fix addCacheControlToContent to preserve non-text parts (image_url)
  and only add cache_control to the last text part (not all text parts)
- Add spec User Story 2 and FR-003 for last user message caching
- Update tests for new behavior, add 3 new test cases
@lewis617 lewis617 merged commit be94713 into main Jun 12, 2026
1 check passed
@lewis617 lewis617 deleted the remove-20th-message-cache branch June 12, 2026 10:25
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