Skip to content

feat(sovexec): Sovereign Execution peer sidecar#6

Merged
hopeatina merged 1 commit into
mainfrom
feat/sovexec-peer-adoption
Apr 18, 2026
Merged

feat(sovexec): Sovereign Execution peer sidecar#6
hopeatina merged 1 commit into
mainfrom
feat/sovexec-peer-adoption

Conversation

@hopeatina
Copy link
Copy Markdown
Contributor

Adds a Gateway Protocol v1 peer sidecar to @useorgx/claude-code-plugin. Existing CLI plugin unchanged — this is additive.

Ships:

  • `lib/peer/ClaudeCodeDriver.mjs` — real Driver that spawns `claude -p --output-format stream-json` and translates NDJSON events to protocol messages.
  • `lib/peer/peer.mjs` — `startPeer()` wires Driver into PeerClient; weekly license heartbeat; skill-rule fetch at boot.
  • `lib/peer/cli.mjs` + bin `orgx-claude-code-peer`.
  • `lib/peer/peer.test.mjs` — `node --test` with fake `claude` shim. Covers detect / success / deviation / failure.
  • `plugin.manifest.json` (unsigned in dev).

Part of Sovereign Execution (`993cabeb`).

Adds a second shape to @useorgx/claude-code-plugin: a peer sidecar that
connects to OrgX server over WebSocket and drives the local `claude` CLI
on dispatch. The existing CLI plugin (hooks / skills / commands /
agents loaded via `--plugin-dir`) stays unchanged.

Mental model:
  - CLI plugin = loaded by the user for interactive sessions
  - Peer sidecar = loaded by the machine, listens for OrgX dispatches,
                    spawns `claude -p <prompt> --plugin-dir <this-plugin>
                    --output-format stream-json` which re-uses the same
                    skill catalog the interactive sessions use

Files:
  lib/peer/ClaudeCodeDriver.mjs  — Driver implementing Gateway Protocol
                                    v1. detect / probe run `claude
                                    --version`. dispatch spawns claude,
                                    reads NDJSON stdout, yields
                                    task.started / task.step /
                                    task.deviation / task.completed /
                                    task.failed. cancel() SIGTERMs then
                                    SIGKILLs after 3s grace.
  lib/peer/peer.mjs              — startPeer() wires Driver into
                                    PeerClient from
                                    @useorgx/orgx-gateway-sdk; posts
                                    /api/v1/licenses/heartbeat on boot +
                                    every 7 days; fetches skill rules
                                    from /api/v1/plan-skills on connect
                                    for the Driver to match against
                                    file-edit / tool-call events.
  lib/peer/cli.mjs               — `orgx-claude-code-peer` binary;
                                    reads ORGX_API_KEY +
                                    ORGX_WORKSPACE_ID; handles
                                    SIGINT/SIGTERM cleanly.
  lib/peer/peer.test.mjs         — `node --test` unit coverage using a
                                    fake `claude` shim on PATH. Covers
                                    detect happy path, success trace
                                    (task.started → steps →
                                    task.completed with tokens), skill
                                    deviation emission, task.failed on
                                    error event.

package.json:
  + dependency @useorgx/orgx-gateway-sdk (github: for now, npm once
                                          publishing lands)
  + bin orgx-claude-code-peer
  + exports '.' and './peer'
  + scripts peer:start / test:peer; test picks up the new peer file

plugin.manifest.json:
  Dev builds unsigned (fingerprint + signature empty) → server marks the
  license 'degraded' in permissive mode; deviation ingestion stays live
  during rollout.

Consumers need:
  ORGX_API_KEY       oxk_ token with scopes gateway:drive +
                       plugin:heartbeat
  ORGX_WORKSPACE_ID  the workspace the peer drives
  ORGX_BASE_URL      optional (defaults to https://useorgx.com)

Part of Sovereign Execution initiative 993cabeb.
@hopeatina hopeatina merged commit 78c549b into main Apr 18, 2026
0 of 2 checks passed
@hopeatina hopeatina deleted the feat/sovexec-peer-adoption branch April 18, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant