Batteries Tools
Install pre-built Prolog rule modules into any Logic namespace and query their predicates immediately alongside your own facts.
What are batteries?
A battery is a named collection of Prolog rules that extends a Logic namespace with ready-made predicates. You assert your own entity and attribute facts as usual, then install a battery and its rules operate directly over those facts — no separate data store, no schema migration.
Rules installed by a battery persist in the namespace just like any other fact. They survive across sessions and are shared across all agents on the same server with access to that namespace.
All Batteries tools are available at data-grout@1/batteries.*@1.
batteries.search@1
Semantic search over the batteries catalog. Accepts a natural language description, tag, or predicate name and returns ranked matches.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
query |
string | yes | — | Natural language description of what you need (e.g. “inventory weight and slot constraints”) |
limit |
integer | no | 10 | Maximum results to return |
tags |
array | no | — | Filter by one or more tags (e.g. ["rpg", "items"]) |
Example
{
"name": "data-grout@1/batteries.search@1",
"arguments": {
"query": "quest prerequisites and objective tracking",
"limit": 5
}
}
Response
{
"results": [
{
"id": "quests",
"title": "Quest System",
"description": "Quest availability, prerequisite chains, ordered objective tracking, and turn-in detection.",
"tags": ["quests", "rpg", "progression"],
"predicate_count": 6,
"version": "1.0.0"
}
]
}
batteries.describe@1
Full reference for a specific battery: all predicates with signatures, parameter descriptions, and example queries.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
string | yes | — | Battery identifier (e.g. "inventory", "quests") |
Example
{
"name": "data-grout@1/batteries.describe@1",
"arguments": { "id": "inventory" }
}
Response
{
"id": "inventory",
"title": "Inventory System",
"version": "1.0.0",
"predicates": [
{
"name": "can_carry/2",
"signature": "can_carry(Player, Item)",
"description": "True if Player can carry Item without exceeding weight limit or filling all slots",
"example": "can_carry(player1, sword)"
},
{
"name": "carrying_weight/2",
"signature": "carrying_weight(Player, Weight)",
"description": "Unifies Weight with the total weight of all items Player is currently carrying",
"example": "carrying_weight(player1, W)"
}
]
}
batteries.install@1
Install a single battery into a namespace. The battery’s Prolog rules are asserted immediately and are queryable via logic.query as soon as the call returns.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
string | yes | — | Battery identifier |
namespace |
string | no | "default" |
Logic namespace to install into |
Example
{
"name": "data-grout@1/batteries.install@1",
"arguments": {
"id": "inventory",
"namespace": "my-game"
}
}
Response
{
"installed": "inventory",
"namespace": "my-game",
"predicate_count": 7,
"version": "1.0.0"
}
Querying after install
Once installed, use logic.query with the battery’s predicates directly:
{
"name": "data-grout@1/logic.query@1",
"arguments": {
"goal": "can_carry(player1, legendary_axe)",
"namespace": "my-game"
}
}
batteries.install_many@1
Install multiple batteries in a single call. All batteries share the same namespace, so predicates from different batteries can reference each other.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
ids |
array | yes | — | List of battery identifiers |
namespace |
string | no | "default" |
Logic namespace to install all batteries into |
Example
{
"name": "data-grout@1/batteries.install_many@1",
"arguments": {
"ids": ["inventory", "quests", "loot-tables"],
"namespace": "my-game"
}
}
Response
{
"installed": ["inventory", "quests", "loot-tables"],
"namespace": "my-game",
"total_predicates": 19
}
batteries.installed@1
List all batteries currently installed in a namespace.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
namespace |
string | no | "default" |
Namespace to inspect |
Example
{
"name": "data-grout@1/batteries.installed@1",
"arguments": { "namespace": "my-game" }
}
Response
{
"namespace": "my-game",
"batteries": [
{ "id": "inventory", "version": "1.0.0", "predicate_count": 7, "installed_at": "2026-05-10T14:23:00Z" },
{ "id": "quests", "version": "1.0.0", "predicate_count": 6, "installed_at": "2026-05-10T14:23:01Z" }
]
}
batteries.remove@1
Uninstall a battery and retract all its rules from the namespace. Your own facts are unaffected.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
id |
string | yes | — | Battery identifier |
namespace |
string | no | "default" |
Namespace to remove from |
Example
{
"name": "data-grout@1/batteries.remove@1",
"arguments": {
"id": "loot-tables",
"namespace": "my-game"
}
}
Composing batteries with your own rules
Batteries participate in the same Prolog engine as your logic.assert facts and logic.constrain rules. You can write rules that call battery predicates:
{
"name": "data-grout@1/logic.assert@1",
"arguments": {
"facts": [
{
"type": "rule",
"head": "ready_for_boss(Player)",
"body": "quest_complete(Player, main_quest), can_carry(Player, boss_key), attribute(Player, level, L), L >= 10"
}
],
"namespace": "my-game"
}
}
This rule calls quest_complete/2 from the quests battery and can_carry/2 from the inventory battery, combining them with your own attribute facts.
Available batteries
| ID | Title | Tags | Status |
|---|---|---|---|
inventory |
Inventory System | items, rpg, core | Available |
quests |
Quest System | quests, rpg, progression | Available |
loot-tables |
Loot Tables | items, drops, roguelike | Available |
combat |
Combat System | combat, rpg, action | Coming soon |
progression |
Progression & Leveling | xp, levels, rpg | Coming soon |
economy |
Economy & Crafting | crafting, trading | Coming soon |
npc-state |
NPC State & Dialogue | npc, narrative | Coming soon |
puzzle-fsm |
Puzzle & FSM | puzzle, logic | Coming soon |
Use batteries.search to discover the current full catalog — new batteries are added regularly.