Xpersona
S

Session Archive

CLAWHUB · Unverified

Automatically saves conversation messages to a SQLite database with query and model usage statistics functionality. Skill: Session Archive Owner: 18940111404 Summary: Automatically saves conversation messages to a SQLite database with query and model usage statistics functionality. Tags: latest:0.4.1 Version history: v0.4.1 | 2026-03-30T14:44:29.234Z | auto - Updated package version to 0.4.1. - No user-facing changes; documentation and core functionality remain unchanged. v0.4.0 | 2026-03-30T14:05:12.631Z | auto - Internal codebas

62
Rank
84
Safety
971
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 971 downloads reported by the source. Last updated 10/12/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s179sj8ta4ajzysdkrzm6cmwqd83v235:session-archive
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-18940111404-session-archive/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

29,821 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

# Session Archive Skill

## 描述
会话存档插件 - 自动将对话消息保存到 SQLite 数据库。

## 功能
- 实时保存对话消息
- 支持按会话、日期查询
- 统计模型使用情况

## 使用方法
此为底层插件,安装后自动生效,无需手动调用。

## 配置
- 数据库路径:`~/.openclaw/session-archive.db`
- 可在 openclaw.json 中自定义配置

README.md

# Session Archive Plugin

OpenClaw 插件:实时将对话消息存档到 SQLite 数据库。

## 功能特性

### 1. 对话消息存档 (messages 表)
- **实时写入**:每次对话完成后立即触发,自动保存到 SQLite
- **完整记录**:保存角色、内容、模型、时间戳
- **元数据**:支持 channel、message_type、tool_name、media_path 等

### 2. 操作记录 (operations 表)
支持手动调用记录以下操作:
- 文件操作:write/edit/delete
- 命令执行:exec/process
- 配置变更:config_change
- Gateway 操作:gateway_restart/start/stop
- 登录/登出:login/logout

## 安装

```bash
openclaw plugins install @zhuJian/session-archive
# 或
npm install @zhuJian/session-archive
```

## 配置

### 默认配置
- 数据库路径:`~/.openclaw/session-archive.db`

### 自定义配置
在 `openclaw.json` 中添加:

```json
{
  "plugins": {
    "entries": {
      "session-archive": {
        "enabled": true,
        "config": {
          "dbPath": "/自定义/路径/session.db"
        }
      }
    }
  }
}
```

## 数据库表结构

### messages 表
```sql
CREATE TABLE messages (
  id           INTEGER PRIMARY KEY AUTOINCREMENT,
  session_key  TEXT NOT NULL,
  session_id   TEXT NOT NULL,
  role         TEXT NOT NULL,
  content      TEXT NOT NULL DEFAULT '',
  model        TEXT,
  tokens       INTEGER,
  created_at   INTEGER NOT NULL,
  channel      TEXT,
  account_id   TEXT,
  message_id   TEXT,
  message_type TEXT,
  tool_name    TEXT,
  media_path   TEXT,
  tokens_input INTEGER,
  tokens_output INTEGER,
  cost_usd     REAL
);
```

### operations 表
```sql
CREATE TABLE operations (
  id              INTEGER PRIMARY KEY AUTOINCREMENT,
  session_key     TEXT,
  operation_type  TEXT NOT NULL,
  target          TEXT NOT NULL,
  details         TEXT,
  result          TEXT,
  operator        TEXT,
  created_at      INTEGER NOT NULL
);
```

## 使用示例

### 查询对话消息
```sql
SELECT * FROM messages WHERE session_key = 'agent:main:main' ORDER BY created_at DESC LIMIT 20;
```

### 查询某渠道的消息
```sql
SELECT * FROM messages WHERE channel = 'wecom' ORDER BY created_at DESC LIMIT 10;
```

### 查询工具调用
```sql
SELECT * FROM messages WHERE message_type = 'tool' ORDER BY created_at DESC LIMIT 10;
```

## 开发者接口

### 记录操作
```typescript
// 在其他插件中调用
const engine = api.getContextEngine('session-archive');
engine.recordOperation({
  operationType: 'exec',
  target: 'ls -la',
  details: { cwd: '/home' },
  result: 'success',
  operator: 'agent:devagent'
});
```

## 与 LCM 插件对比

| 特性 | session-archive | lossless-claw (LCM) |
|------|------------------|---------------------|
| 存储方式 | SQLite | LSM 压缩存储 |
| 压缩 | 无 | 有 |
| 查询性能 | 快 | 较慢 |
| 用途 | 原始消息存档 | 上下文压缩 |
| 互补 | ✅ 可一起使用 | ✅ 可一起使用 |

## 注意事项

1. **数据安全**:数据库文件包含完整对话内容,请妥善保管
2. **磁盘空间**:根据对话量预估存储需求(参考:500条消息/天 ≈ 250KB/天)
3. **兼容性**:需要 OpenClaw >= 2026.3.0

## 版本历史

- **0.4.0**:新增元数据字段(channel、message_type、tool_name、media_path 等)
- **0.3.0**:新增 operations 表支持操作记录
- **0.2.0**:新增元数据字段
- **0.1.0**:初始版本,只记录对话消息

## 作者

- 作者:ZhuJian
- 许可证:MIT

_meta.json

{
  "ownerId": "kn79ge9nvcwta188q524t6smvh835bm0",
  "slug": "session-archive",
  "version": "0.4.1",
  "publishedAt": 1774881869234
}

skill-card.md

## Description:

Automatically saves conversation messages to a SQLite database with query and model usage statistics functionality.

This skill is ready for commercial/non-commercial use.

## Publisher:

[18940111404](https://clawhub.ai/user/18940111404)

### License/Terms of Use:

MIT-0

## Use Case:

OpenClaw users and developers use this plugin to keep a local SQLite archive of conversations, operation records, and model usage statistics for querying, auditing, or troubleshooting.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The plugin automatically stores full conversation contents and operational metadata in a long-lived local SQLite database.

Mitigation: Install only when local archiving is intended; choose a private database path, restrict file permissions, and define retention or deletion practices.

Risk: Archived sessions can include secrets, tool results, media paths, and usage or cost metadata.

Mitigation: Treat the database and its WAL/SHM sidecar files as sensitive, and avoid storing secrets in archived sessions.

## Reference(s):

- [ClawHub Skill Page](https://clawhub.ai/18940111404/skills/session-archive)
- [README](artifact/README.md)
- [Plugin Configuration Schema](artifact/openclaw.plugin.json)

## Skill Output:

**Output Type(s):** [Files, Configuration]

**Output Format:** [SQLite database records and JSON configuration]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Writes messages, operations, and token usage to local SQLite tables; assembly and compaction return pass-through results.]

## Skill Version(s):

0.4.1 (source: server release metadata and package.json)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

openclaw.plugin.json

{
  "id": "session-archive",
  "configSchema": {
    "type": "object",
    "additionalProperties": false,
    "properties": {
      "dbPath": {
        "type": "string",
        "description": "Path to SQLite database file (default: ~/.openclaw/session-archive.db)"
      }
    }
  },
  "uiHints": {
    "dbPath": {
      "label": "Database Path",
      "help": "Path to SQLite database file for session archiving"
    }
  }
}

Sponsored

Ads related to Session Archive and adjacent AI workflows.