会话日志分析

v1.0.0

会话日志分析 - 搜索和分析历史会话日志,查找之前的对话内容和结果。

0· 30·0 current·0 all-time

Install

OpenClaw Prompt Flow

Install with OpenClaw

Best for remote or guided setup. Copy the exact prompt, then paste it into OpenClaw for 534422530/laosi-session-logs.

Previewing Install & Setup.
Prompt PreviewInstall & Setup
Install the skill "会话日志分析" (534422530/laosi-session-logs) from ClawHub.
Skill page: https://clawhub.ai/534422530/laosi-session-logs
Keep the work scoped to this skill only.
After install, inspect the skill metadata and help me finish setup.
Use only the metadata you can verify from ClawHub; do not invent missing requirements.
Ask before making any broader environment changes.

Command Line

CLI Commands

Use the direct CLI path if you want to install manually and keep every step visible.

OpenClaw CLI

Bare skill slug

openclaw skills install laosi-session-logs

ClawHub CLI

Package manager switcher

npx clawhub@latest install laosi-session-logs
Security Scan
VirusTotalVirusTotal
Benign
View report →
OpenClawOpenClaw
Benign
high confidence
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.
Assessment
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.

Like a lobster shell, security has layers — review code before you run it.

historyvk979g70kdnnkc1mm41yefpmkjh85q1mjlatestvk979g70kdnnkc1mm41yefpmkjh85q1mjlogsvk979g70kdnnkc1mm41yefpmkjh85q1mjsessionvk979g70kdnnkc1mm41yefpmkjh85q1mj
30downloads
0stars
1versions
Updated 3h ago
v1.0.0
MIT-0

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怎么导入模块"

Comments

Loading comments...