ralph-api
Rust-native bootstrap runtime for the RPC v1 control plane.
What this crate provides (bootstrap scope)
- HTTP RPC endpoint:
POST /rpc/v1 - WebSocket stream endpoint:
GET /rpc/v1/stream(keepalive skeleton) - Metadata endpoints:
GET /healthGET /rpc/v1/capabilities
- Protocol runtime for canonical RPC v1 envelopes
- Shared error envelope mapping (
INVALID_REQUEST,METHOD_NOT_FOUND, etc.) - Auth abstraction:
trusted_localtokenmode hook
- Idempotency primitives for mutating methods with in-memory store
- Implemented methods:
system.healthsystem.versionsystem.capabilities- Full
task.*family (list/get/ready/create/update/close/archive/unarchive/delete/clear/run/run_all/retry/cancel/status) - Full
loop.*family (list/status/process/prune/retry/discard/stop/merge/merge_button_state/trigger_merge_task) - Full
planning.*family (list/get/start/respond/resume/delete/get_artifact) - Full
config.*family (get/update) - Full
preset.*family (list) - Full
collection.*family (list/get/create/update/delete/import/export)
Persistence notes:
task.*data is persisted in.ralph/api/tasks-v1.jsonloop.*reads/writes.ralph/loops.jsonand.ralph/merge-queue.jsonlviaralph-coreplanning.*data is persisted under.ralph/planning-sessions/<session-id>/collection.*data is persisted in.ralph/api/collections-v1.jsonconfig.*reads/writesralph.ymlwith YAML validation + atomic replace semanticspreset.listreads builtins frompresets/, local files from.ralph/hats/, and collection-backed presets
Intentional migration differences vs legacy Node backend:
task.cancelcurrently allows cancellingpendingtasks (legacy allowed onlyrunning).planning.startreturns a fullsessionobject instead of just{sessionId}.
Run locally
From repository root:
For the MCP server:
The MCP server is workspace-scoped. One server instance manages one workspace root for
ralph.yml, .ralph/api/*, loops, planning sessions, and collections.
Environment variables:
RALPH_API_HOST(default:127.0.0.1)RALPH_API_PORT(default:3000)RALPH_API_SERVED_BY(default:ralph-api)RALPH_API_AUTH_MODE(trusted_localortoken, default:trusted_local)trusted_localis restricted to loopback hosts (127.0.0.1,::1,localhost)
RALPH_API_TOKEN(required for practical token auth use)RALPH_API_IDEMPOTENCY_TTL_SECS(default:3600)RALPH_API_WORKSPACE_ROOT(default: current working directory)RALPH_API_LOOP_PROCESS_INTERVAL_MS(default:30000)RALPH_API_RALPH_COMMAND(default:ralph; command used for loop-side-effect parity flows likeloop.retry)
Smoke call examples
Health:
|
RPC system health:
|