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.
curl -O https://raw.githubusercontent.com/longsizhuo/openInvest/main/CLAUDE.mdgit clone --depth 1 https://github.com/longsizhuo/openInvestWrote 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/longsizhuo/openinvest/claude-md)<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.
<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>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.04065 | $0.04065 |
| Opus 5 | $0.02032 | $0.02032 |
| Sonnet 5 | $0.00813 | $0.00813 |
| Haiku 4.5 | $0.00407 | $0.00407 |
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 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 有三个调用层,每层服务不同对象:
| 层 | 服务对象 | 目的 |
|---|---|---|
| 前端不再由后端 serve;重做时走独立前端直连 MCP | ||
CLI / Skill(scripts/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 后退役 |
关键原则
- Agent 必须拥有全部功能——CLI 不能"只能读不能写"。任何用户能用 GUI 做的事,agent 都能用 CLI 做。
- GUI 只是面对用户的展示层——不是必需。fork 用户可以完全不部署 GUI,只用 CLI 走 agent 路径。
- 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 决定:
- 公开 URL(
docs/accuracy_summary.json/ pnl-data 分支 / outperform feed)绝对不能含 symbol / threshold / verdict 原文 / 任何可反推持仓的字段 - 命中率统计页 n < 30 不展示具体数字(防小样本被截图误传)
- README outperform 同时展示 winning + losing 事件(不只 winning,避免 survivorship bias)
- 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。
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.
- 10d ago First seen · 167 lines · 4,065 tokens per session scan A e7c6a07017c7
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.
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.
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.
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).
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.
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).
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.