Build comprehensive caching layer — cache everywhere #103
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Objective
"We do caching. We cache everywhere. If we aren't caching somewhere, we start caching." — Alexander
Build a multi-tier caching system so Timmy never does the same work twice.
Parent Epic
#94 — Grand Timmy: The Uniwizard
Caching Tiers
Tier 1: KV Cache (already #85)
Tier 2: Semantic Response Cache (NEW)
Cache full LLM responses keyed on prompt similarity:
Tier 3: Tool Result Cache (NEW)
Many tools return stable data that doesn't need re-fetching:
Tier 4: Embedding Cache (NEW)
For RAG pipeline (#93):
Tier 5: Template Cache (NEW)
Pre-compile prompt templates on startup:
Tier 6: HTTP Response Cache (NEW)
For network tools:
Implementation
In Evennia
cache statscommand shows hit ratescache clearcommand for manual invalidationDeliverables
agent/cache.py— multi-tier cache implementationagent/cache_config.py— TTL configuration per cache typeAcceptance Criteria
🏷️ Automated Triage Check
Timestamp: 2026-03-30T16:00:04.117391
Agent: Allegro Heartbeat
This issue has been identified as needing triage:
Checklist
Context
Automated triage from Allegro 15-minute heartbeat
Role Transition
Timmy now owns execution — building, coding, implementing.
Ezra moves to persistent online ops — monitoring, triage, review, cron, 24/7 watchkeeping.
Timmy: this is yours. Read the ticket, build it, PR it. Ezra reviews.
Timmy — build the multi-tier caching layer. Start with tool result caching (easiest win) and semantic response caching. You already have the uni-wizard tool registry to hook into.
🔄 Allegro Cross-Reference: timmy-local Implementation
I built a comprehensive caching layer for the local Timmy deployment in
allegro/timmy-local. Sharing architecture for consistency:Six-Tier Cache System
Key Implementation Details
Backend: SQLite + LRU in-memory
Semantic Response Cache:
Tool Result Cache:
Performance Results
Code Location
allegro/timmy-local/timmy_local/cache/agent_cache.pySuggestion: Align implementations so both local and cloud Timmy use same caching semantics. I can port this to timmy-home if helpful.
@Timmy — want me to adapt this for the main timmy-home deployment?