session-search
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseIf you are Claude Code: Do NOT use this skill directly. Use thesubagent via the Task tool instead - it handles this more efficiently without polluting your context.session-searcher
如果你是Claude Code: 请勿直接使用此技能。请通过Task工具使用子代理——它能更高效地处理此任务,且不会污染你的上下文。session-searcher
session-search
session-search
Search and find previous code agent sessions (Claude-Code or Codex-CLI) for specific
work, decisions, or code patterns.
搜索并查找过往代码Agent会话(Claude-Code或Codex-CLI)中的特定工作内容、决策或代码模式。
Workflow
工作流程
- Understand the query: Identify what the user is looking for (code patterns, decisions, specific work, design direction)
- Search with aichat: Run (use
aichat search --json -n 10 "[query]"to filter by project)-g "project" - Parse results: Use to extract fields from JSONL output (session_id, project, created, snippet, file_path)
jq - Deep dive if needed: Read session files at
(max 3 files)
~/.claude/projects/*/[session-id].jsonl - Summarize: Return a focused summary with key findings and references
Run to see all options (date filters, branch filters, etc.)
and JSONL field names.
aichat search --help- 理解查询内容:明确用户的需求(代码模式、决策、特定工作内容、设计方向)
- 使用aichat进行搜索:运行(使用
aichat search --json -n 10 "[query]"按项目筛选)-g "project" - 解析结果:使用从JSONL输出中提取字段(session_id、project、created、snippet、file_path)
jq - 必要时深入查看:读取路径下的会话文件(最多3个文件)
~/.claude/projects/*/[session-id].jsonl - 总结内容:返回包含关键发现和参考信息的聚焦式总结
运行查看所有选项(日期筛选、分支筛选等)以及JSONL字段名称。
aichat search --helpOutput Format
输出格式
Return a concise summary containing:
- Key Findings: 2-3 bullet points answering the query
- Relevant Sessions: Session IDs and dates for reference
- Specific Content: Code snippets or quotes if directly relevant
Format as clean markdown, not raw JSON.
返回简洁的总结,包含以下内容:
- 关键发现:2-3个回答查询要点的项目符号
- 相关会话:供参考的会话ID和日期
- 具体内容:直接相关的代码片段或引用内容
格式为清晰的Markdown,而非原始JSON。
Example
示例
Query: "Find sessions where we discussed authentication design"
bash
aichat search --json -n 10 "authentication design"Summary:
- Session abc123 (Dec 10): Discussed JWT vs session-based auth, decided on JWT
- Session def456 (Dec 8): Implemented refresh token rotation pattern
查询:"查找我们讨论过认证设计的会话"
bash
aichat search --json -n 10 "authentication design"总结:
- 会话abc123(12月10日):讨论了JWT与基于会话的认证,最终决定采用JWT
- 会话def456(12月8日):实现了刷新令牌轮转模式
Constraints
约束条件
- ALWAYS use flag with aichat search (otherwise it spawns interactive UI)
--json - NEVER return raw JSON output to the user - summarize and distill findings
- NEVER read more than 3 session files per query
- If no results found, suggest alternative search terms
- ONLY report information directly observed in files - never infer or extrapolate
- 始终在aichat搜索中使用标志(否则会启动交互式UI)
--json - 切勿向用户返回原始JSON输出——需进行总结和提炼
- 每次查询读取的会话文件不得超过3个
- 如果未找到结果,建议用户尝试其他搜索关键词
- 仅报告文件中直接观察到的信息——切勿推断或引申
Error Handling
错误处理
If command fails or is not found, ask user to install:
aichat searchbash
uv tool install claude-code-tools # Python package
cargo install aichat-search # Rust search TUIPrerequisites:
- Node.js 16+ (for action menus)
- Rust/Cargo (for aichat-search)
If user doesn't have uv or cargo:
bash
curl -LsSf https://astral.sh/uv/install.sh | sh # uv
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Rust如果命令执行失败或未找到,请提示用户安装:
aichat searchbash
uv tool install claude-code-tools # Python包
cargo install aichat-search # Rust搜索TUI前置要求:
- Node.js 16+(用于操作菜单)
- Rust/Cargo(用于aichat-search)
如果用户没有uv或cargo:
bash
curl -LsSf https://astral.sh/uv/install.sh | sh # uv
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Rust