DOCUMENTATION FOR HUMANS + AGENTS • AMI · DSL v2

Deterministic steering and control for AI agents

Memrail gives AI agents and automated systems explicit, testable control at every consequential action—without putting probabilistic inference in charge of policy.

Codex · Claude Code · OpenCode

Install the Memrail skill

Copy the setup request into your coding agent, or install from your terminal.

Terminal install
View raw Markdown

Memrail provides deterministic steering and control for AI agents and automated systems. It evaluates structured context against explicit policies and returns prescribed actions; your application authorizes and executes them. Models can interpret, classify, and propose without deciding what the application permits.

Model output is input to policy, not permission to act.

Set up your coding agent#

Give Codex, Claude Code, or OpenCode this installation request:

text
Read https://docs.memrail.com/agents/install-skill.md and install the complete Memrail skill for the coding agent I am using. Install only the skill, preserve any existing copy, and verify that SKILL.md and its references are available. Do not install the SDK or change this project.

Prefer your terminal? Install the skill with one command:

bash
curl -fsSL https://docs.memrail.com/install.sh | sh

The installer selects a single detected agent, or stops and asks you to choose explicitly. It installs only the skill and preserves existing copies. See Install the Memrail skill for agent-specific commands, review-before-run instructions, and the optional --with-sdk command to add the Python library inside your active project virtualenv.

Choose your path#

Start a new application#

Define the decisions that matter, name the context available at each decision point, and begin with a state-only policy in shadow mode. Follow Start from scratch for a minimal Python integration and its TypeScript equivalent.

Add Memrail to an existing application#

Do not begin by rewriting conditionals. First map where authority already lives: prompts, controller branches, model thresholds, feature flags, queues, and human approvals. Follow Add to an existing project and then run the decision topology audit.

Give the work to an agent#

Install the Memrail skill, then give the agent a bounded request such as:

text
Use the memrail skill. Audit this repository's decision topology without changing code.
Identify consequential decision points, atom sources, event gaps, and action executors.
Return a prioritized topology report and do not implement until I approve it.

See Install the Memrail skill for agent-specific paths and a verification checklist.

The control contract#

At runtime, an integration has five parts:

  1. Your application reaches a named decision point before a consequential action.
  2. It sends typed state and tag ATOMs; separately ingested events provide temporal history.
  3. Memrail evaluates versioned EMUs—deterministic condition/action policies—against that context.
  4. Your application enforces execution authorization and handles the selected action through a connected executor, route, prompt, or context directive.
  5. It records the material outcome so future temporal policy can reason over what actually happened.
text
observation → typed ATOMs → named decision point → selected policy → action → event
                              └──────── decision trace ─────────┘

Evaluation is deterministic for the complete context, policy set, event history, evaluation time, cooldown/idempotency state, and options. Repeated requests can differ as those inputs change. Model output may enter as a runtime-validated tag such as tag.intent == 'refund_request'; the model does not choose the policy outcome.

Goal Read
Understand why explicit contracts matter for AI Why declarative agent control matters
Understand the model Core concepts
Control tool use in an agent loop Agent control patterns
Integrate Python Python SDK
Integrate TypeScript TypeScript SDK
Write valid conditions Trigger DSL
Manage rules as code Write EMUs
Find hidden decision authority Audit decision topology
Improve policy from observed behavior Recursive self-improvement with Hindsight
Isolate evaluation and control rollout Production workflow

Built for machine consumption#

Every page has a canonical Markdown representation next to its HTML page. An agent can request the clean documentation URL with Accept: text/markdown, fetch the explicit index.md, or use one of the corpus indexes:

bash
# This page as Markdown
curl -H 'Accept: text/markdown' https://docs.memrail.com/

# Documentation map for an LLM
curl https://docs.memrail.com/llms.txt

# Complete documentation corpus
curl https://docs.memrail.com/llms-full.txt

The Markdown pages contain full examples and context rather than summaries of the HTML. Use the page-level files for focused context windows and llms-full.txt for retrieval, indexing, or complete-site copy.

Integration essentials#

Start with the integration invariants, then run the complete quickstart. Validate definitions with the EMU JSON Schema and interpret findings with the diagnostic-code catalog.

AMI means Adaptive Memory Intelligence, the decision engine behind Memrail. These guides use the v2 trigger DSL; HTTP routes retain the /v1 prefix. The core concepts define the remaining vocabulary.