Quick Summary
anthropic_messages provider sends system as a flat string, ignoring SystemParts content blocks, which defeats Anthropic prompt caching.
Environment & Tools
- PicoClaw Version: latest main
- Go Version: go 1.25
- AI Model & Provider: Anthropic Claude via
anthropic_messages provider
- Operating System: macOS
- Channels: WeCom
📸 Steps to Reproduce
- Configure
anthropic_messages as provider
- Send a message to the agent
- Observe the HTTP request —
system field is a flat string instead of content blocks array
❌ Actual Behavior
anthropic_messages provider reads msg.Content (concatenated fallback string) instead of msg.SystemParts, resulting in:
system is a string instead of content blocks array
- No
cache_control markers on static blocks
- Dynamic context (
## Current Time) mixed in the same string causes the entire system prompt prefix to change every minute, defeating Anthropic prompt caching
provider.go L176-L281:
var systemPrompt string
// ...
case "system":
systemPrompt = msg.Content // ← ignores msg.SystemParts
// ...
result["system"] = systemPrompt // ← flat string, no cache_control
✅ Expected Behavior
Same behavior as the SDK-based anthropic provider — output system as a content blocks array with cache_control: ephemeral on static blocks.
💬 Additional Context
The anthropic (SDK) provider correctly uses SystemParts with per-block cache_control: ephemeral. Fix submitted in PR #2192.
Quick Summary
anthropic_messagesprovider sendssystemas a flat string, ignoringSystemPartscontent blocks, which defeats Anthropic prompt caching.Environment & Tools
anthropic_messagesprovider📸 Steps to Reproduce
anthropic_messagesas providersystemfield is a flat string instead of content blocks array❌ Actual Behavior
anthropic_messagesprovider readsmsg.Content(concatenated fallback string) instead ofmsg.SystemParts, resulting in:systemis a string instead of content blocks arraycache_controlmarkers on static blocks## Current Time) mixed in the same string causes the entire system prompt prefix to change every minute, defeating Anthropic prompt cachingprovider.go L176-L281:
✅ Expected Behavior
Same behavior as the SDK-based
anthropicprovider — outputsystemas a content blocks array withcache_control: ephemeralon static blocks.💬 Additional Context
The
anthropic(SDK) provider correctly usesSystemPartswith per-blockcache_control: ephemeral. Fix submitted in PR #2192.