ASTROCOMP.EXE: Building a Chinese-American Fusion Astrological System

Cover Image for ASTROCOMP.EXE: Building a Chinese-American Fusion Astrological System
Nathan Tang
Nathan Tang
15 minutes

UPDATE (January 2026): ASTROCOMP v2.0.0 removed the weather/barometric pressure component to become a pure celestial calculation system. This eliminated the need for location input and weather APIs, making the tool work offline and for any past/future date. The core 50/50 Chinese-Western balance remains unchanged. Technical details in this post about weather integration are now historical. See current methodology →

Table of Contents

I came across this tweet about scx_horoscope, a Linux CPU scheduler that makes scheduling decisions based on planetary positions and zodiac signs. Someone actually built a kernel scheduler that prioritizes processes based on their horoscope. It works. There's a demo video.

I thought it was the funniest thing I'd seen in weeks. And then I thought: what if I tried building something like that?

So I started going down the rabbit hole of how different cultures tracked the stars. And yes — I'm definitely capitalizing on everyone suddenly being in a Chinese time in their life. But I was also genuinely curious. Why did Chinese astronomers divide the sky into 28 lunar mansions? What were Western astrologers actually calculating with planetary aspects? How did people use these systems for thousands of years?

I spent a lot of time with Claude going through the basics — the lunar mansion system (二十八宿), Five Elements theory (五行), how Western aspects work, what the actual calculations look like. Then figuring out how to implement all of it using NASA's JPL DE441 ephemerides instead of approximations.

I've always loved the night sky. Used to want to be an astronaut as a kid. People have been trying to read the stars for millennia using genuinely clever systems, and I wanted to explore that. But I didn't want to build a personality quiz. I wanted a coin-flip decision tool. "Is today auspicious?" That's it.

So I focused on predictive astrology (timing and date selection) rather than personality astrology (zodiac signs):

  • Western: Planetary aspects — geometric relationships that change daily, used in electional astrology for picking auspicious times
  • Chinese: Lunar mansions — traditional date selection (择日, zérì), used for thousands of years to pick wedding dates, business openings, etc.

Different use case than zodiac signs. Equally valid, just solving a different problem.

Try ASTROCOMP.EXE →

Why I Actually Built This

The Linux astrology scheduler is genuinely cool — actual kernel-level horoscope integration is hilarious and technically impressive. But it got me thinking about a different angle: what if I tried implementing the astrological systems themselves more thoroughly?

Like, actually implementing the ancient systems instead of approximations. Balancing Chinese and Western astrology 50/50 without one dominating. Using real NASA data. Being completely transparent about every formula. And being honest about what's science versus what's tradition.

Also I thought it would be fun to use. And the retro terminal aesthetic is sick. (This is important.)

All of the above turned out to be true. But it required a lot of back-and-forth with Claude about Qing Dynasty texts and NASA ephemeris documentation, which is a sentence I never expected to type.

Respecting Two 4,000-Year-Old Traditions

Most "fusion" astrology systems are just Western astrology with some Chinese zodiac animals slapped on. That's not fusion — that's decoration. I wanted to actually combine both systems with equal weight, not have one be the "main" thing with the other as flavor text.

The 2:2:1 Architecture

I designed a balanced weighting system where each component acts as a multiplier around a neutral baseline:

WESTERN CELESTIAL (±12% combined influence):
  • Planetary aspects (±8%): Trine, sextile, square, opposition analysis
  • Lunar phase (±4%): Waxing/waning cycle influence

CHINESE CELESTIAL (±12% combined influence):
  • Lunar mansions / 二十八宿 (±6%): 28 mansions across 4 celestial palaces
  • Five Elements / 五行 (±6%): Daily heavenly stem from 60-day cycle

EARTHLY - NEUTRAL (±8% combined influence):
  • Weather discomfort (max -5%): Quadratic rain probability scaling
  • Barometric pressure (±6%/-4.5%): Physiological effects documented

The percentages are multiplicative modifiers — each component can shift the final score up or down. Western and Chinese systems get equal weight (±12% each), with earthly/weather factors contributing a smaller amount (±8%). Starting from a neutral baseline of 0.5, these modifiers compound to create the final reading.

Perfect 50/50 balance. Neither tradition dominates. This was non-negotiable. I checked the math like five times.

Chinese Lunar Mansions (二十八宿)

The Twenty-Eight Lunar Mansions are a 4,500+ year old system that divides the Moon's path across the sky into 28 segments. Each segment represents where the Moon is relative to the background stars (not the Sun). Each mansion has traditional auspiciousness associations from texts like the Xie Ji Bian Fang Shu (協記辯方書).

The calculation is surprisingly simple:

mansion_index = ⌊moon_longitude / 12.857142857⌋ mod 28

Some example mansions:

  • 軫 (Zhěn, Chariot) — Highly auspicious [+0.90]: Excellent for business, travel
  • 鬼 (Guǐ, Ghost) — Very inauspicious [-0.80]: Avoid weddings, major events
  • 角 (Jiǎo, Horn) — Beneficial [+0.80]: Good for construction, new ventures

These aren't random assignments. They come from centuries of traditional date selection (择日, zérì) used in everything from wedding planning to business openings. People took this seriously.

Five Elements & Heavenly Stems (五行/天干)

The Five Elements (Wood → Fire → Earth → Metal → Water) cycle through ten Heavenly Stems combining yin-yang polarity:

  • 甲 (Jiǎ, Yang Wood): Growth, expansion, new beginnings [+0.50]
  • 丙 (Bǐng, Yang Fire): Visibility, public events, clarity [+0.60]
  • 己 (Jǐ, Yin Earth): Nurturing, hospitality, agriculture [+0.50]
  • 癸 (Guǐ, Yin Water): Rest, introspection, subtle influence [+0.30]

The daily stem is calculated using a continuous day count (Julian Day Number), maintaining consistency with the traditional Chinese calendar that's been in use for over 2,000 years.

Real Astronomical Calculations

If I'm building an astrology thing, I at least wanted to know where the planets actually are. Not "close enough" — actually where they are in the sky right now.

I used a library called Astronomy Engine that implements NASA's JPL DE441 ephemeris. An ephemeris is basically a giant lookup table of where planets are at any given time. NASA uses these to navigate spacecraft — if you're sending a probe to Mars, you need to know exactly where Mars will be months from now, down to fractions of a degree.

Does that level of precision actually matter for astrology? Probably not. Your birth location is usually accurate to maybe a city, which is way less precise than arcseconds. But I thought it was cool to use the same data NASA uses, and the library was free and well-documented, so why not.

What it gives me:

  • Actual planetary positions at any moment (not rounded approximations)
  • Proper lunar phase calculations
  • Real distances in astronomical units
  • The ability to calculate birth charts and transits accurately

Example output:

Sun     : 05h 57m 23.45s / +22° 14' 39.82" / 0.984 AU / λ=308.394°
Moon    : 09h 12m 45.67s / +15° 32' 18.91" / 385,234 km / λ=138.192°
Mercury : 05h 23m 12.34s / +20° 45' 33.12" / 1.023 AU / λ=300.798°

Is this overkill for a coin-flip astrology website? Absolutely. Do I care? Not even a little.

When Claude Held Out On Me

After getting the basic system working, I was confused about one thing: why do birth charts need location? Date and time should be enough for planetary positions, right?

Turns out I was missing a fundamental Western astrology concept: house systems. Houses divide the sky into 12 life areas (career, relationships, home, etc.) and tell you where planetary transits manifest in your life. Without houses, you know "Jupiter is trine your natal Sun" but not whether that affects your career, your love life, or your health. It's like knowing you got a package but not which room it's in.

This created an interesting design problem though. Houses are fundamental to Western astrology, but I couldn't let them break the 50/50 balance I'd worked so hard to achieve. Adding more Western features would mean unequal weighting.

The solution: houses provide context, not calculation weight.

// COMPUTATIONAL (affects the score):
auspiciousness = baseScore × westernScore × chineseScore × earthlyScore

// INFORMATIONAL (context only):
natalHouses = {
  ascendant: { sign: "Virgo", degree: 15.3 },
  midheaven: { sign: "Gemini", degree: 8.7 },
  cusps: [/* all 12 house positions */],
  planetHouses: [/* which house each planet occupies */]
}

Houses tell you Jupiter is in your 10th house (career) while natal Sun is in your 6th house (daily work), so that trine means career advancement through consistent effort. Same +4% boost, you just know where to apply it now.

Implementation

I implemented the Placidus house system, which is the most widely used in modern Western astrology:

  • Ascendant: Eastern horizon at birth moment — changes every ~2 hours
  • Midheaven: Highest point in sky — your career/public life trajectory
  • 12 house cusps: Where each life area begins
  • Planet placements: Which house each natal planet occupies

This required birth coordinates because the Ascendant formula depends on latitude:

HOUSE CALCULATION (WHY LOCATION MATTERS)

Birth Time (UTC) + Geographic Longitude
         ↓
 Greenwich Sidereal Time + Longitude
         ↓
 LOCAL SIDEREAL TIME (LST)
 "What's overhead right now on celestial sphere?"
         ↓
┌─────────────────────┬──────────────────────┐
│   ASCENDANT (ASC)   │   MIDHEAVEN (MC)     │
├─────────────────────┼──────────────────────┤
│ tan(ASC) = ...      │ tan(MC) = cos(LST)   │
│   -cos(LST)         │          ─────────   │
│ ───────────────     │      sin(LST)·cos(ε) │
│ sin(LST)·cos(ε) +   │                      │
│   tan(lat)·sin(ε)   │ ← NO latitude here!  │
│                     │                      │
│ ← Needs latitude! → │                      │
└─────────────────────┴──────────────────────┘
         ↓                     ↓
    House 1 cusp          House 10 cusp
         ↓                     ↓
┌──────────────────────────────────────────┐
│    TRISECT ARCS BETWEEN ANGLES           │
│    Houses 2,3 | 5,6 | 8,9 | 11,12        │
└──────────────────────────────────────────┘
                  ↓
         12 HOUSE CUSPS
  (Each planet falls in one house based on longitude)

Why "Portland" matters: Portland OR (45.5°N) vs
                        Portland ME (43.7°N)
= Different tan(lat) = Different Ascendant
= Wrong houses = Wrong life area interpretations

Which led to another problem: "Portland" could be Oregon, Maine, or UK. Wrong city means wrong houses means wrong interpretations. So I added a verification step — type your location, click "Verify," see "Portland, Oregon (45.52°N, 122.68°W)" before saving.

The important thing: houses add zero calculation weight. The 50/50 balance stays perfect. They're metadata that enriches interpretation without biasing the math.

Before: "Transit Jupiter trine natal Sun (+3.2%). Today is auspicious." After: "Transit Jupiter in your 10th house (career) trine natal Sun in your 6th house (work). Today is auspicious for career advancement through consistent effort."

Same score, way more useful context.

Being Honest About What's What

I wanted to be upfront about what's actually happening under the hood. The methodology tab separates everything into three categories:

Measured (verifiable): Astronomical positions from NASA data, weather conditions, atmospheric pressure Documented (peer-reviewed): Barometric pressure affects headaches, weather influences mood Traditional (belief-based): Astrological aspects, lunar mansions, house meanings

Astrology has no scientific validity. The astronomical calculations are NASA-grade precise, and some correlations like pressure and headaches are documented, but the astrological interpretations are tradition, not science. The system is transparent about which is which, and I think that matters.

All your data stays on your computer — birth charts are stored in localStorage, nothing goes to a server.

The Architecture

(Skip this if you're not a programmer — it's implementation details.)

Core Stack:

  • Next.js 15 / TypeScript / Astronomy Engine (JPL DE441)
  • Custom terminal UI with retro MS-DOS aesthetic
  • Server-side rate limiting (10 req/min) + weather API integration (wttr.in)
  • localStorage for birth charts (zero server-side storage)

Key algorithms:

  • Lunar mansion calculation (28-division ecliptic)
  • Heavenly Stem (continuous day count mod 10)
  • Placidus house system (LST → Ascendant/Midheaven → 12 cusps)
  • Aspect detection with orb adjustment

Technical Deep Dive

Aspect Detection: 45 Planet Pairs

Every planetary reading checks all possible planet pairs for geometric relationships. With 10 bodies (Sun, Moon, + 8 planets), that's C(10,2) = 45 pairs to check.

ASPECT DETECTION PIPELINE

10 Planets → 45 Pairs
(Sun-Moon, Sun-Mercury, ... Neptune-Pluto)
     ↓
For each pair:
  angle = |planet1.λ - planet2.λ| mod 360°
  if angle > 180°: angle = 360° - angle
     ↓
Check against aspect types:
  Conjunction  : 0°   ± orb → Neutral/Mixed
  Sextile      : 60°  ± orb → Harmonious (+)
  Square       : 90°  ± orb → Tense (-)
  Trine        : 120° ± orb → Harmonious (+)
  Opposition   : 180° ± orb → Tense (-)
     ↓
Orb = tolerance window (larger orb for Sun/Moon)
  Sun/Moon: 8° orb  (more "influential")
  Others:   6° orb
     ↓
Sum all aspect scores → Western modifier
(Trines/sextiles boost, squares/oppositions drag)

This runs on every reading — comparing current planetary positions for daily forecasts, or current-to-natal positions for personalized transits.

Deterministic Readings

Same date + location always produces the same reading. Otherwise debugging would be a nightmare.

I built a seeded random number generator:

// Linear Congruential Generator
seed_next = (seed_current · 1664525 + 1013904223) mod 2³²

// Seed from date + location
date_seed = YYYY·10000 + MM·100 + DD
location_seed = ⌊latitude·1000⌋ + ⌊longitude·1000⌋
seed = date_seed + location_seed

Error Propagation

The 95% confidence interval reflects measurement uncertainty, not predictive accuracy. The astronomy and weather are measured accurately — what you do with that information is up to you.

The uncertainty comes from all the components:

σ_total = √(Σ σ_i²)

Component uncertainties:
- Planetary positions: ±1 arcsecond (JPL DE441 spec)
- Aspect orb: ±0.001° (calculation rounding)
- Weather data: ±5% precipitation, ±0.5°C (API precision)
- Barometric pressure: ±1 hPa (standard barometer)

Personalized Readings

You can save your birth chart (date, time, location) for personalized readings that differ from the generic daily forecast.

Privacy note: all birth chart data lives in your browser's localStorage. Nothing gets sent to a server. I don't want your birth info, and I definitely don't want to deal with securing a database for astrology data. Clear your browser data and it's gone.

Western Personalization: Transits (±4%)

  1. Calculate planetary positions at your birth time
  2. Compare current planet positions to your birth positions
  3. Find aspects between current and natal planets
  4. Score beneficial transits (trines, sextiles) vs. challenging ones (squares, oppositions)
  5. This adds a ±4% modifier based on your personal transits today

Example: "Transit Jupiter △ Birth Sun" gives you a boost today, even if others don't have this aspect.

Chinese Personalization: Bazi Harmony (±4%)

  1. Calculate your birth day's Heavenly Stem (天干) and Five Element
  2. Compare today's Five Element to yours using productive/destructive cycles
  3. Wood feeds Fire (+boost), Wood parts Earth (-penalty), etc.
  4. This adds a ±4% modifier based on elemental interaction

Example: Born on a Wood day, today is a Fire day → Wood feeds Fire → personal boost.

Balance preserved: Guest mode gets ±12% from each tradition. Profile mode gets ±16% from each. Still 50/50.

The Retro Terminal UI

The interface is a retro terminal because the aesthetic is sick and I will not elaborate further.

Features:

  • Line-by-line animation (skipped for cached results)
  • MS-DOS-style window chrome
  • Tab navigation (Output, Profile, Methodology, Help)
  • Works on mobile, somehow

Try It Yourself

Launch ASTROCOMP.EXE →

Enter your location and get a reading. Then:

  • Click the [Methodology] tab to see the full technical documentation
  • Click [Profile] to save your birth chart for personalized transit analysis

Everything is documented in the Methodology tab — all the formulas, weights, sources, everything. The methodology doc is like 600+ lines because I wanted you to be able to see every formula, every weight, every source.

Final Thoughts

I still don't know if astrology is real. Probably not. But I had fun building this, and I think that's enough.

The whole thing started because I saw that Linux scheduler tweet and couldn't stop laughing. Then I got curious about the actual systems people use to read the stars, and it turns out they're genuinely clever. Chinese lunar mansions, Western aspects, Five Elements, house systems — different strategies that have been around for thousands of years. I wanted to do them justice while being honest about what they are.

So I built something that executes on the joke with care. Equal weight for both traditions, real NASA data, transparent about everything. Now I have a coin-flip decision tool that occasionally feels oddly relevant, and sometimes it's just cool to see what mansion the Moon is in or what house Jupiter's transiting through.

Anyway, try it → if you want. Check the Methodology tab if you're curious about the formulas.

It's pseudo-science done carefully. Which is the best I can do.


Built with Next.js 15, TypeScript, Astronomy Engine v2.1.19 (JPL DE441), wttr.in weather API, and a lot of Claude conversations about Qing Dynasty almanacs and NASA documentation.

Thanks to: Astronomy Engine by Don Cross, the wttr.in project, Karma Weather for lunar mansion interpretations, Claude for research assistance, and everyone who contributed to preserving traditional Chinese astronomical texts online.