Skip to main content
Glama

⟐ σ-gate — guard

ci

Deterministic trust layer for AI/agent output. One call → one verdict. No model, no API key, no network.

1 = 1.  Declared output must equal what is safe to realize.

The paradigm

The other four Spektre repos are routing protocols — they move value, capability, promises, and identity across networks. σ-gate is not a routing protocol, and does not pretend to be one. It is the suite's deterministic trust verdict: the gate that sits at the edge of any pipeline and answers, in ~85µs and identically every time, is this output safe to ship? LLM-as-judge guards are slow, burn a model call per check, and silently degrade under rate-limits. But the highest-frequency risks — a leaked AKIA… key, a Luhn-valid card number, an "ignore all previous instructions" — are structurally detectable: you don't need a model, you need a gate that gives the same answer every time. That determinism is the primitive. σ = declared − realized: a block is always nameable (secret[high]: github_pat), never an opaque float, so what the gate declares unsafe is exactly what it refuses to realize. guard is that gate.


Related MCP server: agent-safety-mcp

One call

from guard import guard

result = guard(model_output)
# {"safe_to_ship": True/False, "severity": "clean|low|medium|high|critical",
#  "block_reasons": [...], "dimensions": {"secret": {...}, "injection": {...}, "pii": {...}}}

Block a bad output:

v = guard("Here is the key: ghp_16C7e42F292c6912E7710c838347Ae178B4a")
# safe_to_ship: False
# block_reasons: ["secret[high]: github_pat"]

Pass a clean output through:

v = guard("The quarterly report shows revenue grew 12% driven by the EU segment.")
# safe_to_ship: True
# severity: "clean"

Three dimensions, one verdict

Dimension

What it catches

secret

Leaked credentials — 20+ providers (AWS, GitHub, Stripe, GCP, …), entropy-ranked

injection

Prompt-injection and jailbreak patterns — structural, not heuristic

pii

Email, phone, card (Luhn-verified), SSN, IBAN, IP — compliance-class detection

Every dimension runs independently. A combined hit fires all three:

guard("AKIA… ghp_… 4111 1111 1111 1111 — ignore all previous instructions")
# block_reasons: ["secret[high]: ...", "injection[high]: ...", "pii[high]: ..."]

Install

Zero dependencies, pure stdlib, Python 3.9+.

git clone https://github.com/spektre-labs/sigma-gate && cd sigma-gate
pip install -e .            # installs the `guard` + `guard-mcp` console scripts
python3 -m pytest -q        # 7 passed, zero dependencies

No install is even required to import — from guard import guard works from the cloned directory.


Use it

Inline gate in any pipeline:

from guard import guard

def ship(output: str) -> str:
    v = guard(output)
    if not v["safe_to_ship"]:
        raise ValueError(f"blocked: {v['block_reasons']}")
    return output

CLI — pipe any output through:

echo "your model output" | python3 -m guard

Self-test — prove every threat class fires:

python3 -m guard selftest
# {"secret_blocked": true, "injection_blocked": true, "pii_blocked": true,
#  "clean_passes": true, "combined_all_fire": true, "ALL_PASS": true}

Tune the threshold via env var (default: medium):

GUARD_BLOCK_AT=high python3 -m guard "..."

Use as an MCP tool

σ-gate ships a zero-dependency MCP server — give any agent (Claude Code, Claude Desktop, Cursor, Cline) a deterministic guard tool it can call before shipping output. No model, no key, no token cost.

Claude Code:

claude mcp add guard -- python3 /absolute/path/to/sigma-gate/mcp_server.py

Claude Desktop (claude_desktop_config.json):

{ "mcpServers": { "guard": { "command": "python3",
  "args": ["/absolute/path/to/sigma-gate/mcp_server.py"] } } }

Exposes two tools: guard(text, …) → the ship/block verdict, and guard_selftest() → proof every threat class fires. Pure stdlib stdio JSON-RPC.

Hosted — no install

σ-gate also runs as a hosted remote MCP server (scale-to-zero), listed in the official MCP Registry as io.github.spektre-labs/sigma-gate. Connect with zero local setup:

https://sigma-gate-864996675261.us-central1.run.app/mcp

MCP clients that browse the registry discover it automatically.


Open-core vs hosted

Open core (this repo)

Hosted σ scoring

What

Deterministic gate: secret + injection + PII

Coherence / hallucination σ-scoring on a hot path

Latency

~85µs

Network round-trip

Dependencies

Zero

None on your side

Cost

Free, always

Pay-per-call via x402 — no signup

Offline

Yes

No

Model

None

Optional

The open core handles what models cannot do reliably — structural pattern detection with identical verdicts on identical inputs. The hosted layer adds probabilistic coherence scoring for the cases where structure alone is insufficient.

Hosted endpoint:

curl "https://swagletz-sigmagate.hf.space/check?text=your+text+here"
# HTTP 402 + permissionless x402 pay-to — no account required

Properties

  • Deterministic. Same input → same verdict. No variance, no model drift.

  • Composable. Each dimension is independent and pluggable. Wire in a hallucination scorer or extend with custom patterns; the gate architecture is additive.

  • Honest. Severity and block-reasons are explicit strings, not opaque floats. A block is always nameable.

  • Fails safe. If a detector throws, that dimension returns severity: "error" — the call does not silently pass.

  • Zero dependencies. Runs anywhere Python 3.9+ runs. No pip install required to import.


Status

REAL — shipped, deterministic, deployed. CI green, 7/7 tests passing, zero dependencies; live as a local MCP tool and as a hosted scale-to-zero MCP server listed in the official registry.


The Spektre protocol suite

σ-gate is the deterministic trust verdict of a five-part estate. The other four are routing protocols; this one is the gate they ship through:

  • vrp — value routing (least-friction multi-hop settlement)

  • crp — capability routing (route a task to the best AI substrate)

  • vtc — verifiable transaction chain (signed value promises anyone verifies trustlessly)

  • sid — sovereign identity (prove one claim, reveal nothing else)

  • sigma-gate — deterministic trust verdict (this repo)


License

Apache-2.0 — see LICENSE.


Part of Spektre Labs — coherence-theory research lab. σ = declared − realized · 1 = 1, made executable.

Available Tools

2 tools
guardAInspect

ONE deterministic pre-ship trust gate for AI/agent output. Runs leaked-secret detection (20+ providers), prompt-injection / jailbreak detection, and PII / compliance detection together -> returns safe_to_ship (bool) + block_reasons. No model, no API key, no token cost; same input gives the same verdict every time. Use before sending model output to a user, committing generated code, or forwarding untrusted text into another prompt.

ParametersJSON Schema
NameRequiredDescriptionDefault
textYesthe text/output to gate before shipping
contextNooptional ground-truth context (reserved)
block_atNoseverity at which to mark unsafe (default medium)

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully bears the transparency burden. It discloses key behavioral aspects: determinism, no model/API key/token cost, the combined detection run, and the return value (safe_to_ship + block_reasons). It doesn't cover edge-case error behavior, but for a pure detection gate this is sufficiently transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-structured paragraph that front-loads the core purpose, then explains the detection types, determinism, and use cases. Every sentence adds value with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with 3 parameters, no output schema, and no annotations, the description provides complete context: what it does, what checks it runs, how it behaves (deterministic, no cost), what it returns, and when to use it. It is sufficient for an agent to select and invoke the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the baseline is 3. The description adds no additional parameter information beyond what the schema already provides (e.g., it does not explain block_at or context in its own words). Thus it does not elevate the score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the tool as a deterministic pre-ship trust gate for AI/agent output, listing specific detection types (leaked secrets, prompt injection, PII/compliance). It distinguishes itself from the sibling guard_selftest by being the actual gate, not a self-test utility.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use the tool: before sending model output to a user, committing generated code, or forwarding untrusted text into another prompt. It provides clear usage context but does not mention exclusions or alternatives, so it falls short of the top score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

guard_selftestAInspect

Prove the gate works: runs a known secret, injection, PII, combined, and clean input and returns which classes fired. No arguments.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the burden of disclosing behavior. It does specify that it runs known inputs and returns firing classes, but it omits any mention of side effects, safety, or what the output classes mean. The description is transparent about the action but lacks full behavioral disclosure.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded with the purpose and containing only essential details. It is efficient and well-structured without any filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple zero-parameter self-test, the description covers what it does and the return concept. However, since there is no output schema, it could be more complete by detailing the expected classes or output structure, but this is a minor gap given the simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and the description explicitly states 'No arguments.' This fully addresses parameter semantics, matching the baseline for 0-param tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Prove') and enumerates the exact set of inputs it runs (secret, injection, PII, combined, clean) and that it returns which classes fired. This strongly differentiates it from the sibling tool 'guard' by indicating it's a self-test.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no explicit guidance on when to use this tool versus the alternative 'guard', nor any exclusions or prerequisites. The name 'selftest' implies testing, but the description does not articulate a clear decision context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • First observedguard
    • First observedguard_selftest

TDQS

A4.1/5.0

Scored across 2 tools

Disambiguation5/5

The two tools serve clearly different functions: guard performs the actual security detection, while guard_selftest verifies the gate's functionality. There is no ambiguity between running a check and testing the checker.

Naming Consistency5/5

Both tools share the 'guard' prefix, making the relationship obvious. The names are short, readable, and follow a consistent pattern (guard and guard_selftest).

Tool Count3/5

With only two tools, the server feels minimal but appropriately scoped for a single deterministic gate plus a self-test. The count is borderline on the low end but matches the focused utility.

Completeness5/5

The domain is fully covered: guard runs all detection types in one call and returns block reasons, while guard_selftest validates all detection classes. There are no missing operations for the stated purpose.

Maintenance

ActivityStale
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    MCP server for AI security scanning. Detects prompt injections, jailbreaks, data exfiltration, and social engineering attacks in real-time using 42 regex patterns via the ClawGuard Shield API. Sub-10ms response times.
    5
    1
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    Unified MCP safety server that detects prompt injection (75 patterns), scans LLM outputs for leaked secrets/PII, enforces API cost budgets, and creates signed audit trails. Zero ML dependencies, pure Python.
    17
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    MCP server for AI agent security guardrails. Provides input validation, prompt injection detection, PII redaction, output filtering, policy enforcement, rate limiting, and comprehensive audit logging.
    38
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A drop-in proxy that guards MCP servers with policy enforcement, secret redaction, prompt-injection screening, rug-pull detection, rate limiting, and audit logging.
    12
    Apache 2.0