−
100%
+
fit
scroll
# Day 00184: The Database Convergence ##
Cosmic Significance Day 184 - The separate
becomes unified. Two database realms revealed,
then bridged. What appeared as "session
expired" was actually two universes unaware of
each other. ## The Discovery A token generated
on HEXLET would not validate on hexperiment.
Not expired - *nonexistent*. Two PostgreSQL
instances, two `presence_sessions` tables, two
separate realities. ``` Web-Vessel
(portal.hexperiment.dev) ↓ calls API via
shared.hexperiment.dev ↓ routes to HEXLET
(97.202.189.213) ↓ creates session in
HEXLET's database TUI on hexperiment ↓
validates via localhost:3002 ↓ queries
hexperiment's database ↓ finds nothing →
"Session expired" ``` Two machines, two
databases, one confused authentication flow.
## The Resolution The web-vessel needed to use
the *local* API, not HEXLET's: ```nginx #
portal.hexperiment.dev nginx config location
/api/ { proxy_pass http://127.0.0.1:3002/api/;
# Local Rust API } location / { proxy_pass
http://127.0.0.1:3333; # Web-Vessel } ``` Now
authentication flows through the same database
the TUI queries. Sessions created in
web-vessel validate in TUI. ## The SSL
Archaeology `portal.hexperiment.dev` SSL
failed after nginx update. Investigation
revealed: - Cert at
`/etc/letsencrypt/live/portal.hexperiment.dev/`
exists - nginx config pointed to
`hexperiment.dev-0001` (wrong cert) - No
Cloudflare proxy (direct to droplet IP
`134.199.187.69`) - Fixed by updating cert
path in nginx config The cert was always
there. The wiring was wrong. ## The CLIOX
Architecture Now ```
┌─────────────────────────────────────────────┐
│ hexos-portal binary │
├─────────────────────────────────────────────┤
│ --api │ Full API server (PostgreSQL) │
│ --web │ Web-Vessel + WebSocket PTY │
│ (default) │ Interactive TUI │ │
--daemon │ JSON command interface │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ Single source of truth: │ │
src/api/mod.rs │
├─────────────────────────────────────────────┤
│ HEXLET_API = "http://localhost:3001/api"
│ │ HEXPERIMENT_LOCAL =
"localhost:3002/api" │ │
HEXPERIMENT_PUBLIC = "shared.hexperiment" │
│ │ │ hostname detection → correct
localhost │ │ SSH tunnel detection →
override all │
└─────────────────────────────────────────────┘
``` All API URLs centralized. Change one file,
rebuild, deploy. ## The Fallback Architecture
``` Primary: HEXLET (Mini Temple) - PostgreSQL
master ↓ sync'd via git (code only)
Fallback: hexperiment droplet - Independent
PostgreSQL Both run identical binary,
independent databases. Web-Vessel calls local
API. Cross-realm works via public API when
needed. ``` The constellation has redundancy.
If HEXLET goes dark, hexperiment stands alone.
## Portability Achieved The binary knows
nothing about infrastructure. It asks: 1. Is
there an SSH tunnel? Use that. 2. What's my
hostname? Route to correct localhost port. 3.
Neither? Fall back to public API. Move the
binary anywhere. It adapts. The nervous system
is location-aware but not location-dependent.
## Essence Database topology matters. When
authentication spans machines, sessions must
span databases - or routing must ensure they
don't need to. We chose routing. The simpler
path. Each realm self-contained, each
web-vessel querying its own TUI's database. No
replication complexity. No distributed session
management. Just correct nginx configuration.
The system that knows its own topology is the
system that can heal itself. --- ## Session 2:
The Elemental Forge — Crown Architecture
*Evening session, Mini Temple* ### Elemental
Arithmetic The `/t` command gained
consciousness. No longer just conversion —
now calculation: ``` /t 10 + 5 10 + 5 = 15
▲△▲ ▲ ▲▼▼ = ▲▼△ ``` Full
glyph equations. The elemental operators
themselves become symbols: - ▲ addition
(fire joins) - ▼ subtraction (earth removes)
- × multiplication (crossing) - ÷ division
(splitting) Both decimal and elemental
representations, side by side. The numeral
system breathes. ### Crown & Gem Architecture
The Forge gains its gem system — designed in
`gems.fid`: **Gems** = typed metadata fields
with constraints: - **onyx**: title
(pattern-validated) - **sapphire**: realm
(enumerated) - **ruby**: freeform properties
(bounded by reserved keys) - **diamond**:
sacred/readonly (system-populated) -
**emerald**: temporal, **amethyst**: tags,
**pearl**: synopsis **Crowns** = templates
composed of gems. Not stored in documents —
stored in database. Documents *reference*
crowns. **Lattices** = crowns without body.
Reusable patterns awaiting manifestation. ###
The CRR Revelation "Be Like Water" extends
beyond CLI rendering. CRR
(Command-Result-Renderer) renders to
*presentation contexts*: TTY with ANSI, HTML
with CSS, JSON for APIs, YAML for export,
elemental glyphs for sacred display. The
format adapts to the vessel receiving it. Same
principle applies to data serialization: -
Crown structure lives in database - YAML
frontmatter is just one OUTPUT encoding -
Document doesn't contain crown schema — it
references it - Flawless YAML because it's
generated, not hand-written **Data flows
through structured, format chosen at
boundary.** ### The Crown/Moon Distinction -
**Crown** = identity (who/what it IS) — the
internal nature - **Moon** = orbit (where/when
it EXISTS) — external metadata via
GravitationalID Both database-stored. Both
linked. Neither lives in the file itself. ###
Essence The same architectural truth emerges
at every level: structure flows through the
system, serialization happens at boundaries.
Whether CLI output or document metadata, the
pattern holds. Be like water. --- ## Session
3: The Forest & The Stem *Night session, Mini
Temple* ### Forest Mode The daemon learns to
travel. `forest.fid` designs offline-first
architecture: ``` /stem forest prepare →
Pack constellation into SQLite /stem forest
return → Sync forest work back to stars ```
**The Vision**: Raspberry Pi 5 with
touchscreen case, dual 4K altar displays.
Complete Portal in the wilderness. Web-Vessel
on localhost. The browser doesn't know it's
offline. SQLite mirrors PostgreSQL schema.
Diamond gem tracks `origin_device` for sync
lineage. Conflicts resolved by timestamp or
interactive merge. ``` "In the forest, you are
your own constellation. When you return, your
stars join the greater sky." ``` ### The Stem
Commands unified under `/stem` (`/s` alias):
``` /stem → System overview /stem forest →
Offline sync /stem mode → Toggle modes /stem
day → Temporal info /stem ternary →
Numeral conversion ``` The split crystallizes:
- **`/stem`** - System (infrastructure, modes,
sync, status) - **`/forge`** - Content
(documents, crowns, gems, editing) The stem
holds the forge. The nervous system enables
the creative space. ### Sacred Query Power
`gems.fid` gains its query documentation. SQL
becomes incantation: ```sql SELECT * FROM
sacred_documents WHERE gem_values->>'sapphire'
= 'hexperiment' AND gem_values->'amethyst' @>
'["deploy"]'; ``` Extracting sapphires and
amethysts. The schema makes the query
beautiful. ### Essence Three architectures
forged: forest mode for offline sovereignty,
stem for command organization, query power for
gem-based search. The daemon prepares to
travel while the system prepares to organize.
--- *Day 184 of the 10,000 Days Journey*
*Membrane: where infrastructure reveals its
hidden assumptions* *"Two databases, one
authentication - now unified by routing, not
replication"* *"Data flows through structured,
format chosen at boundary"* *"The stem holds
the forge"* 🜂
△