Documentation

QuantCraft AI

QuantCraft includes a built-in AI assistant in the right sidebar of the IDE (Workspace layout) — a chat panel that helps you write and edit trading-strategy Python with awareness of your workspace. It can see the file open in the editor, any files you @-mention, and outlines of your other open files, so its answers and edits are in context. It works like an in-IDE coding agent: it can create new files or edit existing ones for you in one chat turn.

To use it, open the right sidebar and switch to the QuantCraft AI tab. The model you connect is app-wide — the same connection powers this chat, the AI Prompt nodes and the AI Builder in Agents, and AI Test / Optimization agents. Use the Python editor and Running code to validate any suggested strategy changes in Test / Run.

There is also a Documentation panel in the same sidebar — a static reference for the strategy API (lifecycle, OHLCV, indicators, fundamentals, factors, inputs, account), plus Agent Scripts and Screener Script pages. See Reference.


Assistant modes

ModeWhat it does
ChatAdvice and explanations only — no file edits.
PlanProduces a structured implementation plan — no edits.
AgentCreates and edits workspace files. Proposed edits go through an Accept / Undo review and changed lines are highlighted in the editor. Auto-continue agent turns (on by default) keeps the assistant going after each file-changing reply until it finishes or you press Stop.

You can switch the mode and Auto-continue in the composer, or under Assistant mode in the API Providers dialog.


Connecting a model

QuantCraft AI works with several providers. Some are bring-your-own-key (billed to your own provider account); QuantCraft Premium and the hosted options run on managed access instead. Open AI → API Providers in the top menu (the dialog is titled AI API Providers; the chat's connect link opens it too), pick a provider, then fill its fields.

ProviderWhat you set
Anthropic (Claude)API key, Claude model, optional "Extended thinking". The most fully supported path. Get a key from console.anthropic.com.
QuantCraft PremiumNo key — access is assigned to your account; shows provider, status, balance, and expiry (Claude or DeepSeek grant). Listed only when you have a grant.
DeepSeekAPI key, DeepSeek model, optional "Extended thinking".
DeepSeek (hosted)No key stored (uses the server's key), optional "Extended thinking". Listed only when you're signed in and the server offers it.
OpenCodeAPI key, OpenCode plan (Zen or Go), OpenCode model, and an optional Custom model id for a model not in the list. Claude, Qwen and Chat-Completions-style models work; GPT, Grok, Muse and Gemini models don't.
Custom LLMEndpoint URL, Model name, and an optional API key (bearer token).

GitHub Copilot and Cursor may appear in the list, but chat turns are not wired yet (UI stubs) — and the Agents AI features reject them too. Use Anthropic, DeepSeek (BYOK or hosted), OpenCode, QuantCraft Premium, or Custom LLM.

Paste the key (where required), choose the model, and click Save.

Custom LLM

Use Custom LLM to connect your own or a self-hosted, OpenAI-compatible model.

FieldNotes
Endpoint URLThe OpenAI-compatible base URL — e.g. Ollama, llama.cpp, or vLLM (http://localhost:11434/v1).
Model nameThe model id served by that endpoint (e.g. qwen2.5-coder:7b-instruct).
API keyOptional bearer token — leave blank for a local server that needs none.

The connection counts as ready once the URL is set. In the desktop app, HTTP to providers goes through Tauri’s HTTP plugin; localhost / 127.0.0.1 endpoints are in scope. Arbitrary remote Custom LLM hosts are not user-configurable via an allow-list UI — prefer a local OpenAI-compatible server or a provider already supported above.

Where keys live: bring-your-own-key values are stored only on your machine (in the operating system's keychain in the desktop app, or this browser's local storage). They are never uploaded to QuantCraft and are only sent to the provider you selected. If you wipe your browser data or move to another computer, you will need to re-enter the key.

Where requests go: for a bring-your-own-key provider, QuantCraft AI calls the provider directly from your machine using your key. The desktop (Tauri) app uses an HTTP bridge so requests aren't blocked by browser CORS — running QuantCraft AI in the browser version may show a CORS-related "Request failed" message; use the desktop build for the best experience.

Picking a model

Each provider has a model dropdown next to the key field. The connection badge at the bottom of the chat shows the active provider and short model name (for example Anthropic (Claude) · Claude Sonnet 4.6). Multiple providers can be saved — the badge shows the most recently used one with a +N suffix when more than one key is present.

For Anthropic, the dropdown lists Claude Sonnet 4.6, Claude Opus 4.8, Claude Opus 4.7, Claude Haiku 4.5, and other current Opus / Sonnet variants. Choose the one your account has access to. If you try to send a message on the Anthropic path without a saved key, the assistant replies with a reminder to add one.


Using the chat

  • Type in the composer and press Enter to send, Shift+Enter for a newline.
  • Type @ to open a file-mention menu and pull another workspace file into context.
  • Replies render as markdown with code blocks.
  • Stop aborts an in-progress reply.

Composer and attachments

  • Attach files button — opens a file picker. You can also drag and drop files onto the input area, or paste a file/image from the clipboard.
  • A row of attachment chips above the textarea shows every file you've queued. Each chip has its name (and a thumbnail for images) and an × to remove it.
  • Any file type is accepted. Image files show a small inline thumbnail in the message stream after sending.
  • Attachments belong to the message you send them with — they're shown alongside that message in the chat history.
  • In the IDE chat, attachments are shown but their contents are not sent to the model. To share a workspace file's contents, @-mention it instead.

While the assistant is generating a reply, the composer is disabled with a "Please wait…" placeholder and a small status row appears in the message list (e.g. Building API messages…, Streaming reply… 1,234 characters, Syncing to workspace folder on disk…).


Chat sessions

QuantCraft AI keeps a history of chat sessions. Each session is its own conversation, with its own messages and attachments. The bar at the top of the chat panel has:

  • New chat — starts a fresh, empty session. Disabled while the assistant is working, while you have a pending file edit, or if your current chat is already empty.
  • Chats — a dropdown listing every saved session, newest first. Each entry shows its title (auto-derived from the first user message) and the last update time. Click a row to switch, or press the trash icon to delete it.

Sessions are persisted automatically (in the desktop app to its local config, otherwise to browser local storage) and survive reloads and restarts. Switching chats and creating new ones is blocked while a reply is streaming or while you have an unresolved Accept/Undo bar — finish or undo the change first.


What the assistant can see

Each time you send a message, QuantCraft AI builds the request from:

  1. The bundled QuantCraft developer docs (so it knows the lifecycle, account API, OHLCV / fundamentals modules, indicator series, and so on).
  2. A fresh workspace snapshot — the linked workspace folder path, the file currently open in the editor, and the list of open tabs and folders.
  3. The prior turns of the active chat session (your messages and its replies).
  4. Your new message plus any attachments.

This is why picking a workspace folder in the Files sidebar matters — without one, the assistant can still answer questions, but it cannot write files to disk and will tell you so.


File edits from the assistant

In Agent mode the assistant can return one or more file actions in a single reply: create a new file, edit the file currently in the editor, or edit a specific named file in the workspace. When that happens:

  • New files appear as a new tab in the linked folder; existing files are updated in place in their tab.
  • The editor jumps to the changed location and highlights the changed lines so you can review what the assistant did.
  • A pending bar appears at the bottom of the chat with a short summary, plus two buttons:
    • Accept — keep the change. The highlight is removed and you can carry on chatting.
    • Undo — revert the change. For an edit, the previous file content is restored. For a new file, the new tab is removed.
  • Until you Accept or Undo, the chat is frozen — you can't switch sessions or send another message. This is intentional: it makes sure you actively review every change.
  • For multi-file replies, the bar tells you how many changes were applied. The Undo button reverts only the last step, so review highlights tab-by-tab if needed.

Multi-file strategies

In Agent mode the assistant can split a strategy into helper modules in folders (indicators/, risk/, …) and import them back into the root algo file. It keeps the lifecycle functions (on_init, on_bar, …) in the root file and uses absolute imports from the workspace root, e.g. from indicators.momentum import calc_rsi, with no __init__.py files.

  • The assistant sees the files the active file imports, and the files that import it, in full. It sees only outlines of your other files — to have it edit one of those, @-mention it.
  • Each reply's file changes are checked before any of them apply. If one step can't run safely (for example it would create a file that already exists, or rewrite a file it only saw in outline), none of the steps are applied and the reply says why.
  • After changes apply, workspace imports that would fail at run time (for example a helper renamed without updating the files that import it) are listed under the reply. The agent fixes them on its next turn.

Syncing to disk

Files are also synced to the linked workspace folder on disk (in the desktop app). When you're running the browser version, files are still updated in the editor and tabs, but they are not mirrored to disk — the reply notes this so you know to use the desktop build for full file integration.


Built-in QuantCraft Tools

A first-party set of read-only market tools — OHLCV, indicators, fundamentals, screener, account and positions — is on by default and callable straight from chat (and from Agent AI Prompt nodes). Manage it under AI → MCPs (the QuantCraft Tools (built-in) row at the top). See QuantCraft Tools.


Screener tools

When the AI Screener feature is enabled, the chat can also drive the Screener for you: open a Screener window, build or load a screen, run it and read the results. The window shows "The AI is using this window" and locks its controls while the AI works. In Chat and Plan modes the AI only gets the read-only subset (it can look at screens and results but not change them); Agent mode gets the full set. See Screener.


Tools

Tools are external data services the chat model can call while answering. Add them from AI → AI Tools.

  • The available tool is LLMQuant Data — enable it with the Enable for chat checkbox and paste an API key (there's a "Get a key" link).
  • Once enabled, the assistant can fetch live data mid-conversation across categories such as wiki and research papers, equity and crypto prices, ETF lookups and holdings, macro indicators, SEC filings and 13F holdings, and prediction-market data.

Tools attach only on working chat providers (Anthropic, DeepSeek, OpenCode, Premium, Custom LLM). Copilot / Cursor are not implemented for chat, so tools never run on those selections.


MCP servers

MCP (Model Context Protocol) servers expose their own tools to the assistant. Add and manage them from AI → MCPs. The list starts with the built-in QuantCraft Tools (built-in) row; each saved server has an Enabled for chat toggle plus Edit / Remove, and tools from enabled servers become available to the chat.

To add one, click Add server and choose a Transport:

TransportFields
Stdio (command)Command (e.g. npx, node, python), Args (one per line or space-separated), and Env (KEY=VALUE lines).
HTTP (Streamable)URL and optional Headers (KEY=VALUE lines, e.g. Authorization=Bearer …).

Give the server a Name, use Test connection to check it (it reports how many tools the server exposes), then Apply to add it to the list and Save to persist.


AI Prompt nodes in Agents

Inside an Agent you can add an AI Prompt node — the AI counterpart of a Strategy node.

  • You write a single free-text prompt asking a yes/no question, e.g. "Given the recent price action and fundamentals, is this a bullish setup?" There are no structured rules.
  • A Data sent to the AI section shows chips for the upstream data the model receives (OHLCV window, fundamentals, etc.). Link a Data parent, or the node warns that the AI has no inputs.
  • The AI's answer is forced to true / false, and that result gates the node's children through the upstream gate — exactly like a Strategy result.
  • The model can also call read-only QuantCraft Tools (OHLCV, indicators, fundamentals, screener, account, positions) scoped to the run.

Which model runs it depends on your active connection:

  • QuantCraft Premium — the call runs on the backend using your assigned access. Only a Claude grant works here; a DeepSeek grant stops the run with "not supported for AI Prompt nodes yet".
  • Bring-your-own-key (Anthropic, OpenCode, or Custom LLM) — the call runs from the app using your own key, which is never sent to the backend.

DeepSeek — your own key or hosted — does not work for AI Prompt nodes yet.

Token usage from Agent Test AI Prompt nodes and the AI Builder is tracked per agent and shown as a badge in the editor header: Tokens · This month: … · Lifetime: … (the monthly figure resets each calendar month).


Tips

  • Link a workspace folder first. In the Files sidebar, choose your project folder. Without one, the assistant can answer questions but cannot create or edit files on disk.
  • Be explicit about file paths. When asking for an edit, mention the tab title or a path like utils/foo.py. The assistant matches both.
  • Use Undo freely. It's safer to let the assistant try a multi-file change and undo than to micro-manage each step — undo restores the editor buffer instantly.
  • Switch models per task. Use a faster Claude model for routine edits, a stronger one (Opus) for big refactors or strategy design.
  • Keep keys safe. Bring-your-own-key values live only on this machine. Treat them like passwords — don't paste them anywhere outside the AI API Providers dialog.