<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: professorwang</title>
    <description>The latest articles on DEV Community by professorwang (@professorwang).</description>
    <link>https://dev.to/professorwang</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4202090%2Fac38a9f9-6216-47f0-811b-58facc96f489.jpg</url>
      <title>DEV Community: professorwang</title>
      <link>https://dev.to/professorwang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/professorwang"/>
    <language>en</language>
    <item>
      <title>I built a BaZi/flying-star API where every answer is replayable (SHA-256)</title>
      <dc:creator>professorwang</dc:creator>
      <pubDate>Fri, 23 Oct 2026 08:45:34 +0000</pubDate>
      <link>https://dev.to/professorwang/i-built-a-baziflying-star-api-where-every-answer-is-replayable-sha-256-1nhg</link>
      <guid>https://dev.to/professorwang/i-built-a-baziflying-star-api-where-every-answer-is-replayable-sha-256-1nhg</guid>
      <description>&lt;p&gt;The problem: three tools, three answers.&lt;/p&gt;

&lt;p&gt;Ask three online BaZi calculators for the same January birth date and you can get three different year pillars. It's not a bug in any one of them, necessarily — the tradition genuinely carries multiple conventions: the year flips at the exact &lt;strong&gt;Lichun&lt;/strong&gt; instant in BaZi practice, at Chinese New Year in folk practice, and at January 1 in naive software. Most tools pick one convention silently. That's the thing we wanted to fix (&lt;a href="https://fengshuicalculator.com/disputes/" rel="noopener noreferrer"&gt;our dispute register lists the cases&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  What we built
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://fengshuicalculator.com" rel="noopener noreferrer"&gt;Fengshui Calculator&lt;/a&gt; is a calculation engine for traditional Chinese calendrics — BaZi four pillars, Xuan Kong flying-star charts, Ming Gua / Kua numbers, the 24 solar terms, almanac officers, date selection — with two properties that are unusual in this space:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Every response carries provenance&lt;/strong&gt;: engine version, ruleset id, and a SHA-256 &lt;code&gt;input_digest&lt;/code&gt; computed over the JCS-canonicalised request. Any result can be replayed byte-for-byte (&lt;a href="https://fengshuicalculator.com/docs/fif/" rel="noopener noreferrer"&gt;fingerprint format docs&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conventions are returned side by side.&lt;/strong&gt; &lt;code&gt;/v1/ganzhi&lt;/code&gt; returns all four year-convention × day-boundary combinations rather than guessing which one you meant. Disagreements are labeled, never merged.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The same kernel runs three places: the browser (WebAssembly, zero network), the REST API, and a native MCP endpoint. We cross-check calendar output against the Hong Kong Observatory for 1901–2100, plus four open-source reference implementations across ~290,000 samples — every divergence is attributed in the public &lt;a href="https://fengshuicalculator.com/audit/report-v1.html" rel="noopener noreferrer"&gt;accuracy report&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it in 60 seconds (no key, no signup)
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Chinese almanac for a day — lunar date, day officer, yellow/black path, six officers&lt;/span&gt;
curl &lt;span class="s2"&gt;"https://fengshuicalculator.com/v1/calendar?date=2026-10-21"&lt;/span&gt;

&lt;span class="c"&gt;# Four pillars, four conventions side by side&lt;/span&gt;
curl &lt;span class="s2"&gt;"https://fengshuicalculator.com/v1/ganzhi?date=1985-02-20&amp;amp;hour=14"&lt;/span&gt;

&lt;span class="c"&gt;# Kua number with the exact Lichun instant applied&lt;/span&gt;
curl &lt;span class="s2"&gt;"https://fengshuicalculator.com/v1/kua?date=1990-07-01&amp;amp;gender=male"&lt;/span&gt;

&lt;span class="c"&gt;# Flying-star chart (Period 9, Zi-shan Wu-xiang)&lt;/span&gt;
curl &lt;span class="s2"&gt;"https://fengshuicalculator.com/v1/flying-star?yun=9&amp;amp;sitting=子&amp;amp;kind=xiagua"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every response includes &lt;code&gt;provenance.engine_version&lt;/code&gt;, &lt;code&gt;provenance.ruleset_id&lt;/code&gt;, and &lt;code&gt;provenance.input_digest&lt;/code&gt;. To verify a response later, POST the same request to &lt;code&gt;/v1/replay&lt;/code&gt; with the digest: you get MATCH or an honest MISMATCH (&lt;a href="https://fengshuicalculator.com/docs/api/" rel="noopener noreferrer"&gt;API reference&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The MCP endpoint (agents)
&lt;/h2&gt;

&lt;p&gt;If your agent speaks MCP, point it at &lt;code&gt;https://fengshuicalculator.com/v1/mcp&lt;/code&gt; (streamable HTTP, stateless, no auth). Ten tools: &lt;code&gt;calendar&lt;/code&gt;, &lt;code&gt;ganzhi&lt;/code&gt;, &lt;code&gt;solar_terms&lt;/code&gt;, &lt;code&gt;kua_number&lt;/code&gt;, &lt;code&gt;flying_star_chart&lt;/code&gt;, &lt;code&gt;yun_period&lt;/code&gt;, &lt;code&gt;rulesets&lt;/code&gt;, &lt;code&gt;form_analysis&lt;/code&gt;, &lt;code&gt;terrain_white_tiger&lt;/code&gt;, &lt;code&gt;replay&lt;/code&gt;. It's also listed in the official MCP Registry as &lt;code&gt;com.fengshuicalculator/fengshui-calculator&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add &lt;span class="nt"&gt;--transport&lt;/span&gt; http fengshui https://fengshuicalculator.com/v1/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Design decisions you might argue with
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;We refuse to guess.&lt;/strong&gt; Day/hour purple-white stars have materially different starting rules across the literature, so the engine returns an explicit "not closed" error instead of picking a formula. Fewer numbers, no invented ones. The &lt;a href="https://fengshuicalculator.com/rules/" rel="noopener noreferrer"&gt;rule provenance register&lt;/a&gt; lists every rule with its classical source — including texts whose attribution the Siku cataloguers doubted; those are flagged, not laundered.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We don't do predictions.&lt;/strong&gt; No fortune verdicts, no "lucky direction" scores, no guarantees. The engine computes markers the tradition defines (a day officer, a flying-star chart, a Kua number); turning those into advice is a different product, and a legally different one in many jurisdictions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Citations are provenance, not endorsement.&lt;/strong&gt; A rule cites the text it descends from (&lt;code&gt;rule_id → text → juan&lt;/code&gt;), exactly as our &lt;a href="https://fengshuicalculator.com/texts/" rel="noopener noreferrer"&gt;text register&lt;/a&gt; assesses that text's attribution status.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it's for
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Builders of astrology/metaphysics apps who don't want to re-verify a lunar calendar&lt;/li&gt;
&lt;li&gt;AI agents that need deterministic calendar maths with a replayable audit trail&lt;/li&gt;
&lt;li&gt;Practitioners who need batch charts and reproducible case records (there's a workbench with an offline license key)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The free tier is a permanent charter: the calculators, the almanac, and the free API tier don't shrink. Pro ($4.99 day pass / $19 month) adds workflow — batch charts, exports — not "more accurate numbers" (&lt;a href="https://fengshuicalculator.com/pro/" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Site: &lt;a href="https://fengshuicalculator.com" rel="noopener noreferrer"&gt;https://fengshuicalculator.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;API docs: &lt;a href="https://fengshuicalculator.com/docs/api/" rel="noopener noreferrer"&gt;https://fengshuicalculator.com/docs/api/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MCP setup: &lt;a href="https://fengshuicalculator.com/docs/mcp/" rel="noopener noreferrer"&gt;https://fengshuicalculator.com/docs/mcp/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Rule provenance: &lt;a href="https://fengshuicalculator.com/rules/" rel="noopener noreferrer"&gt;https://fengshuicalculator.com/rules/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Accuracy report: &lt;a href="https://fengshuicalculator.com/audit/report-v1.html" rel="noopener noreferrer"&gt;https://fengshuicalculator.com/audit/report-v1.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Registry entry: &lt;code&gt;com.fengshuicalculator/fengshui-calculator&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;For entertainment and educational purposes only — this is a calculation tool for a cultural tradition, not predictions, guarantees, or advice.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>api</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
