Bundle Entry:
docs/spec/CLI_TOOLING_BUNDLE_v0.1.mdLegacy Split Doc: Prefer the bundle entrypoint for agent retrieval; this file retains detailed, topic-local semantics.
CLI JSON Schemas v0.1 (Non-GCPM)
This document freezes the --json schema IDs for genesis commands outside the pkg/gcpm surface.
pkg/gcpm schema IDs remain in docs/spec/GCPM_JSON_SCHEMAS_v0.1.md.
Command -> Kind
Core runtime commands
parse->genesis/parse-v0.1fmt->genesis/fmt-v0.2eval->genesis/eval-v0.2explain->genesis/explain-v0.2debug step->genesis/debug-step-v0.1debug break->genesis/debug-break-v0.1debug inspect->genesis/debug-inspect-v0.1debug continue->genesis/debug-continue-v0.1debug frames->genesis/debug-frames-v0.1debug timeline->genesis/debug-timeline-v0.1debug bisect->genesis/debug-bisect-v0.1run->genesis/run-v0.2replay->genesis/replay-v0.2test->genesis/test-v0.2pack->genesis/pack-v0.2cli-schema->genesis/cli-schema-v0.1agent-index->genesis/agent-index-v0.1agent-index --search-symbol->genesis/agent-symbol-search-v0.3agent-index --card->genesis/agent-card-v0.3agent-plan->genesis/agent-plan-v0.1bench *->genesis/bench-v0.1(subcommand result indata.kind)warm->genesis/warm-session-v0.2
Security / optimization / semantic tooling
keygen->genesis/keygen-v0.2sign->genesis/sign-v0.2transparency-verify->genesis/transparency-verify-v0.2typecheck->genesis/typecheck-v0.2optimize->genesis/optimize-v0.2semantic-edit index->genesis/semantic-edit-index-v0.1semantic-edit workspace-graph->genesis/semantic-edit-workspace-graph-v0.1semantic-edit refactor-plan->genesis/semantic-edit-refactor-plan-v0.1semantic-edit apply-plan->genesis/semantic-edit-apply-plan-v0.1apply-patch->genesis/apply-patch-v0.2session begin->genesis/agent-session-begin-v0.1session status->genesis/agent-session-status-v0.1session stage->genesis/agent-session-stage-v0.1session test->genesis/agent-session-test-v0.1session apply->genesis/agent-session-apply-v0.1session abort->genesis/agent-session-abort-v0.1verify->genesis/verify-v0.2
Selfhost lifecycle
selfhost-artifact->genesis/selfhost-artifact-v0.2selfhost-dashboard->genesis/selfhost-dashboard-v0.2
Store / refs / commit
store put->genesis/store-put-v0.2store get->genesis/store-get-v0.2store has->genesis/store-has-v0.2store verify->genesis/store-verify-v0.2refs get->genesis/refs-get-v0.1refs list->genesis/refs-list-v0.1refs set->genesis/refs-set-v0.1refs delete->genesis/refs-delete-v0.1commit new->genesis/commit-new-v0.1commit show->genesis/commit-show-v0.1
Policy / sync / gc
policy list->genesis/policy-list-v0.1policy show->genesis/policy-show-v0.1policy set-default->genesis/policy-set-default-v0.1sync pull->genesis/sync-pull-v0.1sync push->genesis/sync-push-v0.1gc plan->genesis/gc-plan-v0.1gc run->genesis/gc-run-v0.1gc pin->genesis/gc-pin-v0.1gc unpin->genesis/gc-unpin-v0.1gc purge->genesis/gc-purge-v0.1
VCS
vcs hash->genesis/vcs-hash-v0.2vcs diff->genesis/vcs-diff-v0.1vcs apply->genesis/vcs-apply-v0.1vcs log->genesis/vcs-log-v0.1vcs blame->genesis/vcs-blame-v0.1vcs why->genesis/vcs-why-v0.1vcs merge3->genesis/vcs-merge3-v0.1vcs resolve-conflict->genesis/vcs-resolve-conflict-v0.1
Warm Protocol v0.2
genesis warm is a long-lived newline-delimited JSON transport. Every input line and every output line is one UTF-8 JSON value closed by docs/spec/WARM_PROTOCOL_v0.2.schema.json. The wire protocol is genesis/warm-protocol-v0.2; responses use genesis/warm-response-v0.2, typed errors use genesis/warm-protocol-error-v0.2, and the final command envelope (when observed by an embedding runtime) uses genesis/warm-session-v0.2.
Lifecycle and ordering
initializeMUST be the first accepted method in generation zero and after every successful restart or worker-crash reset. It returns the exact server limits and capabilities clients may rely on.- Every request frame carries a 1..128 byte ASCII identifier. IDs are unique within a generation. Execute IDs intentionally identify both the immediate
acceptedresponse and exactly one terminalcompletedor typed-error response.meta.sequencetotally orders emitted responses. executebinds a stable workspace ID to one base-relative root and queues a parsed CLI command. Rebinding an active workspace ID, absolute paths, parent traversal, and symlink escape fail closed. A single serialized dispatcher prevents process-current-directory overlap between workspaces.cancelterminalizes queued work immediately with anot-started-v0.1audit. In native Unix mode, each running command occupies a fresh process tree rooted at that group. Cancellation, request deadlines, session wall limits, disconnect drain expiry, and monitored resource violations sendSIGKILLto that process tree and reap its leader before the terminal response is emitted. Initialization advertiseshard_termination = trueonly for that profile.restartsucceeds only while idle, advances the generation, clears all workspace and ID bindings, and requires a newinitialize. A contained worker panic performs the same generation reset, emitswarm/worker-crash, and fails queued requests aswarm/worker-restartedrather than replaying uncertain work. A fatal signal in a native isolated worker instead emits retryablewarm/worker-abortwith the signal andworker-signal-containedaudit. Because that process cannot mutate daemon memory, initialization, workspace bindings, generation, and later queued requests remain valid. A failed worker kill, reap, residual-tree cleanup, pipe read, or pipe join takes precedence over cancellation, deadline, resource, and command outcomes aswarm/worker-cleanup, retaining the prior outcome and all cleanup failures. The daemon resets its generation and pending queue; if containment cannot be established, it stops admission and shuts down after terminalizing accepted work.shutdown, EOF, input failure, and disconnect stop admission. At mostmax_drain_requests, including the active request, remain eligible to run; excess accepted requests receivewarm/drain-bounded. The retained set has one totaldrain_timeout_msdeadline. Expiry kills and reaps the active worker and terminalizes the rest aswarm/drain-timeout. Every accepted ID therefore receives exactly one terminal response even when input closes.
Bounds and isolation
- Frame allocation is bounded before UTF-8 or JSON decoding. Oversized lines are fully drained so the next frame remains parseable.
- Input transport capacity, execute queue depth, workspace count, argv count, argv entry size, deadline, session frame count, workspace idle lifetime, disconnect drain set, and disconnect drain time are finite and reported by
initialize. docs/spec/AGENT_SESSION_RESOURCES_v0.1.schema.jsoncloses the resource and audit shapes. Each native command has finite wall, aggregate CPU, kernel steps, aggregate process-group resident memory, combined output, effect-op, process-count, and workspace-growth ceilings. Clients cannot override these session-owned limits in request argv.- Native output pipes continue draining after their capture ceiling, while the process group is killed. Disk enforcement combines inherited per-file OS limits with periodic and final base-relative workspace growth accounting. CPU, resident memory, and process count are sampled recursively across the complete process tree, including host-bridge descendants that create their own process groups.
- Kernel bulk strings, byte buffers, temporary join tables, and compiled-blob collections preflight checked capacities and reserve fallibly. Residual allocator aborts that cannot become a Rust error are contained by the native worker boundary; WASI explicitly does not claim this protection.
genesis/agent-session-audit-v0.1records the limit-set BLAKE3 identity, worker profile, observed wall/CPU/output/effects/disk/peak-memory/peak-process values, enforcement mechanisms, termination mode, and exceeded dimension. Native terminal successes place it atdata.audit; terminal protocol errors place it aterror.details.audit. Host absolute paths are forbidden.- Valid, malformed, oversized, and invalid-UTF-8 frames all consume the finite session frame budget. EOF and transport failures do not.
- Workspace roots resolve beneath
--workspace-root; response metadata and typed errors do not expose the configured absolute root. Idle eviction never removes a queued or running request’s workspace. - Native macOS/Linux mode accepts cancellation and control frames while one isolated worker runs. Other native targets fail closed at worker launch. WASI mode advertises
concurrent_control = false,hard_termination = false, andwasi-inline-v0.1; it enforces logical step/shape/effect/output bounds but explicitly reports unavailable native OS CPU/process hard isolation. Clients MUST negotiate the worker profile and MUST NOT infer native hard-cancellation parity from wire-version parity.
Closed frame examples
{"protocol":"genesis/warm-protocol-v0.2","id":"init-1","method":"initialize","client":{"name":"agent","version":"1.0"}}
{"protocol":"genesis/warm-protocol-v0.2","id":"eval-1","method":"execute","workspace":{"id":"repo","root":"."},"argv":["--json","eval","main.gc"],"deadline_ms":5000}
{"protocol":"genesis/warm-protocol-v0.2","id":"cancel-1","method":"cancel","target_id":"eval-1"}
{"protocol":"genesis/warm-protocol-v0.2","id":"stop-1","method":"shutdown"}Unknown fields, methods, protocol versions, duplicate IDs, uninitialized use, invalid bounds, nested warm, workspace escape, queue overflow, stale cancel targets, busy restart, and session exhaustion always produce a typed protocol error. Schema IDs are immutable; incompatible framing requires a new protocol version rather than permissive parsing.
Determinism / versioning
- Schema IDs are immutable contracts for agent workflows.
- Backward-incompatible output changes require a version bump in
kind. - Command aliases MUST preserve
kindfor equivalent behavior.
CLI Schema Contract (genesis/cli-schema-v0.1)
genesis cli-schema provides a machine-readable command/option schema for agent planning.
Envelope
kind = "genesis/cli-schema-v0.1"- Standard CLI JSON envelope from
docs/spec/CLI.md.
data payload
{
"schema": "genesis/cli-schema-v0.1",
"runtime_profile": "production|parity-harness",
"command": {
"name": "genesis",
"path": ["genesis"],
"about": "optional string",
"options": [
{
"name": "coreform_frontend",
"long": "coreform-frontend",
"short": null,
"help": "optional string",
"required": false,
"global": true,
"positional": false,
"value_names": ["COREFORM_FRONTEND"],
"default_values": [],
"allowed_values": ["selfhost"],
"action": "set",
"value_type": "string",
"multiple": false,
"min_values": 1,
"max_values": 1
}
],
"subcommands": [
{
"name": "fmt",
"path": ["genesis", "fmt"],
"about": "optional string",
"options": [],
"subcommands": []
}
]
},
"mcp_interface": {
"schema": "genesis/mcp-interface-v0.1",
"protocolVersion": "2025-11-25",
"identitySha256": "64 lowercase hexadecimal characters"
}
}Profile-specific allowed values
runtime_profile = production:engineandcoreform-frontendallowed values are["selfhost"].
runtime_profile = parity-harness:engineandcoreform-frontendallowed values are["selfhost", "rust"].
Determinism rules
- Option and subcommand entries are emitted in deterministic sorted order.
- Backward-incompatible schema changes require a
kindversion bump.
Generated MCP Interface v0.1
genesis mcp implements the Model Context Protocol revision 2025-11-25 over stdio. The transport is newline-delimited UTF-8 JSON-RPC 2.0. Stdout is reserved exclusively for protocol frames; diagnostics and process failures use stderr. Every input and output frame, queued call, root set, session frame count, and argument vector has a finite configured bound.
Lifecycle and capabilities
initializeis the first request. The server selects protocol version2025-11-25, returns server identity and capabilities, and waits fornotifications/initializedbefore serving normal requests.- The core profile advertises
toolsandresources. It does not advertise prompts, logging, completion, elicitation, sampling, or Tasks. - MCP Tasks are experimental in revision
2025-11-25. Every core tool declaresexecution.taskSupport = "forbidden"; task methods and task-augmented calls fail unless a future separately versioned extension is explicitly negotiated. - EOF/disconnect stops admission and applies the same finite drain-set and drain-time contract as warm mode. Every accepted call receives a terminal JSON-RPC result/error when stdout remains writable. There is no private shutdown method.
Roots and resources
When the client advertises roots, the server requests roots/list after initialization. Only bounded local file:// directory URIs are accepted. Each root is canonicalized and must remain beneath the configured --workspace-root; parent, absolute argument, symlink, non-file, duplicate, inaccessible, and unadvertised-root escapes fail closed. Calls must select an exact returned URI when multiple roots exist. Clients without the roots capability receive only the configured boundary as their implicit root.
resources/list and resources/read expose the generated CLI schema, generated MCP profile, core card, agent profile, task-card registry, symbol index, and diagnostic catalog under genesis:// URIs. Resource templates are an empty, valid list. Embedded JSON is parsed before use; malformed authorities fail closed.
Cancellation, progress, and errors
- A valid
_meta.progressTokenproduces strictly increasing progress values0then1; no progress is emitted after completion or cancellation. notifications/cancelledterminalizes queued calls with JSON-RPC-32800and a not-started audit. For an active native call it kills and reaps the complete isolated process tree before emitting-32800; late progress/result frames are impossible. Disconnect drain cancellation uses-32005or-32006.- Initialization advertises
experimental.genesis/sessionResourceswith the closed limits and their identity. Successful tool results carry the audit in_meta["genesis/sessionAudit"]; cancellation, resource, worker, and drain errors carry it inerror.data.audit. An oversized transport fallback preserves this audit. - Parse, request-shape, method, parameter, initialization, root, queue, frame, output, worker, and resource failures use bounded JSON-RPC errors. CLI semantic failures remain typed Genesis tool results rather than transport failures.
- Request cancellation never applies to
initialize, because initialization is complete before its response can be targeted as an active tool request.
The implementation authorities are crates/gc_cli_driver/src/mcp/, crates/gc_cli_driver/src/cli_schema.rs, and the canonical command handlers. scripts/check_warm_protocol_contract.sh verifies schema generation, lifecycle, roots, resources, progress, cancellation controls, task rejection, malformed frames, output purity, and production CLI execution.
Transactional Agent Sessions v0.1
genesis session is the mutating agent boundary. Its durable state uses genesis/agent-transaction-v0.1, snapshots use genesis/workspace-snapshot-v0.1, and both are closed by docs/spec/AGENT_TRANSACTION_v0.1.schema.json; command results use the six stable kinds listed above. A transaction has one client-selected 1..64 byte ASCII identifier, one immutable base snapshot, one current snapshot, an ordered semantic-patch chain, one exact-snapshot verification record, and one of the states open, applied, or aborted.
Snapshot and isolation contract
session beginrecursively captures the selected package manifest, declared modules, declared capability policy, and base-relative local dependency closure. Inputs must be regular files beneath the package root, and no path component may be a symlink. Retained path material is valid UTF-8 with nonempty/-separated segments; absolute,.,.., empty, backslash, and control-character forms are rejected both on capture and on load.- File blobs and sorted snapshot manifests use domain-separated BLAKE3 identities. Every new or reused object is rehashed and length-checked before materialization and again before a live write. State, responses, and errors contain only relative names, client IDs, counts, and content identities, never absolute host paths.
- The current snapshot is materialized below
.genesis/agent-sessions/.session stageaccepts one canonical Genesis semantic patch, applies it to a fresh candidate materialization, and runs package obligations there. The live package is not mutated. The ordered session chain records the GenesisCode-authoritative normalized semanticpatch-h, so source formatting cannot fork patch identity; any source-byte digest is an internal staging locator only. Failed patch parsing or application never activates the candidate. session testrehashes the isolated workspace before running obligations and binds the acceptance artifact to that exact current snapshot. Capability policies must already belong to the captured snapshot; external policy paths cannot silently broaden authority.session applyis explicit and fail-closed. It acquires the package-local apply lock, requires a successful verification for the exact current snapshot, rehashes both isolated and live inputs, rejects any stale live base, writes only snapshot-managed files, verifies the result, and retains the transaction record asapplied. A failed managed-file write, post-write identity check, or state commit restores and rehashes the captured base or reports a distinct rollback failure.session abortcloses an open transaction without modifying the live package. Closed transactions cannot be staged, tested, applied, or aborted again, but remain inspectable throughsession status.
Snapshot admission is bounded to 4096 files and 256 MiB. Session IDs, object locations, snapshot membership, stale-base comparison, verification identity, and lifecycle state all fail closed. Arbitrary byte editing is intentionally not a session authority: writes enter through semantic patches. O(1)-logical copy-on-write forks and multi-candidate ranking remain the separately measured R1.6 contract.