Skip to content

[Refactor]: Agent System Refactor / [Refactor]: Agent系统重构 #772

@alexhoshina

Description

@alexhoshina

🎯 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

Issue

PR

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions