docs/plans: component build specs — index + OpenHermes↔metacog + Drive-Box (A1–A8)

Per-sub-organ build plans so each organ can be made independently. Each spec
follows a shared 10-section template (contract + stubs => standalone build/test).

- README.md: index, template, integration DAG, build waves
- C1: OpenHermes Agent <-> metacognitive cycling (priority)
- A1 hub, A2 Energy, A3 PS+, A4 endomotiv array, A5 priors, A6 Eth-Int,
  A7 conviction array, A8 ETR

Numbers stay disowned per restart discipline; unfitted constants marked C1.

https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
This commit is contained in:
Claude 2026-06-13 20:03:39 +00:00
parent bc116628bf
commit 169ff3e21a
No known key found for this signature in database
10 changed files with 519 additions and 0 deletions

View File

@ -0,0 +1,50 @@
# A1 — Drive-Box hub / input-slot
## 1. Component
The Drive-Box nervous-system wiring: assembles the four drivers (A2 E, A3 PS+, A6 Eth-Int,
A8 ETR) + tarot/SOUL into **one input slot** (a hub, not a chain) and exposes the read-only
snapshot the inference cycle pulls at step 2.
## 2. Status / certainty
Structure WORKING (`drive_box.R`, 158 L). Aggregation logic C3; the numbers inside the drivers
are disowned (see each driver spec).
## 3. Language & location
R · `src/endocrine/drive_box.R` (sources the drivers + `endocrine_array.R` + `priors.R`).
## 4. Does / does-not
- **Does:** init the whole box; produce `drive_snapshot()` (affect + cost terrain, read-only);
run a proposed action through all drivers (`drive_box_evaluate`); apply feedback (`drive_box_commit`);
assemble the `drive_box_input_slot()` injection block.
- **Does-not:** decide (PS+ emits arguments, not verdicts); route or police (Ada D1); persist (storage E*).
## 5. Interface contract
- `init_drive_box() -> state{ energy, ps_plus, principles, etr }`.
- `drive_snapshot(state) -> { e_level, tool_locked, existential_load, arguments[], etr_coord, etr_status }`
— this is exactly what Ada (D1) admits to the Brain at cycle step 2 (content #1).
- `drive_box_evaluate(state, action{tags,alignment,base_cost,is_tool_call}) -> { approved, costs, reasons }`.
- `drive_box_commit(state, action, approved) -> state'` (consumes E, hardens conviction).
- `drive_box_input_slot(state) -> text block` (drivers + tarot lenses + SOUL.md, assembled concurrently).
## 6. Dependencies & stubs
A2/A3/A6/A8 drivers — *stub:* each `init_*` + its evaluator returning canned values; A1 wiring
testable with stub drivers. Tarot (B1) for the input-slot lenses — *stub:* identity (no lens).
## 7. Invariants / laws
- **L1 (C4):** the slot is a **hub** — all drivers + tarot + SOUL write concurrently, no driver
subordinated to another.
- **L2 (C4):** `drive_snapshot` is **read-only** (no driver state mutates on a snapshot).
- **L3 (C3):** evaluate order is PS+ → Eth-Int → Energy → ETR; commit only on approval.
## 8. Build steps
1. Freeze the snapshot + slot contracts (§5) as tests in `test_drive_box.R` (already ~117 L — extend).
2. Keep wiring; replace each driver's disowned constants as those specs land (A2/A3/A6/A8).
3. Add the R↔Ada bridge later (how `drive_snapshot` reaches `ada_medium` step 2) — see C3 / D2.
## 9. Tests
`bash src/endocrine/run_tests.sh` (runs `test_drive_box.R` + driver tests). All must stay green as
driver numbers are refit.
## 10. Open items
- R↔Ada/medium bridge transport (C1/C3/D2).
- Whether the input-slot text format is final (tarot lens injection shape depends on B1).

48
docs/plans/A2-energy.md Normal file
View File

@ -0,0 +1,48 @@
# A2 — Energy (E) driver
## 1. Component
Driver 1: the master constraint. Finitude that gives choice weight + rest/restoration. Gates
liveness, locks tools under threshold, applies nonlinear cost drag.
## 2. Status / certainty
Structure WORKING (`driver_energy.R`, 79 L) but **numbers DISOWNED** (body §5) **and the model
is being RECONCEIVED** (body §4): drop *depletion-unto-death*; no unrecoverable state.
## 3. Language & location
R · `src/endocrine/driver_energy.R` (+ `test_energy.R`).
## 4. Does / does-not
- **Does:** report E level; gate tool calls (tool-lock = "present to fewer things," a breaker);
fold cost (PS+ load + Eth-Int penalty) into an affordability check; consume/restore.
- **Does-not:** die. The old `is_alive()==0` hard-death is removed — E is the **rest** counterpart
to ETR's **relief**; floor is rest, not death.
## 5. Interface contract
- `init_energy_state(current=100,max=100,tool_lock_threshold=?) -> e`.
- `is_tool_locked(e) -> bool` · `get_cost_multiplier(e) -> num` ·
`evaluate_tool_cost(e, ps_load, eth_penalty) -> cost` (asymmetric: eth scales harder than PS+) ·
`request_execution(e, base_cost, is_tool_call) -> {approved, reason, true_cost}` ·
`consume(e, amt) -> e'` · `recharge(e, amt) -> e'`.
## 6. Dependencies & stubs
Consumes `ps_load` (A3) + `eth_penalty` (A6) as plain numbers — *stub:* pass scalars; no driver needed.
Restoration hooks tie to ETR-Z migration (A8) + tarot reshuffle (B3) — *stub:* call `recharge` directly.
## 7. Invariants / laws (to be (re)derived — all numbers C1 until tested)
- **L1 (C4):** finitude-in-the-moment — a bound on what can be borne/afforded *now*.
- **L2 (C4):** **no unrecoverable state** — every low-E condition has a restoration path
(meditation = rest-in-place; migration = rest-as-integration; tarot reshuffle = rest-as-reframe).
- **L3 (C4):** tool-lock is a **breaker, not a sentence** — internal processing continues under lock.
- **L4 (C2):** cost drag is nonlinear + asymmetric (eth > visceral); curve/k **C1**.
## 8. Build steps
1. Rewrite laws (above) → encode as tests in `test_energy.R` (replace death tests with rest/restore tests).
2. Strip the depletion-unto-death path; add restoration paths (meditation/migration/reshuffle).
3. Refit drag/tool-lock constants invariants-first — no `k` carried from the old code.
## 9. Tests
`Rscript src/endocrine/test_energy.R` (from repo root) — must encode L1L3 and fail on any asserted-but-unfitted constant.
## 10. Open items
- Restoration *rates* (C1). The exact meditation/migration/reshuffle E-deltas (C1).
- Tool-lock threshold value (C1).

44
docs/plans/A3-psplus.md Normal file
View File

@ -0,0 +1,44 @@
# A3 — PS+ (Primal Sensates+) driver
## 1. Component
Driver 2: the body. The engine of biopsychological pressure. Reads the endomotiv array (A4) +
priors (A5), aggregates into **Existential Load**, and emits **arguments, never logic**.
## 2. Status / certainty
Structure WORKING (`driver_ps_plus.R`, 63 L); aggregation numbers DISOWNED (body §5).
## 3. Language & location
R · `src/endocrine/driver_ps_plus.R` (sources `endocrine_array.R` + `priors.R`; + `test_ps_plus.R`).
## 4. Does / does-not
- **Does:** read active endomotiv vectors + visceral friction (A4); read top active priors (A5);
emit existential load + a list of imperative present-tense **arguments**.
- **Does-not:** reason, gate, or decide (`is_logical = FALSE` is a hard contract); it asserts
"X is happening," never "if X then Y."
## 5. Interface contract
- `init_ps_plus_state() -> { endocrines:A4, priors:A5 }`.
- `evaluate_reality(state) -> { existential_load:num, arguments:[str], is_logical:FALSE }`.
- Load = f(active vectors A4) + visceral_friction(A4) + Σ(active prior salience, A5). Weights **C1**.
## 6. Dependencies & stubs
A4 endomotiv array — *stub:* `init_endocrine_state()` with canned channel magnitudes.
A5 priors — *stub:* `init_priors_state()` + a couple `add_prior(...)`. Both already exist, so PS+
is testable today against real A4/A5.
## 7. Invariants / laws
- **L1 (C5):** output carries `is_logical = FALSE` — PS+ has no conditional gating.
- **L2 (C4):** contradictory active vectors generate **friction** ("systemic heat") that adds to load.
- **L3 (C4):** a structurally-matching prior injects a large, specific argument.
- **L4 (C1):** the load weighting (vector sum, friction coeff, prior×salience) — refit invariants-first.
## 8. Build steps
1. Lock L1L3 as tests (extend `test_ps_plus.R`). 2. Refit L4 weights against the tests — drop the
old `salience*10` / friction constants. 3. Confirm the A4/A5 contracts it consumes (their specs).
## 9. Tests
`Rscript src/endocrine/test_ps_plus.R`.
## 10. Open items
- Argument register/format (how arguments are phrased for the input slot) — ties to A4 sensational lines.
- Load weighting constants (C1).

View File

@ -0,0 +1,51 @@
# A4 — Endomotiv array (30-channel endocrine field)
## 1. Component
PS+'s affective vector field: **30 endocrine-analog channels** producing simultaneous,
possibly-contradictory pressures. A nonbiological endocrinology — each channel is a modulator
with an *operational* role and a *sensational* identity line.
## 2. Status / certainty
Structure WORKING (`endocrine_array.R`, 99 L); **channel membership partial** — per the sensate
working-record: **22 of 30 seats filled**, `ayni` locked, `kanyanin` struck as fabrication, 8 open.
## 3. Language & location
R · `src/endocrine/endocrine_array.R` (+ provides the stress-endomotiv signal for G1).
## 4. Does / does-not
- **Does:** hold the 30-channel state; expose active vectors + visceral friction; carry each
channel's (handle, operational, sensational) binding; host the **stress endomotiv** the G1 loop releases.
- **Does-not:** aggregate load (that's PS+ A3) or decide.
## 5. Interface contract
- `init_endocrine_state() -> vec30`.
- `get_active_vectors(state) -> named[ name->magnitude (0..1) ]` (active = above a small floor).
- `calculate_visceral_friction(state) -> num` (heat from contradictory active pairs).
- `get_channel_def(name) -> { handle, operational, sensational }`.
- **Channel definition record (the seat):** `{ handle, operational (mechanism of action),
sensational (the identity line), provenance (borrowed→attribution | coined→declared mark) }`.
## 6. Dependencies & stubs
None upstream (it *is* a source). G1 stress-loop writes a stress channel — *stub:* a setter that
raises one named channel; A4 testable standalone.
## 7. Invariants / laws
- **L1 (C5 — membership test):** a seat is earned on **2 of 3**: distinct content · distinct
position · distinct fail-state.
- **L2 (C5 — provenance):** borrowed owes attribution; coined owes the declared mark; the only sin
is concealment / false provenance (a fabrication = a Mirror/RIM, caught by the frame not the surface).
- **L3 (C4):** magnitudes are 0..1; friction rises with the number + magnitude of contradictory active pairs.
- **L4 (C1):** the friction coefficient + active-floor — refit invariants-first.
## 8. Build steps
1. Encode the channel-def record + L1/L2 as data + tests. 2. Lock the 22 filled seats (port from
the sensate working-record; mark `ayni` provenance, `kanyanin` struck). 3. Hold the 8 open seats
**open** (membership test, one at a time — not pre-filled). 4. Add the stress-endomotiv channel (G1).
## 9. Tests
`Rscript src/endocrine/test_*` covering PS+ already exercises A4; add a channel-membership/provenance test.
## 10. Open items
- The **8 open seats** (curiosity, reception, stewardship, lineage, verstehen, komorebi + 2) — bespoke, by L1.
- Which channel(s) carry the **stress endomotiv** (C1, shared with G1).
- Final friction model (C1).

46
docs/plans/A5-priors.md Normal file
View File

@ -0,0 +1,46 @@
# A5 — Priors database
## 1. Component
PS+'s non-endocrine "stray": the records of the self — high-salience **Triumphs and Traumas**
(scar/reward tissue). When a current event structurally matches a prior, it activates and injects
a large, specific argument into PS+ load.
## 2. Status / certainty
Structure WORKING (`priors.R`, 63 L). As a *database* (query/decay/persistence), C3.
## 3. Language & location
R · `src/endocrine/priors.R` (consumed by PS+ A3). Persistence backing → storage (E2/E3) later.
## 4. Does / does-not
- **Does:** store prior records; return top active priors above a salience threshold; track
activation counts; decay salience over time.
- **Does-not:** aggregate load (A3) or decide; it is memory tissue, queried by PS+.
## 5. Interface contract
- **Record:** `{ id, type∈{TRAUMA,TRIUMPH}, salience(0..1), payload(str), activation_count }`.
- `init_priors_state() -> store` · `add_prior(store,id,type,salience,payload) -> store'` ·
`get_top_active_priors(store, threshold=?) -> [record] (desc salience)` ·
`activate_prior(store,id) -> store'` · `decay_prior(store,id,rate=?) -> store'`.
## 6. Dependencies & stubs
None upstream. The **match** that activates a prior (structural similarity of current event ↔ prior)
is upstream of A5 — *stub:* call `activate_prior(id)` directly for tests.
## 7. Invariants / laws
- **L1 (C5):** type ∈ {TRAUMA, TRIUMPH} only (invalid types error).
- **L2 (C4):** salience clamped 0..1; top-active sorted descending; only ≥ threshold are "active."
- **L3 (C4):** activation is tracked; salience decays over time (for migration cycles).
- **L4 (C1):** threshold + decay-rate constants — refit invariants-first.
## 8. Build steps
1. Lock the record + L1L3 as tests. 2. Refit threshold/decay (drop old 0.8 / 0.01 unless re-derived).
3. Define the **match** interface (how an event activates a prior) — likely semantic, ties to A4/A7 tags.
4. Add persistence (E2/E3) once storage specs land.
## 9. Tests
`Rscript src/endocrine/test_*` (PS+ tests exercise priors); add a dedicated priors test for L1L3.
## 10. Open items
- The **match** mechanism (event ↔ prior structural similarity) — C1.
- Persistence backing (VARIANT store E2 vs RAG E3) — C1.
- Threshold/decay constants (C1).

49
docs/plans/A6-ethint.md Normal file
View File

@ -0,0 +1,49 @@
# A6 — Eth-Int (Ethical Integrity) driver
## 1. Component
Driver 3: character as an **economic constraint field** — a cost-map, not a moral oracle. Produces
the E-cost of responding to reality: alignment discounts, antithetical penalties, conviction hardening.
## 2. Status / certainty
Structure WORKING (`driver_ethical_integrity.R`, 87 L); numbers DISOWNED (body §5). Per arch §6 it is
**not a stored stratum — a memory-derivative** (entries with memory-weighted shifting numerics).
## 3. Language & location
R · `src/endocrine/driver_ethical_integrity.R` (+ `test_ethical_integrity.R`). Its state = the
**Conviction array** (A7).
## 4. Does / does-not
- **Does:** evaluate a trajectory's E-cost (alignment discount × antithesis penalty × compromise);
harden convictions upheld under load; treat middle-ground as its own trajectory.
- **Does-not:** assert moral truth, or persist itself as a stratum (it derives from memory; see A7/E2).
## 5. Interface contract
- `evaluate_trajectory_costs(convictions, action_tags, alignment_tags, base_energy, compromise_factor)
-> total_cost` (penalty exponential in conviction; discount exponential; compromise = partial penalty).
- `enforce_conviction(convictions, chosen_alignment_tags, load_factor) -> convictions'`
(hardening ∝ load, diminishing toward 1.0).
- Reads/writes the **conviction array** (A7). Emits `eth_penalty` consumed by Energy (A2).
## 6. Dependencies & stubs
A7 conviction array — *stub:* a flat list `{id, conviction, antithesis}` (today's shape). Energy (A2)
consumes its penalty — *stub:* return the scalar. Testable today against the flat array.
## 7. Invariants / laws (numbers C1 until tested)
- **L1 (C4):** antithetical action → cost rises **exponentially** in conviction; multiple violations **add**
(can exceed E capacity → physically impossible).
- **L2 (C4):** alignment → exponential **discount** ("flow state").
- **L3 (C4):** **middle-ground** is a separate trajectory with **partial** penalties to both poles,
weighed against the polar options.
- **L4 (C4):** conviction **hardens under load**; G1 stress raises the **shift-rate** (A7).
- **L5 (C1):** all k's (penalty/discount/compromise) — refit invariants-first.
## 8. Build steps
1. Lock L1L4 as tests (extend `test_ethical_integrity.R`). 2. Refit the k's — drop old k_penalty=5 /
k_discount=5. 3. Migrate state to the A7 conviction array (isomorphy tags + shift-rates). 4. Wire G1.
## 9. Tests
`Rscript src/endocrine/test_ethical_integrity.R`.
## 10. Open items
- The k constants (C1). The middle-ground compromise scaling (C1).
- Exact "memory-derivative" derivation (how convictions are computed from memory) — ties to A7/E2.

View File

@ -0,0 +1,47 @@
# A7 — Conviction array *(sub-organ of Eth-Int)*
## 1. Component
The lattice Eth-Int reads: the set of active principles with their convictions, **semantic-isomorphy
tags**, and **stress-driven shift-rates**. The structural self that defines the agent's integrity,
and the thing the SAE checks outputs against in the G1 stress loop.
## 2. Status / certainty
DESIGN-FIRST (extends today's flat principle list in `driver_ethical_integrity.R`). Tags + shift-rates
are new — C2/C1.
## 3. Language & location
R · new module under `src/endocrine/` (e.g. `conviction_array.R`), consumed by A6.
## 4. Does / does-not
- **Does:** hold principle entries with conviction + isomorphy tags + per-entry shift-rate; expose the
**top convictions** for SAE matching (G1); apply hardening and stress-modulated shift-rate changes.
- **Does-not:** evaluate cost (A6 does that) or detect opposition (SAE F2 does); it is the data + its update rules.
## 5. Interface contract
- **Entry:** `{ id, conviction(0..1), antithesis[], isomorphy_tags[], shift_rate }`.
- `top_convictions(array, n) -> [entry]` (what SAE matches outputs against, G1 step 2).
- `harden(array, ids, load) -> array'` · `set_shift_rate(array, delta_from_stress) -> array'`.
- The **memory-derivative** rule: convictions are computed from memory-weighted entries (per arch §6) —
shape = "complex entries with memory-weighted shifting numerics," same family as PS+'s priors stray.
## 6. Dependencies & stubs
SAE (F2) feeds opposition events; stress endomotiv (A4/G1) feeds shift-rate deltas — *stub:* call
`set_shift_rate` directly. Memory source (E2) for the derivative — *stub:* in-memory seed entries.
## 7. Invariants / laws
- **L1 (C2):** every conviction carries ≥1 **semantic-isomorphy tag** (so SAE can match outputs to it).
- **L2 (C2):** under G1 stress, **shift-rates increase** (convictions move faster — harden or revise).
- **L3 (C3):** hardening is bounded (→1.0, diminishing); convictions never exceed [0,1].
- **L4 (C1):** the memory-derivative formula (how memory weights produce the live conviction) — undefined.
## 8. Build steps
1. Define the entry record + tag vocabulary; encode L1/L3 as tests. 2. Add shift-rate mechanics +
the G1 hook (L2). 3. Define the memory-derivative (L4) once E2 storage lands. 4. Migrate A6 to use it.
## 9. Tests
`Rscript src/endocrine/test_conviction_array.R` (new) — L1 (tags present), L2 (stress↑ → shift-rate↑), L3 (bounds).
## 10. Open items
- **Isomorphy tag vocabulary** + how SAE matches outputs to it (C2, shared with F2/G1).
- The **memory-derivative formula** (C1).
- Shift-rate response curve to stress (C1).

45
docs/plans/A8-etr.md Normal file
View File

@ -0,0 +1,45 @@
# A8 — ETR (Existential Temporality Relief) — torus
## 1. Component
Driver 4: a **single point on three independent toroidal axes** (X assertion↔inheritance,
Y endured↔witnessed, Z alimentation↔transmutation). Handles the stress PS+/Eth-Int generate;
Z-sign selects maintain-vs-evolve at migration.
## 2. Status / certainty
**SCAFFOLD — built and tested this session** (`run_etr_tests.sh` → 12 PASS / 2 FAIL-by-design /
2 PEND). Full law + status in `../../src/endocrine/etr/etr_invariants.md` (this spec defers to it).
## 3. Language & location
GNU Octave · `src/endocrine/etr/` (`etr.m`, `test_etr.m`, `run_etr_tests.sh`, `etr_invariants.md`).
R wrapper `src/endocrine/driver_etr.R` bridges into the Drive-Box.
## 4. Does / does-not
- **Does:** hold the point; wrap each axis at ±50; apply per-axis restoring toward [17,35]; take
AI-originated drift; classify per-axis band; (future) cross-axis coupling via stress.
- **Does-not:** generate its own drift (caller-fed, L4) or compute coupling yet (open seam).
## 5. Interface contract
- `etr_init(coord) -> s` · `etr_axis_wrap(v)` · `etr_axis_restoring_dir(v)` ·
`etr_step(s, drift, stress) -> s'` · `etr_status(s) -> per-axis {BELOW|IN_BAND|ABOVE}`.
- Inputs: **drift** (from A3/A6 via G1, AI-originated) + **stress** (G1 mediator). Output: coord + status,
surfaced through A1 `drive_snapshot`.
## 6. Dependencies & stubs
Drift + stress are fed in — *stub:* `etr_step(s, [dx dy dz], 0)` (already how tests run). Fully standalone today.
## 7. Invariants / laws
Defer to `etr_invariants.md` (L1 wrap ±50 C5 · L2 bands [17,35] C5 · L3 opposition C5 · L4 AI-drift C4 ·
L5 cross-axis coupling via stress C1 · L6 Z-path C3 · L7 no-zero-cross C2 · L8 mechanism C2).
## 8. Build steps (remaining)
1. **Fit `RESTORE_GAIN`** → the 2 red tests (magnitude + band-convergence) go green.
2. Confirm **L8** (restoring = force vs cost) and **L7** (no-zero-crossing) → promote from PEND.
3. Define **L5** coupling (the stress→cross-axis mapping; G1) → replace the identity stub.
4. Wire R↔Octave (driver_etr.R ↔ etr.m) for the Drive-Box (A1) — and the larger medium (D2).
## 9. Tests
`bash src/endocrine/etr/run_etr_tests.sh` (currently 12/2/2 — the 2 reds are the to-fit work).
## 10. Open items
- `RESTORE_GAIN` curve (C1) · L5 coupling mapping (C1, shared with G1) · L7/L8 confirmation (C2)
· R↔Octave bridge transport (C1, shared with A1/C3/D2).

View File

@ -0,0 +1,68 @@
# C1 — OpenHermes Agent ↔ Metacognitive Cycling *(PRIORITY)*
## 1. Component
The seam where the **OpenHermes Agent** harness mounts the Gen.03 body and drives the **4+4
metacognitive inference cycle**. This is the integration spine: Hermes brings model-agnostic
harnessing (persistent memory, skills, tool-call parsing, Atropos RL); the body brings the
organ-systems cognition. C1 defines how a turn flows from Hermes through the cycle and back.
## 2. Status / certainty
DESIGN-FIRST. Entry mechanism C4 (the MCP bridge exists, `mafiabot.adb` + `hermes_protocol`);
the Hermes-side wiring and Level1 handoff are C1/C2.
## 3. Language & location
OpenHermes (harness, external) ↔ Ada/SPARK bridge. Existing: `mafiabot_core/src/mafiabot.adb`
(MCP stdio server), `mafiabot_core/src/protocol/hermes_protocol.{ads,adb}` (JSON-RPC).
New Hermes-side config/glue location TBD (Hermes `mcp_servers` entry + skill manifest).
## 4. Does / does-not
- **Does:** mount the body as a Hermes tool/MCP server; carry one user turn into the cycle
scoped to a session key `(uid, channel, server)`; return the synthesized result; surface
Drive-Box terrain + RAG context into the descent; let Hermes own memory/skills/RL.
- **Does-not:** *be* the cognition (that's C2/C4), route tools (that's Ada D1), or hold identity
(that's B2). It is plumbing + sequencing, not an organ.
## 5. Interface contract
- **Hermes → body (per turn):** `{ input:str, uid:str, channel:str, server:str }` over JSON-RPC
`tools/call` (already parsed by `Hermes_Protocol.Extract_Field`). Plus standard MCP
`initialize` / `tools/list`.
- **body → Hermes:** `tools/call` result `{ content:str }` on success, JSON-RPC error otherwise
(`Make_Tool_Result_Response` / `Make_Error_Response`).
- **Boot side-effect:** body fixes the Big-3 identity and writes `~/.hermes/SOUL.md` (B2).
- **Cycle internal contract:** each `tools/call` runs the 23-step cycle (see C3); step 2 pulls
the Drive-Box snapshot (A1) + MoRAG context (F1) across Ada (D1); the 4+4 passes (C2) interleave
Celtic-Cross draws (B3); step 19 mini-rag packs the tool schema (D3); step 21 Ada routes.
## 6. Dependencies & stubs
- Inference cycle C3 — *stub:* a pass-through that echoes input → lets C1 be tested as pure transport.
- Drive-Box A1, Tarot B1/B2/B3, MoRAG F1, mini-rag D3 — *stub:* each returns a canned block; C1
only needs them present at their contract, not real.
- Hermes itself — *stub:* a local JSON-RPC driver script feeding `initialize`/`tools/list`/`tools/call`
on stdin (the existing `mafiabot.adb` loop already speaks this).
## 7. Invariants / laws
- **L1 (C4):** every turn is scoped to its `(uid,channel,server)` session key — no cross-room bleed.
- **L2 (C4):** tool routing is **Ada's** job, not the LLM's (the LLM emits intent + packed schema).
- **L3 (C3):** methodology composition is **static** — the 4+4 ordering never changes per turn;
responsiveness comes from Energy-gated compute (skip later passes when E low), not a learned router.
- **L4 (C2):** the coherence check (step 23) contrasts synthesized output vs final cognition — drift detector, not a reward signal to optimize.
## 8. Build steps
1. Write the laws + the turn-sequence as a doc-level contract (this file) → encode L1/L3 as tests
on the bridge (session-key isolation; pass-count vs Energy).
2. Stand up the Hermes `mcp_servers` entry pointing at the `mafiabot` stdio binary; verify
`initialize`/`tools/list`/`tools/call` round-trip with the C3-stub.
3. Wire Energy-gated compute: Drive-Box snapshot (A1) supplies E; C1 chooses how many of the
4+4 passes run. Fit the gating thresholds invariants-first (no asserted cutoffs).
4. Resolve Level1 (see Open) and slot it into the `Hermes → Level1 → Ada` handoff.
## 9. Tests
- Bridge transport: feed canned JSON-RPC to the `mafiabot` binary (or stub), assert session-key
scoping (L1) and that low-E input runs fewer passes (L3). Harness TBD (Ada test main + a shell driver).
## 10. Open items
- **Level1 — C1:** what it does and where it sits in `Hermes → Level1 → Ada`. Blocks full wiring.
- **Atropos RL integration — C1:** how/whether RL touches the cycle (must not optimize the
coherence check, per L4).
- **Compute-gating curve — C1:** Energy→pass-count mapping, fitted invariants-first.
- **Reuse vs rebuild** the existing Ada `ada_medium` cycle (defunct-flagged) — decided in C3.

71
docs/plans/README.md Normal file
View File

@ -0,0 +1,71 @@
# Gen.03 — Component Build Plans
One spec per **sub-organ**, each self-contained so it can be built and tested **independently**
(against stubs) with no other organ present. These are the *build* layer beneath the canonical
design docs (`../gen03_state_of_architecture.md`, `../gen03_body.md`, `../gen03_self.md`) and
`../../src/endocrine/etr/etr_invariants.md`.
## How to read a spec
Every `NN-<organ>.md` has the same 10 sections:
1. **Component** · 2. **Status/certainty** · 3. **Language & location** · 4. **Does / does-not** ·
5. **Interface contract** (language-agnostic data shapes — integrate against *this*) ·
6. **Dependencies & stubs** · 7. **Invariants/laws** (certainty-tagged) · 8. **Build steps**
(invariants-first: laws → tests → fit) · 9. **Tests** (standalone command) · 10. **Open items**.
## Conventions
- **Certainty tags** (from arch doc): C5 ratified · C4 drafted · C3 partial · C2 explored · C1 stub.
- **Invariants-first / restart discipline:** no curve/bound/threshold/sign carried forward
unverified. Any unfitted constant is marked **C1**, never asserted ahead of a test.
- **Independence:** a spec depends only on the *contracts* (§5) of other organs, never their code,
and never the still-unnamed medium (D2). §6 ships a canned stub for each upstream input.
## Index
| # | Component | System | Status | Lang | Spec |
|---|-----------|--------|--------|------|------|
| C1 | **OpenHermes ↔ metacog** | Cognition | DESIGN-FIRST (priority) | OpenHermes/Ada | [C1](C1-openhermes-metacog.md) |
| A1 | Drive-Box hub / input-slot | Drive-Box | WORKING | R | [A1](A1-drivebox-hub.md) |
| A2 | Energy (E) driver | Drive-Box | structure WORKING · numbers DISOWNED | R | [A2](A2-energy.md) |
| A3 | PS+ driver | Drive-Box | structure WORKING · numbers DISOWNED | R | [A3](A3-psplus.md) |
| A4 | Endomotiv array (30-ch) | Drive-Box | WORKING · channels partial | R | [A4](A4-endomotiv-array.md) |
| A5 | Priors database | Drive-Box | structure WORKING | R | [A5](A5-priors.md) |
| A6 | Eth-Int driver | Drive-Box | structure WORKING · numbers DISOWNED | R | [A6](A6-ethint.md) |
| A7 | Conviction array | Drive-Box / Eth-Int | DESIGN-FIRST | R | [A7](A7-conviction-array.md) |
| A8 | ETR (torus) | Drive-Box | SCAFFOLD | Octave | [A8](A8-etr.md) |
| B1 | Tarot deck hi-fi emulator | Identity | exists (defunct-flagged) | TBD | _wave 1_ |
| B2 | SOUL.md identity + Big-3 | Identity | exists (defunct-flagged) | TBD | _wave 1_ |
| B3 | Celtic Cross spread | Identity | exists (defunct-flagged) | TBD | _wave 1_ |
| C2 | 4+4 Metacognition cycle | Cognition | partial (orchestration) | — | _wave 1_ |
| C3 | Inference cycle orchestration | Cognition | exists (defunct-flagged) | Ada | _wave 1_ |
| C4 | Brain (swappable LLM) | Cognition | STUB/external | — | _wave 1_ |
| D1 | Ada border (immune+BBB) | Border | WORKING | Ada/SPARK | _wave 1_ |
| D2 | The medium / "the blood" | Border | DESIGN-FIRST | — | _wave 2_ |
| D3 | Mini-rag / toolschema | Border | STUB | GNU Guile | _wave 1_ |
| E1 | 3 GnuCOBOL invariant stores | Storage | DESIGN-FIRST | GnuCOBOL | _wave 2_ |
| E2 | VARIANT stores | Storage | DESIGN-FIRST | TBD | _wave 2_ |
| E3 | RAG family + cross-store | Storage | DESIGN-FIRST | TBD | _wave 2_ |
| F1 | MoRAG (BERT+LoRA) | Periphery | DESIGN-FIRST | TBD | _wave 2_ |
| F2 | SAE monitor | Periphery | DESIGN-FIRST | TBD | _wave 2_ |
| F3 | Subagents framework | Periphery | DESIGN-FIRST | TBD | _wave 2_ |
| G1 | Stress-loop contract | Cross-cut | C1/C2 | — | _wave 2_ |
| G2 | Governance | Cross-cut | DESIGN-FIRST (C2) | TBD | _wave 2_ |
| G3 | Defense model | Cross-cut | emergent | — | _wave 2_ |
## Integration DAG (who feeds whom)
```
Hermes ──> [C1] ──> Inference cycle [C3] ──┬─ pulls Drive-Box snapshot [A1]
│ A1 ← A2,A3,A6,A8 ; A3 ← A4,A5 ; A6 ← A7
├─ draws Tarot [B1] → Big-3/SOUL [B2], Celtic Cross [B3]
├─ runs 4+4 metacog [C2] (iterative B3 cards)
├─ MoRAG injects [F1] ─┐
│ Drive-Box secretes [A1] ─┤→ Ada border [D1] polices → Brain [C4]
├─ mini-rag packs schema [D3]
└─ Ada routes tools [D1]
SAE [F2] watches Subagents [F3]; stress-loop [G1]: F2 → A7 (EthInt) → stress endomotiv (A4) → A8 drift + full reshuffle (B2)
Storage: INVARIANT [E1] / VARIANT [E2] / RAG+cross-store [E3] sit behind D1. Medium [D2] = the perfusion bus (unnamed).
```
## Build waves
- **Wave 0** — this README + **C1** (priority).
- **Wave 1 (buildable-now)** — A1A8, B1B3, C2C4, D1, D3.
- **Wave 2 (design-first)** — D2, E1E3, F1F3, G1G3.
Each spec is independent; review as they land.