Belief Revision System - A maximally general framework for managing and revising belief systems
Project description
Belief Revision System (BRS)
A maximally general framework for managing, revising, and reasoning about belief systems.
Overview
BRS provides domain-agnostic infrastructure for:
- Versioned Knowledge Graphs: Immutable, content-addressable storage of nodes, edges, patterns, and world bundles
- Cross-Domain Discovery: Pattern matching via pluggable similarity metrics to find analogies between domains
- Non-Destructive Evaluation: Shadow worlds for hypothesis testing without affecting canonical beliefs
- Pluggable Domain Extensions: Auto-discovered smoke tests and domain-specific validators
Architecture
graph TD
subgraph Extensions["Domain Extensions"]
W["Writing_smoke.py"]
B["Biology_smoke.py"]
Y["Your Domain_smoke.py"]
end
W & B & Y --> R["Registry(auto-discovery)"]
subgraph Core["Core Framework"]
R --> E["Evaluator(smoke tests)"]
D["Discovery(mesh/sim)"] --> E
E --> D
E --> V["Revision(shadow)"]
V --> E
D & E & V --> I["Inference(graph traversal)"]
I --> S["Storage(CAS + SQLite)"]
S --> C["Core(types + utilities)"]
end
Installation
pip install py-brs
For development:
pip install -e .
Quick Start
from pathlib import Path
from brs import CASStore, Node, Edge, Pattern, WorldBundle
# Initialize storage
store = CASStore(Path("./my_knowledge_base"))
# Create a node
node = Node(
id="CONCEPT_A",
name="My Concept",
node_type="primary",
properties={"category": "example"}
)
h = store.put_object("Node", node)
store.upsert_node(node.id, node.name, h)
# Create an edge
edge = Edge(
id="EDGE_1",
parent_id="ROOT",
child_id="CONCEPT_A",
relation="derived_from",
tier=0,
confidence=0.95
)
h = store.put_object("Edge", edge)
store.upsert_edge(edge.id, edge.parent_id, edge.child_id,
edge.relation, edge.tier, edge.confidence, h)
# Create a world bundle
world = WorldBundle(
domain_id="my_domain",
version_label="green",
node_ids=("ROOT", "CONCEPT_A"),
edge_ids=("EDGE_1",),
evidence_ids=(),
pattern_ids=(),
created_utc="2025-01-27T00:00:00Z"
)
store.put_world(world)
# Query ancestry
from brs import best_path_to_any_root
result = best_path_to_any_root(store, "CONCEPT_A", ["ROOT"])
print(result.explanation)
store.close()
Key Concepts
World Bundles
Immutable snapshots of a domain's belief state. Multiple versions can coexist (e.g., "green" for canonical, "_shadow_eval" for testing).
Patterns
Capture invariants and operators that should hold across the domain. Used for cross-domain analog discovery.
Mesh Discovery
Find analogies between domains by comparing pattern signatures using Jaccard similarity or custom metrics.
Shadow Evaluation
Fork a world, apply a proposed change, run smoke tests, and compare maturity—all without affecting canonical beliefs.
Creating Domain Extensions
Add a file brs/domains/my_domain_smoke.py:
DOMAIN_ID = "my_domain"
def run(store, domain_id, world_label):
"""Smoke tests for my domain."""
tests, failures, messages = 0, 0, []
# Your invariant checks here
tests += 1
# if check_something_fails:
# failures += 1
# messages.append("FAIL: ...")
# else:
messages.append("OK: Domain invariants hold")
return (tests, failures, messages)
SMOKE_LEVELS = {
"smoke": run, # Fast checks
"regression": run, # Medium checks
"deep": run, # Expensive checks
}
The domain will be auto-discovered and registered when the brs.domains package is imported.
CLI Usage
# List worlds
brs worlds
# Show domain statistics
brs stats my_domain
# Run smoke tests
brs smoke my_domain --level smoke --verbose
# Discover cross-domain analogs
brs discover domain_a domain_b --min-score 0.3
# Evaluate a proposal
brs evaluate PROPOSAL_ID my_domain --verbose
Components
| Module | Purpose |
|---|---|
core |
Type definitions (Node, Edge, Pattern, WorldBundle, Maturity) |
storage |
Content-addressable SQLite backend |
mesh |
Pattern signatures and similarity metrics |
inference |
Graph traversal (ancestry, reachability) |
revision |
Shadow imports and evaluation |
discovery |
Cross-domain analog suggestion |
evaluator |
Smoke test orchestration |
domains |
Auto-discovered domain extensions |
cli |
Command-line interface |
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_brs-1.3.0.tar.gz.
File metadata
- Download URL: py_brs-1.3.0.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8139fb84c2d3312023518f34206858eb3e20aeb2aa99330958a8c8bb00c39a79
|
|
| MD5 |
56b4bf6d2f07f00d1afe367c7ecada33
|
|
| BLAKE2b-256 |
aba6d867e87b52783faa73a74e24ff7eff3c1874dd0e5ef7eb8dae2bc2668328
|
Provenance
The following attestation bundles were made for py_brs-1.3.0.tar.gz:
Publisher:
release.yml on egoughnour/brs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_brs-1.3.0.tar.gz -
Subject digest:
8139fb84c2d3312023518f34206858eb3e20aeb2aa99330958a8c8bb00c39a79 - Sigstore transparency entry: 864083004
- Sigstore integration time:
-
Permalink:
egoughnour/brs@cb17573a4179369097a5a36b83f2b3297e4eb179 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/egoughnour
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cb17573a4179369097a5a36b83f2b3297e4eb179 -
Trigger Event:
push
-
Statement type:
File details
Details for the file py_brs-1.3.0-py3-none-any.whl.
File metadata
- Download URL: py_brs-1.3.0-py3-none-any.whl
- Upload date:
- Size: 38.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f1166c80e81b01bcca0eb737c14fe391a16b9a1dde30c04d6d2daebff748cc
|
|
| MD5 |
4ed76eff03eb8019174feedbbc8518aa
|
|
| BLAKE2b-256 |
fc1188c3860cad4b905fccee9f109ba8d6fa57d77dc1c3152e259675d6d5f15b
|
Provenance
The following attestation bundles were made for py_brs-1.3.0-py3-none-any.whl:
Publisher:
release.yml on egoughnour/brs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
py_brs-1.3.0-py3-none-any.whl -
Subject digest:
85f1166c80e81b01bcca0eb737c14fe391a16b9a1dde30c04d6d2daebff748cc - Sigstore transparency entry: 864083016
- Sigstore integration time:
-
Permalink:
egoughnour/brs@cb17573a4179369097a5a36b83f2b3297e4eb179 -
Branch / Tag:
refs/tags/v1.3.0 - Owner: https://github.com/egoughnour
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cb17573a4179369097a5a36b83f2b3297e4eb179 -
Trigger Event:
push
-
Statement type: