← 返回 Skills 市场
50
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install laosi-session-logs
功能描述
会话日志分析 - 搜索和分析历史会话日志,查找之前的对话内容和结果。
使用说明 (SKILL.md)
Session Logs - 会话日志分析
激活词: 会话日志 / 搜索历史 / 历史记录
功能
- 搜索历史会话
- 分析会话模式
- 提取关键信息
- 按时间过滤
Python实现
import json
import os
from datetime import datetime, timedelta
from pathlib import Path
class SessionLogs:
def __init__(self, log_dir: str = "~/.openclaw/logs"):
self.log_dir = Path(log_dir).expanduser()
def list_sessions(self, days: int = 7) -> list:
sessions = []
cutoff = datetime.now() - timedelta(days=days)
for file in self.log_dir.glob("*.log"):
mtime = datetime.fromtimestamp(file.stat().st_mtime)
if mtime > cutoff:
sessions.append({
'file': file.name,
'modified': mtime,
'size': file.stat().st_size
})
return sorted(sessions, key=lambda x: x['modified'], reverse=True)
def search_logs(self, keyword: str, days: int = 7) -> list:
results = []
for file in self.log_dir.glob("*.log"):
try:
with open(file, 'r', encoding='utf-8', errors='ignore') as f:
for i, line in enumerate(f, 1):
if keyword.lower() in line.lower():
results.append({
'file': file.name,
'line': i,
'content': line.strip()[:200]
})
except:
pass
return results
def extract_commands(self, log_file: str) -> list:
commands = []
with open(self.log_dir / log_file, 'r') as f:
for line in f:
if 'command:' in line.lower() or 'user:' in line.lower():
commands.append(line.strip())
return commands
使用示例
logs = SessionLogs()
# 列出最近7天会话
recent = logs.list_sessions(7)
for s in recent:
print(f"{s['modified']}: {s['file']}")
# 搜索关键词
results = logs.search_logs("Python", days=30)
for r in results:
print(f"{r['file']}:{r['line']}: {r['content']}")
输出格式
## 会话日志
### 最近会话
| 日期 | 文件 | 大小 |
|------|------|------|
| 2026-04-28 | 2026-04-28.log | 1.2MB |
| 2026-04-27 | 2026-04-27.log | 2.3MB |
### 搜索结果 "Python"
- 2026-04-28.log:142: "用Python写个脚本..."
- 2026-04-27.log:89: "Python怎么导入模块"
安全使用建议
This is an instruction-only skill that reads log files from ~/.openclaw/logs to list and search past sessions. It does not ask for credentials or download code. Before installing, confirm that: (1) you are comfortable with a tool reading files in ~/.openclaw/logs (these logs may contain sensitive data or commands), (2) the log directory location is correct for your environment, and (3) you want the agent to be able to access that data when the skill runs. Note the example code has minor bugs (search ignores the days parameter and returns raw line snippets that could include secrets); consider reviewing or testing the code locally, adding mtime filtering, limiting result size, and sanitizing outputs before using in production.
功能分析
Type: OpenClaw Skill
Name: laosi-session-logs
Version: 1.0.0
The skill provides legitimate functionality for searching and analyzing local OpenClaw session logs stored in ~/.openclaw/logs. The Python implementation in SKILL.md uses standard libraries for file I/O and lacks any indicators of data exfiltration, remote execution, or malicious intent.
能力评估
Purpose & Capability
Name/description (session log search and analysis) match the instructions and example code, which operate on a local log directory (~/.openclaw/logs). No unrelated credentials, binaries, or installs are requested.
Instruction Scope
SKILL.md contains Python code that reads and searches log files in ~/.openclaw/logs — this matches purpose. Minor implementation issues: search_logs accepts a days parameter but does not filter by modification time (it will scan all *.log files), exceptions are broadly swallowed, and extract_commands reads file contents without encoding/options. These are correctness/privacy concerns but not evidence of hidden behavior.
Install Mechanism
No install spec and no code files beyond SKILL.md (instruction-only). Nothing is written to disk or downloaded by the skill itself.
Credentials
No environment variables, credentials, or external config paths are required. The only resource accessed is a local path (~/.openclaw/logs), which is consistent with a session-log analysis tool.
Persistence & Privilege
always is false and the skill does not request persistent/system-wide configuration or elevated privileges. Autonomous invocation is allowed by default but is not combined with other red flags.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install laosi-session-logs - 安装完成后,直接呼叫该 Skill 的名称或使用
/laosi-session-logs触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
搜索和分析历史会话
元数据
常见问题
会话日志分析 是什么?
会话日志分析 - 搜索和分析历史会话日志,查找之前的对话内容和结果。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 50 次。
如何安装 会话日志分析?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install laosi-session-logs」即可一键安装,无需额外配置。
会话日志分析 是免费的吗?
是的,会话日志分析 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
会话日志分析 支持哪些平台?
会话日志分析 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 会话日志分析?
由 534422530(@534422530)开发并维护,当前版本 v1.0.0。
推荐 Skills