Plug-in Rule Modules

Batteries

Pre-built Prolog rule libraries that install into any Logic namespace in one call. Assert your facts, install a battery, and query its predicates immediately — no rules to write, no schemas to define.

Rules are the hard part

Storing facts is easy. Writing the Prolog rules that reason over them — inventory weight limits, quest prerequisite chains, combat resolution — takes time, testing, and domain knowledge. Batteries solve this: curated, tested rule libraries that drop into your namespace and work immediately over the facts you've already asserted.


How It Works

Your Logic Namespace

batteries.install

id: "inventory", namespace: "my-game"

rules asserted into your namespace

Prolog Engine

can_carry/2 · inventory_full/1
carrying_weight/2 · has_item/2
+ your own facts and rules

logic.query

can_carry(player1, legendary_axe)
→ true

Batteries live in the same Prolog engine as your facts. Installed predicates can call your logic.assert facts and combine with your own logic.constrain rules. Install multiple batteries into the same namespace and their predicates interoperate automatically.


Capabilities

🔍

batteries.search

Semantic search over the catalog by description, tag, or predicate name. Find what you need without knowing the exact ID.

📄

batteries.describe

Full predicate reference for any battery — signatures, parameter docs, and example queries — before you install.

batteries.install

Install a single battery into a namespace. Rules are asserted immediately and persist cross-session like any other Logic fact.

📚

batteries.install_many

Install multiple batteries in one call. All predicates share the same namespace and can call each other's rules.

batteries.installed

List active batteries in a namespace with versions and predicate counts.

🗑

batteries.remove

Uninstall a battery and retract its rules. Your own asserted facts are left untouched.


Available batteries

The catalog grows regularly. Search it with batteries.search, browse modules on GitHub ↗, or explore current modules:

Battery Key predicates
fsm
State machine reasoning
fsm_reachable/3, fsm_deterministic/1, fsm_shortest_path/4, fsm_stuck/1
inventory
Items & weight limits
can_carry/2, inventory_full/1, carrying_weight/2
quests
Quest chains & objectives
quest_available/2, next_objective/3, can_turn_in/2
loot-tables
Rarity tiers & drops
drops/2, eligible_loot/2, loot_chance/3
combat
Damage & status effects
effective_damage/4, status_effect_active/2, turn_order/2
progression
XP, levels & prestige
level_for_xp/2, stat_at_level/3, can_prestige/1

Composes with

Batteries extend Logic — installed predicates are queryable via logic.query and participate in logic.constrain rules you define yourself. Chain battery query results through Flow for multi-step pipelines, or pipe into Prism for analysis and reporting.