### Setup commands Source: https://github.com/alberto-codes/judgevet/blob/main/CLAUDE.md Setup commands for the project: sync dependencies, install pre-commit hooks, and verify the CLI works. ```bash uv sync # library and CLI uv sync --extra mcp # adds the MCP runtime uv run pre-commit install uv run judgevet --help ``` -------------------------------- ### Run isolated Python doc examples with uv Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/build-docs.md Runs the isolated documentation Python example checker. Builds into a fresh temporary directory, installs the exact wheel, executes all 15 Python blocks from README/user docs, and performs a typing pass. Requires synthetic credentials and HTTP answers; blocks network access and does not inherit caller environment secrets. ```bash uv run python -m scripts.check_doc_python ``` -------------------------------- ### Create example state file Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-files.md Creates the example state file document.txt containing the text to evaluate. ```bash printf 'A short example.\n' > document.txt ``` -------------------------------- ### Set up environment and install judgevet 0.7.0 Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-judgment.md Creates a new directory, sets up a Python virtual environment, installs judgevet 0.7.0, and verifies the installation. The last command should print 0.7.0. Requires Python 3.12 or newer and Bash on Linux or macOS. ```bash mkdir judgevet-tutorial cd judgevet-tutorial python3 -m venv .venv .venv/bin/python -m pip install 'judgevet==0.7.0' .venv/bin/python -c 'import judgevet; print(judgevet.__version__)' ``` -------------------------------- ### Run doc example inventory check Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/build-docs.md Run the documentation example inventory check. It scans every fenced block in README and authored user docs, supporting both backtick and tilde fences. Maintainer procedures and generated source reference are excluded from this inventory. ```bash uv run python -m scripts.doc_example_inventory ``` -------------------------------- ### Check isolated consumer with ty check and marker verification Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/verify-package.md Creates an isolated consumer environment, installs the wheel, runs a consumer script that imports NoulAnswer, and runs ty check on the consumer file. Then verifies the installed package location and py.typed marker. Expected output includes 'All checks passed!' and 'installed package and typing marker verified'. ```bash uv venv "$artifact_dir/consumer" consumer_python="$artifact_dir/consumer/bin/python" uv pip install --python "$consumer_python" "$wheel_path" cat > "$artifact_dir/consumer_check.py" <<'PYCODE' from judgevet import NoulAnswer answer = NoulAnswer(noul=0.8) probability: float = answer.noul assert probability == 0.8 PYCODE (cd "$artifact_dir" && "$consumer_python" consumer_check.py) uv run ty check --project "$artifact_dir" --python "$consumer_python" "$artifact_dir/consumer_check.py" (cd "$artifact_dir" && "$consumer_python" - <<'PYCODE' import sysconfig from pathlib import Path import judgevet location = Path(judgevet.__file__).resolve() assert location.is_relative_to(Path(sysconfig.get_paths()["purelib"]).resolve()) assert location.with_name("py.typed").is_file() print("installed package and typing marker verified") PYCODE ) ``` -------------------------------- ### Install judgevet MCP server with uv Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Installs the judgevet MCP server as a standalone tool using uv. Use this as an alternative to pip for a persistent command installation. ```bash uv tool install 'judgevet[mcp]==0.13.0' ``` -------------------------------- ### Install judgevet and show CLI help Source: https://github.com/alberto-codes/judgevet/blob/main/README.md Install judgevet version 0.13.0 in a virtual environment and display the CLI help. Requires Python 3.12 or newer. ```bash python -m pip install 'judgevet==0.13.0' judgevet --help ``` -------------------------------- ### Clone and install hooks Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/contributor-setup.md Clones the repository and installs the pre-commit, pre-push, and commit-msg hooks using the locked development environment. Requires network access and a Bash environment; Windows and ChromeOS Linux walkthroughs are unverified. ```bash git clone https://github.com/Alberto-Codes/judgevet.git cd judgevet uv run --locked --extra mcp pre-commit install --install-hooks -t pre-commit -t pre-push -t commit-msg ``` -------------------------------- ### Verify live CLI with check_cli_wheel helper Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Define and run a helper that installs the exact wheel and pytest==9.1.1 in a separate virtual environment, verifies the installed package location with Python isolated mode, and runs the live CLI test. Requires one passed test, not a skip; a missing key skips the opt-in test but that cannot count as successful live verification. ```bash check_cli_wheel() { local cli_wheel="$1" cli_env repo_root repo_root=$(pwd) cli_env=$(mktemp -d /tmp/judgevet-cli-release.XXXXXXXX) uv venv "$cli_env" uv pip install --python "$cli_env/bin/python" "$cli_wheel" 'pytest==9.1.1' direnv exec "$repo_root" bash -e -c ' cd "$1" "$1/bin/python" -I -c "import pathlib,sysconfig,judgevet; p=pathlib.Path(judgevet.__file__).resolve(); root=pathlib.Path(sysconfig.get_paths()[\"purelib\"]).resolve(); assert p.is_relative_to(root); print(\"Installed package location verified\")" "$1/bin/python" -I -m pytest -q -o addopts= --import-mode=importlib \ -m live "$2/tests/live/test_cli_live.py" ' bash "$cli_env" "$repo_root" } check_cli_wheel "$TEST_WHEEL" ``` -------------------------------- ### questions.json content Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-files.md Example questions file content in UTF-8 JSON, using the same shape as the positional questions argument. Save as questions.json. ```json {"clear":{"type":"noul","instructions":"Is this text clear?"}} ``` -------------------------------- ### Install judgevet MCP server with pip Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Installs the judgevet MCP server with the MCP extra using pip. Requires Python 3.12 or newer. Use this for a persistent command installation. ```bash python -m pip install 'judgevet[mcp]==0.13.0' ``` -------------------------------- ### Sync dependencies and build documentation with strict validation Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/build-docs.md Run these commands from a clean checkout with Python 3.12+ and uv installed. The build writes to site/ (Git-ignored) and does not deploy. The strict build checks links and fragments, and requires the package index for dependencies. ```bash uv sync --locked --dev uv run mkdocs build --strict ``` -------------------------------- ### Install judgevet as a standalone uv tool Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/install.md Installs judgevet as a persistent standalone command with uv. If judgevet is not on PATH, run uv tool update-shell and start a new shell. ```bash uv tool install judgevet ``` -------------------------------- ### Install judgevet with pip Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/install.md Installs the judgevet library, CLI, and the judgevet-mcp command in a virtual environment with pip. Requires Python 3.12 or newer. ```bash python -m pip install judgevet ``` -------------------------------- ### Call Jev from a synchronous Python program Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-library.md This code snippet demonstrates how to call Jev from a synchronous Python program using the HTTPSystemOneAdapter. It includes setup, configuration, and a complete example. ```APIDOC ## [SYNC] Call Jev from a synchronous Python program ### Description This recipe demonstrates how to call Jev from a synchronous Python program using the `HTTPSystemOneAdapter`. It shows how to configure credentials, create an adapter, and make a system_one call. ### Method Synchronous call ### Endpoint `HTTPSystemOneAdapter.system_one` ### Parameters #### Constructor Parameters - **api_key** (string) - Required - The API key for authentication. - **base_url** (string) - Required - The base URL of the Jev service. - **network** (object) - Required - Network configuration settings. - **retry** (object) - Required - Retry policy settings. #### system_one Parameters - **state** (string) - Required - The input state to be judged. - **questions** (object) - Required - A dictionary mapping question names to `Noul` objects with instructions. - **model** (string) - Required - The model identifier to use. ### Request Example ```python from judgevet import HTTPSystemOneAdapter, Noul, bind_request_id from judgevet.adapters.inbound.logs import configure from judgevet.adapters.inbound.settings import Settings settings = Settings() configure(settings.log) key = settings.api.resolve_key() if key is None: raise SystemExit("Configure a credential source before calling Jev") with ( HTTPSystemOneAdapter( api_key=key.get_secret_value(), base_url=settings.api.base_url, network=settings.api.network_config, retry=settings.api.retry_policy, ) as adapter, bind_request_id("request-123"), ): response = adapter.system_one( state="I was charged twice.", questions={"billing": Noul(instructions="Is this about billing?")}, model="jev-1.13.0", ) print(response.nouls["billing"].noul) ``` ### Response #### Success Response - **nouls** (object) - A dictionary of Noul answers keyed by the question name. - **noul** (number) - The probability value between 0 and 1. #### Response Example ``` 0.87 ``` ### Notes - The context manager owns cleanup, including when a call raises. - For several calls, keep the adapter open around those calls and close it after the last one. - Returned values remain usable after closing. - Direct constructors do not read judgevet environment settings; explicitly read Settings and resolve a key before constructing the adapter. - Leave `JEV_API__CA_BUNDLE` unset for normal HTTPX trust roots. In a private-CA deployment, set it to your approved PEM bundle. - Certificate and hostname verification stay enabled. - See the event contract for fields and scope lifetime. - Noul semantics follow the vendor definition. - A valid answer does not prove the classification is correct. ``` -------------------------------- ### Run judgevet CLI with uvx Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/install.md Runs the judgevet CLI from any directory using uv. The base library installation also installs the judgevet command in that virtual environment. ```bash uvx judgevet --help ``` -------------------------------- ### Construct and evaluate a typed policy with judgevet.policy Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-policy-library.md This example runs without a key or network, using synthetic answers. It demonstrates constructing a Policy with NoulRule, ChoiceRule, and ScoreRule, validating it against questions, and evaluating it with answers. The report asserts that all rules pass and retains policy order. Note that every rule must pass, and bounds are inclusive. ```python from judgevet import ( Answer, Choice, ChoiceAnswer, Noul, NoulAnswer, Question, Score, ScoreAnswer, ) from judgevet.policy import ( ChoiceRule, NoulRule, Policy, ScoreRule, evaluate_policy, validate_policy, ) questions: dict[str, Question] = { "clear": Noul(instructions="Is this clear?"), "risk": Choice(criteria={"low": "Low risk", "high": "High risk"}), "quality": Score(criteria=["Poor", "Fair", "Good"]), } policy = Policy( ( NoulRule("clear", minimum=0.8), ChoiceRule("risk", "low", min_confidence=0.7), ScoreRule("quality", minimum=1.5, maximum=2, min_confidence=0.6), ) ) validated = validate_policy(policy, questions) answers: dict[str, Answer] = { "clear": NoulAnswer(0.8), "risk": ChoiceAnswer("low", 0.7, {"low": 0.7, "high": 0.3}), "quality": ScoreAnswer( 1.5, 0.6, {0: "Poor", 1: "Fair", 2: "Good"}, {0: 0, 1: 0.5, 2: 0.5}, ), } report = evaluate_policy(validated, answers) assert report.passed assert tuple(item.question for item in report.rules) == ("clear", "risk", "quality") print(report.rules[0].detail) ``` -------------------------------- ### Run judgevet MCP with uvx Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Run the published judgevet MCP server with uvx. Requires uv installed; no prior judgevet installation or source checkout. The pin identifies the published judgevet version, not transitive dependencies. Manual execution waits for MCP input; EOF ends it. Protocol frames use stdout and diagnostics use stderr. ```bash uvx --from 'judgevet[mcp]==0.13.0' judgevet-mcp ``` -------------------------------- ### Run the program: .venv/bin/python first_judgment.py Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-judgment.md Run the file with the interpreter where you installed judgevet. This command executes the first_judgment.py program. ```bash .venv/bin/python first_judgment.py ``` -------------------------------- ### Run both pre-commit stages over the complete checkout Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/contributor-setup.md Run both the pre-commit and pre-push stages over the entire checkout. Both commands must exit zero; the push stage checks coverage, all-file docstrings, isolated examples, and the dependency audit. These commands do not commit or push. ```bash uv run pre-commit run --all-files uv run pre-commit run --all-files --hook-stage pre-push ``` -------------------------------- ### Policy report example in JSON output Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-policy.md Shows the policy member added by --json to stdout. The rule report retains file order; the detail explains the comparison. Unmet policies keep successful answers on stdout. ```json {"result":"fail","rules":[{"question":"clear","pass":false,"detail":"..."}]} ``` -------------------------------- ### Verify JudgeVet MCP configuration with codex mcp get Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Run this command to inspect the saved MCP configuration for the JudgeVet server. It is useful for verifying that the configuration was applied correctly. ```bash codex mcp get judgevet ``` -------------------------------- ### Validate documented data and MCP arguments with scripts.check_doc_schemas Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/build-docs.md Run the offline schema checker to validate documented data and MCP arguments. It builds a fresh wheel, installs its MCP extra in an isolated environment, and uses the installed server's discovered ask_noul schema to validate connection-guide arguments. It makes no service call and does not launch or modify a user host. ```bash uv run python -m scripts.check_doc_schemas ``` -------------------------------- ### Download and verify TestPyPI wheel with smoke tests Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Download the dist artifact from the TestPyPI run, download the exact judgevet wheel from TestPyPI, verify only one wheel exists in each set, compare them, compute SHA256 hashes, and run all four smoke release scripts against the wheel. The policy runner additionally verifies supported import identities, base absence of MCP, py.typed, and execution/static typing of every exact Python block in the policy guide; it requires the development ty executable on PATH. ```bash EVIDENCE_DIR=$(mktemp -d /tmp/judgevet-release.XXXXXXXX) TEST_ARTIFACT="$EVIDENCE_DIR/test-artifact" TEST_INDEX="$EVIDENCE_DIR/test-index" gh run download "$TEST_RUN" --name dist --dir "$TEST_ARTIFACT" uvx --from pip pip download --index-url https://test.pypi.org/simple/ \ --no-deps --only-binary=:all: "judgevet==$VERSION" --dest "$TEST_INDEX" test_artifacts=("$TEST_ARTIFACT"/*.whl) test_downloads=("$TEST_INDEX"/*.whl) (( ${#test_artifacts[@]} == 1 )) (( ${#test_downloads[@]} == 1 )) TEST_WHEEL=${test_downloads[0]} cmp "${test_artifacts[0]}" "$TEST_WHEEL" sha256sum "${test_artifacts[0]}" "$TEST_WHEEL" direnv exec . python3 scripts/smoke_release.py --wheel "$TEST_WHEEL" direnv exec . uv run python -m scripts.smoke_policy_release --wheel "$TEST_WHEEL" direnv exec . python3 -m scripts.smoke_mcp_release --wheel "$TEST_WHEEL" direnv exec . uv run python -m scripts.smoke_registry_release --wheel "$TEST_WHEEL" ``` -------------------------------- ### Parse and evaluate a JSON policy with Noul rule Source: https://github.com/alberto-codes/judgevet/blob/main/docs/reference/policy.md Complete offline example that decodes a JSON policy with a Noul rule and compares synthetic answers. It prints nothing when the assertions pass. ```python from judgevet import Noul, NoulAnswer from judgevet.policy import evaluate_policy from judgevet.policy_json import parse_policy policy = parse_policy( '{"rules":[{"question":"clear","pass":{"noul":{"min":0.8}}}]}', {"clear": Noul(instructions="Is the text clear?")}, ) assert evaluate_policy(policy, {"clear": NoulAnswer(0.8)}).passed assert not evaluate_policy(policy, {"clear": NoulAnswer(0.79)}).passed ``` -------------------------------- ### Pass redactor to HTTPSystemOneAdapter Source: https://github.com/alberto-codes/judgevet/blob/main/docs/reference/configuration.md Synthetic example that replaces all state with a caller-approved summary. Pass the redactor to HTTPSystemOneAdapter; the callback runs once per logical call before serialization. Replace the callback, URL, and credential for real use. ```python from typing import Any from judgevet import GatewayConfig, HTTPSystemOneAdapter, Noul, StateRedactor class ReplaceState: def redact(self, state: str | dict[str, Any] | list[Any]) -> str: return "Caller-approved synthetic summary" redactor: StateRedactor = ReplaceState() with HTTPSystemOneAdapter( api_key="dummy-gateway-key", base_url="https://gateway.example/organization/jev", gateway=GatewayConfig(auth_header="x-apikey", auth_scheme=""), redactor=redactor, ) as adapter: response = adapter.system_one( state={"private_note": "Synthetic original content"}, questions={"billing": Noul(instructions="Is this about billing?")}, ) print(response.answers["billing"]) ``` -------------------------------- ### Run the mechanical check with uv Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/writing-guide.md Run this command to execute the plain English check. It is also run by commit, push, and CI checks. Findings print the file, starting line of the prose block, and the failed rule. ```bash uv run python -m scripts.check_plain_english ``` -------------------------------- ### Configure JudgeVet MCP server in Codex config.toml Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Save this TOML configuration in `.codex/config.toml` for a trusted project or in `~/.codex/config.toml` for user-wide settings. The `env_vars` key forwards the `JEV_API__KEY` environment variable without storing its value in the TOML file. After exporting the key, start Codex CLI from that shell. ```toml [mcp_servers.judgevet] command = "uvx" args = ["--from", "judgevet[mcp]==0.13.0", "judgevet-mcp"] env_vars = ["JEV_API__KEY"] ``` -------------------------------- ### Claude Desktop claude_desktop_config.json entry for judgevet Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Manual local-server setup for Claude Desktop. Merge this entry into claude_desktop_config.json. Use actual absolute paths for the executable and key file. On Windows, escape backslashes in JSON or use forward slashes. ```json { "mcpServers": { "judgevet": { "command": "uvx", "args": ["--from", "judgevet[mcp]==0.13.0", "judgevet-mcp"], "env": {"JEV_API__KEY_FILE": "/absolute/path/to/judgevet.key"} } } } ``` -------------------------------- ### Base CLI image Dockerfile Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/deploy.md Dockerfile for a base CLI image that installs the judgevet wheel without MCP and runs as a non-root user (UID/GID 65532). Select an approved base-image digest and dependency constraints for repeatable production builds; never pass vendor credentials through ARG, ENV, or COPY. ```dockerfile FROM docker.io/library/python:3.13-slim ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 COPY wheels/ /wheels/ RUN python -m pip install --no-cache-dir /wheels/*.whl USER 65532:65532 ENTRYPOINT ["judgevet"] ``` -------------------------------- ### Call Jev synchronously with HTTPSystemOneAdapter Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-library.md Complete synchronous Python program that calls Jev and prints a single probability. Requires judgevet installed and a configured credential source (environment key, mounted file, or credential command). The context manager handles cleanup, and the adapter must be kept open for multiple calls. Direct constructors do not read environment settings, so Settings is explicitly read and the key resolved before constructing the adapter. ```python from judgevet import HTTPSystemOneAdapter, Noul, bind_request_id from judgevet.adapters.inbound.logs import configure from judgevet.adapters.inbound.settings import Settings settings = Settings() configure(settings.log) key = settings.api.resolve_key() if key is None: raise SystemExit("Configure a credential source before calling Jev") with ( HTTPSystemOneAdapter( api_key=key.get_secret_value(), base_url=settings.api.base_url, network=settings.api.network_config, retry=settings.api.retry_policy, ) as adapter, bind_request_id("request-123"), ): response = adapter.system_one( state="I was charged twice.", questions={"billing": Noul(instructions="Is this about billing?")}, model="jev-1.13.0", ) print(response.nouls["billing"].noul) ``` -------------------------------- ### Commit trailers for two models (Specified-By and Generated-By) Source: https://github.com/alberto-codes/judgevet/blob/main/CLAUDE.md Example of two git trailer footers used in a commit message when a reasoning model wrote the specification and a coder implemented it. The Specified-By trailer names the model that produced the definition of ready and done, while Generated-By names the model that wrote the code. The roles are kept separate to preserve the comparison between specification and implementation. ```text Specified-By: Qwen3.8-27B-UD-Q4_K_M (local, via pi, --thinking medium) Generated-By: Qwen3-Coder-Next-UD-IQ4_XS (local, via pi) ``` -------------------------------- ### Run judgevet choice question via uvx Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Use this command to run a judgevet choice question through Pi's Bash tool. It requires the judgevet CLI to be installed or uses the uvx alternative. The command outputs JSON with the tool execution and answers. ```bash uvx --from 'judgevet==0.13.0' judgevet 'Two checks passed.' '{"choice_question":{"type":"choice","instructions":"Did the checks pass?","criteria":{"yes":"Yes","no":"No"}}}' --json ``` -------------------------------- ### Export JEV_API__KEY in Bash Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Read a TypeSafe key into the JEV_API__KEY environment variable without echoing or putting it in shell history. Use for Claude Code, Codex CLI, and Pi hosts started from a shell. Desktop/IDE launches do not necessarily inherit a terminal's environment. ```bash read -r -s -p 'TypeSafe key: ' JEV_API__KEY printf '\n' export JEV_API__KEY ``` -------------------------------- ### Run judgevet noul question via uvx Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Use this command to run a judgevet noul question through Pi's Bash tool. It requires the judgevet CLI to be installed or uses the uvx alternative. The command outputs JSON with the tool execution and answers. ```bash uvx --from 'judgevet==0.13.0' judgevet 'Two checks passed.' '{"noul_question":{"type":"noul","instructions":"Did the checks pass?"}}' --json ``` -------------------------------- ### Run the policy comparison Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-policy.md Command to run the first_policy.py script using the tutorial environment's Python interpreter. ```bash .venv/bin/python first_policy.py ``` -------------------------------- ### Bounded implementation brief template Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/delegate-work.md Use this template to dispatch a bounded implementation task. Replace every placeholder before dispatch. Keep task context short and link precise files and evidence. The brief defines the worker's role, acceptance criteria, allowed edits, and constraints, including a requirement to run the acceptance test before implementation and preserve its red output. ```text Role: bounded implementation worker. The supervisor owns acceptance and the commit. Supervisor / worker / harness: Issue and slice: Base revision and existing modifications: Accepted specification: Validation owner: Input snapshot: Decision and reason: Read first: Allowed edits: Out of scope: Acceptance: - - Run the acceptance test before implementation. Preserve its red output. Do not weaken the acceptance test to obtain green output. Run focused checks needed during edits. The assigned validation owner runs the complete hook stages once per input snapshot. Report required checks you did not run and their assigned owner. Skip session bookkeeping and backlog sweeps. Do not edit STATUS.md, CLAUDE.md or policy files unless this brief assigns them. Do not commit, push, pass --no-verify or add a gate suppression. Preserve unrelated changes. Do not reset, clean, stash or restore them. If required edits exceed the allowed scope, return the missing scope. Return: changed paths, red/green commands and output, unrun checks, remaining gaps and your model identity. Leave the diff for review and stop. ``` -------------------------------- ### Build and run judgevet CLI image Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/deploy.md Builds the image from the image directory and runs the container with --help to verify the CLI. The commands also work with podman in place of docker; the repository's acceptance run uses rootless Podman and verifies the base image omits MCP. ```bash docker build -t judgevet-job ./image docker run --rm judgevet-job --help ``` -------------------------------- ### Use GatewayConfig with HTTPSystemOneAdapter Source: https://github.com/alberto-codes/judgevet/blob/main/docs/reference/configuration.md Creates a gateway with custom auth header 'x-apikey', empty auth scheme, and default headers, then uses it with an HTTP adapter to call system_one. Replace the synthetic URL and credential with real values for actual use. ```python from judgevet import GatewayConfig, HTTPSystemOneAdapter, Noul, RequestMetadata gateway = GatewayConfig( auth_header="x-apikey", auth_scheme="", headers={"Example-Tenant": "synthetic", "Example-Route": "default"}, ) with HTTPSystemOneAdapter( api_key="dummy-gateway-key", base_url="https://gateway.example/organization/jev", gateway=gateway, ) as adapter: response = adapter.system_one( state="Synthetic support ticket", questions={"billing": Noul(instructions="Is this about billing?")}, metadata=RequestMetadata(headers={"example-route": "review"}), ) print(response.answers["billing"]) ``` -------------------------------- ### Download judgevet 0.8.0 wheel Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/deploy.md Prepares a fresh image/wheels directory and downloads the judgevet 0.8.0 wheel without dependencies. Use a clean directory so an older wheel cannot enter the image; for a release candidate, use its verified downloaded wheel instead. ```bash mkdir -p image/wheels python -m pip download --no-deps --only-binary=:all: \ 'judgevet==0.8.0' --dest image/wheels ``` -------------------------------- ### Run and verify TestPyPI workflow with gh Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Dispatch the test-publish workflow on the release branch, then list runs, capture the run ID, verify the head SHA matches, watch for success, and view verbose output. The version input is descriptive, not enforced; the checkout determines the actual version. ```bash gh workflow run test-publish.yml --ref "$RELEASE_BRANCH" -f "version=$VERSION" gh run list --workflow test-publish.yml --branch "$RELEASE_BRANCH" \ --json databaseId,headSha,createdAt,status,url read -r -p 'TestPyPI run ID for this dispatch: ' TEST_RUN test "$(gh run view "$TEST_RUN" --json headSha --jq .headSha)" = "$HEAD_SHA" gh run watch "$TEST_RUN" --exit-status test "$(gh run view "$TEST_RUN" --json conclusion --jq .conclusion)" = success gh run view "$TEST_RUN" --verbose ``` -------------------------------- ### Freeze the candidate: verify release PR and version files Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Run from the repository root with Python 3.12+, gh, uv, and direnv configured. Prompts for the release PR number and intended version, then verifies the PR checks, fetches branches, validates the head commit, and displays the version files and changelog. Requires the vendor key via the approved environment and must not print it or enable shell tracing. ```bash set -euo pipefail shopt -s nullglob read -r -p 'Release PR number: ' PR read -r -p 'Intended version: ' VERSION RELEASE_BRANCH=$(gh pr view "$PR" --json headRefName --jq .headRefName) HEAD_SHA=$(gh pr view "$PR" --json headRefOid --jq .headRefOid) BASE_SHA=$(gh pr view "$PR" --json baseRefOid --jq .baseRefOid) gh pr checks "$PR" git fetch origin "$RELEASE_BRANCH" main git cat-file -e "$HEAD_SHA^{commit}" for file in pyproject.toml src/judgevet/__init__.py .release-please-manifest.json uv.lock; do git show "$HEAD_SHA:$file" done git show "$HEAD_SHA:CHANGELOG.md" gh run list --workflow ci.yml --commit "$BASE_SHA" ``` -------------------------------- ### Add judgevet to a uv project Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/install.md Adds judgevet to an existing uv project. The package includes judgevet/py.typed for type checkers and does not install the MCP runtime by default. ```bash uv add judgevet ``` -------------------------------- ### Launch Cursor worker with cursor-agent Source: https://github.com/alberto-codes/judgevet/blob/main/docs/reference/worker-runs.md Launch a Cursor worker from the checkout root with the brief as the prompt. The --force flag applies edits without prompting, so .cursor/cli.json is the only guard. A resource_exhausted error before any edit is a service failure; retry once. ```bash cursor-agent -p --force --trust --output-format json \ --model cursor-grok-4.6-medium "$(cat brief.md)" > receipt.json ``` -------------------------------- ### Evaluate two policies with different NoulRule thresholds Source: https://github.com/alberto-codes/judgevet/blob/main/docs/explanation/policies.md Runs offline after installing judgevet. Shows that the same NoulAnswer (0.85) passes a policy with minimum 0.8 and fails one with minimum 0.9, using validate_policy and evaluate_policy. ```python from judgevet import Noul, NoulAnswer from judgevet.policy import NoulRule, Policy, evaluate_policy, validate_policy questions = {"billing": Noul(instructions="Is this about billing?")} answers = {"billing": NoulAnswer(noul=0.85)} review = validate_policy(Policy((NoulRule("billing", minimum=0.8),)), questions) route = validate_policy(Policy((NoulRule("billing", minimum=0.9),)), questions) assert evaluate_policy(review, answers).passed assert not evaluate_policy(route, answers).passed ``` -------------------------------- ### Run judgevet with explicit policy Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-policy.md Creates a sample document and runs the judgevet CLI with the questions and policy files, outputting JSON. The command exits with status 0 if the policy passes, 3 if the policy is not met, and other codes for failures. ```bash printf 'A short example.\n' > document.txt judgevet --state-file document.txt --questions-file questions.json --policy policy.json --json ``` -------------------------------- ### Choice rule: low risk with minimum confidence 0.7 Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-policy.md Example of a Choice predicate using the exact label from the question criteria. Here the question is 'risk' and the pass label is 'low', requiring confidence between 0.7 and 1 inclusive. ```json {"question":"risk","pass":{"choice":"low","confidence":{"min":0.7}}} ``` -------------------------------- ### Supply TypeSafe API key via JEV_API__KEY Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-judgment.md Prompts for the TypeSafe API key without echoing input, then exports it as JEV_API__KEY. The key is not part of a shell command argument. Do not print the variable, commit it, or enable shell tracing. ```bash read -r -s -p 'TypeSafe API key: ' JEV_API__KEY printf '\n' export JEV_API__KEY ``` -------------------------------- ### Verify production publication with gh run and smoke tests Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Verifies the production publish run by checking the run's head SHA and conclusion, downloading the dist artifact, downloading the wheel from PyPI, comparing hashes, and running smoke tests. Requires $RELEASE_SHA, $EVIDENCE_DIR, $VERSION, and $TEST_WHEEL to be set. A hash mismatch requires investigation and does not authorize replacement of immutable files. ```bash gh run list --workflow publish.yml --commit "$RELEASE_SHA" \ --json databaseId,headSha,createdAt,status,url read -r -p 'Production publish run ID: ' PROD_RUN test "$(gh run view "$PROD_RUN" --json headSha --jq .headSha)" = "$RELEASE_SHA" gh run watch "$PROD_RUN" --exit-status test "$(gh run view "$PROD_RUN" --json conclusion --jq .conclusion)" = success gh run view "$PROD_RUN" --verbose PROD_ARTIFACT="$EVIDENCE_DIR/prod-artifact" PROD_INDEX="$EVIDENCE_DIR/prod-index" gh run download "$PROD_RUN" --name dist --dir "$PROD_ARTIFACT" uvx --from pip pip download --index-url https://pypi.org/simple/ \ --no-deps --only-binary=:all: "judgevet==$VERSION" --dest "$PROD_INDEX" prod_artifacts=("$PROD_ARTIFACT"/*.whl) prod_downloads=("$PROD_INDEX"/*.whl) (( ${#prod_artifacts[@]} == 1 )) (( ${#prod_downloads[@]} == 1 )) PROD_WHEEL=${prod_downloads[0]} cmp "${prod_artifacts[0]}" "$PROD_WHEEL" cmp "$TEST_WHEEL" "$PROD_WHEEL" sha256sum "${prod_artifacts[0]}" "$TEST_WHEEL" "$PROD_WHEEL" direnv exec . python3 scripts/smoke_release.py --wheel "$PROD_WHEEL" direnv exec . uv run python -m scripts.smoke_policy_release --wheel "$PROD_WHEEL" direnv exec . python3 -m scripts.smoke_mcp_release --wheel "$PROD_WHEEL" direnv exec . uv run python -m scripts.smoke_registry_release --wheel "$PROD_WHEEL" direnv exec . uv run python -m scripts.smoke_registry_release check_cli_wheel "$PROD_WHEEL" ``` -------------------------------- ### Define and evaluate a local policy (first_policy.py) Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-policy.md Complete program that defines a policy with a minimum Noul probability of 0.8, validates it, and evaluates two synthetic answers: one at the boundary (0.8) and one below (0.79). It prints the pass/fail results and the rule checked, then asserts the expected outcomes. This runs offline and requires no API key. ```python from judgevet import Noul, NoulAnswer from judgevet.policy import NoulRule, Policy, evaluate_policy, validate_policy questions = {"billing": Noul(instructions="Is this about billing?")} policy = validate_policy( Policy((NoulRule("billing", minimum=0.8),)), questions, ) at_boundary = {"billing": NoulAnswer(noul=0.8)} below_boundary = {"billing": NoulAnswer(noul=0.79)} passing = evaluate_policy(policy, at_boundary) failing = evaluate_policy(policy, below_boundary) print(f"At 0.8: passed={passing.passed}") print(f"At 0.79: passed={failing.passed}") print(f"Rule checked: {failing.rules[0].question}") assert passing.passed assert not failing.passed ``` -------------------------------- ### Sync environment and check CLI help Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/contributor-setup.md Synchronizes the locked development environment with the MCP extra and verifies the CLI is available. The MCP extra is optional for library and CLI consumers but enables the complete contributor test suite. ```bash uv sync --locked --extra mcp uv run judgevet --help ``` -------------------------------- ### Score rule: quality with score bounds 2-3 and minimum confidence Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-cli-policy.md Example of a Score predicate using the original rubric scale, from zero through the last criterion index. Here the question is 'quality', with score between 2 and 3 inclusive and confidence minimum 0.6. ```json {"question":"quality","pass":{"score":{"min":2,"max":3},"confidence":{"min":0.6}}} ``` -------------------------------- ### Verify and publish release tag Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/cut-a-release.md Inspect the release tag, verify it points to the release commit, then edit the draft release with reviewed notes and publish it by setting --draft=false. Publishing the draft is the production trigger; do not bypass with a local upload. ```bash TAG="v$VERSION" gh release view "$TAG" --json tagName,isDraft,targetCommitish,url git fetch origin "refs/tags/$TAG:refs/tags/$TAG" test "$(git rev-parse "$TAG^{commit}")" = "$RELEASE_SHA" read -r -p 'Path to reviewed release notes: ' NOTES_FILE gh release edit "$TAG" --notes-file "$NOTES_FILE" gh release edit "$TAG" --draft=false ``` -------------------------------- ### Run judgevet score question via uvx Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Use this command to run a judgevet score question through Pi's Bash tool. It requires the judgevet CLI to be installed or uses the uvx alternative. The command outputs JSON with the tool execution and answers. ```bash uvx --from 'judgevet==0.13.0' judgevet 'Two checks passed.' '{"score_question":{"type":"score","instructions":"Did the checks pass?","criteria":["Poor","Fair","Good","Excellent"]}}' --json ``` -------------------------------- ### Run judgevet-job with mounted credentials Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/deploy.md Runs the judgevet-job container with read-only root, a tmpfs for /tmp, dropped capabilities, and no-new-privileges. Mounts the inputs directory and the credential file (JUDGEVET_KEY_FILE) as read-only, sets JEV_API__KEY_FILE to the mounted secret path, and configures timeout, attempts, and JSON debug logging. On SELinux hosts, replace the --mount options with --volume "$PWD/inputs:/inputs:ro,Z" and --volume "$JUDGEVET_KEY_FILE:/run/secrets/jev-key:ro,Z" to apply labels. ```bash docker run --rm --read-only \ --tmpfs /tmp:rw,noexec,nosuid,size=16m \ --cap-drop ALL --security-opt no-new-privileges \ --mount "type=bind,src=$PWD/inputs,dst=/inputs,readonly" \ --mount "type=bind,src=$JUDGEVET_KEY_FILE,dst=/run/secrets/jev-key,readonly" \ -e JEV_API__KEY_FILE=/run/secrets/jev-key \ -e JEV_API__TIMEOUT_SECONDS=10 \ -e JEV_API__MAX_ATTEMPTS=1 \ -e JEV_LOG__FORMAT=json \ -e JEV_LOG__LEVEL=debug \ judgevet-job --state-file /inputs/state.txt \ --questions-file /inputs/questions.json --json ``` -------------------------------- ### Construct image evidence with judgevet.media Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-library.md Constructs an ImageAttachment and ImageEvidence without decoding image bytes, and checks MediaCapabilities defaults. Use with judge_with_images(port, state, questions, model, evidence=evidence). The helper preserves exact bytes, global image order, and per-question reference order; constructors snapshot collections and reject malformed associations with ValueError. Unknown question references raise ProviderRequestError, required questions without attachments raise MissingEvidenceError, and unsupported formats or limits raise ProviderCapabilityError before inference. ```python from judgevet.media import ImageAttachment, ImageEvidence, MediaCapabilities image = ImageAttachment("scan", b"opaque-encoded-image", "image/png") evidence = ImageEvidence([image], {"claim": ["scan"]}, required={"claim"}) capabilities = MediaCapabilities({"image/png"}) assert evidence.images[0].data == b"opaque-encoded-image" assert evidence.by_question["claim"] == ("scan",) assert capabilities.max_images == 16 ``` -------------------------------- ### Run MCP from source checkout with direnv Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/connect-mcp.md Use this command to run the MCP server from a source checkout for development. It requires direnv and an absolute path to the checkout. This command uses the approved environment and the --locked flag. ```bash direnv exec /absolute/path/to/judgevet uv run --directory /absolute/path/to/judgevet --locked --extra mcp judgevet-mcp ``` -------------------------------- ### Complete program: first_judgment.py Source: https://github.com/alberto-codes/judgevet/blob/main/docs/tutorials/first-judgment.md Save this complete program as first_judgment.py in the judgevet-tutorial directory. It uses HTTPSystemOneAdapter and Noul to ask a billing question. The with block closes the HTTP client when it exits, even on exceptions. Reading the answer afterwards does not require an open client. ```python import os from judgevet import HTTPSystemOneAdapter, Noul with HTTPSystemOneAdapter(api_key=os.environ["JEV_API__KEY"]) as adapter: response = adapter.system_one( state="I was charged twice. Please help today.", questions={"billing": Noul(instructions="Is this about billing?")}, model="jev-1.13.0", ) answer = response.nouls["billing"] print(f"Probability of billing: {answer.noul}") print(f"Resolved model: {response.model}") print(f"Input tokens: {response.usage.input_tokens}") ``` -------------------------------- ### Synchronous live judgment with HTTPSystemOneAdapter Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/use-policy-library.md Use for synchronous live judgments. Requires TYPESAFE_API_KEY in the environment. The adapter must be explicitly closed; it supports with and close(). The zero floor is for wiring demonstration; choose acceptance thresholds for your task. ```python import os from judgevet import HTTPSystemOneAdapter, Noul, SystemOnePort, SystemOneResponse from judgevet.policy import NoulRule, Policy, evaluate_policy, validate_policy questions = {"clear": Noul(instructions="Is this text clear?")} validated = validate_policy(Policy((NoulRule("clear", minimum=0),)), questions) def judge(port: SystemOnePort) -> SystemOneResponse: return port.system_one("The meeting starts at noon.", questions, "jev-latest") with HTTPSystemOneAdapter(api_key=os.environ["TYPESAFE_API_KEY"]) as adapter: answer = judge(adapter) report = evaluate_policy(validated, answer.answers) assert report.passed print(report.rules[0].detail) ``` -------------------------------- ### Build and inspect wheel for judgevet/py.typed Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/verify-package.md Builds the wheel into a fresh temporary directory and verifies the py.typed marker is present in the wheel. The temporary directory remains available for inspection after the check. ```bash artifact_dir=$(mktemp -d) uv build --out-dir "$artifact_dir" set -- "$artifact_dir"/judgevet-*.whl test "$#" -eq 1 && test -f "$1" || exit 1 wheel_path=$1 uv run python - "$wheel_path" <<'PYCODE' import sys import zipfile with zipfile.ZipFile(sys.argv[1]) as wheel: assert "judgevet/py.typed" in wheel.namelist() print("wheel contains judgevet/py.typed") PYCODE ``` -------------------------------- ### Handle a failed library call with retry policy Source: https://github.com/alberto-codes/judgevet/blob/main/docs/how-to/handle-errors.md Use this pattern after installing judgevet and supplying JEV_API__KEY. It calls the service with synthetic text and permits at most three attempts. The handler prints error category and retry metadata, not service-supplied message text. It retries eligible HTTP failures and keeps an unavailable answer separate from a policy rejection. Transport retries remain disabled. The adapter retries a transient 5xx or a rate limit by default. ```python import os from judgevet import HTTPSystemOneAdapter, JevError, Noul, RetryPolicy try: with HTTPSystemOneAdapter( api_key=os.environ["JEV_API__KEY"], retry=RetryPolicy(max_attempts=3) ) as adapter: response = adapter.system_one( state="I was charged twice.", questions={"billing": Noul(instructions="Is this about billing?")}, ) except JevError as error: print(f"Service call failed: {type(error).__name__}") print(f"Retry candidate: {error.retryable}") else: print(response.nouls["billing"].noul) ``` -------------------------------- ### Architecture layout Source: https://github.com/alberto-codes/judgevet/blob/main/CLAUDE.md Shows the hexagonal architecture layout enforced by import-linter. Both inbound adapters take a SystemOnePort and do not construct an HTTP client themselves. ```text adapters/inbound/ cli.py (typer) · mcp.py (stdio server) adapters/outbound/ http.py — the Jev API ports/ SystemOnePort protocol domain/ Noul · Choice · Score · their answers · Usage — pure ``` -------------------------------- ### Run terminology check with uv Source: https://github.com/alberto-codes/judgevet/blob/main/docs/maintainers/writing-guide.md Runs the terminology checker via `uv run python -m scripts.check_terminology`. The command is executed in commit/push hooks and CI. A clean result does not prove every term or numeric interpretation is correct. ```bash uv run python -m scripts.check_terminology ```