Skip to main content
Glama
willfate
by gro83j

WillFate

CI Python Node MCP License: MIT

English README · 更新日志 CHANGELOG · 可选网页工作台分支 (web-ui)

WillFate 是一套本地优先的中国传统术数排盘、经典书证检索、个人长期记忆与现实成长陪伴框架。装好后,你可以直接用 Claude Code、Codex、Antigravity、WorkBuddy、Cursor、DSH 等任意本地 AI 助手为你排盘、解盘、复盘校准与规划现实行动。

WillFate 架构与双线工作流


为什么做 WillFate?(解决普通 AI 算命的三大硬伤)

  1. 告别大模型“心算排盘幻觉”:大模型心算万年历、节气换柱、真太阳时、紫微安星和星盘宫位极易出错。WillFate 内置 16 个确定性术数计算工具(八字、大运、紫微、运限、飞星、西占、推运/返照、奇门、六爻、梅花、大小六壬、太乙、黄历、塔罗),所有盘面符号 100% 由本地确定性算法产出并自动缓存。

  2. 从 0 开始、越用越懂你的本地长期记忆:每位使用者的数据完全独立保存在自己电脑的 ~/.willfate/(可通过 WILLFATE_HOME 覆盖),仓库零预置私人数据。首次对话自动引导建档,后续会话一键“温启动”加载你的个人简报、沟通偏好、已排本命盘与未决问题。

  3. 事实与推算严格分家 + 四段式证据链:

    • 只把客观现实写进档案:你亲口说的现状、经历与偏好进入 personal_memory.db 与事实台账;AI 推算的运势判断只写进 ~/.willfate/readings/ 待事后现实校准,绝不污染事实库。

    • 反宿命论与可验证推演:每个结论强制走「盘面信号 → 时间触发 → 领域归属 → 最窄可支持结论」,区分强/中/弱证据并设置高风险安全降级,同时提供「算命解盘线」与「现实能力提升线」双轨切换。


Related MCP server: 命盘 Mingpan

三分钟快速上手

环境要求:Python ≥ 3.10 + Node.js ≥ 20。

第 1 步:克隆并初始化本地私密目录与排盘引擎

git clone https://github.com/gro83j/willfate.git
cd willfate

# 安装最小核心依赖(仅 lunar-python,SQLite FTS5 / 稀疏向量 / MCP 均使用标准库)
pip install -r requirements.txt

# 初始化 ~/.willfate 空数据库与目录,并安装 16 工具排盘运行时依赖
python willfate_cli.py init --install-runtime

# 环境自检
python willfate_cli.py doctor

第 2 步:一键安装全宿主 Skill 并挂载 22 工具 MCP

# 自动探测本机已安装的 AI 助手并写入 Skill(也可指定 --host claude,codex,antigravity,workbuddy,cursor,dsh 或 all)
python willfate_cli.py setup --host auto

按终端打印的配置把 MCP Server 挂进你的 AI 助手(任选其一;即使不挂 MCP,能访问本地文件/终端的 AI 助手也能通过 ~/.willfate/bin/willfate_run.py 直接驱动全部能力):

  • Claude Code(一行命令):

    claude mcp add willfate -- python /绝对路径/willfate/willfate_cli.py mcp
  • Cursor / Antigravity / WorkBuddy / DSH(MCP JSON):

    {
      "mcpServers": {
        "willfate": {
          "command": "python",
          "args": ["/绝对路径/willfate/willfate_cli.py", "mcp"]
        }
      }
    }
  • Codex(~/.codex/config.toml):

    [mcp_servers.willfate]
    command = "python"
    args = ["/绝对路径/willfate/willfate_cli.py", "mcp"]

第 3 步:在你的 AI 助手里直接开聊

  • 首次使用(冷启动从 0 建档):

    willfate (AI 会引导你提供称呼、性别、公历出生年月日时分与出生城市,自动排好本命八字/紫微/星盘缓存到本地 ~/.willfate/charts/ 并建立你的专属档案。)

  • 日常看盘 / 起卦(算命解盘线):

    willfate 结合我的八字和紫微看看明年事业变动窗口,再起一局奇门看眼下这个机会能不能成。

  • 日常复盘 / 抗拖延(能力提升陪伴线):

    最近推进副业总是拖延内耗,帮我拆解一下这周可执行的动作和复盘指标。


22 个统一 MCP 工具一览

A. 本地长期记忆、温启动与校准工具(6 个)

工具名

作用

willfate_doctor

检查 Python、16 工具排盘引擎版本与 ~/.willfate 本地记忆/书库状态

willfate_warmstart

生成会话温启动简报(当下干支锚点、事实台账、偏好画像、缓存盘面、最近解读;首次使用标记冷启动)

willfate_profile_get

读取本人(primary)或第三方(other:*)结构化档案、事实台账与沟通偏好

willfate_profile_ingest

将用户直述的客观现实事实写入 SQLite 向量记忆库与 Markdown 事实台账(禁写测算结论)

willfate_memory_search

在个人长期记忆库(personal_memory.db)与自备古籍书库(books.db)中执行 FTS5 + 稀疏向量混合检索

willfate_reading_log

创建正式解读归档(create)、列出历史记录(list)或追加事后现实校准(calibrate)

B. 确定性术数排盘工具(16 个,全部支持 saveAs 自动落盘缓存)

类别

工具名

核心输出

四柱子平

bazi · bazi_dayun · bazi_pillars_resolve

真太阳时换算、四柱藏干十神、神煞、交运节气、大运流年流月、四柱反推公历

紫微斗数

ziwei · ziwei_horoscope · ziwei_flying_star

十二宫安星、庙旺利陷、五行局、大限/流年/流月/流日四化叠盘、宫干飞星转宫

西方占星

astrology · astrology_advanced

本命行星落宫与相位、流运触发、次限推运(secondary_progression)、太阳返照(solar_return)

三式与周易

qimen · liuyao · meihua · daliuren · xiaoliuren · taiyi

时家转盘奇门九宫门星神、六爻纳甲六亲月建日辰、梅花体用、大小六壬四课三传、太乙

历法与符号

almanac · tarot

万年历择日干支宜忌、塔罗牌阵抽取


CLI 常用命令

python willfate_cli.py doctor                                  # 环境与记忆库状态自检
python willfate_cli.py warmstart                               # 生成 ~/.willfate/warmstart/briefing.md
python willfate_cli.py chart --list                            # 查看 16 个排盘工具及必填参数
python willfate_cli.py chart --tool bazi --args-file args.json --out-name primary_bazi
python willfate_cli.py profile show                            # 查看当前个人档案状态
python willfate_cli.py profile ingest --facts examples/facts_ingest.example.json --dry-run
python willfate_cli.py search --query "伤官见官" --scope books  # 检索自备古籍书库
python willfate_cli.py ingest-books                            # 导入 ~/.willfate/books 下的自备书籍
python willfate_cli.py calibrate --list                        # 查看历史解读与事后校准记录

本地数据目录与自备古籍书库

本仓库不包含任何受版权保护的书籍文件或任何个人数据。运行 init 后,你的所有私人数据均保存在本地 ~/.willfate/(可用环境变量 WILLFATE_HOME 指定其他盘符目录):

~/.willfate/
├── memory_store/
│   ├── personal_memory.db            # 个人长期记忆与结构化档案 SQLite(FTS5 + 稀疏向量)
│   ├── books.db                      # 自备古籍分块与检索索引 SQLite
│   └── profiles/                     # 事实台账 primary_profile_facts.md 与沟通画像
├── books/                            # 放入你自备的 .txt / .md / .pdf / .epub / .docx 典籍后运行 ingest-books
├── charts/                           # 本命盘与起局 JSON/MD 本地缓存(免重复排盘)
├── readings/                         # 每次正式解读的归档与事后现实校准记录
└── warmstart/briefing.md             # 供本地 AI 助手一键读取的会话温启动简报
  • 可选高级能力:

    • PDF/EPUB/图片排盘 OCR:pip install -r agent/requirements-optional.txt

    • 本地离线 BGE ONNX 重排:pip install -r agent/requirements-book-rerank.txt

    • Neo4j 图谱记忆旁路层(默认 fail-open,不装也不影响主流程):pip install -r agent/requirements-graph.txt,参考 agent/graph/README.md。


可选分支:本地网页与图谱记忆工作台 (web-ui)

如果你除了在本地 AI 助手里对话之外,还想要一个本地浏览器可视化界面(包含图谱记忆节点可视化浏览、日常心情日记、随手笔记与历史解读归档台),可以切换到可选的 web-ui 分支:

git fetch origin web-ui
git checkout web-ui

# 启动本地 Web 工作台(默认监听 127.0.0.1:8765,首次启动自动在本地生成随机口令)
python bridge/server.py

日常只用 Claude Code / Codex / Antigravity / Cursor / DSH 对话的用户,留在默认的 main 分支即可,更加轻量纯粹。


开发测试与免责声明

# 在隔离空环境下运行全量单元测试与排盘运行时集成测试(635+ 用例)
cd agent
PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 WILLFATE_CHART_RUNTIME_INTEGRATION=1 python -m pytest -q

文化与安全边界声明:

  1. 本项目定位为传统文化术数研究、符号自省与个人成长复盘工具,严禁用于宿命论恐吓或迷信敛财。

  2. 任何排盘推演结论均属于条件性视角参考,不能替代执业医师的医疗诊断、执业律师的法律意见、心理咨询/危机干预或持牌机构的金融投资决策。

License

MIT License · 第三方开源组件说明见 NOTICE。

Available Tools

22 tools
almanacC

择日万年历与当日干支宜忌神煞

Inputs: saveAs.

astrologyC

西方占星本命盘与指定时刻流运行星触发(含宫位与相位)

Inputs: birthDay (required), birthHour (required), birthYear (required), birthMonth (required), +1 more.

astrology_advancedD

西方占星次限推运(secondary_progression)与太阳返照盘(solar_return)

Inputs: methods (required), birthDay (required), latitude (required), birthHour (required), +5 more.

baziC

四柱八字排盘(支持出生地经度换算真太阳时、十神、神煞、藏干)

Inputs: gender (required), birthDay (required), birthHour (required), birthYear (required), +2 more.

bazi_dayunC

八字大运、流年、流月与交运节气推算

Inputs: gender (required), birthDay (required), birthHour (required), birthYear (required), +2 more.

bazi_pillars_resolveB

已知四柱干支反推候选公历出生时间

Inputs: dayPillar (required), hourPillar (required), yearPillar (required), monthPillar (required), +1 more.

daliurenC

大六壬起课(天地盘、四课、三传、神将、课体)

Inputs: date (required), hour (required), saveAs.

liuyaoC

六爻纳甲起卦排盘(本卦变卦、六亲六神、月建日辰、动爻空亡)

Inputs: date (required), question (required), yongShenTargets (required), saveAs.

meihuaC

梅花易数起卦排盘(体用生克、互卦变卦)

Inputs: date (required), question (required), saveAs.

qimenC

时家转盘奇门遁甲排盘(阴阳遁、局数、九宫、八门、九星、八神、格局)

Inputs: day (required), hour (required), year (required), month (required), +1 more.

taiyiD

太乙神数排盘

Inputs: date (required), mode (required), saveAs.

tarotC

塔罗牌阵抽取与牌面结构信息

Inputs: saveAs.

willfate_doctorB

自检 WillFate 运行环境:Python、16 工具排盘运行时版本、本地数据目录(~/.willfate)、个人档案与书库条数

Inputs: no named parameters.

willfate_profile_getC

读取本地人物档案 JSON、事实台账 Markdown 与沟通偏好画像

Inputs: profileId.

willfate_profile_ingestA

将用户直述的客观现实事实写入本地长期记忆库与事实台账(严禁写入命理推算结论)

Inputs: facts, profileId, profilePatch, ledgerEntries, +2 more.

willfate_reading_logB

管理本地解读校准日志(~/.willfate/readings/):记录正式解读结论与应期窗口,或在现实发生后追加校准复盘

Inputs: file, limit, topic, action, +11 more.

willfate_warmstartB

初始化本地数据目录并生成温启动简报(含当下干支锚点、个人事实档案、沟通偏好、已缓存盘面、历史解读记录;首次使用自动标记冷启动)

Inputs: readingsLimit.

xiaoliurenC

小六壬起课与掌诀推演

Inputs: hour (required), lunarDay (required), lunarMonth (required), saveAs.

ziweiC

紫微斗数十二宫本命盘(星曜、四化、庙旺利陷、五行局)

Inputs: gender (required), birthDay (required), birthHour (required), birthYear (required), +2 more.

ziwei_flying_starC

紫微斗数宫干四化飞星、转宫与立太极查询

Inputs: gender (required), queries (required), birthDay (required), birthHour (required), +3 more.

ziwei_horoscopeC

紫微斗数大限、流年、流月、流日运限叠盘

Inputs: gender (required), birthDay (required), birthHour (required), birthYear (required), +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.7/5.0

    Scored across 22 tools

    Disambiguation4/5

    Each divination system (bazi, ziwei, qimen, liuyao, meihua, daliuren, xiaoliuren, taiyi, tarot, astrology) is a clearly separate tool with a distinct method, and the sub-tools (astrology_advanced, bazi_dayun, ziwei_horoscope) are scoped to distinct chart layers. The only mild overlaps are willfate_doctor vs willfate_warmstart (both environment/init concerns) and willfate_profile_get vs willfate_memory_search (both read local personal data), but descriptions distinguish them adequately.

    Naming Consistency3/5

    All names are lowercase snake_case and follow a recognizable {system}_{subfunction} pattern, which is readable. However, the willfate_ prefix is applied to only a subset of tools (doctor, warmstart, profile_*, memory_search, reading_log) while core chart tools are bare, and some suffixes are adjectives (astrology_advanced) rather than actions, so the convention is mixed.

    Tool Count4/5

    22 tools is on the heavy side, but the server covers roughly ten distinct divination systems plus profile/memory management, so each system getting 1-3 tools is justified rather than redundant. No obvious filler tools are present.

    Completeness3/5

    Chart casting is well covered across many traditions, plus a reading log, memory search, and diagnostics. However, the long-term memory/profile surface is write-and-read only: there is no way to correct, update, or delete stored facts, profile entries, or reading-log records, which is a notable gap for a persistent memory system.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables traditional Chinese metaphysics tools like Bazi, Ziwei, and Qimen via MCP, integrating AI analysis for divination and fortune-telling.
      818
      AGPL 3.0
    • A
      license
      A
      quality
      B
      maintenance
      Provides traditional Chinese astrology (Bazi, Ziwei) and divination (Liuyao, Meihua, Qimen, etc.) calculations as MCP tools for AI assistants.
      18
      760 npm
      139
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Provides Chinese metaphysical tools (bazi, qimen, five elements) as MCP tools for AI agents to give personalized advice on timing, compatibility, and daily energy.
      5
      90 npm
      2
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Provides MCP tools for Chinese metaphysics, including BaZi (Four Pillars) charting, Liu Yao hexagram casting, lunar conversion, and AI-powered destiny analysis.
      10
      37 npm
      MIT