Commit Graph
1 Commits
Author SHA1 Message Date
yetone 386a2ba5ad kiro 0.1.10: the caller's prompt-cache marks reach Kiro as cachePoints (#110)
What: buildKiro dropped every cache_control, so Kiro was never asked to
cache a prompt and its tokenUsage reported no cache reads ("kiro cli
cache 率为 0"). Kiro's generateAssistantResponse takes Bedrock's cachePoint
({"type":"default"}) on a userInputMessage, on an assistantResponseMessage
and as an entry of the tools: the CodeWhisperer streaming model's
UserInputMessage.cachePoint, AssistantResponseMessage.cachePoint and
Tool::CachePoint (aws/amazon-q-developer-cli's generated client), and
Kiro CLI 2.27's model list carries supportsPromptCaching and
maximumCacheCheckpointsPerRequest. A message holding a marked block now
gets a cachePoint on the entry it ends up in (merged turns included; a
marked system prompt marks the first message, where the instructions
go), and a marked tool is followed by a cachePoint entry, as kirocc and
AIClient2API send. Four at most, the last kept, as Anthropic allows.
conversationId is left per request: a cachePoint caches the prompt's
prefix, not a conversation.

Run: TMPDIR=<scratch> HOME=<scratch> bun test (1191 pass, 0 fail) and bun
scripts/check.mjs kiro. cache-points.test.mjs's first fixture places the
marks where a captured Claude Code 2.1.296 request had them (two system
blocks and the trailing system-role hook message; texts cut short); the
second is the shape magpie's buildAnthropic hands a plugin for a
translated request. With the two cachePoint lines taken out, 3 of its 4
tests fail. Not tried against a real Kiro account (none signed in here),
so whether Kiro then reports cacheReadInputTokens is not seen yet.
2026-10-14 12:54:44 +08:00