v1.3.133
v1.3.133
Released: 2026-07-06
Summary
Major agent optimization release: three new execution acceleration features
(speculative execution, parallel pre-execution, tool result memoization),
progressive drift detection, and 8 bug fixes across agent, provider, TUI, IM,
and context management.
Features
Agent Execution Acceleration (3 new optimizations)
-
Pattern-aware speculative tool execution (PASTE-inspired): While the LLM
generates its response, predict likely next read-only tool calls and
pre-execute them in background goroutines. When the LLM's response arrives,
if predictions match, results are ready instantly — zero tool latency.
Bigram pattern model with argument-linked predictions and TTL cache.
(internal/agent/speculate.go) -
Speculator production hardening: Bounded LRU cache (max 50 entries),
adaptive prediction threshold (self-tunes based on cache hit rate), and
max concurrent speculations (3). Prevents unbounded memory growth and
goroutine explosion.
(internal/agent/speculate.go) -
Parallel pre-execution of read-only tools (LLMCompiler/W&D-inspired):
Before the sequential tool execution loop, identifies read-only tool calls
in the LLM batch response that are NOT in the speculative cache, and
executes them concurrently with goroutines. Max 3 concurrent, with full
permission check safety.
(internal/agent/parallel_tools.go) -
Tool result memoization (ToolCaching-inspired): Lightweight cache that
serves repeated read-only tool calls from memory instead of re-executing.
File-based tools use mtime invalidation; search/grep uses 30s TTL; LSP
tools use 15s TTL. Bounded LRU (50 entries), per-run reset.
(internal/agent/memoize.go)
Agent Intelligence
-
Progressive drift detection (SICA-inspired): 3 escalating levels of
guidance when the agent appears stuck (20/40/60 iterations). Each level
fires at most once per stall episode, resets on productive action.
(internal/agent/overseer.go) -
Task-aware tool result preservation: ClearOldToolResults now skips
results containing semantic error markers (error:, fail:, panic:, etc.).
Prevents "context collapse" during debugging — error context survives
clearing.
(internal/context/manager.go)
Bug Fixes
-
fix(im): bound approvals map growth — The IM Manager.approvals map
never had entries deleted, causing unbounded memory growth. Added
pruneApprovalsLocked() and fixed snapshot to exclude resolved entries. -
fix: double-Shutdown panic — Swarm and subagent managers could panic
on double Shutdown calls. Added sync.Once protection. -
fix(tui): Esc dismisses exit/cancel confirmation — Esc key now
properly dismisses exit and cancel confirmation prompts. -
fix: readline shortcuts cursor jump — Ctrl+K/U/W caused cursor to
jump to wrong position after editing. -
fix(stt): check HTTP status before decoding — STT adapter tried to
decode response body without checking HTTP status code first, causing
confusing error messages. -
fix(provider): stop retrying 400 Bad Request — 400 errors are
permanent (not retriable), but the retry loop would retry them
indefinitely. -
fix(agent): add completed tool results on mid-loop cancel — When the
agent loop is cancelled mid-execution, completed tool results were not
added to context, losing work. -
fix(agent): failed run_command not productive — Failed run_command
calls were incorrectly counted as "productive" in the overseer, preventing
stall detection from triggering.
Complete Agent Optimization Stack
| Layer | File | Purpose |
|---|---|---|
| Tool result memoization | memoize.go | Serve repeated read-only calls from cache (NEW) |
| Parallel execution | parallel_tools.go | Concurrent read-only tools per LLM batch |
| Speculative execution | speculate.go | Pre-execute during LLM generation |
| Tool-result clearing | agent_precompact.go | Mechanical context space recovery |
| Tool-use input clearing | agent_precompact.go | Extended context trimming |
| Progressive error streak | loop_detect.go | 4/7/10 errors with escalating guidance |
| Progressive drift | overseer.go | 20/40/60 iterations with escalating guidance |
| Overseer (5 modes) | overseer.go | Deterministic trajectory analysis |
| Repetition tracker | repetition_tracker.go | Failed-edit cluster detection |
| Smart verify hint | verify_hint.go | Post-edit build reminders |
| Reactive ratchet rules | ratchet_reactive.go | Error pattern matching in results |