From 005c551e0437e1f69482092401a495c411228590 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 10 Jun 2026 04:19:00 +0000 Subject: [PATCH] Add SOUL.md frontloader + wire all drivers and tarot into the input slot SOUL.md: YAML frontloader prepended to every other input -- name slot, version (Gen.03), first-commit unix epoch, and base-7 encoded references to vital file paths (each path's UTF-8 bytes as a big-endian integer in base 7). drive_box.R: drive_box_input_slot() implements the hub topology -- Energy, PS+, Ethical Integrity, ETR, AND the tarot spread each write their signal into one input slot (the Ada Medium Phase_Enrich injection), headed by the SOUL frontloader, with the raw user input appended. Not a chain; every subsystem wires to the input. Endocrine suite now 120 assertions, all green. --- SOUL.md | 38 ++++++++++++++++++++++++++ src/endocrine/drive_box.R | 49 ++++++++++++++++++++++++++++++++++ src/endocrine/test_drive_box.R | 25 +++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 SOUL.md diff --git a/SOUL.md b/SOUL.md new file mode 100644 index 0000000..a70281e --- /dev/null +++ b/SOUL.md @@ -0,0 +1,38 @@ +--- +# SOUL.md — identity frontloader. +# Prepended to every other input (cf. 'included every other input'). +# vital_paths values are each path's UTF-8 bytes read as one big-endian +# integer and rendered in base 7. Decode: digits b7 -> integer -> bytes -> utf-8. +soul: + name: "" # name slot — unassigned + version: 0.3.0 # Gen.03 + soul_schema: 1 + first_commit_epoch: 1780171196 # unix epoch of the repo's first commit + encoding: base7 + vital_paths: + inference_cycle: "10440144244105352536065606211234554456522420204060163555314624546251265221614233602265040255331410123045543542363203345526501164460512415116351" + # ^ mafiabot_core/src/organs/ada_medium/ada_medium.adb — 23-step forward-only cognition; the input slot lives here (Phase_Enrich) + identity_state: "62164515552425052625666315213315333541465524426322641064202150361302125520202140141152615215146500430265054316344166516225104" + # ^ mafiabot_core/src/organs/soul/soul-state.adb — Big-3 anchors + per-session card pool + tarot_spread: "5466234511100463631053506065245264324312153646135360531025414320345220324061142515153505404546031655663544445242133206630253341343342424416405066" + # ^ mafiabot_core/src/organs/soul/soul-celtic_cross.adb — 10-card Celtic Cross; wires into the input slot + trust_boundary: "142326524135245123441266041444631222123353343062025511061366254021505226354324365012250254655013256130231134022066401366" + # ^ mafiabot_core/src/trust/trust_boundary.ads — inbound/outbound screen, provenance, rate limit + mcp_bridge: "33444200663445510352251520452040043235331110102136544026054416510162501511623060163346463013221563442150341622632205166065353163621" + # ^ mafiabot_core/src/protocol/hermes_protocol.adb — MCP stdio JSON-RPC bridge to the Hermes harness + shared_types: "142326524135245123441266041444631222123353343062025511065256302524052040605001020121216631535011151662153634161426141034" + # ^ mafiabot_core/src/types/mafiabot_types.ads — Organ_Id, fixed-point drive types, Operation_Status + drive_box: "50230454343663153046052016452261344130654355125551542606026143630662531" + # ^ src/endocrine/drive_box.R — Drive-Box nervous system; all four drivers wire to the input slot + self: "20254206236001653414" + # ^ SOUL.md — this frontloader; included every other input +--- + +# SOUL + +> Filler body. The operative content is the YAML frontmatter above; this +> document is a *frontloader* — the runtime prepends it to every other input, +> so the model re-grounds in its name, version, origin epoch, and the base-7 +> references to the organs it must keep coherent. The Soul organ overwrites +> the live copy at ~/.hermes/SOUL.md with the current Big-3 each cycle. + diff --git a/src/endocrine/drive_box.R b/src/endocrine/drive_box.R index c3e37d5..4c27660 100644 --- a/src/endocrine/drive_box.R +++ b/src/endocrine/drive_box.R @@ -107,3 +107,52 @@ drive_box_commit <- function(state, evaluation, alignment_tags = character(0)) { } state } + +# --- The Input Slot (hub topology) --- +# All four drivers AND the tarot spread wire into ONE place: the input slot -- +# the enriched context prepended to every model input (the Ada Medium's +# Phase_Enrich injection point). This is a hub, not a chain: each subsystem +# writes its own signal into the slot rather than feeding the next driver. The +# SOUL.md frontloader heads the slot and is included every other input. +# +# Returns: +# slot : the assembled injection block (drivers + tarot + soul ref) +# input : slot followed by the raw user input_text +# components : the individual signal lines (for testing / inspection) +drive_box_input_slot <- function(state, input_text = "", + tarot_spread = character(0), + soul_ref = "SOUL.md") { + snap <- drive_snapshot(state) + lines <- character(0) + + # SOUL frontloader reference (included every other input) + if (nzchar(soul_ref)) { + lines <- c(lines, sprintf("[SOUL: %s]", soul_ref)) + } + # Energy driver -> slot + lines <- c(lines, sprintf("[E ratio=%.2f locked=%s alive=%s]", + snap$energy_ratio, + tolower(as.character(snap$tool_locked)), + tolower(as.character(snap$alive)))) + # PS+ driver -> slot (visceral / systemic-heat / prior arguments) + for (a in snap$arguments) { + lines <- c(lines, sprintf("[PS+ %s]", a)) + } + # Ethical Integrity driver -> slot (principle posture) + for (p in state$ethics$principles) { + lines <- c(lines, sprintf("[ETH %s conviction=%.2f]", p$id, p$conviction)) + } + # ETR driver -> slot (temporal-coherence regime) + lines <- c(lines, sprintf("[ETR status=%s path=%s]", snap$etr_status, snap$update_path)) + # Tarot spread -> slot (each drawn card token) + for (card in tarot_spread) { + lines <- c(lines, sprintf("[CC %s]", card)) + } + + slot <- paste(lines, collapse = "\n") + list( + slot = slot, + input = if (nzchar(input_text)) paste0(slot, "\n\n", input_text) else slot, + components = lines + ) +} diff --git a/src/endocrine/test_drive_box.R b/src/endocrine/test_drive_box.R index 34107b4..946db3c 100644 --- a/src/endocrine/test_drive_box.R +++ b/src/endocrine/test_drive_box.R @@ -89,4 +89,29 @@ test_case("commit on a denied action is a no-op on energy", function() { expect_equal(db$energy$current_energy, before, label = "no consumption when denied") }) +test_case("input slot: every driver + tarot + soul wire into one slot", function() { + db <- prime() + spread <- c("THE_FOOL", "THE_MAGICIAN") + res <- drive_box_input_slot(db, input_text = "who are you", + tarot_spread = spread, soul_ref = "SOUL.md") + expect_true(grepl("[SOUL: SOUL.md]", res$slot, fixed = TRUE), "soul frontloader wired") + expect_true(grepl("[E ratio=", res$slot, fixed = TRUE), "energy wired") + expect_true(any(grepl("^\\[PS\\+ ", res$components)), "ps+ wired") + expect_true(grepl("[ETH honesty conviction=", res$slot, fixed = TRUE), "eth-int wired") + expect_true(grepl("[ETR status=", res$slot, fixed = TRUE), "etr wired") + expect_true(grepl("[CC THE_FOOL]", res$slot, fixed = TRUE), "tarot card 1 wired") + expect_true(grepl("[CC THE_MAGICIAN]", res$slot, fixed = TRUE), "tarot card 2 wired") + # the raw input is appended after the slot + expect_true(grepl("who are you$", res$input), "user input appended after slot") +}) + +test_case("input slot: empty body still emits driver + soul signals", function() { + db <- init_drive_box() + res <- drive_box_input_slot(db, input_text = "", tarot_spread = character(0)) + expect_true(grepl("[SOUL: SOUL.md]", res$slot, fixed = TRUE), "soul present") + expect_true(grepl("[E ratio=1.00", res$slot, fixed = TRUE), "energy present at full") + expect_true(grepl("[ETR status=DISASTROUS", res$slot, fixed = TRUE), "etr present") + expect_equal(res$input, res$slot, label = "no input_text -> input == slot") +}) + test_summary()