@songsid/agend 2.0.8-beta.3 → 2.0.8-beta.4

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: session-management
3
- description: Save/load/fork sessions, batch backup, reviewer session setup, kiro-cli session paths
3
+ description: Save/load/fork sessions, batch backup, reviewer session setup, kiro-cli and claude-code session paths
4
4
  ---
5
5
 
6
6
  ## kiro-cli Session Storage
@@ -52,6 +52,61 @@ Steps:
52
52
  - `execute_bash`: `tmux send-keys -t agend:<new-instance-name> '/chat load YYYYMMDD.json' Enter`
53
53
  - Or configure `pre_task_command: "/chat load YYYYMMDD.json"` for auto-load on restart
54
54
 
55
+ ## Claude Code Session Storage & Fork
56
+
57
+ claude-code stores conversation sessions as JSONL, **keyed by the project (working) directory**:
58
+ - **Path:** `~/.claude/projects/<project-path-encoded>/*.jsonl`
59
+ - `<project-path-encoded>` is the absolute working_directory with `/` replaced by `-`
60
+ (e.g. `/home/han/Projects/AgEnD` → `-home-han-Projects-AgEnD`)
61
+ - Each `.jsonl` is one session (full message history). Latest = most recently modified.
62
+
63
+ **Key difference from kiro-cli:** claude-code has **no `/chat save` / `/chat load`**. You resume
64
+ only via `--continue` (latest session for this dir) or `--resume <id>`. `/export` produces
65
+ plain text only — it **cannot** be reloaded as a session. So forking is done by **copying the
66
+ `.jsonl` file**, not by save/load commands.
67
+
68
+ ### Fork a claude-code session to a new instance
69
+
70
+ 1. **Confirm source instance is idle** — `tmux capture-pane -t agend:<source> -p | tail -5`
71
+ (look for the ready prompt, e.g. `❯`). Don't fork mid-task.
72
+
73
+ 2. **Find the source session file** (newest first):
74
+ ```bash
75
+ ls -lt ~/.claude/projects/<source-path-encoded>/*.jsonl | head -5
76
+ ```
77
+
78
+ 3. **Create the new instance** with `create_instance` (backend: `claude-code`). Note its
79
+ `working_directory` — it determines the target project path.
80
+
81
+ 4. **Copy the `.jsonl` into the new instance's encoded project dir:**
82
+ ```bash
83
+ TARGET_ENC="$(echo '<target-working-dir>' | sed 's#/#-#g')"
84
+ mkdir -p ~/.claude/projects/$TARGET_ENC
85
+ cp ~/.claude/projects/<source-path-encoded>/<session>.jsonl \
86
+ ~/.claude/projects/$TARGET_ENC/
87
+ ```
88
+
89
+ 5. **Start/restart the new instance** — the claude-code backend resumes via `--continue`
90
+ (it auto-picks the latest session for that project dir), so the copied session is continued.
91
+
92
+ ### Caveats
93
+ - **Same project path required:** a session can only resume under the working_directory it
94
+ was recorded in. If the target dir differs, claude-code still loads it via `--continue`
95
+ (it reads the newest `.jsonl` in the target's encoded dir), but file paths/context inside
96
+ the transcript will refer to the original dir.
97
+ - `/export` = text only, not reloadable. Use the raw `.jsonl`.
98
+ - Pick the **right** `.jsonl` if multiple exist (sort by mtime; each branch/compaction can
99
+ create new files).
100
+
101
+ ### kiro-cli vs claude-code fork (summary)
102
+ | | kiro-cli | claude-code |
103
+ |---|---|---|
104
+ | Store | `~/.kiro/sessions/cli/<uuid>.json` | `~/.claude/projects/<path-encoded>/*.jsonl` |
105
+ | Keyed by | session uuid | project (working) directory |
106
+ | Fork method | `/chat save` → copy → `/chat load` | copy `.jsonl` → `--continue` |
107
+ | Reload command | `/chat load <file>` | none — `--continue` / `--resume` only |
108
+ | Text export | — | `/export` (not reloadable) |
109
+
55
110
  ## Batch Session Backup
56
111
 
57
112
  Save all instances' sessions to a dated backup directory:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songsid/agend",
3
- "version": "2.0.8-beta.3",
3
+ "version": "2.0.8-beta.4",
4
4
  "description": "Multi-agent fleet daemon — run any coding CLI (Claude, Gemini, Codex, OpenCode) from Telegram",
5
5
  "type": "module",
6
6
  "bin": {