closde-sync is a Go + Node preload wrapper around Claude Code with optional Xray-based proxying and a lightweight sync server.
- Builds a cross-platform
closdebinary intobuild/closdeorbuild/closde.exe. - Runs in client mode by default and forwards all received flags to the downstream Node-based Claude CLI.
- Runs in server mode when the executable filename contains
server. - Injects a preload bundle into the Claude CLI process.
- Optionally starts an in-process Xray proxy from
CLOSDE_PROXYinstead of using an external Xray binary.
- Download the
closdebinary andpreload.jsfor your platform from Release. - Create
.closedfolder in home directory. - Move
preload.jsinto.closde. - Create
.envfile in.closde, edit it according to this instructions in the README. - Move the binary to directory like
~/.loacl/binor/usr/local/bin, and use it.
.
├── build/ # built binaries
├── dist/ # built preload bundle
├── internal/ # client/runtime/build/xray internals
├── preload/ # preload TypeScript source
├── server/ # sync server implementation
├── main.go # root binary entry
└── package.json # JS build scripts
- Node.js
- npm
- Go (Development)
The client expects either a Claude Code installation managed under ~/.closde/claude/<version>, CLOSDE_CLAUDE_VERSION=local to use the system claude command, or CLOSDE_CLAUDE_VERSION=file:<abs-path> to run a specific binary. If CLOSDE_CLAUDE_VERSION is unset, closde automatically resolves and downloads the latest Claude Code version from npm.
Install dependencies:
npm installBuild everything:
npm run buildUseful scripts:
npm run build # build preload + binary
npm run build:preload # build dist/preload.js
npm run build:cmd # build build/closde(.exe)
npm run check # TypeScript check + go test ./...closde loads ~/.closde/.env automatically. If the file does not exist, it is created and the first run exits so you can fill in the required values.
CLOSDE_CLAUDE_VERSION=<installed-claude-version> # optional: set to local to use system claudeSupport environment flags:
| Name | Required | Default | Describe |
|---|---|---|---|
CLOSDE_CLAUDE_VERSION |
N | / | Claude Code version to use. local uses the system claude command, and file:<abs-path> runs a specific binary — both skip the npm download and NODE_OPTIONS injection. If omitted, the latest npm release is used. |
CLOSDE_PROXY |
N | / | The proxy URI provided to Xray to drive claude. When set, Xray binds a local HTTP proxy starting at port 11808, shifting to the next free port if it is in use. |
CLOSDE_SERVER_URL |
N | / | Closde server URL. |
CLOSDE_AUTH_TOKEN |
N | / | The token used to connect to the Cloude server. |
HTTPS_PROXY |
N | / | The HTTPS proxy URL provided to claude. |
HTTP_PROXY |
N | / | The HTTP proxy URL provided to claude. |
CLOSDE_PLATFORM |
N | / | Platform name injected into process.platform |
CLOSDE_ARCH |
N | / | Arch information injected into process.arch |
CLOSDE_NODE_VERSION |
N | / | NodeJS version injected into process.version. |
CLOSDE_CLAUDE_SETTINGS |
N | $HOME/.claude.json |
.claude.json file path. |
CLOSDE_CLAUDE_CREDENTIALS |
N | $HOME/.claude/.credentials.json |
.credentials.json file path. |
Rename the binary like xxx-server to enable server mode.
Examples:
cp ./build/closde ./build/closde-server
./build/closde-server --help
./build/closde-server serve --addr :8080Server commands:
./build/closde-server serve
./build/closde-server create-token [name]
./build/closde-server get-configserve supports:
--addr HTTP listen address
--config-file server config file path
--watch-local-state watch Claude local state files and broadcast updates
--claude-settings Claude settings file path
--claude-credentials Claude credentials file pathDefaults:
- listen address:
:8080 - config file:
<repo>/config.json - Claude settings:
~/.claude.json - Claude credentials:
~/.claude/.credentials.json
If CLOSDE_PROXY is set, the client starts an embedded Xray instance and points Node traffic to the local HTTP proxy.
Supported proxy URI styles are implemented under internal/xray/.
Run the standard validation steps:
npm run check
npm run build