Agent: prompt cache hints never trigger in production — preamble below 4096-char threshold #23
Closed
opened 2026-05-12 19:05:10 +00:00 by KofTwentyTwo
·
0 comments
No Branch/Tag Specified
develop
ci/secrets-historical-baseline
feature/security-findings-2026-10
dependabot/npm_and_yarn/webview/npm_and_yarn-3ac77625be
dependabot/npm_and_yarn/webview/packages/bus/npm_and_yarn-c86b58a346
dependabot/npm_and_yarn/webview/vitejs/plugin-react-6.0.2
dependabot/npm_and_yarn/webview/vite-8.0.13
dependabot/npm_and_yarn/webview/zustand-5.0.13
dependabot/npm_and_yarn/webview/types/node-25.9.1
dependabot/npm_and_yarn/webview/vitest-4.1.6
dependabot/github_actions/actions/setup-node-6
dependabot/github_actions/github/codeql-action-4
dependabot/github_actions/actions/checkout-6
dependabot/github_actions/actions/cache-5
dependabot/github_actions/pnpm/action-setup-6
feat/local-first-llm-routing
docs/local-first-llm-routing-spec
fix/v0.2-wave-1-code-fixes
docs/v0.2-wave-1-doc-drift
docs/handoff-2026-05-14
docs/multi-runner-inventory
docs/ollama-baseline-58
fix/ci-env-harness-sqlite-voice-warmup
fix/ci-xcode-26-and-batcher-timing
chore/typecheck-blocking
fix/hud-typecheck-strict-undefined
wip/voice-log-menu-stash4
v0.1.0-dev.71
v0.1.0-dev.68
v0.1.0-dev.64
v0.1.0-dev.50
Labels
Clear labels
area:agent
area:build
area:bus
area:devtool
area:hud
area:logging
area:mcp
area:memory
area:vision
area:voice
audit-finding
bug
carry-forward
comment-cleanup
dependencies
documentation
duplicate
enhancement
epic
good first issue
help wanted
invalid
javascript
migration
question
severity:critical
severity:high
severity:low
severity:medium
wontfix
Something isn't working
Comment / docstring cleanup per .planning/code-commenting-guide.md
Dependency updates
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Pull requests that update javascript code
Further information is requested
This will not be worked on
Milestone
No items
No Milestone
v0.2 — Observable + stable (audit punch-list)
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: KofTwentyTwo/Jarvis#23
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Cache hints effectively never trigger in production.
MIN_CHARS_FOR_CACHE_BREAKPOINT = 4096but the lockedselfAwarePreambleis ~700 chars;.emptyadds no presence/memory hydration; Round-4 degradation summary stays under threshold by design. On healthy boot,finalSystem.countis ~700-1200 chars,CacheHints.eligibleForSystemPrompt(finalSystem)returnsnilon every turn. Not a correctness bug — but the prompt cache is effectively dead. Every turn pays full input-token cost. With Opus 4.7's ~1.35× token inflation vs 3.x, this matters more.Evidence
packages/AgentCore/Sources/AgentCore/CacheHints.swift:50—MIN_CHARS_FOR_CACHE_BREAKPOINT = 4096packages/AgentCore/Sources/AgentCore/ContextBuilder.swift:64-74— ~700-char preambleApp/AppDelegate.swift:1685— orchestrator constructed with.emptycontextAgentOrchestrator.swift:118— Round-4 degradation summary bounded below 4096Root cause / hypothesis
Phase E fix correctly returns
nilto avoid the 200 OK + EOF cache-validation-failure cascade. But on a healthy boot the prompt never crosses the threshold, so cache eligibility is structurally false. Possible intentional cost-acceptance, possible oversight — not documented either way.Recommended fix
Not a fix request — flagging for awareness. Possible mitigations:
CacheHints.swiftdocumenting the trade-off explicitlyDecide whether this is intentional cost-acceptance or oversight; comment accordingly.
Test
CacheHints.eligibleForSystemPromptcalls; assert in healthy boot the rate of non-nil returns matches the chosen policySource
.planning/audit-2026-05-12/mcp-agent-audit.md(2026-05-12) — finding HIGH-1Cross-references