A Swift SDK for semantic caching of LLM responses using Redis/Valkey and pgvector embeddings. Supports adaptive thresholds, hybrid BM25+vector search, guardrails, SWR (Stale-While-Revalidate), workflow checkpoints, and pub/sub messaging.
Cachly exposes 18 tools with mixed quality. Most tools have descriptions (good), but parameter schemas are incomplete or missing type information. Many parameters lack descriptions entirely (e.g., 'fn', 'embedFn' in getOrSet are described as 'function' with no detail on signature or expected behavior). Output schemas are defined as result types but not documented in tool descriptions. Error handling is minimal, no recovery guidance or actionable error messages. Tool naming is reasonable (verb-noun style) but some names are vague ('stats', 'feedback'). No tool annotations (readOnlyHint, destructiveHint) despite clear risk levels. Composition is weak: tools like 'getOrSet' combine caching, embedding, and semantic matching in one call, violating single-responsibility. Parameter dependencies (e.g., vectorUrl required for some operations) are undocumented.
Return the server-side F1-calibrated threshold for a namespace (§1 Adaptive Threshold). Requires vectorUrl.
Bulk index entries into the semantic cache via pgvector API (§2 Batch Indexing).
Bulk warm up cache with multiple key-value pairs.
Check a prompt against guardrails (content policy, PII, jailbreak patterns) via pgvector API.
Auto-detect namespace from prompt text using heuristics (§4). Detects code, translation, summary, Q&A, and creative content patterns.
Record whether a cache hit was accepted as correct for adaptive threshold calibration (§1). Requires vectorUrl. No-op otherwise.
Cache LLM responses by meaning, not just exact key. Retrieves cached value if semantic similarity exceeds threshold, otherwise computes and caches new value.
Function parameters ('fn', 'embedFn', 'handler') lack type signatures and expected behavior. Descriptions say 'Async function' or 'callback' but do not specify input/output types, error handling, or calling convention.
Parameter dependencies undocumented. Many tools require 'vectorUrl' but this is not marked as conditional or documented in parameter descriptions. LLMs cannot infer when vectorUrl is mandatory vs optional.
No tool annotations (readOnlyHint, destructiveHint, idempotentHint) despite clear risk levels. 'invalidateTag' is destructive but unmarked. 'stats' and 'getTags' are read-only but unmarked. MCP spec supports these hints; omitting them forces LLMs to infer safety.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 36 | 2026-07-28+ | v2 |
Retrieve tags associated with a cache key.
Invalidate all cache entries with a given tag.
Retrieve LLM proxy statistics including request counts, cache hits/misses, estimated savings, and latency metrics.
Publish a message to a pub/sub channel.
Subscribe to a pub/sub channel and receive messages asynchronously.
Associate tags with a cache key for grouped invalidation.
Warm up cache from a snapshot of semantic cache entries for a namespace.
Retrieve cache statistics for a namespace including hit/miss counts, hit rate, and per-namespace breakdowns.
Check Stale-While-Revalidate (SWR) registry for entries that need revalidation.
Record a workflow checkpoint with step metadata, status, state, output, and duration.
Retrieve a workflow run summary with all checkpoints.
Output schemas defined as Swift types (CacheStats, BatchIndexResult, etc.) but not documented in tool descriptions. LLMs cannot see what fields to expect without reading source code.
No error handling guidance. Tools do not document what errors can occur, whether they are retryable, or what the LLM should do next. E.g., 'embedFunctionFailed' is defined but no tool explains when it occurs or how to recover.