XSHELF is a deterministic Rust runtime for LLM-assisted repository work. It
wraps repo commands with bounded capture, schema-checked outputs, explicit
execution policy, and replayable telemetry.
Use it when free-form agent output is too loose for automation, CI, or operator workflows that need stable JSON contracts and inspectable failure paths.
Trust and naming:
XSHELF/CXis an independent open-source project and is not affiliated with or endorsed by OpenAI.XSHELFis the primary project name.CXremains a supported compatibility command surface during migration (./bin/cx ...).
Start with read-only checks. They do not change repository configuration.
./bin/xshelf version
./bin/xshelf task check --json
./bin/xshelf core --json
./bin/xshelf diag --json --window 20What should be visible:
versionprints the XSHELF runtime version.task check --jsonreports task orchestration readiness.core --jsonprints machine-readable runtime and backend state.diag --jsonprints recent machine-readable diagnostics.- JSON output remains parseable by automation.
The short alias is available as ./bin/xs ...; the compatibility alias remains
available as ./bin/cx ....
Minimum local requirements:
bashgitjqfor JSON inspection in examples- Rust toolchain for development and local validation:
cargo,rustfmt,clippy
Optional backend tools:
ollamafor the optional local backend pathllama-clifrom llama.cpp for the optionalllamacpplocal backendmlx-lmin a Python environment for the optional macOSmlxbackend
Install shell functions and man pages:
./bin/xshelf-install
./bin/xs-install
man xs
man xshelf
man cxThen check backend health:
./bin/xshelf llm check
./bin/xshelf doctor
./bin/xshelf healthRun cxo only after readiness and backend checks are healthy. A safe first
command is a read-only repository inspection:
./bin/xshelf cxo git statusThe Rust pipeline is intentionally strict:
- Capture repository output.
- Reduce context.
- Enforce budget.
- Run the selected backend.
- Validate structured output.
- Quarantine invalid results.
- Append telemetry.
Current compatibility storage path:
- repo-scoped runtime state currently lives under
.cx/ - schemas:
.cx/schemas/ - logs:
.cx/cxlogs/ - quarantine:
.cx/quarantine/ - state/tasks/runtime metadata:
.cx/
Runtime state:
./bin/xshelf core --json
./bin/xshelf mode --json | jq .
./bin/xshelf broker show --json | jq .core/version/diag/scheduler JSON surfaces now include
backend_capabilities.runtime, a typed capability envelope with explicit nulls
for unknown support lanes.
Task graph:
./bin/xshelf task add "Implement parser hardening" --role implementer
./bin/xshelf task fanout "Ship release notes improvements" --from staged-diff
./bin/xshelf task check --json | jq .
./bin/xshelf task run-all --status pending --mode mixed
./bin/xshelf task run-all --status pending --mode parallel --max-workers 2
./bin/xshelf task run-all --status pending --events-jsonl --json
./bin/xshelf task events --limit 20 --json--events-jsonl writes additive task-events.v1 progress events to stderr and
.codex/cxlogs/task_events.jsonl, so final stdout JSON remains parseable.
Policy and telemetry:
./bin/xshelf policy show --json | jq .
./bin/xshelf telemetry 50 --json | jq .
./bin/xshelf logs stats 200 --json | jq .
./bin/xshelf logs validate --fix=false
./bin/xshelf optimize 200 --json | jq .
./bin/xshelf quota probe 30 --json | jq .Structured output:
./bin/xshelf schema list
./bin/xshelf schema list --json | jq .
./bin/xshelf next git status
./bin/xshelf diffsum-staged | jq .
./bin/xshelf commitjson | jq ../bin/xshelf llm show
./bin/xshelf llm check
./bin/xshelf llm use primary
./bin/xshelf llm use ollama llama3.1
./bin/xshelf llm use llamacpp ggml-org/Qwen3-0.6B-GGUF:Q4_0
./bin/xshelf llm use mlx local_mlx
./bin/xshelf llm models list --json | jq .
./bin/xshelf llm models add local_mlx --backend mlx --model "$MLX_MODEL_ID"
./bin/xshelf llm models inspect local_mlx --json | jq .
./bin/xshelf llm models inspect local_mlx --disk-usage --json | jq .
./bin/xshelf llm verify mlx --profile smoke --json | jq .
./bin/xshelf llm verify mlx --profile benchmark --ctx 8192 --json | jq .
./bin/xshelf llm resident show --json | jq .
CX_PROVIDER_ADAPTER=http-curl \
CX_HTTP_REQUEST_PROFILE=openai_json \
CX_HTTP_PROVIDER_URL=http://127.0.0.1:11434/v1/chat/completions \
./bin/xshelf llm resident probe-models --json | jq .
./bin/xshelf llm smoke "Respond with OK only."
./bin/xshelf llm unset modelWhen the selected model token matches a local-model registry alias or ID for the
active backend, runtime execution resolves it to the record's resolved_model.
llm show prints both alias and resolved model when applicable.
llm models inspect uses cheap path checks by default; recursive directory
accounting runs only when --disk-usage is provided.
llm resident exposes explicit resident-server capability state and an optional
/v1/models probe on opt-in HTTP adapter profiles.
llamacpp accepts either a local .gguf path or a llama.cpp Hugging Face repo
specifier. The default smoke recipe uses ggml-org/Qwen3-0.6B-GGUF:Q4_0, a
small Apache-2.0 GGUF model whose Q4_0 file is about 429 MB.
brew install llama.cpp
./scripts/llamacpp_smoke.sh
# Equivalent manual smoke:
./bin/xshelf llm use llamacpp ggml-org/Qwen3-0.6B-GGUF:Q4_0
CX_CMD_TIMEOUT_SECS=600 \
CX_LLAMA_CPP_ARGS="-n 64 --temp 0 -c 2048 --simple-io" \
./bin/xshelf cxo printf 'xshelf llamacpp smoke\n'Important runtime knobs:
- budgeting:
CX_CONTEXT_BUDGET_CHARS,CX_CONTEXT_BUDGET_LINES,CX_CONTEXT_CLIP_MODE,CX_CONTEXT_CLIP_FOOTER - timeout:
CX_CMD_TIMEOUT_SECS - backend/model:
CX_LLM_BACKEND,CX_OLLAMA_MODEL,CX_LLAMA_CPP_MODEL,CX_LLAMA_CPP_BIN,CX_LLAMA_CPP_ARGS,CX_MLX_MODEL,CX_MLX_PYTHON,CX_MLX_ARGS,CX_MLX_MAX_TOKENS,CX_MODEL - output mode:
CX_JSON_DEFAULT,CX_JSON_AUTO - execution mode:
CX_MODE,CX_SCHEMA_RELAXED - HTTP adapter policy:
CX_HTTP_PROVIDER_URL,CX_HTTP_PROVIDER_TOKEN,CX_HTTP_AUTH_PROFILE,CX_HTTP_AUTH_HEADER,CX_HTTP_AUTH_VALUE,CX_HTTP_AUTH_VALUE_FILE,CX_HTTP_AUTH_USERNAME,CX_HTTP_AUTH_PASSWORD,CX_HTTP_AUTH_PASSWORD_FILE,CX_HTTP_PROVIDER_TOKEN_FILE,CX_HTTP_REQUEST_PROFILE,CX_HTTP_PROVIDER_MODEL,CX_HTTP_PROVIDER_FORMAT,CX_HTTP_REQUIRE_HTTPS,CX_HTTP_ALLOW_LOCAL_HTTP,CX_HTTP_ALLOWED_HOSTS,CX_HTTP_CA_BUNDLE,CX_HTTP_CLIENT_CERT,CX_HTTP_CLIENT_KEY,CX_HTTP_TLS_PINNEDPUBKEY,CX_HTTP_TLS_MIN_VERSION,CX_HTTP_FOLLOW_REDIRECTS,CX_HTTP_MAX_REDIRECTS
Useful state/config commands:
./bin/xshelf mode
./bin/xshelf broker show --json | jq .
./bin/xshelf quota guard show
./bin/xshelf quota catalog show --json | jq .Canonical runtime:
- engine:
rust/cxrs - primary entrypoint:
bin/xshelf - short alias:
bin/xs - compatibility alias:
bin/cx - compatibility shell shim:
lib/cx.sh
Runtime vs development:
- end users should use
doctor,health, and command JSON surfaces - maintainers and CI run the Rust suite, compat checks, and guardrails
Operator docs:
- docs/README.md - documentation index
- docs/manuals/00_README.md - manual entrypoint
- docs/manuals/02_web/index.html - web manual index
- docs/manuals/02_web/CX_MANUAL_MASTER.html - tracked HTML reader mirror
- docs/manuals/01_pdf/CX_MANUAL_MASTER.pdf - generated master manual PDF
- docs/providers/HTTP_PROVIDER_TLS.md - HTTP/TLS operator guidance
Maintainer docs:
- docs/project/REPO_ROLE_CONTRACT.md
- docs/project/ROADMAP.md
- docs/project/RELEASE_CADENCE.md
- docs/project/PUBLIC_SURFACES.md
- docs/project/XSHELF_RENAME_MIGRATION.md
- CONTRIBUTING.md
Planning and history:
- docs/orchestration/ - phase plans, work queues, and milestone notes
- docs/turboquant/ - TurboQuant experiment archive
- docs/project/RUST_FIRST_MIGRATION.md
- docs/project/SECURITY_HISTORY_REWRITE.md
Runtime-facing validation:
./bin/xshelf doctor
./bin/xshelf health
./bin/xshelf logs validate --fix=falseMaintainer validation:
./scripts/compat_local.sh --quick
./scripts/compat_local.sh --full --out .cx/compat/latest.json
./scripts/compat_all.sh --quick
./scripts/compat_all.sh --full --out .cx/compat/all_latest.json
./bin/cx-compat-local --quickRust maintainer path:
cd rust/cxrs
cargo fmt --check
cargo clippy --all-targets -- -D warnings -D clippy::too_many_arguments
cargo test --tests -- --test-threads=1Git hook guardrails:
./bin/cx-enable-githooks
git pushRepository layout:
bin/xshelf- canonical runtime entrypointbin/xs- short runtime aliasbin/cx- compatibility runtime aliasrust/cxrs/src/main.rs- Rust binary entryrust/cxrs/src/app/mod.rs- routing/orchestrationrust/cxrs/src/modules/*.rs- runtime moduleslib/cx.sh- shell compatibility shim
Current design discipline:
- Rust is authoritative for runtime behavior, contracts, and telemetry
- no automatic checks during shell startup
- diagnostics go to stderr; pipeline output stays on stdout
- capture is internal-native only
Versioning:
- machine-readable current version:
VERSION - release history:
CHANGELOG.md, tags, andVERSION_HISTORY.md