scripts

August 3, 2026 · View on GitHub

Maintenance and automation scripts for Soma. Shell scripts target Bash and generally use set -euo pipefail; Python scripts run with python3.

This README is the index for everything under scripts/. When a script is added, renamed, or materially changed, update the quick index and the reference entry.

Regenerating The Inventory

The committed generated script index lives at docs/generated/scripts-index.md and is refreshed by:

cargo xtask generate-docs

The raw file list can also be generated directly from git:

rg --files scripts | sort

Useful starter for extracting script headers while updating this README:

for f in scripts/*.sh scripts/*.py; do
  printf '\n## %s\n' "$f"
  sed -n '1,40p' "$f"
done

The descriptions below are hand-curated from each script's current behavior, usage text, Justfile wiring, CI references, and hook integration.

Quick Index

Release And Versioning

FileTypeEntry pointsWhat it does
install.shBash installercurl -fsSL https://raw.githubusercontent.com/dinglebear-ai/soma/main/scripts/install.sh | bashInstalls the checksum-verified Linux x86_64 release archive; the published root install.sh remains a thin compatibility shim.
pre-release-check.shBash wrappercargo xtask pre-release-check, just pre-releaseDelegates to xtask for the release-readiness gate: patterns, plugin layout, schema/OpenAPI docs, scaffold contract, Soma smoke tests, release version checks, blob size, ASCII hygiene, just verify, plugin build, and optional mcporter tests.
bump-version.shBash wrapper`cargo xtask bump-version soma <majorminor
check-version-sync.shBash wrappercargo xtask check-version-syncThin wrapper for the xtask manifest-backed version sync gate.
check-dependency-updates.shBash wrappercargo xtask check-dependency-updates, just deps-checkDelegates to xtask for a read-only dependency drift report using cargo update --dry-run plus optional crates.io latest-version checks.
check-python-platform-policy.pyPython policy gatecargo xtask check-docs, CIVerifies the Python provider remains x86_64-only across Linux, macOS, and Windows and that its release workflow pins the approved OIDC PyPI publisher, provenance, SBOM, checksum, and recovery contracts.
check-blob-size.pyPython wrappercargo xtask check-blob-size, just blob-size-check, CIDelegates to xtask to block changed git blobs above the configured size budget unless allowlisted.
blob-size-allowlist.txtDataused by check-blob-size.pyAllowlist patterns for intentional large artifacts.

Generated Contracts And Docs

FileTypeEntry pointsWhat it does
check-schema-docs.pyPython wrappercargo xtask check-schema-docs, just schema-docs, just schema-docs-check, CIDelegates to xtask to generate/check docs/MCP_SCHEMA.md and related action references from the canonical action specs.
check-openapi.pyPython wrappercargo xtask check-openapi, just openapi, just openapi-check, CIDelegates to xtask to generate/check docs/generated/openapi.json for the REST API surface.
generate-docs.pyPythoncargo xtask generate-docs, cargo xtask check-docs, CIGenerates/checks volatile docs and metadata from the service-owned ACTION_SPECS (including modular Python lifecycle specs), ENV_KEY_SPECS, and typed config defaults.
check-stale-claims.pyPythoncargo xtask check-stale-claims, CIFails when known stale hardcoded Soma claims reappear.
check-readme-guide.pyPythonpython3 scripts/check-readme-guide.py README.mdAudits RMCP READMEs against docs/RMCP_README_GUIDE.md structural invariants before fleet alignment.
check-scaffold-intent-contract.pyPython wrappercargo xtask check-scaffold-intent-contract, just scaffold-contract-check, CIDelegates to xtask to validate the scaffold intent JSON schema and checked-in examples without third-party packages.
generate-synapse-operation-fixture.pyPython contract tooljust synapse-operation-contract-check, just synapse-operation-contract-generateGenerates the pinned 59-operation Synapse semantic fixture and validates names, dispatch shapes, exact scopes, destructive/transport metadata, parameter groups, source provenance, donor identity, and the deterministic semantic digest.
generate-synapse-canonical-classifications.pyPython contract tooljust synapse-canonical-contract-check, just synapse-canonical-contract-generateGenerates and validates the digest-bound canonical OperationSpec registry, including mutation safety, target kinds, lifecycle support, retry/idempotency, versioned parameter/result schema IDs, stable diagnostic codes, evidence, and backend capability requirements.
generate-operation-surface-contracts.pyPython contract tooljust operation-surface-contracts-check, just operation-surface-contracts-generateGenerates 59 closed canonical parameter schemas and the complete 33-code projection table for CLI exits, HTTP statuses, MCP error codes, event severity, retry, and terminal semantics.
generate-operation-result-contracts.pyPython contract tooljust operation-result-contracts-check, just operation-result-contracts-generateGenerates 59 closed canonical result payload schemas across 13 normalized output families, including bounded text/artifact, command, fanout, transfer, diff, metrics, status, mutation, and inventory shapes.
check-synapse-product-import.pyPython import contractjust synapse-product-import-checkProves the temporary crates/synapse/import subtree matches the reviewed tree locked beside the donor provenance, contains exactly 386 tracked files, resolves only the synapse and xtask packages, and remains outside Soma's root Cargo workspace.
generate-unify-manifest.pyPython package tooljust unify-manifest-check, just unify-manifest-generateGenerates and validates docs/unify/MANIFEST.yaml plus CHECKSUMS.sha256 from the pinned donor lock and current package files. Requires PyYAML.
check-coupled-files.shBash wrappercargo xtask check-coupled-files, just coupled-files-check, CIDelegates to xtask to warn when files that usually change together drift, such as script edits without scripts/README.md updates.
refresh-docs.shBash wrappercargo xtask refresh-docs, just refresh-docs*Delegates to xtask to refresh ignored protocol, SDK, Claude Code, and mcporter references under docs/references/.

Plugin And MCP Validation

FileTypeEntry pointsWhat it does
conformance_report.pyPythonjust conformance-reportSummarizes official MCP conformance checks.json result files under results/, with optional JSON output for audits.
ci/mcp-conformance.shBashjust conformance-matrix, CIRuns the pinned server/client conformance matrix with per-run output isolation, RMCP-revision-keyed build artifacts, and retry-safe dynamic server ports.
ci/mcp-conformance-port.shBash librarysourced by ci/mcp-conformance.shHolds cooperative per-port locks for parallel matrix jobs; the caller retains the lock for the Soma child lifetime and retries non-cooperating bind races.
validate-plugin-layout.shBash wrappercargo xtask validate-plugin-layout, just validate-plugin, CIDelegates to xtask to validate Claude, Codex, and Gemini plugin packaging conventions.
check-plugin-hook-contract.pyPython wrappercargo xtask check-plugin-hook-contractDelegates to xtask to audit cross-repo plugin setup hook JSON contracts, optionally executing setup commands.
check-plugin-stdio-smoke.shBash wrappercargo xtask check-plugin-stdio-smoke, docs/contractsDelegates to xtask to smoke-test the installed stdio plugin binary with JSON-RPC initialize plus status.
test-mcp-auth.shBash wrappercargo xtask test-mcp-auth, just test-mcp-authDelegates to xtask to smoke-test HTTP MCP bearer-auth behavior.
test-trace-headers.shBash smoke testscripts/test-trace-headers.shExercises trusted HTTP trace-header modes, _meta precedence, CORS exposure, and outbound non-propagation against a live Soma server.
generate-cli.shBash wrappercargo xtask generate-cli, just generate-cliDelegates to xtask to use mcporter to generate a standalone CLI from a running MCP server schema.
sync-cargo.shBash wrappercargo xtask sync-cargo, plugin hook/runtime supportDelegates to xtask to copy Cargo.lock into plugin data directories, falling back to cargo fetch if needed.

Soma And Local Runtime Checks

FileTypeEntry pointsWhat it does
test-soma-features.shBash wrappercargo xtask test-soma-features, just soma-features, CIDelegates to xtask for fast Soma invariant smoke tests.
check-cargo-generate.pyPython wrappercargo xtask cargo-generate, docsThin wrapper for the xtask-owned cargo-generate smoke test.
check-runtime-current.shBash wrappercargo xtask check-runtime-current, just runtime-currentDelegates to xtask to check whether the running systemd unit or Docker container uses the expected/current artifact.
repair.shBash wrappercargo xtask repair, just repairDelegates to xtask to stop, rebuild, and restart the local soma-mcp service through systemd or Docker Compose.

Hygiene And Developer Workflow

FileTypeEntry pointsWhat it does
ci/changed_paths.pyPythonscripts/ci/pre_push.py, future CI routingClassifies changed paths into coarse categories such as rust, web, docker, MCP, release, security, and Soma; keep its path taxonomy in parity with cargo xtask changed-paths.
ci/pre_push.pyPythonlefthook pre-push, just pre-push, just pre-push-planRuns a path-aware local pre-push plan. Full mode prepares and tests the Python SDK before nextest, matching hosted CI ordering; opt in with SOMA_FULL_PRE_PUSH=1 or just pre-push-full.
with_timeout.shBashlefthook.ymlApplies a wall-clock budget to local hook commands so one check cannot stall commits indefinitely.
check_lefthook_pre_commit_speed.pyPythonlefthook.yml, just lefthook-speed-check, CIFails if the pre-commit stage grows workspace-scale cargo/test/build commands.
block-env-commits.shBash wrappercargo xtask block-env-commits, lefthook pre-commitDelegates to xtask to prevent staged .env* secret files from being committed, except .env.example.
check-file-size.shBash wrappercargo xtask check-file-size, just file-size-check, lefthook pre-commitDelegates to xtask to enforce staged source-file size budgets.
asciicheck.pyPython wrappercargo xtask asciicheck, through run-ascii-check.shDelegates to xtask to check files for unexpected non-ASCII characters and optionally fix common smart punctuation.
run-ascii-check.shBash wrappercargo xtask run-ascii-check, just ascii-check, just ascii-fix, CIDelegates to xtask to collect tracked text-like files and run asciicheck.py.
kache-gate.shBash.github/workflows/ci.yml (before/after each cached build)Fails the job when the kache compiler cache silently degrades - dead daemon, unreachable remote, or a hit rate under the configured floor. kache is fail-open, so without this a broken cache is a green, slow build.
kache-gate-selftest.shBashscripts/kache-gate-selftest.shProves the gate rejects a degraded build and passes a healthy one, plus its baseline scoping. A gate that always passes hides breakage; one that always fails gets ignored.
build-web.shBash wrappercargo xtask build-web, just build-webDelegates to xtask to build the optional Next.js static web UI export.
web-watch.shBash wrappercargo xtask web-watch, just web-watchDelegates to xtask to rebuild the optional web UI on changes using watchexec.

Script Reference

asciicheck.py

cargo xtask asciicheck README.md Justfile
cargo xtask asciicheck --fix README.md
just ascii-check
just ascii-fix

Checks files for unexpected non-ASCII characters. --fix replaces common smart punctuation with ASCII equivalents. A small allowlist permits intentional documentation glyphs such as section signs, arrows, and box-drawing characters.

Usually run through cargo xtask run-ascii-check, which provides the repo's tracked-file selection.

blob-size-allowlist.txt

Data file for scripts/check-blob-size.py.

Each non-comment line is a glob pattern for an intentional large artifact. The checker strips comments and blank lines, then treats matching paths as allowlisted instead of failing the size budget.

Currently allowlists crates/shared/codex-app-server-client/schema/protocol.schema.json (a vendored JSON Schema build.rs reads directly to generate protocol types - see that crate's README).

block-env-commits.sh

cargo xtask block-env-commits

Thin wrapper for cargo xtask block-env-commits.

The xtask command inspects the git staging area and rejects staged .env, .env.local, .env.prod, .env.staging, or other .env* files. .env.example is explicitly allowed.

Used by lefthook.yml.

build-web.sh

cargo xtask build-web
just build-web

Builds the optional Next.js web UI static export from apps/web/. If apps/web/ is absent, the script exits successfully without doing anything. If node_modules/ is missing, it runs pnpm install --frozen-lockfile, then pnpm build.

Output lands in apps/web/out/ and is embedded into the binary by the web feature.

bump-version.sh

scripts/bump-version.sh patch
scripts/bump-version.sh minor
scripts/bump-version.sh major

Thin wrapper for:

cargo xtask bump-version soma <major|minor|patch>

It updates every version-bearing file declared for the soma component in release/components.toml. Plugin manifests intentionally remain versionless.

check-blob-size.py

cargo xtask check-blob-size
cargo xtask check-blob-size --base origin/main --head HEAD --max-bytes 512000
just blob-size-check

Checks changed git blobs between a base and head ref. Defaults to origin/main, then main, then HEAD~1 if needed. Files over the byte budget fail unless a matching pattern is present in scripts/blob-size-allowlist.txt.

Binary changes are reported as binary so reviewers can distinguish large text files from generated artifacts.

check-cargo-generate.py

cargo xtask check-cargo-generate
cargo xtask check-cargo-generate --help

Thin wrapper for cargo xtask cargo-generate. It runs:

cargo xtask cargo-generate <args>

from the repository root and returns the xtask exit code. The real implementation and maintained usage live in xtask.

check-coupled-files.sh

cargo xtask check-coupled-files
cargo xtask check-coupled-files origin/main HEAD
just coupled-files-check

Thin wrapper for cargo xtask check-coupled-files.

The xtask command checks changed paths and reports likely documentation or automation drift:

  • Justfile without lefthook.yml, or vice versa.
  • scripts/* without scripts/README.md.
  • crates/soma/mcp/src/schemas.rs without docs/MCP_SCHEMA.md.
  • plugin package changes without docs/PLUGINS.md.

Used in CI as a guardrail. It intentionally reports coupled-file concerns rather than trying to infer every valid exception.

ci/pre_push.py

python3 scripts/ci/pre_push.py --dry-run
SOMA_FULL_PRE_PUSH=1 python3 scripts/ci/pre_push.py

Runs the path-aware local pre-push plan used by lefthook, just pre-push, and just pre-push-plan. Rust-category changes run version sync, script syntax checks, workflow linting, coupled-file checks, cargo xtask check-architecture, clippy, focused nextest, schema docs, and release version gates. Set SOMA_FULL_PRE_PUSH=1 or use just pre-push-full for the full local suite.

conformance_report.py

just conformance-report
python3 scripts/conformance_report.py --results results
python3 scripts/conformance_report.py --results results --json

Summarizes checks.json files emitted by the official MCP conformance suite. The text output is intended for quick local audits; --json emits a stable machine-readable summary with total checks, pass rate, status counts, per-scenario counts, and non-success failures.

check-dependency-updates.sh

cargo xtask check-dependency-updates
cargo xtask check-dependency-updates --skip-search
cargo xtask check-dependency-updates --fail-on-updates
just deps-check

Read-only dependency update report. It runs cargo update --dry-run for lockfile-compatible updates, then checks direct root dependencies against crates.io unless --skip-search is used.

Options:

OptionEffect
--skip-searchSkip crates.io latest-version checks.
--fail-on-updatesExit 1 when possible updates are detected.
-h, --helpShow help.

check-file-size.sh

cargo xtask check-file-size
scripts/check-file-size.sh
MAX_RS=450 MAX_TS=350 cargo xtask check-file-size
just file-size-check

Thin wrapper for cargo xtask check-file-size.

The xtask command checks staged .rs, .ts, and .tsx files against effective production-line budgets. Test files are exempt. Rust trailing inline #[cfg(test)] mod ... blocks are excluded from the production count.

Defaults:

VariableDefaultMeaning
MAX_RS350Maximum effective production lines for Rust files.
MAX_TS300Maximum effective production lines for TypeScript/TSX files.

Used by lefthook.yml.

check-openapi.py

cargo xtask check-openapi --write
cargo xtask check-openapi --check
just openapi
just openapi-check

Generates docs/generated/openapi.json for Soma REST API surface:

  • public /health and /status
  • direct /v1/* business routes
  • /v1/capabilities
  • deprecated retired REST action-envelope route compatibility envelope

The version comes from Cargo.toml. The REST action enum is derived from crates/soma/domain/src/actions.rs, excluding MCP-only actions.

check-python-platform-policy.py

python3 scripts/check-python-platform-policy.py

Validates the Python provider's release policy across packaging metadata, workflows, and documentation. The gate requires x86_64 wheels for Linux, macOS, and Windows; rejects ARM/AArch64/QEMU release contracts; and keeps the approved OIDC PyPI publisher SHA aligned with .github/workflows/python-wheels.yml alongside provenance, SBOM, checksum, and immutable-tag recovery requirements.

check-readme-guide.py

python3 scripts/check-readme-guide.py README.md
python3 scripts/check-readme-guide.py /home/jmagar/workspace/gotify-rmcp/README.md

Audits one or more README files against the high-signal invariants in docs/RMCP_README_GUIDE.md: first-screen value prop, product boundary, installation/client paths, runtime surfaces, MCP/CLI reference, credential boundaries, generated-vs-curated docs ownership, distribution contracts, and verification sections, plus the short related-server family section.

The related-server catalog identifies Soma by its canonical https://github.com/dinglebear-ai/soma repository URL so generated README links do not fall back to the pre-organization owner.

This is a fleet-alignment helper, not a full prose linter. It intentionally checks structure and obvious credential-in-arguments mistakes before a human does the final README pass.

generate-docs.py

python3 scripts/generate-docs.py --write
python3 scripts/generate-docs.py --check
cargo xtask generate-docs
cargo xtask check-docs

Generates volatile docs and metadata from canonical Rust specs:

  • docs/ENV.md
  • .env.example
  • config.soma.toml
  • apps/web/lib/generated-actions.ts
  • docs/generated/plugin-settings.md
  • docs/generated/scripts-index.md

The action parser expands module-qualified entries in ACTION_SPECS, currently the Python lifecycle constants in actions_python.rs, and resolves reused parameter groups in source order. Unresolved action or parameter references fail closed instead of silently disappearing from web, README, and plugin-skill output.

The checker fails when any generated file drifts. Env var descriptions, defaults, and placeholders (including per-provider OAuth vars like SOMA_MCP_AUTHELIA_* and SOMA_MCP_GITHUB_*) are hand-curated in this script's env_purpose/env_default/placeholder_for maps — add new vars there, not just to ENV_KEY_SPECS, or --check will fail with a missing description/default/placeholder.

check-stale-claims.py

python3 scripts/check-stale-claims.py
cargo xtask check-stale-claims

Scans non-generated source/docs for Soma claims that should not reappear, such as stale old local-port examples, old MCP port defaults, or explicit plugin manifest version fields. The locked Synapse import snapshot under crates/synapse/import is excluded because its product-specific and historical claims must remain byte-for-byte identical to the reviewed import-tree lock.

check-plugin-hook-contract.py

cargo xtask check-plugin-hook-contract
cargo xtask check-plugin-hook-contract --execute

Audits plugin setup hooks across known Rust MCP server repositories in the workspace. Static mode checks expected files and JSON contract shape. --execute runs each binary setup command in an isolated temporary data directory and validates the emitted contract JSON.

This is an operator/release audit tool, not a normal per-commit check.

check-plugin-stdio-smoke.sh

cargo xtask check-plugin-stdio-smoke
BIN=soma TIMEOUT_SECS=10 cargo xtask check-plugin-stdio-smoke

Thin wrapper for cargo xtask check-plugin-stdio-smoke.

The xtask command smoke-tests the installed stdio MCP binary used by plugin manifests. It sends a minimal JSON-RPC sequence:

  1. initialize
  2. notifications/initialized
  3. tools/call for the soma tool with action=status

The response is parsed in Rust; the command passes only when the status result is ok.

Environment:

VariableDefaultMeaning
BINsomaBinary to execute from PATH.
TIMEOUT_SECS5Timeout for the stdio exchange.

check-runtime-current.sh

scripts/check-runtime-current.sh
scripts/check-runtime-current.sh --mode systemd --expected-binary target/release/soma
scripts/check-runtime-current.sh --mode docker --pull --compose-dir .
just runtime-current

Checks whether the live runtime is using the expected/current artifact.

Systemd mode compares the running process hash from /proc/<pid>/exe against the unit ExecStart binary and, when supplied, --expected-binary.

Docker mode compares the running container image ID with the local Docker Compose image ID. --pull refreshes the Compose image before comparison.

Options:

OptionMeaning
`--mode autosystemd
--pullDocker mode only: pull before comparing.
--unit NAMESystemd user unit. Default: soma-mcp.service.
--service NAMEDocker Compose service/container. Default: soma-mcp.
--compose-dir DIRDocker Compose project directory. Default: current directory.
--expected-binary PATHSystemd mode: also compare against this binary.

Soma adopters should rename SOMA_*, service, and binary defaults.

check-scaffold-intent-contract.py

cargo xtask check-scaffold-intent-contract
just scaffold-contract-check

Validates docs/contracts/scaffold-intent.schema.json plus JSON examples under docs/contracts/examples/.

The validator intentionally avoids third-party dependencies. It checks the schema shape and the specific semantic constraints the scaffold handoff relies on; it is not a full JSON Schema implementation.

generate-synapse-operation-fixture.py

just synapse-operation-contract-check
just synapse-operation-contract-generate /home/jmagar/workspace/synapse origin/main

generate reads src/actions/operations.rs from the requested Synapse Git ref, records the canonical repository, full commit, source SHA-256, ordered source lines, and per-macro hashes, preserves the complete legacy dispatch contract, and writes docs/unify/03-contracts/examples/synapse-operations.json. The fixture carries a deterministic semantic SHA-256 over all operation records. check validates structure, distributions, access/scope binding, parameter groups, provenance, and the semantic digest without requiring a donor clone; passing --donor-repo additionally proves byte-for-byte parity with a live donor ref.

generate-synapse-canonical-classifications.py

just synapse-canonical-contract-check
just synapse-canonical-contract-generate

Consumes the pinned legacy semantic fixture and generates docs/unify/03-contracts/examples/synapse-canonical-operations.json. All 21 mutations have explicit safety and lifecycle decisions; read-only operations use bounded domain rules. Check mode proves complete 59-operation coverage, exact parameter parity, risk/planning and retry/idempotency invariants, deterministic parameter/result SchemaId values, stable per-operation diagnostic vocabularies, evidence and capability requirements, and a classification SHA-256. The Rust integration test deserializes every generated entry directly into OperationSpec.

generate-operation-surface-contracts.py

just operation-surface-contracts-check
just operation-surface-contracts-generate

Generates 59 closed Draft 2020-12 parameter schemas from the canonical registry and one complete projection table for all 33 stable diagnostic codes. Canonical schemas exclude Flux/Scout routing and presentation fields. Check mode proves coverage, schema IDs, required fields, exclusivity, stable digests, and exact CLI/HTTP/MCP/event/retry projection coverage.

generate-operation-result-contracts.py

just operation-result-contracts-check
just operation-result-contracts-generate

Generates 59 closed canonical result payload schemas across 13 normalized families. Text and command outputs support bounded inline values or protected artifact references; inventory, metrics, status, mutation, fanout, transfer, diff, and diagnostic-report payloads have stable top-level shapes. Legacy JSON is projected above these schemas rather than becoming the shared contract.

generate-unify-manifest.py

just unify-manifest-check
just unify-manifest-generate

Builds the documentation-package manifest from docs/unify/05-migration/donors.lock.toml, hashes every non-self-referential package file, then writes a checksum list that covers every package file except the checksum file itself. The check mode fails on stale metadata, file hashes, counts, or checksums.

check-schema-docs.py

cargo xtask check-schema-docs --write
cargo xtask check-schema-docs --check
just schema-docs
just schema-docs-check

Treats crates/soma/domain/src/actions.rs::ACTION_SPECS as canonical and generates/checks docs/MCP_SCHEMA.md.

It also checks that action docs stay mentioned in key user-facing surfaces such as the README and plugin skill text. Action descriptions are maintained in this script, so new actions usually require a script update plus a generated docs refresh.

check-version-sync.sh

cargo xtask check-version-sync
cargo xtask check-version-sync /path/to/project

Thin wrapper for:

cargo xtask check-version-sync

The xtask validates release/components.toml, exact JSON pointers, Cargo and Cargo.lock parity, MCP registry metadata, OpenAPI version, changelog heading, and plugin-manifest versionlessness.

generate-cli.sh

SOMA_MCP_TOKEN=... cargo xtask generate-cli
just generate-cli

Generates a standalone CLI binary for this server through:

mcporter generate-cli

Requirements:

  • a running MCP server on http://localhost:40060/mcp
  • mcporter available on PATH
  • optional SOMA_MCP_TOKEN for bearer-authenticated schema fetches

The script fetches /mcp/tools/list, hashes the schema, and skips regeneration when dist/.cache/soma-cli.schema_hash already matches and dist/soma-cli exists. The generated CLI embeds the token; do not commit or share it.

Soma adopters must update the port, generated binary name, and token env var.

kache-gate.sh

scripts/kache-gate.sh --baseline    # before the build: snapshot cumulative counters
scripts/kache-gate.sh               # after the build: diff and enforce

Turns a silently-degraded compiler cache into a red job.

kache is fail-open by design: it never fails a build over a cache problem. A dead daemon, an unreachable remote, or a mis-normalized cache key all present as a green build that is merely slow. soldr degraded exactly that way for a full day before anyone noticed, which is why this gate exists.

It works by baseline-and-diff, not kache report --since. In kache 0.12.0 --since does not actually bound the event window - the summary counters are cumulative over the whole event log - so a --since-based gate would go permanently red after one historical store failure, and pass forever after one historical remote hit. Snapshotting before the build and diffing after is exact rather than time-windowed, and stays correct if upstream later fixes --since.

VariableDefaultMeaning
KACHE_GATE_BASELINE$RUNNER_TEMP//tmp + /kache-gate-baseline.jsonSnapshot path.
KACHE_GATE_MIN_HIT_RATE0Integer percent floor, applied to this build's delta.
KACHE_GATE_REQUIRE_REMOTE01 requires new remote hits this build.
KACHE_GATE_REQUIRE_DAEMON01 requires a reachable daemon.
KACHE_GATE_ROOT$PWDBuild tree to scope to.

Exit codes: 0 pass, 1 gate violation, 2 report unusable.

kache-gate-selftest.sh

scripts/kache-gate-selftest.sh

Proves kache-gate.sh rejects a degraded build and its baseline-and-diff scoping works.

Both failure directions are tested deliberately: a gate that only ever passes converts "the cache broke" into "CI is green", and a gate that always fails trains people to ignore it.

pre-release-check.sh

cargo xtask pre-release-check
cargo xtask pre-release-check --skip-verify --skip-build-plugin
cargo xtask pre-release-check --mcporter
just pre-release

Runs the release-readiness gate.

Always runs:

  • cargo xtask patterns
  • just validate-plugin
  • cargo xtask check-schema-docs --check
  • cargo xtask check-openapi --check
  • cargo xtask check-scaffold-intent-contract
  • cargo xtask test-soma-features
  • cargo xtask check-release-versions --base origin/main --head HEAD --mode pr
  • cargo xtask check-blob-size
  • just ascii-check

By default it also runs just verify and just build-plugin. --mcporter adds just test-mcporter, which requires a running server.

refresh-docs.sh

cargo xtask refresh-docs
cargo xtask refresh-docs --dry-run
cargo xtask refresh-docs --skip-crawl
cargo xtask refresh-docs --skip-repomix
just refresh-docs
just refresh-docs-dry

Refreshes ignored reference docs under docs/references/.

Current inputs:

  • crawled docs from https://modelcontextprotocol.io
  • crawled docs from https://code.claude.com
  • Repomix packs for modelcontextprotocol/rust-sdk
  • Repomix packs for modelcontextprotocol/modelcontextprotocol
  • Repomix packs for modelcontextprotocol/registry
  • mcporter docs/source references

Environment:

VariableDefaultMeaning
AXON_OUTPUT_DIR~/.axon/outputAxon host output directory.
REPOMIX_BINauto-detectedRepomix executable; falls back to npx --yes repomix.

Soma adopters should add service-specific docs and repos in the marked CUSTOMIZE: sections.

repair.sh

cargo xtask repair
just repair

Stops, rebuilds, and restarts the local soma-mcp service.

Flow:

  1. Stop soma-mcp.service if active.
  2. Otherwise stop a Docker container named soma-mcp if active.
  3. Build target/release/soma with --features full.
  4. If the systemd unit exists, install the binary into ~/.local/bin/ and start the unit.
  5. Otherwise, if docker-compose.yml exists, rebuild and recreate with Docker Compose.
  6. If no manager is detected, leave the rebuilt binary in target/release/.

run-ascii-check.sh

cargo xtask run-ascii-check
cargo xtask run-ascii-check --fix
just ascii-check
just ascii-fix

Thin wrapper for cargo xtask run-ascii-check.

The xtask command collects tracked text-like files and runs scripts/asciicheck.py.

Included extensions:

  • *.md
  • *.rs
  • *.toml
  • *.json
  • *.yml
  • *.yaml
  • *.sh
  • *.py

Excluded paths:

  • docs/references/**
  • docs/sessions/**

--fix rewrites files in place using asciicheck.py --fix.

sync-cargo.sh

cargo xtask sync-cargo
CLAUDE_PLUGIN_ROOT=/path/to/repo CLAUDE_PLUGIN_DATA=/path/to/data cargo xtask sync-cargo

Thin wrapper for cargo xtask sync-cargo.

The xtask command copies Cargo.lock from CLAUDE_PLUGIN_ROOT to CLAUDE_PLUGIN_DATA when the destination is missing or stale. If the copy fails, it runs cargo fetch against the source manifest. If both fail, it removes the destination lockfile and exits non-zero.

Used by plugin/runtime setup paths that need Cargo metadata in a plugin data directory.

test-mcp-auth.sh

SOMA_MCP_TOKEN=... cargo xtask test-mcp-auth
cargo xtask test-mcp-auth --url http://localhost:40060/mcp --token ...
cargo xtask test-mcp-auth --check-x-api-key
just test-mcp-auth

Smoke-tests HTTP MCP bearer auth:

  • /health is public.
  • /mcp rejects missing bearer tokens.
  • /mcp rejects bad bearer tokens.
  • /mcp accepts the configured bearer token.
  • --check-x-api-key optionally checks x-api-key behavior.

The default URL is Soma's local MCP endpoint. Soma adopters should update examples and env var names.

test-soma-features.sh

cargo xtask test-soma-features
just soma-features

Fast shell smoke tests for Soma invariants that are awkward to express as Rust tests.

Current checks:

  • .env guard blocks staged secrets.
  • .env.example remains allowed.
  • the inline agent-doc symlink pattern creates AGENTS.md and GEMINI.md symlinks pointing at CLAUDE.md.
  • cargo xtask validate-plugin-layout passes.
  • cargo xtask check-schema-docs --check passes.
  • cargo xtask run-ascii-check accepts the tracked repo file set.

validate-plugin-layout.sh

cargo xtask validate-plugin-layout
PLUGIN_ROOT=plugins/soma cargo xtask validate-plugin-layout
just validate-plugin

Validates the Claude, Codex, and Gemini plugin package layout.

It checks, among other things:

  • manifests exist and are valid JSON
  • plugin names match expectations
  • plugin manifests have no version field
  • MCP config paths are correct
  • hooks and skills are wired
  • sensitive user config fields are marked sensitive
  • stdio command/args use the expected PATH binary
  • Gemini settings map into MCP environment variables

web-watch.sh

cargo xtask web-watch
just web-watch

Runs one initial cargo xtask build-web, then watches apps/web/ and rebuilds on changes using watchexec.

Ignored paths:

  • apps/web/.next/**
  • apps/web/out/**
  • apps/web/node_modules/**

Requires:

mise install watchexec

Hook And CI Integration

Pre-commit hook scripts:

  • block-env-commits.sh
  • check-file-size.sh

CI-facing checks:

  • validate-plugin-layout.sh
  • check-schema-docs.py --check
  • check-openapi.py --check
  • check-scaffold-intent-contract.py
  • test-soma-features.sh
  • check-blob-size.py
  • check-coupled-files.sh
  • run-ascii-check.sh

Release-facing checks:

  • pre-release-check.sh
  • check-version-sync.sh
  • bump-version.sh
  • check-dependency-updates.sh
  • check-plugin-hook-contract.py
  • check-runtime-current.sh

Install hooks with:

just install-hooks

Maintenance Rule

When adding, renaming, or changing a script:

  1. Update this README.
  2. Update any Justfile recipe that calls it.
  3. Update CI or hook wiring if the script is part of a gate.
  4. If the script changes generated docs or contracts, run the matching --check command before release.