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



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
- The Premise
- Challenge #1: Respecting Two 4,000-Year-Old Traditions
- Challenge #2: Real Astronomical Calculations
- Challenge #3: When Claude Held Out On Me (Information Architecture)
- The Architecture: 2:2:1 Balance
- Technical Deep Dive
- Try It Yourself
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. Completely absurd. And then I thought: what if I tried building something like that?
So I started learning about how different cultures tracked the stars. And yes—I'm definitely capitalizing on everyone suddenly being in a Chinese time in their life. But 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 - understanding the lunar mansion system (二十八宿), the Five Elements theory (五行), how Western aspects work, what the actual calculations looked like. Then figuring out how to implement them using NASA's JPL DE441 ephemerides instead of approximations.
I've always enjoyed the night sky - used to want to be an astronaut as a kid, after all. People have been trying to read the stars for millennia using genuinely clever systems. Here's the thing though: I didn't want a personality quiz. I wanted a coin-flip decision tool. "Is today auspicious?"
So I focused on predictive astrology (timing/date selection) rather than personality astrology (zodiac signs). That means:
- 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.
Instead of zodiac signs that tell you personality traits based on birth month. Different use case, equally valid, just solving a different problem.
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 curious about a different angle: what if I tried implementing the astrological systems themselves more thoroughly? Like:
- Actually implementing the ancient systems instead of using approximations
- Balancing Chinese and Western astrology 50/50 without one dominating
- Using real astronomical calculations (NASA ephemerides)
- Incorporating documented physiological effects (barometric pressure genuinely affects headaches)
- Being completely transparent about formulas
- Being honest about what's science vs. tradition
Also I thought it would be fun to use. And the retro terminal aesthetic is sick. (This is important.)
Turns out yes to all of the above. But it required a lot of back-and-forth with Claude about Qing Dynasty texts and NASA ephemeris documentation.
Challenge #1: Respecting Two 4,000-Year-Old Traditions
The Problem
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.
The Solution: 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 equal 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:
mansion_index = ⌊moon_longitude / 12.857142857⌋ mod 28
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—they come from centuries of traditional date selection (择日, zérì) used in everything from wedding planning to business openings.
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 system (astronomers call it Julian Day Number), maintaining consistency with the traditional Chinese calendar that's been used for over 2,000 years.
Challenge #2: Real Astronomical Calculations
The Goal
If I'm building an astrology thing, I at least wanted to know where the planets actually are. Not "close enough" - like, actually where they are in the sky right now.
The Solution: NASA's Planetary Position Data
I used a library called Astronomy Engine that implements NASA's JPL DE441 ephemeris.
Wait, what's an ephemeris? It's basically a 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. Plus the library was free and well-documented, so why not?
What this 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? Yes. Was it fun to implement? Also yes.
Challenge #3: When Claude Held Out On Me (Information Architecture)
The Problem
After getting the basic system working, I was confused about one thing: why did 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. Without houses, you know "Jupiter is trine your natal Sun" but not whether that affects your career, your love life, or your health.
This was a gap in my understanding of what Western astrology actually does. Transits without house context are like knowing you got a package without knowing which room it's in.
The Design Challenge
This created an interesting problem: 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 = 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, now you know where to apply it.
The Implementation
Implemented the Placidus house system (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 = wrong houses = wrong interpretations.
Added a verification step: type your location, click "Verify," see "Portland, Oregon (45.52°N, 122.68°W)" before saving. Problem solved.
Critical invariant maintained: 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."
Information architecture, not calculation inflation.
Being Honest About What's What
While implementing this, I made sure to separate what's measured from what's interpreted. The methodology breaks it down:
Measured (100% verifiable): Astronomical positions (NASA data), weather, 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. But the underlying astronomical calculations are NASA-grade precise, and some correlations (pressure → headaches) are documented. The system is transparent about which is which.
And 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: The Fun Stuff
Aspect Detection: Checking 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 forecast) or current-to-natal positions (for personalized transits).
Deterministic Reading Generation
Same date + location = identical 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
Real Error Propagation
The 95% confidence interval reflects measurement uncertainty, not predictive accuracy. I'm measuring the astronomy and weather accurately—what you do with that information is up to you.
I calculate actual uncertainty from all the components (σ is the error margin, basically how precise each measurement is):
σ_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 with Birth Charts
Users can save their birth chart (date, time, location) for personalized readings that differ from generic daily forecasts.
Privacy note: All birth chart data is stored in your browser's localStorage—nothing is sent to a server. Your personal information never leaves your computer. Clear your browser data and it's gone.
Western Personalization: Transits (±4%)
- Calculate planetary positions at your birth time
- Compare current planet positions to your birth positions
- Find aspects between current and natal planets
- Score beneficial transits (trines, sextiles) vs challenging (squares, oppositions)
- This adds ±4% modifier to your score based on YOUR personal transits today
Example: "Transit Jupiter △ Birth Sun" gives you a boost today, even if others don't have this.
Chinese Personalization: Bazi Harmony (±4%)
- Calculate your birth day's Heavenly Stem (天干) and Five Element
- Compare today's Five Element to yours using productive/destructive cycles
- Wood feeds Fire (+boost), Wood parts Earth (-penalty), etc.
- This adds ±4% modifier based on elemental interaction
Example: Born on Wood day, today is Fire day → Wood feeds Fire → +boost for you specifically.
Perfect Balance: Guest mode (±12% West, ±12% East). Profile mode (±16% West, ±16% East). Still 50/50!
The Retro Terminal UI
The interface is a retro terminal with:
Features:
- Line-by-line animation (skipped for cached results)
- MS-DOS-style window chrome
- Tab navigation (Output, Profile, Methodology, Help)
- Responsive design (works on mobile!)
Try It Yourself
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.
Final Thoughts
I still don't know if astrology is real. Probably not? But I had fun building this.
The whole thing started because I saw that Linux scheduler tweet and thought it was hilarious. Then I got curious about the actual systems people use to read the stars—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.
So I built something that executes on the joke with care. Equal weight for both traditions, real NASA data, transparent about what's measured vs. what's interpretation. The methodology document is like 600+ lines because I wanted you to be able to see every formula, every weight, every source.
Your data stays on your computer. Birth charts are stored in 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.
Now I have a thing I can use for my coin flip decisions. Sometimes the reading is oddly relevant. 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. Type in your city, get a reading. Check the Methodology tab if you want to see the formulas.
It's pseudo-science done carefully. Which is the best I can do.
Technical notes: 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.
Special 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.