← All tools

Batteries

Pre-built Prolog rule modules that install directly into any Logic namespace. Search the catalog, install with one call, and query the predicates immediately alongside your own facts — no rules to write, no schemas to define.

Why this matters

Logic lets you store and query facts. Batteries extend that with ready-made reasoning — predicate libraries covering inventory systems, quest graphs, combat rules, and more, all installable in one call. Because batteries live in the same Logic namespace as your own facts, installed predicates can reason directly over the entities you've already asserted. Install once and the rules persist cross-session just like any other Logic fact.

Capabilities

  • batteries.search — Semantic search over the catalog by description, tag, or predicate name
  • batteries.describe — Full predicate reference for a specific battery: signatures, parameters, example queries
  • batteries.install — Install a single battery into a namespace — predicates are queryable immediately
  • batteries.install_many — Install multiple batteries in one call; predicates across all batteries share the same namespace
  • batteries.installed — List all batteries currently active in a namespace with version and predicate counts
  • batteries.remove — Uninstall a battery and retract its rules from the namespace
  • batteries.validate — Per-predicate diagnostics: pass/no_data/not_loaded status with missing-fact hints and optional CTC

How batteries compose with your facts

Batteries don't replace your data — they reason over it. Install the inventory battery into a namespace, assert a few entity facts about your players and items, and predicates like can_carry/2, inventory_full/1, and carrying_weight/2 work immediately using your facts as input. The rules never touch a separate store — they run in the same Prolog engine against the same fact space, so they compose naturally with your own logic.constrain rules and logic.query goals.

Example: install and query

// Find available batteries by keyword
{ "name": "data-grout@1/batteries.search@1",
  "arguments": { "query": "inventory weight slots items" }
}

// Install into a namespace — predicates are immediately queryable
{ "name": "data-grout@1/batteries.install@1",
  "arguments": {
    "id": "inventory",
    "namespace": "my-game"
  }
}

// Query an installed predicate directly via logic.query
{ "name": "data-grout@1/logic.query@1",
  "arguments": {
    "goal": "can_carry(player1, sword)",
    "namespace": "my-game"
  }
}

Composes with

Batteries extend Logic — all installed predicates are queryable via logic.query and participate in logic.constrain rules. Use Flow to chain battery queries into multi-step pipelines. Pipe results through Prism for analysis or charting.