longbridge-terminal: Instructions file for Claude Code

CLAUDE.md

longbridge-terminal CLAUDE.md is an instructions file for Claude Code from longbridge/longbridge-terminal. It costs 3,233 tokens per session, scanned A, original, Apache-2.0.

Repository-specific instructions for Claude Code, stored in a file named CLAUDE.md. They describe a Rust command-line tool that wraps Longbridge’s stock-trading API and also provides a full-screen market-monitoring interface.

In plain words
What is it for?
Use them when developing or maintaining the Longbridge CLI, its trading API integrations, authentication, terminal interface, asynchronous operations, or related modules.
Why use it?
They give the coding agent context about the project’s architecture, authentication, state handling, and technology choices before it changes code.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is longbridge/longbridge-terminal's own configuration. It tells Claude Code how to work on longbridge-terminal itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything longbridge-terminal configures →

About the project

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.

longbridge/longbridge-terminal · 1,037 stars · on GitHub · open.longbridge.com

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/longbridge/longbridge-terminal/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/longbridge/longbridge-terminal

Made for: Claude Code.

Wrote 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.

agentmods badge for longbridge-terminal CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/longbridge/longbridge-terminal/claude-md/github.svg)](https://agentmods.dev/instructions/longbridge/longbridge-terminal/claude-md)
Your own site
<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.

agentmods 80×15 button for longbridge-terminal CLAUDE.md

Your own site · 80×15
<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>
Per session 3,233 This file is loaded in full into every session.
When invoked 3,233 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 25d ago against content hash 8e94b492840c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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.

CLAUDE.md · 297 lines

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/openapi main (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::OAuthBuilder in openapi::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 via OAuthBuilder::callback_port())
2. src/openapi/ - OpenAPI Integration Layer
  • context.rs - Global context management
    • init_contexts() - Initialize QuoteContext and TradeContext with OAuth token, returns WebSocket receiver
    • quote() - Get global QuoteContext (for quotes, subscriptions)
    • quote_cmd() - Same, and fires the /v1/quote/cmd beacon; use it at WS-backed CLI quote entry points
    • track_quote_cmd() - Fires the beacon alone; HTTP-backed CLI quote entry points call it directly
    • trade() - Get global TradeContext (for trading operations)
    • Uses OnceLock for global singleton
  • One-shot CLI quote commands do not use the WS QuoteContext: they go through cli::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 through quote_cmd(). The TUI and longbridge serve keep the WS QuoteContext.

Read the full file on GitHub · 297 lines

Changes

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.

  1. 25d ago Changed · +8 lines · +162 tokens per session 8e94b492840c
  2. 2mo ago First seen · 289 lines · 3,071 tokens per session scan A 60b9211a7053

Subscribe to this mod's changes

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.

Related

longbridge-terminal CLAUDE.md compared with instructions from other repositories

longbridge-terminal CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
longbridge-terminal CLAUDE.mdlongbridge/longbridge-terminalInstructions file1.0kyesterdayApache-2.0A3,233Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode