@enruana/claude-orka 0.4.2 → 0.4.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.
Files changed (2) hide show
  1. package/README.md +1608 -103
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,13 +7,14 @@
7
7
 
8
8
  ## What is Claude-Orka?
9
9
 
10
- Claude-Orka is a powerful SDK and CLI tool that enables you to:
10
+ Claude-Orka is a powerful SDK, CLI, and UI tool that enables you to:
11
11
 
12
12
  - 🎯 **Orchestrate multiple Claude Code sessions** using tmux
13
- - 🌿 **Create conversation forks** to explore different approaches
13
+ - 🌿 **Create conversation forks** to explore different approaches in parallel
14
14
  - 🔀 **Merge forks back to main** with context preservation
15
- - 💾 **Save and resume sessions** with full context
16
- - 📊 **Manage session state** across your projects
15
+ - 💾 **Save and resume sessions** with full conversation history
16
+ - 📊 **Visualize session hierarchy** in an interactive Electron UI
17
+ - 🔄 **Automatic recovery** from system restarts and crashes
17
18
 
18
19
  Perfect for complex development workflows where you need to explore multiple solutions in parallel!
19
20
 
@@ -25,29 +26,39 @@ npm install -g @enruana/claude-orka
25
26
 
26
27
  ## Prerequisites
27
28
 
28
- - Node.js >= 18.0.0
29
- - [tmux](https://github.com/tmux/tmux) - Terminal multiplexer
30
- - [Claude CLI](https://claude.ai/download) - Claude Code CLI
29
+ - **Node.js** >= 18.0.0
30
+ - **tmux** - Terminal multiplexer
31
+ - **Claude CLI** - Claude Code CLI
31
32
 
32
- **Quick setup (automatic):**
33
+ ### Quick Setup (Automatic)
33
34
 
34
35
  ```bash
35
- # Install dependencies automatically
36
+ # Install all dependencies automatically
36
37
  orka prepare
37
38
 
38
39
  # Verify installation
39
40
  orka doctor
40
41
  ```
41
42
 
42
- **Manual setup:**
43
- - macOS: `brew install tmux`
44
- - Ubuntu: `sudo apt-get install tmux`
45
- - Claude CLI: Download from [claude.ai](https://claude.ai/download)
43
+ ### Manual Setup
44
+
45
+ **macOS:**
46
+ ```bash
47
+ brew install tmux
48
+ ```
49
+
50
+ **Ubuntu/Debian:**
51
+ ```bash
52
+ sudo apt-get install tmux
53
+ ```
54
+
55
+ **Claude CLI:**
56
+ Download from [claude.ai/download](https://claude.ai/download)
46
57
 
47
58
  ## Quick Start
48
59
 
49
60
  ```bash
50
- # 1. Install dependencies (if needed)
61
+ # 1. Install dependencies
51
62
  orka prepare
52
63
 
53
64
  # 2. Initialize in your project
@@ -55,17 +66,33 @@ orka init
55
66
 
56
67
  # 3. Create a new session
57
68
  orka session create "Implement Feature X"
69
+ # → Opens Claude Code in tmux
70
+ # → Opens Electron UI for visual management
58
71
 
59
72
  # 4. Create a fork to explore an alternative
60
73
  orka fork create <session-id> "Try Alternative Approach"
61
74
 
62
- # 5. When done, merge the fork back to main
75
+ # 5. Export and merge the fork back to main
63
76
  orka merge auto <session-id> <fork-id>
64
77
 
65
78
  # 6. Check project status
66
79
  orka status
67
80
  ```
68
81
 
82
+ ---
83
+
84
+ ## Table of Contents
85
+
86
+ - [Features](#features)
87
+ - [CLI Reference](#cli-reference)
88
+ - [SDK API Reference](#sdk-api-reference)
89
+ - [Electron UI Guide](#electron-ui-guide)
90
+ - [Examples](#examples)
91
+ - [Architecture](#architecture)
92
+ - [Troubleshooting](#troubleshooting)
93
+
94
+ ---
95
+
69
96
  ## Features
70
97
 
71
98
  ### 🎯 Session Management
@@ -83,6 +110,7 @@ orka status
83
110
  - Generate summaries of fork explorations
84
111
  - Merge learnings back to main conversation
85
112
  - **Validation** - Merge button disabled until fork is exported
113
+ - Track parent-child relationships in fork hierarchy
86
114
 
87
115
  ### 💾 State Persistence
88
116
 
@@ -106,157 +134,1634 @@ orka status
106
134
  - **Quick actions** - Code, Terminal, Save & Close buttons
107
135
  - **Real-time updates** - Automatically refreshes on state changes
108
136
  - **Fork management** - Create, export, merge, and close forks visually
137
+ - **Status indicators** - Visual distinction for active, saved, merged, and closed forks
138
+
139
+ ---
140
+
141
+ ## CLI Reference
109
142
 
110
- ## What's New in v0.4.x
143
+ ### Setup Commands
111
144
 
112
- ### v0.4.2 (Latest)
113
- - 🐛 **Fixed**: `orka prepare` command now works correctly (readline import fix)
114
- - ✅ **Improved**: Dependency installation more reliable
145
+ #### `orka prepare`
115
146
 
116
- ### v0.4.1
117
- - 🔄 **Session Recovery**: Automatically recovers sessions after system restarts
118
- - 💪 **Resilient**: Detects missing tmux sessions and recreates them with Claude context
119
- - 🔍 **Smart Detection**: Checks tmux session existence before attempting reconnection
147
+ Install and configure system dependencies automatically.
120
148
 
121
- ### v0.4.0
122
- - 🎨 **Electron UI**: Visual session tree with interactive fork management
123
- - 💾 **Save & Close**: Properly detaches from tmux (sessions stay alive for resume)
124
- - 🔒 **Merge Validation**: Merge button disabled until fork is exported
125
- - 🖥️ **UI Improvements**: Code and Terminal quick action buttons
126
- - 🚫 **No DevTools**: Cleaner UI without automatic developer tools
149
+ ```bash
150
+ orka prepare [options]
151
+ ```
152
+
153
+ **Options:**
154
+ - `-y, --yes` - Skip confirmation prompts
155
+
156
+ **What it does:**
157
+ - Detects your operating system
158
+ - Installs tmux via package manager (Homebrew, apt, yum)
159
+ - Checks for Claude CLI installation
160
+ - Provides installation instructions if dependencies are missing
161
+
162
+ **Example:**
163
+ ```bash
164
+ # Interactive installation
165
+ orka prepare
166
+
167
+ # Skip confirmations
168
+ orka prepare --yes
169
+ ```
170
+
171
+ ---
127
172
 
128
- ## Commands
173
+ #### `orka doctor`
129
174
 
130
- ### Setup
175
+ Check system dependencies and configuration.
131
176
 
132
177
  ```bash
133
- orka prepare # Install system dependencies (tmux, etc.)
134
- orka doctor # Check system dependencies
135
- orka init # Initialize Claude-Orka in current project
178
+ orka doctor
179
+ ```
180
+
181
+ **What it checks:**
182
+ - Node.js version
183
+ - tmux installation and version
184
+ - Claude CLI installation and authentication
185
+ - Project initialization status
186
+
187
+ **Example output:**
188
+ ```
189
+ ✓ Node.js v20.18.0
190
+ ✓ tmux 3.5a
191
+ ✓ Claude CLI installed
192
+ ✓ Project initialized
136
193
  ```
137
194
 
138
- ### Project
195
+ ---
196
+
197
+ #### `orka init`
198
+
199
+ Initialize Claude-Orka in the current project.
139
200
 
140
201
  ```bash
141
- orka status # Show project status
202
+ orka init
142
203
  ```
143
204
 
144
- ### Sessions
205
+ **What it does:**
206
+ - Creates `.claude-orka/` directory
207
+ - Initializes `state.json` with empty state
208
+ - Sets up exports directory structure
209
+
210
+ ---
211
+
212
+ ### Project Commands
213
+
214
+ #### `orka status`
215
+
216
+ Show project status and session summary.
145
217
 
146
218
  ```bash
147
- orka session create [name] # Create new session
148
- orka session list # List all sessions
149
- orka session get <id> # Get session details
150
- orka session resume <id> # Resume saved session
151
- orka session close <id> # Close session (save for later)
152
- orka session delete <id> # Permanently delete session
219
+ orka status [options]
153
220
  ```
154
221
 
155
- ### Forks
222
+ **Options:**
223
+ - `--json` - Output in JSON format
156
224
 
225
+ **Example:**
157
226
  ```bash
158
- orka fork create <session-id> [name] # Create fork
159
- orka fork list <session-id> # List forks
160
- orka fork resume <session-id> <fork-id> # Resume fork
161
- orka fork close <session-id> <fork-id> # Close fork
162
- orka fork delete <session-id> <fork-id> # Delete fork
227
+ orka status
228
+
229
+ # Output:
230
+ # 📊 Project Summary
231
+ # ──────────────────
232
+ # Project Path: /path/to/project
233
+ # Total Sessions: 3
234
+ # Active: 1
235
+ # Saved: 2
236
+ # Last Updated: 11/20/2025, 6:48:46 AM
237
+ #
238
+ # 📝 Sessions:
239
+ # ✓ Feature Implementation
240
+ # ID: abc123...
241
+ # Status: active
242
+ # Total Forks: 2
163
243
  ```
164
244
 
165
- ### Merge
245
+ ---
246
+
247
+ ### Session Commands
248
+
249
+ #### `orka session create`
250
+
251
+ Create a new Claude Code session.
166
252
 
167
253
  ```bash
168
- orka merge export <session-id> <fork-id> # Generate export
169
- orka merge do <session-id> <fork-id> # Merge to main
170
- orka merge auto <session-id> <fork-id> # Export + merge (recommended)
254
+ orka session create [name] [options]
171
255
  ```
172
256
 
173
- ## Example Workflow
257
+ **Arguments:**
258
+ - `name` - Optional session name (default: "Session-{timestamp}")
259
+
260
+ **Options:**
261
+ - `--no-terminal` - Don't open terminal window
262
+ - `--no-ui` - Don't launch Electron UI
174
263
 
264
+ **What it does:**
265
+ 1. Creates new tmux session
266
+ 2. Launches Claude Code in the tmux session
267
+ 3. Opens terminal window
268
+ 4. Launches Electron UI for visual management
269
+ 5. Saves session state
270
+
271
+ **Example:**
175
272
  ```bash
176
- # 1. Start a new session for your feature
273
+ # Create with custom name
177
274
  orka session create "OAuth Implementation"
178
- # → Session ID: abc123...
179
275
 
180
- # 2. Work on the main approach...
181
- # (Claude Code opens in tmux)
276
+ # Create without opening terminal
277
+ orka session create --no-terminal
278
+
279
+ # Create without UI
280
+ orka session create --no-ui
281
+ ```
282
+
283
+ ---
284
+
285
+ #### `orka session list`
286
+
287
+ List all sessions in the project.
288
+
289
+ ```bash
290
+ orka session list [options]
291
+ ```
292
+
293
+ **Options:**
294
+ - `--status <status>` - Filter by status (active, saved)
295
+ - `--json` - Output in JSON format
296
+
297
+ **Example:**
298
+ ```bash
299
+ # List all sessions
300
+ orka session list
301
+
302
+ # List only active sessions
303
+ orka session list --status active
304
+
305
+ # Get JSON output
306
+ orka session list --json
307
+ ```
308
+
309
+ ---
310
+
311
+ #### `orka session get`
312
+
313
+ Get detailed information about a session.
314
+
315
+ ```bash
316
+ orka session get <session-id> [options]
317
+ ```
318
+
319
+ **Arguments:**
320
+ - `session-id` - Session ID to retrieve
321
+
322
+ **Options:**
323
+ - `--json` - Output in JSON format
324
+
325
+ **Example:**
326
+ ```bash
327
+ orka session get abc123
328
+ ```
329
+
330
+ ---
331
+
332
+ #### `orka session resume`
333
+
334
+ Resume a saved or detached session.
335
+
336
+ ```bash
337
+ orka session resume <session-id> [options]
338
+ ```
339
+
340
+ **Arguments:**
341
+ - `session-id` - Session ID to resume
342
+
343
+ **Options:**
344
+ - `--no-terminal` - Don't open terminal window
345
+ - `--no-ui` - Don't launch Electron UI
346
+
347
+ **What it does:**
348
+ 1. **If tmux session exists**: Reconnects to existing session
349
+ 2. **If tmux session missing**: Creates new tmux session and resumes Claude session
350
+ 3. Opens terminal window and launches UI
351
+ 4. Resumes all forks that weren't merged
352
+
353
+ **Recovery mechanism:**
354
+ - Detects if tmux session was lost (system restart, crash)
355
+ - Automatically creates new tmux session
356
+ - Resumes Claude session with full context
357
+ - Restores all fork panes
358
+
359
+ **Example:**
360
+ ```bash
361
+ orka session resume abc123
362
+ ```
363
+
364
+ ---
365
+
366
+ #### `orka session close`
367
+
368
+ Close and save a session for later.
369
+
370
+ ```bash
371
+ orka session close <session-id>
372
+ ```
373
+
374
+ **Arguments:**
375
+ - `session-id` - Session ID to close
376
+
377
+ **What it does:**
378
+ - Detaches from tmux session (session stays alive)
379
+ - Updates status to 'saved'
380
+ - Session can be resumed later with full context
381
+
382
+ **Example:**
383
+ ```bash
384
+ orka session close abc123
385
+ ```
386
+
387
+ ---
388
+
389
+ #### `orka session delete`
390
+
391
+ Permanently delete a session.
392
+
393
+ ```bash
394
+ orka session delete <session-id>
395
+ ```
396
+
397
+ **Arguments:**
398
+ - `session-id` - Session ID to delete
399
+
400
+ **What it does:**
401
+ - Kills tmux session
402
+ - Removes session from state
403
+ - **Warning**: This action cannot be undone
404
+
405
+ **Example:**
406
+ ```bash
407
+ orka session delete abc123
408
+ ```
409
+
410
+ ---
411
+
412
+ ### Fork Commands
413
+
414
+ #### `orka fork create`
415
+
416
+ Create a fork (conversation branch) from main or another fork.
417
+
418
+ ```bash
419
+ orka fork create <session-id> [name] [options]
420
+ ```
421
+
422
+ **Arguments:**
423
+ - `session-id` - Parent session ID
424
+ - `name` - Optional fork name (default: "Fork-{timestamp}")
425
+
426
+ **Options:**
427
+ - `--parent <parent-id>` - Parent fork ID (default: "main")
428
+ - `--vertical` - Split pane vertically instead of horizontally
429
+
430
+ **What it does:**
431
+ 1. Creates split pane in tmux
432
+ 2. Launches new Claude session in the fork
433
+ 3. Tracks parent-child relationship
434
+ 4. Updates session state
435
+
436
+ **Limitation:**
437
+ - Only one active fork allowed per parent branch
438
+ - Must merge or close existing fork before creating new one
439
+
440
+ **Example:**
441
+ ```bash
442
+ # Create fork from main
443
+ orka fork create abc123 "Try JWT Implementation"
444
+
445
+ # Create fork from another fork
446
+ orka fork create abc123 "Nested Approach" --parent def456
447
+
448
+ # Create with vertical split
449
+ orka fork create abc123 --vertical
450
+ ```
451
+
452
+ ---
453
+
454
+ #### `orka fork list`
455
+
456
+ List all forks in a session.
457
+
458
+ ```bash
459
+ orka fork list <session-id> [options]
460
+ ```
461
+
462
+ **Arguments:**
463
+ - `session-id` - Session ID
464
+
465
+ **Options:**
466
+ - `--json` - Output in JSON format
467
+
468
+ **Example:**
469
+ ```bash
470
+ orka fork list abc123
471
+ ```
472
+
473
+ ---
474
+
475
+ #### `orka fork resume`
476
+
477
+ Resume a saved fork.
478
+
479
+ ```bash
480
+ orka fork resume <session-id> <fork-id>
481
+ ```
482
+
483
+ **Arguments:**
484
+ - `session-id` - Session ID
485
+ - `fork-id` - Fork ID to resume
486
+
487
+ **What it does:**
488
+ - Creates new split pane in tmux
489
+ - Resumes Claude session for the fork
490
+ - Restores fork context
491
+
492
+ **Example:**
493
+ ```bash
494
+ orka fork resume abc123 def456
495
+ ```
496
+
497
+ ---
498
+
499
+ #### `orka fork close`
500
+
501
+ Close a fork without merging (abandon experiment).
502
+
503
+ ```bash
504
+ orka fork close <session-id> <fork-id>
505
+ ```
506
+
507
+ **Arguments:**
508
+ - `session-id` - Session ID
509
+ - `fork-id` - Fork ID to close
510
+
511
+ **What it does:**
512
+ - Kills fork's tmux pane
513
+ - Sets fork status to 'closed'
514
+ - Fork can be viewed in UI but not resumed
515
+ - No export or merge required
516
+
517
+ **Use case:**
518
+ - Experiment didn't work out
519
+ - Want to abandon this approach
520
+ - Don't need to merge learnings back
521
+
522
+ **Example:**
523
+ ```bash
524
+ orka fork close abc123 def456
525
+ ```
526
+
527
+ ---
528
+
529
+ #### `orka fork delete`
530
+
531
+ Permanently delete a fork.
532
+
533
+ ```bash
534
+ orka fork delete <session-id> <fork-id>
535
+ ```
536
+
537
+ **Arguments:**
538
+ - `session-id` - Session ID
539
+ - `fork-id` - Fork ID to delete
540
+
541
+ **What it does:**
542
+ - Removes fork from session state
543
+ - **Warning**: Cannot be undone
544
+
545
+ **Example:**
546
+ ```bash
547
+ orka fork delete abc123 def456
548
+ ```
549
+
550
+ ---
551
+
552
+ ### Merge Commands
553
+
554
+ #### `orka merge export`
555
+
556
+ Generate export summary for a fork.
557
+
558
+ ```bash
559
+ orka merge export <session-id> <fork-id>
560
+ ```
561
+
562
+ **Arguments:**
563
+ - `session-id` - Session ID
564
+ - `fork-id` - Fork ID to export
565
+
566
+ **What it does:**
567
+ 1. Sends prompt to Claude to generate summary
568
+ 2. Claude creates executive summary of fork exploration
569
+ 3. Claude exports to `.claude-orka/exports/fork-{id}.md`
570
+ 4. **Note**: Async operation - Claude does the work in background
571
+
572
+ **Example:**
573
+ ```bash
574
+ orka merge export abc123 def456
575
+ # Wait for Claude to complete (usually 10-15 seconds)
576
+ ```
577
+
578
+ ---
579
+
580
+ #### `orka merge do`
581
+
582
+ Merge a fork back to its parent.
583
+
584
+ ```bash
585
+ orka merge do <session-id> <fork-id>
586
+ ```
587
+
588
+ **Arguments:**
589
+ - `session-id` - Session ID
590
+ - `fork-id` - Fork ID to merge
591
+
592
+ **Prerequisites:**
593
+ - Fork must have been exported first
594
+ - Export file must exist
595
+
596
+ **What it does:**
597
+ 1. Sends merge prompt to parent conversation
598
+ 2. Includes fork export summary
599
+ 3. Sets fork status to 'merged'
600
+ 4. Closes fork pane
601
+
602
+ **Example:**
603
+ ```bash
604
+ orka merge do abc123 def456
605
+ ```
606
+
607
+ ---
608
+
609
+ #### `orka merge auto`
610
+
611
+ Export and merge a fork (recommended).
612
+
613
+ ```bash
614
+ orka merge auto <session-id> <fork-id> [options]
615
+ ```
616
+
617
+ **Arguments:**
618
+ - `session-id` - Session ID
619
+ - `fork-id` - Fork ID to export and merge
182
620
 
183
- # 3. Create a fork to try JWT tokens
184
- orka fork create abc123 "Try JWT Tokens"
185
- # → Fork ID: def456...
621
+ **Options:**
622
+ - `--wait <ms>` - Wait time for export (default: 15000ms)
186
623
 
187
- # 4. Work on the fork...
188
- # (Fork opens in new tmux pane)
624
+ **What it does:**
625
+ 1. Generates export (Claude does this)
626
+ 2. Waits for export to complete
627
+ 3. Merges fork to parent
628
+ 4. Complete workflow in one command
189
629
 
190
- # 5. Merge the successful approach back
630
+ **Example:**
631
+ ```bash
632
+ # Use default wait time (15 seconds)
191
633
  orka merge auto abc123 def456
192
634
 
193
- # 6. Check final state
194
- orka status
635
+ # Custom wait time (20 seconds)
636
+ orka merge auto abc123 def456 --wait 20000
195
637
  ```
196
638
 
197
- ## SDK Usage
639
+ ---
640
+
641
+ ## SDK API Reference
198
642
 
199
- You can also use Claude-Orka programmatically:
643
+ ### Installation
200
644
 
201
645
  ```typescript
202
646
  import { ClaudeOrka } from '@enruana/claude-orka'
647
+ ```
203
648
 
204
- const orka = new ClaudeOrka('/path/to/project')
205
- await orka.initialize()
649
+ ### ClaudeOrka Class
206
650
 
207
- // Create session
208
- const session = await orka.createSession('My Feature')
651
+ Main SDK class for orchestrating Claude Code sessions.
209
652
 
210
- // Create fork
211
- const fork = await orka.createFork(session.id, 'Alternative')
653
+ #### Constructor
212
654
 
213
- // Generate export and merge
214
- await orka.generateExportAndMerge(session.id, fork.id)
655
+ ```typescript
656
+ new ClaudeOrka(projectPath: string)
657
+ ```
215
658
 
216
- // Get project summary
217
- const summary = await orka.getProjectSummary()
659
+ **Parameters:**
660
+ - `projectPath` - Absolute path to your project directory
661
+
662
+ **Example:**
663
+ ```typescript
664
+ const orka = new ClaudeOrka('/Users/username/my-project')
665
+ await orka.initialize()
218
666
  ```
219
667
 
220
- ## Architecture
668
+ ---
669
+
670
+ ### Initialization
221
671
 
672
+ #### `initialize()`
673
+
674
+ Initialize ClaudeOrka and create state directory.
675
+
676
+ ```typescript
677
+ async initialize(): Promise<void>
222
678
  ```
223
- .claude-orka/
224
- ├── state.json # Project state
225
- └── exports/ # Fork summaries (created on-demand)
226
- └── fork-*.md # Generated summaries
679
+
680
+ **Example:**
681
+ ```typescript
682
+ await orka.initialize()
227
683
  ```
228
684
 
229
- **Key Concepts:**
685
+ ---
686
+
687
+ ### Session Methods
230
688
 
231
- - **Session**: A Claude Code conversation with main + forks
232
- - **Main**: The primary conversation branch
233
- - **Fork**: A branched conversation to explore alternatives
234
- - **Export**: A summary of a fork's exploration
235
- - **Merge**: Integrate fork learnings into main
689
+ #### `createSession()`
236
690
 
237
- ## Configuration
691
+ Create a new Claude Code session.
238
692
 
239
- Claude-Orka uses native Claude CLI sessions, so no additional configuration is needed. Session IDs are automatically detected from `~/.claude/history.jsonl`.
693
+ ```typescript
694
+ async createSession(
695
+ name?: string,
696
+ openTerminal?: boolean
697
+ ): Promise<Session>
698
+ ```
240
699
 
241
- ## Troubleshooting
700
+ **Parameters:**
701
+ - `name` - Optional session name (default: "Session-{timestamp}")
702
+ - `openTerminal` - Open terminal window (default: true)
242
703
 
243
- ```bash
244
- # Check if everything is set up correctly
245
- orka doctor
704
+ **Returns:** `Session` object
246
705
 
247
- # Common issues:
248
- # - tmux not installed → brew install tmux
249
- # - Claude CLI not found → Install from claude.ai
250
- # - Project not initialized → orka init
706
+ **Example:**
707
+ ```typescript
708
+ const session = await orka.createSession('OAuth Implementation')
709
+ console.log(session.id) // abc123...
251
710
  ```
252
711
 
253
- ## Contributing
712
+ ---
254
713
 
255
- Contributions are welcome! Please feel free to submit a Pull Request.
714
+ #### `resumeSession()`
256
715
 
257
- ## License
716
+ Resume a saved session.
258
717
 
259
- MIT © enruana
718
+ ```typescript
719
+ async resumeSession(
720
+ sessionId: string,
721
+ openTerminal?: boolean
722
+ ): Promise<Session>
723
+ ```
724
+
725
+ **Parameters:**
726
+ - `sessionId` - Session ID to resume
727
+ - `openTerminal` - Open terminal window (default: true)
728
+
729
+ **Returns:** `Session` object
730
+
731
+ **Recovery behavior:**
732
+ - Checks if tmux session exists
733
+ - If yes: Reconnects to existing session
734
+ - If no: Creates new tmux session and resumes Claude session
735
+
736
+ **Example:**
737
+ ```typescript
738
+ const session = await orka.resumeSession('abc123')
739
+ ```
740
+
741
+ ---
742
+
743
+ #### `closeSession()`
744
+
745
+ Close a session.
746
+
747
+ ```typescript
748
+ async closeSession(sessionId: string): Promise<void>
749
+ ```
750
+
751
+ **Parameters:**
752
+ - `sessionId` - Session ID to close
753
+
754
+ **Example:**
755
+ ```typescript
756
+ await orka.closeSession('abc123')
757
+ ```
758
+
759
+ ---
760
+
761
+ #### `deleteSession()`
762
+
763
+ Permanently delete a session.
764
+
765
+ ```typescript
766
+ async deleteSession(sessionId: string): Promise<void>
767
+ ```
768
+
769
+ **Parameters:**
770
+ - `sessionId` - Session ID to delete
771
+
772
+ **Example:**
773
+ ```typescript
774
+ await orka.deleteSession('abc123')
775
+ ```
776
+
777
+ ---
778
+
779
+ #### `listSessions()`
780
+
781
+ List sessions with optional filters.
782
+
783
+ ```typescript
784
+ async listSessions(filters?: SessionFilters): Promise<Session[]>
785
+ ```
786
+
787
+ **Parameters:**
788
+ - `filters` - Optional filters (status, name)
789
+
790
+ **Returns:** Array of `Session` objects
791
+
792
+ **Example:**
793
+ ```typescript
794
+ // List all sessions
795
+ const sessions = await orka.listSessions()
796
+
797
+ // List only active sessions
798
+ const activeSessions = await orka.listSessions({ status: 'active' })
799
+ ```
800
+
801
+ ---
802
+
803
+ #### `getSession()`
804
+
805
+ Get a session by ID.
806
+
807
+ ```typescript
808
+ async getSession(sessionId: string): Promise<Session | null>
809
+ ```
810
+
811
+ **Parameters:**
812
+ - `sessionId` - Session ID
813
+
814
+ **Returns:** `Session` object or `null`
815
+
816
+ **Example:**
817
+ ```typescript
818
+ const session = await orka.getSession('abc123')
819
+ if (session) {
820
+ console.log(session.name)
821
+ }
822
+ ```
823
+
824
+ ---
825
+
826
+ #### `getProjectSummary()`
827
+
828
+ Get complete project summary with statistics.
829
+
830
+ ```typescript
831
+ async getProjectSummary(): Promise<ProjectSummary>
832
+ ```
833
+
834
+ **Returns:** `ProjectSummary` object
835
+
836
+ **Example:**
837
+ ```typescript
838
+ const summary = await orka.getProjectSummary()
839
+ console.log(`Total sessions: ${summary.totalSessions}`)
840
+ console.log(`Active: ${summary.activeSessions}`)
841
+ ```
842
+
843
+ ---
844
+
845
+ ### Fork Methods
846
+
847
+ #### `createFork()`
848
+
849
+ Create a fork (conversation branch).
850
+
851
+ ```typescript
852
+ async createFork(
853
+ sessionId: string,
854
+ name?: string,
855
+ parentId?: string,
856
+ vertical?: boolean
857
+ ): Promise<Fork>
858
+ ```
859
+
860
+ **Parameters:**
861
+ - `sessionId` - Session ID
862
+ - `name` - Optional fork name (default: "Fork-{timestamp}")
863
+ - `parentId` - Parent fork ID (default: "main")
864
+ - `vertical` - Split vertically (default: false)
865
+
866
+ **Returns:** `Fork` object
867
+
868
+ **Example:**
869
+ ```typescript
870
+ // Create fork from main
871
+ const fork = await orka.createFork('abc123', 'JWT Implementation')
872
+
873
+ // Create fork from another fork
874
+ const nestedFork = await orka.createFork(
875
+ 'abc123',
876
+ 'Nested Approach',
877
+ 'def456'
878
+ )
879
+
880
+ // Create with vertical split
881
+ const vFork = await orka.createFork('abc123', undefined, 'main', true)
882
+ ```
883
+
884
+ ---
885
+
886
+ #### `resumeFork()`
887
+
888
+ Resume a saved fork.
889
+
890
+ ```typescript
891
+ async resumeFork(sessionId: string, forkId: string): Promise<Fork>
892
+ ```
893
+
894
+ **Parameters:**
895
+ - `sessionId` - Session ID
896
+ - `forkId` - Fork ID
897
+
898
+ **Returns:** `Fork` object
899
+
900
+ **Example:**
901
+ ```typescript
902
+ const fork = await orka.resumeFork('abc123', 'def456')
903
+ ```
904
+
905
+ ---
906
+
907
+ #### `closeFork()`
908
+
909
+ Close a fork without merging.
910
+
911
+ ```typescript
912
+ async closeFork(sessionId: string, forkId: string): Promise<void>
913
+ ```
914
+
915
+ **Parameters:**
916
+ - `sessionId` - Session ID
917
+ - `forkId` - Fork ID
918
+
919
+ **Example:**
920
+ ```typescript
921
+ await orka.closeFork('abc123', 'def456')
922
+ ```
923
+
924
+ ---
925
+
926
+ #### `deleteFork()`
927
+
928
+ Permanently delete a fork.
929
+
930
+ ```typescript
931
+ async deleteFork(sessionId: string, forkId: string): Promise<void>
932
+ ```
933
+
934
+ **Parameters:**
935
+ - `sessionId` - Session ID
936
+ - `forkId` - Fork ID
937
+
938
+ **Example:**
939
+ ```typescript
940
+ await orka.deleteFork('abc123', 'def456')
941
+ ```
942
+
943
+ ---
944
+
945
+ ### Export & Merge Methods
946
+
947
+ #### `generateForkExport()`
948
+
949
+ Generate export summary for a fork.
950
+
951
+ ```typescript
952
+ async generateForkExport(
953
+ sessionId: string,
954
+ forkId: string
955
+ ): Promise<string>
956
+ ```
957
+
958
+ **Parameters:**
959
+ - `sessionId` - Session ID
960
+ - `forkId` - Fork ID
961
+
962
+ **Returns:** Path to export file (relative to project)
963
+
964
+ **Note:** Async - Claude generates the export in background
965
+
966
+ **Example:**
967
+ ```typescript
968
+ const exportPath = await orka.generateForkExport('abc123', 'def456')
969
+ console.log(`Export will be saved to: ${exportPath}`)
970
+ // Wait 10-15 seconds for Claude to complete
971
+ ```
972
+
973
+ ---
974
+
975
+ #### `merge()`
976
+
977
+ Merge a fork to its parent.
978
+
979
+ ```typescript
980
+ async merge(sessionId: string, forkId: string): Promise<void>
981
+ ```
982
+
983
+ **Parameters:**
984
+ - `sessionId` - Session ID
985
+ - `forkId` - Fork ID
986
+
987
+ **Prerequisites:**
988
+ - Fork must be exported first
989
+
990
+ **Example:**
991
+ ```typescript
992
+ await orka.merge('abc123', 'def456')
993
+ ```
994
+
995
+ ---
996
+
997
+ #### `generateExportAndMerge()`
998
+
999
+ Generate export and merge (recommended).
1000
+
1001
+ ```typescript
1002
+ async generateExportAndMerge(
1003
+ sessionId: string,
1004
+ forkId: string,
1005
+ waitTime?: number
1006
+ ): Promise<void>
1007
+ ```
1008
+
1009
+ **Parameters:**
1010
+ - `sessionId` - Session ID
1011
+ - `forkId` - Fork ID
1012
+ - `waitTime` - Wait time in ms (default: 15000)
1013
+
1014
+ **Example:**
1015
+ ```typescript
1016
+ // Use default wait time
1017
+ await orka.generateExportAndMerge('abc123', 'def456')
1018
+
1019
+ // Custom wait time
1020
+ await orka.generateExportAndMerge('abc123', 'def456', 20000)
1021
+ ```
1022
+
1023
+ ---
1024
+
1025
+ #### `generateExportMergeAndClose()`
1026
+
1027
+ Complete workflow: export, merge, and close.
1028
+
1029
+ ```typescript
1030
+ async generateExportMergeAndClose(
1031
+ sessionId: string,
1032
+ forkId: string,
1033
+ waitTime?: number
1034
+ ): Promise<void>
1035
+ ```
1036
+
1037
+ **Parameters:**
1038
+ - `sessionId` - Session ID
1039
+ - `forkId` - Fork ID
1040
+ - `waitTime` - Wait time in ms (default: 15000)
1041
+
1042
+ **Example:**
1043
+ ```typescript
1044
+ await orka.generateExportMergeAndClose('abc123', 'def456')
1045
+ ```
1046
+
1047
+ ---
1048
+
1049
+ ### Command Sending
1050
+
1051
+ #### `send()`
1052
+
1053
+ Send command to session or fork.
1054
+
1055
+ ```typescript
1056
+ async send(
1057
+ sessionId: string,
1058
+ command: string,
1059
+ target?: string
1060
+ ): Promise<void>
1061
+ ```
1062
+
1063
+ **Parameters:**
1064
+ - `sessionId` - Session ID
1065
+ - `command` - Command to send
1066
+ - `target` - Optional fork ID (default: main)
1067
+
1068
+ **Example:**
1069
+ ```typescript
1070
+ // Send to main
1071
+ await orka.send('abc123', 'ls -la')
1072
+
1073
+ // Send to fork
1074
+ await orka.send('abc123', 'npm test', 'def456')
1075
+ ```
1076
+
1077
+ ---
1078
+
1079
+ ### Type Definitions
1080
+
1081
+ #### Session
1082
+
1083
+ ```typescript
1084
+ interface Session {
1085
+ id: string // Unique session ID
1086
+ name: string // Session name
1087
+ tmuxSessionId: string // tmux session ID
1088
+ status: 'active' | 'saved' // Session status
1089
+ createdAt: string // ISO timestamp
1090
+ lastActivity: string // ISO timestamp
1091
+ main: MainBranch // Main conversation
1092
+ forks: Fork[] // Array of forks
1093
+ projectPath?: string // Project path
1094
+ }
1095
+ ```
1096
+
1097
+ #### MainBranch
1098
+
1099
+ ```typescript
1100
+ interface MainBranch {
1101
+ claudeSessionId: string // Claude session UUID
1102
+ tmuxPaneId?: string // tmux pane ID (if active)
1103
+ status: 'active' | 'saved' // Branch status
1104
+ contextPath?: string // Path to context export
1105
+ }
1106
+ ```
1107
+
1108
+ #### Fork
1109
+
1110
+ ```typescript
1111
+ interface Fork {
1112
+ id: string // Fork ID
1113
+ name: string // Fork name
1114
+ parentId: string // Parent ID ('main' or fork ID)
1115
+ claudeSessionId: string // Claude session UUID
1116
+ tmuxPaneId?: string // tmux pane ID (if active)
1117
+ createdAt: string // ISO timestamp
1118
+ status: 'active' | 'saved' | 'closed' | 'merged' // Fork status
1119
+ contextPath?: string // Path to export
1120
+ mergedToMain?: boolean // Merge status
1121
+ mergedAt?: string // Merge timestamp
1122
+ }
1123
+ ```
1124
+
1125
+ #### SessionFilters
1126
+
1127
+ ```typescript
1128
+ interface SessionFilters {
1129
+ status?: 'active' | 'saved' // Filter by status
1130
+ name?: string // Filter by name (partial match)
1131
+ }
1132
+ ```
1133
+
1134
+ #### ProjectSummary
1135
+
1136
+ ```typescript
1137
+ interface ProjectSummary {
1138
+ projectPath: string // Project path
1139
+ totalSessions: number // Total sessions
1140
+ activeSessions: number // Active sessions count
1141
+ savedSessions: number // Saved sessions count
1142
+ sessions: SessionSummary[] // Array of session summaries
1143
+ lastUpdated: string // ISO timestamp
1144
+ }
1145
+ ```
1146
+
1147
+ #### SessionSummary
1148
+
1149
+ ```typescript
1150
+ interface SessionSummary {
1151
+ id: string // Session ID
1152
+ name: string // Session name
1153
+ claudeSessionId: string // Claude session UUID
1154
+ status: 'active' | 'saved' // Status
1155
+ createdAt: string // ISO timestamp
1156
+ lastActivity: string // ISO timestamp
1157
+ totalForks: number // Total forks
1158
+ activeForks: number // Active forks count
1159
+ savedForks: number // Saved forks count
1160
+ mergedForks: number // Merged forks count
1161
+ forks: ForkSummary[] // Array of fork summaries
1162
+ }
1163
+ ```
1164
+
1165
+ #### ForkSummary
1166
+
1167
+ ```typescript
1168
+ interface ForkSummary {
1169
+ id: string // Fork ID
1170
+ name: string // Fork name
1171
+ claudeSessionId: string // Claude session UUID
1172
+ status: 'active' | 'saved' | 'closed' | 'merged' // Status
1173
+ createdAt: string // ISO timestamp
1174
+ hasContext: boolean // Has export
1175
+ contextPath?: string // Path to export
1176
+ mergedToMain: boolean // Merge status
1177
+ mergedAt?: string // Merge timestamp
1178
+ }
1179
+ ```
1180
+
1181
+ ---
1182
+
1183
+ ## Electron UI Guide
1184
+
1185
+ ### Overview
1186
+
1187
+ The Electron UI provides a visual interface for managing Claude Code sessions and forks. It automatically launches when you create or resume a session.
1188
+
1189
+ ### Screenshots
1190
+
1191
+ **Active Fork with Visual Hierarchy**
1192
+
1193
+ ![Active Fork](https://raw.githubusercontent.com/enruana/claude-orka/refs/heads/main/public/1-fork.png)
1194
+
1195
+ *Visual session tree showing main branch and an active fork with parent-child relationship*
1196
+
1197
+ ---
1198
+
1199
+ **Closed and Merged Forks**
1200
+
1201
+ ![Closed and Merged Forks](https://raw.githubusercontent.com/enruana/claude-orka/refs/heads/main/public/2-forks-closed-merged.png)
1202
+
1203
+ *Compact visual representation: Red circles for closed forks, green circles for merged forks*
1204
+
1205
+ ---
1206
+
1207
+ **Fork Info Modal**
1208
+
1209
+ ![Fork Merged Dialog](https://raw.githubusercontent.com/enruana/claude-orka/refs/heads/main/public/3-fork-merged-dialog.png)
1210
+
1211
+ *Detailed fork information modal with export file access for merged forks*
1212
+
1213
+ ---
1214
+
1215
+ ### Features
1216
+
1217
+ #### Visual Session Tree
1218
+
1219
+ - **Hierarchical view** of main conversation and all forks
1220
+ - **Parent-child relationships** shown with connecting edges
1221
+ - **Color-coded status indicators**:
1222
+ - 🟢 Green: Active
1223
+ - 🟡 Yellow: Saved
1224
+ - 🔴 Red: Closed
1225
+ - 🔵 Green circle: Merged
1226
+
1227
+ #### Interactive Nodes
1228
+
1229
+ **Main Node:**
1230
+ - Large card showing "MAIN" branch
1231
+ - Click to select and view in action panel
1232
+
1233
+ **Fork Nodes (Active/Saved):**
1234
+ - Full cards with fork name and ID
1235
+ - Click to select
1236
+ - Shows fork status badge
1237
+
1238
+ **Fork Nodes (Closed/Merged):**
1239
+ - Compact circles (48px)
1240
+ - "C" for Closed (red border)
1241
+ - "M" for Merged (green border)
1242
+ - Click to open info modal with details
1243
+
1244
+ #### Header Actions
1245
+
1246
+ **Project Name:**
1247
+ - Shows current project name in window title
1248
+
1249
+ **Code Button:**
1250
+ - Opens project folder in Cursor (preferred)
1251
+ - Falls back to VSCode
1252
+ - Falls back to Finder
1253
+
1254
+ **Terminal Button:**
1255
+ - Focuses the terminal window
1256
+ - Brings tmux session to front
1257
+
1258
+ **Save & Close Button:**
1259
+ - Detaches from tmux (session stays alive)
1260
+ - Closes terminal window
1261
+ - Closes Electron app
1262
+ - Session can be resumed later
1263
+
1264
+ #### Action Panel
1265
+
1266
+ Located at the bottom, shows actions for selected node:
1267
+
1268
+ **New Fork:**
1269
+ - Creates fork from selected node
1270
+ - Opens dialog to enter fork name
1271
+ - Disabled if active fork already exists from this node
1272
+ - Tooltip explains Claude Code limitation
1273
+
1274
+ **Export:**
1275
+ - Generates export summary for selected fork
1276
+ - Sends prompt to Claude to create summary
1277
+ - Disabled for main branch
1278
+ - Shows progress "Exporting..."
1279
+
1280
+ **Merge:**
1281
+ - Merges selected fork to its parent
1282
+ - **Disabled until fork is exported**
1283
+ - Tooltip: "Export the fork first before merging"
1284
+ - Shows progress "Merging..."
1285
+
1286
+ **Close:**
1287
+ - Closes selected fork (abandon experiment)
1288
+ - No export or merge required
1289
+ - Fork marked as 'closed' (red circle in tree)
1290
+ - Can view info later but cannot resume
1291
+
1292
+ #### Fork Info Modal
1293
+
1294
+ For closed/merged forks, clicking shows modal with:
1295
+
1296
+ **Information displayed:**
1297
+ - Fork name
1298
+ - Fork ID
1299
+ - Claude Session ID
1300
+ - Status badge (color-coded)
1301
+ - Created date
1302
+ - Context path (if exported)
1303
+ - Merged date (if merged)
1304
+
1305
+ **Actions:**
1306
+ - **Open Export File** (merged forks only)
1307
+ - Opens export markdown in default app
1308
+ - Only shown if fork was merged and has export
1309
+
1310
+ ### Real-Time Updates
1311
+
1312
+ The UI automatically updates when:
1313
+ - State file changes (`.claude-orka/state.json`)
1314
+ - New forks are created
1315
+ - Forks are merged or closed
1316
+ - Session status changes
1317
+
1318
+ ### Window Controls
1319
+
1320
+ **Frameless design:**
1321
+ - Custom title bar with project name
1322
+ - Transparent background
1323
+ - Always on top (configurable)
1324
+ - Resizable (min 500x600, default 600x800)
1325
+
1326
+ ### Keyboard Shortcuts
1327
+
1328
+ - **Cmd/Ctrl + R**: Refresh (reload)
1329
+ - **Cmd/Ctrl + Q**: Quit application
1330
+ - **Cmd/Ctrl + W**: Close window (same as Save & Close)
1331
+
1332
+ ### Launch Options
1333
+
1334
+ **Automatic (default):**
1335
+ ```bash
1336
+ orka session create
1337
+ # UI launches automatically
1338
+ ```
1339
+
1340
+ **Manual control:**
1341
+ ```bash
1342
+ # Skip UI launch
1343
+ orka session create --no-ui
1344
+
1345
+ # Launch UI programmatically
1346
+ const orka = new ClaudeOrka('/path/to/project')
1347
+ await orka.createSession('Feature', true) // true = open terminal + UI
1348
+ ```
1349
+
1350
+ ---
1351
+
1352
+ ## Examples
1353
+
1354
+ ### Example 1: Basic Workflow
1355
+
1356
+ ```typescript
1357
+ import { ClaudeOrka } from '@enruana/claude-orka'
1358
+
1359
+ const orka = new ClaudeOrka('/Users/me/my-project')
1360
+ await orka.initialize()
1361
+
1362
+ // Create session
1363
+ const session = await orka.createSession('OAuth Implementation')
1364
+ console.log(`Session created: ${session.id}`)
1365
+
1366
+ // Work on main... then create fork
1367
+ const fork = await orka.createFork(session.id, 'Try JWT Tokens')
1368
+ console.log(`Fork created: ${fork.id}`)
1369
+
1370
+ // Work on fork... then merge back
1371
+ await orka.generateExportAndMerge(session.id, fork.id)
1372
+ console.log('Fork merged!')
1373
+
1374
+ // Check final state
1375
+ const summary = await orka.getProjectSummary()
1376
+ console.log(`Total sessions: ${summary.totalSessions}`)
1377
+ ```
1378
+
1379
+ ### Example 2: Multiple Forks
1380
+
1381
+ ```typescript
1382
+ const orka = new ClaudeOrka(process.cwd())
1383
+ await orka.initialize()
1384
+
1385
+ const session = await orka.createSession('Database Design')
1386
+
1387
+ // Create multiple forks to explore options
1388
+ const fork1 = await orka.createFork(session.id, 'PostgreSQL Approach')
1389
+ const fork2 = await orka.createFork(session.id, 'MongoDB Approach')
1390
+ const fork3 = await orka.createFork(session.id, 'Hybrid Approach')
1391
+
1392
+ // Work on each... then merge the winner
1393
+ await orka.generateExportAndMerge(session.id, fork1.id)
1394
+
1395
+ // Close the others
1396
+ await orka.closeFork(session.id, fork2.id)
1397
+ await orka.closeFork(session.id, fork3.id)
1398
+ ```
1399
+
1400
+ ### Example 3: Nested Forks
1401
+
1402
+ ```typescript
1403
+ const session = await orka.createSession('API Design')
1404
+
1405
+ // Main approach
1406
+ const restFork = await orka.createFork(session.id, 'REST API')
1407
+
1408
+ // Try variations of REST
1409
+ const restV1 = await orka.createFork(
1410
+ session.id,
1411
+ 'REST with Versioning',
1412
+ restFork.id // parent is the REST fork
1413
+ )
1414
+
1415
+ const restGraphQL = await orka.createFork(
1416
+ session.id,
1417
+ 'REST + GraphQL Hybrid',
1418
+ restFork.id
1419
+ )
1420
+
1421
+ // Merge best variation back to REST fork
1422
+ await orka.generateExportAndMerge(session.id, restV1.id)
1423
+
1424
+ // Then merge REST fork to main
1425
+ await orka.generateExportAndMerge(session.id, restFork.id)
1426
+ ```
1427
+
1428
+ ### Example 4: Session Recovery
1429
+
1430
+ ```typescript
1431
+ // Create session
1432
+ const session = await orka.createSession('Long Running Task')
1433
+
1434
+ // ... work on it ...
1435
+
1436
+ // Close session (detach from tmux)
1437
+ await orka.closeSession(session.id)
1438
+
1439
+ // Later... even after system restart
1440
+ const resumed = await orka.resumeSession(session.id)
1441
+ console.log('Session resumed with full context!')
1442
+
1443
+ // If tmux was lost (restart), ClaudeOrka:
1444
+ // 1. Detects missing tmux session
1445
+ // 2. Creates new tmux session
1446
+ // 3. Resumes Claude session with full history
1447
+ // 4. Restores all forks
1448
+ ```
1449
+
1450
+ ### Example 5: CLI Script
1451
+
1452
+ ```bash
1453
+ #!/bin/bash
1454
+
1455
+ # Create session
1456
+ SESSION_ID=$(orka session create "Feature X" --json | jq -r '.id')
1457
+
1458
+ # Create fork
1459
+ FORK_ID=$(orka fork create $SESSION_ID "Alternative" --json | jq -r '.id')
1460
+
1461
+ # Export and merge
1462
+ orka merge auto $SESSION_ID $FORK_ID
1463
+
1464
+ # Get final summary
1465
+ orka status
1466
+ ```
1467
+
1468
+ ---
1469
+
1470
+ ## Architecture
1471
+
1472
+ ### Directory Structure
1473
+
1474
+ ```
1475
+ .claude-orka/
1476
+ ├── state.json # Project state (sessions, forks)
1477
+ └── exports/ # Fork export summaries
1478
+ ├── fork-abc123.md # Export for fork abc123
1479
+ └── fork-def456.md # Export for fork def456
1480
+ ```
1481
+
1482
+ ### State File
1483
+
1484
+ **Location:** `.claude-orka/state.json`
1485
+
1486
+ **Structure:**
1487
+ ```json
1488
+ {
1489
+ "version": "1.0.0",
1490
+ "projectPath": "/path/to/project",
1491
+ "sessions": [
1492
+ {
1493
+ "id": "abc123...",
1494
+ "name": "Feature Implementation",
1495
+ "tmuxSessionId": "orka-abc123",
1496
+ "status": "active",
1497
+ "createdAt": "2025-11-20T10:00:00.000Z",
1498
+ "lastActivity": "2025-11-20T12:00:00.000Z",
1499
+ "main": {
1500
+ "claudeSessionId": "uuid-main",
1501
+ "tmuxPaneId": "%1",
1502
+ "status": "active"
1503
+ },
1504
+ "forks": [
1505
+ {
1506
+ "id": "def456",
1507
+ "name": "Alternative Approach",
1508
+ "parentId": "main",
1509
+ "claudeSessionId": "uuid-fork",
1510
+ "tmuxPaneId": "%2",
1511
+ "status": "merged",
1512
+ "createdAt": "2025-11-20T11:00:00.000Z",
1513
+ "contextPath": ".claude-orka/exports/fork-def456.md",
1514
+ "mergedToMain": true,
1515
+ "mergedAt": "2025-11-20T12:00:00.000Z"
1516
+ }
1517
+ ]
1518
+ }
1519
+ ],
1520
+ "lastUpdated": "2025-11-20T12:00:00.000Z"
1521
+ }
1522
+ ```
1523
+
1524
+ ### Key Concepts
1525
+
1526
+ **Session:**
1527
+ - A Claude Code conversation with main + forks
1528
+ - Runs in tmux session for multiplexing
1529
+ - Persists across tmux detach/attach
1530
+
1531
+ **Main Branch:**
1532
+ - Primary conversation thread
1533
+ - Cannot be deleted or merged
1534
+ - Always exists in a session
1535
+
1536
+ **Fork:**
1537
+ - Branched conversation from main or another fork
1538
+ - Independent Claude session
1539
+ - Can be merged back to parent
1540
+
1541
+ **Export:**
1542
+ - Summary of fork's exploration
1543
+ - Generated by Claude
1544
+ - Markdown format
1545
+ - Required before merge
1546
+
1547
+ **Merge:**
1548
+ - Integrates fork learnings into parent
1549
+ - Sends export summary to parent conversation
1550
+ - Marks fork as 'merged'
1551
+
1552
+ ### tmux Integration
1553
+
1554
+ **Session naming:** `orka-{session-id}`
1555
+ - Easy identification
1556
+ - Consistent naming
1557
+
1558
+ **Pane layout:**
1559
+ ```
1560
+ ┌─────────────────────────────────┐
1561
+ │ Main (MAIN) │
1562
+ ├─────────────────────────────────┤
1563
+ │ Fork 1 │
1564
+ ├─────────────────────────────────┤
1565
+ │ Fork 2 │
1566
+ └─────────────────────────────────┘
1567
+ ```
1568
+
1569
+ **Recovery:**
1570
+ - Detects if tmux session exists
1571
+ - If missing: creates new session + resumes Claude
1572
+ - If exists: reconnects to existing panes
1573
+
1574
+ ### Claude Integration
1575
+
1576
+ **Session detection:**
1577
+ - Reads `~/.claude/history.jsonl`
1578
+ - Finds most recent session ID
1579
+ - Associates with tmux pane
1580
+
1581
+ **Context preservation:**
1582
+ - Uses Claude's native session resume
1583
+ - Full conversation history maintained
1584
+ - Works across system restarts
1585
+
1586
+ ---
1587
+
1588
+ ## Troubleshooting
1589
+
1590
+ ### Common Issues
1591
+
1592
+ #### tmux not found
1593
+
1594
+ **Error:** `command not found: tmux`
1595
+
1596
+ **Solution:**
1597
+ ```bash
1598
+ # macOS
1599
+ brew install tmux
1600
+
1601
+ # Ubuntu
1602
+ sudo apt-get install tmux
1603
+
1604
+ # Or use orka prepare
1605
+ orka prepare
1606
+ ```
1607
+
1608
+ ---
1609
+
1610
+ #### Claude CLI not found
1611
+
1612
+ **Error:** `command not found: claude`
1613
+
1614
+ **Solution:**
1615
+ - Download from [claude.ai/download](https://claude.ai/download)
1616
+ - Or install via npm: `npm install -g @anthropic-ai/claude-cli`
1617
+ - Verify: `claude --version`
1618
+
1619
+ ---
1620
+
1621
+ #### Project not initialized
1622
+
1623
+ **Error:** `Project not initialized`
1624
+
1625
+ **Solution:**
1626
+ ```bash
1627
+ orka init
1628
+ ```
1629
+
1630
+ ---
1631
+
1632
+ #### Session recovery fails
1633
+
1634
+ **Error:** Session won't resume after restart
1635
+
1636
+ **Check:**
1637
+ 1. State file exists: `.claude-orka/state.json`
1638
+ 2. Claude session still valid in `~/.claude/history.jsonl`
1639
+ 3. Run `orka doctor` to check dependencies
1640
+
1641
+ **Recovery:**
1642
+ ```bash
1643
+ # Force resume
1644
+ orka session resume <session-id>
1645
+
1646
+ # If that fails, create new session
1647
+ orka session create
1648
+ ```
1649
+
1650
+ ---
1651
+
1652
+ #### Merge fails - no export
1653
+
1654
+ **Error:** `Cannot merge - fork not exported`
1655
+
1656
+ **Solution:**
1657
+ ```bash
1658
+ # Export first
1659
+ orka merge export <session-id> <fork-id>
1660
+
1661
+ # Wait 10-15 seconds for Claude
1662
+
1663
+ # Then merge
1664
+ orka merge do <session-id> <fork-id>
1665
+
1666
+ # Or use auto (recommended)
1667
+ orka merge auto <session-id> <fork-id>
1668
+ ```
1669
+
1670
+ ---
1671
+
1672
+ #### UI won't launch
1673
+
1674
+ **Error:** Electron UI doesn't open
1675
+
1676
+ **Check:**
1677
+ 1. Electron is installed: `npm list -g electron`
1678
+ 2. Display is available (not SSH session)
1679
+ 3. Permissions correct
1680
+
1681
+ **Manual launch:**
1682
+ ```bash
1683
+ # Check if UI process is running
1684
+ ps aux | grep electron
1685
+
1686
+ # Kill existing UI
1687
+ pkill -f "electron.*claude-orka"
1688
+
1689
+ # Try again
1690
+ orka session resume <session-id>
1691
+ ```
1692
+
1693
+ ---
1694
+
1695
+ #### Multiple sessions conflict
1696
+
1697
+ **Error:** Fork creation blocked
1698
+
1699
+ **Reason:** Claude Code limitation - only one fork per branch
1700
+
1701
+ **Solution:**
1702
+ ```bash
1703
+ # Merge or close existing fork first
1704
+ orka merge auto <session-id> <existing-fork-id>
1705
+
1706
+ # Or close it
1707
+ orka fork close <session-id> <existing-fork-id>
1708
+
1709
+ # Then create new fork
1710
+ orka fork create <session-id> "New Fork"
1711
+ ```
1712
+
1713
+ ---
1714
+
1715
+ ### Debug Mode
1716
+
1717
+ Enable debug logging:
1718
+
1719
+ ```bash
1720
+ # Set environment variable
1721
+ export CLAUDE_ORKA_DEBUG=1
1722
+
1723
+ # Run command
1724
+ orka session create
1725
+
1726
+ # Check logs
1727
+ cat .claude-orka/orka.log
1728
+ ```
1729
+
1730
+ ---
1731
+
1732
+ ### Getting Help
1733
+
1734
+ ```bash
1735
+ # Check system status
1736
+ orka doctor
1737
+
1738
+ # Get help for command
1739
+ orka session create --help
1740
+
1741
+ # View version
1742
+ orka --version
1743
+ ```
1744
+
1745
+ ---
1746
+
1747
+ ## Contributing
1748
+
1749
+ Contributions are welcome! Please feel free to submit a Pull Request.
1750
+
1751
+ **Areas for contribution:**
1752
+ - Windows support
1753
+ - Additional terminal emulators
1754
+ - UI enhancements
1755
+ - Documentation improvements
1756
+ - Bug fixes
1757
+
1758
+ ---
1759
+
1760
+ ## License
1761
+
1762
+ MIT © enruana
1763
+
1764
+ ---
260
1765
 
261
1766
  ## Links
262
1767