stigmergy 1.2.13 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -3
- package/STIGMERGY.md +3 -0
- package/config/builtin-skills.json +43 -0
- package/config/enhanced-cli-config.json +438 -0
- package/docs/CLI_TOOLS_AGENT_SKILL_ANALYSIS.md +463 -0
- package/docs/DESIGN_CLI_HELP_ANALYZER_REFACTOR.md +726 -0
- package/docs/ENHANCED_CLI_AGENT_SKILL_CONFIG.md +285 -0
- package/docs/IMPLEMENTATION_CHECKLIST_CLI_HELP_ANALYZER_REFACTOR.md +1268 -0
- package/docs/INSTALLER_ARCHITECTURE.md +257 -0
- package/docs/LESSONS_LEARNED.md +252 -0
- package/docs/SPECS_CLI_HELP_ANALYZER_REFACTOR.md +287 -0
- package/docs/SUDO_PROBLEM_AND_SOLUTION.md +529 -0
- package/docs/correct-skillsio-implementation.md +368 -0
- package/docs/development_guidelines.md +276 -0
- package/docs/independent-resume-implementation.md +198 -0
- package/docs/resumesession-final-implementation.md +195 -0
- package/docs/resumesession-usage.md +87 -0
- package/package.json +146 -136
- package/scripts/analyze-router.js +168 -0
- package/scripts/run-comprehensive-tests.js +230 -0
- package/scripts/run-quick-tests.js +90 -0
- package/scripts/test-runner.js +344 -0
- package/skills/resumesession/INDEPENDENT_SKILL.md +403 -0
- package/skills/resumesession/README.md +381 -0
- package/skills/resumesession/SKILL.md +211 -0
- package/skills/resumesession/__init__.py +33 -0
- package/skills/resumesession/implementations/simple-resume.js +13 -0
- package/skills/resumesession/independent-resume.js +750 -0
- package/skills/resumesession/package.json +1 -0
- package/skills/resumesession/skill.json +1 -0
- package/src/adapters/claude/install_claude_integration.js +9 -1
- package/src/adapters/codebuddy/install_codebuddy_integration.js +3 -1
- package/src/adapters/codex/install_codex_integration.js +15 -5
- package/src/adapters/gemini/install_gemini_integration.js +3 -1
- package/src/adapters/qwen/install_qwen_integration.js +3 -1
- package/src/cli/commands/autoinstall.js +65 -0
- package/src/cli/commands/errors.js +190 -0
- package/src/cli/commands/independent-resume.js +395 -0
- package/src/cli/commands/install.js +179 -0
- package/src/cli/commands/permissions.js +108 -0
- package/src/cli/commands/project.js +485 -0
- package/src/cli/commands/scan.js +97 -0
- package/src/cli/commands/simple-resume.js +377 -0
- package/src/cli/commands/skills.js +158 -0
- package/src/cli/commands/status.js +113 -0
- package/src/cli/commands/stigmergy-resume.js +775 -0
- package/src/cli/commands/system.js +301 -0
- package/src/cli/commands/universal-resume.js +394 -0
- package/src/cli/router-beta.js +471 -0
- package/src/cli/utils/environment.js +75 -0
- package/src/cli/utils/formatters.js +47 -0
- package/src/cli/utils/skills_cache.js +92 -0
- package/src/core/cache_cleaner.js +1 -0
- package/src/core/cli_adapters.js +345 -0
- package/src/core/cli_help_analyzer.js +1236 -680
- package/src/core/cli_path_detector.js +702 -709
- package/src/core/cli_tools.js +515 -160
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +18 -0
- package/src/core/coordination/nodejs/HookDeploymentManager.js +242 -412
- package/src/core/coordination/nodejs/HookDeploymentManager.refactored.js +323 -0
- package/src/core/coordination/nodejs/generators/CLIAdapterGenerator.js +363 -0
- package/src/core/coordination/nodejs/generators/ResumeSessionGenerator.js +932 -0
- package/src/core/coordination/nodejs/generators/SkillsIntegrationGenerator.js +1395 -0
- package/src/core/coordination/nodejs/generators/index.js +12 -0
- package/src/core/enhanced_cli_installer.js +1208 -608
- package/src/core/enhanced_cli_parameter_handler.js +402 -0
- package/src/core/execution_mode_detector.js +222 -0
- package/src/core/installer.js +151 -106
- package/src/core/local_skill_scanner.js +732 -0
- package/src/core/multilingual/language-pattern-manager.js +1 -1
- package/src/core/skills/BuiltinSkillsDeployer.js +188 -0
- package/src/core/skills/StigmergySkillManager.js +123 -16
- package/src/core/skills/embedded-openskills/SkillParser.js +7 -3
- package/src/core/smart_router.js +550 -261
- package/src/index.js +10 -4
- package/src/utils.js +66 -7
- package/test/cli-integration.test.js +304 -0
- package/test/direct_smart_router_test.js +88 -0
- package/test/enhanced-cli-agent-skill-test.js +485 -0
- package/test/simple_test.js +82 -0
- package/test/smart_router_test_runner.js +123 -0
- package/test/smart_routing_edge_cases.test.js +284 -0
- package/test/smart_routing_simple_verification.js +139 -0
- package/test/smart_routing_verification.test.js +346 -0
- package/test/specific-cli-agent-skill-analysis.js +385 -0
- package/test/unit/smart_router.test.js +295 -0
- package/test/very_simple_test.js +54 -0
- package/src/cli/router.js +0 -1783
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
# ResumeSession - 跨 CLI 会话恢复工具
|
|
2
|
+
|
|
3
|
+
跨多个 CLI 工具恢复和管理会话历史的工具。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- **智能项目识别** - 自动识别当前项目目录并过滤相关会话
|
|
8
|
+
- **跨 CLI 支持** - 支持任何常见 CLI 工具
|
|
9
|
+
- **自动检测** - 自动扫描常见 CLI 的会话存储位置,无需手动配置
|
|
10
|
+
- **开箱即用** - 无需配置,安装即可使用
|
|
11
|
+
- **多种恢复模式** - 支持恢复最新会话、显示会话列表、按 CLI 过滤等
|
|
12
|
+
- **灵活的参数控制** - 通过参数控制显示的会话数量和范围
|
|
13
|
+
- **相对时间显示** - 显示会话的相对时间(如"5分钟前")
|
|
14
|
+
|
|
15
|
+
## 安装方式
|
|
16
|
+
|
|
17
|
+
### 方式 1: 全局安装(推荐)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 在工具目录下执行
|
|
21
|
+
npm install -g .
|
|
22
|
+
|
|
23
|
+
# 安装后可以在任何位置使用
|
|
24
|
+
resume-session
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 方式 2: 直接使用 Node.js
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 在工具目录下执行
|
|
31
|
+
node independent-resume.js [参数]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 方式 3: 创建软链接(Linux/Mac)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# 创建可执行链接
|
|
38
|
+
ln -s $(pwd)/independent-resume.js ~/.local/bin/resume-session
|
|
39
|
+
|
|
40
|
+
# 添加到 PATH(如果需要)
|
|
41
|
+
export PATH="$PATH:$HOME/.local/bin"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 使用方式
|
|
45
|
+
|
|
46
|
+
### 基本用法
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 恢复当前项目目录的最新会话(不论会话是哪个 CLI 产生的)
|
|
50
|
+
resume-session
|
|
51
|
+
|
|
52
|
+
# 或使用 Node.js
|
|
53
|
+
node independent-resume.js
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 显示多个会话
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# 显示当前项目目录相关的最近 5 个会话摘要列表
|
|
60
|
+
resume-session 5
|
|
61
|
+
|
|
62
|
+
# 显示最近 10 个会话
|
|
63
|
+
resume-session 10
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 按 CLI 过滤
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 显示当前项目的 iFlow 会话
|
|
70
|
+
resume-session iflow
|
|
71
|
+
|
|
72
|
+
# 显示当前项目最近 3 个 iFlow 会话
|
|
73
|
+
resume-session iflow 3
|
|
74
|
+
|
|
75
|
+
# 显示当前项目的 Claude 会话
|
|
76
|
+
resume-session claude
|
|
77
|
+
|
|
78
|
+
# 显示当前项目最近 5 个 Gemini 会话
|
|
79
|
+
resume-session gemini 5
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 显示所有会话
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# 显示当前项目所有 CLI 的会话列表
|
|
86
|
+
resume-session --all
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 显示完整会话列表
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 显示所有 CLI 所有项目的会话分类列表
|
|
93
|
+
resume-session --complete
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 显示帮助
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
resume-session --help
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 参数说明
|
|
103
|
+
|
|
104
|
+
| 参数 | 说明 |
|
|
105
|
+
|------|------|
|
|
106
|
+
| 无参数 | 恢复当前项目目录的最新会话(不论哪个 CLI) |
|
|
107
|
+
| `[数字]` | 显示当前项目目录相关的最近 N 个会话摘要列表 |
|
|
108
|
+
| `[CLI名称]` | 显示对应 CLI 关于本项目目录相关的会话列表 |
|
|
109
|
+
| `[CLI名称] [数字]` | 显示对应 CLI 关于本项目目录相关的最近 N 个会话 |
|
|
110
|
+
| `--all` | 显示当前项目所有 CLI 的会话列表 |
|
|
111
|
+
| `--complete` | 显示所有 CLI 所有项目的会话分类列表 |
|
|
112
|
+
| `--help` | 显示帮助信息 |
|
|
113
|
+
|
|
114
|
+
## 配置要求
|
|
115
|
+
|
|
116
|
+
### 无需手动配置!
|
|
117
|
+
|
|
118
|
+
此工具**完全自动化**,采用两层配置策略:
|
|
119
|
+
|
|
120
|
+
### 策略 1: 优先使用 Stigmergy(如果已安装)
|
|
121
|
+
|
|
122
|
+
如果系统安装了 stigmergy 并且已配置:
|
|
123
|
+
- 自动读取 `~/.stigmergy/config.json`
|
|
124
|
+
- 使用 stigmergy 的扫描结果
|
|
125
|
+
- 提供最准确的 CLI 检测
|
|
126
|
+
- 支持自定义 CLI 路径和多个实例
|
|
127
|
+
|
|
128
|
+
### 策略 2: 自动检测(后备方案)
|
|
129
|
+
|
|
130
|
+
如果没有 stigmergy 或没有配置:
|
|
131
|
+
- 自动扫描常见 CLI 的会话存储位置
|
|
132
|
+
- 开箱即用,无需任何配置
|
|
133
|
+
- 支持多个候选路径
|
|
134
|
+
- 适用于大多数安装场景
|
|
135
|
+
|
|
136
|
+
### 自动扫描位置
|
|
137
|
+
|
|
138
|
+
工具会自动扫描以下位置(每个 CLI 扫描多个候选路径):
|
|
139
|
+
|
|
140
|
+
**Linux/Mac:**
|
|
141
|
+
- `~/.cli-name/projects/`
|
|
142
|
+
- `~/.config/cli-name/projects/`
|
|
143
|
+
|
|
144
|
+
**Windows:**
|
|
145
|
+
- `~/AppData/Roaming/cli-name/projects/`
|
|
146
|
+
|
|
147
|
+
### 支持的 CLI
|
|
148
|
+
|
|
149
|
+
工具自动检测以下 CLI 工具:
|
|
150
|
+
- Claude
|
|
151
|
+
- Gemini
|
|
152
|
+
- Qwen
|
|
153
|
+
- iFlow
|
|
154
|
+
- CodeBuddy
|
|
155
|
+
- Codex
|
|
156
|
+
- QoderCLI
|
|
157
|
+
- Kode
|
|
158
|
+
|
|
159
|
+
### 自定义安装
|
|
160
|
+
|
|
161
|
+
如果 CLI 安装在自定义位置:
|
|
162
|
+
- **有 stigmergy**: 在 stigmergy 中配置,获得最佳效果
|
|
163
|
+
- **无 stigmergy**: 工具自动扫描多个候选路径,找到第一个有效的位置
|
|
164
|
+
|
|
165
|
+
## 工作原理
|
|
166
|
+
|
|
167
|
+
1. **配置加载** - 优先从 stigmergy 获取配置,如果没有则使用自动检测
|
|
168
|
+
2. **会话扫描** - 扫描已检测到 CLI 的会话目录
|
|
169
|
+
3. **项目识别** - 通过当前工作目录和会话文件路径智能匹配相关项目
|
|
170
|
+
4. **会话排序** - 按修改时间排序会话,最新的排在前面
|
|
171
|
+
5. **内容提取** - 自动提取会话内容并生成摘要
|
|
172
|
+
6. **智能过滤** - 根据参数过滤和显示相应的会话
|
|
173
|
+
|
|
174
|
+
## 使用场景
|
|
175
|
+
|
|
176
|
+
### 场景 1: 快速恢复上次对话
|
|
177
|
+
|
|
178
|
+
你正在使用某个 CLI 工具开发项目,突然想恢复上次的对话内容:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# 在项目目录下执行
|
|
182
|
+
resume-session
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
工具会自动找到当前项目相关的最新会话并显示完整内容。
|
|
186
|
+
|
|
187
|
+
### 场景 2: 查看最近几次会话
|
|
188
|
+
|
|
189
|
+
你想查看最近几次的会话历史,选择要恢复的会话:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# 显示最近 5 次会话
|
|
193
|
+
resume-session 5
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### 场景 3: 查看特定 CLI 的会话
|
|
197
|
+
|
|
198
|
+
你只关心某个特定 CLI 的会话历史:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# 查看 iFlow 的所有会话
|
|
202
|
+
resume-session iflow
|
|
203
|
+
|
|
204
|
+
# 查看 Claude 的最近 3 次会话
|
|
205
|
+
resume-session claude 3
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### 场景 4: 查看项目的所有会话
|
|
209
|
+
|
|
210
|
+
你想查看当前项目所有 CLI 的会话历史:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
resume-session --all
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### 场景 5: 查看所有项目的会话
|
|
217
|
+
|
|
218
|
+
你想查看所有项目的所有会话:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
resume-session --complete
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 场景 6: 切换工作目录后恢复
|
|
225
|
+
|
|
226
|
+
你在不同的项目目录下工作,想快速恢复该项目的最新会话:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
cd ~/projects/my-app
|
|
230
|
+
resume-session
|
|
231
|
+
|
|
232
|
+
cd ~/projects/another-project
|
|
233
|
+
resume-session
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
工具会根据当前工作目录自动识别项目并显示对应的会话。
|
|
237
|
+
|
|
238
|
+
## 项目识别机制
|
|
239
|
+
|
|
240
|
+
工具使用以下策略识别当前项目的会话(按优先级):
|
|
241
|
+
|
|
242
|
+
1. **精确匹配**: 项目名称与当前目录名完全匹配
|
|
243
|
+
2. **路径包含**: 项目名称包含在当前工作目录路径中
|
|
244
|
+
3. **名称包含**: 当前目录名包含在项目名称中
|
|
245
|
+
4. **文件路径**: 会话文件路径包含当前工作目录路径
|
|
246
|
+
|
|
247
|
+
所有匹配都是大小写不敏感的。
|
|
248
|
+
|
|
249
|
+
## 输出格式
|
|
250
|
+
|
|
251
|
+
### 完整会话内容
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
================================================================================
|
|
255
|
+
会话来源: iFlow
|
|
256
|
+
项目: my-project
|
|
257
|
+
时间: 2026/1/13 14:30:25 (5分钟前)
|
|
258
|
+
会话ID: abc123
|
|
259
|
+
================================================================================
|
|
260
|
+
|
|
261
|
+
[User]: 请帮我创建一个 React 组件
|
|
262
|
+
[Assistant]: 好的,我来帮你创建一个 React 组件...
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
================================================================================
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### 会话列表
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
找到 5 个会话 (显示前 5 个):
|
|
272
|
+
================================================================================
|
|
273
|
+
|
|
274
|
+
[1] iFlow - my-project
|
|
275
|
+
时间: 2026/1/13 14:30:25 (5分钟前)
|
|
276
|
+
会话ID: abc123
|
|
277
|
+
摘要: [User]: 请帮我创建一个 React 组件 [Assistant]: 好的,我来帮你创建...
|
|
278
|
+
--------------------------------------------------------------------------------
|
|
279
|
+
|
|
280
|
+
[2] Claude - my-project
|
|
281
|
+
时间: 2026/1/13 12:15:10 (2小时前)
|
|
282
|
+
会话ID: def456
|
|
283
|
+
摘要: [User]: 如何优化这个函数? [Assistant]: 可以考虑使用缓存...
|
|
284
|
+
--------------------------------------------------------------------------------
|
|
285
|
+
...
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### 按 CLI 分组
|
|
289
|
+
|
|
290
|
+
```
|
|
291
|
+
================================================================================
|
|
292
|
+
会话列表(按 CLI 分组)
|
|
293
|
+
================================================================================
|
|
294
|
+
|
|
295
|
+
iFlow (2 个会话)
|
|
296
|
+
--------------------------------------------------------------------------------
|
|
297
|
+
[1] my-project - 2026/1/13 14:30:25 (5分钟前)
|
|
298
|
+
会话ID: abc123
|
|
299
|
+
[2] another-project - 2026/1/12 10:20:15 (1天前)
|
|
300
|
+
会话ID: xyz789
|
|
301
|
+
|
|
302
|
+
Claude (3 个会话)
|
|
303
|
+
--------------------------------------------------------------------------------
|
|
304
|
+
[1] my-project - 2026/1/13 12:15:10 (2小时前)
|
|
305
|
+
会话ID: def456
|
|
306
|
+
[2] test-project - 2026/1/11 16:45:30 (2天前)
|
|
307
|
+
会话ID: ghi012
|
|
308
|
+
[3] demo-project - 2026/1/10 09:30:00 (3天前)
|
|
309
|
+
会话ID: jkl345
|
|
310
|
+
|
|
311
|
+
================================================================================
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## 注意事项
|
|
315
|
+
|
|
316
|
+
1. **工作目录**: 建议在项目目录下使用工具,这样可以更准确地识别项目相关的会话
|
|
317
|
+
2. **会话格式**: 工具尝试自动提取会话内容,但不同 CLI 的会话格式可能不同
|
|
318
|
+
3. **权限问题**: 确保工具对 CLI 会话目录有读取权限
|
|
319
|
+
4. **项目匹配**: 如果项目名称与目录名不完全匹配,工具会尝试多种匹配策略
|
|
320
|
+
|
|
321
|
+
## 故障排查
|
|
322
|
+
|
|
323
|
+
### 问题: 未找到任何会话
|
|
324
|
+
|
|
325
|
+
**原因**: 可能是 CLI 工具还未创建会话,或者会话目录不存在
|
|
326
|
+
|
|
327
|
+
**解决**:
|
|
328
|
+
- 确保至少使用过一个 CLI 工具并创建了会话
|
|
329
|
+
- 检查 CLI 会话目录是否存在
|
|
330
|
+
- 使用 `--complete` 参数查看所有会话
|
|
331
|
+
- 工具会优先使用 stigmergy 配置,如果没有则自动扫描常见位置
|
|
332
|
+
|
|
333
|
+
### 问题: CLI 未被检测到
|
|
334
|
+
|
|
335
|
+
**原因**: CLI 可能安装在自定义位置,或尚未创建会话
|
|
336
|
+
|
|
337
|
+
**解决**:
|
|
338
|
+
- **有 stigmergy**: 在 stigmergy 中配置 CLI 路径
|
|
339
|
+
- **无 stigmergy**: 工具会自动扫描多个候选路径
|
|
340
|
+
- 确保 CLI 的会话目录可访问
|
|
341
|
+
- 检查 CLI 是否已创建任何会话
|
|
342
|
+
|
|
343
|
+
### 问题: 当前项目未找到相关会话
|
|
344
|
+
|
|
345
|
+
**原因**: 可能是当前工作目录不在任何已知项目中,或者项目名称匹配失败
|
|
346
|
+
|
|
347
|
+
**解决**:
|
|
348
|
+
- 确保在正确的项目目录下使用工具
|
|
349
|
+
- 使用 `--complete` 参数查看所有项目的会话
|
|
350
|
+
- 检查会话的项目名称是否与当前目录匹配
|
|
351
|
+
- 尝试使用项目目录的父目录运行工具
|
|
352
|
+
|
|
353
|
+
### 问题: 找到了错误的会话
|
|
354
|
+
|
|
355
|
+
**原因**: 项目名称匹配策略可能匹配到了其他相似的项目
|
|
356
|
+
|
|
357
|
+
**解决**:
|
|
358
|
+
- 使用 `--all` 查看所有匹配的会话
|
|
359
|
+
- 使用 CLI 名称参数过滤特定 CLI 的会话
|
|
360
|
+
- 检查项目名称是否与其他项目相似
|
|
361
|
+
|
|
362
|
+
### 问题: 无法读取会话内容
|
|
363
|
+
|
|
364
|
+
**原因**: 会话文件可能损坏或格式不支持
|
|
365
|
+
|
|
366
|
+
**解决**:
|
|
367
|
+
- 检查会话文件是否为有效的 JSON 格式
|
|
368
|
+
- 确认会话文件没有被其他程序锁定
|
|
369
|
+
- 检查文件权限
|
|
370
|
+
|
|
371
|
+
## 开发和贡献
|
|
372
|
+
|
|
373
|
+
欢迎提交 Issue 和 Pull Request!
|
|
374
|
+
|
|
375
|
+
## 许可证
|
|
376
|
+
|
|
377
|
+
MIT License
|
|
378
|
+
|
|
379
|
+
## 作者
|
|
380
|
+
|
|
381
|
+
stigmergy
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: resumesession
|
|
3
|
+
description: Cross-CLI session recovery and history management skill
|
|
4
|
+
author: stigmergy
|
|
5
|
+
version: 2.1.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# ResumeSession Skill
|
|
9
|
+
|
|
10
|
+
Cross-CLI session recovery and history management skill for all CLI tools.
|
|
11
|
+
|
|
12
|
+
## Description
|
|
13
|
+
|
|
14
|
+
This skill enables Claude CLI and other AI assistants to recover and manage sessions across different CLI tools. When users ask to "恢复上次对话" (recover last conversation) or "查看历史会话" (view session history), this skill provides intelligent project-based filtering and context recovery.
|
|
15
|
+
|
|
16
|
+
**Configuration**: CLI paths and detection are managed by stigmergy. The skill reads configuration from `~/.stigmergy/config.json`.
|
|
17
|
+
|
|
18
|
+
## When to Use This Skill
|
|
19
|
+
|
|
20
|
+
Use this skill when users request:
|
|
21
|
+
- 恢复上次对话 (recover last conversation)
|
|
22
|
+
- 查看历史会话 (view session history)
|
|
23
|
+
- 继续之前的讨论 (continue previous discussion)
|
|
24
|
+
- 找到之前的某个会话 (find a previous session)
|
|
25
|
+
- 查看某个 CLI 的会话 (view sessions from a specific CLI)
|
|
26
|
+
|
|
27
|
+
## How It Works
|
|
28
|
+
|
|
29
|
+
### 1. Identify User Intent
|
|
30
|
+
|
|
31
|
+
Analyze the user's request to determine:
|
|
32
|
+
- Whether they want to recover the latest session or browse multiple sessions
|
|
33
|
+
- Whether they want sessions from a specific CLI or all CLIs
|
|
34
|
+
- Whether they want sessions from current project or all projects
|
|
35
|
+
|
|
36
|
+
### 2. Execute Recovery Tool
|
|
37
|
+
|
|
38
|
+
Call the `independent-resume.js` script with appropriate parameters:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
// Default: recover latest session from current project
|
|
42
|
+
Bash("node independent-resume.js")
|
|
43
|
+
|
|
44
|
+
// Show 5 recent sessions from current project
|
|
45
|
+
Bash("node independent-resume.js 5")
|
|
46
|
+
|
|
47
|
+
// Show iFlow sessions from current project
|
|
48
|
+
Bash("node independent-resume.js iflow")
|
|
49
|
+
|
|
50
|
+
// Show all CLI sessions from current project
|
|
51
|
+
Bash("node independent-resume.js --all")
|
|
52
|
+
|
|
53
|
+
// Show all sessions from all projects
|
|
54
|
+
Bash("node independent-resume.js --complete")
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Analyze and Present Results
|
|
58
|
+
|
|
59
|
+
The tool returns session data in a structured format. Use LLM intelligence to:
|
|
60
|
+
- Summarize the session content
|
|
61
|
+
- Highlight key information
|
|
62
|
+
- Provide context for continuation
|
|
63
|
+
- Help user select the right session if multiple are shown
|
|
64
|
+
|
|
65
|
+
### 4. Continue Conversation
|
|
66
|
+
|
|
67
|
+
After displaying the session content, ask the user:
|
|
68
|
+
- "是否要继续这个会话?" (Do you want to continue this session?)
|
|
69
|
+
- "需要查看其他会话吗?" (Do you need to view other sessions?)
|
|
70
|
+
- "需要我帮你做什么?" (What would you like me to do?)
|
|
71
|
+
|
|
72
|
+
## Configuration
|
|
73
|
+
|
|
74
|
+
**No manual configuration required!** The tool automatically detects installed CLI tools using a two-tier strategy:
|
|
75
|
+
|
|
76
|
+
### Priority 1: Stigmergy Configuration (if available)
|
|
77
|
+
|
|
78
|
+
If stigmergy is installed and configured, the tool uses its CLI configuration:
|
|
79
|
+
- Reads from `~/.stigmergy/config.json`
|
|
80
|
+
- Uses stigmergy's scan results for CLI paths
|
|
81
|
+
- Supports custom CLI paths and multiple instances
|
|
82
|
+
- Provides the most accurate CLI detection
|
|
83
|
+
|
|
84
|
+
### Priority 2: Automatic Detection (fallback)
|
|
85
|
+
|
|
86
|
+
If stigmergy is not available or has no configuration, the tool automatically scans common installation locations:
|
|
87
|
+
- Scans multiple common paths for each CLI
|
|
88
|
+
- Supports both Linux/Mac and Windows paths
|
|
89
|
+
- Detects CLI tools without user intervention
|
|
90
|
+
- Works out of the box for most installations
|
|
91
|
+
|
|
92
|
+
**Scanned Locations** (for each CLI):
|
|
93
|
+
- `~/.cli-name/projects/` (Linux/Mac)
|
|
94
|
+
- `~/.config/cli-name/projects/` (Linux/Mac)
|
|
95
|
+
- `~/AppData/Roaming/cli-name/projects/` (Windows)
|
|
96
|
+
|
|
97
|
+
**Supported CLI Tools**:
|
|
98
|
+
- Claude
|
|
99
|
+
- Gemini
|
|
100
|
+
- Qwen
|
|
101
|
+
- iFlow
|
|
102
|
+
- CodeBuddy
|
|
103
|
+
- Codex
|
|
104
|
+
- QoderCLI
|
|
105
|
+
- Kode
|
|
106
|
+
|
|
107
|
+
**Custom Installation Support**:
|
|
108
|
+
If a CLI is installed in a custom location:
|
|
109
|
+
- With stigmergy: Configure in stigmergy for best results
|
|
110
|
+
- Without stigmergy: The tool scans multiple candidate paths automatically
|
|
111
|
+
|
|
112
|
+
## Usage Examples
|
|
113
|
+
|
|
114
|
+
### Example 1: Quick Recovery
|
|
115
|
+
|
|
116
|
+
**User**: "恢复上次对话"
|
|
117
|
+
|
|
118
|
+
**AI Response**:
|
|
119
|
+
1. Execute: `node independent-resume.js`
|
|
120
|
+
2. Display the latest session content
|
|
121
|
+
3. Ask: "已恢复上次对话。是否要继续?"
|
|
122
|
+
|
|
123
|
+
### Example 2: Browse Recent Sessions
|
|
124
|
+
|
|
125
|
+
**User**: "查看最近几次会话"
|
|
126
|
+
|
|
127
|
+
**AI Response**:
|
|
128
|
+
1. Execute: `node independent-resume.js 5`
|
|
129
|
+
2. Display the 5 most recent sessions with summaries
|
|
130
|
+
3. Ask: "找到了 5 个会话。你想继续哪个?"
|
|
131
|
+
|
|
132
|
+
### Example 3: Filter by CLI
|
|
133
|
+
|
|
134
|
+
**User**: "看看 iFlow 的会话"
|
|
135
|
+
|
|
136
|
+
**AI Response**:
|
|
137
|
+
1. Execute: `node independent-resume.js iflow`
|
|
138
|
+
2. Display all iFlow sessions from current project
|
|
139
|
+
3. Ask: "找到了 X 个 iFlow 会话。你想继续哪个?"
|
|
140
|
+
|
|
141
|
+
### Example 4: View All Projects
|
|
142
|
+
|
|
143
|
+
**User**: "查看所有项目的会话"
|
|
144
|
+
|
|
145
|
+
**AI Response**:
|
|
146
|
+
1. Execute: `node independent-resume.js --complete`
|
|
147
|
+
2. Display sessions grouped by project
|
|
148
|
+
3. Ask: "你想查看哪个项目的会话?"
|
|
149
|
+
|
|
150
|
+
## Features
|
|
151
|
+
|
|
152
|
+
- ✅ **Project-Aware**: Automatically filters sessions by current working directory
|
|
153
|
+
- ✅ **Default Context Recovery**: Shows latest session content by default
|
|
154
|
+
- ✅ **Number-Based Control**: Use numbers to show multiple sessions
|
|
155
|
+
- ✅ **CLI Filtering**: Filter sessions by specific CLI tool
|
|
156
|
+
- ✅ **All CLI View**: Show all CLI sessions for current project
|
|
157
|
+
- ✅ **Complete View**: Show all projects' sessions grouped by project
|
|
158
|
+
- ✅ **Cross-CLI Support**: Works with Claude, Gemini, Qwen, iFlow, CodeBuddy, Codex, QoderCLI, Kode
|
|
159
|
+
- ✅ **Smart Project Recognition**: Automatically matches sessions to current project
|
|
160
|
+
- ✅ **Relative Time Display**: Shows relative time (e.g., "5 minutes ago")
|
|
161
|
+
|
|
162
|
+
## Tool Parameters
|
|
163
|
+
|
|
164
|
+
| Parameter | Description |
|
|
165
|
+
|-----------|-------------|
|
|
166
|
+
| (none) | Recover latest session from current project |
|
|
167
|
+
| `[number]` | Show N most recent sessions from current project |
|
|
168
|
+
| `[cli-name]` | Show sessions from specific CLI (current project) |
|
|
169
|
+
| `[cli-name] [number]` | Show N sessions from specific CLI |
|
|
170
|
+
| `--all` | Show all CLI sessions from current project |
|
|
171
|
+
| `--complete` | Show all sessions from all projects |
|
|
172
|
+
|
|
173
|
+
## Supported CLIs
|
|
174
|
+
|
|
175
|
+
This skill supports any CLI tool that:
|
|
176
|
+
- Stores sessions in files (typically JSON)
|
|
177
|
+
- Can be configured in stigmergy
|
|
178
|
+
- Has extractable project and session information
|
|
179
|
+
|
|
180
|
+
**Common CLI Tools** (examples, not limited to):
|
|
181
|
+
- Claude
|
|
182
|
+
- Gemini
|
|
183
|
+
- Qwen
|
|
184
|
+
- iFlow
|
|
185
|
+
- CodeBuddy
|
|
186
|
+
- Codex
|
|
187
|
+
- QoderCLI
|
|
188
|
+
- Kode
|
|
189
|
+
|
|
190
|
+
**Custom CLI Support**:
|
|
191
|
+
- Add any CLI to stigmergy configuration
|
|
192
|
+
- Support multiple instances of the same CLI
|
|
193
|
+
- Support custom installation paths
|
|
194
|
+
- Support custom session formats
|
|
195
|
+
|
|
196
|
+
## Notes
|
|
197
|
+
|
|
198
|
+
**Configuration Strategy**:
|
|
199
|
+
- **Priority 1**: Uses stigmergy configuration if available (most accurate)
|
|
200
|
+
- **Priority 2**: Falls back to automatic detection (works out of the box)
|
|
201
|
+
- No manual configuration required in either case
|
|
202
|
+
- Seamlessly switches between strategies based on environment
|
|
203
|
+
|
|
204
|
+
**Context Loading**: When recovering a session, load the conversation history as context for the LLM to understand the previous discussion.
|
|
205
|
+
|
|
206
|
+
**Project Awareness**: The tool automatically identifies the current project based on the working directory. Ensure users are in the correct project directory.
|
|
207
|
+
|
|
208
|
+
**Error Handling**:
|
|
209
|
+
- If no sessions are found, inform the user and suggest they check if CLI tools have created sessions
|
|
210
|
+
- The tool automatically detects installed CLI tools (with or without stigmergy)
|
|
211
|
+
- If CLI is installed in a custom location, ensure the session directory is accessible
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "resumesession",
|
|
3
|
+
"displayName": "ResumeSession",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"description": "Cross-CLI session recovery and history management with project-aware filtering",
|
|
6
|
+
"capabilities": [
|
|
7
|
+
"Recover latest session from current project",
|
|
8
|
+
"Check session content and skip empty sessions",
|
|
9
|
+
"Show multiple sessions from current project",
|
|
10
|
+
"Filter sessions by specific CLI",
|
|
11
|
+
"Search sessions by content keywords",
|
|
12
|
+
"Filter sessions by date range (today, week, month)",
|
|
13
|
+
"Show sessions from all projects with --all flag",
|
|
14
|
+
"Multiple view formats: summary, timeline, detailed, context",
|
|
15
|
+
"Cross-CLI support: Claude, Gemini, Qwen, iFlow, CodeBuddy, Codex, QoderCLI, Kode"
|
|
16
|
+
],
|
|
17
|
+
"protocols": ["chinese", "english"],
|
|
18
|
+
"hooks": [],
|
|
19
|
+
"enabled": true,
|
|
20
|
+
"category": "session-management",
|
|
21
|
+
"author": "stigmergy",
|
|
22
|
+
"dependencies": [],
|
|
23
|
+
"implementations": [
|
|
24
|
+
{
|
|
25
|
+
"name": "stigmergy-resume",
|
|
26
|
+
"version": "2.0.0",
|
|
27
|
+
"language": "javascript",
|
|
28
|
+
"description": "Project-aware session recovery tool",
|
|
29
|
+
"runtime": "node",
|
|
30
|
+
"entry_point": "src/cli/commands/stigmergy-resume.js"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "simple-resume",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Simple cross-CLI session recovery tool",
|
|
5
|
+
"language": "javascript",
|
|
6
|
+
"runtime": "node",
|
|
7
|
+
"entry_point": "src/cli/commands/simple-resume.js",
|
|
8
|
+
"metadata": {
|
|
9
|
+
"cli_type": "cross-cli",
|
|
10
|
+
"session_scope": "all",
|
|
11
|
+
"output_format": "full"
|
|
12
|
+
}
|
|
13
|
+
}
|