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

# Tools for agents

> Give an AI the complete scripting reference, and fix what it writes by diagnostic code.

Have an AI write scripts for you. The whole reference comes as one text file, and every problem the editor reports has a stable code a model can act on.

## The reference for an AI

[terminal/llms.txt](/terminal/llms.txt) is the whole scripting reference in one file: these guides, every diagnostic code, the API's TypeScript declarations, every example and every built-in indicator. It is built from the same sources as these pages and the engine, so it matches what the terminal runs. Give it to a model with your request, then paste the script into the editor.

## What to ask for

A model writes a better script when the request says what it should read and draw. Name:

* the data: the chart's bars, another interval or market, the tape, liquidations, liquidation levels, the order book, open interest, funding or breadth;
* what to plot and where: on the price pane, in a pane of its own, as a line, bars, markers or a table;
* the settings the reader should be able to change;
* what should happen on the bar still forming: follow the price live, or wait for the bar to close.

For example: "Using the 0xArchive scripting reference, write a script that plots, in its own pane, the USD of long liquidations less short liquidations on each bar, with a setting for the smallest liquidation to count, and marks bars where more than \$5M of longs were liquidated."

The rules a model most often breaks are in [how a script runs](/terminal/guides/how-scripts-run): constructors only at the top, persistent values as declared state, and indicators updated on every bar.

## Fixing what it wrote

The editor checks a script as you type and lists each problem with its line and a code, such as `OX1003` for a top-level `let`. Give the model the list: each code's entry in [diagnostics](/terminal/reference/diagnostics) says what is wrong and what to do. Codes never change meaning, so a fix-up loop can key on them. `OX9xxx` codes are the engine's own failures, never the script's.

## Next step

Look up a code in [diagnostics](/terminal/reference/diagnostics).


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