Skip to content

Feat/ai berkshire skills#407

Merged
warren618 merged 9 commits into
HKUDS:mainfrom
sambazhu:feat/ai-berkshire-skills
Jul 7, 2026
Merged

Feat/ai berkshire skills#407
warren618 merged 9 commits into
HKUDS:mainfrom
sambazhu:feat/ai-berkshire-skills

Conversation

@sambazhu

@sambazhu sambazhu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Why

Changes

Test Plan

  • Existing tests pass (pytest --ignore=agent/tests/e2e_backtest --tb=short -q)
  • New tests added (if applicable)
  • Tested manually (describe below)

Checklist

  • No changes to protected areas (src/agent/, src/session/, src/providers/) without prior discussion
  • No hardcoded values (API keys, file paths, magic numbers)
  • Code follows CONTRIBUTING.md guidelines
  • Documentation updated (if user-facing change)

sambazhu and others added 4 commits July 5, 2026 13:39
… committee preset)

Ports the ai-berkshire value-investing methodology into first-class
Vibe-Trading tools / skills / swarm preset, rewritten for the BaseTool +
SKILL.md + swarm model (no Claude Code slash-commands or TeamCreate).

Tools (auto-discovered BaseTool subclasses, pure stdlib):
- financial_rigor: exact-decimal verification — verify_market_cap,
  verify_valuation, cross_validate, benford, calc, three_scenario. The calc
  evaluator walks an AST in the Decimal domain (0.1 + 0.2 == 0.3 exactly),
  so there is no eval and no IEEE-754 drift.
- report_audit: markdown data-point extraction -> random sample -> PASS/FAIL
  verdict gate. A single-source failure now correctly FAILs the report
  (the source logic silently WARNed instead).

Skills (markdown methodology):
- bottleneck-hunter: supply-chain bottleneck arbitrage — decompose a
  super-trend to Layer 2/3 choke points with mandatory valuation gates.
- thesis-tracker: post-buy discipline — 5-sentence thesis, falsifiable
  assumptions, red lines, 1-10 health score.
- management-deep-dive: management integrity / ability / capital-allocation
  / governance with Duan Yongping's 3-question verdict.
- private-company-research: 6-lens pre-IPO framework (business / financial /
  competitive / risk / tech / alternative-data) with confidence labeling
  and signal-consistency cross-validation.

Swarm preset:
- value_investing_committee: four adversarial master perspectives
  (Buffett / Munger / Duan Yongping / Li Lu) plus a chair synthesizing
  consensus and contradictions into a verdict.

63 new tests; EXPECTED_PRESET_COUNT bumped 29 -> 30.

Inspired by https://github.com/xbtlin/ai-berkshire.

Co-Authored-By: Claude <noreply@anthropic.com>
loop.py dedups non-repeatable tools by name (a tool already in _called_ok
is refused on a second call). Both tools are read-only and idempotent but
were left at the default repeatable=False, so calling financial_rigor
twice in one session (e.g. verify_valuation then three_scenario) hit a
'cached result, cannot re-invoke' refusal. Set repeatable=True on both.

Co-Authored-By: Claude <noreply@anthropic.com>
LLMs routinely pass '15%' as 15 instead of 0.15, which made
three_scenario_valuation compound at 1500% and return absurd target prices
(23.5 x 16^3 = 96256 instead of 35.74). The math was correct for the input
given, but the tool silently accepted an unreasonable growth rate.

Now |growth| > 1 is treated as a percent and divided by 100, with a
growth_normalized_from_percent flag and note in the result. Description
also clarified ('0.15 for 15%').

Co-Authored-By: Claude <noreply@anthropic.com>
The preset YAML was on disk and loadable (inspect_preset valid=True), but
run_swarm refused preset_name='value_investing_committee' as 'Unknown preset'
because _PRESET_NAMES is derived from _PRESET_KEYWORDS, which the new preset
was not added to. The LLM then fuzzy-matched to the similarly-named built-in
investment_committee and ran the wrong team.

Register value_investing_committee in _PRESET_KEYWORDS (value-investing /
Buffett / Munger / Duan Yongping / Li Lu keywords) and add its
{company}/{market} variables to _build_variables.

Co-Authored-By: Claude <noreply@anthropic.com>
@shadowinlife

shadowinlife commented Jul 6, 2026

Copy link
Copy Markdown
Contributor
  1. 周边基础设施额? 当前SKILLS似乎主要来源于https://github.com/xbtlin/ai-berkshire 这个项目, 如果需要迁移可以看一下是不是有周边基础设施也需要连带

  2. 是否考虑英文? : 母项目中的skills.md的中文描述论文破裂才要卖 是一个较为奇怪的中文表达, 直觉上可能是论据破裂 更合适? 此类表达也许是更上游的英文描述的问题? 可以考虑纯英文的skills

  3. 需要增加的非常重要的宏观约束: 母项目的maintainer非常贴心的展示了实盘记录, 我的个人观点是它选中了美团标的, 说明没有考虑 人口时钟居民边际消费变化 趋势, 如果需要添加这个skills到当前项目, 建议在SKILLS里考虑补充一些宏观分析内容.

sambazhu and others added 3 commits July 6, 2026 14:46
…heck (P3)

P3 of the ai-berkshire fusion — small, broad-impact methodology additions:

- data-routing: add a 'Data Verification Discipline' section — cross-check
  material figures across >=2 sources, flag >1% deviations as caliber
  mismatches, use financial_rigor's cross_validate for exact comparison,
  mark unverified numbers. Pairs with the cross_validate tool added in P1.
- research-discipline (new skill, analysis): a 60-second self-bias checklist
  run at the start of any research task — leader-bias, English-bias,
  narrative-bias, confirmation-bias, recency-bias, with concrete corrections.
  Covers the reasoning layer (vs cross_validate=numbers, report_audit=output).

No code changes, no new deps. Existing data-routing tests still pass (4/4).

Co-Authored-By: Claude <noreply@anthropic.com>
An 8-part publication-grade deep-dive on a single company (~120k words):
cognitive reset / moat / profit engine / hidden assets / era variable /
financials / management / valuation+redlines. The core IP is the strict
fact-check checklist (5 pseudo-precision traps + 7 revision checks) and
the cross-article consistency scan.

Adapted from ai-berkshire's deep-company-series.md. Cross-article scan
reuses report_audit (extract numbers across 8 articles) + financial_rigor
cross_validate (flag >1% deviations) — closes the loop with P1's tools.

Co-Authored-By: Claude <noreply@anthropic.com>
Adds a 'Value Investing' category to WelcomeScreen with 4 one-click
examples surfacing the ai-berkshire toolkit:
- Value Investing Committee (run_swarm value_investing_committee, Tencent)
- Supply-Chain Bottleneck Hunter (bottleneck-hunter, AI infra)
- Investment Thesis Tracker (thesis-tracker, Moutai)
- Exact Valuation Check (financial_rigor PE/PB/ROE + three-scenario)

i18n: en + zh-CN (title + desc + prompt). dist is gitignored — CI builds it.

Co-Authored-By: Claude <noreply@anthropic.com>
@sambazhu

sambazhu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

感谢您的细致评审!针对您提到的三点,我的回复如下:

  1. 关于来自 ai-berkshire 的周边基础设施
    在进行迁移时,我已经对整个仓库进行了完整评估。核心部分已成功迁移,其余部分则是出于特定原因有意跳过的:

已迁移:financial_rigor.py 和 report_audit.py(两个纯标准库工具),以及本次 PR 中的 6 个技能(skills)和 1 个预设(preset)。
有意未迁移:
1、morningstar_fair_value.py / xueqiu_scraper.py —— 网页爬虫(涉及认证/反爬机制以及合规风险),不适合作为上游工具。
2、momentum_backtest.py —— 硬编码了 NVDA/AMD/MU 的基本面,缺乏通用性(Vibe-Trading 自带的回测功能更强)。
3、log-command.sh —— Claude Code 的 user_prompt_submit 钩子,属于宿主机特定的脚本。
4、stock_screener.py —— Vibe-Trading 已经具备了 screen_market 和 iwencai_search 功能。
5、data/(自选股、基本面)—— 原作者的个人数据,不属于方法论范畴。
6、reports/ —— 原作者的个人研究产物,而非技能。
综上所述,周边基础设施已经过评估,我们仅迁移了具备可移植性和通用性的部分。

  1. 英文技能
    完全同意。我将把所有技能的主体内容转换为英文(以匹配 akshare 等内置技能)。稍后会推送一个后续提交(commit)。

  2. 宏观约束(人口时钟 / 消费趋势)
    这个建议,ai-berkshire 原作者对美团的选股逻辑在长期宏观逆风因素上的确考虑偏弱。我将在 thesis-tracker 中加入人口结构/消费趋势的红线指标,并在 value_investing_committee 的李录 Agent 中引入宏观视角的评估。这些改动也将包含在后续的提交中。

…eview

Responding to upstream review feedback:

1. All skill bodies converted to English (matching bundled skills like
   akshare). Some Chinese wording was ambiguous in an international project.
2. Added macro constraints (demographic clock / consumption trend /
   generational shift) per reviewer's point that a consumer-name pick
   should weigh long-term macro headwinds:
   - thesis-tracker: new red line on macro-trend reversal for
     consumer/property/education names.
   - value_investing_committee Li Lu agent: mandatory demographic-clock +
     consumption-trend + generational-shift section for consumer-dependent
     names; a consumer name cannot score high 10-year certainty without
     addressing demographics.

No structural changes; counts unchanged (85 skills, 70 tools, 30 presets).

Co-Authored-By: Claude <noreply@anthropic.com>
@sambazhu

sambazhu commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author
  1. ai-berkshire 的周边基础设施
    迁移时已评估了整个仓库。核心已迁;其余因具体原因有意放弃:
    已迁:financial_rigor.py + report_audit.py(两个纯 stdlib 工具),以及本 PR 的 6 个技能 + 1 个 preset。
    有意未迁:
    morningstar_fair_value.py / xueqiu_scraper.py —— 网页爬虫(需登录态/反爬 + 合规风险),不适合作为上游工具。
    momentum_backtest.py —— 硬编码 NVDA/AMD/MU 财务数据,无通用性(Vibe-Trading 的 backtest 更强)。
    log-command.sh —— Claude Code 的 user_prompt_submit hook,宿主专有。
    stock_screener.py —— Vibe-Trading 已有 screen_market + iwencai_search。
    data/(watchlist、fundamentals)—— 作者个人数据,非方法论。
    reports/ —— 作者个人研究产出,非技能。
    所以周边基础设施已评估;只迁移了可移植、通用的部分。

2 & 3 —— 已在 commit 7a55def 处理。
1、英文:全部 6 个技能正文 + value_investing_committee preset 已转为英文,与内置技能(如 akshare)一致。
2、宏观约束:
1)thesis-tracker 新增一条红线"该标的终端市场的宏观趋势逆转"(人口时钟 / 消费降级 / 代际迁移),对消费/地产/教育类标的明确加权。
2)value_investing_committee 的李录 agent 新增强制性的人口时钟 + 消费趋势 + 代际迁移章节(针对消费依赖型标的)——消费类标的若不回应人口问题,无法获得高"10 年确定性"评分。
您指出的美团盲点正是这个改动要解决的:一个消费标的如果没权衡人口下降 / 消费降级,现在会在投资论文红线和李录视角被拦截。

@warren618 warren618 merged commit e7370e9 into HKUDS:main Jul 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants