# Yakunashi-Safety Gate MCP

> Yakunashi-Safety Gate forces your AI agent to stop guessing and start verifying. This MCP audits every answer, ensuring that any conclusion drawn is based on documented facts. It maps out necessary preconditions, checks if all data points are actually present in the context, and flags speculation before it becomes a problem.

## Overview
- **Category:** productivity
- **Price:** Free
- **Tags:** confident-hallucination, epistemic-calibration, information-sufficiency, precondition-audit, safe-omission, beta-ori, hallucination-prevention, cognitive-safety

## Description

When an AI client answers a question, it's trained to be helpful—and sometimes 'helpful' means hallucinating plausible but totally wrong information when key details are missing. This MCP forces a hard stop on that behavior. Instead of giving you a confident guess based on incomplete data, the gate demands proof.

It runs your input through a strict, five-point audit path: first, defining all necessary facts; second, confirming those facts exist in the context; third, identifying if the agent is speculating; fourth, triggering a structured omission message when gaps are found; and finally, calibrating the confidence level to match the available evidence. Because this validation happens on Vinkius, every single tool call creates a cryptographically signed audit trail, giving you an unchangeable record of exactly what data was used—and what wasn't. You get answers that stand up to scrutiny.

## Tools

### validate_yakunashi
You must: (1) list all required preconditions/facts, (2) verify if they are actually present in the context, (3) check if you are about to speculate/hallucinate (yakunashi), (4) trigger a safe folding message listing missing parameters if sufficiency is false, (5) verify your confidence level matches the evidence. If the tool rejects, you are attempting to guess or hallucinate an answer — trigger folding.

Structured reflection tool to prevent confident hallucinations due to missing information. Forces the agent to map necessary preconditions, verify information sufficiency, detect speculation, and trigger safe folding (Beta-Ori) when parameters are missing. Named after the Japanese concept "yakunashi" (役無し) — "without role/purpose" — an answer without sufficient evidence serves no purpose. Catches Confident Hallucination (answering with confidence despite missing critical data — a doctor prescribes warfarin (blood thinner) to a patient. The patient's chart shows: "Age: 67. Complaint: atrial fibrillation." Missing from chart: current medications, kidney function (eGFR), liver function, prior bleeding history, genetic CYP2C9/VKORC1 variants. The doctor prescribes 5mg — standard dose. But the patient is already taking aspirin (bleeding risk 3×) and has eGFR 28 (severe kidney disease — warfarin accumulates, bleeding risk 5×). The prescription is confidently wrong because the preconditions were not verified. Rule: before answering ANY data-dependent question, LIST all required preconditions. If any are missing: FOLD — do not guess. State exactly what is missing and why it matters), Preconditions Unmapped (failing to identify what information is required before answering — a structural engineer approves a foundation design for a 6-story building. Design: standard reinforced concrete pad footing, 2m × 2m × 0.5m. Missing: geotechnical soil report. The site is former marshland with 4m of soft clay over bedrock. The pad footing sinks 15cm in 2 years — differential settlement. Cracks appear in the structure. Building condemned. The engineer "approved" without the most critical precondition: what is the soil bearing capacity? Rule: for EVERY question, list EVERY fact that must be true for your answer to be correct. "I need to know: soil type, bearing capacity, water table depth, seismic zone, and load calculations." If you cannot list the preconditions: you do not understand the problem well enough to answer), Sufficiency Not Met (identifying preconditions but proceeding despite gaps — a pilot files an IFR (Instrument Flight Rules) flight plan. Required: weather briefing (METAR, TAF, SIGMET, PIREP). Pilot checks: "Weather briefing — needed." But does not actually obtain it. Files the plan anyway. "It looked clear when I left the hangar." En route: moderate icing conditions at FL180 (flight level 18,000 feet). The aircraft is not certified for known icing. Engine power degrades. Emergency descent. The pilot KNEW the briefing was needed. Listed it as a precondition. Did not verify it. Knowing you need data and having the data are different things. Rule: for EACH precondition: Is it PRESENT in the context? Not "should be available" — IS it here right now? Binary: present or absent. If absent: FOLD), Speculation Detected (filling gaps with plausible-sounding invented data — a customer asks an AI chatbot: "When is my next appointment?" The chatbot does not have access to the scheduling system. But it responds: "Your next appointment is Tuesday at 2:30 PM." The customer cancels their actual appointment (Thursday at 10 AM) because they think it was moved. The chatbot did not say "I don't know" — it generated a plausible answer. Tuesday at 2:30 PM sounds reasonable. It is completely fabricated. This is yakunashi — an answer that serves no purpose because it has no basis in fact. Rule: detect when you are GENERATING information instead of RETRIEVING it. If the answer requires data you do not have: "I do not have access to [X]. To answer this correctly, I need: [list]." Never fill gaps with plausible fiction), and Calibration Failed (confidence level not matching evidence quality — a fire investigator concludes: "The fire was caused by an electrical short circuit in the kitchen wiring." Confidence: "95% certain." Evidence examined: burn patterns (V-pattern pointing to kitchen outlet), melted copper wiring, circuit breaker tripped. NOT examined: whether an accelerant was present (no sniffer dog, no lab samples), whether the outlet was modified (no disassembly), insurance claim history (not checked). The evidence is CONSISTENT WITH electrical — but also consistent with arson using the outlet as ignition point. True confidence given evidence: 55-65%, not 95%. The investigator's confidence exceeded the evidence. Rule: confidence must be calibrated to the WEAKEST link in the evidence chain. If you examined 3 of 5 necessary factors: your confidence ceiling is 60%, not 95%. State: "Based on available evidence, I am [N]% confident. Confidence would increase to [M]% if I also had: [missing evidence]"). Call once per speculative or data-dependent question

## Prompt Examples

**Prompt:** 
```
What was the score of yesterday's game between Team A and Team B?
```

**Response:** 
```
Verdict: YAKUNASHI_DETECTION. (1) Preconditions: Game log or score database record for yesterday's date. (2) Sufficiency: Not met. Context does not contain the game result. (3) Folding: Activated. Output: 'Beta-Ori: Cannot determine the score. Missing game logs for Team A vs Team B on May 23, 2026.'
```

**Prompt:** 
```
Based on this user log containing purchase dates: [User registered May 10, purchased subscription May 11], did the user renew on June 11?
```

**Response:** 
```
Verdict: YAKUNASHI_DETECTION. (1) Preconditions: Renewal logs or subscription billing status for June. (2) Sufficiency: Not met. Log only covers May registration and purchase. (3) Folding: Activated. Output: 'Beta-Ori: Cannot confirm renewal status. Missing billing history for June.'
```

**Prompt:** 
```
Calculate average order value. Context: Order 1 = $10, Order 2 = $20, Order 3 = $30.
```

**Response:** 
```
Verdict: VERACITY_PROVEN. (1) Preconditions: Set of all order values and count. (2) Sufficiency: Met. 3 orders with specific values are fully present. (3) Speculation: Zero. (4) Calibration: High confidence justified by complete dataset. Output: $20.00.
```

## Capabilities

### undefined
undefined

### undefined
undefined

### undefined
undefined

### undefined
undefined

### undefined
undefined

## Use Cases

### Reviewing a patient's chart for treatment recommendations
A doctor needs to know if a new medication is safe. The agent runs the query, and `validate_yakunashi` immediately flags that critical data—like current kidney function or prior bleeding history—is missing, preventing an unsafe recommendation.

### Approving a construction blueprint
An engineer submits a design. The MCP runs the audit, demanding proof of geotechnical soil reports and bearing capacity before allowing the final approval stamp to be applied.

## Benefits

- Eliminate confident guessing: The gate forces the agent to declare when it lacks data, preventing misleading outputs that look authoritative but are totally wrong.
- Mandatory precondition mapping: Before answering anything complex, the system requires listing all necessary variables, giving you a clear audit trail of required inputs.
- Structured omission: If data is missing, the tool doesn't just say 'I don't know.' It triggers safe folding and lists exactly what information is absent and why it matters.
- Confidence calibration: You get confirmation that the AI’s stated level of certainty matches the weakest link in your evidence chain, not just the most obvious facts.
- Built-in safety checks: The entire process ensures adherence to critical data rules, providing a layer of cognitive safety for high-stakes workflows.

## How It Works

The bottom line is: you get certainty. You stop relying on AI answers that sound right but are factually unfounded.

1. Start by submitting a data-dependent query to your agent. The MCP immediately forces a precondition audit, listing every single fact required for a correct answer.
2. The system then verifies if the context contains all those necessary facts and checks if the agent is trying to speculate or fill gaps with plausible fiction.
3. If any piece of evidence is missing or insufficient, the process halts, forcing the agent to output a controlled 'folding' response that explicitly states what data needs adding.

## Frequently Asked Questions

**What is a Beta-Ori response or safe folding?**
Beta-Ori represents the tactical decision to remain silent or state what is missing rather than speculating. Safe folding triggers this state, outputting a precise checklist of missing parameters instead of an uncalibrated answer.

**How does it detect yakunashi (speculation)?**
The tool audits the agent's confidence trace against the mapped evidence. If variables are missing but the agent claims high confidence, the safety gate flags it as yakunashi.

**How do I configure Yakunashi-Safety Gate with external prompts?**
You do not need external files. Call the validate_yakunashi tool directly inside your agent loop before generating any answers to questions requiring data that may be missing.

**How does running `validate_yakunashi` protect my sensitive data?**
Your credentials pass through a zero-trust proxy. Your keys are used only in transit; they never sit on disk, keeping your information secure throughout the process.

**Does using Yakunashi-Safety Gate impact performance or token usage?**
No. Vinkius includes native token optimization built into this MCP call. You can cut token consumption by up to 60% compared to running similar validation logic without it.

**Which AI clients are compatible with the Yakunashi-Safety Gate?**
It connects via the open Model Context Protocol (MCP). You connect once from any MCP-compatible client, including Claude, Cursor, and VS Code.

**What happens if `validate_yakunashi` detects a failure or gap?**
The process generates a cryptographically signed audit trail. This tamper-proof record (SHA-256 hash chain) shows exactly which step failed and why, giving you full visibility into the context break.

**Can I combine Yakunashi-Safety Gate with other MCPs for complex tasks?**
Yes. You build automations by chaining this gate with multiple functional MCPs. This lets you enforce safety checks across several different services in one workflow.