ziwei-chart
把一个人的生辰排成十二宫紫微命盘,产出可复用的 JSON 与纯数据 Markdown;没有明确性别就不排,因为大限方向无从判定。
- 分组
- 命理
- 版本
- 0.8.4
- 许可证
- MIT
安装
/plugin install chinese-metaphysics@misoto22然后这样调用:
/chinese-metaphysics:ziwei-chart紫微斗数以农历月日安星,和八字用节气分月是两套不同的历法口径。这个技能把生辰解析成十二宫命盘:宫位、主星辅星、生年四化、大限窗口,全部写进可复核的 JSON 与纯数据 Markdown,不做任何解读。它要求明确给出性别——大限的顺逆由年干阴阳配合性别决定,缺一不可,而且绝不从姓名或称呼推断。晚子时出生会额外产出一份 00:00 换日的备用盘,因为农历日一变,紫微和跟它锚定的每一颗星都会移位。
什么时候会触发
CI 实际用来评测这个技能的 prompt——所以它们不会和技能的真实行为脱节。
会触发
- 帮我排紫微斗数:林青,女,1990-03-15 08:30,上海出生。
- Cast my Purple Star Astrology chart. Name A, male, born 1988-11-02 at 21:05 in New York City.
- 我想看自己的十二宫命盘,男,农历 1999-11-25 午时,北京。
- 排个紫微命盘:陈明,2001-07-19 14:20,成都。
不会触发
- 帮我排八字:林青,1990-03-14 07:42,上海出生。
- 解读一下刚才生成的 ziwei_林青.json。
- 我八字和紫微两张盘都有了,帮我合参看看。
- 看看我今年的流年四化怎么走。
Calculate one static twelve-palace chart, write ziwei_<name>.json and ziwei_<name>.md, then hand the verified JSON to ziwei-reading automatically. The artifacts contain placement data only; never interpret the chart here.
Route before calculating
- Four pillars, ten gods, or five-element strength belong to
bazi-chart. - Two people being matched belong to
bazi-compatibility. - An existing Zi Wei chart that needs meaning belongs to
ziwei-readingwithout recalculating. - A BaZi chart and a Zi Wei chart that both already exist, and need to be read against each other, belong to
bazi-ziwei-cross. - Annual or monthly transformations, 流年, dated events, and forecasts are outside this release; state that rather than improvising them.
Require one resolved birth record
Collect these fields without guessing:
name: display identity for the artifact.birth_place: unambiguous city/region/country.birth_date: exactYYYY-MM-DDin the declared calendar.birth_time: exactHH:MMin 24-hour form. Refuse an hour-only or approximate time; the hour branch moves both the life palace and the body palace.calendar:gregorianorlunar. A lunar date also requires explicitleap_month: true|false.timezone: historical IANA zone such asAsia/Shanghai.latitudeandlongitude: decimal degrees for the birthplace.gender: required and eithermaleorfemale. Decade cycles run forward or backward by the year's polarity combined with gender, so the direction cannot be derived without it. Ask the person; never infer it from a name, relationship, or pronoun. If they decline, say the decade ranges cannot be calculated and stop.utc_offset_minutesonly when an authoritative historical source must override IANA data.fold: 0|1only to resolve a repeated DST wall time.
Resolve a place through an available geocoder or map source. If multiple places match, stop for a location choice. Do not select the largest or most famous city silently.
Calculation contract
The shared placer applies these declared rules:
- Resolve the historical civil instant through IANA data or the explicit offset, then derive true solar time exactly as this plugin's BaZi charts do.
- Convert the resolved date to a standardized Chinese lunar date under GB/T 33661-2017. Zi Wei places every star from the lunar month and day, not from solar terms.
- Take the year pillar from the lunar year. This is not the BaZi year pillar. BaZi changes the year at Li Chun; Zi Wei changes it at lunar new year, so a January or early-February birth legitimately carries a different year stem in the two systems. Never reconcile that difference silently.
- Place the life palace by counting months forward from 寅 and hours backward; place the body palace by counting hours forward instead.
- Derive the bureau from the sexagenary sound of the life palace, then place 紫微 from the bureau and lunar day, and 天府 mirrored across the 寅-申 axis.
- Use a 23:00 day boundary. For 23:00-23:59, also emit a 00:00-boundary alternate; the lunar day differs, which moves 紫微 and every star anchored to it. Never average the two.
- Derive placements and the year transformations from
ziwei-chart-rules-v1.
Star brightness and the transformation set are declared lineage conventions, not measurements. The rules file records the school and the readings this release does not follow.
Run the placer
Work from this skill directory. Put the resolved object in a UTF-8 JSON file and run:
python3 scripts/compute_ziwei.py --request REQUEST.json --out OUTPUT_DIRECTORY --language zh
Inline JSON is also accepted:
python3 scripts/compute_ziwei.py --json '{...}' --out OUTPUT_DIRECTORY --language en
The runtime requires pyswisseph, declared in requirements.txt. If it reports the dependency missing, surface that exact installation error; do not replace the lunar conversion with an approximate date table. An optional Swiss data directory may be supplied with --ephemeris-path.
The command prints exactly two absolute paths on success: canonical JSON first, data-only Markdown second. Exit code 2 means no valid pair was created. Never create or repair one artifact manually after a placement failure.
Validate and hand off
Read the JSON back and verify:
- schema is
chinese-metaphysics.ziwei-chart, version 1; - checksum matches canonical content;
- twelve palaces exist, each with a branch, a stem, and a palace name;
- the life palace and the body palace are both marked;
- the bureau, the lunar date, and the year pillar exist;
- every placed transformation names a star that appears in a palace, and any unplaced transformation is listed rather than dropped;
- twelve decade ranges exist and run in one consistent direction;
- an alternate is complete when
alternate_day_boundaryis true; - Markdown names the same checksum and contains no interpretation.
After validation, automatically invoke ziwei-reading with the exact JSON path. Do not wait for a second user request. Do not invoke it when placement or validation failed. After the reading completes, report the chart JSON, chart Markdown, reader-report Markdown, and separate evidence-artifact Markdown paths.
Privacy and limits
Birth details are sensitive personal data. Write only to the user-selected output directory, do not send them elsewhere, and do not add unrelated identity details. This skill places static natal structure and decade ranges only: no annual or monthly transformation, no 流年, no self-transformation, no event timing, no medical or psychological diagnosis, no deterministic claims, and no compatibility verdicts.
See references/request.example.json for the request shape and references/examples.md for boundary and failure examples.