feat(sovexec): Sovereign Execution peer sidecar#6
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Gateway Protocol v1 peer sidecar to @useorgx/claude-code-plugin. Existing CLI plugin unchanged — this is additive.
Ships:
Part of Sovereign Execution (`993cabeb`).