session-archiver

Session auto-archiver. Automatically archives completed sessions by extracting meaningful user+assistant messages from .reset transcript files and appending to daily memory.

3,880 stars

Best use case

session-archiver is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Session auto-archiver. Automatically archives completed sessions by extracting meaningful user+assistant messages from .reset transcript files and appending to daily memory.

Teams using session-archiver should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/session-archiver/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/aqbjqtd/session-archiver/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/session-archiver/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How session-archiver Compares

Feature / Agentsession-archiverStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Session auto-archiver. Automatically archives completed sessions by extracting meaningful user+assistant messages from .reset transcript files and appending to daily memory.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Session Archiver

自动归档对话历史到每日 memory,保留 user + assistant 消息。双保险触发:cron 每小时 + /new 时 spawn。

## 核心要点

1. **双保险触发** — cron 每小时自动运行 + /new 时 spawn subagent,确保不遗漏
2. **去重** — marker + memory 内容双保险,避免重复归档
3. **归档内容** — user + assistant 消息,彻底剥离元数据
4. **自动清理** — 保留最近 30 天日志,超出自动删除
5. **洞察提炼** — 自动提取值得沉淀的洞察候选,供下次会话审查
6. **零感知** — cron 归档静默不通知用户;/new 时 spawn 也不阻塞主窗口
7. **零配置** — 首次运行自动集成到 AGENTS.md,无需手动修改

## 快速集成

**无需手动操作。** 脚本首次运行时自动检测 AGENTS.md 并追加集成内容(搜索 `session-archiver` 关键词判断是否已集成)。

自动写入的内容为 Session Startup 第 5、6 步:
- 第 5 步:spawn 后台 subagent 运行归档脚本
- 第 6 步:主 agent 审查洞察候选文件

## 脚本位置

- 归档脚本:`scripts/session-auto-archive.js`
- 洞察提取:`scripts/extract-insights.js`

## 执行方式

### 机制 1:cron 每小时兜底(主流程)

通过 OpenClaw cron 系统部署,每小时执行一次 isolated subagent 运行归档脚本。delivery=none,静默运行不通知用户。

### 机制 2:/new 时即时触发(补充)

Session Startup 第 5 步 spawn 后台 subagent 运行归档脚本,确保即时性。

> 双保险:两者共享同一个去重 marker(memory/.last_archived_session),不会重复归档。

## 工作流程

1. 扫描 `~/.openclaw/agents/main/sessions/` 找最新 `.reset.*` 文件
2. 去重 A:检查 marker 文件
3. 去重 B:检查 memory 文件是否已有该 sessionId
4. 解析 JSONL,提取 user + assistant 消息
5. 彻底剥离 Conversation info 元数据
6. 短时内容相似去重(hash 前 80 字符)
7. 追加到 `memory/YYYY-MM-DD.md`
8. 更新 marker
9. **自动清理** — 删除 30 天前的 memory 文件
10. **洞察提炼** — 分析归档内容,结果写入 `memory/.insights-candidates-YYYY-MM-DD.md`

## 去重机制

| 检查点 | 文件 | 说明 |
|--------|------|------|
| marker | memory/.last_archived_session | 记录上次处理的 sessionId |
| memory 内容 | memory/YYYY-MM-DD.md | 搜索「来源 session: id」 |

## 洞察候选文件

分析归档内容,识别 6 类值得提炼的信息:

| 类型 | 说明 |
|------|------|
| 🤕 纠正 | 用户纠正了 AI 的行为 |
| 🔄 自我修正 | AI 承认错误或改进 |
| 📌 决策 | 形成了明确结论或建议 |
| 💡 偏好 | 用户表达了明确偏好 |
| ⚙️ 工作流变化 | 任务分工、工具选择发生变化 |
| 📝 教训 | 需要记住避免重蹈的规则 |

输出到 `memory/.insights-candidates-YYYY-MM-DD.md`,主 agent 在下次 Session Startup 时审查,决定是否吸收进 self-improving 文件。

## 注意事项

- 仅沉淀 text 内容,图片/文件不内联存储
- 长期重要内容需人工迁移至 MEMORY.md
- 主窗口永远不直接运行脚本,只 spawn subagent
- cron 归档和 /new spawn 共享 marker,不会重复归档
- 洞察提炼为辅助功能,找不到候选时静默退出

Related Skills

unified-session

3891
from openclaw/skills

Unify all chat channels into one shared AI session for seamless cross-device continuity. Start a conversation on your laptop, continue from your phone — same context, same memory, zero loss. Use this skill whenever: - User wants multiple messaging channels (DingTalk, Feishu/Lark, Telegram, Discord, WhatsApp, Signal, Slack, webchat) to share one conversation - User mentions "shared session", "cross-device", "multi-channel", "unified session", "continue conversation", "seamless", "context lost", "memory lost", "上下文丢失", "记忆丢失", "多端共享" - User says their bot "forgets" what was said when they switch from one app to another - User asks how to make Telegram/Discord/DingTalk/Feishu/WhatsApp share context with webchat - User wants to switch between desktop and mobile without losing conversation history - User mentions dmScope, session routing, channel isolation, or session merging - User describes wanting to pick up where they left off on a different device or chat app - User complains about having separate conversations on each channel when they only have one agent - Even if the user doesn't use technical terms — if they describe the pain of "switching apps and the AI doesn't remember", this is the skill to use

session-guardian

3891
from openclaw/skills

Never lose a conversation again. Auto-backup, smart recovery, and health monitoring for OpenClaw sessions. Protects against gateway crashes, model disconnections, and token overflow. Use this skill when: - User worries about losing conversations after gateway restart or model crash - User mentions session backup, conversation recovery, session protection, or data loss - User's agent is slow or timing out (likely token overflow from large sessions) - User runs multiple agents and needs to track collaboration across sessions - User asks about session health, backup strategy, or disaster recovery - User mentions "对话丢失", "会话备份", "上下文溢出", "token超限", "Gateway重启后记忆丢失" - Even if user just says "my agent lost everything after a restart" — this is the skill

General Utilities

session-rotate-80

3880
from openclaw/skills

Auto-create a new session when OpenClaw context usage reaches 80% without requiring Mem0 or file memory systems. Use when users want default OpenClaw to proactively rotate sessions and avoid context overflow in long chats.

Workflow & Productivity

Session Archive Skill

3891
from openclaw/skills

## 描述

youtube-archiver

3891
from openclaw/skills

Archive YouTube playlists into markdown notes with metadata, transcripts, AI summaries, and tags. Use when a user asks to import/sync YouTube playlists, archive Watch Later or Liked videos, enrich YouTube notes, batch process video notes, or automate recurring YouTube-to-markdown sync jobs with cron.

session-recover

3891
from openclaw/skills

短期记忆恢复技能。用于快速回顾当前 session 或上一个 session 的完整内容。适用于:想知道"这次 session 聊了什么"、session 被意外重置后需要恢复上下文、或想提取对话精华。

session-health-monitor

3891
from openclaw/skills

Context window health monitoring for OpenClaw agents — threshold warnings via Telegram, pre-compaction snapshots, and memory rotation.

urlsession-code-review

3891
from openclaw/skills

Reviews URLSession networking code for iOS/macOS. Covers async/await patterns, request building, error handling, caching, and background sessions.

session-history

3891
from openclaw/skills

Search and browse past conversation history across all sessions. Use when recalling prior work, finding old discussions, resuming dropped threads, or when the user references something from a previous conversation that isn't in memory files. Also use when asked to "remember" something discussed before, find "that conversation about X", or continue work from a past session.

memory-archiver

3891
from openclaw/skills

记忆管理技能 - 三层时间架构 + 三类记忆标签 + 自动搜索 Hook

browser-session-curator

3891
from openclaw/skills

Turn an overwhelming set of tabs, bookmarks, and snippets into a structured session digest with tasks, reading queue, and archive plan.

authorized-session-scrape

3891
from openclaw/skills

Continue searching and extracting within a user-authorized local browser session after the user logs in. Use for pagination, site search, tab-by-tab extraction, and post-login discovery without bypassing access controls.