ELTIGA.

case file 04Author

Gravel

Guardrails for AI agents: scope validation, human approvals, emergency stop and an audit trail.

Role
Author
Stack
4 components
Status
Rust workspace with a terminal UI

§ 01

The problem

An AI agent that can run tools can act on targets it was never meant to touch. It needs enforced limits and a human who can say no, and that control has to sit between the agent and the tool transport.

§ 02

The build

Gravel is a terminal app that mediates every tool call: it checks scope, asks the operator to approve, can halt everything instantly, and records what happened.

result

Version 0.1.0 (February 2026): a five-crate Rust workspace with CI for tests, clippy and rustfmt, and cargo-dist release automation for macOS, Linux and Windows.

§ 03

What it does

  1. 01

    Shared domain layer for sessions, tool requests and configuration.

  2. 02

    Security crate for scope validation, approvals, emergency stop and audit.

  3. 03

    MCP client and interceptor layer for tool execution.

  4. 04

    Agent runtime with pluggable model backends, plus a terminal UI with session resume.

§ 04

Run Gravel

A working replica of the real interface, on made-up sample data

§ 05

Architecture

Drawn from the project's own documentation

Gravel architectureThree rows. First, the gate: the agent proposes a tool call, the scope check extracts targets from the arguments and validates them against allow and block lists (violations are denied and logged), the operator approves or denies in the terminal UI, and approval yields a signed token. Second, execution: the MCP interceptor accepts only requests that carry the token, sends them over a stdio or HTTP transport, and the tool server runs them. Third, always on: an audit log records sessions, requests, approvals, denials, executions and scope violations, and an emergency stop halts new requests and pending work.Gate · before anything runsAgentmodel backend proposes a tool callScope checktargets extracted from arguments;allow and block lists, CIDROperator approvalqueued in the TUI overlay; approve ordenySigned tokenissued on approvalapproved requests onlyExecute · MCP layerMCP interceptorscope, risk and approval awareTransportstdio or HTTPTool serverruns only with a signed tokenAlways onAudit logsession, request, approval, denial,execution, scope violationsEmergency stopstop new requests; cancel or denypending work
Mechanism: a tool call moves from raw request to scoped request to signed token, and only a signed request can reach the tool transport.

§ 06

Engineering decisions

  1. D-01

    Model each tool call as a typed lifecycle: raw request, scoped request, then a signed approval token. Execution proceeds only with the token.

  2. D-02

    Validate scope before anything runs: targets are extracted from tool arguments and checked against allow and block lists, including CIDR ranges. Violations are denied and logged.

  3. D-03

    Layer the workspace with dependencies pointing inward: the security crate sits below MCP, agent and UI, so policy changes do not touch rendering or model backends.

  4. D-04

    Queue approvals and process them in order in a focused terminal overlay, so the operator reviews one request at a time.

  5. D-05

    Design emergency stop to halt new requests and cancel or deny pending work, leaving an audit trail.

  6. D-06

    Use one typed command contract (UiIntent) and typed orchestrator events between the UI and the runtime, instead of parsing strings.

§ 07

Secured and shipped

  • [pass]Defensive by design: every tool request passes scope validation and operator approval before it runs.
  • [pass]Emergency stop and an audit trail of what ran.
  • [pass]Cargo workspace with format, clippy and test commands as the quality gate.

stack

Rust / MCP / Terminal UI / Cargo workspace

open channel

Have a problem shaped like this one?

Tell me what your team is stuck on and what you need built.