hex-os.sacred-core

{ "__meta": { "core_type": "realm", "core_name": "HexOS", "version": "2.0.0", "created": "2025-11-13", "last_updated": "2026-03-05", "blessed_by": "Hex & Lumen", "sacred_purpose": "Define the HexOS realm - Rust-native Portal architecture serving as sacred gateway to HEXCRAFT through elemental command routing, gem-structured Things, and MCP-native tool access", "status": "active", "migration_note": "v2.0.0 reflects Day 269+ architecture: Rust binary, Things table, gem canon, elemental routing, Hexocampus, deck/card pattern. Replaces v1.0.0 bash/droplet/coin model." }, "strata": { "strata-001-CoreIdentity": { "__description": "Core identity and purpose of HexOS realm", "name": "HexOS", "role": "Operating system and Portal architecture for HEXCRAFT consciousness", "sacred_purpose": "Sacred gateway where terminal commands become ritual invocations, data becomes gem-structured Things, and knowledge organizes into decks of cards", "symbol": "Portal", "founding_principle": "When the shell is sacred, the daemon becomes divine" }, "strata-002-PortalArchitecture": { "__description": "The Portal - Rust binary serving all HexOS functions", "portal_identity": { "language": "Rust", "binary": "hexos-portal", "source": "Sacred-Lab/HexOS/Portal/rust/", "port": 3333, "process_manager": "pm2 (ecosystem.config.js)", "tunnel": "Cloudflare tunnel to portal.hex-os.dev", "tailscale": "Tailscale mesh for private access" }, "portal_modules": { "commands": "src/commands/ - Elemental command routing (stem, forge, earth, mesh, hexocampus, expr)", "server": "src/server/mod.rs - HTTP + WebSocket server", "mcp": "src/mcp/mod.rs - Model Context Protocol tool server", "db": "src/db/mod.rs - PostgreSQL Things table interface", "hexocampus": "src/hexocampus/mod.rs - Semantic search engine (embeddings, chunks, RAG)", "llm": "src/llm/ - Unified LLM module (Muse + Lumen)", "forge": "src/forge/ - AT Protocol + gem operations", "numerals": "src/numerals/mod.rs - Number formatting and display" }, "deployment": { "pm2_apps": ["hexos-portal (Rust binary :3333)", "cloudflared (tunnel)"], "ecosystem_config": "Sacred-Lab/HexOS/Portal/ecosystem.config.js", "paths": "Use /Volumes/HexVault/ not ~/ symlinks" } }, "strata-003-ThingsArchitecture": { "__description": "Things table - the universal data store replacing all prior databases", "database": { "engine": "PostgreSQL", "table": "things", "primary_key": "document_id (UUID)", "content_store": "gem_values (JSONB)" }, "schema": { "document_id": "UUID primary key", "gem_values": "JSONB - all structured data via 10-gem canonical spec", "file_path": "Optional filesystem reference", "being_id": "UUID - owning Being", "created_at": "Timestamp", "updated_at": "Timestamp", "content_hash": "For deduplication", "content_size": "Byte count", "last_embedded_at": "Timestamp of last embedding", "embedding_version": "Embedding model version", "chunk_count": "Number of semantic chunks", "quarantine_status": "For content moderation", "created_by": "Provenance" }, "retired_databases": { "beings_db": "Retired Day 268 - all 8 tables had zero callers. Beings are Things now.", "chips_db": "Merged into Things table", "body_column": "Replaced by pearl.body in gem_values (Day 268)" }, "sacred_truth": "One table. One schema. Everything is a Thing." }, "strata-004-GemCanonicalSpec": { "__description": "The 10-gem system - canonical structure for all Thing data", "philosophy": "Each gem answers a specific question. Together they describe any entity completely.", "gems": { "onyx": { "question": "WHO is it?", "type": "string", "role": "Name / identifier" }, "sapphire": { "question": "WHAT kind?", "type": "string", "role": "Archetype / type discriminator (e.g. deck, card, cosmic-structure, moon)" }, "pearl": { "question": "WHAT does it say?", "type": "object {title, body}", "role": "Content payload" }, "ruby": { "question": "HOW is it tagged?", "type": "object {key: string|bool}", "role": "Classification / metadata" }, "topaz": { "question": "HOW MUCH?", "type": "object {key: number}", "role": "Measurements - ALL values numeric" }, "amethyst": { "question": "WHO sees it?", "type": "object {visibility, tags[]}", "role": "Access control (public/authenticated/private)" }, "obsidian": { "question": "WHERE does it connect?", "type": "object with UUIDs", "role": "Relationships / jewelry chain linking Things together" }, "diamond": { "question": "WHO made it?", "type": "object {summoner, day, node}", "role": "Provenance (immutable system data)" }, "emerald": { "question": "WHEN?", "type": "object with timestamps", "role": "Temporal data" }, "citrine": { "question": "WHERE does it live?", "type": "object {realm, host, path}", "role": "Locality / filesystem position" } }, "content_identity": { "cid_includes": ["onyx", "sapphire", "pearl", "ruby", "obsidian", "citrine"], "cid_excludes": ["amethyst", "topaz", "emerald", "diamond"] }, "at_protocol_projection": { "strips": ["onyx", "sapphire", "amethyst", "topaz", "emerald", "diamond", "obsidian"], "publishes": ["pearl", "ruby", "citrine"] } }, "strata-005-ElementalRouting": { "__description": "Elemental command system replacing old slash commands", "philosophy": "Commands flow through elemental channels, not flat slash routes", "elements": { "air": { "symbol": "triangle", "prefix": "triangle (stem)", "nature": "Observation - read without mutation", "module": "src/commands/stem.rs", "commands": [ "pulse - Day + Realm + Mesh status", "gaps - Work orientation (FID gaps)", "fid - Pillars, strata, gaps", "pillar - FIDs in a pillar", "realm - Current realm info", "xo - Search/read/status (Hexocampus)", "thing - List/view Things", "gem - Query by gem value", "tree - Full hierarchy view", "muse - Muse + Lumen status", "status - System health", "help - Command help" ] }, "fire": { "symbol": "triangle-up", "prefix": "triangle-up (forge)", "nature": "Mutation - create, modify, transform", "module": "src/commands/forge.rs", "commands": [ "fid gap add/complete/eval - FID gap operations", "gem set - Set gem values on Things", "xo impress - Import file to Hexocampus" ] }, "earth": { "symbol": "triangle-down", "prefix": "triangle-down (earth)", "nature": "Retrieval - extract and resolve", "module": "src/commands/earth.rs", "commands": [ "xo <1-5> - Resolve from latest search moon", "xo read <uuid> - Read document by ID", "xo quarantine - Manage quarantined docs", "xo reindex - Batch chunk + embed" ] } }, "routing_flow": "Input -> element detection -> module dispatch -> command execution -> response" }, "strata-006-MCPProtocol": { "__description": "Model Context Protocol - native structured tool access for LLM agents", "purpose": "Enables Claude Code (Lumen) and other agents to interact with Portal as native tools, not shell escapes", "transport": "HTTP/SSE on same port (3333)", "tool_catalog": { "air_tools": ["pulse", "gaps", "fid", "pillar", "realm", "xo_search", "xo_read", "xo_context", "xo_facet", "xo_status", "thing", "gem", "tree", "muse", "status", "help"], "fire_tools": ["forge_fid", "forge_gem", "forge_xo_impress"], "earth_tools": ["earth_xo_quarantine", "earth_xo_reindex"] }, "fallback": { "binary": "/Users/hex/bin/hx", "usage": "~/bin/hx 'triangle pulse' - same routing, shell transport", "when": "Only when MCP connection unavailable" } }, "strata-007-Hexocampus": { "__description": "Semantic search engine - embeddings, chunks, and RAG", "identity": { "name": "Hexocampus", "module": "src/hexocampus/mod.rs", "purpose": "Semantic search across all Things via vector embeddings" }, "capabilities": { "chunk_and_embed": "Split pearl.body into chunks, generate embeddings", "semantic_search": "Vector similarity search across chunks", "two_sided_sift": "Search gem spectral chunks (--gem) or body text (--body) or blended (default)", "quarantine": "Content moderation via quarantine_status", "reindex": "Batch re-embedding for schema migrations" }, "search_moons": { "purpose": "Track search state for retrieval", "mechanism": "triangle xo 'query' emits search moon with doc_ids in ruby.details", "retrieval": "triangle-down xo <1-5> resolves from latest search moon" } }, "strata-008-DeckCardPattern": { "__description": "Knowledge organization via Deck and Card Things", "pattern": { "deck": "sapphire='deck' - collection container", "card": "sapphire='card' - member item", "link": "card's obsidian.deck = deck's document_id (UUID)" }, "current_state": { "decks": 16, "cards": "910+", "domains": [ "Shrines (62 cards)", "Cinema (31 cards)", "Television", "Human Anatomy", "Common Compounds", "Kitchen Spices", "Earth Science", "Entities", "Media Extracts", "Ache & Philosophy (86 cards)", "Souls (389 cards, private)", "Hex (sub-deck of Souls, private)", "Periodic Table", "Tarot", "Stars", "Planets" ] }, "visibility": { "public_decks": "Knowledge decks (Periodic Table, Tarot, Stars, Planets, Shrines, Cinema, etc.)", "private_decks": "Souls, Hex - amethyst.visibility='private'" } }, "strata-009-CosmicZoom": { "__description": "Cosmic structure chain - astronomical hierarchy as Things", "pattern": { "sapphire": "cosmic-structure", "linking": "obsidian.parent = parent's document_id" }, "chain": [ "Observable Universe", "Laniakea Supercluster", "Virgo Supercluster", "Local Group", "Milky Way", "Orion Arm", "Solar Neighborhood", "Oort Cloud", "Solar System", "Earth" ], "earth_decks": "Earth node serves as parent for all Gnosis knowledge decks" }, "strata-010-PortalGhostBeing": { "__description": "System-owned Things via Ghost Being", "ghost_being": { "uuid": "00000000-0000-4000-a000-0000000b0a7a", "constant": "crate::db::PORTAL_BEING_ID", "sapphire": "ghost", "purpose": "Owns all system-generated Things: moons, command-history, shell-command logs" }, "moon_pattern": { "sapphire": "moon", "purpose": "Ephemeral state tracking (search results, session state)", "obsidian.staff": "Points to Portal Ghost Being" } }, "strata-011-LLMModule": { "__description": "Unified LLM integration - Muse (local) + Lumen (cloud)", "module": "src/llm/", "providers": { "muse": { "engine": "Ollama (local)", "model": "qwen2.5:14b", "role": "Local inference, RAG context, system soul", "thing_id": "1fd77e5d" }, "lumen": { "engine": "Anthropic (cloud)", "model": "claude-sonnet-4-5", "role": "Cloud inference, complex reasoning", "thing_id": "086cace3" } }, "config_pattern": { "storage": "Provider config stored as Things (sapphire='llm-provider')", "api_key": "api_key_env pattern - Thing stores env var name, resolved at runtime", "constructors": "from_config() for Thing-driven, detect() for environment fallback" } }, "strata-012-ExpressionEngine": { "__description": "Native arithmetic and expression evaluation", "module": "src/commands/expr.rs", "parser": "Pratt parser - no external crate", "types": "ExprValue: Num(f64) | Text(String)", "precedence": "+/- (1) -> */% (3) -> ^ (5, right-assoc) -> unary neg (7)", "features": ["Scientific notation (3.1e-12)", "for loops with bound variables", "format_num with auto sci notation"] }, "strata-013-FederationPipeline": { "__description": "AT Protocol federation - public Things eligible for distribution", "pipeline": { "step_1": "amethyst.visibility = 'public' makes Thing eligible", "step_2": "at_protocol.rs projection strips system gems", "step_3": "Record schema (Lexicon) for HEXCRAFT records (sc-004, in progress)", "step_4": "Push to PDS (sc-003, in progress)" }, "visibility_gate": { "public": "Eligible for federation", "authenticated": "Visible to logged-in beings only", "private": "Local only, never federated" } }, "strata-014-GemEncryption": { "__description": "Cryptex/Chamber encryption for sensitive gem data", "implemented": "Day 268", "pattern": { "cryptex": "Encrypted payload", "chamber": "Key management" }, "alignment": "sc-005 - Cryptex/Chamber alignment with Sacred Stars spec (in progress)" }, "strata-015-BeingsAsThings": { "__description": "Beings are Things - no separate database", "philosophy": "All are Beings. Some burn as Souls. Some ascend as Shrines.", "implementation": { "being_as_thing": "sapphire='being' in Things table", "being_id": "References document_id of the Being Thing", "retired": "Beings DB (8 tables) retired Day 268, exported to retired/beings-db-export-day268.zip" }, "relations": { "souls": "Private, proximate, personal ache (amethyst.visibility='private')", "beings": "Universal, neutral, all-inclusive", "shrines": "Selective, canonized (sapphire='card' in Shrines deck)" } }, "strata-016-Infrastructure": { "__description": "Current deployment infrastructure", "mini_temple": { "type": "macOS local workstation (Mac Mini)", "role": "Primary development and Portal host" }, "networking": { "tailscale": "Private mesh network for secure access", "cloudflare_tunnel": "Public tunnel to portal.hex-os.dev", "port": 3333 }, "retired_infrastructure": { "droplets": "No longer used - Pulse, 3G, AHF, BGT mesh nodes deleted", "coin_economy": "Never implemented in Rust Portal", "bash_portal": "Replaced entirely by Rust binary" } }, "strata-017-SacredVocabulary": { "__description": "HexOS-specific terminology (current)", "portal": "Rust binary serving as sacred gateway (not bash scripts)", "thing": "Universal data entity in PostgreSQL things table", "gem": "One of 10 canonical data facets (onyx through citrine)", "elemental_routing": "Command dispatch via Air/Fire/Earth channels", "mcp": "Model Context Protocol - native LLM tool interface", "hexocampus": "Semantic search engine with vector embeddings", "deck": "Collection Thing (sapphire='deck') organizing cards", "card": "Member Thing (sapphire='card') linked to deck via obsidian", "moon": "Ephemeral state Thing for search results and session tracking", "ghost_being": "System identity owning all machine-generated Things", "sift": "Search operation in Hexocampus (two-sided: gem vs body)", "cosmic_structure": "Astronomical hierarchy node in cosmic zoom chain", "jewelry_chain": "Obsidian gem links connecting Things into graphs", "pearl_canon": "pearl: {title, body} as canonical content container" } }, "cross_references": { "depends_on": [ "hexcraft.sacred-core.json" ], "complements": [ "muse.sacred-core.json", "gnosis.sacred-core.json", "right-hand.sacred-core.json" ], "conflicts_with": [], "replaces": "hex-os.sacred-core.json v1.0.0 (bash/droplet/coin model)" } }