nodehop 0.2.0__tar.gz
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.
- nodehop-0.2.0/LICENSE +21 -0
- nodehop-0.2.0/PKG-INFO +261 -0
- nodehop-0.2.0/README.md +232 -0
- nodehop-0.2.0/nodehop/__init__.py +3 -0
- nodehop-0.2.0/nodehop/__main__.py +3 -0
- nodehop-0.2.0/nodehop/cli.py +807 -0
- nodehop-0.2.0/nodehop/config.py +183 -0
- nodehop-0.2.0/nodehop/core.py +642 -0
- nodehop-0.2.0/nodehop/deploy.py +205 -0
- nodehop-0.2.0/nodehop/doctor.py +285 -0
- nodehop-0.2.0/nodehop/gui.py +338 -0
- nodehop-0.2.0/nodehop/hooks.py +193 -0
- nodehop-0.2.0/nodehop/icon.py +148 -0
- nodehop-0.2.0/nodehop/modules/__init__.py +26 -0
- nodehop-0.2.0/nodehop/modules/base.py +214 -0
- nodehop-0.2.0/nodehop/modules/claude_code.py +309 -0
- nodehop-0.2.0/nodehop/modules/codex.py +209 -0
- nodehop-0.2.0/nodehop/modules/command.py +81 -0
- nodehop-0.2.0/nodehop/onboard.py +210 -0
- nodehop-0.2.0/nodehop/pairing.py +217 -0
- nodehop-0.2.0/nodehop/runner.py +72 -0
- nodehop-0.2.0/nodehop/state.py +120 -0
- nodehop-0.2.0/nodehop/system.py +41 -0
- nodehop-0.2.0/nodehop/train.py +200 -0
- nodehop-0.2.0/nodehop/transport.py +107 -0
- nodehop-0.2.0/nodehop/ui.py +140 -0
- nodehop-0.2.0/nodehop/uninstall.py +145 -0
- nodehop-0.2.0/nodehop.egg-info/PKG-INFO +261 -0
- nodehop-0.2.0/nodehop.egg-info/SOURCES.txt +33 -0
- nodehop-0.2.0/nodehop.egg-info/dependency_links.txt +1 -0
- nodehop-0.2.0/nodehop.egg-info/entry_points.txt +2 -0
- nodehop-0.2.0/nodehop.egg-info/top_level.txt +1 -0
- nodehop-0.2.0/pyproject.toml +41 -0
- nodehop-0.2.0/setup.cfg +4 -0
- nodehop-0.2.0/tests/test_nodehop.py +1517 -0
nodehop-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BuildRunnerFr
|
|
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.
|
nodehop-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nodehop
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Close your laptop, your agents keep working: hand off Claude Code sessions and training jobs between your machines.
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://github.com/BuildRunnerFr/NodeHop
|
|
7
|
+
Project-URL: Issues, https://github.com/BuildRunnerFr/NodeHop/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/BuildRunnerFr/NodeHop/blob/main/CHANGELOG.md
|
|
9
|
+
Keywords: claude-code,ai-agents,handoff,tmux,ssh,tailscale,machine-learning,checkpoint
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Software Development
|
|
24
|
+
Classifier: Topic :: System :: Distributed Computing
|
|
25
|
+
Requires-Python: >=3.9
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="https://raw.githubusercontent.com/BuildRunnerFr/NodeHop/main/docs/logo.png" width="112" alt="NodeHop logo">
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">NodeHop</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center">
|
|
37
|
+
<b>Close your laptop. Your agents keep working.</b><br>
|
|
38
|
+
<sub>Hands Claude Code and Codex sessions from your laptop to an always-on Mac or Linux box, and back.</sub>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="https://github.com/BuildRunnerFr/NodeHop/actions/workflows/tests.yml"><img src="https://github.com/BuildRunnerFr/NodeHop/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
43
|
+
<img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="Python 3.9+">
|
|
44
|
+
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey" alt="macOS | Linux">
|
|
45
|
+
<img src="https://img.shields.io/badge/dependencies-none-brightgreen" alt="No dependencies">
|
|
46
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT license"></a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
NodeHop hands running work from your laptop to an always-on machine, and back.
|
|
52
|
+
Close the lid while Claude Code or Codex is in the middle of a task: the
|
|
53
|
+
session is stopped, copied to your Mac mini or Linux box, and resumed there with
|
|
54
|
+
the same conversation. Open the lid: your laptop takes it back. Training jobs work the
|
|
55
|
+
same way, resuming from their last checkpoint at the other machine's pace.
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
laptop (primary) always-on machine (server)
|
|
59
|
+
──────────────── ──────────────────────────
|
|
60
|
+
lid closes ─► stop the agent
|
|
61
|
+
copy project + conversation ──────► resume it, same conversation
|
|
62
|
+
lid opens ─► ask the server to stop
|
|
63
|
+
copy everything back ◄─────────────
|
|
64
|
+
resume it here
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Highlights
|
|
68
|
+
|
|
69
|
+
- **Your agents never stop** — Claude Code and Codex sessions (conversation
|
|
70
|
+
included) and long commands such as training jobs move between machines and
|
|
71
|
+
resume.
|
|
72
|
+
- **Set up by an agent, from one machine** — it asks you a few questions and
|
|
73
|
+
installs NodeHop on the other machine over SSH. No agent needed over there.
|
|
74
|
+
- **The laptop needs no SSH server** — it pushes work when it sleeps and pulls it
|
|
75
|
+
back when it wakes; only the always-on machine accepts connections.
|
|
76
|
+
- **Safe on slow networks** — transfers are all-or-nothing; if the newest state
|
|
77
|
+
cannot be sent before sleep, the server resumes from its last complete copy.
|
|
78
|
+
- **Fallback** — if the laptop dies without going to sleep, the server resumes
|
|
79
|
+
the work in progress after 2 minutes.
|
|
80
|
+
- **You decide conflicts** — if two agents worked in parallel, a native window
|
|
81
|
+
shows what each one did and lets you pick (the other version is kept).
|
|
82
|
+
- **A Mac mini or a Linux server takes over** — the always-on machine can be a
|
|
83
|
+
Mac or a Linux box, with or without a screen.
|
|
84
|
+
- **Paths may differ** — different user names and folders on each machine.
|
|
85
|
+
- **Zero dependencies** — Python 3.9+ standard library, `ssh`, `rsync`, `tmux`.
|
|
86
|
+
|
|
87
|
+
## Before you start
|
|
88
|
+
|
|
89
|
+
NodeHop does almost everything itself. You only prepare three things, once,
|
|
90
|
+
on **both machines**:
|
|
91
|
+
|
|
92
|
+
1. **Your agent, installed and signed in.** NodeHop is built for Claude Code
|
|
93
|
+
first, and Codex works the same way: use either, or both. Install it on each
|
|
94
|
+
machine, sign in with your account, and open it once (`claude`, then its
|
|
95
|
+
first screens). NodeHop never moves your login from one machine to the other.
|
|
96
|
+
2. **SSH on the always-on machine.** macOS: System Settings › General › Sharing ›
|
|
97
|
+
Remote Login. Linux: `sudo apt install -y openssh-server`. The laptop needs no
|
|
98
|
+
SSH server. When asked, you type that machine's password once into
|
|
99
|
+
`ssh-copy-id`.
|
|
100
|
+
3. **[Tailscale](https://tailscale.com) on both machines**, signed in to the
|
|
101
|
+
same account, so they find each other at home and away (recommended; a
|
|
102
|
+
local network works too).
|
|
103
|
+
|
|
104
|
+
That's all. Installing NodeHop on the other machine, pairing both machines and
|
|
105
|
+
hooking into sleep and wake are done for you.
|
|
106
|
+
|
|
107
|
+
## Get started
|
|
108
|
+
|
|
109
|
+
### With an agent (recommended)
|
|
110
|
+
|
|
111
|
+
Ask your coding agent (Claude Code or any other), on your laptop:
|
|
112
|
+
|
|
113
|
+
> Install NodeHop from https://github.com/BuildRunnerFr/NodeHop by following its AGENT_SETUP.md.
|
|
114
|
+
|
|
115
|
+
It installs NodeHop, asks you whether this is the laptop or the always-on
|
|
116
|
+
machine, which machine is the other one (your Tailscale machines are offered),
|
|
117
|
+
and which project to protect, then sets up both machines. All you may have to
|
|
118
|
+
do: type the other machine's password once into `ssh-copy-id`, and run anything
|
|
119
|
+
that needs `sudo`. Details for agents: [AGENT_SETUP.md](AGENT_SETUP.md).
|
|
120
|
+
|
|
121
|
+
### By hand
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
pipx install git+https://github.com/BuildRunnerFr/NodeHop
|
|
125
|
+
nodehop onboard # the same questions, with arrow-key menus
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Daily use
|
|
129
|
+
|
|
130
|
+
```sh
|
|
131
|
+
cd ~/code/my-app
|
|
132
|
+
nodehop on # protect this project (Claude Code; --agent codex for Codex)
|
|
133
|
+
nodehop start my-app # run its agent, inside NodeHop's tmux
|
|
134
|
+
nodehop attach my-app # open its terminal (detach: Ctrl-b d)
|
|
135
|
+
nodehop status # where each project runs right now
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Then just close the lid. A few more:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
nodehop handoff --to server # hand off now, without closing the lid
|
|
142
|
+
nodehop pull my-app # bring a project back here
|
|
143
|
+
nodehop resolve # two agents worked in parallel: choose
|
|
144
|
+
nodehop doctor # check everything, with fixes
|
|
145
|
+
nodehop -n handoff # dry run: print every command, change nothing
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Training jobs
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
nodehop on ~/code/my-model --command ".venv/bin/python train.py"
|
|
152
|
+
nodehop start my-model
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
With `from nodehop import train` (standard library, PyTorch optional) a script
|
|
156
|
+
saves a checkpoint and exits cleanly when NodeHop stops it, resumes from it on
|
|
157
|
+
the other machine, and picks a micro-batch that fits that machine's memory —
|
|
158
|
+
gradient accumulation keeps the effective batch, and so the training, identical.
|
|
159
|
+
A 40,000-step run moved between a MacBook (128 × 4) and a Mac mini (64 × 8)
|
|
160
|
+
with the same loss curve. See [examples/train_relay.py](examples/train_relay.py).
|
|
161
|
+
|
|
162
|
+
## How it works
|
|
163
|
+
|
|
164
|
+
| When | What NodeHop does |
|
|
165
|
+
| --- | --- |
|
|
166
|
+
| Every 30 s | The laptop tells the server it is alive; every 5 min it also copies the active projects there. |
|
|
167
|
+
| Lid closes | Stop the agent (Claude Code quits in ~1 s; a training job saves a checkpoint), copy what changed, resume it on the server. Budget: ~22 s, because macOS sleeps soon after. |
|
|
168
|
+
| Lid opens | Ask the server to stop, copy everything back, resume here. Retries while the network comes back. |
|
|
169
|
+
| Laptop silent 2 min without sleeping | The server resumes, from the last copy, the work that was in progress. |
|
|
170
|
+
| Laptop back, both agents worked | The server's agent is paused and you choose which version to keep. |
|
|
171
|
+
|
|
172
|
+
Agents run in NodeHop's own tmux server, so they keep running with no terminal
|
|
173
|
+
open and can be stopped cleanly. A resumed Claude Code gets a short "carry on"
|
|
174
|
+
message only if it was in the middle of something; an idle one is just reopened.
|
|
175
|
+
|
|
176
|
+
## Requirements
|
|
177
|
+
|
|
178
|
+
| | The machine you work on (primary) | The always-on machine (server) |
|
|
179
|
+
| --- | --- | --- |
|
|
180
|
+
| System | a Mac, usually a laptop | a Mac (e.g. a Mac mini) or a Linux server, headless is fine |
|
|
181
|
+
| Needs | Python 3.9+ (the system one works), `rsync`, `tmux`, and your agent (Claude Code and/or Codex) signed in | the same, plus an SSH server (Remote Login on macOS; `openssh-server` on Linux) |
|
|
182
|
+
| Notes | [SleepWatcher](https://www.bernhard-baehr.de/), installed for you by `nodehop onboard` | Mac: keep a user session open (automatic login) so agents can read the login keychain. Linux: `loginctl enable-linger` so agents keep running with nobody logged in |
|
|
183
|
+
|
|
184
|
+
- **[Tailscale](https://tailscale.com)** recommended, so it also works away
|
|
185
|
+
from home.
|
|
186
|
+
|
|
187
|
+
A Linux machine can also be the primary (a systemd sleep hook replaces
|
|
188
|
+
SleepWatcher), but that setup is less tested.
|
|
189
|
+
|
|
190
|
+
## Configuration
|
|
191
|
+
|
|
192
|
+
`nodehop config get` shows everything; `nodehop config set <key> <value>`
|
|
193
|
+
changes it. The useful ones:
|
|
194
|
+
|
|
195
|
+
| Key | Default | Meaning |
|
|
196
|
+
| --- | --- | --- |
|
|
197
|
+
| `presync_seconds` | `300` | how often active projects are copied to the server |
|
|
198
|
+
| `failover_minutes` | `2` | server: resume the laptop's work after this much silence (`0` = off) |
|
|
199
|
+
| `sleep_budget_seconds` | `22` | time allowed to hand off when the lid closes |
|
|
200
|
+
| `unattended` | unset (asked) | how a resumed agent handles permission prompts with nobody there: `auto` (Claude Code's auto mode; Codex sandboxed to the project), `acceptEdits`, or `default` |
|
|
201
|
+
| `remote_control` | `false` | show NodeHop's Claude Code sessions in the Claude app, to follow and answer them from anywhere |
|
|
202
|
+
| `backups_keep` | `5` | versions set aside after a fallback or conflict, kept per project |
|
|
203
|
+
| `excludes` | `node_modules`, `.venv`, … | never copied (rebuild them on each machine) |
|
|
204
|
+
| `workspace` | unset | where received projects go (unset: same place relative to the home folder) |
|
|
205
|
+
| `claude_args` / `codex_args` | `[]` | extra flags for Claude Code / Codex (e.g. `["-c", "model=\"…\""]`) |
|
|
206
|
+
|
|
207
|
+
## FAQ
|
|
208
|
+
|
|
209
|
+
**Does the other machine need an agent to be set up?** No. The agent on your
|
|
210
|
+
laptop installs and configures NodeHop over there through SSH. Claude Code (or
|
|
211
|
+
Codex) must simply be installed and signed in there too, since that machine
|
|
212
|
+
runs your agent while the laptop sleeps.
|
|
213
|
+
|
|
214
|
+
**Does it work on battery?** Yes. Closing the lid hands off on battery as on
|
|
215
|
+
power: NodeHop finishes before macOS goes to sleep (a few seconds, within a
|
|
216
|
+
22-second budget).
|
|
217
|
+
|
|
218
|
+
**What does NodeHop do with my passwords?** Nothing: it never asks for, types or
|
|
219
|
+
stores one, and agents' logins never leave their machine. It uses its own SSH
|
|
220
|
+
key, restricted on the server; see [SECURITY.md](SECURITY.md).
|
|
221
|
+
|
|
222
|
+
**What if the resumed agent needs a permission with nobody there?** Set
|
|
223
|
+
`unattended` to `auto` (the onboarding suggests it): Claude Code's auto mode
|
|
224
|
+
decides by itself, so work does not stall. With `remote_control` on, you can
|
|
225
|
+
also follow and answer it from the Claude app.
|
|
226
|
+
|
|
227
|
+
**My network is slow; will a big checkpoint make me lose work?** A transfer cut
|
|
228
|
+
by sleep changes nothing on the other side, and the server resumes from the
|
|
229
|
+
last complete copy (at most `presync_seconds` old).
|
|
230
|
+
|
|
231
|
+
**What if I edit the project on both machines?** Don't: the receiving copy is
|
|
232
|
+
made identical to the sender's. If two agents ever worked in parallel, NodeHop
|
|
233
|
+
asks you which version to keep and saves the other.
|
|
234
|
+
|
|
235
|
+
**Which agents?** Claude Code (the main target) and Codex, each with its
|
|
236
|
+
conversation, as long as it is signed in on both machines; anything
|
|
237
|
+
else as a plain command (`nodehop on --command "…"`), restarted on the other
|
|
238
|
+
machine. Adding another agent is one module: see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
239
|
+
|
|
240
|
+
**Does it rely on agents' internals?** Yes: session files (`~/.claude/projects`,
|
|
241
|
+
`~/.codex/sessions`) are not public APIs and may change. NodeHop keeps each
|
|
242
|
+
agent's details in its own module.
|
|
243
|
+
|
|
244
|
+
## Uninstall
|
|
245
|
+
|
|
246
|
+
```sh
|
|
247
|
+
nodehop uninstall --everywhere # from the laptop: this machine and the paired ones
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
It removes NodeHop's background jobs, app, keys, config, backups and logs, then
|
|
251
|
+
the program itself. Your projects, your agents and their conversations stay.
|
|
252
|
+
|
|
253
|
+
## Contributing
|
|
254
|
+
|
|
255
|
+
Issues and pull requests are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
256
|
+
and the design notes in [CLAUDE.md](CLAUDE.md). Changes are listed in
|
|
257
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
258
|
+
|
|
259
|
+
## License
|
|
260
|
+
|
|
261
|
+
[MIT](LICENSE)
|
nodehop-0.2.0/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/BuildRunnerFr/NodeHop/main/docs/logo.png" width="112" alt="NodeHop logo">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">NodeHop</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<b>Close your laptop. Your agents keep working.</b><br>
|
|
9
|
+
<sub>Hands Claude Code and Codex sessions from your laptop to an always-on Mac or Linux box, and back.</sub>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/BuildRunnerFr/NodeHop/actions/workflows/tests.yml"><img src="https://github.com/BuildRunnerFr/NodeHop/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
|
|
14
|
+
<img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="Python 3.9+">
|
|
15
|
+
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Linux-lightgrey" alt="macOS | Linux">
|
|
16
|
+
<img src="https://img.shields.io/badge/dependencies-none-brightgreen" alt="No dependencies">
|
|
17
|
+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-green" alt="MIT license"></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
NodeHop hands running work from your laptop to an always-on machine, and back.
|
|
23
|
+
Close the lid while Claude Code or Codex is in the middle of a task: the
|
|
24
|
+
session is stopped, copied to your Mac mini or Linux box, and resumed there with
|
|
25
|
+
the same conversation. Open the lid: your laptop takes it back. Training jobs work the
|
|
26
|
+
same way, resuming from their last checkpoint at the other machine's pace.
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
laptop (primary) always-on machine (server)
|
|
30
|
+
──────────────── ──────────────────────────
|
|
31
|
+
lid closes ─► stop the agent
|
|
32
|
+
copy project + conversation ──────► resume it, same conversation
|
|
33
|
+
lid opens ─► ask the server to stop
|
|
34
|
+
copy everything back ◄─────────────
|
|
35
|
+
resume it here
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Highlights
|
|
39
|
+
|
|
40
|
+
- **Your agents never stop** — Claude Code and Codex sessions (conversation
|
|
41
|
+
included) and long commands such as training jobs move between machines and
|
|
42
|
+
resume.
|
|
43
|
+
- **Set up by an agent, from one machine** — it asks you a few questions and
|
|
44
|
+
installs NodeHop on the other machine over SSH. No agent needed over there.
|
|
45
|
+
- **The laptop needs no SSH server** — it pushes work when it sleeps and pulls it
|
|
46
|
+
back when it wakes; only the always-on machine accepts connections.
|
|
47
|
+
- **Safe on slow networks** — transfers are all-or-nothing; if the newest state
|
|
48
|
+
cannot be sent before sleep, the server resumes from its last complete copy.
|
|
49
|
+
- **Fallback** — if the laptop dies without going to sleep, the server resumes
|
|
50
|
+
the work in progress after 2 minutes.
|
|
51
|
+
- **You decide conflicts** — if two agents worked in parallel, a native window
|
|
52
|
+
shows what each one did and lets you pick (the other version is kept).
|
|
53
|
+
- **A Mac mini or a Linux server takes over** — the always-on machine can be a
|
|
54
|
+
Mac or a Linux box, with or without a screen.
|
|
55
|
+
- **Paths may differ** — different user names and folders on each machine.
|
|
56
|
+
- **Zero dependencies** — Python 3.9+ standard library, `ssh`, `rsync`, `tmux`.
|
|
57
|
+
|
|
58
|
+
## Before you start
|
|
59
|
+
|
|
60
|
+
NodeHop does almost everything itself. You only prepare three things, once,
|
|
61
|
+
on **both machines**:
|
|
62
|
+
|
|
63
|
+
1. **Your agent, installed and signed in.** NodeHop is built for Claude Code
|
|
64
|
+
first, and Codex works the same way: use either, or both. Install it on each
|
|
65
|
+
machine, sign in with your account, and open it once (`claude`, then its
|
|
66
|
+
first screens). NodeHop never moves your login from one machine to the other.
|
|
67
|
+
2. **SSH on the always-on machine.** macOS: System Settings › General › Sharing ›
|
|
68
|
+
Remote Login. Linux: `sudo apt install -y openssh-server`. The laptop needs no
|
|
69
|
+
SSH server. When asked, you type that machine's password once into
|
|
70
|
+
`ssh-copy-id`.
|
|
71
|
+
3. **[Tailscale](https://tailscale.com) on both machines**, signed in to the
|
|
72
|
+
same account, so they find each other at home and away (recommended; a
|
|
73
|
+
local network works too).
|
|
74
|
+
|
|
75
|
+
That's all. Installing NodeHop on the other machine, pairing both machines and
|
|
76
|
+
hooking into sleep and wake are done for you.
|
|
77
|
+
|
|
78
|
+
## Get started
|
|
79
|
+
|
|
80
|
+
### With an agent (recommended)
|
|
81
|
+
|
|
82
|
+
Ask your coding agent (Claude Code or any other), on your laptop:
|
|
83
|
+
|
|
84
|
+
> Install NodeHop from https://github.com/BuildRunnerFr/NodeHop by following its AGENT_SETUP.md.
|
|
85
|
+
|
|
86
|
+
It installs NodeHop, asks you whether this is the laptop or the always-on
|
|
87
|
+
machine, which machine is the other one (your Tailscale machines are offered),
|
|
88
|
+
and which project to protect, then sets up both machines. All you may have to
|
|
89
|
+
do: type the other machine's password once into `ssh-copy-id`, and run anything
|
|
90
|
+
that needs `sudo`. Details for agents: [AGENT_SETUP.md](AGENT_SETUP.md).
|
|
91
|
+
|
|
92
|
+
### By hand
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pipx install git+https://github.com/BuildRunnerFr/NodeHop
|
|
96
|
+
nodehop onboard # the same questions, with arrow-key menus
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Daily use
|
|
100
|
+
|
|
101
|
+
```sh
|
|
102
|
+
cd ~/code/my-app
|
|
103
|
+
nodehop on # protect this project (Claude Code; --agent codex for Codex)
|
|
104
|
+
nodehop start my-app # run its agent, inside NodeHop's tmux
|
|
105
|
+
nodehop attach my-app # open its terminal (detach: Ctrl-b d)
|
|
106
|
+
nodehop status # where each project runs right now
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then just close the lid. A few more:
|
|
110
|
+
|
|
111
|
+
```sh
|
|
112
|
+
nodehop handoff --to server # hand off now, without closing the lid
|
|
113
|
+
nodehop pull my-app # bring a project back here
|
|
114
|
+
nodehop resolve # two agents worked in parallel: choose
|
|
115
|
+
nodehop doctor # check everything, with fixes
|
|
116
|
+
nodehop -n handoff # dry run: print every command, change nothing
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Training jobs
|
|
120
|
+
|
|
121
|
+
```sh
|
|
122
|
+
nodehop on ~/code/my-model --command ".venv/bin/python train.py"
|
|
123
|
+
nodehop start my-model
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
With `from nodehop import train` (standard library, PyTorch optional) a script
|
|
127
|
+
saves a checkpoint and exits cleanly when NodeHop stops it, resumes from it on
|
|
128
|
+
the other machine, and picks a micro-batch that fits that machine's memory —
|
|
129
|
+
gradient accumulation keeps the effective batch, and so the training, identical.
|
|
130
|
+
A 40,000-step run moved between a MacBook (128 × 4) and a Mac mini (64 × 8)
|
|
131
|
+
with the same loss curve. See [examples/train_relay.py](examples/train_relay.py).
|
|
132
|
+
|
|
133
|
+
## How it works
|
|
134
|
+
|
|
135
|
+
| When | What NodeHop does |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| Every 30 s | The laptop tells the server it is alive; every 5 min it also copies the active projects there. |
|
|
138
|
+
| Lid closes | Stop the agent (Claude Code quits in ~1 s; a training job saves a checkpoint), copy what changed, resume it on the server. Budget: ~22 s, because macOS sleeps soon after. |
|
|
139
|
+
| Lid opens | Ask the server to stop, copy everything back, resume here. Retries while the network comes back. |
|
|
140
|
+
| Laptop silent 2 min without sleeping | The server resumes, from the last copy, the work that was in progress. |
|
|
141
|
+
| Laptop back, both agents worked | The server's agent is paused and you choose which version to keep. |
|
|
142
|
+
|
|
143
|
+
Agents run in NodeHop's own tmux server, so they keep running with no terminal
|
|
144
|
+
open and can be stopped cleanly. A resumed Claude Code gets a short "carry on"
|
|
145
|
+
message only if it was in the middle of something; an idle one is just reopened.
|
|
146
|
+
|
|
147
|
+
## Requirements
|
|
148
|
+
|
|
149
|
+
| | The machine you work on (primary) | The always-on machine (server) |
|
|
150
|
+
| --- | --- | --- |
|
|
151
|
+
| System | a Mac, usually a laptop | a Mac (e.g. a Mac mini) or a Linux server, headless is fine |
|
|
152
|
+
| Needs | Python 3.9+ (the system one works), `rsync`, `tmux`, and your agent (Claude Code and/or Codex) signed in | the same, plus an SSH server (Remote Login on macOS; `openssh-server` on Linux) |
|
|
153
|
+
| Notes | [SleepWatcher](https://www.bernhard-baehr.de/), installed for you by `nodehop onboard` | Mac: keep a user session open (automatic login) so agents can read the login keychain. Linux: `loginctl enable-linger` so agents keep running with nobody logged in |
|
|
154
|
+
|
|
155
|
+
- **[Tailscale](https://tailscale.com)** recommended, so it also works away
|
|
156
|
+
from home.
|
|
157
|
+
|
|
158
|
+
A Linux machine can also be the primary (a systemd sleep hook replaces
|
|
159
|
+
SleepWatcher), but that setup is less tested.
|
|
160
|
+
|
|
161
|
+
## Configuration
|
|
162
|
+
|
|
163
|
+
`nodehop config get` shows everything; `nodehop config set <key> <value>`
|
|
164
|
+
changes it. The useful ones:
|
|
165
|
+
|
|
166
|
+
| Key | Default | Meaning |
|
|
167
|
+
| --- | --- | --- |
|
|
168
|
+
| `presync_seconds` | `300` | how often active projects are copied to the server |
|
|
169
|
+
| `failover_minutes` | `2` | server: resume the laptop's work after this much silence (`0` = off) |
|
|
170
|
+
| `sleep_budget_seconds` | `22` | time allowed to hand off when the lid closes |
|
|
171
|
+
| `unattended` | unset (asked) | how a resumed agent handles permission prompts with nobody there: `auto` (Claude Code's auto mode; Codex sandboxed to the project), `acceptEdits`, or `default` |
|
|
172
|
+
| `remote_control` | `false` | show NodeHop's Claude Code sessions in the Claude app, to follow and answer them from anywhere |
|
|
173
|
+
| `backups_keep` | `5` | versions set aside after a fallback or conflict, kept per project |
|
|
174
|
+
| `excludes` | `node_modules`, `.venv`, … | never copied (rebuild them on each machine) |
|
|
175
|
+
| `workspace` | unset | where received projects go (unset: same place relative to the home folder) |
|
|
176
|
+
| `claude_args` / `codex_args` | `[]` | extra flags for Claude Code / Codex (e.g. `["-c", "model=\"…\""]`) |
|
|
177
|
+
|
|
178
|
+
## FAQ
|
|
179
|
+
|
|
180
|
+
**Does the other machine need an agent to be set up?** No. The agent on your
|
|
181
|
+
laptop installs and configures NodeHop over there through SSH. Claude Code (or
|
|
182
|
+
Codex) must simply be installed and signed in there too, since that machine
|
|
183
|
+
runs your agent while the laptop sleeps.
|
|
184
|
+
|
|
185
|
+
**Does it work on battery?** Yes. Closing the lid hands off on battery as on
|
|
186
|
+
power: NodeHop finishes before macOS goes to sleep (a few seconds, within a
|
|
187
|
+
22-second budget).
|
|
188
|
+
|
|
189
|
+
**What does NodeHop do with my passwords?** Nothing: it never asks for, types or
|
|
190
|
+
stores one, and agents' logins never leave their machine. It uses its own SSH
|
|
191
|
+
key, restricted on the server; see [SECURITY.md](SECURITY.md).
|
|
192
|
+
|
|
193
|
+
**What if the resumed agent needs a permission with nobody there?** Set
|
|
194
|
+
`unattended` to `auto` (the onboarding suggests it): Claude Code's auto mode
|
|
195
|
+
decides by itself, so work does not stall. With `remote_control` on, you can
|
|
196
|
+
also follow and answer it from the Claude app.
|
|
197
|
+
|
|
198
|
+
**My network is slow; will a big checkpoint make me lose work?** A transfer cut
|
|
199
|
+
by sleep changes nothing on the other side, and the server resumes from the
|
|
200
|
+
last complete copy (at most `presync_seconds` old).
|
|
201
|
+
|
|
202
|
+
**What if I edit the project on both machines?** Don't: the receiving copy is
|
|
203
|
+
made identical to the sender's. If two agents ever worked in parallel, NodeHop
|
|
204
|
+
asks you which version to keep and saves the other.
|
|
205
|
+
|
|
206
|
+
**Which agents?** Claude Code (the main target) and Codex, each with its
|
|
207
|
+
conversation, as long as it is signed in on both machines; anything
|
|
208
|
+
else as a plain command (`nodehop on --command "…"`), restarted on the other
|
|
209
|
+
machine. Adding another agent is one module: see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
210
|
+
|
|
211
|
+
**Does it rely on agents' internals?** Yes: session files (`~/.claude/projects`,
|
|
212
|
+
`~/.codex/sessions`) are not public APIs and may change. NodeHop keeps each
|
|
213
|
+
agent's details in its own module.
|
|
214
|
+
|
|
215
|
+
## Uninstall
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
nodehop uninstall --everywhere # from the laptop: this machine and the paired ones
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
It removes NodeHop's background jobs, app, keys, config, backups and logs, then
|
|
222
|
+
the program itself. Your projects, your agents and their conversations stay.
|
|
223
|
+
|
|
224
|
+
## Contributing
|
|
225
|
+
|
|
226
|
+
Issues and pull requests are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
227
|
+
and the design notes in [CLAUDE.md](CLAUDE.md). Changes are listed in
|
|
228
|
+
[CHANGELOG.md](CHANGELOG.md).
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
[MIT](LICENSE)
|