openInvest

io.github.longsizhuo由 GitHub 帳號 longsizhuo 發布v0.68.6更新於 Nov 8, 2026

Investment runtime for AI agents — LLM investment committee, portfolio ledger, decision accounting

概覽

AI 產生的概覽

自架式投資決策引擎,為助理提供多代理投資委員會、持倉帳本與可稽核的決策紀錄。

可以做什麼
  • 執行多代理投資委員會:宏觀策略師、量化分析師、風控主管與 CIO 共同產出附信心度的買進/加碼/持有/減碼/賣出結論
  • 以帶 YAML frontmatter 的 Markdown 檔案保存持倉帳本與決策紀錄,並依自身歷史繪出總權益曲線
  • 執行具前視偏差防護的長期回測,並與基準投資組合比較
  • 每晚依實際市場結果對過往決策進行記憶整併
  • 透過 CLI 指令與支援 Claude Code、Codex、Hermes、OpenClaw 的代理技能提供相同能力
適用情境
適合希望助理對自身持倉進行結構化、可稽核的投資檢視,並記錄每項決策理由,而非聊天式報明牌的使用者。也適合願意自架、把推理紀錄與回測留在本機,並清楚它僅是決策輔助工具、不會執行下單的人。
執行需求
以 Python 套件形式透過 uvx(openinvest-mcp)在本機執行,資料目錄由 INVEST_HOME 指定(預設 ~/openInvest)。未宣告驗證機制。README 指出技能模式使用宿主代理自身的推理、不消耗第三方 API Key,但自動化排程需要 LLM API Key(預設 DeepSeek,相容任何 OpenAI 介面)以及寄送日報郵件所需的信箱密鑰。
安裝前請注意
涉及私人財務資料:持倉、結論與帳本會寫入 INVEST_HOME 目錄,README 警告無伺服器方案若使用公開的 GitHub fork 會外洩這些資訊,務必設為私有。自動化執行需要 LLM_API_KEY、EMAIL_SENDER、EMAIL_PASSWORD、DIGEST_EMAIL_TO 等密鑰。它僅提供決策輔助而非投資建議,不會送出委託單;其自身稽核顯示方向性判斷命中率低於隨機。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 openInvest,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[owl-02-lineart-gold]

openInvest

A self-hosted investment decision engine built for modern AI agents. Multi-agent information isolation and cross-challenge protocol, providing an auditable decision trail (Audit Trail).

[Python] [Agents] [License] [Stars] [Glama MCP server]

📚 Full Architecture Wiki · 🇨🇳 中文版


What is OpenInvest?

OpenInvest is a self-hosted investment decision engine built for modern AI agents.

It provides a verifiable investment committee, evidence-based reasoning, long-horizon backtesting, and auditable decision records. Instead of replacing Claude Code, Codex, Hermes, or OpenClaw, OpenInvest is designed to power them.


Live Performance & PnL

[PnL chart] Data feed is automatically updated every 2 hours using `jobs/pnl_snapshot` and pushed to the pnl-data branch
Upper half: 30-day total-equity curve (whole account, time-weighted so deposits/withdrawals don't count as returns, rebased to 100 at the window start) · Lower half: same-window return against 8 benchmark assets (transparent disclosure, not an alpha claim—the committee's proven value is discipline and transparency, not excess return, see ADR-023)
📌 Note: The current chart shows the author's live production portfolio. After self-hosting, the same job draws your own total-equity curve from your own ledger (`memory/portfolio_history.jsonl`) — any holdings, no fixed assets, no symbols or quantities in the public SVG. It appears once the ledger spans 2 trading days.
  • Benchmark Portfolio: The system introduces 8 standard control benchmarks across 4 quadrants (AI advisors / Mutual funds / Wealth management / Broad market index). For details on the comparison methodology and data cleaning logic, see docs/wiki/README.md.

Research & Falsification

System Self-Disclosure: This system is an auditing tool to eliminate human investment cognitive biases and enforce reasoning transparency, not a return-amplifying black box. Latest automated audit (docs/verdict_accuracy.md): Directional verdicts (excluding HOLD) have a true hit rate of 42.2% (n=56, below random); HOLD accounts for 56% of all decisions. The system's value lies in transparency and discipline (mostly staying inactive, low turnover), not directional prediction. Detailed log stream can be found in docs/verdict_accuracy.md.

This project systematically attempts to falsify its own edge and publishes negative results as-is. The deterministic features the committee reads, and the timing signals around them, were tested against pre-registered statistical gates — none survived as tradable alpha.

TestResultVerdict
Q1 cross-sectional stock picking6 features, mean-IC 0.025–0.067, Holm-corrected p=0.397No significant stock-picking signal
M1 multivariate GBM (out-of-sample)mean OOS IC +0.003, p=0.925Feature combination doesn't help either — no signal
Q2 gold MA200 trendp_holm=0.016, significant — but trend_dca shows it is beta, not tradable alpha: timing terminal value 3.07 vs 15.10 buy-and-hold, Sharpe +0.36 vs +0.68, max drawdown deeper (−57% vs −44%)Statistically significant, economically untradable
Per-asset multi-signal families3 assets × 4 signal families × parameter grid = 24 variants per asset; after costs + DSR deflation, none passes DSR > 0.95No tradable signal in any family
Positive controlA cheating perfect-foresight timing signal scores DSR = 1.00The harness can detect a real signal

Methodology: Newey-West HAC t-statistics, Deflated Sharpe Ratio (Bailey & López de Prado 2014, re-derived equation by equation), Holm correction, zero lookahead, and LLM training-cutoff probes.

Details: experiments/signal-eval/README.md · docs/verdict_accuracy.md · ADR-022 · ADR-023


Product Philosophy

Most AI investment assistants try to become better chatbots. OpenInvest instead builds a transparent, verifiable, and auditable decision engine that plugs into personal agents such as Claude Code, Codex, Hermes, and OpenClaw — every improvement in those agents automatically makes OpenInvest more capable.

The division of labor is deliberate: your agent handles long-term memory, natural conversation, and user understanding; OpenInvest handles the verifiable investment committee, evidence-based reasoning, long-horizon backtesting, and auditable decision records.

                   User                     │         ┌───────────┴───────────┐         ▼                       ▼    Your Agent             OpenInvest(User Understanding)   (Market Understanding)         │                       │         └───────────┬───────────┘                     ▼            Better Investment Decisions

Your agent knows you. OpenInvest knows investing.

Avoiding User Ownership

OpenInvest intentionally avoids "owning" the user. Most AI products try to own everything—memory, persona, chat history, and workspaces. OpenInvest takes a back seat. It exposes clean APIs, CLI commands, and agent skills (Claude Code / Codex / Hermes / OpenClaw), letting your primary agent manage the conversation and context while OpenInvest powers the underlying investment intelligence.


Features

  • Multi-Agent Investment Committee: Isolated analysis and round-rebuttal debate.
  • Coordinator-Worker Architecture: Prevents context contamination and role hallucination.
  • Information Isolation: Rigidly blocks quant and risk analysts from out-of-boundary contexts.
  • Auditable Decision Trail: Clean logs showing exactly "why" each decision was made.
  • Markdown-as-a-Database: Frontmatter (YAML) + Markdown (Body) as the single source of truth.
  • Long-Horizon Backtesting: Built-in test harness with lookahead bias protections.
  • Dreaming-Based Memory Consolidation: Nightly memory distillation to prevent context drift.
  • Self-Hosted / Zero-Cost: Powered directly by your local agent's reasoning resources.
  • Agent Skill: Lightweight plugin for Claude Code / Codex / Hermes / OpenClaw, with interactive bootstrap wizard.
  • Automated Deployment: GitHub Actions workflow to run the committee and email reports daily.

Quick Start

1. Integrate with your agent (Recommended)

Add the lightweight skill from your agent's plugin registry. The host agent will automatically pull the core code and align dependencies on first run:

bash
# Claude Code/plugin marketplace add longsizhuo/openInvest/plugin install invest@openinvest
# Codexcodex plugin marketplace add longsizhuo/openInvestcodex plugin add invest@openinvest
# Hermes Agent (official plugin catalog)hermes plugins install openinvest --enable# older Hermes without the catalog: hermes plugins install longsizhuo/openInvest/plugin --enable
# OpenClawopenclaw plugins install clawhub:openinvest

Any other MCP client: register the MCP server from step 2 below (full walkthrough in the agent tutorial).

2. Standalone — MCP server or CLI (no clone needed)

The backend ships on PyPI; ~/openInvest holds only your data:

bash
# MCP (any MCP client; add --http for a remote streamable-HTTP server — BETA)claude mcp add openinvest -e INVEST_HOME=~/openInvest -- uvx openinvest-mcp
# or plain CLIINVEST_HOME=~/openInvest uvx openinvest status

Send set up invest (or 帮我初始化 invest) to any skill-enabled AI terminal. The system will trigger an interactive bootstrap wizard to guide you through:

  1. Detecting the memory/ state storage path and .env configuration.
  2. 5-dimensional profiling (Legal name, Risk capacity, Debt structure, Initial holdings, and optional keys).
  3. Running static data migration to immediately generate your first asset exposure memo.

💡 Zero-Cost Execution: In skill interactive mode, the committee's underlying reasoning relies entirely on the host agent's (e.g. Claude Code) reasoning pipeline. No third-party API Key is consumed. You only need to configure an API key when setting up automated crons or calling independent Web APIs.

For self-hosting details, see docs/QUICK_START.md. (The bundled Web GUI was retired on 2026-07-05 — all capabilities are exposed via CLI/MCP; a standalone frontend may return later.)

3. Serverless Self-Hosting (GitHub Actions)

Run the committee automatically via GitHub Actions and receive daily digest emails.

⚠️ Fork must be set to Private: State files (holdings, verdicts) will be committed back to your fork. Public forks will leak your private financial information.

  1. Fork this repository and change its visibility to Private (Settings -> Visibility).
  2. Run set up invest locally to generate the initial memory/ folder, then commit and push it to your private fork:
    bash
    git add -f memory/ && git commit -m "chore: init memory state" && git push
  3. In your fork's Settings -> Secrets and variables -> Actions, add the following Secrets:
    • LLM_API_KEY (or DEEPSEEK_API_KEY): API key to run the committee.
    • EMAIL_SENDER / EMAIL_PASSWORD: Gmail address + App Password.
    • DIGEST_EMAIL_TO: Recipient email address.
  4. Enable Workflows under the Actions tab. The workflow runs automatically at 10:00 AM (Beijing time) daily; you can also manually trigger daily-report via Run workflow.

Architecture & Multi-Agent Orchestration

openInvest does not run a mock debate in a single LLM session. The system enforces an Information Isolation Contract at the core/committee/ layer, orchestrating 4 independent LLM processes in a directed acyclic graph (DAG):

                [ Macro Data Injection ]                           │                 ▼ 1. Macro Alignment Context             ┌──────────────────────────┐             │    Macro Strategist      │ (VIX / Interest rate spread / Currency momentum)             └─────────────┬────────────┘                           │                 ▼ 2. Async Multi-Dimensional Scrutiny (Async DAG)             ┌─────────────┴────────────┐             ▼                          ▼   ┌──────────────────┐        ┌──────────────────┐   │  Quant Analyst   │        │   Risk Officer   │   │ (RSI / Momentum) │        │ (Concentration)  │   │                  │        │                  │   │ 🛑 No Holdings   │        │ 🛑 No Indicators │   └─────────┬────────┘        └─────────┬────────┘             │                           │             └─────────────┬─────────────┘                           │             ▼ 3. Round 2 Rebuttal & Cross-Challenge             │ Mutual feedback loop for signal correction             ▼   ┌──────────────────────────────────────────────┐   │         Chief Investment Officer (CIO)       │   └───────────────────────┬──────────────────────┘                           │             ▼ 4. Deterministic State Persistence          [ BUY / ACCUMULATE / HOLD / TRIM / SELL ]
  1. Macro Strategist: Assesses the global macro landscape (VIX, yield curve spread, core currency matrix) to establish the portfolio's risk threshold.
  2. Quant Analyst: A pure mathematical momentum and technical indicator filter. Strictly blocked from knowing portfolio holdings to eliminate human attachment and loss-aversion biases.
  3. Risk Officer: Focuses entirely on tail risks (drawdown buffers, concentration limits, solvency multipliers). Strictly blocked from technical indicators to make objective asset exposure rulings.
  4. Round 2 Rebuttal: Quant and Risk analysts are fed each other's Round 1 reports in Round 2, challenging boundaries until signals converge or safety valves trigger.
  5. CIO (Chief Investment Officer): Synthesizes the audited reports and outputs a structured Verdict (BUY / ACCUMULATE / HOLD / TRIM / SELL) with a confidence level. No auto-order execution occurs; final action remains strictly up to the human auditor.

Key trade-offs behind this design are recorded as ADRs in docs/wiki/adr/ (24 to date), including rulings that overturned our own earlier designs — ADR-007 retired the few-shot CIO route, and ADR-009 rejected TA-style analyst agents after a pre-registered experiment.


Core Design

  • Coordinator-Worker Pattern: Workers operate in isolated namespaces. Boundary constraints are hardcoded at the framework layer in Python to prevent attention contamination in large multi-role prompts.
  • Markdown-as-a-Database: The system uses Frontmatter (YAML) + Markdown (Body) as the single source of truth. Leveraging fcntl.flock process file locks and temporary atomic file replacement, it provides a tamper-proof investment audit trail natively tracked by Git.
  • Three-Phase Dreaming Consolidation: Distills daily decisions against actual market outcomes nightly (Light Sleep $\rightarrow$ REM $\rightarrow$ Deep Sleep) to consolidate long-term insights, preventing Large Language Model (LLM) context drift over long execution spans.

Configuration

The system defaults to DeepSeek endpoints and supports any standard OpenAI-compatible API. LLM provider setup and all tunable runtime overrides (ADR-017) are documented in docs/wiki/22-configuration.md.


Disclaimers & Backtest Limitations

  1. No Financial Advice: This system is a decision-support tool powered by LLMs. Output memos represent simulated reasoning based on deterministic data and do not constitute asset allocation advice.
  2. Backtest Time-Lock & Lookahead Guard: The backtest engine (scripts/backtest_runner.py) has a hardcoded safety valve: it rejects backtests for decision_date > 2024-06-30 by default (override with --allow-lookahead). Since mainstream foundation models have training cutoff dates around mid-2024, backtesting on later intervals introduces severe Lookahead Bias (model pre-training leakage). Parameter tuning, Optuna sweeps, and prompt optimization must run strictly on historical windows prior to June 30, 2024.

Acknowledgments

  • Jawz: Thank you for supporting openInvest's continued development.
  • Tencent Cloud: Thank you for supporting openInvest's continued development.
  • Equibles — Optional data provider for A-share and Hong Kong financial statements, and a daily-price fallback when Yahoo Finance is unreachable. Yahoo Finance stays the default; set your own free EQUIBLES_API_KEY to turn it on (setup).
  • Xiaomi MiMo — Special thanks to MiMo Quantitative Lab for sponsoring production-grade high-performance LLM inference (powering mimo-v2.5-pro long-horizon sweeps).
  • OpenClaw Dreaming Guide — Theoretical foundation for the three-phase sleep-cycle memory distillation framework.

License

This project is licensed under the MIT License - see the LICENSE file for details.

來源:README.md,提交 5d3b074

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:軟體包安裝失敗。

版本歷史

29
  1. v0.68.4Nov 7, 2026
  2. v0.68.1Oct 29, 2026
  3. v0.67.0Oct 20, 2026
  4. v0.64.0Oct 19, 2026
  5. v0.62.0Oct 19, 2026
  6. v0.59.1Oct 19, 2026
  7. v0.58.0Oct 18, 2026
  8. v0.55.0Oct 18, 2026
  9. v0.54.0Oct 18, 2026
  10. v0.53.1Oct 18, 2026
  11. v0.49.0Oct 18, 2026
  12. v0.45.0Oct 17, 2026
  13. v0.44.1Oct 15, 2026
  14. v0.42.4Oct 15, 2026
  15. v0.42.2Oct 14, 2026
  16. v0.42.0Oct 13, 2026
  17. v0.41.3Oct 13, 2026
  18. v0.41.2Oct 11, 2026
  19. v0.41.1Oct 11, 2026
  20. v0.40.4Oct 10, 2026
  21. v0.40.1Oct 9, 2026
  22. v0.40.0Oct 9, 2026
  23. v0.39.2Oct 9, 2026
  24. v0.39.0Oct 8, 2026
  25. v0.37.0Oct 8, 2026
  26. v0.36.2Oct 8, 2026
  27. v0.35.0Oct 7, 2026
  28. v0.34.1Oct 7, 2026
  29. v0.34.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分