longbridge/longbridge-terminal is a command-line and full-screen terminal interface for the Longbridge trading platform, providing market data, portfolio information, and trading operations. It is for traders, scripts, and AI agents that need to query quotes and accounts or submit and manage orders from a terminal. The catalogue instruction supports using the terminal in an AI-agent trading workflow.
Borrowing it
Nothing to install: this file belongs to longbridge/longbridge-terminal. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/longbridge/longbridge-terminal/main/CLAUDE.mdgit clone --depth 1 https://github.com/longbridge/longbridge-terminalWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/longbridge/longbridge-terminal/claude-md)<a href="https://agentmods.dev/instructions/longbridge/longbridge-terminal/claude-md"><img src="https://agentmods.dev/badge/instructions/longbridge/longbridge-terminal/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/longbridge/longbridge-terminal/claude-md"><img src="https://agentmods.dev/badge/instructions/longbridge/longbridge-terminal/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.03233 | $0.03233 |
| Opus 5.5 | $0.01293 | $0.01293 |
| Sonnet 5.5 | $0.00647 | $0.00647 |
| Haiku 4.5 | $0.00323 | $0.00323 |
Grade A, and why
longbridge-terminal CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 297 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A Rust-based CLI (longbridge) that wraps every Longbridge OpenAPI endpoint for scripting, AI-agent tool-calling, and daily trading workflows. Also ships a full-screen TUI for interactive market monitoring.
Core Architecture
Tech Stack
- UI Framework: Ratatui (v0.30) - TUI rendering
- Async Runtime: Tokio (v1.33+) - Async I/O
- ECS Framework: Bevy ECS (v0.11) - Entity-Component-System architecture
- Market SDK: longbridge - Longbridge OpenAPI Rust SDK, tracked as a git dependency on
longbridge/openapimain(dependency alias:longbridge-sdk)
Check Cargo.toml / Cargo.lock rather than this list before relying on a version.
- State Management: DashMap, Atomic, RwLock - Thread-safe global state
Key Modules
1. src/auth.rs - Auth utilities
clear_token()- Clear stored OAuth token (logout). Deletes token file used by the SDK.- OAuth and token refresh are handled by the longbridge SDK: use
longbridge::oauth::OAuthBuilderinopenapi::context::init_contexts(). Token is loaded from~/.longbridge/openapi/tokens/<client_id>or browser flow is started; the SDK auto-refreshes the token. - Local callback server: default port
60355(configurable viaOAuthBuilder::callback_port())
2. src/openapi/ - OpenAPI Integration Layer
context.rs- Global context managementinit_contexts()- Initialize QuoteContext and TradeContext with OAuth token, returns WebSocket receiverquote()- Get global QuoteContext (for quotes, subscriptions)quote_cmd()- Same, and fires the/v1/quote/cmdbeacon; use it at WS-backed CLI quote entry pointstrack_quote_cmd()- Fires the beacon alone; HTTP-backed CLI quote entry points call it directlytrade()- Get global TradeContext (for trading operations)- Uses
OnceLockfor global singleton
- One-shot CLI quote commands do not use the WS
QuoteContext: they go throughcli::quote_http::HttpQuoteApi, which POSTs the gateway's/quote/*HTTP shim and reshapes its proto-JSON into the SDK types. Commands without a shim (market temperature, security list, watchlist, subscriptions, …) call the WS context throughquote_cmd(). The TUI andlongbridge servekeep the WSQuoteContext.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 25d ago Changed · +8 lines · +162 tokens per session 8e94b492840c
- 2mo ago First seen · 289 lines · 3,071 tokens per session scan A 60b9211a7053
longbridge-terminal CLAUDE.md is an instructions file published in the GitHub repository longbridge/longbridge-terminal (1,037 stars, last pushed yesterday), licensed Apache-2.0. It adds 3,233 tokens to every session, about $0.0129 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
longbridge-terminal CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| longbridge-terminal CLAUDE.mdlongbridge/longbridge-terminal | Instructions file | 1.0k | yesterday | Apache-2.0 | A | 3,233 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | yesterday | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |