ChartnautDocs

Command reference

Every chartnaut command and flag, as the CLI defines them. chartnaut <command> --help prints the same list in your terminal, and the source for each command is in chartnaut/cli on GitHub.

$ chartnaut run --help
Usage: chartnaut run [options] <target>

run a local script folder/file (inline) or a saved ref on Chartnaut servers

Arguments:
  target              path to a script folder or file, or a ref (slug, slug@3,
                      author/slug, chartnaut/rsi)

Options:
  --on <instruments>  instrument, or comma list (one run each, max 3 at once)
  --tf <timeframe>    timeframe (1m 5m 15m 30m 1h 2h 4h 1d 1w 1mo; 1mo = calendar month)
  --from <date>       window start (ISO date/time)
  --to <date>         window end (ISO date/time, default now)
  --last <span>       window as a span back from now, e.g. 30d, 12w, 6m, 1y
  --bars <n>          window as a bar count
  --set <key=value>   setting override (repeatable) (default: [])
  --kind <kind>       kind for a lone file outside a script folder
  --label <text>      free-text label shown in the app
  --wait              wait for the run to finish (default) (default: true)
  --no-wait           print the run id and exit
  --out <file>        write full results to file.csv or file.json
  -h, --help          display help for command

Options on every command

Option

What it does

--json

Prints the raw API response instead of the tables. Goes before or after the command name.

-v, --version

Prints the CLI's version.

-h, --help

Prints the command's usage. chartnaut help <command> does the same.

Every command exits with a fixed code from 0 to 5, so a script or a coding agent can branch on it. The codes are on Errors and exit codes.

Instruments, timeframes and windows

The commands that run something (run and collect) share these rules.

Flag

Takes

--on

An instrument symbol, such as BTC, ETH or EURUSD. chartnaut instruments lists them.

--tf

One of 1m 5m 15m 30m 1h 2h 4h 1d 1w 1mo. 1mo is the calendar month, and 1M means the same.

--last

A span back from now: 30d, 12w, 6m or 1y. A month is 30 days and a year is 365.

--bars

A number of bars back from now. --bars 300 --tf 5m is the last 25 hours of clock time, weekend or not.

--from, --to

A date (2026-01-02, read as midnight UTC), a full timestamp, or unix seconds. --to defaults to now and needs --from.

Pass exactly one of --last, --bars or --from. When you leave a flag out, the CLI takes it from defaults in the nearest chartnaut.json, which chartnaut init writes. A window ends on the last closed bar. A run window also starts no earlier than your plan's historical data reaches, and holds at most 50,000 bars.

A saved script is named by a ref: orb-break for your latest version, orb-break@3 for version 3, author/slug for someone else's script, and chartnaut/rsi for a built-in. chartnaut library search finds them.

Project folders and scripts

chartnaut init

Sets up the current folder as a project folder: chartnaut.json, the indicators/, definitions/ and studies/ folders, and the agent guide in CLAUDE.md and AGENTS.md. It never removes or overwrites what you wrote. Running it again refreshes only the marked Chartnaut section of the guide. What it writes is on Working with Claude Code and Codex.

Flag

Default

What it sets

--instrument <symbol>

BTC

The default instrument

--tf <timeframe>

5m

The default timeframe

--window <span>

90d

The default window: a span, or a bar count such as 2000

A default already in chartnaut.json is kept unless you pass its flag.

chartnaut new <kind> <slug>

Writes a starter folder, <kind-plural>/<slug>/, with script.json and main.ts. <kind> is indicator, definition or study. The slug is 2 to 63 characters of lowercase letters, digits and dashes, starting with a letter or digit.

Flag

What it does

--name <name>

The display name. Defaults to the slug.

chartnaut validate [path]

Lints and resolves a script without saving or running it. Free. path is a script folder or file and defaults to .. Prints ok: <slug> (<kind>) and the script's settings, outputs, events and dependencies, or one path:line: severity: message line per problem and exit code 1.

Flag

What it does

--kind <kind>

The kind of a lone file that is not in a script folder

chartnaut push [path]

Saves a script folder as a new version, creating the script on its first push. path defaults to .. See Saving and versions.

Flag

What it does

-m, --message <msg>

The change summary shown in the version history

--force

On a version conflict, save on top of the latest version

--visibility <v>

private or public, on the first push only. Defaults to private. Refused for a study: studies are always private.

chartnaut pull <ref>

Writes a saved version of your own script to local files. <ref> is slug or slug@N.

Flag

What it does

--dir <dir>

The folder to write to. Defaults to the script's existing folder, or <kind-plural>/<slug>.

chartnaut diff <slug>

Prints a unified diff of your local files against the latest saved version. Takes a slug or a path to a script folder. Tells you when your folder is based on an older version than the latest.

chartnaut ls

Lists your scripts: slug, id, kind, version, visibility, last update and name. The id (ind_… for an indicator, flw_… for a definition) is what the Terminal SDK takes; studies have none.

Flag

What it does

--kind <kind>

Only indicator, definition or study

-q, --query <q>

Only scripts whose slug, name or description contains the text

--limit <n>

Page size. 50 by default, 500 at most.

--cursor <cursor>

The next page, from the more: --cursor … line

chartnaut versions <slug>

Lists a script's versions, newest first, with when each was saved, who saved it and its change summary. Takes --limit and --cursor like ls.

chartnaut open <target>

Prints the app link for a script slug or a study run id. Indicator and definition runs have no page in the app.

Flag

What it does

--browser

Opens the link in your browser as well

Running

chartnaut run <target>

Runs a script on Chartnaut's servers and prints the summary. A path to a folder or file runs your local files and saves nothing. Anything else is a ref and runs the saved version. A study runs by ref only, so push it first. Another author's script runs only once it is in your library; until then run stops with Add it first: chartnaut library add <ref>. See Runs and results.

Flag

What it does

--on <instruments>

The instrument. A comma list such as BTC,ETH starts one run each, three at a time, and prints a comparison table.

--tf, --from, --to, --last, --bars

The timeframe and window, as above

--set <key=value>

Overrides a setting. Repeat it for more than one. true, false, null, numbers and JSON arrays or objects are typed; anything else is a string.

--kind <kind>

The kind of a lone file that is not in a script folder

--label <text>

A free-text label kept on the run

--wait

Waits for the run to finish. This is the default.

--no-wait

Prints the run id and status, and exits

--out <file>

Writes the full results to a .csv or .json file. With several instruments, each gets its own file named after the full symbol, such as results.HYPERLIQUID_BTC.csv. A study writes .json only.

chartnaut runs

Lists your recent runs, newest first.

Flag

What it does

--script <slug>

Only runs of this script. --script inline lists runs of local files.

--source <source>

api for runs started from the CLI or API (the default), app for study runs made in the app, all for both

--status <status>

queued, running, succeeded, failed or cancelled

--limit <n>

Page size. 50 by default, 200 at most.

--cursor <cursor>

The next page

chartnaut runs get <id>

Prints a run's status, progress, failure, summary and console lines.

Flag

What it does

--watch

Polls until the run finishes, printing its progress as it goes

chartnaut runs results <id>

Prints what a finished run produced: series, events or study blocks.

Flag

What it does

--keys <keys>

Study: a comma list of result keys to return in full

--full

Study: every block in full

--outputs <ids>

Indicator: a comma list of output ids

--event <id>

Definition: only this event id

--from <date>, --to <date>

Indicator and definition: only results in this range. Give full timestamps, such as 2026-09-01T00:00:00Z.

--format <format>

json (the default) or csv. A study's CSV needs exactly one key in --keys.

--limit <n>

Page size. 5,000 by default, 50,000 at most.

--cursor <cursor>

The next page

--all

Follows every page and joins them: one JSON document, or one CSV with a single header row

chartnaut runs cancel <id>

Cancels a queued or running run and prints its new status.

A definition's events

See Definition events. Both commands work on your own definitions only.

chartnaut events <definition>

Lists the events your definition has from running over history, on every instrument and timeframe, from the app or the CLI.

Flag

What it does

--summary

Totals, one row per instrument and timeframe, and any runs still going or failed

--on <instrument>

Only this instrument

--tf <timeframe>

Only this timeframe

--event <id>

Only this event id

--from <date>, --to <date>

Only events starting at or after, or ending at or before, this time. Give an RFC 3339 timestamp, such as 2026-01-02T00:00:00Z.

--version <n>

Only events found by this version

--where <json>

Payload filters, such as '[{"key":"range","op":"gt","value":10}]'

--limit <n>

Page size. 100 by default, 1,000 at most.

--cursor <cursor>

The next page

--all

Follows every page

--format <format>

json (the default) or csv. CSV follows every page unless you give --limit or --cursor without --all.

--out <file>

Writes to a .csv or .json file

chartnaut collect <definition>

Runs your definition over history on one instrument, timeframe and window, and keeps its events. Only the part of the window it has not covered yet runs.

Flag

What it does

--on <instrument>

The instrument

--tf, --from, --to, --last, --bars

The timeframe and window, as above

--version <n>

Run this version. Defaults to the latest.

--wait

Waits until it finishes, then prints the total

--version <n> on events keeps the events that version found; on collect it runs that version. The same filter is version in the API.

Forward Insights

A Forward Insight is a study saved to your library. Make it active and it shows on the latest setup of its definition on your charts of its market and timeframe. The study must publish pin_cell first: see Forward Insights for the contract.

chartnaut insights

Lists your Forward Insights, newest change first, with whether each one is active.

Flag

What it does

--definition <slug>

Only insights on this definition

--study <slug>

Only insights made from this study

--on <instrument>

Only this instrument

--tf <timeframe>

Only this timeframe

--limit <n>, --cursor <cursor>

Page size and the next page

chartnaut insights create <run>

Saves a succeeded study run to your library as a Forward Insight: run_… from chartnaut run, or srun_… for a run made in the app. It belongs to the definition, and the run's instrument and timeframe. To see it on a chart, make it active with chartnaut insights activate.

Flag

What it does

--name <name>

Required. The card's title on the chart

--definition <slug>

Your definition, when the study reads more than one

--description <text>

What the card answers

--dry-run

Checks everything and prints the preview card without saving

--no-replace

Refuses instead of replacing your insight with the same name on that definition

--replaces <id>

Re-saves this insight (ins_…) whatever its name is now. It stays active if it was

When the study needs a change, the error ends with fix: and docs: lines.

chartnaut insights show <id>

Prints one insight: its definition, instrument, timeframe, study version, window and breakdown.

chartnaut insights update <id>

--name and --description change what the chart shows. To change the numbers, run the study again and insights create with the same name.

chartnaut insights activate <id>

Makes the insight active on your charts. A definition has one active insight per market and timeframe, so this replaces any other active there. Otherwise it takes one of your plan's places (Forward Insights on charts). When every place is taken it stops with plan_limit and names the active ones: deactivate one first.

chartnaut insights deactivate <id>

Stops the insight showing on your charts and frees its place. It stays in your library.

chartnaut insights rm <id>

Removes the insight from your library, and from your charts if it was active. The study and its runs are kept.

Developer projects

A project is the Chartnaut side of an app that puts the Chartnaut terminal on your own site, with the Terminal SDK: its keys, sites and webhooks. These commands need the apps:write permission: when your login lacks it, they sign you in again through your browser to add it. They never make Live keys. Getting started walks through them.

The old chartnaut app commands, chartnaut init --app and chartnaut login --apps still work and do the same thing.

chartnaut init --project [slug]

Links this project folder to a project: picks it (or creates one), writes a Test key to .env.local as CHARTNAUT_SECRET_KEY (never printed) with CHARTNAUT_APP, adds .env.local to .gitignore, checks localhost is allowed, writes the project's slug into chartnaut.json, a guide into AGENTS.md and CLAUDE.md, the skill .claude/skills/chartnaut-sdk/SKILL.md, a template in an empty folder, then runs chartnaut project check.

Flag

What it does

--name <name>

Creates a new project with this name

--template <name>

next, vite-express or none. Default next in an empty folder, none otherwise. A template needs an empty folder

--port <port>

Your dev server's port. Default 3000 for next, 5173 for vite-express

--no-browser

Prints the sign-in link instead of opening it

--no-check

Skips the checklist at the end

With --json it prints the project, what happened to each file and the checklist. The key's secret is replaced by where it was written.

chartnaut project list

Your projects: slug, name, your role and whether each is live.

chartnaut project create <name>

Creates a project and writes its first Test key to .env.local here.

chartnaut project key [slug]

Makes a new Test key and writes it to .env.local in place of the old one. The old key works until you revoke it on the project's Keys tab in Developers. Without a slug it uses this folder's project (CHARTNAUT_APP in .env.local, then chartnaut.json), or your only project.

chartnaut project check [slug]

Prints the project's checklist: Test key made, first frame, your account linked, then what Live still needs. Exits 0 whatever it shows.

Account and discovery

chartnaut login

Signs in through your browser: it prints a code and opens the approval page. See Sign in.

Flag

What it does

--token <token>

Saves this API key instead of signing in through the browser. For CI.

--force

Signs in again, replacing the current login

--no-browser

Prints the link instead of opening it

--expires <span>

How long the key works: 7d, 30d or 90d, the default. The approval page can shorten it, never lengthen it

--apps

Also asks for the permission to create developer projects and Test keys (apps:write). The approval page names it. A saved key without it is replaced

When it signs in, login prints the date the key expires. From 7 days before that date, every command prints a one-line warning on stderr. Once the key has expired, commands say your key expired. Run chartnaut login. and exit 3. A key saved with --token keeps the expiry it was made with.

chartnaut logout

Signs out and revokes the key this machine used.

chartnaut whoami

Prints your user, plan, the key's name, the date it expires (or that it never does), its scopes, and the API address.

chartnaut usage

Prints this period's compute and every plan cap with how much of it you use. --json adds the request limits. See Limits.

chartnaut instruments [q]

Lists the instruments you can run on, with their category, order flow and the dates they cover. q matches the symbol, the short symbol and the name.

Flag

What it does

--category <c>

crypto, fx, index or commodities

--limit <n>, --cursor <cursor>

Paging

chartnaut library search [q]

Searches every script you can use: your own, Chartnaut's built-ins, other people's public scripts and the ones you added to your library. Prints one row per script with its ref, kind, latest version, adoptions, author and name. Every word of q must appear in the name, slug, description, tags, category or author. The source never comes back. See Search the library.

Flag

What it does

--scope <scope>

Whose scripts: all (the default), library (what your library in the app shows), mine, published (your public ones, never studies), chartnaut, community (other people's public ones) or installed (other people's you added)

--author <name>

One author: a username, chartnaut or me

--kind <kind>

indicator, definition or study. Only your own and Chartnaut's studies are listed

--sort <sort>

relevance (the default with q), updated (the default without), created, adoptions or name

--interface

Adds each script's settings, outputs and events to the response. They show with --json

--limit <n>, --cursor <cursor>

Paging. --limit is at most 200

The ref in the first column runs as it is: chartnaut run chartnaut/rsi --on BTC --tf 1h --last 30d.

chartnaut library show <ref>

Prints one library script: its ref, kind, version and author, its name and description, tables of its settings, outputs, events and results, and its app link. Never its source. The ref is author/slug, chartnaut/slug for a built-in or me/slug for your own, with @N for version N: chartnaut library show chartnaut/rsi. See Get a library script.

Flag

What it does

--kind <kind>

indicator, definition or study, when one of your studies shares the slug with an indicator or definition

chartnaut library add <ref>

Adds another author's script to your library, as Add to library does in the app: chartnaut library add bob/vwap-bands. Their script runs for you only once it is in your library. When it needs other scripts you have not added, the CLI prints To use <name>, we'll add N more scripts to your library: with the list, then asks Add them? [y/N].

Answering anything but y adds nothing. Adding never copies a script: it stays its author's, picks up their edits, and you can remove it at any time. When something it needs is not shared with you, nothing is added and the CLI names it. Studies cannot be added: only your own studies run. See Add to your library.

Flag

What it does

--yes

Adds everything it needs without asking. For scripts and CI. Without a terminal to ask in, library add refuses unless you pass it

--kind <kind>

indicator or definition, when the author has both with that slug

chartnaut library remove <ref>

Takes a script you added out of your library. The scripts it brought along stay. Your own scripts and Chartnaut's built-ins cannot be removed this way. See Remove from your library.

Flag

What it does

--kind <kind>

indicator or definition, when you added both with that slug

chartnaut library needs <ref>

Shows what adding a script would add, and changes nothing: each script it needs with its status, anything not shared with you, and the message the app would show. library requirements is the same command. See Check what a script needs.

chartnaut docs [topic]

With no topic, lists the scripting reference topics. With one, such as chartnaut docs series-outputs, prints that topic as markdown. These are the Scripting pages.

chartnaut mcp install [client]

Prints the setup that connects an AI tool to Chartnaut's MCP server, with your API address filled in. client is claude, cursor or codex; with none, it prints all three. It makes no network calls, and it never prints your saved key: the API-key variants read CHARTNAUT_TOKEN from the environment. See Connect Chartnaut to an AI app.

Client

Prints

claude

claude mcp add --transport http chartnaut <url> for the browser sign-in, and the same line with an Authorization header for an API key

cursor

The chartnaut entry for ~/.cursor/mcp.json, with and without a key header

codex

The [mcp_servers.chartnaut] table for ~/.codex/config.toml, reading the key from CHARTNAUT_TOKEN

Flag

What it does

--write

Applies the setup for one client. claude runs claude mcp add --scope user with the key the CLI is signed in with. cursor adds Chartnaut, with that key, to ~/.cursor/mcp.json and keeps every other server. codex adds or replaces the table in ~/.codex/config.toml and writes no key. It says what it wrote and where

chartnaut upgrade

Updates the CLI to the latest release. See Install.

Flag

What it does

--check

Only reports whether a newer version exists

Environment variables

Variable

What it does

CHARTNAUT_TOKEN

An API key to use instead of the saved login. It wins when both are set.

CHARTNAUT_NO_BROWSER

When set, login prints the link instead of opening a browser

CHARTNAUT_API_URL

The API address. Defaults to https://api.chartnaut.com/v1.

CHARTNAUT_APP_URL

The app address the CLI trusts when opening links. The CLI only opens https links on chartnaut.com or this host, and prints any other link instead of opening it.

chartnaut login saves your key in ~/.config/chartnaut/credentials.json, readable only by you.