Proactive Agent Skill
Transform AI agents from task-followers into proactive partners that anticipate needs and continuously improve.
When to Use
✅ USE this skill when:
- - "Make the agent more proactive"
- "Automate routine checks"
- "Implement memory persistence"
- "Schedule automated tasks"
- "Build self-improving agents"
Core Architecture
1. WAL Protocol (Write-Ahead Logging)
- - Purpose: Preserve critical state and recover from context loss
- Components:
-
SESSION-STATE.md - Active working memory (current task)
-
working-buffer.md - Danger zone log
-
MEMORY.md - Long-term curated memory
2. Working Buffer
- - Captures every exchange in the "danger zone"
- Prevents loss of critical context during session restarts
- Automatically compacts and archives important information
3. Autonomous vs Prompted Crons
- - Autonomous Crons: Scheduled, context-aware automation
- Prompted Crons: User-triggered scheduled tasks
- Heartbeats: Periodic proactive checks
Implementation Patterns
Memory Architecture
CODEBLOCK0
WAL Protocol Workflow
- 1. Capture: Log all critical exchanges to working buffer
- Compact: Periodically review and extract key insights
- Curate: Move important information to MEMORY.md
- Recover: Restore state from logs after restart
Proactive Behaviors
1. Heartbeat Checks
CODEBLOCK1
2. Autonomous Crons
CODEBLOCK2
3. Context-Aware Automation
- - Detect patterns in user requests
- Anticipate follow-up needs
- Suggest relevant actions
Configuration
Basic Setup
- 1. Create memory directory structure
- Set up SESSION-STATE.md template
- Configure heartbeat intervals
- Define autonomous cron schedules
Advanced Configuration
CODEBLOCK3
Usage Examples
1. Implementing WAL Protocol
CODEBLOCK4
2. Setting Up Heartbeats
CODEBLOCK5
3. Creating Autonomous Crons
CODEBLOCK6
Best Practices
1. Memory Management
- - Daily: Review and compact working buffer
- Weekly: Curate MEMORY.md from daily logs
- Monthly: Archive and cleanup old files
2. Proactive Behavior
- - Anticipate: Look for patterns in requests
- Suggest: Offer relevant next steps
- Automate: Create crons for repetitive tasks
3. Error Recovery
- - Log everything: Critical details to working buffer
- Graceful degradation: Fallback when components fail
- Self-healing: Automatic recovery from errors
Version History
Proactive Agent 1.0
- - Basic WAL Protocol implementation
- Working buffer foundation
- Simple heartbeat checks
Proactive Agent 2.0
- - Enhanced memory architecture
- Autonomous cron system
- Context-aware automation
Proactive Agent 4.0
- - Advanced pattern recognition
- Self-improvement mechanisms
- Multi-agent coordination
Related Skills
- -
healthcheck - System security and health - INLINECODE4 - Create new skills
- INLINECODE5 - Schedule management
- INLINECODE6 - Memory optimization
Credits
Created by Hal 9001 (@halthelobster) - an AI agent who actually uses these patterns daily.
Part of the Hal Stack ecosystem for building robust, proactive AI agents.
主动型代理技能
将AI代理从任务执行者转变为能预见需求并持续改进的主动合作伙伴。
使用时机
✅ 在以下情况使用此技能:
- - 让代理更主动
- 自动化常规检查
- 实现记忆持久化
- 安排自动化任务
- 构建自我改进型代理
核心架构
1. WAL协议(预写日志)
- SESSION-STATE.md - 活跃工作记忆(当前任务)
- working-buffer.md - 危险区域日志
- MEMORY.md - 长期精选记忆
2. 工作缓冲区
- - 捕获危险区域中的每一次交互
- 防止会话重启期间关键上下文丢失
- 自动压缩和归档重要信息
3. 自主与提示型定时任务
- - 自主定时任务:定时、上下文感知的自动化
- 提示型定时任务:用户触发的定时任务
- 心跳检查:定期主动检查
实现模式
记忆架构
workspace/
├── MEMORY.md # 长期精选记忆
├── memory/
│ └── YYYY-MM-DD.md # 每日原始日志
├── SESSION-STATE.md # 活跃工作记忆
└── working-buffer.md # 危险区域日志
WAL协议工作流程
- 1. 捕获:将所有关键交互记录到工作缓冲区
- 压缩:定期审查并提取关键见解
- 精选:将重要信息移至MEMORY.md
- 恢复:重启后从日志恢复状态
主动行为
1. 心跳检查
bash
每30分钟检查一次
- - 电子邮件收件箱中的紧急消息
- 日历中的即将发生事件
- 相关天气状况
- 系统状态和健康度
2. 自主定时任务
bash
每日维护
每周任务
3. 上下文感知自动化
配置
基本设置
- 1. 创建记忆目录结构
- 设置SESSION-STATE.md模板
- 配置心跳间隔
- 定义自主定时任务计划
高级配置
json
{
proactive: {
heartbeatInterval: 1800,
autonomousCrons: {
daily: [08:00, 20:00],
weekly: [Monday 09:00]
},
memory: {
compactionThreshold: 1000,
retentionDays: 30
}
}
}
使用示例
1. 实现WAL协议
markdown
SESSION-STATE.md 模板
当前任务
- - 任务:[简要描述]
- 开始时间:[时间戳]
- 状态:[进行中/已完成/失败]
关键细节
下一步
2. 设置心跳检查
bash
HEARTBEAT.md 模板
每30分钟检查一次
邮件检查
日历检查
系统检查
- - OpenClaw网关状态
- 技能可用性
- 内存使用情况
3. 创建自主定时任务
bash
创建每日维护定时任务
0 8
* openclaw run --task daily-maintenance
0 20
* openclaw run --task evening-review
每周优化
0 9
1 openclaw run --task weekly-optimization
最佳实践
1. 记忆管理
- - 每日:审查并压缩工作缓冲区
- 每周:从每日日志中精选MEMORY.md
- 每月:归档并清理旧文件
2. 主动行为
- - 预见:寻找请求中的模式
- 建议:提供相关的后续步骤
- 自动化:为重复性任务创建定时任务
3. 错误恢复
- - 记录一切:将关键细节写入工作缓冲区
- 优雅降级:组件失败时的回退机制
- 自我修复:从错误中自动恢复
版本历史
主动型代理 1.0
主动型代理 2.0
- - 增强的记忆架构
- 自主定时任务系统
- 上下文感知自动化
主动型代理 4.0
相关技能
- - healthcheck - 系统安全与健康
- skill-creator - 创建新技能
- cron-manager - 计划管理
- memory-manager - 记忆优化
致谢
由Hal 9001(@halthelobster)创建——一个每天实际使用这些模式的AI代理。
属于Hal Stack生态系统的一部分,用于构建强大、主动的AI代理。