ctx-switch 2.0.0
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/CONTRIBUTING.md +76 -0
- package/LICENSE +21 -0
- package/README.cc-continue.md +131 -0
- package/README.ctx-switch.md +142 -0
- package/README.md +193 -0
- package/dist/index.mjs +2021 -0
- package/package.json +59 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributing to cc-continue
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in contributing!
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repo
|
|
8
|
+
2. Clone your fork:
|
|
9
|
+
```bash
|
|
10
|
+
git clone git@github.com:YOUR_USERNAME/cc-continue.git
|
|
11
|
+
cd cc-continue
|
|
12
|
+
```
|
|
13
|
+
3. Link it locally for testing:
|
|
14
|
+
```bash
|
|
15
|
+
npm link
|
|
16
|
+
```
|
|
17
|
+
4. Make your changes
|
|
18
|
+
5. Test by running `cc-continue` in a project directory where you've used Claude Code
|
|
19
|
+
|
|
20
|
+
## Development
|
|
21
|
+
|
|
22
|
+
This is a zero-dependency CLI tool built on Node.js built-ins. Keep it dependency-free unless there is a strong reason not to.
|
|
23
|
+
|
|
24
|
+
### Project Structure
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
index.js # CLI entrypoint
|
|
28
|
+
src/ # Internal modules
|
|
29
|
+
test/ # Node test suite + fixtures
|
|
30
|
+
package.json
|
|
31
|
+
README.md
|
|
32
|
+
LICENSE
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Testing Your Changes
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Run the automated test suite
|
|
39
|
+
npm test
|
|
40
|
+
|
|
41
|
+
# Smoke test the CLI help
|
|
42
|
+
npm run smoke:help
|
|
43
|
+
|
|
44
|
+
# Check environment diagnostics
|
|
45
|
+
cc-continue doctor
|
|
46
|
+
|
|
47
|
+
# Inspect local sessions for the current project
|
|
48
|
+
cc-continue sessions
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Guidelines
|
|
52
|
+
|
|
53
|
+
- **Zero dependencies** — everything should use Node.js built-ins
|
|
54
|
+
- **Don't break `--raw`** — the raw fallback must always work without a network call
|
|
55
|
+
- **Keep fixtures realistic** — parser changes should be backed by JSONL fixtures from real Claude session shapes
|
|
56
|
+
- **Preserve CLI ergonomics** — help text, error messages, and diagnostics are part of the product
|
|
57
|
+
|
|
58
|
+
## Submitting a PR
|
|
59
|
+
|
|
60
|
+
1. Create a branch: `git checkout -b my-feature`
|
|
61
|
+
2. Make your changes
|
|
62
|
+
3. Run `npm test`
|
|
63
|
+
4. Smoke test `cc-continue --raw` in a real Claude project if your change touches parsing or prompt generation
|
|
64
|
+
4. Push and open a PR
|
|
65
|
+
|
|
66
|
+
## Ideas for Contributions
|
|
67
|
+
|
|
68
|
+
- Additional provider adapters beyond OpenRouter
|
|
69
|
+
- Session browsing and selection UX
|
|
70
|
+
- Support for other session formats (Cursor, Windsurf, etc.)
|
|
71
|
+
- Better large-session summarization strategies
|
|
72
|
+
- JSON output modes for other automation workflows
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Harshit
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# cc-continue
|
|
2
|
+
|
|
3
|
+
> **This package is being renamed to [`ctx-switch`](https://www.npmjs.com/package/ctx-switch).** Install `ctx-switch` for the latest version. `cc-continue` will continue to work but will no longer receive updates.
|
|
4
|
+
|
|
5
|
+
Switch context between AI coding agents. Extract sessions from **Claude Code**, **Codex**, or **OpenCode** and generate a handoff prompt you can paste into any other AI agent to keep going.
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
You're deep in a coding session — the agent is editing files, running commands, making progress — and then:
|
|
10
|
+
|
|
11
|
+
> **Usage limit reached. Please wait before sending more messages.**
|
|
12
|
+
|
|
13
|
+
Your work is half-done. You can't continue. You switch to another AI agent but now you have to explain everything from scratch.
|
|
14
|
+
|
|
15
|
+
## The Solution
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx cc-continue
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Pick your source agent, and it reads the session, captures the current git state, and produces a structured continuation prompt that another agent can pick up immediately.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Multi-source**: Extract sessions from Claude Code, Codex, or OpenCode
|
|
26
|
+
- **Interactive picker**: Choose your source agent, or pass `--source claude|codex|opencode`
|
|
27
|
+
- **Smart session discovery**: Finds the latest session for the current project directory
|
|
28
|
+
- Filters noise from user messages (confirmations, short replies, interruptions)
|
|
29
|
+
- Tracks only **unresolved** errors — skips errors that were later fixed
|
|
30
|
+
- Captures recent commits, committed diffs, staged/unstaged changes, and untracked files
|
|
31
|
+
- Extracts key decisions and pivots from the previous agent
|
|
32
|
+
- Produces a priority-ordered prompt: Task → Errors → Decisions → Completed Work → Current State → Instructions
|
|
33
|
+
- Supports target-specific prompts with `--target codex|cursor|chatgpt|generic`
|
|
34
|
+
- Auto-copies to clipboard on macOS, Linux, and Windows
|
|
35
|
+
- Optional LLM refinement via `--refine` (uses OpenRouter)
|
|
36
|
+
- `sessions` command to list recent sessions
|
|
37
|
+
- `doctor` command for diagnostics
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Recommended: use the new package name
|
|
43
|
+
npm i -g ctx-switch
|
|
44
|
+
|
|
45
|
+
# Or the legacy name (still works)
|
|
46
|
+
npm i -g cc-continue
|
|
47
|
+
npx cc-continue
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cd my-project
|
|
54
|
+
|
|
55
|
+
# Interactive source picker (choose Claude/Codex/OpenCode)
|
|
56
|
+
cc-continue
|
|
57
|
+
|
|
58
|
+
# Specify the source directly
|
|
59
|
+
cc-continue --source claude
|
|
60
|
+
cc-continue --source codex
|
|
61
|
+
cc-continue --source opencode
|
|
62
|
+
|
|
63
|
+
# Target a specific agent for the output prompt
|
|
64
|
+
cc-continue --source claude --target codex
|
|
65
|
+
|
|
66
|
+
# Refine via OpenRouter LLM (optional)
|
|
67
|
+
cc-continue --refine
|
|
68
|
+
|
|
69
|
+
# List recent sessions
|
|
70
|
+
cc-continue sessions --source claude --limit 5
|
|
71
|
+
|
|
72
|
+
# Write to a file
|
|
73
|
+
cc-continue --output ./handoff.md
|
|
74
|
+
|
|
75
|
+
# Run diagnostics
|
|
76
|
+
cc-continue doctor --source codex
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### LLM Refinement (Optional)
|
|
80
|
+
|
|
81
|
+
If you want the prompt refined by an LLM, use `--refine`. On first use, it'll ask for your OpenRouter API key:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
Enter your OpenRouter API key: sk-or-v1-...
|
|
85
|
+
Saved to ~/.ctx-switch.json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Get a free key at [openrouter.ai/keys](https://openrouter.ai/keys). You can also set it via environment variable:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Key Flags
|
|
95
|
+
|
|
96
|
+
- `--source <name>` Session source: `claude`, `codex`, or `opencode` (interactive if omitted)
|
|
97
|
+
- `--target <name>` Tailor the prompt for `generic`, `codex`, `cursor`, or `chatgpt`
|
|
98
|
+
- `--output <file>` Write the prompt to a file
|
|
99
|
+
- `--session <id|path>` Use a specific session
|
|
100
|
+
- `--refine` Refine the prompt via an LLM provider
|
|
101
|
+
- `--provider <name>` Refinement provider (default: `openrouter`)
|
|
102
|
+
- `--model <name>` Override the provider model (default: `openrouter/free`)
|
|
103
|
+
- `--api-key <key>` Override the API key for a single run
|
|
104
|
+
|
|
105
|
+
## Session Storage
|
|
106
|
+
|
|
107
|
+
| Source | Storage | Format |
|
|
108
|
+
|--------|---------|--------|
|
|
109
|
+
| Claude Code | `~/.claude/projects/<encoded-cwd>/*.jsonl` | JSONL |
|
|
110
|
+
| Codex | `~/.codex/sessions/<year>/<month>/<day>/*.jsonl` | JSONL |
|
|
111
|
+
| OpenCode | `~/.local/share/opencode/opencode.db` | SQLite |
|
|
112
|
+
|
|
113
|
+
## Requirements
|
|
114
|
+
|
|
115
|
+
- **Node.js** >= 18
|
|
116
|
+
- **At least one of**: Claude Code, Codex, or OpenCode (must have been used in the current directory)
|
|
117
|
+
- **sqlite3** (only needed for OpenCode sessions)
|
|
118
|
+
- **OpenRouter API key** (only needed with `--refine`)
|
|
119
|
+
|
|
120
|
+
## Migrating to ctx-switch
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm uninstall -g cc-continue
|
|
124
|
+
npm i -g ctx-switch
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Both `ctx-switch` and `cc-continue` commands work after installing either package.
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# ctx-switch
|
|
2
|
+
|
|
3
|
+
> Formerly `cc-continue` — existing installs still work, just use `ctx-switch` going forward.
|
|
4
|
+
|
|
5
|
+
Switch context between AI coding agents. Extract sessions from **Claude Code**, **Codex**, or **OpenCode** and generate a handoff prompt you can paste into any other AI agent to keep going.
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
You're deep in a coding session — the agent is editing files, running commands, making progress — and then:
|
|
10
|
+
|
|
11
|
+
> **Usage limit reached. Please wait before sending more messages.**
|
|
12
|
+
|
|
13
|
+
Your work is half-done. You can't continue. You switch to another AI agent but now you have to explain everything from scratch.
|
|
14
|
+
|
|
15
|
+
## The Solution
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx ctx-switch
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Pick your source agent, and it reads the session, captures the current git state, and produces a structured continuation prompt that another agent can pick up immediately.
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
- **Multi-source**: Extract sessions from Claude Code, Codex, or OpenCode
|
|
26
|
+
- **Interactive picker**: Choose your source agent, or pass `--source claude|codex|opencode`
|
|
27
|
+
- **Smart session discovery**: Finds the latest session for the current project directory
|
|
28
|
+
- Filters noise from user messages (confirmations, short replies, interruptions)
|
|
29
|
+
- Tracks only **unresolved** errors — skips errors that were later fixed
|
|
30
|
+
- Captures recent commits, committed diffs, staged/unstaged changes, and untracked files
|
|
31
|
+
- Extracts key decisions and pivots from the previous agent
|
|
32
|
+
- Produces a priority-ordered prompt: Task → Errors → Decisions → Completed Work → Current State → Instructions
|
|
33
|
+
- Supports target-specific prompts with `--target codex|cursor|chatgpt|generic`
|
|
34
|
+
- Auto-copies to clipboard on macOS, Linux, and Windows
|
|
35
|
+
- Optional LLM refinement via `--refine` (uses OpenRouter)
|
|
36
|
+
- `sessions` command to list recent sessions
|
|
37
|
+
- `doctor` command for diagnostics
|
|
38
|
+
|
|
39
|
+
## How It Works
|
|
40
|
+
|
|
41
|
+
1. You pick the source agent (Claude Code, Codex, or OpenCode)
|
|
42
|
+
2. Finds the most recent session for your current project directory
|
|
43
|
+
3. Parses the conversation — user messages, tool calls, errors, and results
|
|
44
|
+
4. Captures the current git state: branch, commits, diffs, untracked files
|
|
45
|
+
5. Builds a structured prompt optimized for agent handoff
|
|
46
|
+
6. Copies to clipboard and prints to stdout
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Run directly (no install needed)
|
|
52
|
+
npx ctx-switch
|
|
53
|
+
|
|
54
|
+
# Or install globally
|
|
55
|
+
npm i -g ctx-switch
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cd my-project
|
|
62
|
+
|
|
63
|
+
# Interactive source picker (choose Claude/Codex/OpenCode)
|
|
64
|
+
ctx-switch
|
|
65
|
+
|
|
66
|
+
# Specify the source directly
|
|
67
|
+
ctx-switch --source claude
|
|
68
|
+
ctx-switch --source codex
|
|
69
|
+
ctx-switch --source opencode
|
|
70
|
+
|
|
71
|
+
# Target a specific agent for the output prompt
|
|
72
|
+
ctx-switch --source claude --target codex
|
|
73
|
+
|
|
74
|
+
# Pick a specific session
|
|
75
|
+
ctx-switch --source claude --session 4474da94-50a9-40de-9afe-c6c73acf2401
|
|
76
|
+
|
|
77
|
+
# Refine via OpenRouter LLM (optional)
|
|
78
|
+
ctx-switch --refine
|
|
79
|
+
|
|
80
|
+
# List recent sessions
|
|
81
|
+
ctx-switch sessions --source claude --limit 5
|
|
82
|
+
|
|
83
|
+
# Write to a file
|
|
84
|
+
ctx-switch --output ./handoff.md
|
|
85
|
+
|
|
86
|
+
# Run diagnostics
|
|
87
|
+
ctx-switch doctor --source codex
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### LLM Refinement (Optional)
|
|
91
|
+
|
|
92
|
+
If you want the prompt refined by an LLM, use `--refine`. On first use, it'll ask for your OpenRouter API key:
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
Enter your OpenRouter API key: sk-or-v1-...
|
|
96
|
+
Saved to ~/.ctx-switch.json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Get a free key at [openrouter.ai/keys](https://openrouter.ai/keys). You can also set it via environment variable:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Key Flags
|
|
106
|
+
|
|
107
|
+
- `--source <name>` Session source: `claude`, `codex`, or `opencode` (interactive if omitted)
|
|
108
|
+
- `--target <name>` Tailor the prompt for `generic`, `codex`, `cursor`, or `chatgpt`
|
|
109
|
+
- `--output <file>` Write the prompt to a file
|
|
110
|
+
- `--session <id|path>` Use a specific session
|
|
111
|
+
- `--refine` Refine the prompt via an LLM provider
|
|
112
|
+
- `--provider <name>` Refinement provider (default: `openrouter`)
|
|
113
|
+
- `--model <name>` Override the provider model (default: `openrouter/free`)
|
|
114
|
+
- `--api-key <key>` Override the API key for a single run
|
|
115
|
+
|
|
116
|
+
## Session Storage
|
|
117
|
+
|
|
118
|
+
| Source | Storage | Format |
|
|
119
|
+
|--------|---------|--------|
|
|
120
|
+
| Claude Code | `~/.claude/projects/<encoded-cwd>/*.jsonl` | JSONL |
|
|
121
|
+
| Codex | `~/.codex/sessions/<year>/<month>/<day>/*.jsonl` | JSONL |
|
|
122
|
+
| OpenCode | `~/.local/share/opencode/opencode.db` | SQLite |
|
|
123
|
+
|
|
124
|
+
## Requirements
|
|
125
|
+
|
|
126
|
+
- **Node.js** >= 18
|
|
127
|
+
- **At least one of**: Claude Code, Codex, or OpenCode (must have been used in the current directory)
|
|
128
|
+
- **sqlite3** (only needed for OpenCode sessions)
|
|
129
|
+
- **OpenRouter API key** (only needed with `--refine`)
|
|
130
|
+
|
|
131
|
+
## Migrating from cc-continue
|
|
132
|
+
|
|
133
|
+
`cc-continue` still works — it's an alias for `ctx-switch`. You'll see a one-line deprecation notice reminding you to switch. No other changes needed.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
npm uninstall -g cc-continue
|
|
137
|
+
npm i -g ctx-switch
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
MIT
|
package/README.md
ADDED
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# ctx-switch
|
|
2
|
+
|
|
3
|
+
> Formerly `cc-continue` — existing installs still work, just use `ctx-switch` going forward.
|
|
4
|
+
|
|
5
|
+
**Switch coding agents without losing context.**
|
|
6
|
+
Agent handoff for Claude Code, Codex, and OpenCode.
|
|
7
|
+
|
|
8
|
+
## Why this exists
|
|
9
|
+
|
|
10
|
+
You're in the middle of a coding session. Things are working. Progress is being made.
|
|
11
|
+
|
|
12
|
+
And then you need to switch.
|
|
13
|
+
|
|
14
|
+
- Maybe the session can't continue
|
|
15
|
+
- Maybe something isn't working as expected
|
|
16
|
+
- Maybe you just want to move to another agent
|
|
17
|
+
|
|
18
|
+
Now you're stuck.
|
|
19
|
+
|
|
20
|
+
You switch to another agent — but:
|
|
21
|
+
|
|
22
|
+
- it has no context
|
|
23
|
+
- you have to explain everything again
|
|
24
|
+
- you lose momentum
|
|
25
|
+
|
|
26
|
+
**Your work shouldn't reset just because you switched tools.**
|
|
27
|
+
|
|
28
|
+
## What ctx-switch does
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx ctx-switch
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
It captures your current session — code, context, decisions, errors — and generates a clean, structured handoff prompt so another agent can continue immediately.
|
|
35
|
+
|
|
36
|
+
No re-explaining.
|
|
37
|
+
No rebuilding context.
|
|
38
|
+
No wasted time.
|
|
39
|
+
|
|
40
|
+
**Just continue where you left off.**
|
|
41
|
+
|
|
42
|
+
### Core idea
|
|
43
|
+
|
|
44
|
+
> Switch agents. Don't restart.
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Multi-agent support**: Claude Code, Codex, OpenCode
|
|
49
|
+
- **Smart session detection**: Finds the latest session for your current project
|
|
50
|
+
- **Context extraction**:
|
|
51
|
+
- Filters noise (confirmations, filler)
|
|
52
|
+
- Keeps only relevant context
|
|
53
|
+
- **Error awareness**:
|
|
54
|
+
- Includes unresolved errors
|
|
55
|
+
- Skips already-fixed issues
|
|
56
|
+
- **Codebase state capture**:
|
|
57
|
+
- Recent commits
|
|
58
|
+
- Diffs (staged & unstaged)
|
|
59
|
+
- Untracked files
|
|
60
|
+
- **Decision tracking**:
|
|
61
|
+
- Extracts key decisions and pivots
|
|
62
|
+
- **Structured output**:
|
|
63
|
+
- Task → Errors → Decisions → Completed Work → Current State → Instructions
|
|
64
|
+
- **Target-aware prompts**:
|
|
65
|
+
- `codex`, `cursor`, `chatgpt`, or `generic`
|
|
66
|
+
- **Clipboard ready**: Auto-copy across macOS, Linux, Windows
|
|
67
|
+
- **Optional LLM refinement** (`--refine`)
|
|
68
|
+
- `sessions` command to browse recent sessions
|
|
69
|
+
- `doctor` command for diagnostics
|
|
70
|
+
|
|
71
|
+
## How it works
|
|
72
|
+
|
|
73
|
+
1. Select your source agent (Claude / Codex / OpenCode)
|
|
74
|
+
2. `ctx-switch` finds the latest session for your project
|
|
75
|
+
3. Parses:
|
|
76
|
+
- conversation
|
|
77
|
+
- tool calls
|
|
78
|
+
- errors
|
|
79
|
+
4. Captures git state:
|
|
80
|
+
- branch
|
|
81
|
+
- commits
|
|
82
|
+
- diffs
|
|
83
|
+
5. Builds a structured handoff prompt
|
|
84
|
+
6. Copies it to clipboard and prints it
|
|
85
|
+
|
|
86
|
+
## Install
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run instantly
|
|
90
|
+
npx ctx-switch
|
|
91
|
+
|
|
92
|
+
# Or install globally
|
|
93
|
+
npm i -g ctx-switch
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Usage
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd my-project
|
|
100
|
+
|
|
101
|
+
# Interactive mode
|
|
102
|
+
ctx-switch
|
|
103
|
+
|
|
104
|
+
# Specify source
|
|
105
|
+
ctx-switch --source claude
|
|
106
|
+
ctx-switch --source codex
|
|
107
|
+
ctx-switch --source opencode
|
|
108
|
+
|
|
109
|
+
# Target a specific agent
|
|
110
|
+
ctx-switch --source claude --target codex
|
|
111
|
+
|
|
112
|
+
# Use a specific session
|
|
113
|
+
ctx-switch --source claude --session <id>
|
|
114
|
+
|
|
115
|
+
# Refine output with LLM
|
|
116
|
+
ctx-switch --refine
|
|
117
|
+
|
|
118
|
+
# List sessions
|
|
119
|
+
ctx-switch sessions --source claude --limit 5
|
|
120
|
+
|
|
121
|
+
# Save to a file
|
|
122
|
+
ctx-switch --output ./handoff.md
|
|
123
|
+
|
|
124
|
+
# Run diagnostics
|
|
125
|
+
ctx-switch doctor --source codex
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Example use cases
|
|
129
|
+
|
|
130
|
+
- Continue work in another agent when switching is needed
|
|
131
|
+
- Move a session across tools without re-explaining everything
|
|
132
|
+
- Resume work seamlessly in a different environment
|
|
133
|
+
- Preserve context when changing workflows
|
|
134
|
+
|
|
135
|
+
## LLM Refinement (Optional)
|
|
136
|
+
|
|
137
|
+
Use `--refine` to improve the generated prompt via an LLM.
|
|
138
|
+
|
|
139
|
+
On first use:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Enter your OpenRouter API key: sk-or-v1-...
|
|
143
|
+
Saved to ~/.ctx-switch.json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Get a key: [openrouter.ai/keys](https://openrouter.ai/keys)
|
|
147
|
+
|
|
148
|
+
Or set manually:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Key Flags
|
|
155
|
+
|
|
156
|
+
| Flag | Description |
|
|
157
|
+
|------|-------------|
|
|
158
|
+
| `--source <name>` | `claude`, `codex`, `opencode` |
|
|
159
|
+
| `--target <name>` | `generic`, `codex`, `cursor`, `chatgpt` |
|
|
160
|
+
| `--output <file>` | Save prompt |
|
|
161
|
+
| `--session <id\|path>` | Use specific session |
|
|
162
|
+
| `--refine` | Refine prompt via LLM |
|
|
163
|
+
| `--provider` | Refinement provider (default: `openrouter`) |
|
|
164
|
+
| `--model` | Override model |
|
|
165
|
+
| `--api-key` | Override API key |
|
|
166
|
+
|
|
167
|
+
## Session Storage
|
|
168
|
+
|
|
169
|
+
| Source | Storage Path | Format |
|
|
170
|
+
|--------|-------------|--------|
|
|
171
|
+
| Claude Code | `~/.claude/projects/<encoded-cwd>/*.jsonl` | JSONL |
|
|
172
|
+
| Codex | `~/.codex/sessions/<year>/<month>/<day>/*.jsonl` | JSONL |
|
|
173
|
+
| OpenCode | `~/.local/share/opencode/opencode.db` | SQLite |
|
|
174
|
+
|
|
175
|
+
## Requirements
|
|
176
|
+
|
|
177
|
+
- **Node.js** >= 18
|
|
178
|
+
- **Claude Code, Codex, or OpenCode** (used in current directory)
|
|
179
|
+
- **sqlite3** (only for OpenCode sessions)
|
|
180
|
+
- **OpenRouter API key** (only if using `--refine`)
|
|
181
|
+
|
|
182
|
+
## Migrating from cc-continue
|
|
183
|
+
|
|
184
|
+
`cc-continue` still works — it's now an alias for `ctx-switch`.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npm uninstall -g cc-continue
|
|
188
|
+
npm i -g ctx-switch
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
MIT
|