S

Session Memory

AI 智慧體v2.0.0
作者:swaylq更新於 2026-11-05session-memory@clawhub_swaylq/session-memory
上下文管理記憶增強

據 AlphaMoat 統計,截至 2026-10,Session Memory 累計下載 8,724 次、獲 1 個星標,按累計下載量在本次參與排名的 10,914 個 AI 技能中排名第 3,188 位,在「AI 智慧體」分類(1,632 個)中排名第 422 位。

列表預設按累計下載量排序,也可按星標排序;詳情頁排名按累計下載量計算。

累計下載
8724
星標
1
全站下載量排名
#3,188
全站前 30% · 「AI 智慧體」前 26%
平台累計下載星標評論
SkillHub ↗87241—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

Bash 與 Node 工具可按主題、標籤和重要性儲存記錄,透過多關鍵詞搜尋,並按重要性與時間載入相關上下文。它還支援主題歸納、編輯、刪除、匯入匯出和歸檔,記憶以本地 JSONL 記錄儲存。 本機檔案可能包含個人或專案資訊;限制工作目錄存取,並在處理前核對所選檔案。

資料釋出於 2026-10-27

可以用來做什麼

  • 為後續會話保留決策和有用背景

什麼時候用

  • 智慧體需要持久上下文、可搜尋記錄或會話開始摘要時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

按主題和重要性儲存這條非敏感專案決策,並說明之後如何檢索。

月度資料趨勢

累計下載8724
3841646490862026-03 · 累計下載 42032026-05 · 累計下載 53752026-06 · 累計下載 56272026-07 · 累計下載 59872026-08 · 累計下載 61822026-09 · 累計下載 65692026-10 · 累計下載 872426-0326-0926-10
星標1
0122026-03 · 星標 12026-05 · 星標 12026-06 · 星標 12026-07 · 星標 12026-08 · 星標 12026-09 · 星標 12026-10 · 星標 126-0326-0926-10

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-108724—1
2026-096569—1
2026-086182+3.3%1
2026-075987+6.4%1
2026-065627+4.7%1
2026-055375—1
2026-034203—1

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

5.2 KB · SkillHub v2.0.0
---
name: session-memory
description: Persistent memory toolkit for AI agents. Save context, recall with relevance scoring, consolidate insights, track decisions across sessions. Features importance levels, multi-keyword search, session context loader, export/import, memory stats. Pure bash+node, no dependencies. v2.0.0
homepage: https://github.com/voidborne-d/session-memory-skill
metadata: {"openclaw":{"emoji":"🧠","requires":{"bins":["node"]}}}
---

# Session Memory 🧠 v2.0

Persistent memory for AI agents. Save what matters, recall what's relevant, consolidate what you've learned.
展開全部(共 213 行)

**v2.0:** relevance-scored search, importance levels, session context loader, consolidation, export/import, stats, edit/delete.

## Quick Start

```bash
# Save a memory (with optional importance)
MEMORY_IMPORTANCE=high ./scripts/save.sh "decision" "Chose Postgres over SQLite for scale"

# Recall with relevance scoring
./scripts/recall.sh "database" --limit 5

# Load session context (startup)
./scripts/context.sh --days 3

# Consolidate by topic
./scripts/consolidate.sh --since 2026-01-01

# Stats
./scripts/stats.sh
```

---

## Commands

### save.sh — Save a Memory

```bash
./scripts/save.sh "topic" "content" [tags...]
```

| Env | Default | Description |
|-----|---------|-------------|
| `AGENT_MEMORY_DIR` | `~/.agent-memory` | Storage directory |
| `MEMORY_IMPORTANCE` | `normal` | low / normal / high / critical |

```bash
# Basic save
./scripts/save.sh "insight" "Users prefer dark mode 3:1" ui design

# High importance
MEMORY_IMPORTANCE=high ./scripts/save.sh "decision" "Migrated to TypeScript" refactor

# Critical (always surfaces in context.sh)
MEMORY_IMPORTANCE=critical ./scripts/save.sh "credential" "API key rotated, new one in vault"
```

### recall.sh — Search Memories

```bash
./scripts/recall.sh "query" [--json] [--limit N] [--topic T] [--importance I] [--since YYYY-MM-DD]
```

Features:
- **Multi-keyword AND search** — all words must match
- **Relevance scoring** — based on word match ratio + importance + recency
- **Filters** — by topic, importance level, date range

```bash
./scripts/recall.sh "database migration"
./scripts/recall.sh "API" --topic decision --limit 20
./scripts/recall.sh "deploy" --since 2026-03-01 --json
./scripts/recall.sh "error" --importance high
```

### context.sh — Session Startup Loader

```bash
./scripts/context.sh [--days N] [--limit N] [--json]
```

Loads the most relevant memories for a new session:
- Recent memories (last N days, default 3)
- High/critical importance items regardless of age
- Sorted by importance then recency
- Grouped by date

```bash
# Quick context
./scripts/context.sh

# Wider window
./scripts/context.sh --days 7 --limit 30

# For programmatic use
./scripts/context.sh --json
```

### daily.sh — Day View

```bash
./scripts/daily.sh [YYYY-MM-DD] [--json]
```

### topics.sh — Topic Index

```bash
./scripts/topics.sh [--json]
```

### consolidate.sh — Topic Consolidation

```bash
./scripts/consolidate.sh [--since YYYY-MM-DD] [--topic T] [--json]
```

Groups all memories by topic, showing counts, date ranges, top tags, and latest entries. Useful for periodic review.

### stats.sh — Memory Statistics

```bash
./scripts/stats.sh [--json]
```

Shows: total entries, date range, entries/day average, storage size, topic breakdown, importance distribution.

### edit.sh — Edit or Delete

```bash
./scripts/edit.sh <timestamp_ms> --content "new content"
./scripts/edit.sh <timestamp_ms> --topic "new topic"
./scripts/edit.sh <timestamp_ms> --importance critical
./scripts/edit.sh <timestamp_ms> --delete
```

### export.sh — Export Memories

```bash
./scripts/export.sh [-o backup.json] [--since YYYY-MM-DD] [--topic T]
```

### import.sh — Import Memories

```bash
./scripts/import.sh backup.json [--dry-run]
```

Deduplicates by timestamp — safe to run multiple times.

### prune.sh — Archive Old Memories

```bash
./scripts/prune.sh [days]
```

Moves memories older than N days (default: 30) to `archive/`.

---

## Storage

```
~/.agent-memory/
├── 2026/
│   ├── 01/
│   │   ├── 15.jsonl
│   │   └── 16.jsonl
│   └── 02/
│       └── 01.jsonl
└── archive/          # Pruned memories
```

Each line is a JSON object:
```json
{"ts":1706793600000,"topic":"decision","content":"Chose X because Y","tags":["project"],"importance":"high"}
```

## Importance Levels

| Level | When to Use | Behavior |
|-------|-------------|----------|
| `low` | Background info, minor notes | Only found via search |
| `normal` | Standard memories | Shown in daily view |
| `high` | Key decisions, insights | Always in session context |
| `critical` | Credentials, blockers, urgent | Always in session context, top priority |

## Recommended Workflow

```bash
# Session start
./scripts/context.sh

# During work — save important things
./scripts/save.sh "decision" "..."
MEMORY_IMPORTANCE=high ./scripts/save.sh "insight" "..."

# End of session
./scripts/save.sh "summary" "Today: did X, decided Y, next step Z"

# Weekly review
./scripts/consolidate.sh --since $(date -u -d '7 days ago' +%Y-%m-%d)
./scripts/stats.sh

# Monthly maintenance
./scripts/prune.sh 60
./scripts/export.sh -o backup-$(date +%Y%m).json
```

---

*Created by [Voidborne](https://voidborne.org) 🔹*

「AI 智慧體」分類下的熱門技能

資料月份:2026-10 · 下載/星標數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。