Chat History Analyzer | OpenClaw Skill
Description
Extracts and analyzes Cursor IDE chat history to identify key discoveries, obstacles, and solutions, saving findings to the journal.
Chat History Analyzer | OpenClaw Skill
Extracts chat history from Cursor IDE's local SQLite databases, analyzes the last hour of conversations for key discoveries, obstacles, and solutions, and saves structured findings to the OpenClaw journal directory.
Usage
- - As a scheduled cron job to continuously track insights from chat history
- Manually to analyze recent chat activity
- To identify recurring patterns, problems, or solutions in your workflow
CODEBLOCK0
What this skill does
- - Extracts chat history from Cursor's SQLite databases (global and workspace-specific)
- Analyzes the last hour of messages for patterns indicating discoveries, obstacles, and solutions
- Saves structured findings to
/Users/ghost/.openclaw/journal/ as markdown files - Runs automatically via cron job every hour
Integration as a Cron Job
This skill is designed to run hourly via OpenClaw cron. The analyze_logs.py script combines both log analysis and chat history analysis.
Example Cron Job Configuration:
CODEBLOCK1
Or run directly via shell script:
CODEBLOCK2
Output Format
Findings are saved to /Users/ghost/.openclaw/journal/chat_analysis_YYYY-MM-DD_HHMMSS.md with sections for:
- - Key Discoveries: Successful findings, realizations, and implementations
- Obstacles Encountered: Errors, failures, and blockers
- Solutions Found: Fixes, workarounds, and resolutions
Requirements
- - Cursor IDE installed with chat history stored locally
- SQLite3 available (usually pre-installed on macOS)
- OpenClaw journal directory writable
How it works
- 1. Connects to Cursor's SQLite databases at
~/Library/Application Support/Cursor/User/globalStorage/state.vscdb and workspace-specific databases - Extracts messages from the last N hours (default: 1 hour)
- Analyzes message content using pattern matching for discoveries, obstacles, and solutions
- Saves structured markdown report to the journal directory
聊天历史分析器 | OpenClaw 技能
描述
提取并分析 Cursor IDE 的聊天历史,识别关键发现、障碍和解决方案,并将结果保存到日志中。
聊天历史分析器 | OpenClaw 技能
从 Cursor IDE 的本地 SQLite 数据库中提取聊天历史,分析最近一小时的对话内容,识别关键发现、障碍和解决方案,并将结构化结果保存到 OpenClaw 日志目录中。
使用方法
- - 作为定时任务持续追踪聊天历史中的洞察信息
- 手动分析最近的聊天活动
- 识别工作流程中的重复模式、问题或解决方案
bash
组合日志和聊天历史分析(用于定时任务)
python3 /Users/ghost/.openclaw/workspace/skills/chat-history-analyzer/scripts/analyze_logs.py
仅分析最近一小时的聊天历史
python3 /Users/ghost/.openclaw/workspace/skills/chat-history-analyzer/scripts/chat
historyanalyzer.py
分析最近两小时
python3 /Users/ghost/.openclaw/workspace/skills/chat-history-analyzer/scripts/chat
historyanalyzer.py --hours 2
输出 JSON 格式
python3 /Users/ghost/.openclaw/workspace/skills/chat-history-analyzer/scripts/analyze_logs.py --json
该技能的功能
- - 提取 Cursor 的 SQLite 数据库(全局和工作区专用)中的聊天历史
- 分析最近一小时的消息,识别发现、障碍和解决方案的模式
- 保存结构化结果到 /Users/ghost/.openclaw/journal/ 目录,格式为 markdown 文件
- 自动运行通过每小时执行的定时任务
集成定时任务
该技能设计为通过 OpenClaw 定时任务每小时执行一次。analyze_logs.py 脚本同时整合了日志分析和聊天历史分析。
定时任务配置示例:
json
{
payload: {
kind: agentTurn,
message: 运行 analyze_logs.py 脚本,分析最近一小时的日志和 Cursor 聊天历史,将结果保存到日志中。,
model: openrouter/google/gemini-2.5-flash,
thinking: low,
timeoutSeconds: 180
},
schedule: {
kind: cron,
cron: 0
},
delivery: {
mode: announce
},
sessionTarget: isolated,
name: 聊天历史与日志分析
}
或通过 shell 脚本直接运行:
bash
添加到 crontab(使用 crontab -e)
每小时的第 0 分钟执行
0
/Users/ghost/.openclaw/workspace/skills/chat-history-analyzer/scripts/analyze
logs.py --json >> /Users/ghost/.openclaw/logs/analyzelogs.log 2>&1
输出格式
结果保存到 /Users/ghost/.openclaw/journal/chatanalysisYYYY-MM-DD_HHMMSS.md,包含以下部分:
- - 关键发现:成功的发现、认识和实现
- 遇到的障碍:错误、失败和阻塞点
- 找到的解决方案:修复方法、变通方案和解决方案
要求
- - 已安装 Cursor IDE 并本地存储聊天历史
- 可使用 SQLite3(macOS 通常预装)
- OpenClaw 日志目录可写
工作原理
- 1. 连接到 Cursor 的 SQLite 数据库,路径为 ~/Library/Application Support/Cursor/User/globalStorage/state.vscdb 和工作区专用数据库
- 提取最近 N 小时(默认:1 小时)的消息
- 使用模式匹配分析消息内容,识别发现、障碍和解决方案
- 将结构化的 markdown 报告保存到日志目录