☿ Autolycus · RTK v2

Reduced Token Kernel v2

Compression architecture, anomaly detection, and circuit breaker —
built into the agent loop, works seamlessly

RTK v2 — Architecture (rtk_ck) Agent Loop run_agent.py LLM API Call transform_tool_result (hook) 💾 store.py Full output → disk ~/.autolycus/rtk-cache/ 📦 compressor.py Type-aware compression head + errors + tail 📝 metadata.py Stats → state.db rtk_metadata Bounded buffer (500) 🔍 pattern.py — Detectors 3 consecutive errors → 🔴 halt Budget exceeded → 🔴 halt Infinite loop → ⚠ inject No progress → ⚠ inject ⚡ signal.py — Injection Signal → kvstore → system prompt one-shot, auto-cleared ⚠ signal in system prompt 🔴 Circuit Breaker _rtk_halt_requested = True Session stopped 💾 rtk_recover Full data recovery 🧹 rtk_cleanup GC old cache files (>30d) should_halt 📊 monitor.py Per-tool stats + export JSON 🗄️ kvstore.py session-scoped JSON storage terminal head+errors+tail read_file section+head+tail search_files group by directory 🔵 budget.py BudgetScanner 80% / 95% / 100% 🔵 growth.py GrowthDetector 25% / 50% auto-scale 🔵 patterns.py PatternDetector REDUNDANT_READS 🔵 dedup.py Deduplicator volatile vs prefetch 🔵 result_cache ResultCache pre_tool_call ⚙ context_engine.py RTCKContextEngine ✅ verifier.py Post-compression verify 📈 metrics.py rtk_ck_stat tool 🔄 prefetch_cache.py Stale detection + inject ── Compression (normal) - - Signal injection — — Circuit breaker (halt) rtk_ck modules (v2) should_halt
209
unit tests
84%
avg token savings
500
bounded buffer (entries)
6
anomaly detectors