[Refactor]: Agent System Refactor / [Refactor]: Agent系统重构
Author: alexhoshinaCreated Feb 25, 2026Updated Apr 3, 2026
Labelstype: roadmapdomain: agent
Purpose
As PicoClaw evolves, we're seeing growing complexity in the agent layer (pkg/agent/loop.go, now ~1200 LOC).
Current Pain Points
- Monolithic structure -
loop.gomixes routing, LLM iteration, tool execution, context management, summarization - Reactive context handling - Emergency compression when we hit limits, losing user context abruptly
- Tool coupling - Tools have implicit dependencies on agent loop internals
- Limited observability - Hard to debug execution flow across tool calls and LLM interactions
- Session consistency risks - No explicit serialization, potential race conditions in multi-channel scenarios
- Write-only memory - MEMORY.md exists but agent can't search/retrieve past information
- Flat tool permissions - No per-agent or per-channel tool restrictions
Related Issues & PRs
Roadmap
- #296
- #295
- #294
- #290
- #284
Issue
- #773
PR
Source: sipeed/picoclaw