sica-fondt/docs/plans/F1-morag.md
Claude 20e99f434c
docs/plans: remaining component specs — Identity, Cognition, Border, Storage, Periphery, Cross-cutting
Wave 1 remainder + Wave 2 design-first specs, completing one build plan per sub-organ:
- B1 tarot emulator, B2 SOUL/Big-3, B3 Celtic Cross
- C2 4+4 metacog, C3 inference cycle, C4 Brain
- D1 Ada border, D2 the medium, D3 mini-rag
- E1 3 GnuCOBOL invariant stores, E2 VARIANT stores, E3 RAG family
- F1 MoRAG, F2 SAE monitor, F3 subagents
- G1 stress-loop contract, G2 governance, G3 defense model

Each: contract + stubs for independent build; unfitted constants marked C1.

https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
2026-06-13 20:08:19 +00:00

39 lines
1.9 KiB
Markdown

# F1 — MoRAG (mixture-of-RAG) *(DESIGN-FIRST)*
## 1. Component
The context assembler in the periphery: **BERT** classifies/routes the incoming situation, **LoRAs**
specialise, and it **injects** the assembled context on its way to the inference loop (crossing Ada).
## 2. Status / certainty
DESIGN-FIRST · ABSENT (no code). Role C4; implementation C1.
## 3. Language & location
TBD · new location e.g. `src/morag/`. ML toolchain (BERT classifier + LoRA adapters).
## 4. Does / does-not
- **Does:** classify/route (BERT), specialise (LoRA), assemble + inject context at cycle step 2.
- **Does-not:** police (D1 — and note **modulators like LoRA cross Ada too**, so a poisoned adapter meets
Ada first); decide (C2/C4); hold the memory it draws from (E3).
## 5. Interface contract (proposed)
- `assemble(input, room_ns) -> injected_context` (BERT route → select LoRA(s) → pull E3 RAG → pack).
- Output crosses **Ada (D1)** before reaching the Brain; modulators (LoRA deltas) also pass D1's BBB.
## 6. Dependencies & stubs
E3 RAG (declarative source) — *stub:* fixed context. D1 (crossing) — *stub:* allow-all. Brain C4 consumes injection.
## 7. Invariants / laws
- **L1 (C5):** MoRAG **injects**, Ada **polices** — assembly is the organ's job, admission is Ada's.
- **L2 (C5):** modulators (steering vectors / LoRA) reach the Brain only by clearing Ada's BBB.
- **L3 (C4):** it is a **mixture** — BERT routes among specialised LoRAs.
## 8. Build steps
1. Define the assemble contract. 2. Stand up a BERT router (classify situation → LoRA selection).
3. Wire LoRA adapters + E3 retrieval. 4. Route output through D1 into step-2 enrich (C3).
## 9. Tests
Routing test (situation → expected LoRA); injection crosses a D1 stub; modulator blocked when provenance bad.
## 10. Open items
- Model/adapter choices + hosting (C1). LoRA adapter set (C1). Copyleft posture for ML deps.