session-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSession Search
会话搜索
Answers "which of my past sessions was about X" and then pulls that session's context in.
用于回答“我哪次过往会话是关于X的”,并调取该会话的上下文。
Step 1: Check the graph exists and is fresh
步骤1:检查图谱是否存在且为最新版本
bash
obsidian-wiki sessions-query "<topic>" --jsonIf this exits 1 with "run sessions-build first", tell the user and offer . If
is more than ~7 days old, mention it and offer a rebuild — but do not silently
rebuild, since that is a multi-second operation the user did not ask for.
/session-braingraph.jsonbash
obsidian-wiki sessions-query "<topic>" --json如果该命令返回状态码1并提示“先运行sessions-build”,请告知用户并提供命令选项。如果已超过约7天,需告知用户并提供重建选项——但请勿静默重建,因为这是一项耗时数秒的操作,且用户并未主动要求。
/session-braingraph.jsonStep 2: Rank
步骤2:排序
The scoring already combines four signals, so take the ordering as given rather than re-ranking:
- similarity — TF-IDF cosine against the session's text
- cluster lift — a session inside the best-matching topic scores higher even if its own words never matched. This is why a session that never said "telemetry" can still surface for it.
- bookmark boost — a human already flagged this session as worth keeping
- time decay — 90-day half-life, applied with a floor so an old exact match still outranks a fresh weak one
Useful filters: , , , .
--project NAME--cluster N--since DATE--top N评分已结合了四个信号,因此直接使用给定的排序结果即可,无需重新排序:
- 相似度 — 基于会话文本的TF-IDF余弦相似度
- 集群提升 — 即使会话自身文本未匹配关键词,只要它属于最匹配的主题集群,评分也会更高。这就是为什么从未提及“telemetry”的会话仍可能因该主题被检索出来。
- 书签加权 — 已被人工标记为值得保留的会话
- 时间衰减 — 半衰期为90天,设置最低分值,确保旧的精确匹配仍优先于新的弱匹配
实用筛选参数:、、、。
--project NAME--cluster N--since DATE--top NStep 3: Present
步骤3:展示结果
Show the top ~5 as a compact table — title, project, date, topic, and the string, which
already explains the match. Do not dump the raw JSON at the user.
whyTwo things must be stated honestly rather than glossed over:
- Entries with are history-only: the transcript has been pruned from disk and only the prompts survive. They are listed in
loadable: falsewith a reason. Say the transcript is gone; do not imply it can be retrieved.unloadable - If everything relevant is unloadable, answer from the prompt text that is there and say that is all that remains.
将排名前5的结果以简洁表格形式展示——包含标题、项目、日期、主题以及字段(该字段已解释匹配原因)。请勿向用户输出原始JSON数据。
why有两件事必须如实说明,不得含糊:
- 标记为的条目属于仅历史记录:会话记录已从磁盘中删除,仅保留提示内容。这些条目会在
loadable: false列表中附带原因说明。需告知用户会话记录已不存在,不得暗示可恢复。unloadable - 如果所有相关条目均无法加载,则基于现有的提示文本进行回答,并说明这是仅存的内容。
Step 4: Load — hand off, do not reimplement
步骤4:加载——转交处理,勿重复实现
should_loadPrefer an existing loader skill if the user has one installed:
- — loads a Claude session by id
claude-session-load - — use when the hit is bookmarked
bookmark-load
⚠️ Those skills live in the user's personal skills directory (), not in this
repo. They may not exist. Do not assume them and do not error if they are absent — fall back to
reading the transcript directly:
~/.claude/skills/bash
undefinedshould_load如果用户已安装现有的加载skill,优先使用:
- — 通过ID加载Claude会话
claude-session-load - — 当匹配结果已被书签标记时使用
bookmark-load
⚠️ 这些skill存储在用户的个人技能目录()中,不在本仓库内。它们可能不存在。请勿假设其存在,若不存在也无需报错——直接回退到读取会话记录:
~/.claude/skills/bash
undefinedthe path is in the query result as transcript
transcript路径在查询结果的transcript
字段中
transcriptobsidian-wiki sessions-show <session-id> --pretty
The transcript is JSONL and can be tens of MB. **Never read one whole.** Filter to the human turns
first:
```bash
grep -c '' <transcript> # size check before anything else
python3 -c "
import json,sys
for line in open(sys.argv[1], errors='replace'):
try: r = json.loads(line)
except ValueError: continue
if r.get('type')=='user' and not r.get('isSidechain') and not r.get('isMeta'):
c = (r.get('message') or {}).get('content')
if isinstance(c,str) and not c.lstrip().startswith('<'): print('>', c[:400])
" <transcript>obsidian-wiki sessions-show <session-id> --pretty
会话记录为JSONL格式,大小可达数十MB。**绝不要读取完整文件**。先筛选出用户的对话内容:
```bash
grep -c '' <transcript> # 先检查文件大小
python3 -c "
import json,sys
for line in open(sys.argv[1], errors='replace'):
try: r = json.loads(line)
except ValueError: continue
if r.get('type')=='user' and not r.get('isSidechain') and not r.get('isMeta'):
c = (r.get('message') or {}).get('content')
if isinstance(c,str) and not c.lstrip().startswith('<'): print('>', c[:400])
" <transcript>Step 5: Answer
步骤5:生成回答
Synthesise from what you loaded and cite the session ids you used. If the answer came from a
history-only session's prompts rather than a real transcript, say so — the user needs to know how
much of the context you actually have.
基于加载的内容生成回答,并注明所使用的会话ID。如果回答仅来自仅历史记录会话的提示内容而非完整会话记录,需如实告知用户——用户需要了解你实际掌握的上下文程度。
Related
相关功能
- — build or refresh the graph, survey and name topics
/session-brain - — search compiled vault knowledge; this skill searches raw session history instead
wiki-query - — pull a topic out of another agent's history and distil it into the vault
wiki-agent
- — 构建或刷新图谱,梳理并命名主题
/session-brain - — 搜索已整理的vault知识;而本skill搜索的是原始会话历史
wiki-query - — 从其他Agent的历史记录中提取主题并提炼到vault中
wiki-agent