一句话定义
- 这一组命令负责直接调用 agent、查看和管理会话、使用记忆搜索,以及处理 ACP 等与 agent 交互相关的能力。
解决的问题
- 不经过聊天平台,怎么直接在终端里让 agent 干活
- 当前有哪些会话,哪些最近活跃
- 如何查
MEMORY.md与 daily memory 的语义索引状态 - 如何重建记忆索引
- 如何通过 ACP 连接外部 IDE 或工具
核心机制
agent:发起一次 agent turn。agents:管理隔离 agent(workspace、auth、routing)。sessions:查看会话(新增 cleanup、export-trajectory)。memory:记忆索引、重建、搜索(新增 promote、promote-explain、rem-backfill、rem-harness)。tasks:检视持久后台任务和 TaskFlow 状态(v2026.5.26 新增)。transcripts:检视已存储的 transcripts(v2026.5.26 新增)。system:system event / heartbeat / presence,属于系统级交互配套能力。
关键组成
1. 直接调用 agent
openclaw agent --message "今天天气怎么样?"
openclaw agent --message "分析这段代码" --thinking medium
openclaw agent --to +15555550123 --message "Run summary" --deliver
适合场景:
- 在终端直接做一次请求
- 继续某个特定 session
- 生成结果后直接投递到目标频道
2. 管理隔离 agent
openclaw agents list
openclaw agents add <name>
openclaw agents delete <id>
openclaw agents bindings
openclaw agents bind --agent <id> --bind telegram
适合场景:
- 多个独立 workspace / 多套模型路由
- 按频道或账号做路由隔离
3. 会话管理
openclaw sessions
openclaw sessions --active 120
openclaw sessions --json
openclaw sessions cleanup
openclaw sessions export-trajectory
适合场景:
- 看有哪些会话存在
- 看最近活跃会话
- 给脚本或自动化做 JSON 输出
cleanup:会话存储运维清理(v2026.5.26 新增)export-trajectory:导出 trajectory bundle(v2026.5.26 新增)
4. 记忆系统
openclaw memory status
openclaw memory status --deep
openclaw memory index
openclaw memory index --force
openclaw memory search "meeting notes"
openclaw memory promote --limit 10 --min-score 0.75
openclaw memory promote --apply
openclaw memory promote-explain "关键词"
openclaw memory rem-harness --json
openclaw memory rem-backfill --path ./memory
适合场景:
- 检查记忆索引是否可用
- 强制重建索引
- 基于语义搜索历史记忆
promote:将短期记忆提升为长期记忆(v2026.5.26 新增 REM 机制)promote-explain:解释特定候选的提升分数(v2026.5.26 新增)rem-backfill:写回历史 REM 摘要到 DREAMS.md(v2026.5.26 新增)rem-harness:预览 REM 反射和候选真值(v2026.5.26 新增)
5. Tasks、Transcripts 与系统级交互(v2026.5.26 新增)
openclaw tasks list
openclaw tasks show <id>
openclaw tasks cancel <id>
openclaw tasks flow
openclaw tasks audit
openclaw tasks maintenance
openclaw tasks notify
openclaw transcripts list
openclaw transcripts show <id>
openclaw transcripts path <id>
openclaw system event --text "hello"
openclaw system heartbeat last
openclaw system presence
说明:
tasks用于检视持久后台任务和 TaskFlow 状态(v2026.5.26 全新)transcripts用于检视已存储的 transcripts(v2026.5.26 全新)system偏向底层系统交互与心跳管理
生命周期 / 执行流程
做一次终端 agent 调用
openclaw agent --message "..."- 若需要渠道投递,加
--deliver、--channel、--to - 如果想复用上下文,可指定 session 相关参数
查历史与记忆
openclaw sessions --active 120openclaw memory statusopenclaw memory search "..."- 新增记忆文件后必要时
openclaw memory index
排查“记忆为什么搜不到”
openclaw memory statusopenclaw memory status --deepopenclaw memory index --force- 确认 embedding provider / memory 文件结构是否正常
高频命令组合
直接问 agent
openclaw agent --message "帮我总结今天日志"
看活跃会话 + 查记忆
openclaw sessions --active 120
openclaw memory search "上次讨论的服务器配置"
强制重建记忆索引
openclaw memory status
openclaw memory index --force
边界与限制
agent是一次性调用入口,不等于完整多轮消息平台体验。sessions主要是查看与枚举;具体对话能力更多还是通过 agent / 平台侧进行。memory search依赖 embedding / index 正常工作,provider 异常时会不可用。agents管理的是隔离 agent,而不是简单会话别名。
常见误区
- 误区 1:把
agent和message send混为一谈。前者是让 AI 干活,后者是发消息。 - 误区 2:以为新增记忆文件就会自动立即可搜索。很多场景仍需要
memory index。 - 误区 3:把
agents和sessions当同一层概念。前者偏运行实体,后者偏对话上下文。
对比项
agent:发起一次 agent turnagents:管理隔离 agentsessions:列出会话memory:索引与搜索记忆system:心跳、事件、presence
OpenClaw Agent、会话与记忆命令
https://blog.weihan.fun/archives/019e6d21-8c9c-77dc-8785-2e679d124fe3
评论