Skip to content

feat: Cron tool and agent integration#23

Merged
lxowalle merged 6 commits intosipeed:mainfrom
yinwm:fix/gateway-cron-tool
Feb 11, 2026
Merged

feat: Cron tool and agent integration#23
lxowalle merged 6 commits intosipeed:mainfrom
yinwm:fix/gateway-cron-tool

Conversation

@yinwm
Copy link
Collaborator

@yinwm yinwm commented Feb 11, 2026

Summary

Add cron/scheduled task functionality with deep agent integration.

Features

  • Cron Tool: Schedule one-time reminders, recurring tasks, and complex cron expressions
  • Agent Integration: Cron tool fully integrated with agent for complex task processing
  • Memory System: Long-term memory and daily notes support
  • Code Refactoring: Remove duplicate code, use utils.Truncate consistently
  • Concurrency Fix: Fixed race conditions in cron service with gronx library
  • Documentation: Added workspace layout and cron features documentation

Changes

  • New: pkg/tools/cron.go (284 lines)
  • New: pkg/agent/memory.go
  • New: pkg/utils/string.go
  • Modified: pkg/agent/loop.go (+505/-190 lines)
  • Modified: pkg/cron/service.go - refactored with gronx library
  • Modified: pkg/tools/registry.go - added ExecuteWithContext
  • Modified: README.md - added documentation

Testing

  • Build: go build passes
  • Tests: go test passes
  • Upstream typo fix merged

yinwm and others added 6 commits February 11, 2026 20:28
- Add adhocore/gronx dependency for cron expression parsing
- Fix CronService race conditions and add cron expression support
- Add CronTool with add/list/remove/enable/disable actions
- Add ContextualTool interface for tools needing channel/chatID context
- Add ProcessDirectWithChannel to AgentLoop for cron job execution
- Register CronTool in gateway and wire up onJob handler
- Fix slice bounds panic in addJob for short messages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add at_seconds parameter for one-time reminders (e.g., "remind me in 10 minutes")
- Update every_seconds description to emphasize recurring-only usage
- Route cron delivery: deliver=true sends directly, deliver=false uses agent
- Fix cron data path from ~/.picoclaw/cron to workspace/cron
- Fix sessions path from workspace/../sessions to workspace/sessions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code review fixes:
- Use map for O(n) job lookup in cron service (was O(n²))
- Set DeleteAfterRun=true for one-time cron tasks
- Restore context compression/summarization to prevent context overflow
- Add pkg/utils/string.go with Unicode-aware Truncate function
- Simplify setupCronTool to return only CronService
- Change Chinese comments to English in context.go

Refactoring:
- Replace toolsSummary callback with SetToolsRegistry setter pattern
- This makes dependency injection clearer and easier to test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove duplicate truncate/truncateString functions from loop.go and cron.go
- Use utils.Truncate consistently across codebase
- Add Workspace Layout section to README
- Document cron/scheduled tasks functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lxowalle lxowalle merged commit 4fbf017 into sipeed:main Feb 11, 2026
@yinwm yinwm deleted the fix/gateway-cron-tool branch February 11, 2026 16:14
emadomedher pushed a commit to emadomedher/picoclaw that referenced this pull request Feb 17, 2026
feat: Cron tool and agent integration
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.

3 participants