openInvest: Instructions file for Claude Code

CLAUDE.md

openInvest CLAUDE.md is an instructions file for Claude Code from longsizhuo/openInvest. It costs 4,065 tokens per session, scanned A, original, MIT.

A set of project instructions for openInvest, an investment tool designed to be operated by AI agents through command-line tools and skills. It explains the product’s layers, rules for code changes and testing requirements.

In plain words
What is it for?
Use it when adding agent commands, portfolio operations, API changes, investment reports or automated tests.
Why use it?
It keeps new features available to agents and preserves consistent, safe handling of portfolio data and financial workflows.

Instructions file for Claude Code

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

This is longsizhuo/openInvest's own configuration. It tells Claude Code how to work on openInvest 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 openInvest configures →

Reuse

Borrowing it

Nothing to install: this file belongs to longsizhuo/openInvest. 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/longsizhuo/openInvest/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/longsizhuo/openInvest

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 openInvest CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/longsizhuo/openinvest/claude-md/github.svg)](https://agentmods.dev/instructions/longsizhuo/openinvest/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/longsizhuo/openinvest/claude-md"><img src="https://agentmods.dev/badge/instructions/longsizhuo/openinvest/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 openInvest CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/longsizhuo/openinvest/claude-md"><img src="https://agentmods.dev/badge/instructions/longsizhuo/openinvest/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,065 This file is loaded in full into every session.
When invoked 4,065 The same file — it is already loaded in full.
Security scan A 1 finding. 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.04065 $0.04065
Opus 5 $0.02032 $0.02032
Sonnet 5 $0.00813 $0.00813
Haiku 4.5 $0.00407 $0.00407

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

Security

Grade A, and why

openInvest CLAUDE.md scanned grade A with 1 finding 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 10d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- CLI 子命令缺写操作时,**优先补 CLI 子命令**而不是只让 agent 调 web API curl
CLAUDE.md · 167 lines

How it starts

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

CLAUDE.md — openInvest 项目级指引

这份文件给 Claude(或任何 AI agent)改代码时看。核心产品哲学先看完,再动手

核心产品哲学

openInvest 有三个调用层,每层服务不同对象:

服务对象 目的
GUI(已退役 2026-07-05,等重做) 小白用户 前端不再由后端 serve;重做时走独立前端直连 MCP
CLI / Skillscripts/skill.py + skills/invest/scripts/run.sh AI agent(Claude / Codex / Hermes / OpenClaw / Gemini / Cursor / Cline / 任意脚本) Agent 跑全链路:查询 + 记账 + 改持仓 + 触发委员会
Web API(deprecated) remote hub 模式 存量端点服务 INVEST_API_BASE 转发与内部触发;不再新增端点,待 MCP 覆盖 remote 后退役

关键原则

  1. Agent 必须拥有全部功能——CLI 不能"只能读不能写"。任何用户能用 GUI 做的事,agent 都能用 CLI 做。
  2. GUI 只是面对用户的展示层——不是必需。fork 用户可以完全不部署 GUI,只用 CLI 走 agent 路径。
  3. CLI / GUI 都共用 Web API 底层——所有写操作走 with_portfolio_tx(fcntl 锁 + atomic write)保证一致性。

写代码时

  • 加新功能,问自己:agent 怎么调? 如果只是给 GUI 加按钮,没补 CLI 子命令 / Web API 端点,你做错了——agent 用不上
  • CLI 子命令缺写操作时,优先补 CLI 子命令而不是只让 agent 调 web API curl
  • 不要在 SKILL.md 写"CLI 只读 / 写操作走 web API"——这是反产品哲学的措辞

测试纪律

  • CI 自动跑.github/workflows/ci.yml)—— pytest 全套 + smoke import + 脱敏字段 grep
  • 不要靠 dev 自己想起来跑 pytest——commit 前 CI 会跑,红就别合
  • 加新模块要在 ci.yml 的 smoke import 步骤同步加 import 检查

公开数据红线

按金融视角 review 决定:

  1. 公开 URL(docs/accuracy_summary.json / pnl-data 分支 / outperform feed)绝对不能含 symbol / threshold / verdict 原文 / 任何可反推持仓的字段
  2. 命中率统计页 n < 30 不展示具体数字(防小样本被截图误传)
  3. README outperform 同时展示 winning + losing 事件(不只 winning,避免 survivorship bias)
  4. PATCH executed 必须同步 cash + holdings(账本一致性)。且必须幂等——任何"累加语义 + 可重放触发"的账本写入(HTTP 重试 / 邮件轮询 / cron 重跑 / agent 重发 / 双击)必须有原子幂等闸(state_claim)或状态机守卫,绝不重复入账。规则 + 全路径审计表见 docs/wiki/adr/016-ledger-mutation-idempotency.md。已咬两次(#62 邮件、本轮 PATCH/payday)——加新账本写路径先对照该 ADR。

双路径架构(Coordinator vs Direct)

  • Coordinator 路径:Claude Code 用 prepare_committee + spawn 4 subagent。不需要 DEEPSEEK_API_KEY
  • Direct 路径:任意 agent(Gemini / Cursor / 普通脚本)用 run_committee SYM 一键 = 后端 DeepSeek 跑 4 角色辩论。需要 DEEPSEEK_API_KEY

详见 docs/wiki/04-execution-paths.md + skills/invest/references/two-paths.md

Read the full file on GitHub · 167 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. 10d ago First seen · 167 lines · 4,065 tokens per session scan A e7c6a07017c7

Subscribe to this mod's changes

openInvest CLAUDE.md is an instructions file published in the GitHub repository longsizhuo/openInvest (83 stars, last pushed yesterday), licensed MIT. It adds 4,065 tokens to every session, about $0.0203 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens