Astrology Semantics — High-Level Design
Reading guide: The current package architecture defines the binder boundary. Sections below describe reference designs unless an implementation note says otherwise. Standalone facade, cache and provenance services are dropped; their integration responsibilities belong to the consumer.
Status: Draft for review · Part of: Astro Binder · Updated: 2026-10-24
The module turns canonical astronomy into signs, nakshatras, padas, motion, aspects and houses. It is pure, in-process, with no provider, network, clock or locale.
The pure derivations are implemented in the separate
@astrology/astrology-semantics package.
The package guide describes the exported functions, default aspect profile and caller-owned
context checks. The diagram below remains the reference design for the wider binder.
1. Purpose
Two providers can return the same longitude yet produce different charts if each feature implements its own rules. This module implements them once, so charts, transits and panchang agree on sign and nakshatra.
It answers meaning, not position:
- Which sign and degree within it?
- Which nakshatra and pada?
- Is the body retrograde?
- Which aspects are in orb, applying or separating?
- Which house holds the body?
2. Where it sits
canonical positions + houses ──▶ astrology semantics ──▶ semantic annotations
- Upstream: the canonical normalizer resolves units, frame and zodiac.
- Downstream: the calculation facade attaches annotations.
- Never: calls a provider, reads a cache, writes storage.
3. Responsibilities
| Component | Owns | Deterministic rule |
|---|---|---|
| Sign + degree | 12 signs from 0° Aries | sign = floor(longitude / 30), degree = longitude mod 30 |
| Nakshatra + pada | 27 nakshatras from 0° sidereal Aries | nakshatra = floor(longitude / 13°20′), pada = floor((longitude mod 13°20′) / 3°20′) + 1 |
| Motion state | Retrograde flag, speed exposure | retrograde = speedLongitude < 0, except a declared node convention |
| Aspects | Separation, orb, applying/separating | Shortest arc against the orb profile |
| House placement | Cusp interval holding a body | Cusps in zodiacal order, wrap at 360° |
| Reference tables | Sign, nakshatra, orb definitions | Read-only, versioned |
4. Architecture
Diagram: reference design, not deployed behaviour.
The module is small pure functions over one canonical input, with no orchestration and no request spine. Any subset of derivations can be requested without changing the others.
5. Rules
- One ayanamsa subtraction. Longitude already sits in the requested zodiac; a second subtraction is a defect, not a configuration.
- Sidereal meanings stay sidereal. Nakshatra and pada are
nullfor a tropical request, never derived from a mixed zodiac. - No rounding. Full double precision; serialisation rounds once, in the normalizer’s output contract.
- Canonical identifiers only.
aries,ashwini,conjunction— lowercase; labels and translations stay in the client. - Half-open intervals. Boundary longitude starts the next sign, nakshatra or house:
[0, 30)is Aries,30.0is Taurus. - Unknown input is rejected upstream. Validated values only; no defaults for missing bodies or cusps.
6. Edge cases
| Case | Behaviour |
|---|---|
| Longitude 359.9999° | Wraps for aspects; sign is Pisces, not Aries |
| Exact boundary (30°, 13°20′, cusp) | Next interval, per the half-open rule |
| Mean vs true node | Differs near boundaries; response records nodeType |
| Retrograde station | Near-zero speed follows speedLongitude sign; no hysteresis |
| Applying vs separating | Relative speed and shortest arc, not orb size |
| Houses at high latitude | Engine rejects upstream; never guesses a cusp |
| Tropical + nakshatra request | Omitted, not converted silently |
7. Out of scope
- Provider selection, caching, retries, provenance (facade, router).
- Unit, frame and zodiac conversion (normalizer).
- Interpretations, dignity scoring, yogas, dasha periods (later product logic).
- Localised names and glyphs (presentation layer).
8. Planned code
| Piece | Responsibility |
|---|---|
semantics/SignResolver |
Sign and degree |
semantics/NakshatraResolver |
Nakshatra, pada, sidereal guard |
semantics/MotionResolver |
Retrograde, node state |
semantics/AspectResolver |
Separation, orb, applying/separating |
semantics/HouseResolver |
Cusp interval, whole-sign |
semantics/ReferenceTables |
Versioned sign, nakshatra, orb data |