Skip to main content

Pre-flight gate enforcement MCP server for Hermes Agent

Project description

Ultratimonel — Pre-flight Gate Enforcement MCP Server

Ultratimonel is an MCP (Model Context Protocol) server that enforces a deterministic pre-flight gate protocol in Hermes. It ensures that every LLM generation has consulted AgentMemory (1a), Checkpoint (1b), and Deck (1e) before generating a response.

Quick Start

# Set up
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

# Run (stdio transport — default for Hermes integration)
python main.py

# Run (with custom DB path)
ULTRATIMONEL_DB_PATH=/tmp/test.db python main.py

# Deploy SOUL.md rules
./scripts/deploy_soul.sh

# Run tests
pytest tests/ -v

Tools

assert_gates(message, session_id, sender="user")

Run all three pre-flight gates and return structured results.

  • Input: message string, Hermes session ID, optional sender
  • Output: JSON with gates[], status (PASS/BLOCK/WARN), context, context_envelope, timestamp
  • Execution order: 1a AgentMemory → 1b Checkpoint → 1e Deck

check_gate(name, session_id)

Read the current status of a single gate from SQLite persistence.

  • Input: gate name (1a, 1b, 1e), session ID
  • Output: JSON with name, state, mandatory, message, updated_at

complete_gate(name, session_id, reason)

Explicitly mark a BLOCK or WARN gate as PASS. Only works when current state is BLOCK or WARN.

  • Input: gate name, session ID, optional reason string
  • Output: JSON with name, state (PASS), updated_at, message

Gate States

State Meaning Generation Action
PASS Gate completed successfully Continue
SKIP Gate does not apply / N/A Continue
WARN Gate failed (non-critical) Warn + continue
BLOCK Gate failed (mandatory) Halt generation

Architecture

ultratimonel/
├── main.py                 # Entry point (stdio transport)
├── requirements.txt        # fastmcp, httpx
├── ultratimonel/
│   ├── __init__.py         # Package metadata
│   ├── server.py           # FastMCP tool registration
│   ├── persistence.py      # SQLite layer (WAL, migrations)
│   ├── context_extractor.py# Message → sender/topic/project
│   ├── gate_engine.py      # State machine (PASS/SKIP/WARN/BLOCK)
│   ├── triple_match.py     # 1a→1b→1e orchestration
│   └── bridge.py           # mcp-capabilities bridge stub
├── scripts/
│   └── deploy_soul.sh      # SOUL.md rule injection
└── tests/
    ├── test_gate_engine.py
    ├── test_context_extractor.py
    ├── test_persistence.py
    ├── test_triple_match.py
    └── test_integration.py

Database

SQLite database at ~/.hermes/ultratimonel.db (configurable via ULTRATIMONEL_DB_PATH). Six tables:

  • schema_version — migration tracking
  • sessions — per-generation context
  • gate_state — per-gate status per session+project
  • gate_logs — audit trail of state transitions
  • checkpoints — triple-match snapshots
  • missions — top-level mission lifecycle

WAL journal mode, NORMAL synchronous, 5s busy timeout.

SOUL.md Deployment

Run scripts/deploy_soul.sh to inject the pre-flight protocol rules into ~/.hermes/SOUL.md. The script:

  1. Backs up the existing SOUL.md
  2. Checks for the ## Protocolo Pre-flight (OBLIGATORIO) section
  3. Updates in-place or appends as needed
  4. Supports --force, --dry-run flags

Error Handling

All external MCP tool calls (AgentMemory, Checkpoint, Deck) are wrapped in try/except with SKIP fallback. The server never crashes from external failures. See the SDD for detailed error scenarios.

Dependencies

  • Python ≥ 3.13
  • fastmcp — MCP framework
  • httpx — HTTP client for external MCP calls
  • sqlite3 — stdlib persistence

License

MIT — © Nous Research

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ultratimonel-1.0.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ultratimonel-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file ultratimonel-1.0.0.tar.gz.

File metadata

  • Download URL: ultratimonel-1.0.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ultratimonel-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0b71c3eb29d94f5ba3ada5e64aea67f583333ece5f9f36839b805a526d335398
MD5 4209a10899559c341b108e8c52b802e7
BLAKE2b-256 697502421b5a78c32987122cef375f84cb45f68d9d84fea6fd714003e060aa38

See more details on using hashes here.

File details

Details for the file ultratimonel-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ultratimonel-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for ultratimonel-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d20d18a54d5f2726d9c9a9e433fb74217443e7b6014f6ef032aa863ae565aa8
MD5 69ae757063b3f05a2228232bd3d10e61
BLAKE2b-256 27d4e215791388c3634671faa8cda7764a54b95ad8d221e790faae51c62194cc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page