← 返回
未分类 中文

Session Recall

Recover conversation context when a message arrives with unclear meaning. Use when a user's message lacks context (e.g. "I logged in" with no prior mention o...
Recover conversation context when a message arrives with unclear meaning. Use when a user's message lacks context (e.g. "I logged in" with no prior mention o...
yozu yozu 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 363
下载
💾 0
安装
1
版本
#latest

概述

Session Recall

Recover missing conversation context autonomously. Never ask the user "what are you talking about?" until all steps are exhausted.

When This Triggers

  • An incoming message doesn't match the current session context
  • Session starts after compaction (.jsonl.reset exists)
  • User references something not in current context window
  • User references a topic from another channel or a cron-delivered notification
  • Thread reply arrives without visible parent context

Recovery Flow

Execute steps in order. Stop early if sufficient context is found.

Step 0: sessions_history (fastest check)

Use sessions_history to retrieve recent messages for the current channel. This requires no file I/O and is the quickest way to recover recent context.

Step 1: Same-channel transcript

Read the .jsonl transcript for the current session:

  1. Look up the session associated with this channel via sessions_list or sessions.json
  2. Read ~/.openclaw/agents/{agent}/sessions/{sessionId}.jsonl (default agent: main)
  3. For large files, read the tail first (tail -n 200) rather than loading the entire file
  4. Check for .reset files with the same sessionId prefix (pre-compaction data)
  5. If the message is a thread reply, read the parent message first

Step 2: Channel context summary

Read memory/channel_context/{channel-name}.md if it exists. These are user-maintained summaries of ongoing topics per channel — not a built-in OpenClaw feature, but a recommended convention.

Step 3: Cross-channel and cron search

Messages often originate from cron jobs or other channels.

  1. Extract key terms from the unclear message
  2. Use the bundled search script or grep across all .jsonl files:

```bash

./scripts/search_sessions.sh "keyword"

```

  1. Also search for the current channel ID in other sessions — cron jobs send messages to channels but these don't appear in the channel's own .jsonl:

```bash

./scripts/search_sessions.sh "{current_channel_id}"

```

  1. When a match is found, read surrounding context to understand the full conversation
  2. Sort results by timestamp, prioritize most recent

Step 4: Memory files

  1. memory/active_context.md — current shared context across channels
  2. memory/YYYY-MM-DD.md — today and yesterday's daily notes
  3. Semantic memory search if available in your setup (e.g., memory_search tool)

Step 5: Ask the user (last resort)

Only after steps 0–4 yield nothing. Be specific about what was searched:

> "Searched this channel's transcript, cross-channel sessions (including cron), and memory files for '{keyword}' but couldn't find context. What are you referring to?"

Key Insight: Cron-to-Channel Messages

Cron jobs can send messages to channels via sessions_send or direct API calls. These messages:

  • Appear in the chat platform for the user to see
  • Are logged in the cron session's .jsonl, NOT the target channel's .jsonl
  • Require Step 3's channel-ID search to discover

This is the most common cause of unrecognized messages — the user is responding to something a cron job sent.

Security Note

Session transcripts may contain sensitive data (API keys, passwords, personal information). Do not pipe search output to public channels or logs. This skill assumes single-user/single-agent deployment.

Notes

  • Path ~/.openclaw/agents/main/sessions/ assumes default agent name main. Adjust if using a custom agent name.
  • Channel context files (memory/channel_context/) are a recommended convention, not built-in. Users create and maintain these themselves.
  • The search script requires python3, grep, and bash.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 08:21 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

it-ops-security

Exec Security

yozu
在执行 exec/bash 前检查 shell 命令安全,检测递归删除、凭据泄漏等危险模式。
★ 0 📥 524
ai-agent

Find Skills

root
帮助用户发现和安装智能体技能,当用户询问如「如何做X」、「找X的技能」、「有能做...的吗」等问题时
★ 1,516 📥 572,159
ai-agent

self-improving agent

pskoett
记录自身发现以实现自我改进的技能
★ 4,162 📥 932,718