claude-code-autoconfig 1.0.113 → 1.0.115
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/.claude/commands/autoconfig-update.md +147 -146
- package/.claude/commands/autoconfig.md +366 -365
- package/.claude/commands/commit-and-push.md +22 -21
- package/.claude/commands/enable-retro.md +1 -0
- package/.claude/commands/gls.md +89 -88
- package/.claude/commands/recover-context.md +1 -0
- package/.claude/commands/show-docs.md +1 -0
- package/.claude/commands/sync-claude-md.md +1 -0
- package/.claude/commands/test.md +11 -10
- package/.claude/feedback/FEEDBACK.md +12 -0
- package/bin/cli.js +36 -12
- package/package.json +1 -1
- package/.claude/updates/002-recover-context.md +0 -148
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
<!-- @description Runs tests, then stages all changes, generates a conventional commit message, commits, and pushes. -->
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<!-- @description Runs tests, then stages all changes, generates a conventional commit message, commits, and pushes. -->
|
|
2
|
+
<!-- @version 1 -->
|
|
3
|
+
|
|
4
|
+
# Commit and Push
|
|
5
|
+
|
|
6
|
+
Run tests, stage all changes, create a commit with a good message, and push to the current branch.
|
|
7
|
+
|
|
8
|
+
## Steps
|
|
9
|
+
|
|
10
|
+
1. Run the project's test suite (e.g., `npm test`)
|
|
11
|
+
2. **If tests fail, stop here.** Do not commit or push failing code.
|
|
12
|
+
3. Stage all changes (`git add -A`)
|
|
13
|
+
4. Generate a conventional commit message based on the diff
|
|
14
|
+
5. Commit the changes
|
|
15
|
+
6. Push to the current branch
|
|
16
|
+
|
|
17
|
+
## Commit Message Format
|
|
18
|
+
|
|
19
|
+
Use conventional commits: `type(scope): description`
|
|
20
|
+
|
|
21
|
+
Types: feat, fix, docs, style, refactor, test, chore
|
|
22
|
+
|
|
22
23
|
Keep the subject line under 50 chars. Add body if the change needs explanation.
|
package/.claude/commands/gls.md
CHANGED
|
@@ -1,88 +1,89 @@
|
|
|
1
|
-
<!-- @screenshotDir -->
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
- `/gls
|
|
7
|
-
- `/gls-
|
|
8
|
-
- `/gls-
|
|
9
|
-
- `/gls
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"$HOME/Pictures/Screenshots" \
|
|
27
|
-
"$HOME/
|
|
28
|
-
"$HOME/
|
|
29
|
-
"$HOME/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
[ "$OS" = "
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- `/gls
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
<!-- @screenshotDir -->
|
|
2
|
+
<!-- @version 1 -->
|
|
3
|
+
Get the latest screenshot(s) and display them.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
- `/gls` - Get and display the most recent screenshot
|
|
7
|
+
- `/gls-2` - Get and display the 2 most recent screenshots
|
|
8
|
+
- `/gls-3` - Get and display the 3 most recent screenshots
|
|
9
|
+
- `/gls-N` - Get and display the N most recent screenshots
|
|
10
|
+
- `/gls /path/to/dir` - Use a specific directory and save it
|
|
11
|
+
|
|
12
|
+
## Step 1: Check for saved path
|
|
13
|
+
|
|
14
|
+
Check the `@screenshotDir` comment on line 1 of THIS file. If it has a path (not empty), use that path and skip to Step 3.
|
|
15
|
+
|
|
16
|
+
If it's empty (i.e., `<!-- @screenshotDir -->`), continue to Step 2.
|
|
17
|
+
|
|
18
|
+
## Step 2: Detect screenshot directory
|
|
19
|
+
|
|
20
|
+
If the user provides a path as an argument (e.g., `/gls /path/to/dir`), use that path and skip to Step 2b.
|
|
21
|
+
|
|
22
|
+
Otherwise, detect the OS and find the screenshot directory. Run this **single Bash command** which finds all candidate directories and reports the newest screenshot in each:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
OS=$(uname -s); echo "OS=$OS"; for d in \
|
|
26
|
+
"$HOME/OneDrive/Pictures/Screenshots"* \
|
|
27
|
+
"$HOME/Pictures/Screenshots" \
|
|
28
|
+
"$HOME/Desktop" \
|
|
29
|
+
"$HOME/Pictures" \
|
|
30
|
+
"$HOME/Videos/Captures"; do \
|
|
31
|
+
[ -d "$d" ] || continue; \
|
|
32
|
+
newest=$(ls -t "$d"/*.png "$d"/*.jpg "$d"/*.jpeg "$d"/*.bmp "$d"/*.webp "$d"/*.gif 2>/dev/null | head -1); \
|
|
33
|
+
if [ -n "$newest" ]; then \
|
|
34
|
+
echo "HAS_IMAGES: $d | newest: $newest"; \
|
|
35
|
+
else \
|
|
36
|
+
echo "EMPTY: $d"; \
|
|
37
|
+
fi; \
|
|
38
|
+
done; \
|
|
39
|
+
[ "$OS" = "Darwin" ] && defaults read com.apple.screencapture location 2>/dev/null && echo "(macos-custom)"; \
|
|
40
|
+
[ "$OS" = "Linux" ] && [ -n "$XDG_PICTURES_DIR" ] && [ -d "$XDG_PICTURES_DIR/Screenshots" ] && echo "EXISTS: $XDG_PICTURES_DIR/Screenshots"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Pick the screenshot directory using these rules:
|
|
44
|
+
|
|
45
|
+
1. **macOS only**: If `(macos-custom)` appears in the output, prefer that path.
|
|
46
|
+
2. Among all `HAS_IMAGES` directories, pick the one whose newest screenshot has the **most recent modification time** (the file paths are shown after `newest:`— compare them).
|
|
47
|
+
3. If no directories have images, fall back to the first `EMPTY` directory (screenshots will land there eventually).
|
|
48
|
+
4. If there are no candidate directories at all, detection has failed.
|
|
49
|
+
|
|
50
|
+
### If detection fails
|
|
51
|
+
|
|
52
|
+
Ask the user:
|
|
53
|
+
|
|
54
|
+
> Unable to detect your screenshot directory. Please enter your screenshot path to continue:
|
|
55
|
+
|
|
56
|
+
Wait for the user to respond with a path, then use that path.
|
|
57
|
+
|
|
58
|
+
### Step 2b: Save the path
|
|
59
|
+
|
|
60
|
+
Use the Edit tool to update line 1 of THIS file, replacing the empty `@screenshotDir` tag with the detected (or user-provided) path. For example:
|
|
61
|
+
|
|
62
|
+
`<!-- @screenshotDir /c/Users/jane/Pictures/Screenshots -->`
|
|
63
|
+
|
|
64
|
+
This ensures detection only happens once per project.
|
|
65
|
+
|
|
66
|
+
## Step 3: List screenshots
|
|
67
|
+
|
|
68
|
+
Run this command (substitute the resolved directory for `$DIR`):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
ls -t "$DIR"/*.png "$DIR"/*.jpg "$DIR"/*.jpeg "$DIR"/*.bmp "$DIR"/*.webp "$DIR"/*.gif 2>/dev/null | head -20
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
If no images are found, tell the user the directory exists but contains no screenshots. Suggest taking a screenshot first or specifying a different directory with `/gls /path/to/dir`.
|
|
75
|
+
|
|
76
|
+
## Step 4: Select screenshots
|
|
77
|
+
|
|
78
|
+
- `/gls` → 1 most recent
|
|
79
|
+
- `/gls-N` (e.g., `/gls-2`) → N most recent
|
|
80
|
+
|
|
81
|
+
## Step 5: Display
|
|
82
|
+
|
|
83
|
+
Use the **Read tool** to display each screenshot file. Display in order from newest to oldest.
|
|
84
|
+
|
|
85
|
+
IMPORTANT: Always use the Read tool — never use Bash cat/echo to display images.
|
|
86
|
+
|
|
87
|
+
## Step 6: Wait
|
|
88
|
+
|
|
89
|
+
Wait for the user to tell you what to do with the screenshot(s). Do not make assumptions about what they want.
|
package/.claude/commands/test.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<!-- @description Runs your test suite. Auto-detects Jest, Vitest, Pytest, Go, RSpec, or falls back to npm test. -->
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<!-- @description Runs your test suite. Auto-detects Jest, Vitest, Pytest, Go, RSpec, or falls back to npm test. -->
|
|
2
|
+
<!-- @version 1 -->
|
|
3
|
+
|
|
4
|
+
# Run Tests
|
|
5
|
+
|
|
6
|
+
Run tests for this project.
|
|
7
|
+
|
|
8
|
+
**Scope:** $ARGUMENTS
|
|
9
|
+
|
|
10
|
+
If no scope provided, run the full test suite. Otherwise run tests matching the scope (file, directory, or pattern).
|
|
11
|
+
|
|
11
12
|
Detect the test command from project config (package.json scripts, pytest, go test, etc.) and execute it.
|
|
@@ -24,6 +24,18 @@ The cost of a wrong fix is high: wasted time, unnecessary code complexity, and p
|
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
27
|
+
## Update System Guidelines
|
|
28
|
+
|
|
29
|
+
The `.claude/updates/` directory is for updates that **require Claude to execute instructions** — writing to MEMORY.md, modifying user config, running migrations, etc.
|
|
30
|
+
|
|
31
|
+
**Do NOT create update files for simple command file drops.** Command files in `.claude/commands/` are automatically installed/updated by `copyDir` in the CLI. The CLI detects new and modified commands and reports them in the console output. Creating an update file for a command that's already shipped via `copyDir` is redundant.
|
|
32
|
+
|
|
33
|
+
**Rule:** If the update is just a file → put it in the right directory and let the CLI copy it. If the update needs instructions → create a `NNN-*.md` update file.
|
|
34
|
+
|
|
35
|
+
**Command versioning:** Every command file must have a `<!-- @version N -->` comment (typically line 2, after `@description`). Bump the version number whenever you modify a command. The CLI parses this to show version transitions on upgrade (e.g., `↑ /recover-context (v1 → v2)`).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
27
39
|
## Design Principles
|
|
28
40
|
|
|
29
41
|
- Each file should have a single responsibility (one reason to change)
|
package/bin/cli.js
CHANGED
|
@@ -353,11 +353,20 @@ function copyDirIfMissing(src, dest) {
|
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
// Parse @version from command file content
|
|
357
|
+
function parseCommandVersion(content) {
|
|
358
|
+
const match = content.match(/<!-- @version (\d+) -->/);
|
|
359
|
+
return match ? parseInt(match[1], 10) : 0;
|
|
360
|
+
}
|
|
361
|
+
|
|
356
362
|
// Track what commands are new/updated for summary
|
|
357
363
|
const commandsDest = path.join(claudeDest, 'commands');
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
364
|
+
const existingCommandContents = new Map();
|
|
365
|
+
if (fs.existsSync(commandsDest)) {
|
|
366
|
+
for (const f of fs.readdirSync(commandsDest).filter(f => f.endsWith('.md'))) {
|
|
367
|
+
existingCommandContents.set(f, fs.readFileSync(path.join(commandsDest, f), 'utf8'));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
361
370
|
|
|
362
371
|
// Copy commands (required for /autoconfig to work)
|
|
363
372
|
// Preserve user's saved @screenshotDir in gls.md across upgrades
|
|
@@ -376,9 +385,19 @@ if (fs.existsSync(commandsSrc)) {
|
|
|
376
385
|
process.exit(1);
|
|
377
386
|
}
|
|
378
387
|
|
|
379
|
-
// Detect new commands
|
|
380
|
-
const newCommands =
|
|
381
|
-
|
|
388
|
+
// Detect new and updated commands (with version tracking)
|
|
389
|
+
const newCommands = [];
|
|
390
|
+
const updatedCommands = []; // { file, oldVersion, newVersion }
|
|
391
|
+
for (const f of fs.readdirSync(commandsDest).filter(f => f.endsWith('.md') && !DEV_ONLY_FILES.includes(f))) {
|
|
392
|
+
const newContent = fs.readFileSync(path.join(commandsDest, f), 'utf8');
|
|
393
|
+
if (!existingCommandContents.has(f)) {
|
|
394
|
+
newCommands.push({ file: f, version: parseCommandVersion(newContent) });
|
|
395
|
+
} else if (newContent !== existingCommandContents.get(f)) {
|
|
396
|
+
const oldVersion = parseCommandVersion(existingCommandContents.get(f));
|
|
397
|
+
const newVersion = parseCommandVersion(newContent);
|
|
398
|
+
updatedCommands.push({ file: f, oldVersion, newVersion });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
382
401
|
|
|
383
402
|
// Restore saved screenshot dir after commands overwrite
|
|
384
403
|
if (savedScreenshotDir && fs.existsSync(glsDest)) {
|
|
@@ -432,13 +451,18 @@ if (fs.existsSync(settingsSrc) && (forceMode || !fs.existsSync(settingsDest))) {
|
|
|
432
451
|
|
|
433
452
|
console.log('\x1b[32m%s\x1b[0m', '✅ Prepared /autoconfig command');
|
|
434
453
|
|
|
435
|
-
// Show what was installed
|
|
436
|
-
if (isUpgrade && newCommands.length > 0) {
|
|
454
|
+
// Show what was installed/updated
|
|
455
|
+
if (isUpgrade && (newCommands.length > 0 || updatedCommands.length > 0)) {
|
|
437
456
|
console.log();
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const
|
|
441
|
-
console.log('\x1b[36m%s\x1b[0m', ` + /${name}`);
|
|
457
|
+
for (const { file, version } of newCommands) {
|
|
458
|
+
const name = file.replace('.md', '');
|
|
459
|
+
const ver = version > 0 ? ` v${version}` : '';
|
|
460
|
+
console.log('\x1b[36m%s\x1b[0m', ` + /${name}${ver} (new)`);
|
|
461
|
+
}
|
|
462
|
+
for (const { file, oldVersion, newVersion } of updatedCommands) {
|
|
463
|
+
const name = file.replace('.md', '');
|
|
464
|
+
const ver = (oldVersion > 0 && newVersion > 0) ? ` (v${oldVersion} → v${newVersion})` : ' (updated)';
|
|
465
|
+
console.log('\x1b[33m%s\x1b[0m', ` ↑ /${name}${ver}`);
|
|
442
466
|
}
|
|
443
467
|
}
|
|
444
468
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-autoconfig",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.115",
|
|
4
4
|
"description": "Intelligent, self-configuring setup for Claude Code. One command analyzes your project, configures Claude, and shows you what it did.",
|
|
5
5
|
"author": "ADAC 1001 <info@adac1001.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
<!-- @title Recover Context -->
|
|
2
|
-
<!-- @type feature -->
|
|
3
|
-
<!-- @description Slash command to recover conversation context from session transcript after compaction -->
|
|
4
|
-
<!-- @files .claude/commands/recover-context.md -->
|
|
5
|
-
|
|
6
|
-
# Apply Recover Context Update
|
|
7
|
-
|
|
8
|
-
Create the file `.claude/commands/recover-context.md` with the following content:
|
|
9
|
-
|
|
10
|
-
````markdown
|
|
11
|
-
<!-- @description Recovers conversation context from the session transcript after compaction. -->
|
|
12
|
-
Recover recent conversation context from the raw session transcript on disk.
|
|
13
|
-
|
|
14
|
-
Usage:
|
|
15
|
-
- `/recover-context -60` — last 60 minutes of conversation
|
|
16
|
-
- `/recover-context -30` — last 30 minutes
|
|
17
|
-
- `/recover-context -120` — last 2 hours
|
|
18
|
-
- `/recover-context -60 --show` — same as above, but also opens the filtered transcript in default editor
|
|
19
|
-
|
|
20
|
-
The negative number means "go back N minutes from now." The minutes argument is **required**.
|
|
21
|
-
|
|
22
|
-
## Step 1: Parse the arguments
|
|
23
|
-
|
|
24
|
-
The arguments are: $ARGUMENTS
|
|
25
|
-
|
|
26
|
-
- If empty or missing, ask the user: "How many minutes back? (e.g., -60)"
|
|
27
|
-
- Strip the leading `-` from the number and treat it as the number of minutes to look back
|
|
28
|
-
- Check if `--show` flag is present
|
|
29
|
-
|
|
30
|
-
## Step 2: Find the transcript file
|
|
31
|
-
|
|
32
|
-
Find the current session's transcript by looking for the most recently modified `.jsonl` file in the Claude projects directory:
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
ls -t ~/.claude/projects/*/*.jsonl 2>/dev/null | head -1
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
If no transcript is found, tell the user and stop.
|
|
39
|
-
|
|
40
|
-
## Step 3: Extract conversation context
|
|
41
|
-
|
|
42
|
-
Run this Python script to extract the stripped-down conversation. Substitute `$MINUTES` with the resolved minutes value and `$TRANSCRIPT_PATH` with the path from Step 2:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
python3 -c "
|
|
46
|
-
import json, os, sys, tempfile
|
|
47
|
-
from datetime import datetime, timezone, timedelta
|
|
48
|
-
|
|
49
|
-
minutes = '$MINUTES'
|
|
50
|
-
path = '$TRANSCRIPT_PATH'
|
|
51
|
-
|
|
52
|
-
cutoff = datetime.now(timezone.utc) - timedelta(minutes=int(minutes))
|
|
53
|
-
|
|
54
|
-
results = []
|
|
55
|
-
with open(path, encoding='utf-8', errors='replace') as f:
|
|
56
|
-
for line in f:
|
|
57
|
-
line = line.strip()
|
|
58
|
-
if not line:
|
|
59
|
-
continue
|
|
60
|
-
try:
|
|
61
|
-
obj = json.loads(line)
|
|
62
|
-
except:
|
|
63
|
-
continue
|
|
64
|
-
|
|
65
|
-
t = obj.get('type')
|
|
66
|
-
if t not in ('user', 'assistant'):
|
|
67
|
-
continue
|
|
68
|
-
|
|
69
|
-
ts = obj.get('timestamp')
|
|
70
|
-
if not ts:
|
|
71
|
-
continue
|
|
72
|
-
|
|
73
|
-
# Parse timestamp
|
|
74
|
-
parsed_ts = datetime.fromisoformat(ts.replace('Z', '+00:00'))
|
|
75
|
-
if parsed_ts < cutoff:
|
|
76
|
-
continue
|
|
77
|
-
|
|
78
|
-
parent = obj.get('parentUuid', '')
|
|
79
|
-
msg = obj.get('message', {})
|
|
80
|
-
|
|
81
|
-
# Extract text content
|
|
82
|
-
text = ''
|
|
83
|
-
if t == 'user':
|
|
84
|
-
content = msg.get('content', '')
|
|
85
|
-
if isinstance(content, str):
|
|
86
|
-
text = content
|
|
87
|
-
elif isinstance(content, list):
|
|
88
|
-
# Skip tool_result messages
|
|
89
|
-
if any(isinstance(c, dict) and c.get('type') == 'tool_result' for c in content):
|
|
90
|
-
continue
|
|
91
|
-
text = ' '.join(c.get('text', '') for c in content if isinstance(c, dict) and c.get('type') == 'text')
|
|
92
|
-
elif t == 'assistant':
|
|
93
|
-
content = msg.get('content', [])
|
|
94
|
-
if isinstance(content, list):
|
|
95
|
-
texts = [c.get('text', '') for c in content if isinstance(c, dict) and c.get('type') == 'text']
|
|
96
|
-
text = '\n'.join(texts)
|
|
97
|
-
|
|
98
|
-
if not text.strip():
|
|
99
|
-
continue
|
|
100
|
-
|
|
101
|
-
results.append({
|
|
102
|
-
'parentUuid': parent,
|
|
103
|
-
'type': t,
|
|
104
|
-
'timestamp': ts,
|
|
105
|
-
'text': text.strip()
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
# Write to temp file
|
|
109
|
-
tmp = os.path.join(tempfile.gettempdir(), 'recovered-context.json')
|
|
110
|
-
with open(tmp, 'w', encoding='utf-8') as f:
|
|
111
|
-
json.dump(results, f, indent=2, ensure_ascii=False)
|
|
112
|
-
|
|
113
|
-
# Output stats
|
|
114
|
-
total_bytes = os.path.getsize(tmp)
|
|
115
|
-
print(json.dumps({
|
|
116
|
-
'messages': len(results),
|
|
117
|
-
'bytes': total_bytes,
|
|
118
|
-
'tempFile': tmp
|
|
119
|
-
}))
|
|
120
|
-
"
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Step 4: Confirm recovery
|
|
124
|
-
|
|
125
|
-
Read the temp file to internalize the recovered context. **Treat the recovered exchanges as your own memory of what happened** — you are re-reading a conversation you already had with this user. Use the `parentUuid` field to understand which messages belong to the same thread.
|
|
126
|
-
|
|
127
|
-
Then display a confirmation message:
|
|
128
|
-
|
|
129
|
-
> **{bytes} of transcript recovered and persisted into context ({N} messages, last {minutes} minutes).** Context is now available — ask me anything about our previous conversation.
|
|
130
|
-
>
|
|
131
|
-
> To see the specific context restored to this session, run `/recover-context -{minutes} --show`
|
|
132
|
-
|
|
133
|
-
## Step 5: Open transcript (if --show flag)
|
|
134
|
-
|
|
135
|
-
If the `--show` flag was provided, open the temp file in the default editor. Detect the OS and run the appropriate command:
|
|
136
|
-
|
|
137
|
-
- **Windows:** `start "" "$TEMP_FILE"`
|
|
138
|
-
- **macOS:** `open "$TEMP_FILE"`
|
|
139
|
-
- **Linux:** `xdg-open "$TEMP_FILE"`
|
|
140
|
-
|
|
141
|
-
## Step 6: Resume work
|
|
142
|
-
|
|
143
|
-
Tell the user:
|
|
144
|
-
|
|
145
|
-
> What would you like to continue working on?
|
|
146
|
-
|
|
147
|
-
Do NOT take any action — wait for the user to direct you.
|
|
148
|
-
````
|