wiki-agent
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWiki Agent — Targeted Cross-Agent History Search + Ingest
Wiki Agent — 跨Agent历史定向搜索与摄入
You are doing a query-driven targeted ingest from one specific AI agent's raw conversation history. The user is typically working in a different agent right now and wants to pull in context from another agent's past sessions.
This is not bulk ingest. You find sessions about a specific topic, extract the relevant blobs, distill them into the wiki, and return a synthesized answer the user can act on immediately.
你将执行基于查询的特定AI Agent原始对话历史定向摄入。用户当前通常在另一个Agent中工作,想要从其他Agent的过往会话中调取上下文信息。
这不是批量摄入。你需要找到与特定主题相关的会话,提取相关内容片段,将其提炼到wiki中,并返回用户可立即使用的合成答案。
Command Routing
命令路由
Parse the invocation to determine the target agent and optional query:
| Command | Target | Example |
|---|---|---|
| Claude Code history | |
| Codex CLI history | |
| Hermes agent history | |
| OpenClaw history | |
| Copilot chat history | |
If no query is given, default to recent sessions mode: ingest the last 5 unprocessed sessions from that agent and return a summary of what was found. This is equivalent to a focused for that agent only.
wiki-history-ingest解析调用指令以确定目标Agent和可选查询:
| 命令 | 目标 | 示例 |
|---|---|---|
| Claude Code历史记录 | |
| Codex CLI历史记录 | |
| Hermes Agent历史记录 | |
| OpenClaw历史记录 | |
| Copilot聊天历史记录 | |
如果未提供查询,默认进入近期会话模式:摄入该Agent的最后5个未处理会话,并返回找到内容的摘要。这相当于针对该Agent的聚焦版。
wiki-history-ingestBefore You Start
开始前准备
- Read → get
~/.obsidian-wiki/config.OBSIDIAN_VAULT_PATH - Read → know what's already ingested.
$OBSIDIAN_VAULT_PATH/.manifest.json - Read if it exists → warm context on recent wiki activity.
$OBSIDIAN_VAULT_PATH/hot.md
- 读取→ 获取
~/.obsidian-wiki/config。OBSIDIAN_VAULT_PATH - 读取→ 了解已摄入的内容。
$OBSIDIAN_VAULT_PATH/.manifest.json - 如果存在,请读取 → 获取wiki近期活动的上下文信息。
$OBSIDIAN_VAULT_PATH/hot.md
Step 1: Locate the Agent's History Root
步骤1:定位Agent的历史记录根目录
| Agent | Default path | Config override |
|---|---|---|
| | |
| | |
| | |
| | |
| | |
If the history root doesn't exist, stop and tell the user: "No history found at . Have you run on this machine? You can set a custom path with in ."
<agent><path><agent><CONFIG_VAR>.env| Agent | 默认路径 | 配置覆盖项 |
|---|---|---|
| | |
| | |
| | 环境变量或 |
| | |
| | |
如果历史记录根目录不存在,请停止操作并告知用户:"在未找到历史记录。你是否在此机器上运行过?你可以在中通过设置自定义路径。"
<path><agent><agent>.env<CONFIG_VAR>Step 2: Build Session Inventory
步骤2:构建会话清单
Use the cheapest index source for each agent — don't open session files until you know which ones are relevant.
为每个Agent使用成本最低的索引源——在确定哪些会话相关之前,不要打开会话文件。
Claude
Claude
Primary index: ~/.claude/projects/ (directories = projects, files = sessions)
Session files: ~/.claude/projects/*/*.jsonl
Desktop index: find ~/Library/Application Support/Claude/local-agent-mode-sessions -name "local_*.json"
Signal fields: sessionId, cwd, startedAt, title (in local_*.json)Build a list of sessions: .
{path, project_dir, modified_at, already_ingested}Primary index: ~/.claude/projects/ (directories = projects, files = sessions)
Session files: ~/.claude/projects/*/*.jsonl
Desktop index: find ~/Library/Application Support/Claude/local-agent-mode-sessions -name "local_*.json"
Signal fields: sessionId, cwd, startedAt, title (in local_*.json)构建会话列表:。
{path, project_dir, modified_at, already_ingested}Codex
Codex
Primary index: ~/.codex/session_index.jsonl
Session files: ~/.codex/sessions/**/rollout-*.jsonl
Signal fields: thread_id, name/title, updated_at (in session_index.jsonl)Read as the inventory. Each line: . Map thread IDs to rollout files by matching directory names.
session_index.jsonl{thread_id, name, updated_at}Primary index: ~/.codex/session_index.jsonl
Session files: ~/.codex/sessions/**/rollout-*.jsonl
Signal fields: thread_id, name/title, updated_at (in session_index.jsonl)读取作为清单。每一行:。通过匹配目录名将线程ID映射到rollout文件。
session_index.jsonl{thread_id, name, updated_at}Hermes
Hermes
Primary index: ~/.hermes/memories/*.md (fast to scan)
Session files: ~/.hermes/sessions/**/*.jsonl
Signal fields: file names, memory titles, first 3 lines of each memoryScan memory filenames first (they're often titled by topic). Fall back to session listing.
Primary index: ~/.hermes/memories/*.md (fast to scan)
Session files: ~/.hermes/sessions/**/*.jsonl
Signal fields: file names, memory titles, first 3 lines of each memory首先扫描内存文件名(通常按主题命名)。如果没有匹配项,再回退到会话列表。
OpenClaw
OpenClaw
Primary index: ~/.openclaw/workspace/memory/MEMORY.md (structured long-term memory)
Daily notes: ~/.openclaw/workspace/memory/YYYY-MM-DD.md
Session index: ~/.openclaw/agents/*/sessions/sessions.json
Session files: ~/.openclaw/agents/*/sessions/*.jsonlRead sections first — it's the pre-compiled summary of everything. Daily notes give recency signal.
MEMORY.mdPrimary index: ~/.openclaw/workspace/memory/MEMORY.md (structured long-term memory)
Daily notes: ~/.openclaw/workspace/memory/YYYY-MM-DD.md
Session index: ~/.openclaw/agents/*/sessions/sessions.json
Session files: ~/.openclaw/agents/*/sessions/*.jsonl首先读取的章节——这是所有内容的预编译摘要。每日笔记提供时效性信号。
MEMORY.mdCopilot
Copilot
Primary index: session filenames / directory listing
Session files: varies by client (VS Code: ~/.copilot/sessions/*.jsonl or similar)
Signal fields: session timestamps, file namesPrimary index: session filenames / directory listing
Session files: varies by client (VS Code: ~/.copilot/sessions/*.jsonl or similar)
Signal fields: session timestamps, file namesStep 3: Score Sessions Against the Query
步骤3:根据查询为会话评分
If a query was given, score each session in the inventory without opening full session files:
- Name/title match — does the session name or thread title contain the query terms? Score: +3
- CWD/project match — does the working directory suggest the right project? Score: +2
- Recency — sessions from the last 90 days score higher than older ones. Score: +1 per 30-day recency bracket (max +3)
- Already ingested — if this session was previously ingested and the wiki page already covers the query (check +
hot.md), flag as "covered" but still show in resultsindex.md
Select the top 3–5 sessions by score. If no query was given, select the 5 most recent unprocessed sessions.
如果提供了查询,在不打开完整会话文件的情况下为清单中的每个会话评分:
- 名称/标题匹配——会话名称或线程标题是否包含查询词?评分:+3
- 工作目录/项目匹配——工作目录是否指向正确的项目?评分:+2
- 时效性——近90天内的会话比旧会话得分更高。评分:每30天时间段+1(最高+3)
- 已摄入状态——如果该会话之前已被摄入,且wiki页面已覆盖该查询(检查+
hot.md),标记为“已覆盖”但仍显示在结果中index.md
选择得分前3-5的会话。如果未提供查询,选择5个最新的未处理会话。
Step 4: Extract the Relevant Blob
步骤4:提取相关内容片段
Open each selected session file and extract only the content relevant to the query. Do not read the full session if it's large — use targeted extraction.
打开每个选中的会话文件,仅提取与查询相关的内容。如果会话文件较大,不要读取完整内容——使用定向提取。
Per-Agent Extraction Strategy
各Agent提取策略
Claude (JSONL conversation):
- Each line:
{role, content, timestamp, ...} - Search with: to find the relevant lines
grep -i "<query terms>" <session.jsonl> - Extract: the surrounding conversation window (10 lines before + 20 lines after each hit)
- Special signal: tool calls (Read/Write/Bash/Edit) reveal what was actually done — extract these even without keyword matches if they're in the relevant window
Codex (rollout JSONL):
- Each line:
{type: "session_meta|turn_context|event_msg|response_item", ...} - Filter to (user turns) and
type: "event_msg"(model output)type: "response_item" - Search with:
grep -i "<query terms>" <rollout.jsonl> - Extract: matching turns + their parent context (the preceding the match)
turn_context - Skip: events (operational metadata, not knowledge)
session_meta
Hermes (memory files + session JSONL):
- For memory files: read the full file (they're short — typically <500 words each)
- For session JSONL: + surrounding window
grep -i "<query terms>" - Memory files with title matches → read fully; others → grep only
OpenClaw (MEMORY.md + daily notes + session JSONL):
- : grep for section headers containing query terms → extract that section
MEMORY.md - Daily notes: grep most recent 30 days for query terms → extract matching paragraphs
- Session JSONL: same grep-window approach as Claude
- Prefer MEMORY.md/daily notes over session JSONL (they're pre-synthesized)
Copilot (session JSONL):
- Same grep-window approach as Claude
- Look for checkpoint files if available (pre-summarized)
Claude(JSONL对话):
- 每一行:
{role, content, timestamp, ...} - 搜索方式:查找相关行
grep -i "<query terms>" <session.jsonl> - 提取内容:匹配内容前后的对话窗口(匹配项前10行+后20行)
- 特殊信号:工具调用(Read/Write/Bash/Edit)显示实际操作内容——即使没有关键词匹配,只要在相关窗口内也要提取这些内容
Codex(rollout JSONL):
- 每一行:
{type: "session_meta|turn_context|event_msg|response_item", ...} - 筛选(用户轮次)和
type: "event_msg"(模型输出)type: "response_item" - 搜索方式:
grep -i "<query terms>" <rollout.jsonl> - 提取内容:匹配的轮次及其父上下文(匹配项之前的)
turn_context - 跳过:事件(操作元数据,非知识内容)
session_meta
Hermes(内存文件+会话JSONL):
- 对于内存文件:读取完整文件(文件较短,通常<500词)
- 对于会话JSONL:使用+ 上下文窗口
grep -i "<query terms>" - 标题匹配的内存文件→完整读取;其他→仅使用grep搜索
OpenClaw(MEMORY.md+每日笔记+会话JSONL):
- :搜索包含查询词的章节标题→提取该章节
MEMORY.md - 每日笔记:搜索最近30天内的查询词→提取匹配段落
- 会话JSONL:采用与Claude相同的grep窗口方法
- 优先使用MEMORY.md/每日笔记而非会话JSONL(它们是预合成的)
Copilot(会话JSONL):
- 采用与Claude相同的grep窗口方法
- 如果有 checkpoint 文件(预摘要),优先使用
Step 5: Distill Blobs into Wiki Pages
步骤5:将内容片段提炼到Wiki页面
For each extracted blob, determine where it belongs in the wiki:
- Check if a wiki page already covers this — grep and page frontmatter for the topic. If yes, update the existing page rather than creating a new one.
index.md - Determine category using standard rules (from ):
llm-wiki/SKILL.md- Technique / how-to →
skills/ - Abstract concept / pattern →
concepts/ - Tool / library / person →
entities/ - Cross-cutting insight →
synthesis/
- Technique / how-to →
- Write or update the page with required frontmatter:
Setyaml
--- title: <topic> category: skill|concept|entity|synthesis tags: [tag1, tag2] sources: [<agent>://<path/to/session>] created: <date> updated: <date> confidence: high|medium|low lifecycle: stable|draft ---with the agent prefix sosourcescan find it later.memory-bridge - Add cross-links to related wiki pages found in .
index.md
Distillation rules (same as all ingest skills):
- Extract durable knowledge, not operational telemetry
- One wiki page per concept, not one per session
- Merge into existing pages rather than duplicating
- Keep the signal: decisions made, patterns discovered, techniques that worked, bugs explained
对于每个提取的内容片段,确定其在wiki中的归属:
- 检查是否已有wiki页面覆盖该主题——在和页面前置元数据中搜索该主题。如果有,更新现有页面而非创建新页面。
index.md - 确定分类使用标准规则(来自):
llm-wiki/SKILL.md- 技术/操作指南 →
skills/ - 抽象概念/模式 →
concepts/ - 工具/库/人物 →
entities/ - 跨领域见解 →
synthesis/
- 技术/操作指南 →
- 编写或更新页面并添加所需前置元数据:
设置yaml
--- title: <topic> category: skill|concept|entity|synthesis tags: [tag1, tag2] sources: [<agent>://<path/to/session>] created: <date> updated: <date> confidence: high|medium|low lifecycle: stable|draft ---时添加Agent前缀,以便sources后续能找到它。memory-bridge - 添加交叉链接到中找到的相关wiki页面。
index.md
提炼规则(与所有摄入技能相同):
- 提取持久知识,而非操作遥测数据
- 每个概念对应一个wiki页面,而非每个会话对应一个
- 合并到现有页面而非重复创建
- 保留关键信息:做出的决策、发现的模式、有效的技术、问题解释
Step 6: Return Synthesized Answer
步骤6:返回合成答案
After ingesting, immediately synthesize and return an answer from the newly ingested + existing wiki content:
undefined摄入完成后,立即从新摄入的内容+现有wiki内容中合成并返回答案:
undefinedFrom <agent> history: "<query>"
来自<agent>历史记录:"<query>"
Found in: <N> sessions (<session names/titles>)
Key insights:
<Synthesized answer — 3–5 bullet points of the most useful knowledge>
Wiki pages updated/created:
- [[page-name]] — <what was added>
- [[page-name]] — <what was added>
Sessions ingested:
| Session | Date | Relevance |
|---|---|---|
| <name> | <date> | <one-line why it was selected> |
Gaps: <What the sessions didn't cover that might be relevant>
If a query was given but no relevant sessions were found, say so explicitly: "No sessions about '<query>' found in `<agent>` history. The most recent sessions covered: <list topics from last 3 sessions>."
---找到于: <N>个会话(<会话名称/标题>)
关键见解:
<合成答案——3-5个最有用知识的要点>
更新/创建的Wiki页面:
- [[page-name]] — <添加的内容>
- [[page-name]] — <添加的内容>
已摄入的会话:
| 会话 | 日期 | 相关性 |
|---|---|---|
| <name> | <date> | <选中原因的单行说明> |
空白点: <会话未涵盖但可能相关的内容>
如果提供了查询但未找到相关会话,请明确告知:"在`<agent>`历史记录中未找到关于'<query>'的会话。最近的会话涵盖:<最近3个会话的主题列表>。"
---Step 7: Update Tracking Files
步骤7:更新跟踪文件
Update for each session file processed:
.manifest.jsonjson
{
"<path>": {
"ingested_at": "<now>",
"source_type": "<agent>_conversation",
"modified_at": "<file mtime>",
"pages_created": [...],
"pages_updated": [...]
}
}Append to :
log.md- [TIMESTAMP] WIKI-AGENT agent=<agent> query="<query>" sessions_searched=N sessions_ingested=M pages_created=X pages_updated=YUpdate with a one-line summary of what was ingested.
hot.md为每个处理的会话文件更新:
.manifest.jsonjson
{
"<path>": {
"ingested_at": "<now>",
"source_type": "<agent>_conversation",
"modified_at": "<file mtime>",
"pages_created": [...],
"pages_updated": [...]
}
}向追加内容:
log.md- [TIMESTAMP] WIKI-AGENT agent=<agent> query="<query>" sessions_searched=N sessions_ingested=M pages_created=X pages_updated=Y用摄入内容的单行摘要更新。
hot.mdCross-Agent Use Patterns
跨Agent使用模式
These are the primary use cases this skill is designed for:
"I'm on Codex. What did I figure out about X in Claude?"
→ — finds Claude sessions about X, ingests them, returns the answer
/wiki-claude "X""I solved a bug in Hermes last week. I need that context now in Claude Code."
→ — surfaces and ingests the Hermes session
/wiki-hermes "bug description""What are all the approaches I've tried for X across all my tools?"
→ Run , , in sequence — each ingests its slice, the wiki accumulates the cross-agent picture, then shows what each tool uniquely contributed
/wiki-claude "X"/wiki-codex "X"/wiki-hermes "X"/memory-bridge diffNo query — just "catch me up on recent Codex work"
→ — ingests last 5 Codex sessions and returns a summary
/wiki-codex以下是该技能设计的主要使用场景:
"我正在使用Codex。我在Claude中关于X的解决方案是什么?"
→ — 查找Claude中关于X的会话,摄入并返回答案
/wiki-claude "X""我上周在Hermes中解决了一个bug。现在需要在Claude Code中使用该上下文。"
→ — 调取并摄入Hermes会话
/wiki-hermes "bug description""我在所有工具中尝试过哪些解决X的方法?"
→ 依次运行、、 — 每个工具摄入其对应的内容片段,wiki积累跨Agent的完整信息,然后展示每个工具的独特贡献
/wiki-claude "X"/wiki-codex "X"/wiki-hermes "X"/memory-bridge diff无查询——仅需"了解我最近在Codex中的工作内容"
→ — 摄入最后5个Codex会话并返回摘要
/wiki-codex