longbridge-terminal CLAUDE.md

longbridge-terminal CLAUDE.md is an instructions file for Claude Code from longbridge/longbridge-terminal. It costs 3,071 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.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/longbridge/longbridge-terminal/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.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.svg" alt="Measured on agentmods" height="20"></a>
Per session 3,071 This file is loaded in full into every session.
When invoked 3,071 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
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.03071 $0.03071
Opus 5 $0.01536 $0.01536
Sonnet 5 $0.00614 $0.00614
Haiku 4.5 $0.00307 $0.00307

Measured 6d ago against content hash 60b9211a7053, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 6d 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 · 289 lines

How it starts

The opening of the file, as written. The whole thing — 289 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)
    • trade() - Get global TradeContext (for trading operations)
    • Uses OnceLock for global singleton
3. src/data/ - Data Layer
  • types.rs - Base type definitions
    • Counter - Stock identifier (format: 700.HK, AAPL.US)
    • TradeStatus, Currency, Market - Enum types
    • QuoteData, Candlestick, Depth - Market data structures
  • stock.rs - Stock data structure
    • update_from_quote() - Update from longbridge quote
    • update_from_depth() - Update from longbridge depth
  • stocks.rs - Global stock cache (based on DashMap)
    • STOCKS - Global singleton, provides get(), mget(), insert(), modify() methods

Read the full file on GitHub · 289 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. 6d 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 (994 stars, last pushed 2d ago), licensed Apache-2.0. It adds 3,071 tokens to every session, about $0.0154 per session on Opus 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

Other instructions, from other repositories

maverick-mcp AGENTS.md

AGENTS.md instructions for wshobson/maverick-mcp, covering repository guidelines, project overview, project structure, documentation map and build, test, and development commands.

wshobson/maverick-mcp · 1,422 tokens

InvestSkill copilot-instructions.md

Copilot instructions for yennanliu/InvestSkill, covering investskill — github copilot setup & usage guide, installation & setup, automatic setup, verify setup and core stock analysis (6 frameworks).

yennanliu/InvestSkill · 3,183 tokens

InvestSkill GEMINI.md

Gemini CLI instructions for yennanliu/InvestSkill, covering investskill — gemini cli setup & usage guide, installation & setup, quick start, navigate to the investskill directory and start gemini cli (loads gemini.md automatically).

yennanliu/InvestSkill · 3,074 tokens

unifly AGENTS.md

Instructions for hyperb1iss/unifly, covering agents.md, what this repository is, quick command reference, the canonical "before commit" gate and individual gates.

hyperb1iss/unifly · 9,275 tokens

dartlab CLAUDE.md

Claude Code instructions for eddmpython/dartlab, covering dartlab 에이전트 진입 규칙, 정본 소유권, 시작 순서, 작업별 문서 지도 and 공통 안전 경계.

eddmpython/dartlab · 1,186 tokens

korean-dart-mcp CLAUDE.md

Claude Code instructions for chrisryugj/korean-dart-mcp, covering korean-dart-mcp 프로젝트 가이드, 구조, 설계 원칙, 1. corpcode 자동 해결 and 2. enum 으로 도구 폭발 방지.

chrisryugj/korean-dart-mcp · 823 tokens