Extending_Symbolic_Operations - ric-massey/orrin_v3 GitHub Wiki
Extending Symbolic Operations
How to add new symbolic capability — predicates, entity types, causal edges, rules, or a whole new reasoning operation — without breaking the invariants the rest of the system relies on.
Where things live
- World-model entities/predicates and inheritance queries:
brain/symbolic/inference.py. - Causal edges and interventions:
brain/symbolic/causal_graph.py. - Rules (the full lifecycle — synthesis, verification, compression, forgetting):
brain/symbolic/rule_engine.pyand its siblingrule_*.pymodules. - Routing: a new operation must be reachable from
brain/symbolic/reasoning_router.py, otherwise nothing will ever call it.
Ground rules
- Stay symbolic-first. A new operation must work with no LLM configured. If it can optionally
consult the LLM, route that through
brain/symbolic/llm_gate.pyso the global tool-only gate and fail-closed contract apply. - Validate before effect. New rules go through
rule_verifier.py; don't add a path that lets an unverified rule fire. - Persist through the existing stores. Models persist as JSON under
brain/data/— resolve paths viabrain/paths.pyconstants, never hand-built paths. - Record productions. If the operation produces something durable (a new principle, edge, or
resolved experiment), record it via
brain/symbolic/symbolic_effects.pyso it lands on the effect ledger and earns production reward. - Keep it bounded. Anything that accumulates (rules, edges, concepts) needs a decay or
compression path —
rule_forgetting.pyandrule_compressor.pyare the patterns to follow.
Testing
- Unit-test queries and inference behavior under
tests/brain/. make verifymust stay green — it enforces import layering and module size caps in addition to the suite, so a new module that reaches into the wrong layer fails fast.- For behavioral verification,
brain/symbolic/benchmark.pyscores reasoning againstground_truth.py; extend the ground-truth set alongside a new operation.
Code pointers
brain/symbolic/— the whole subsystem, mapped in Symbolic Reasoning Subsystemtests/brain/— existing test patterns to copy