mod anthropic_plugin#
- module anthropic_plugin#
Anthropic cache plugin for the ACG system.
Translates ACG stability classifications into Anthropic-specific
cache_controlbreakpoints on content blocks. Implements theProviderPlugintrait with:Breakpoint budget allocation: Up to 4 breakpoints per request.
Token minimum enforcement: Per-model from
CapabilityRegistry.TTL mapping:
RetentionTierto Anthropic TTL (5m default or 1h extended).Tool schema canonicalization: RFC 8785 via
canonicalize_value.System string-to-array conversion: Handles both string and array-of-blocks format.
Threat mitigations
T-08-01: Only injects
cache_controlannotations with fixed structure{"type": "ephemeral"}.T-08-02:
scope_labelis logged in detail but does NOT change cache visibility.T-08-03: All JSON access uses Option-returning methods; errors propagate via
Result.T-08-05: TTL is hardcoded to exactly 2 behaviors (omit or
"1h").
Structs and Unions
- struct AnthropicCachePlugin#
Anthropic-specific provider plugin for cache_control breakpoint injection.
Translates
CacheStabilityandRetentionintents into Anthropic’s explicitcache_controlannotations. Other intent types are markedIgnored/NotRelevant.Construction
let registry = CapabilityRegistry::with_defaults(); let plugin = AnthropicCachePlugin::new(®istry);
Implementations
- impl AnthropicCachePlugin#
Functions
- fn new(registry: &CapabilityRegistry) -> Self#
Create a new Anthropic cache plugin backed by the given capability registry.
The registry is cloned into an
Arcfor shared ownership.
Traits implemented
- impl ProviderPlugin for AnthropicCachePlugin#
- impl HintPlanApplier for AnthropicCachePlugin#