Skip to main content
Glama

rationale-engine

Python 3.10+ Rust: 2021 (Pure Safe) License: MIT Dependencies: Zero MCP: 12 Stdio Tools

Stop merging unexplained diffs, sycophantic AI plans, and wishful strategy memos. Verify 5-layer first-principles rationale, pre-mortem failure modes, and falsifiable kill criteria in < 80 µs with zero dependencies.

Architecture docs rot into changelog lists ("Switched to Redis"), while RLHF models flatter weak proposals and bury irreversible bets. rationale-engine (v2.0.0) pairs a zero-dependency Pure Safe Rust (#![forbid(unsafe_code)]) UTF-8 scanner with a block-aware multi-decision parser, 6 domain profiles (generic, software-engineering, ai-ml-systems, product-business, security-governance, scientific-research), 42 epistemic rules (including anti-sycophancy & ML baseline gates), MCDA +/-15% sensitivity, 7 export formats, an 8-audience rigor advisor, and a 12-tool Stdio MCP server — with 0 runtime dependencies.

Try Live in Browser · AI & Benchmark Guide · MCP Server Setup · Architecture · Formal Specification


Before & After in One Deterministic Pass

Pass raw proposals through run_rationale_chain() or rationale-engine chain:

RAW PROPOSAL (Score: 20.0/100 · FAIL — missing layers 2..5, changelog-only):
## Decision 1: Cache Layer
Switched to Redis because it is obviously best practice. TODO: add details later.
VERIFIED 5-LAYER RATIONALE (Score: 100.0/100 · PASS · SHA-256 receipt minted):
1. CS / OS / Protocol Fundamentals -> Bounded RAM cache vs durable disk I/O
2. Threat Model / Failure Mode     -> Thundering herd + eviction storm (CWE-400)
3. Trade-off & Reversibility Door  -> In-process LRU vs Redis (Two-Way Door, N.x safe)
4. Runtime & Stdlib Implementation -> `functools.lru_cache` + `threading.RLock`
5. Edge Cases & Kill Criteria      -> Cold-start cap; rollback if p99 > 40 ms

Related MCP server: ReasonForge

Two Core Tracks: Generic & Software Engineering

Layer

Generic Decisions (profile="generic")

Software Engineering (profile="software-engineering")

1

First-Principles Laws & Domain Axioms

CS / OS / Protocol Fundamentals

2

Pre-Mortem Failure Modes, Risks & Asymmetry

Threat Model / Failure Mode (CWE-*, TOCTOU)

3

Alternatives Matrix, Via Negativa & Door Type

Engineering Trade-off, Via Negativa & SemVer

4

Operational Mechanism & Named Owners

Language Runtime, Stdlib & SDK Symbols

5

Stress Edge Cases & Falsifiable Kill Criteria

Production Topologies, Edge Cases & TDD/Kill Gates

Additional built-in profiles: product-business, ai-ml-systems, security-governance, scientific-research, plus register_domain_profile().


Architecture (v1.0.0)

flowchart TD
    IN["Proposal Markdown + Profile"] --> WIRE{"Machine Wire Format?"}
    WIRE -->|"Yes (JSON-RPC / Protobuf / SQL)"| SKIP["Bypass Engine (LAW_07)"]
    WIRE -->|"No (Human Proposal)"| PARSE["Block-AST Parser (Per-Decision + Fence Isolation)"]
    PARSE --> RUST["Pure Safe Rust Scanner (O(N) UTF-8)"]
    RUST --> RULES["36 Epistemic Rules + One-Way Door Gate"]
    RULES --> FSM["7-Law Rationale FSM + SVG Scorecard + SHA-256 Receipt"]

Installation

Install directly from GitHub in one command (Python 3.10+, dependencies = []):

pip install "git+https://github.com/skupriienko/rationale-engine.git"

For local development with the optional zero-crate Pure Safe Rust (#![forbid(unsafe_code)]) accelerator:

git clone https://github.com/skupriienko/rationale-engine.git
cd rationale-engine
cargo build --release --manifest-path rust/Cargo.toml
pip install -e ".[dev]"

30-Second Python Quickstart

from rationale_engine import (
    evaluate_tradeoff_matrix,
    export_rationale,
    render_rationale_template,
    run_rationale_chain,
    verify_rationale,
)

# 1. Generate a Generic or Software Engineering blueprint
blueprint = render_rationale_template(
    title="Regional Hub Consolidation",
    profile="generic",
    door_type="one_way",
)

# 2. Verify a multi-decision proposal (ignores prose mentions & code-block TODOs)
result = run_rationale_chain(blueprint, profile="generic")
print("Score:", result["report"]["score"], "Passed:", result["passed"])

# 3. Detect fragile trade-offs with +/-15% MCDA weight perturbation
mcda = evaluate_tradeoff_matrix(
    options=[
        {"name": "Option A", "scores": {"safety": 9.0, "speed": 5.0}, "complexity": 2.0},
        {"name": "Option B", "scores": {"safety": 5.2, "speed": 9.0}, "complexity": 4.0},
    ],
    weights={"safety": 0.51, "speed": 0.49},
)
print("Winner:", mcda["winner"], "Fragile flip:", mcda["fragile_flip_detected"])

# 4. Export to MADR 4.0, GitHub PR, or Executive Memo
madr = export_rationale("Adopt SQLite WAL", profile="software-engineering", fmt="madr")

MCP Server Setup

Add rationale-engine to Claude Code, Cursor, Windsurf, or any JSON-RPC 2.0 MCP client:

{
  "mcpServers": {
    "rationale-engine": {
      "command": "rationale-engine",
      "args": ["mcp"]
    }
  }
}

MCP Tool

Purpose

rationale_template

Generate 5-layer Generic or SE blueprint

rationale_verify

Audit multi-decision Markdown + Rust metrics

rationale_chain

6-stage pipeline + SVG + SHA-256 receipt

rationale_fsm

7-Law Epistemic FSM evaluation

rationale_mcda

Weighted MCDA + +/-15% sensitivity check

rationale_export

Render 5-layer, MADR, GitHub PR, or Memo

Utility Tool

Purpose

rationale_advise

Recommend rigor tier (bypass..strict_one_way_gate) for 8 audiences & AI stages

rationale_rules

List all 42 epistemic rules across 7 families

rationale_svg

Render light-atelier SVG scorecard

rationale_profiles

List 6 built-in + custom domain profiles

rationale_register_profile

Register a custom 5-layer profile at runtime

rationale_benchmark

Benchmark Pure Safe Rust vs Python scanner


CLI & Verification

rationale-engine template --profile generic --title "Pricing Tier Migration"
rationale-engine verify --file proposal.md --profile software-engineering --json
rationale-engine chain --file proposal.md --profile auto --json
rationale-engine export --title "Adopt SQLite WAL" --profile software-engineering --format madr

Run the full Rust + Python verification suite locally:

cargo test --manifest-path rust/Cargo.toml --release
ruff check src tests examples && mypy --strict src/rationale_engine && pytest -W error

Scope & When NOT to Use

  • Best Fit: Architecture Decision Records (ADRs), RFCs, migrations, security hardening, executive strategy memos, product bets, and research protocols.

  • Do NOT Use On: Machine wire formats (JSON-RPC, Protobuf, SQL DDL), trivial typo fixes, or routine formatting commits.

See docs/ARCHITECTURE_AND_RATIONALE.md and docs/SPECIFICATION_AND_LIMITATIONS.md for formal specifications.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables structured, iterative reasoning for complex problem-solving with features like confidence tracking, revision mechanisms, and branching support. Provides flexible validation and multiple output formats for systematic analysis and decision-making tasks.
      1
      60 npm
      72
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Provides 8 MCP tools for deterministic, read-only reasoning: intake, routing, planning, rubric, sweep checklist, verdict gate, reflection, and evaluation. It forces scope locks, disconfirmation-first plans, blind-spot sweeps, and evidence-gated verdicts.
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables users to trace regulatory rule changes to affected parties and required actions through deterministic safety gates, returning dated action plans and hash-linked evidence records. Supports 12 MCP tools over stdio or streamable HTTP for source comparison, obligation decomposition, scope assessment, planning, and evidence validation across multiple domain packs.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes 14 tools that let an agent query charter clauses, route and execute an 8-stage collaboration pipeline, arbitrate conflicts with cited clause IDs, enforce safety gates, run receipt self-checks, deposit and recall memory, solve symbolic anchoring constraints, and mine a 330-entry knowledge base plus semantic-field analysis. It also diagnoses image-generation prompts against a formal feature-cluster grammar, all over a zero-dependency stdio JSON-RPC interface.
      1
      MIT