#772·picoclaw

[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

  1. Monolithic structure - loop.go mixes routing, LLM iteration, tool execution, context management, summarization
  2. Reactive context handling - Emergency compression when we hit limits, losing user context abruptly
  3. Tool coupling - Tools have implicit dependencies on agent loop internals
  4. Limited observability - Hard to debug execution flow across tool calls and LLM interactions
  5. Session consistency risks - No explicit serialization, potential race conditions in multi-channel scenarios
  6. Write-only memory - MEMORY.md exists but agent can't search/retrieve past information
  7. Flat tool permissions - No per-agent or per-channel tool restrictions

Related Issues & PRs

Roadmap

  • #296
  • #295
  • #294
  • #290
  • #284

Issue

  • #773

PR