Skip to content
TickLogits

AI agents & the Ultra API

Connect Claude Code, Codex, Devin or any coding agent to PineTune through the loopback Ultra bridge.

The Developer plan lets a local coding agent operate PineTune: inspect the strategy, edit its Pine source, launch runs, wait for them and apply the best candidate.

Architecture

A Chrome MV3 extension cannot listen on a TCP port. PineTune therefore connects as a WebSocket client to a small, dependency-free Node bridge bound to 127.0.0.1. Your agent calls the bridge over HTTP.

Endpoint Purpose
POST /api Send an action ({ "action": "...", ... })
GET /health Bridge and extension connection status
GET /connect Wake page: nudges the extension to (re)connect
GET /events Live state stream (SSE, or WebSocket upgrade)

Default port: 5678. All responses are { "ok": true, "data": ... } or { "ok": false, "error": "..." }.

Setup

  1. Activate a Developer licence in the popup.
  2. Settings → Ultra Agent API: enable it and set the port (default 5678).
  3. Open a TradingView chart with your strategy and the Strategy Tester.
  4. Run the CLI client. If nothing is listening on the port it starts the bridge for you and pins the first extension that connects.
curl http://127.0.0.1:5678/health
node tools/ultra-client.js status
node tools/ultra-client.js listTabs

If /health reports connected: false, open http://127.0.0.1:5678/connect in the browser that has PineTune installed.

The research loop

  1. Inspect: snapshot --inputs --pine returns strategy, inputs, editable Pine source, metrics and recent results.
  2. Edit code (optional): updatePineSource validates, replaces the full source, saves, updates the chart and verifies the result.
  3. Configure: setConfig with inputs, ranges, mode, objective and filters (partial updates are merged).
  4. Run: call --method start, then waitDone blocks until the run reaches a terminal state.
  5. Analyse: getResults / getHistory.
  6. Apply: applyBest or applyResult, which wait for the tester to settle.

“Best” means best among the combinations tested under your objective and filters, not a global optimum.

Agent Skill

PineTune ships a SKILL.md that teaches skill-aware agents the full loop, the API reference and common pitfalls. Point your agent at it, then describe the goal in plain language.

Security

  • The bridge only binds to the loopback interface. Never expose it to a LAN or the internet.
  • API responses never include your full licence key or third-party API keys.
  • Don’t put secrets in request files passed with --file.
  • Read-only or protected scripts are never edited around their restrictions.