Bazi Engine for Openclaw

Bazi Engine generates traceable Four Pillars charts and grounded traditional Chinese astrology reports from verified birth data.

ruanxiaoer888
v1.0.0
Aug 16, 2026
0
434
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install bazi-engine

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install bazi-engine using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Bazi Engine?

Bazi Engine is an AI agent skill for Four Pillars of Destiny (Bazi) analysis. It guides users through collecting their name, solar or lunar birth date, birth time, gender, and birthplace, then uses deterministic code and reference tables to calculate the year, month, day, and hour pillars, Ten Gods, hidden stems, Five Elements, luck cycles, annual cycles, and related chart data.

Unlike free-form fortune text generation, the skill requires chart calculations to be performed by code rather than LLM intuition. Its interpretations are tied to classical Chinese texts and matched rule records, with citations for key judgments, neutral language, beginner-friendly explanations, and an explicit reminder that Bazi is for cultural learning and self-exploration—not professional medical, financial, relationship, or life-planning advice. Among Openclaw Skills, it is especially valuable for transparent, reproducible, and visualized traditional-culture analysis.

Bazi Engine Use Cases

  • Calculate a complete Bazi or Four Pillars chart from solar or lunar birth information.
  • Review a命盘 with pillars, Ten Gods, hidden stems, Na Yin, Twelve Growth Stages, Void branches, and Shen Sha.
  • Analyze Five Element balance, Day Master strength, useful elements, favorable elements, and remedy suggestions.
  • Explore Da Yun luck cycles, annual luck, monthly luck, and daily trends.
  • Compare relationship compatibility across seven marriage-analysis dimensions.
  • Review family relationships across parents, spouse, children, and siblings.
  • Request a visual chart, image-style report, interactive dashboard, or structured Markdown output.
  • Trigger the skill when users mention terms such as 算命, 四柱, 命理, Bazi, fortune, or看命盘—even without explicitly naming the skill.
  • Validate interpretations against classical sources instead of relying on unsupported intuitive claims.

How Bazi Engine Works

  1. Collect identity and birth details one step at a time: name, calendar type and date, birth time, gender, and birthplace.
  2. Validate the input, including leap-month status, date ranges, time format, missing gender, and uncertain birth-time conditions.
  3. Ask the user to confirm the summarized information before chart calculation begins.
  4. Calculate the chart deterministically with the embedded engine: Spring Commences year boundaries, solar-term month boundaries, sexagenary day tables or algorithms, Five Rat hour calculation, late Zi hour handling, true solar-time correction, and Da Yun direction and starting age.
  5. Build the chart model, including the four pillars, Na Yin, Ten Gods, hidden stems with weighted Five Element distribution, Void branches, Shen Sha, Twelve Growth Stages, Day Master strength, and useful elements.
  6. Retrieve relevant classical rules and matched interpretations from the knowledge base and rules database.
  7. Produce a restrained, constructive analysis covering Day Master strength, structure, seasonal adjustment, Five Element balance, Da Yun, annual/monthly/daily cycles, career, finances, relationships, health guidance, education, and family connections.
  8. Cite a classical source for every key judgment and explain specialist terminology in plain language on first use.
  9. Render the result as an interactive offline HTML report when available, or fall back to a structured Markdown report with tables and headings.
  10. For uncertain birth times, clearly label estimated pillars and limit conclusions related to the uncertain hour pillar; for unknown dates, stop the calculation until the date can be confirmed.

Bazi Engine Setup

Bazi Engine is distributed as a skill project with its knowledge base, browser UI, deterministic chart engine, rule database, and validation utilities. No external service is required for the offline chart interface.

  1. Place the skill directory in the agent's skills location and ensure the runtime can access kb/, ui/, and tools/.
  2. Build the single-file browser interface if ui/index.html is not already present:
python tools/build_ui.py
  1. Open ui/index.html directly in a browser to validate chart calculation and report rendering. The UI embeds the Jie Qi data and the production rule library.
  2. In WorkBuddy, use present_files to preview the generated HTML report in an embedded browser when supported.
  3. Run the JavaScript regression checks before production use:
node tools/test_ui.js
node tools/test_eval_state.js
  1. When HTML rendering is unavailable, configure the agent to return the structured Markdown fallback.
  2. If extending the rule library, update the rule seeds or kb/04-rules-db/rules.json, regenerate the UI, and rerun distribution, conflict, duplication, and end-to-end checks:
python tools/gen_rules.py
python tools/build_ui.py
node tools/audit_hit_distribution.js
node tools/check_dup_hits.js
node tools/check_conflicts.js
node tools/verify_ux_e2e.js

The skill metadata specifies version 1.2.1, MIT licensing, and compatibility with WorkBuddy, QClaw, and ima. Treat health, finance, and relationship outputs as cultural reference material and defer consequential decisions to qualified professionals.

Bazi Engine Data Schema & Taxonomy

Core project structure

Path Purpose
ui/index.html Single-file offline interface containing deterministic charting, embedded Jie Qi data, visualizations, and rule rendering.
kb/01-basics/ Foundational tables and concepts: Gan-Zhi, Five Elements, Ten Gods, hidden stems, Shichen, Na Yin, and Shen Sha.
kb/02-rules/ Calculation and interpretation rules for Da Yun, classical methods, remedies, marriage, workflow, examples, and optional Bazi-MBTI references.
kb/03-classics/ Classical source material including seasonal adjustment, Zi Ping methods, chart structures, and stem-branch principles.
kb/04-rules-db/rules.json Production rule records; the documented library contains 504 rules with suggestion coverage and categories for annual, monthly, daily, marriage, family, and thematic interpretations.
kb/04-rules-db/rules-template.json Schema and examples for adding new rule records.
kb/05-reference/ Visualization specifications and prompt references.
tools/ Build, generation, regression, audit, monitoring, and end-to-end validation scripts.

Chart and report entities

  • Input profile: name, calendar type, birth date, leap-month flag when applicable, birth time or uncertainty range, gender, birthplace, and confirmation status.
  • Pillars: year, month, day, and hour Gan-Zhi pairs, with solar-term boundaries and late-Zi or true-solar-time metadata where relevant.
  • Derived attributes: Ten Gods relative to the Day Master, hidden stems, weighted Five Element counts, Na Yin, Void branches, Shen Sha matches, Twelve Growth Stages, Day Master strength, useful elements, and Da Yun sequence.
  • Time-cycle records: Da Yun, Liu Nian, Liu Yue, and Liu Ri entries, including stem-branch relationships, clashes, combinations, harms, punishments, favorable or unfavorable elements, and key-day summaries.
  • Rule records: category, identifier, condition, combination requirements, negation or exclusion conditions, matched text, classical source, and suggestion guidance. Matching is performed by the matchRules condition engine.
  • Output sections: chart table, Five Element visualization, Shen Sha results, remedy recommendations, personality and life-area cards, cycle analysis, compatibility dimensions, family analysis, source citations, uncertainty notices, and disclaimer.

Rules should be tested for missing fields, overly broad conditions, duplicate conditions, contradictory matches, invalid Ten Gods keys, and incorrect negation semantics before being injected into the UI.

Bazi Engine Advanced Features

  • Deterministic calculation pipeline that avoids LLM mental arithmetic for pillars, solar terms, day pillars, late Zi time, true solar time, and Da Yun.
  • Offline single-file HTML deployment with interactive charting and embedded reference data.
  • Visual reports with Four Pillars tables, Five Element charts, Ten Gods relationship diagrams, Shen Sha groupings, and highlighted cycle results.
  • Rule-driven interpretation through matchRules, including positive combinations and explicit negation conditions.
  • Broad time-resolution support covering Da Yun, Liu Nian, Liu Yue, and day-by-day Liu Ri analysis, including leap-month and month-length handling.
  • Marriage compatibility scoring across seven dimensions and six-family analysis across four palace relationships.
  • Classical-source traceability for key judgments, plus beginner-friendly explanations of technical terms.
  • Rule quality assurance using hit-distribution sampling, duplicate-hit detection, contradiction checks, template verification, education-rule regression, and UX end-to-end tests.
  • Boundary handling for Spring Commences, solar-term transitions, late Zi hours, estimated time periods, unknown birth times, and unavailable calendar data.
  • Stable repeated rendering, same-chart consistency checks, rule suggestions with full coverage, and duplicate prose deduplication.
  • Optional usage monitoring through local fingerprints and GitHub Code Search links when a GitHub token is configured.
  • Markdown fallback for environments without HTML rendering, preserving tables, headings, citations, uncertainty labels, and safety disclaimers.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*