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
- 01
Shared domain layer for sessions, tool requests and configuration.
- 02
Security crate for scope validation, approvals, emergency stop and audit.
- 03
MCP client and interceptor layer for tool execution.
- 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
§ 06
Engineering decisions
- 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.
- 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.
- 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.
- D-04
Queue approvals and process them in order in a focused terminal overlay, so the operator reviews one request at a time.
- D-05
Design emergency stop to halt new requests and cancel or deny pending work, leaving an audit trail.
- 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.