直接读取 ~/.qclaw/memory/lossless/lcm.db(LCM 数据库,OpenClaw 核心会话存储)
时间边界:按 anchor_day + anchor_time(默认 08:00)确定本地时区一天窗口,
LCM 存储 UTC 时间,转换后匹配。
~/.qclaw/raw-report-data/raw-md/{YYYY-MM-DD}__{agent_id}__raw.md
~/.qclaw/raw-report-data/raw-docx/{YYYY-MM-DD}__{agent_id}__raw.docx
所有日期变量由 --date(默认昨天)决定,文件名固定为 {日期}__{agent_id}__raw.{ext} 格式。
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--agent-id main \
--output-md ~/.qclaw/raw-report-data/raw-md/report.md \
--output-docx ~/.qclaw/raw-report-data/raw-docx/report.docx
# 输出:~/.qclaw/raw-report-data/raw-md/2026-06-07__main__raw.md
# ~/.qclaw/raw-report-data/raw-docx/2026-06-07__main__raw.docx
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--date 2026-06-08 --agent-id main \
--output-md ~/.qclaw/raw-report-data/raw-md/report.md \
--output-docx ~/.qclaw/raw-report-data/raw-docx/report.docx
# 输出:~/.qclaw/raw-report-data/raw-md/2026-06-08__main__raw.md
# ~/.qclaw/raw-report-data/raw-docx/2026-06-08__main__raw.docx
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--days 7 --agent-id main \
--output-md ~/.qclaw/raw-report-data/raw-md/report.md \
--output-docx ~/.qclaw/raw-report-data/raw-docx/report.docx
# 生成:report__main__2026-06-02.md ~ report__main__2026-06-08.md
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--date-range 2026-06-05,2026-06-08 --agent-id main \
--output-md ~/.qclaw/raw-report-data/raw-md/report.md \
--output-docx ~/.qclaw/raw-report-data/raw-docx/report.docx
# 生成:report__main__2026-06-05.md, report__main__2026-06-08.md
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--date 2026-06-08 --agent-id main --format md-only \
--output-md ~/.qclaw/raw-report-data/raw-md/report.md \
--output-docx /dev/null
python3 <SCRIPT_PATH>/scripts/raw-report.py \
--date 2026-06-08 --agent-id main --dry-run
| 参数 | 必填 | 说明 | 默认值 |
|---|---|---|---|
| ------ | ------ | ------ | -------- |
--agent-id | ✅ | Agent ID(如 main、op-xxx) | - |
--date | ❌ | 报告日期(YYYY-MM-DD) | 昨天 |
--days | ❌ | 生成最近 N天的报告(含今天) | - |
--date-range | ❌ | 日期范围,逗号分隔 | - |
--mainline | ❌ | Mainline 名称 | primary |
--lcmdb | ❌ | lcm.db 路径 | ~/.qclaw/memory/lossless/lcm.db |
--output-md | ❌* | md 目录+前缀(单天自动生成 {日期}__{agent_id}__raw.md) | 见默认路径 |
--output-docx | ❌* | docx 目录+前缀(单天自动生成 {日期}__{agent_id}__raw.docx) | 见默认路径 |
--format | ❌ | both / md-only / docx-only | both |
--timezone | ❌ | 时区 | Asia/Shanghai |
--anchor-time | ❌ | 锚点时间(本地时区一天边界) | 08:00 |
--dry-run | ❌ | 仅打印统计,不写入文件 | false |
--user-name | ❌ | 用户显示名称(统一输出) | 你 |
--assistant-name | ❌ | 助手显示名称(统一输出) | 龙虾 |
*多天模式(--days 或 --date-range 多日)时必须至少指定一个输出路径。
| 模式 | 输出文件名 | 示例 |
|---|---|---|
| ------ | ----------- | ------ |
单天(--date) | {YYYY-MM-DD}__{agent_id}__raw.{ext} | 2026-06-08__main__raw.md |
多天(--days / --date-range) | {前缀}__{agent_id}__{YYYY-MM-DD}.{ext} | report__main__2026-06-08.md |
agent_id 自动嵌入文件名,不同 agent 的报告互不覆盖。
输出内容: 仅 user 和 assistant 的最终对话内容
role=tool 工具执行结果消息(不输出)---
schema: raw-report/v1
kind: conversation-log
anchor_day: 2026-06-08
timezone: Asia/Shanghai
agent_id: main
target_mainline: primary
source_of_truth: lcm-db
content_status: complete
coverage_status: verified
delivery_status: pending
---
# Raw Report
## Conversation
[2026-06-08 09:09:01 CST] openclaw-control-ui(webchat):现在我要分析 lcm.db
[2026-06-08 09:09:08 CST] 我:分析完成,以下是 lcm.db 的完整结构与内容报告。
...
创建 raw-report 的 cron 任务时,必须遵守以下规则:
--assistant-name 取当前 agent 的 IDENTITY.md 名字:从当前 workspace 的 IDENTITY.md 中 Name 字段取值(如 小腾、创业庄园庄主),禁止使用脚本默认值"龙虾",也禁止使用 openclaw.json 中的 identity.name(那是配置名,不是显示名)。--user-name 取 USER.md 中的称呼:从当前 workspace 的 USER.md 中 What to call them 字段取值(如"林老师")。如果该字段为空或未定义,才使用脚本默认值"你"。--date 参数:脚本默认取昨天数据,cron 场景下无需指定日期。要求:必须使用 message 工具发送生成的 docx 文件,参数用 media 传递文件的绝对路径。通过 cron 工具创建每日定时任务:
名称:daily-raw-report
时间:每天 08:00(Asia/Shanghai)
类型:agentTurn(isolated session)
触发命令(通过 cron 工具添加):
{
"name": "daily-raw-report",
"schedule": {
"kind": "cron",
"expr": "0 8 * * *",
"tz": "Asia/Shanghai"
},
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"message": "请生成昨日的 raw report。执行命令:python3 <SCRIPT_PATH>/scripts/raw-report.py --agent-id main --assistant-name QClaw --user-name 主人 --output-md ~/.qclaw/raw-report-data/raw-md/report.md --output-docx ~/.qclaw/raw-report-data/raw-docx/report.docx --format both。要求:必须使用 message 工具发送生成的 docx 文件,参数用 media 传递文件的绝对路径"
},
"delivery": {
"mode": "announce"
},
"enabled": true
}
说明:
--date,脚本默认取昨天数据--assistant-name 和 --user-name 按上方注意事项 1、2 规则动态填入,禁止使用脚本默认值sessionTarget: "isolated" 避免主会话干扰delivery.mode: "announce" 完成后在当前 channel 通知# python-docx(可选,生成富文本 docx;不装则使用内置 OOXML fallback)
pip install python-docx
共 3 个版本