openapi CLAUDE.md

A set of project instructions for keeping the Longbridge OpenAPI software library consistent across Rust, C, C++, Java, Node.js, and Python. It explains which files to update and which checks to run after changes.

In plain words
What is it for?
Use it when adding or changing API endpoints, data types, enums, or fields, and when modifying Rust or one of the supported language libraries.
Why use it?
Changes to one language layer can leave the others out of sync. These instructions provide a checklist for updating related layers and generated files correctly.

Instructions file

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/openapi/claude-md
Clone the repo
git clone --depth 1 https://github.com/longbridge/openapi
Per session 1,265 This file is loaded in full into every session.
When invoked 1,265 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 $0.01265 $0.01265
Opus 5 $0.00633 $0.00633
Sonnet 5 $0.00253 $0.00253
Haiku 4.5 $0.00127 $0.00127

Measured 2d ago against content hash b5b3d39a2e35, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

openapi 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 2d 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 · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent Guidelines

SDK layers — update ALL of them when adding/changing an API or type

This repo ships the SDK in six language layers. The Rust core is the source of truth; every other layer is a hand-written binding that mirrors it. When you add a new API endpoint, type, enum, or field, you must propagate the change to every layer below — it is easy to forget the C++ and Java layers, so treat this list as a checklist:

  1. Rust core (rust/src/) — the source of truth.
  2. C (c/src/) — FFI structs (*Owned + ToFFI), enums, extern "C" fns. Header c/csrc/include/longbridge.h is auto-generated by cbindgen.
  3. C++ (cpp/) — wraps the C layer. Update cpp/include/*.hpp (public types/methods), cpp/src/convert.hpp (C↔C++ conversions), and cpp/src/*_context.cpp.
  4. Java (java/) — JNI. Update the Rust JNI layer (java/src/*.rs) and the Java classes (java/javasrc/src/main/java/com/longbridge/).
  5. Node.js (nodejs/src/) — napi. index.d.ts / index.js are auto-generated by npm run build:debug.
  6. Python (python/src/) — PyO3. Keep the hand-maintained stub python/pysrc/longbridge/openapi.pyi in sync.

After modifying Rust code

Run the following commands from the workspace root:

cargo clippy --all --all-features
cargo +nightly fmt --all

Note: cargo +nightly fmt may reflow doc comments (e.g. /// @param … lines). Do not revert those changes — they are intentional formatting output and should be committed as-is.

After modifying the Node.js SDK (nodejs/)

Build the native .node binary from the nodejs/ directory:

npm run build:debug

nodejs/index.d.ts and nodejs/index.js are auto-generated by npm run build:debug — never edit them by hand.

After updating the proto submodule (rust/crates/proto/openapi-protobufs/)

Run the following command from the workspace root to regenerate the Rust proto source files (e.g. rust/crates/proto/src/longbridge.control.v1.rs, rust/crates/proto/src/longbridge.quote.v1.rs, rust/crates/proto/src/longbridge.trade.v1.rs):

Read the full file on GitHub · 119 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. 2d ago First seen · 119 lines · 1,265 tokens per session scan A b5b3d39a2e35

Subscribe to this mod's changes

openapi CLAUDE.md is an instructions file published in the GitHub repository longbridge/openapi (450 stars, last pushed 4d ago), licensed Apache-2.0. It adds 1,265 tokens to every session, about $0.0063 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.