sica-fondt/core/docs/plans/A5-priors.md
Claude b6bcab794f
Reorg step 1: consolidate repo under core/, drop the mafiabot label
Mechanical structure-only pass (no document/guide content edits):

- Move src/ichor, src/endocrine, and docs/ into core/; the old top-level
  mafiabot_core/ becomes core/. Everything now lives under a single core/ root.
- Drop the "mafiabot" label from the Ada/Alire crate: core.gpr (project Core),
  alire.toml name = "core"; the generated *_config.* regenerate as core_config.*.
- Repoint build-critical wiring only:
  - .claude/skills/run-sica-fondt/smoke.sh (ponyc + Ada + COBOL paths)
  - core/src/endocrine R source()/runner paths and the test glob
  - .github/workflows/ci.yml (working-directory + gpr name)

Verified green: smoke ALL GREEN (Pony Ichor, Ada core crate + tests, COBOL E1
vault); R endocrine 14/0; Octave ETR 26/0/1.

Deferred (reserved for a less-ephemeral doc/guide pass): docmap.yaml, the guide
files and nested AGENTS.md/README prose + now-stale relative links, SOUL.md, and
the deeper ring/storage restructure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015hmgREHNsxYCuim33yUF2c
2026-06-23 07:46:47 +00:00

2.2 KiB
Raw Blame History

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).
  2. Define the match interface (how an event activates a prior) — likely semantic, ties to A4/A7 tags.
  3. 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).