> ## Documentation Index
> Fetch the complete documentation index at: https://agents.nanonets.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Trail Rules

> Turn a procedure document in a task into cited, scoped draft rules in a Trail, and see how the Trail took them.

**Create Trail Rules** writes the rules an agent turned from a procedure document (an SOP, a policy, a detailed task procedure, a controls workbook) into a Trail, as drafts a person approves, and reports back how the Trail took each one. Every rule cites the passage or cells it came from, so a reviewer opens the source on those words. Display name **"Create Trail Rules"**. **Off by default**; enable it per agent.

The usual order in a task: read the document, cite each rule's source with `cite`, then send the rules here a batch at a time.

## Authentication and enablement

* No external integration. It writes to Trails in the running agent's workspace.
* **Off by default.** Not seeded into new agents.
* Works on graph and opencore Trails.
* The agent writes **drafts**. Approved rules are never changed or removed by it; they are changed in the Trail.

## Inputs

* `file_url`: the cited document, as a workspace path or a task file URL. Needed when the call sends rules. The file becomes a document in the Trail; one document per Trail, task and file.
* `trail` (optional): the Trail's name or id. Default: the agent's own Trail, or the workspace's only Trail.
* `rules` (optional, at most 50 per call): each with
  * `key`: the agent's key for the rule, unique in the document. Sending the same key again updates that rule.
  * `text`: the rule, standalone.
  * `cite`: the numbers of the `[cite:N]` handles the `cite` tool returned for its source. A citation from another document is refused.
  * `entities`: the entities it applies to (company codes, legal entities, countries). Empty means all.
  * `procedure`, `step`, `step_order`: the procedure and step it belongs to.
  * `source_ids`: the document's own ids for it (BR-05).
  * `flags`: what a reviewer must know: `proposed`, `incomplete`, `unresolved_reference`, `columns_disagree`, `placeholder_text`, `people`.
* `remove_keys` (optional): keys of drafts to delete.

A call with neither `rules` nor `remove_keys` only reads the document's state. `file_url` may then be left out when the task has written rules from one document.

## Output

Each call waits while the Trail places what it sent and checks it against the Trail's other rules (about a minute for a full batch; at most two and a half minutes), then reports:

* every rule's state: **added**, **already in the Trail** (a duplicate), **clashes** with another rule, **approved**, or **failed** with the reason;
* the agent's own rules that clash with or repeat each other, which it merges into one;
* duplicates of and clashes with rules already in the Trail, which stay drafts for the reviewer to settle at approval.

If the Trail is still working when the wait ends, the report says so; calling again without rules reads the final state.

The task page shows one live card per document: each rule with its state and a citation that opens the document at its passage. It updates while the Trail places and checks the rules.

On an opencore Trail each rule is kept as its own evidence, and the Trail's memory service derives and relates the memories itself; its conflicts are settled in the Trail's conflicts view.

## Limits and side effects

* 50 rules per call; send the rest in further calls.
* Placement's model calls are metered as Trail usage, as an upload is.

## Errors

* A rule without a key, text or citation, a key used twice, or a citation that is not this task's or is in another file: nothing is written, and each problem is listed.
* The file is not one of this task's files, or the Trail cannot be found.
* A read when the task has written rules from several documents and `file_url` is left out: the documents are listed.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.