CLI Reference¶
Command-line interface for the Mistaber halachic symbolic reasoning system.
Installation¶
The CLI is installed as part of Mistaber:
The command mistaber becomes available in your PATH.
Synopsis¶
Global Options¶
| Option | Short | Type | Default | Description |
|---|---|---|---|---|
--ontology |
-o |
PATH | ./mistaber/ontology |
Path to ontology directory |
--format |
-f |
CHOICE | text |
Output format: text or json |
--help |
Show help message and exit |
Ontology Path¶
The ontology path should point to a directory containing:
- schema/ - Sort and constraint definitions
- base/ - Base ontology files
- worlds/ - World definition files
mistaber --ontology /path/to/ontology query "world(X)"
mistaber -o ./custom_ontology query "world(X)"
Output Format¶
Text format (default): Human-readable output
JSON format: Machine-parseable output
Commands¶
query¶
Query for atoms matching a pattern.
Arguments:
| Argument | Required | Description |
|----------|----------|-------------|
| PATTERN | Yes | ASP atom pattern (e.g., "world(X)", "forbidden(W, A, F, C)") |
Options:
| Option | Short | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --world | -w | STRING | Engine default | World context for the query |
| --check-completeness | | FLAG | False | Check if all required OWA predicates have known values |
| --require-complete | | FLAG | False | Require completeness; return empty if incomplete |
Pattern Syntax:
- Variables are uppercase: X, W, Food, Category
- Constants are lowercase: base, mechaber, achiila
- Predicates: predicate(arg1, arg2, ...)
Examples:
# Query all worlds
mistaber query "world(X)"
# Query with world context
mistaber query "holds(status(item, X), World)" --world mechaber
# Query with completeness check
mistaber query "is_kosher(X)" --check-completeness
# Require complete data
mistaber query "forbidden(food)" --require-complete
# JSON output
mistaber -f json query "world(X)"
Output (text):
Output (JSON):
Completeness Output:
{
"complete": false,
"world": "base",
"query": "is_kosher(chicken)",
"missing_facts": [
{
"predicate": "is_kosher",
"entity": "chicken",
"question": "Is chicken inherently kosher?"
}
],
"results": []
}
compare¶
Compare query results across multiple worlds.
Arguments:
| Argument | Required | Description |
|----------|----------|-------------|
| PATTERN | Yes | ASP atom pattern to compare |
Options:
| Option | Short | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --worlds | -w | STRING | All worlds | Comma-separated list of worlds |
Examples:
# Compare across all worlds
mistaber compare "status(X, Y)"
# Compare specific worlds
mistaber compare "holds(forbidden(item), W)" --worlds "mechaber,rema"
# Short form
mistaber compare "permitted(food)" -w "base,ashk_mb,seph_by"
# JSON output
mistaber -f json compare "status(fish_dairy, X)"
Output (text):
Comparison: status(fish_dairy, X)
=================================
mechaber:
X: sakana
_world: mechaber
rema:
X: mutar
_world: rema
Output (JSON):
analyze¶
Analyze a scenario (push mode).
Arguments:
| Argument | Required | Description |
|----------|----------|-------------|
| SCENARIO | Yes | File path to .lp file OR inline ASP code |
Options:
| Option | Short | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --world | -w | STRING | Engine default | World context for analysis |
Examples:
# Analyze from file
mistaber analyze scenario.lp --world base
# Analyze inline code
mistaber analyze "is_food(chicken). food_cat(chicken, basar)."
# With world context
mistaber analyze my_case.lp -w mechaber
Output (text):
Analysis Results
================
world: mechaber
scenario: is_food(chicken). food_cat(chicken, of).
atoms:
- world(base)
- world(mechaber)
- food(chicken)
- food_type(chicken, of)
- holds(issur(achiila, chicken_milk), mechaber)
Output (JSON):
{
"world": "mechaber",
"atoms": [
"world(base)",
"world(mechaber)",
"food(chicken)",
"food_type(chicken, of)"
],
"scenario": "is_food(chicken). food_cat(chicken, of)."
}
explain¶
Generate an explanation for why an atom holds.
Arguments:
| Argument | Required | Description |
|----------|----------|-------------|
| ATOM | Yes | Atom to explain (e.g., "world(base)", "forbidden(item)") |
Options:
| Option | Short | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --world | -w | STRING | Engine default | World context |
| --facts | -f | STRING | "" | Additional ASP facts |
Examples:
# Explain world existence
mistaber explain "world(base)"
# Explain with world context
mistaber explain "forbidden(fish_dairy)" --world mechaber
# Add additional facts
mistaber explain "permitted(item)" -w rema --facts "is_food(item)."
Output (text):
Explanation: forbidden(beef_milk)
=================================
atom: forbidden(beef_milk)
world: mechaber
using_xclingo: true
explanation:
holds(issur(achiila, beef_milk), mechaber)
<- asserts(mechaber, issur(achiila, beef_milk))
<- is_beheima_chalav_mixture(beef_milk)
<- mixture(beef_milk)
<- contains(beef_milk, beef)
<- contains(beef_milk, milk)
<- food_type(beef, beheima)
<- food_type(milk, chalav)
Output (JSON):
{
"atom": "forbidden(beef_milk)",
"world": "mechaber",
"using_xclingo": true,
"derivation": {
"root": "holds(issur(achiila, beef_milk), mechaber)",
"children": [...]
},
"tree": "holds(issur(achiila, beef_milk), mechaber)\n <- asserts(...)",
"raw_output": "..."
}
machloket¶
Find disputes (machloket) between halachic authorities.
Arguments:
| Argument | Required | Description |
|----------|----------|-------------|
| PATTERN | Yes | ASP pattern to check for disputes |
Options:
| Option | Short | Type | Default | Description |
|--------|-------|------|---------|-------------|
| --worlds | -w | STRING | All worlds | Comma-separated list of worlds |
Examples:
# Find all disputes on status
mistaber machloket "status(X, Y)"
# Check specific topic between authorities
mistaber machloket "status(fish_dairy, X)" --worlds "mechaber,rema"
# Check permitted items
mistaber machloket "permitted(X)" -w "ashk_mb,seph_by"
Output (text):
Disputes Found: 1
========================================
[1] Topic: fish_dairy
Opinions:
mechaber: sakana
rema: mutar
Sources:
mechaber: SA YD 87:3
rema: Darkei Moshe
Output (JSON):
{
"disputes": [
{
"topic": "fish_dairy",
"opinions": {
"mechaber": "sakana",
"rema": "mutar"
},
"sources": {
"mechaber": "SA YD 87:3",
"rema": "Darkei Moshe"
}
}
],
"count": 1
}
No disputes:
Environment Variables¶
The CLI supports environment variable configuration with the MISTABER_ prefix:
| Variable | Description |
|---|---|
MISTABER_ONTOLOGY |
Default ontology path |
MISTABER_FORMAT |
Default output format (text or json) |
Example:
export MISTABER_ONTOLOGY=/path/to/ontology
export MISTABER_FORMAT=json
mistaber query "world(X)" # Uses environment defaults
Configuration File¶
The CLI looks for configuration in:
1. ./mistaber.yaml
2. ~/.config/mistaber/config.yaml
Configuration file format:
# mistaber.yaml
ontology: /path/to/ontology
format: text
# Engine configuration
engine:
default_world: mechaber
interpretation_precedence:
- taz
- shach
safek_resolution: madrega
context: lechatchila
policy:
safek_issur: strict
shiur_system: chazon_ish
minhag_region: ashkenaz
Exit Codes¶
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error (invalid arguments, file not found) |
| 2 | Ontology loading error |
| 3 | Query execution error |
Common Patterns¶
Finding Rulings¶
# What's forbidden in a world?
mistaber query "holds(issur(A, F), W)" -w mechaber
# What's permitted?
mistaber query "holds(heter(A, F), W)" -w rema
Comparing Authorities¶
# How do authorities differ on fish with dairy?
mistaber machloket "status(fish_dairy, X)"
# Compare specific rulings
mistaber compare "holds(issur(achiila, M), W)" -w "mechaber,rema,gra"
Scenario Analysis¶
# What happens with this mixture?
cat > scenario.lp << 'EOF'
mixture(my_mix).
contains(my_mix, chicken).
contains(my_mix, milk).
food_type(chicken, of).
food_type(milk, chalav).
EOF
mistaber analyze scenario.lp -w mechaber
Debugging¶
# Why is something forbidden?
mistaber explain "holds(issur(achiila, beef_milk), mechaber)"
# Check what worlds exist
mistaber query "world(X)"
# Check world inheritance
mistaber query "accessible(X, Y)"
Scripting Examples¶
Bash Script¶
#!/bin/bash
# check_status.sh - Check status of item across authorities
ITEM=$1
echo "Checking status of $ITEM..."
mistaber -f json compare "status($ITEM, X)" | jq .
Python Script¶
#!/usr/bin/env python3
import subprocess
import json
def query_mistaber(pattern):
result = subprocess.run(
["mistaber", "-f", "json", "query", pattern],
capture_output=True,
text=True
)
return json.loads(result.stdout)
results = query_mistaber("world(X)")
for r in results:
print(f"World: {r['X']}")