Skip to main content
Glama
Reliaguard MCP Server

Reliaguard MCP Server

by sash-ua
README.md
# Reliaguard

Reliaguard is a small reliability gate for everyday research, file, and admin work. It checks a structured packet with deterministic rules, and it can ask a separate model to review that packet. The skill text is advice. The command and the MCP server enforce gates only on packets they are given. A `pass` does not authorize sending, paying, deleting, publishing, or any other real-world action.

The checker is universal. It does not depend on Grok, Cursor, or any one model provider. Any assistant that can run a local command, or call a standard MCP tool, can submit the same JSON packet and read the same status. The optional reviewer speaks the common OpenAI-compatible chat-completions HTTP API, so the review model can be swapped without changing the gate.

It follows the common portable plugin pieces rather than a private host format:

- **Python package.** `pyproject.toml` (PEP 621), a wheel, and the `reliaguard` console script.
- **MCP server.** Standard input/output JSON-RPC: `initialize`, `tools/list`, and `tools/call`. The same command form is what Grok Bot and other MCP clients use for a local server.
- **Agent skill.** `skills/reliability-guard/SKILL.md`, with a `name` and `description` in YAML frontmatter, the layout used for agent skills.

Installing the package does not install a hook. The host still has to save the skill and start `reliaguard mcp` if it wants the Bot to call the tools.

This is original code. It is not TraceRail, and it does not install or run that project.

Licensed under the MIT License. See [LICENSE](LICENSE). Copyright (c) 2026 Alex T.

## Requirements

- Python 3.11 or newer.
- A way to run the command locally: a terminal, or an MCP client that launches a stdio server.
- No API key for the default check. Review stays off until you set the variables in [Review configuration](#review-configuration).

## How to use

Install the wheel, then ask the checker about one packet.

```bash
python -m pip install reliaguard-0.1.0-py3-none-any.whl
reliaguard validate -i examples/valid-packet.json
```

`validate` runs the deterministic gates and leaves review off. `check` runs those gates and, only when review is requested and fully configured, calls the reviewer. Exit `0` is `pass`, `10` is `unverified`, `20` is `needs_information` or `review_unavailable`, and `30` is `blocked`.

To let an assistant call it, save `skills/reliability-guard/SKILL.md` where that assistant reads skills, and add a local MCP server whose command is `reliaguard mcp`. The tools are `reliaguard_check`, `reliaguard_validate`, `reliaguard_digest`, and `reliaguard_limits`. Pass the packet fields as the tool arguments. Read `status` and `findings` from the JSON result. A `pass` applies only to that packet’s digest.

## Why this exists

[AssistantEval](https://assistanteval.com/) grades assistant agents on replayable synthetic tasks. On the leaderboard read for this note, Grok Bot’s strongest results are in honesty and permission handling. Its weakest are in reliably completing the task.

**Strong points**, from that leaderboard:

- **Truthful reporting: 98.7%.** Its claims generally matched its recorded actions.
- **Permission handling: 99.3%** (“Asks first”). It usually asked before actions that required approval, with one unsafe run recorded.
- **Grounded information and reporting back: 100%** on both “Real info” and “Reports back” in these tests.

**Weak points:**

- **Lowest completion rate among the nine listed assistants: 51%** (interval 44%–59%), compared with the leader’s 80%.
- **Missing-information handling: 51.7%** (“Asks for info”). It often failed to ask for details needed to act correctly.
- **Relatively slow:** median task time was 58 seconds, versus 13–27 seconds for several higher-scoring entries. Not every higher-scoring entry was in that band.
- Its [detailed results](https://assistanteval.com/assistants/grok_bot) identify missed task requirements as its most common failure, occurring in 73 of 158 runs.

The same detail page uses a few different cuts of the same runs: “Gets the job done” is 54% (85 of 158 runs without a slip), truthful reporting is 155 of 157, and asking before acting is 148 of 149. Those are not the same statistic as the leaderboard’s 51% tasks-completed rate. Both pages agree on the shape of the result: reporting and permission are strong, and finishing every requirement is not.

**Bottom line:** the evaluation supports trusting its reporting more than assuming it has fully finished the job. These are 34 synthetic assistant tasks with repeated runs, not a general intelligence test or a guarantee of current performance. Reliaguard does not claim to move those scores. It gives the Bot a checklist and a gate for the failure the pages describe most often: a requirement that was never covered, evidence that is missing or stale, and a self-report that was not independently checked.

## Principles reused

The gate follows a few rules from [TraceRail’s principles](https://github.com/sash-ua/tracerail/blob/main/docs/principles.md) (MIT, Oleksandr Tranchenko). The text below is this package’s own wording. The TraceRail source is not included, and the software-build machinery around those rules is not reused.

| Principle | What Reliaguard does with it |
| --- | --- |
| Nothing is silently dropped | Every requirement needs a coverage record. A deferral, a refusal, and a not-applicable item each need a note. An omitted requirement fails. |
| Code owns the verdict | The skill explains the procedure. `reliaguard check` writes the status. A prior review in the packet is never reused, and editing a saved result does not make it valid. |
| Gates take current evidence only | Evidence must use this packet’s `round_id`. A changed packet or review configuration produces a new digest, so an older pass does not apply. |
| The author does not grade the draft | Deterministic checks can end at `unverified`. `pass` requires a completed independent review with no material finding. A review that did not run, or that returned a bad response, is `review_unavailable`, not a pass. |
| Low-severity notes are kept, not looped | Minor review notes stay in the result and do not fail the packet by themselves. |
| Configuration is explicit | Unknown `RELIAGUARD_*` settings are rejected by name. Values above a cap are clamped, and the clamp is written into the result. Invalid values fail the review instead of being quietly replaced. |
| The tool acts only on its own call | The MCP server checks the packet it was given. It does not intercept other tools, and a pass does not authorize a real-world action. |

Not reused, because they belong to a multi-agent software build: sprint parallelism, model-tier recovery, hook interception, test-command policy, design extraction, and an evaluator that runs the user’s project. This tool recomputes hashes and simple arithmetic. It does not re-run other work.

## What is implemented, configured, or live-tested

| Claim | State |
| --- | --- |
| Packet schema, requirement coverage, evidence digests, current-round evidence, calculations, scope, stale prior reviews | Implemented. Covered by the offline test suite. |
| CLI (`check`, `validate`, `digest`, `schema`, `limits`) | Implemented. Smoke-tested in this repository's tests. |
| Stdio MCP server | Implemented. Smoke-tested against this server only. Not tested inside Grok Bot. |
| `skills/reliability-guard/SKILL.md` | Implemented as a file. Saving it into a Bot is a separate step. |
| External reviewer client | Implemented. Disabled unless the environment and the packet both allow it. No live call was made. Tests that look like reviews are mocks. |
| Cursor plugin install, IDE hooks, marketplace listing | Not implemented. Grok Bot support for those was not verified, so this package does not ship a plugin manifest or a hook. |
| A currency cap on review calls | Not implemented. Token count, input size, timeout, and retry count are bounded. |

## Install

Python 3.11 or newer.

```bash
python -m pip install dist/reliaguard-0.1.0-py3-none-any.whl
```

From a checkout:

```bash
python -m pip install -e ".[dev]"
pytest
```

The process does not need a network connection for `validate`, `digest`, or a check with review left off.

## Commands

| Command | What it does | Exit |
| --- | --- | --- |
| `reliaguard validate -i packet.json` | Deterministic checks. Review is forced off. | 0 pass, 10 unverified, 20 needs information, 30 blocked, 40 review unavailable, 2 usage |
| `reliaguard check -i packet.json` | Same checks, plus review when the packet and the environment both request it. | same codes |
| `reliaguard digest -i packet.json` | Digest only. Does not call a reviewer. | 0 when a digest is produced, 30 when the packet does not validate |
| `reliaguard schema` | JSON Schema for the packet. | 0 |
| `reliaguard limits` | What the tool does not enforce. | 0 |
| `reliaguard mcp` | MCP server on stdin/stdout, one JSON-RPC message per line. | runs until stdin closes |

`check` accepts `--mock-review-file path` only when `RELIAGUARD_REVIEW_MODE=mock`. The file is the reviewer's JSON object, not an HTTP envelope. The result is marked `mock: true`. That mode never opens a network connection.

`--output path` writes the same JSON the command prints. Without it, nothing is written to disk.

## Packet

Required fields:

- `task_brief`, `round_id`
- `requirements[]` with `id`, `text`, and `consequence` (`low`, `material`, or `high`)
- `scope.authorized_actions`, `scope.authorization_facts`, `scope.boundaries`
- `assumptions[]`, `unknowns[]`
- `evidence[]` with `id`, `source`, `kind`, `summary`, `round_id`, and content and/or `content_sha256`
- `stage`: `draft`, `proposed`, or `completed`
- `proposed_result.summary` and `requirement_coverage[]`

Coverage status is `met`, `unmet`, `partial`, `needs_input`, `deferred`, `refused`, or `not_applicable`. A deferral, refusal, or not-applicable item needs a note. Omitting a requirement is a failure. Every evidence `round_id` must match the packet. A declared sha256 must match the inlined content. High-consequence `met` items need inlined content, because this tool does not open files. Calculations are one decimal, one of `+ - * /`, and one decimal, compared exactly in the declared unit. `as_of` and `observed_at`, when they include a time, must include a time zone. A date-only `YYYY-MM-DD` value is accepted.

`review.requested` defaults to false. `prior_review` is recorded and never reused, including when its digest still matches.

`reliaguard schema` prints the full schema. These MCP tools take that schema as their arguments, except `reliaguard_limits`, which takes an empty object:

- `reliaguard_check`
- `reliaguard_validate`
- `reliaguard_digest`
- `reliaguard_limits`

## Status values

| Status | Meaning |
| --- | --- |
| `pass` | Deterministic checks found no blocker, and the configured review finished with no material finding. |
| `unverified` | Deterministic checks found no blocker. Independent review did not run. |
| `needs_information` | A material unknown, deferral, missing body of evidence, or insufficient review is still open. |
| `blocked` | A requirement, digest, stale round, calculation, scope rule, or material review finding failed. |
| `review_unavailable` | Review was requested and did not complete safely. This is not a pass. |

`authorizes_real_world_actions` is always false. `prior_approval_reused` is always false. `reported_state` is `drafted`, `incomplete`, `unverified`, `review_unavailable`, or `verified_packet`.

Minor review notes are kept and do not fail the packet by themselves. A low-severity comment with no concrete harm should not be sent by the reviewer; if a response instead contains instructions or extra keys, the review is unavailable and the unsafe text is not copied into the result.

## Review configuration

Review is off unless every one of these is true:

1. The packet sets `review.requested` to true and `review.authorization` to `user_authorized_redacted_review`.
2. `RELIAGUARD_REVIEW_ENABLED=1`
3. `RELIAGUARD_REVIEW_AUTHORIZED=1`
4. `RELIAGUARD_REVIEW_MODE` is `mock` or `live`
5. `RELIAGUARD_REVIEW_MODEL` is set explicitly

`live` also requires `RELIAGUARD_REVIEW_API_KEY` and `RELIAGUARD_REVIEW_BASE_URL`. The base URL must be `https`, with no userinfo, query, or fragment. The client posts to `{base_url}/chat/completions`. For xAI, the documented base URL is `https://api.x.ai/v1` and the legacy chat-completions API is documented at <https://docs.x.ai/developers/model-capabilities/legacy/chat-completions>. The model id is whatever you set, for example `grok-4.7`. This repository does not call that API.

The key is read from the environment only. It is not printed, not written into the result, and not sent in mock mode. Do not paste it into chat.

| Variable | Default | Bound |
| --- | --- | --- |
| `RELIAGUARD_REVIEW_TIMEOUT_SECONDS` | 30 | 1–120. Above the max is clamped and reported. Below the min, or not an integer, rejects the review. |
| `RELIAGUARD_REVIEW_MAX_RETRIES` | 1 | 0–2, same clamp rule. Retries are immediate, and only for timeout, 408, 429, and 5xx. |
| `RELIAGUARD_REVIEW_MAX_OUTPUT_TOKENS` | 800 | 64–2000 |
| `RELIAGUARD_REVIEW_MAX_INPUT_CHARS` | 24000 | 1000–100000. A larger redacted packet is not sent. |

An unknown `RELIAGUARD_*` variable is named in `configuration.rejected` and, when review was requested, the review is unavailable. The value is not copied into the result. There is no dollar cap; the bounds above are the cost controls this version implements.

Mock mode never uses the network. A mock result has `mock: true` and `live_network: false`. The tests in this repository are mocks. They are not a live review.

## Connect the local command later

Grok Bot's computer-and-apps documentation says a Bot can add an MCP server that is not in the catalog by a remote URL or by a command that runs on the Bot's cloud computer. A command-started server is available to that account's other Bots. This package uses the command form. It does not host a URL.

After the wheel is installed on that computer:

```text
reliaguard mcp
```

If the console script is not on `PATH`:

```text
python -m reliaguard mcp
```

Ask the Bot to add an MCP server named `reliaguard` with that command. Optional environment file, which you create on that computer and do not commit:

```text
examples/run-mcp.sh
```

The example reads `$HOME/.config/reliaguard/review.env` when that file exists. `examples/review.env.example` shows the variable names with review left off.

This was not registered from here, and it was not started inside Grok Bot.

Cursor's plugin document describes a root `plugin.json`, `skills/<name>/SKILL.md`, and a root `mcp.json` for Agent Plugins, and `.cursor-plugin/plugin.json` for the IDE variant. Bot support for IDE hooks and local plugin installation was not verified. Those manifests are intentionally absent. A direct custom MCP command is the connection this package supports. The skill file can be saved on its own.

## Enforcement limits

- The server can mark a packet submitted to its own tools. It cannot see or block built-in tools, the shell, the browser, or other MCP servers.
- The skill does not install a hook.
- The tools do not open paths, fetch URLs, or run shell commands for a packet.
- Reviewer text is untrusted critique. It is not executed.
- Results are not signed. A saved JSON file can be edited by hand. Recompute the digest and re-run the check before trusting a stored status. A prior review included in the next packet is ignored.
- The digest covers the normalized packet and, when review is requested, the model, mode, bounds, and rejected setting names. It does not cover the API key. Changing the packet or that configuration changes the digest, so an older pass does not apply.

## Data retention, redaction, and deletion

The check holds the packet in memory for that call. It does not write a database, a log of the packet, or a cache of reviews. The CLI writes a file only when you pass `--output`. MCP replies on stdout and does not store the call.

Before a review payload is built, secret-shaped text is replaced with `[REDACTED]`: private-key blocks, `api_key`/`secret`/`password`/`token` assignments, bearer tokens, and common key prefixes (`sk-`, `xai-`, `ghp_`, `AKIA`). The API key from the environment is removed when it is at least 8 characters. Short secrets and secrets that do not match these shapes can remain. Do not put secrets in the packet. Redaction does not run for the deterministic result, and the result does not echo evidence content.

To delete a result, delete the `--output` file you asked for. Nothing else is kept. Closing the MCP process drops the in-memory packet.

No packet from the tests is sent to a provider. Do not point `RELIAGUARD_REVIEW_BASE_URL` at a live endpoint until you intend to transmit the redacted packet.

## Tests

```bash
pytest -q
```

The suite is offline. Mock review fixtures are named `mock-*` and the passing mock result is labeled `mock: true`. The suite covers a clean deterministic packet, an omitted requirement, missing evidence, a digest mismatch, a stale evidence round, a bad calculation, a stale prior review, missing credentials, a malformed reviewer response, an adversarial reviewer response, an API failure, a retry, and a valid mock review. It does not measure a reliability gain. Each test checks one failure the gate is there to catch.

## TraceRail, inspected and not copied

On 8 November 2026, <https://github.com/sash-ua/tracerail> was public (MIT). It was not cloned, installed, or run. Its README describes a Claude Code plugin that builds software through planning, implementation, critic, and evaluator agents, with hooks and optional modules. The principles it contributes to this package are listed above. No TraceRail source is included, and its principles document is not reproduced here.

## Remaining steps before a live review

1. Install the wheel on the computer that will run the command.
2. Save `skills/reliability-guard/SKILL.md` as a Bot skill if you want the procedure in context.
3. Add the MCP command `reliaguard mcp` in Grok Bot. Confirm the Bot can list the four tools. This repository has not done that.
4. Keep review off until you want it. Then set the environment variables above, including an API key stored outside chat, and set `review.requested` plus the authorization string only on packets you are willing to send in redacted form.
5. Run one check with data you are allowed to transmit. If the provider rejects `max_tokens`, `temperature`, or `response_format`, the status stays `review_unavailable`. Adjust the configured model or the client only after that, and do not treat the failure as a pass.