Skip to content

Agent Memory System & Tool Execution Improvements#14

Merged
lxowalle merged 4 commits intosipeed:mainfrom
yinwm:fix/tool-execution
Feb 11, 2026
Merged

Agent Memory System & Tool Execution Improvements#14
lxowalle merged 4 commits intosipeed:mainfrom
yinwm:fix/tool-execution

Conversation

@yinwm
Copy link
Collaborator

@yinwm yinwm commented Feb 10, 2026

Agent Memory System & Tool Execution Improvements

Summary

This PR introduces a comprehensive memory system and improves the agent's tool execution capabilities with better logging, dynamic tool loading, and enhanced debugging support.

Key Changes

1. New Memory System (pkg/agent/memory.go)

  • Long-term Memory: Persistent knowledge storage in memory/MEMORY.md
  • Daily Notes: Time-organized journaling in memory/YYYYMM/YYYYMMDD.md
  • Simple API: Read/Write methods for both memory types
  • Auto-creation: Automatically creates necessary directories

2. Enhanced Skills System

  • Dynamic Tool Summaries: Tools now generate descriptions for the system prompt
  • YAML Frontmatter Support: Proper parsing for nanobot-style skill definitions
  • Skills Integration: Skills are now loaded and included in agent context
  • GetSummaries() Method: ToolRegistry can provide tool descriptions for LLM

3. Improved Logging & Debugging

  • Structured Logging: Added InfoCF calls throughout agent loop with context metadata
    • Message processing with channel/chatID/session tracking
    • Tool call logging with arguments preview
    • Response logging with iteration counts
  • Debug Mode: DebugCF for verbose system prompt logging
  • Startup Info: Fixed skills_available field (was showing <nil>)

4. System Message Channel

  • New processSystemMessage() Handler: Routes system channel messages properly
  • Origin Parsing: Extracts original channel/chatID from system messages
  • Context Preservation: Uses origin session for memory and tool context

5. Tool Registry Enhancements

  • Better Tool Descriptions: Improved descriptions for web_search and shell tools
  • Context Management: Tools can receive channel/chatID context
  • Summary Generation: Tools provide summaries for system prompt injection

6. Code Quality

  • Removed merge conflict markers
  • Fixed BuildMessages signature inconsistencies
  • Aligned with upstream main (includes Groq ASR, Feishu support)

Files Changed

File Changes Description
pkg/agent/memory.go +161 lines New memory system
pkg/agent/loop.go Major refactor Logging, system messages, memory integration
pkg/agent/context.go Enhanced Skills loading, dynamic tool summaries
pkg/tools/registry.go +68 lines Tool summaries, context management
pkg/skills/loader.go Refactored Cleaner implementation
pkg/tools/edit.go Improvements Better file editing
pkg/tools/subagent.go Enhanced Context support
cmd/picoclaw/main.go Cleanup Startup logging

Test Plan

  • Build succeeds on darwin/arm64
  • Agent starts without errors
  • skills_available shows correct count
  • Memory files are created in correct locations
  • System messages are routed properly
  • Tool execution logs are informative

Related Issues

N/A (feature enhancement)

Checklist

  • Code compiles
  • No merge conflicts (resolved upstream conflicts)
  • Based on latest upstream/main
  • Logging is informative but not excessive
  • Memory system is simple and effective

Additional Context:

This branch was created by cherry-picking 3 commits from the original fix/tool-execution branch onto the latest upstream/main, then adding a fix commit. It excludes the unrelated QQ channel changes to keep this PR focused on agent execution improvements.

- Add MemoryStore for persistent long-term and daily notes
- Add dynamic tool summary generation in system prompt
- Fix YAML frontmatter parsing for nanobot skill format
- Add GetSummaries() method to ToolRegistry
- Fix DebugCF logging to use structured metadata
- Improve web_search and shell tool descriptions
anatolykoptev added a commit to anatolykoptev/picoclaw that referenced this pull request Feb 11, 2026
…ed#14 + SessionKey fix

Cherry-picked from sipeed#14 (yinwm):
- Memory system: persistent MEMORY.md + daily notes in memory/YYYYMM/
- Enhanced skills loader with YAML frontmatter + GetSummaries()
- Structured logging throughout agent loop (InfoCF, DebugCF)
- Tool improvements: edit tool, better shell/web descriptions
- Dynamic tool summaries in system prompt
- Subagent tool support

Additional fix from sipeed#5:
- SessionKey now uses "channel:chatID" format (was empty string)
  preventing all users from sharing the same session

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lxowalle
Copy link
Collaborator

Nice! Thanks for the PR!!

@lxowalle lxowalle merged commit 833c092 into sipeed:main Feb 11, 2026
@yinwm yinwm deleted the fix/tool-execution branch February 11, 2026 16:17
emadomedher pushed a commit to emadomedher/picoclaw that referenced this pull request Feb 17, 2026
Agent Memory System & Tool Execution Improvements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants